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;
21
22 /*
23 * Title: Câmera Virtual - LIVES
24 * Description: Câmera Virtual para Controle via LabVIEW
25 * Copyright: Copyright (c) 2001
26 * Company: Centro de Educação em Informática - SENAC - SP
27 */
28
29 import java.util.Enumeration;
30 import javax.media.j3d.*;
31
32 /***
33 * Behavior that updates state of a VcLaser. The criterion for waking up the behavior
34 * is the number of elapsed frames.
35 *
36 * @author Carlos da Silva dos Santos
37 * @version 1.0
38 */
39 class VcLaserTraceBehavior extends Behavior implements VcLaserTracer{
40
41 VcLaser laser;
42
43 WakeupCriterion criterion;
44 private boolean retrace = true;
45 private boolean debugflag = false;
46
47
48 /***
49 * Creates new behavior, that wakes up when 20 frames have elapsed.
50 */
51 public VcLaserTraceBehavior(VcLaser laser) {
52 this(laser,20);
53 }
54
55 /***
56 * Creates new behavior, that wakes up when numFrames have elapsed.
57 */
58 public VcLaserTraceBehavior(VcLaser laser, int numFrames) {
59 this.laser = laser;
60 criterion = new WakeupOnElapsedFrames(numFrames);
61 }
62
63 public void debugln(String s) {
64 if(debugflag) System.out.println(s);
65 }
66
67 /***
68 * Method from Behavior class.
69 * Updates position of the laser beam(s).
70 */
71 public void processStimulus(Enumeration parm1) {
72 debugln("TraceBehavior: processStimulus");
73 // using retrace variable will not work if the world changes
74 // and array transform remains the same
75 //if(retrace){
76 debugln("updating");
77 laser.trace();
78 //retrace = false;
79 //}
80 this.wakeupOn(criterion);
81 }
82
83 /***
84 * Method from Behavior class. This method should never be called directly.
85 */
86 public void initialize() {
87 this.wakeupOn(criterion);
88 }
89
90
91 /***
92 * Method from VcLaserTracer interface.
93 * @param enable Regulates operation of behavior.
94 */
95 public void setEnable(boolean enable){
96 super.setEnable(enable);
97 }
98
99
100 /***
101 * Method from VcLaserTracer interface.
102 * @return current state of behavior.
103 */
104 public boolean getEnable(){
105 return super.getEnable();
106 }
107
108
109
110 }
This page was automatically generated by Maven