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 import java.io.*;
24 import javax.swing.*;
25
26
27
28 /***
29 * A version of the Virtual Camera application without the graphical features, to
30 * be used by external applications.
31 *
32 * @author Fábio Roberto de Miranda
33 * @version 1.0
34 */
35
36 public class GUILessVC implements Serializable {
37
38 transient camera3d.VcApplication vcApplication;
39 transient camera3d.GUIControl guiControl;
40
41 public GUILessVC() {
42 vcApplication = new VcApplication();
43 vcApplication.setBeanMode(true);
44 vcApplication.setVisible(false);
45 this.guiControl = vcApplication.getGUIControl();
46 try {
47 jbInit();
48 }
49 catch(Exception e) {
50 e.printStackTrace();
51 }
52 }
53
54
55 public void initialize(int lookAndFeel, int internalFrames){
56 if (internalFrames ==0){
57 GUIControl.viewportsInJInternalFrames = false;
58 } else {
59 GUIControl.viewportsInJInternalFrames = true;
60 }
61 initialize(lookAndFeel);
62 }
63
64 public void initialize(int lookAndFeel){
65 switch (lookAndFeel){
66 case 0:
67 try {
68 //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
69 UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
70 }
71 catch(Exception e) {
72 e.printStackTrace();
73 }
74 break;
75 case 1:
76 try {
77 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
78 //UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
79 }
80 catch(Exception e) {
81 e.printStackTrace();
82 }
83 break;
84 default:
85 try {
86 //UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
87 UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
88 }
89 catch(Exception e) {
90 e.printStackTrace();
91 }
92 break;
93
94 }
95 vcApplication.setVisible(true);
96
97
98 }
99 private void jbInit() throws Exception {
100 }
101
102 public void close(){
103 vcApplication.close();
104 //guiControl = null;
105 //vcApplication = null;
106 //System.exit(0);
107 }
108
109 public void loadFile(String s){
110 guiControl.loadFile(s);
111 }
112
113 public void addViewport(){
114 guiControl.addViewport();
115 }
116
117 /*
118 * Adds a view with specified name
119 */
120 public void addView(String s){
121 guiControl.addView(s);
122 }
123
124
125
126 /*
127 * Adds a viewport representing the specified view
128 */
129 public void addViewport(String view){
130 guiControl.addViewport(view);
131 }
132
133 /*
134 * Finds the viewport called viewportName and sets it to display the view called
135 * view
136 */
137 public void changeViewInViewport(String viewportName, String view){
138 guiControl.changeViewInViewport(viewportName, view);
139 }
140
141 public void renameVcObject(String oldName, String newName){
142 guiControl.renameVcObject(oldName, newName);
143 }
144
145 public void toggleHelpingGrid(){
146 guiControl.toggleHelpingGrid();
147 }
148
149 public void translateX(String mode, String object, double value){
150 guiControl.translateX(mode, object, value);
151 }
152
153 public void translateY(String mode, String object, double value){
154 guiControl.translateY(mode, object, value);
155 }
156
157 public void translateZ(String mode, String object, double value){
158 guiControl.translateZ(mode, object, value);
159 }
160
161 public void rotateX(String mode, String object, double value){
162 guiControl.rotateX(mode, object, value);
163 }
164
165 public void rotateY(String mode, String object, double value){
166 guiControl.rotateY(mode, object, value);
167 }
168
169 public void rotateZ(String mode, String object, double value){
170 guiControl.rotateZ(mode, object, value);
171 }
172
173 public void scaleX(String mode, String object, double value){
174 guiControl.scaleX(mode, object, value);
175 }
176
177 public void scaleY(String mode, String object, double value){
178 guiControl.scaleY(mode, object, value);
179 }
180
181 public void scaleZ(String mode, String object, double value){
182 guiControl.scaleZ(mode, object, value);
183 }
184
185 public void scale(String mode, String object, double value){
186 guiControl.scale(mode, object, value);
187 }
188
189 public void changeProjectionPolicy(String strView, String strPolicy){
190 guiControl.changeProjectionPolicy(strView, strPolicy);
191 }
192
193 public void changeMovementPolicy(String strView, String strPolicy){
194 guiControl.changeMovementPolicy(strView, strPolicy);
195 }
196
197 public void changeResizePolicy(String strView, String strPolicy){
198 guiControl.changeResizePolicy(strView, strPolicy);
199 }
200
201 public void setFieldOfView(String strView, double d){
202 guiControl.setFieldOfView(strView, d);
203 }
204
205 public void addLight(String type, String name){
206 guiControl.addLight(type, name);
207 }
208
209 public void changeLightColor(String light, int red, int green, int blue){
210 guiControl.changeLightColor(light, red, green, blue);
211 }
212
213 public void changeLightState(String light, int state){
214 guiControl.changeLightState(light, state);
215 }
216
217 public void changeSpotSpreadAngle(String spotName, double angle){
218 guiControl.changeSpotSpreadAngle(spotName, angle);
219 }
220
221 public void changeSpotConcentration(String spotName, double angle){
222 guiControl.changeSpotConcentration(spotName, angle);
223 }
224
225 public void takeJPGSnapshot(String viewname, String filename){
226 guiControl.saveJPGFile(viewname, filename);
227 }
228
229
230 public void takeJPGSnapshot(String filename){
231 guiControl.saveJPGFile(filename);
232 }
233
234 public void frameObjectsInView(String view){
235 guiControl.frameObjectsInView(view);
236 }
237
238
239 public void lookAt(String camera, String object){
240 guiControl.lookAt(camera, object);
241 }
242
243 public void addMeasurer(){
244 guiControl.addDistanceMeasurer();
245 }
246
247 public void setMeasurerDirection(String name, int direction, String axis){
248 guiControl.setMeasurerDirection(name, direction, axis);
249 }
250
251 public double getMeasuredDistance(String measurer){
252 double dist = guiControl.getMeasuredDistance(measurer);
253 return dist;
254 }
255
256 public static void main(String[] args){
257 GUILessVC guil = new GUILessVC();
258 guil.initialize(0);
259 }
260 }
This page was automatically generated by Maven