View Javadoc
1 /***************************************************************************** 2 * Virtual Mockup for Machine Vision 3 * Copyright (C) 2001-2003 Fabio R. de Miranda, João E. Kogler Jr., 4 * Carlos S. Santos. 5 * Virtual Mockup for Machine Vision Project funded by SENAC-SP 6 * 7 * Permission is granted to redistribute and/or modify this 8 * software under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License (http://www.gnu.org/copyleft/lesser.html) 16 * for more details. 17 * 18 *****************************************************************************/ 19 20 package camera3d.action; 21 22 23 24 import javax.vecmath.*; 25 import camera3d.GeometryBag; 26 import camera3d.J3DBase; 27 28 /*** 29 * @author Carlos da Silva dos Santos, Fábio de Miranda 30 * @version 1.0 31 */ 32 public class AddLineGizmoAction extends GeometryBagAction { 33 34 private Point3d p1; 35 private Point3d p2; 36 private Vector3d direction; 37 38 public AddLineGizmoAction(Point3d p1, Point3d p2) { 39 this.p1 = p1; 40 this.p2 = p2; 41 this.direction = null; 42 } 43 44 public AddLineGizmoAction(Point3d p1, Vector3d direction){ 45 this.p1 = p1; 46 this.direction = direction; 47 this.p2 = null; 48 } 49 50 public void doAction(ActionExecutor exec){ 51 J3DBase base = exec.getJ3DBase(); 52 if (geometryBag == null){ 53 geometryBag = base.getDefaultGeometryBag(); 54 } 55 if (direction==null){ 56 geometryBag.addLine(p1, p2); 57 } else { 58 geometryBag.addLine(p1, direction); 59 } 60 } 61 }

This page was automatically generated by Maven