Line.java
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright (c) 2012 Stefan Profanter. All rights reserved. This program and the accompanying
00003  * materials are made available under the terms of the GNU Public License v3.0 which accompanies
00004  * this distribution, and is available at http://www.gnu.org/licenses/gpl.html
00005  * 
00006  * Contributors: Stefan Profanter - initial API and implementation, Year: 2012
00007  ******************************************************************************/
00008 package edu.tum.cs.vis.model.util;
00009 
00010 import processing.core.PGraphics;
00011 
00018 public class Line extends DrawObject {
00019 
00023         private static final long       serialVersionUID        = 6189622478733284349L;
00024 
00028         public Line() {
00029                 super(2);
00030         }
00031 
00041         public void draw(PGraphics g, DrawSettings drawSettings) {
00042                 applyColor(g, drawSettings);
00043                 if (drawSettings != null && drawSettings.drawType == DrawType.POINTS) {
00044                         for (int i = 0; i < position.length; i++) {
00045                                 if (position[i].overrideColor != null) {
00046                                         g.stroke(position[i].overrideColor.getRed(),
00047                                                         position[i].overrideColor.getGreen(),
00048                                                         position[i].overrideColor.getBlue());
00049                                         g.noFill();
00050                                 } else if (drawSettings.getOverrideColor() == null && position[i].color != null) {
00051                                         g.stroke(position[i].color.getRed(), position[i].color.getGreen(),
00052                                                         position[i].color.getBlue());
00053                                         g.noFill();
00054                                 }
00055                                 g.point(position[i].x, position[i].y, position[i].z);
00056                         }
00057                 } else
00058                         g.line(position[0].x, position[0].y, position[0].z, position[1].x, position[1].y,
00059                                         position[1].z);
00060         }
00061 }


knowrob_cad_parser
Author(s): Stefan Profanter
autogenerated on Mon Oct 6 2014 01:29:56