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 camera3d.VcLaserArray; 25 26 /*** 27 * Action for setting the grid parameters of a given VcLaserArray. 28 * @author Fábio Roberto de Miranda e Carlos da Silva dos Santos 29 * @version 1.0 30 */ 31 public class SetLaserArrayGridAction extends LaserAction { 32 33 private VcLaserArray array; 34 private int nx,ny,oldnx,oldny; 35 private double dx,dy,olddx,olddy; 36 37 /*** 38 * Constructs an action that will change the grid of a given VcLaserArray. 39 * @param array VcLaserArray whose grid will be changed. 40 * @param nx number of laser beams in X direction 41 * @param ny number of laser beams in Y direction 42 * @param dx distance between laser beams in X direction 43 * @param dy distance between laser beams in Y direction 44 */ 45 public SetLaserArrayGridAction(VcLaserArray array, int nx, int ny, double dx, double dy) { 46 this.array= array; 47 this.nx = nx; 48 this.ny = ny; 49 this.dx = dx; 50 this.dy = dy; 51 } 52 53 /*** Changes the grid of the VcLaserArray set at construction. 54 */ 55 public void doAction(ActionExecutor executor) { 56 // provision for undoAction 57 oldnx = array.getXBeams(); 58 oldny = array.getYBeams(); 59 olddx = array.getXDelta(); 60 olddy = array.getYDelta(); 61 array.setGrid(nx,ny,dx,dy); 62 } 63 64 /*** Sets grid back to former values */ 65 public void undoAction(ActionExecutor executor) { 66 array.setGrid(oldnx,oldny,olddx,olddy); 67 } 68 69 }

This page was automatically generated by Maven