Source code: com/xerox/VTM/demo/Introduction.java
1 /* FILE: Introduction.java
2 * DATE OF CREATION: Dec 07 2000
3 * AUTHOR : Emmanuel Pietriga (emmanuel.pietriga@xrce.xerox.com)
4 * MODIF: Tue Aug 05 09:22:07 2003 by Emmanuel Pietriga (emmanuel@w3.org, emmanuel@claribole.net)
5 * Copyright (c) Xerox Corporation, XRCE/Contextual Computing, 2002. All Rights Reserved
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it 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 library 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 for more details.
16 *
17 * For full terms see the file COPYING.
18 */
19
20 package com.xerox.VTM.demo;
21
22 import java.util.Vector;
23 import java.awt.Color;
24 import javax.swing.ImageIcon;
25 import com.xerox.VTM.engine.*;
26 import com.xerox.VTM.glyphs.*;
27 import net.claribole.zvtm.glyphs.*;
28
29 public class Introduction {
30
31 VirtualSpaceManager vsm;
32
33 IntroPanel iPanel;
34
35 AppEventHandler eh;
36
37 String animType="";
38 String animScheme="";
39
40 int camNb=0;
41
42 Introduction(){
43 init();
44 }
45
46 public void init(){
47 vsm=new VirtualSpaceManager();
48 vsm.addVirtualSpace("vs1");
49 vsm.addCamera("vs1");
50 Vector vc1=new Vector();vc1.add(vsm.getVirtualSpace("vs1").getCamera(0));
51 vsm.addView(vc1,"Demo",750,600,false,true);
52 //vsm.getView("Demo").setCursorIcon(java.awt.Cursor.CROSSHAIR_CURSOR);
53 iPanel=new IntroPanel(this);
54 }
55
56 void cameraDemo(){
57 if (vsm.getView("Demo2")!=null){vsm.getView("Demo2").destroyView();}
58 vsm.destroyGlyphsInSpace("vs1");
59 eh=new CameraDemoEvtHdlr(this);
60 vsm.getView("Demo").setEventHandler(eh);
61 float h=0.8f;float s=1.0f;float v=1.0f;
62
63
64 long randomX=0;
65 long randomY=0;
66 long randomS=0;
67 float randomO=0;
68 float randomSat=0;
69 double shapeType=0;
70 Glyph g;
71 float[] vertices={1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f};
72 for (int i=0;i<400;i++){
73 randomX=Math.round(Math.random()*6000);
74 randomY=Math.round(Math.random()*6000);
75 randomS=Math.round(Math.random()*199)+20;
76 randomO=(float)(Math.random()*2*Math.PI);
77 randomSat=(float)Math.random();
78 shapeType=Math.random();
79 if (shapeType<0.2){
80 g=new VTriangleOr(randomX,randomY,0,randomS,Color.getHSBColor(0.66f,randomSat,0.8f),randomO);
81 }
82 else if (shapeType<0.4){
83 g=new VDiamondOr(randomX,randomY,0,randomS,Color.getHSBColor(0.66f,randomSat,0.8f),randomO);
84 }
85 else if (shapeType<0.6){
86 g=new VOctagonOr(randomX,randomY,0,randomS,Color.getHSBColor(0.66f,randomSat,0.8f),randomO);
87 }
88 else if (shapeType<0.8){
89 g=new VRectangleOr(randomX,randomY,0,randomS,randomS,Color.getHSBColor(0.66f,randomSat,0.8f),randomO);
90 }
91 else {
92 g=new VShape(randomX,randomY,0,randomS,vertices,Color.getHSBColor(0.66f,randomSat,0.8f),randomO);
93 }
94 vsm.addGlyph(g,"vs1");
95 }
96
97
98 // for (int i=0;i<20;i++){
99 // for (int j=0;j<20;j++){
100 // Glyph r;
101 // if (i<10){
102 // if (j<10){
103 // r=new VRectangle(-6000+i*500,-6000+j*500,0,200,200,Color.black);
104 // vsm.addGlyph(r,"vs1");
105 // }
106 // else {
107 // r=new VTriangle(-6000+i*500,-6000+j*500,0,200,Color.black);
108 // vsm.addGlyph(r,"vs1");
109 // }
110 // }
111 // else {
112 // if (j<10){
113 // r=new VDiamond(-6000+i*500,-6000+j*500,0,200,Color.black);
114 // vsm.addGlyph(r,"vs1");
115 // }
116 // else {
117 // r=new VOctagon(-6000+i*500,-6000+j*500,0,200,Color.black);
118 // vsm.addGlyph(r,"vs1");
119 // }
120 // }
121 // r.setHSVColor(h,s-(10-i)/10.0f,v-(10-j)/10.0f);
122 // }
123 // }
124 vsm.getGlobalView(vsm.getActiveCamera(),200);
125 }
126
127 void objectFamilies(){
128 vsm.destroyGlyphsInSpace("vs1");
129 eh=new CameraDemoEvtHdlr(this);
130 vsm.getView("Demo").setEventHandler(eh);
131 VRectangle r1=new VRectangle(-600,400,0,100,50,Color.black);
132 VRectangle r2=new VRectangle(-200,400,0,50,50,Color.black);
133 VRectangleOr r3=new VRectangleOr(200,400,0,30,100,Color.black,0.707f);
134 VRectangleST r4=new VRectangleST(600,400,0,100,75,Color.black);
135 r2.setDashed(true);r3.setFill(false);
136 vsm.addGlyph(r1,"vs1");vsm.addGlyph(r2,"vs1");vsm.addGlyph(r3,"vs1");vsm.addGlyph(r4,"vs1");
137 r1.setHSVColor(0.5f,0.9f,0.6f);r2.setHSVColor(0.5f,0.9f,0.6f);r3.setHSVColor(0.5f,0.9f,0.6f);r4.setHSVColor(0.5f,0.9f,0.6f);
138 VTriangleST t1=new VTriangleST(-600,200,0,50,Color.black);
139 VTriangle t2=new VTriangle(-200,200,0,50,Color.black);
140 VTriangle t3=new VTriangle(200,200,0,50,Color.black);
141 VTriangleOrST t4=new VTriangleOrST(600,200,0,75,Color.black,0.707f);
142 t1.setDashed(true);t3.setFill(false);t3.setDashed(true);
143 vsm.addGlyph(t1,"vs1");vsm.addGlyph(t2,"vs1");vsm.addGlyph(t3,"vs1");vsm.addGlyph(t4,"vs1");
144 t1.setHSVColor(0.66f,0.5f,0.5f);t2.setHSVColor(0.66f,0.5f,0.5f);t3.setHSVColor(0.66f,0.5f,0.5f);t4.setHSVColor(0.66f,0.5f,0.5f);
145 VDiamondST d1=new VDiamondST(-600,0,0,50,Color.black);
146 VDiamond d2=new VDiamond(-200,0,0,45,Color.black);
147 VOctagon o3=new VOctagon(200,0,0,50,Color.black);
148 VOctagonOrST o4=new VOctagonOrST(600,0,0,75,Color.black,0.5f);
149 d1.setDashed(true);d2.setFill(false);o3.setDashed(true);
150 vsm.addGlyph(d1,"vs1");vsm.addGlyph(d2,"vs1");vsm.addGlyph(o3,"vs1");vsm.addGlyph(o4,"vs1");
151 d1.setHSVColor(0.0f,0.8f,0.8f);d2.setHSVColor(0.0f,0.8f,0.8f);o3.setHSVColor(0.0f,0.8f,0.8f);o4.setHSVColor(0.0f,0.8f,0.8f);
152 VCircle x1=new VCircle(-600,-200,0,50,Color.black);
153 VSegment x2=new VSegment(-200,-200,0,50,100,Color.black);
154 BooleanOps[] barray={new BooleanOps(0,-20,20,40,1,2),new BooleanOps(0,25,20,40,2,1)};
155 VBoolShape x3=new VBoolShape(200,-200,0,100,50,2,barray,Color.black);
156 VText x4=new VText(560,-200,0,Color.black,"text object");
157 x2.setDashed(true);
158 vsm.addGlyph(x1,"vs1");vsm.addGlyph(x2,"vs1");vsm.addGlyph(x3,"vs1");vsm.addGlyph(x4,"vs1");
159 x4.setSpecialFont(new java.awt.Font("Dialog",0,24));
160 x1.setHSVColor(0.2f,0.55f,0.95f);x2.setHSVColor(0.2f,0.55f,0.95f);x3.setHSVColor(0.2f,0.55f,0.95f);x4.setHSVColor(0.2f,0.55f,0.95f);
161 VImage i1=new VImage(0,-400,0,(new ImageIcon(this.getClass().getResource("/images/xrce.gif"))).getImage());i1.setDrawBorderPolicy(VImage.DRAW_BORDER_MOUSE_INSIDE);
162 vsm.addGlyph(i1,"vs1");
163
164 float[] vs={0.1f,0.5f,0.3f,0.5f,1.0f,0.5f,1.0f,0.5f};
165 VShapeST s1=new VShapeST(-600,-400,0,100,vs,Color.gray,0);vsm.addGlyph(s1,"vs1");
166 float[] vs2={1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f,1.0f,0.8f};
167 VShape s2=new VShape(600,-400,0,100,vs2,Color.gray,0);vsm.addGlyph(s2,"vs1");
168
169 VQdCurve qd1=new VQdCurve(-600,-600,0,100,Color.black,0,50,(float)Math.PI/2);
170 vsm.addGlyph(qd1,"vs1");
171 VQdCurve qd2=new VQdCurve(0,-600,0,100,Color.black,0.707f,100,(float)Math.PI/3);
172 vsm.addGlyph(qd2,"vs1");
173 VCbCurve cb1=new VCbCurve(600,-600,0,100,Color.black,0,50,(float)Math.PI/2,100,(float)-Math.PI/2);
174 vsm.addGlyph(cb1,"vs1");
175 qd2.setHSVColor(0.0f,0.8f,0.8f);
176 cb1.setHSVColor(0.66f,0.5f,0.5f);
177
178 //will be the primary glyph of a CGlyph
179 VRectangleOr cg1=new VRectangleOr(0,-900,0,400,100,Color.white,0);
180 //and 4 secondary glyphs (init coordinates of secondary glyphs do not matter as they will be changed to match the position offset defined in the associated SGlyph)
181 VTriangleOr cg2=new VTriangleOr(0,-800,0,50,Color.red,(float)(-Math.PI/4.0f));
182 VTriangleOr cg3=new VTriangleOr(0,-800,0,50,Color.red,(float)(Math.PI/4.0f));
183 VTriangleOr cg4=new VTriangleOr(0,-800,0,50,Color.red,(float)(-5*Math.PI/4.0f));
184 VTriangleOr cg5=new VTriangleOr(0,-800,0,50,Color.red,(float)(-3*Math.PI/4.0f));
185 vsm.addGlyph(cg1,"vs1");vsm.addGlyph(cg2,"vs1");vsm.addGlyph(cg3,"vs1");vsm.addGlyph(cg4,"vs1");vsm.addGlyph(cg5,"vs1");
186 cg1.setHSVColor(0.66f,0.5f,0.5f);
187 SGlyph[] sgs={
188 new SGlyph(cg2,400,100,SGlyph.FULL_ROTATION,SGlyph.RESIZE),
189 new SGlyph(cg3,-400,100,SGlyph.FULL_ROTATION,SGlyph.RESIZE),
190 new SGlyph(cg4,-400,-100,SGlyph.FULL_ROTATION,SGlyph.RESIZE),
191 new SGlyph(cg5,400,-100,SGlyph.FULL_ROTATION,SGlyph.RESIZE)
192 };
193 CGlyph cg=new CGlyph(cg1,sgs);
194 vsm.addCGlyph(cg,"vs1"); //use addCGlyph, not addGlyph
195 vsm.getGlobalView(vsm.getActiveCamera(),200);
196 }
197
198 void objectAnim(){
199 vsm.destroyGlyphsInSpace("vs1");
200 vsm.destroyVirtualSpace("vs2");
201 VRectangle orG=new VRectangle(400,300,0,25,25,Color.black);
202 orG.setText("orientation");
203 orG.setTextPos(-1);
204 orG.setType("orient");
205 VRectangle szG=new VRectangle(400,100,0,25,25,Color.black);
206 szG.setText("size");
207 szG.setTextPos(-1);
208 szG.setType("size");
209 VRectangle clG=new VRectangle(400,-100,0,25,25,Color.black);
210 clG.setText("color");
211 clG.setTextPos(-1);
212 clG.setType("col");
213 VRectangle trG=new VRectangle(400,-300,0,25,25,Color.black);
214 trG.setText("translation");
215 trG.setTextPos(-1);
216 trG.setType("pos");
217 vsm.addGlyph(orG,"vs1");vsm.addGlyph(szG,"vs1");vsm.addGlyph(clG,"vs1");vsm.addGlyph(trG,"vs1");
218 orG.setHSVColor(0.3f,1.0f,0.6f);szG.setHSVColor(0.3f,1.0f,0.6f);clG.setHSVColor(0.3f,1.0f,0.6f);trG.setHSVColor(0.3f,1.0f,0.6f);
219 VSegment sep=new VSegment(700,0,0,1,300,Color.black);
220 vsm.addGlyph(sep,"vs1");
221 VRectangle linG=new VRectangle(1000,200,0,25,25,Color.black);
222 linG.setText("linear");
223 linG.setTextPos(-1);
224 linG.setType("lin");
225 VRectangle expG=new VRectangle(1000,0,0,25,25,Color.black);
226 expG.setText("exponential");
227 expG.setTextPos(-1);
228 expG.setType("exp");
229 VRectangle sigG=new VRectangle(1000,-200,0,25,25,Color.black);
230 sigG.setText("slow-in/slow-out");
231 sigG.setTextPos(-1);
232 sigG.setType("sig");
233 vsm.addGlyph(linG,"vs1");vsm.addGlyph(expG,"vs1");vsm.addGlyph(sigG,"vs1");
234 linG.setHSVColor(0.3f,1.0f,0.6f);expG.setHSVColor(0.3f,1.0f,0.6f);sigG.setHSVColor(0.3f,1.0f,0.6f);
235 eh=new AnimationEvtHdlr(this,orG,szG,clG,trG,linG,expG,sigG);
236 vsm.getView("Demo").setEventHandler(eh);
237
238 VCircle c1=new VCircle(-400,900,0,100,Color.black);c1.setType("an");
239 VTriangleOr t1=new VTriangleOr(-400,600,0,100,Color.black,0);t1.setType("an");
240 VOctagonOr o1=new VOctagonOr(-400,300,0,100,Color.black,0);o1.setType("an");
241 VRectangleOr r1=new VRectangleOr(-400,0,0,100,50,Color.black,0);r1.setType("an");
242 VDiamondOr d1=new VDiamondOr(-400,-300,0,100,Color.black,0);d1.setType("an");
243 vsm.addGlyph(c1,"vs1");vsm.addGlyph(t1,"vs1");vsm.addGlyph(o1,"vs1");vsm.addGlyph(r1,"vs1");vsm.addGlyph(d1,"vs1");
244 c1.setHSVColor(0.65f,1.0f,1.0f);t1.setHSVColor(0.65f,0.8f,0.8f);o1.setHSVColor(0.65f,0.6f,0.6f);r1.setHSVColor(0.65f,0.4f,0.4f);d1.setHSVColor(0.65f,0.2f,0.2f);
245 VImageOr i1=new VImageOr(-400,-600,0,(new ImageIcon(this.getClass().getResource("/images/xrce.gif"))).getImage(),0.0f);i1.setDrawBorderPolicy(VImage.DRAW_BORDER_MOUSE_INSIDE);
246 vsm.addGlyph(i1,"vs1");i1.setType("an");
247 i1.sizeTo(200);
248 float[] vs={1.0f,0.4f,1.0f,0.4f,0.8f,0.5f,0.3f,1.0f};
249 VShape s1=new VShape(-400,-900,0,100,vs,Color.blue,0);vsm.addGlyph(s1,"vs1");s1.setType("an");
250
251 //will be the primary glyph of a CGlyph
252 VRectangleOr cg1=new VRectangleOr(-400,-1200,0,200,100,Color.black,0);
253 //and 4 secondary glyphs (init coordinates of secondary glyphs do not matter as they will be changed to match the position offset defined in the associated SGlyph)
254 VTriangleOr cg2=new VTriangleOr(0,0,0,50,Color.black,0);
255 VRectangleOrST cg3=new VRectangleOrST(0,0,0,50,50,Color.black,0.404f);
256 VTriangleOrST cg4=new VTriangleOrST(0,0,0,50,Color.black,0.404f);
257 VRectangleOr cg5=new VRectangleOr(0,0,0,50,50,Color.black,0);
258 vsm.addGlyph(cg1,"vs1");vsm.addGlyph(cg2,"vs1");vsm.addGlyph(cg3,"vs1");vsm.addGlyph(cg4,"vs1");vsm.addGlyph(cg5,"vs1");
259 cg1.setType("an");cg2.setType("an");cg3.setType("an");cg4.setType("an");cg5.setType("an");
260 cg1.setHSVColor(0.65f,0.4f,0.4f);
261 cg2.setHSVColor(0.65f,0.8f,0.8f);
262 cg3.setHSVColor(0.65f,0.8f,0.8f);
263 cg4.setHSVColor(0.65f,0.8f,0.8f);
264 cg5.setHSVColor(0.65f,0.8f,0.8f);
265 SGlyph[] sgs={
266 new SGlyph(cg2,200,0,SGlyph.FULL_ROTATION,SGlyph.RESIZE),
267 new SGlyph(cg3,0,100,SGlyph.FULL_ROTATION,SGlyph.RESIZE),
268 new SGlyph(cg4,-200,0,SGlyph.FULL_ROTATION,SGlyph.RESIZE),
269 new SGlyph(cg5,0,-100,SGlyph.FULL_ROTATION,SGlyph.RESIZE)
270 };
271 CGlyph cg=new CGlyph(cg1,sgs);
272 vsm.addCGlyph(cg,"vs1"); //use addCGlyph, not addGlyph
273 vsm.getGlobalView(vsm.getActiveCamera(),200);
274 }
275
276 void animate(Glyph g){
277 if (animType.equals("orient")){
278 if (animScheme.equals("lin")){vsm.animator.createGlyphAnimation(5000,AnimManager.GL_ROT_LIN,new Float(10.0f),g.getID());}
279 else if (animScheme.equals("exp")){vsm.animator.createGlyphAnimation(5000,AnimManager.GL_ROT_PAR,new Float(10.0f),g.getID());}
280 else if (animScheme.equals("sig")){vsm.animator.createGlyphAnimation(5000,AnimManager.GL_ROT_SIG,new Float(10.0f),g.getID());}
281 }
282 else if (animType.equals("size")){
283 if (animScheme.equals("lin")){vsm.animator.createGlyphAnimation(3000,AnimManager.GL_SZ_LIN,new Float(2.0f),g.getID());}
284 else if (animScheme.equals("exp")){vsm.animator.createGlyphAnimation(3000,AnimManager.GL_SZ_PAR,new Float(2.0f),g.getID());}
285 else if (animScheme.equals("sig")){vsm.animator.createGlyphAnimation(3000,AnimManager.GL_SZ_SIG,new Float(2.0f),g.getID());}
286 }
287 else if (animType.equals("col")){
288 Vector v=new Vector();
289 v.add(new Float(0));v.add(new Float(-0.8f));v.add(new Float(-0.6f));v.add(new Boolean(false));
290 vsm.animator.createGlyphAnimation(2000,AnimManager.GL_COLOR_SIG,v,g.getID());
291 v=new Vector();
292 v.add(new Float(0));v.add(new Float(0.8f));v.add(new Float(0.6f));v.add(new Boolean(false));
293 vsm.animator.createGlyphAnimation(2000,AnimManager.GL_COLOR_SIG,v,g.getID());
294 }
295 else if (animType.equals("trans")){
296 if (animScheme.equals("lin")){vsm.animator.createGlyphAnimation(1000,AnimManager.GL_TRANS_LIN,new LongPoint(200,100),g.getID());}
297 else if (animScheme.equals("exp")){vsm.animator.createGlyphAnimation(1000,AnimManager.GL_TRANS_PAR,new LongPoint(200,100),g.getID());}
298 else if (animScheme.equals("sig")){vsm.animator.createGlyphAnimation(1000,AnimManager.GL_TRANS_SIG,new LongPoint(200,100),g.getID());}
299 }
300 }
301
302 void multiLayer(){
303 if (vsm.getView("Demo2")!=null){vsm.getView("Demo2").destroyView();}
304 vsm.destroyGlyphsInSpace("vs1");
305 vsm.getVirtualSpace("vs1").removeCamera(1);
306 vsm.getView("Demo").destroyView();
307 vsm.addVirtualSpace("vs2");
308 vsm.addCamera("vs2");
309 Vector vc1=new Vector();vc1.add(vsm.getVirtualSpace("vs1").getCamera(0));vc1.add(vsm.getVirtualSpace("vs2").getCamera(0));
310 vsm.addView(vc1,"Demo",750,600,false,true);
311 eh=new MultiLayerEvtHdlr(this);
312 vsm.getView("Demo").setEventHandler(eh);
313 VRectangleST g1=new VRectangleST(-2000,0,0,500,500,Color.blue);
314 VTriangleST g2=new VTriangleST(2000,0,0,500,Color.blue);
315 VDiamondST g3=new VDiamondST(0,-2000,0,500,Color.blue);
316 VOctagonST g4=new VOctagonST(0,2000,0,500,Color.blue);
317 float[] vertices={1.0f,0.76f,1.0f,0.76f,1.0f,0.76f,1.0f,0.76f,1.0f,0.76f,1.0f,0.76f,1.0f,0.76f,1.0f,0.76f};
318 VShapeST g5=new VShapeST(0,0,0,200,vertices,Color.blue,0);
319 VCbCurve cb1=new VCbCurve(0,1000,0,300,Color.black,(float)Math.PI/2,200,(float)Math.PI/2,200,(float)-Math.PI/2);
320 VCbCurve cb2=new VCbCurve(1000,0,0,300,Color.black,0,200,(float)Math.PI/2,200,(float)-Math.PI/2);
321 VCbCurve cb3=new VCbCurve(0,-1000,0,300,Color.black,(float)Math.PI/2,200,(float)Math.PI/2,200,(float)-Math.PI/2);
322 VCbCurve cb4=new VCbCurve(-1000,0,0,300,Color.black,0,200,(float)Math.PI/2,200,(float)-Math.PI/2);
323 vsm.addGlyph(g1,"vs2");vsm.addGlyph(g2,"vs2");vsm.addGlyph(g3,"vs2");vsm.addGlyph(g4,"vs2");vsm.addGlyph(g5,"vs2");
324 vsm.addGlyph(cb1,"vs2");vsm.addGlyph(cb2,"vs2");vsm.addGlyph(cb3,"vs2");vsm.addGlyph(cb4,"vs2");
325 VCircle c1=new VCircle(-2000,0,0,500,Color.yellow);
326 VCircle c2=new VCircle(2000,0,0,500,Color.yellow);
327 VCircle c3=new VCircle(0,-2000,0,500,Color.yellow);
328 VCircle c4=new VCircle(0,2000,0,500,Color.yellow);
329 VShapeST c5=new VShapeST(0,0,0,200,vertices,Color.yellow,0);
330 cb1=new VCbCurve(0,1000,0,300,Color.black,(float)Math.PI/2,200,(float)Math.PI/2,200,(float)-Math.PI/2);
331 cb2=new VCbCurve(1000,0,0,300,Color.black,0,200,(float)Math.PI/2,200,(float)-Math.PI/2);
332 cb3=new VCbCurve(0,-1000,0,300,Color.black,(float)Math.PI/2,200,(float)Math.PI/2,200,(float)-Math.PI/2);
333 cb4=new VCbCurve(-1000,0,0,300,Color.black,0,200,(float)Math.PI/2,200,(float)-Math.PI/2);
334 vsm.addGlyph(c1,"vs1");vsm.addGlyph(c2,"vs1");vsm.addGlyph(c3,"vs1");vsm.addGlyph(c4,"vs1");vsm.addGlyph(c5,"vs1");
335 vsm.addGlyph(cb1,"vs1");vsm.addGlyph(cb2,"vs1");vsm.addGlyph(cb3,"vs1");vsm.addGlyph(cb4,"vs1");
336 vsm.getVirtualSpace("vs1").getCamera(0).posx=0;
337 vsm.getVirtualSpace("vs1").getCamera(0).posy=0;
338 vsm.getVirtualSpace("vs1").getCamera(0).setAltitude(800.0f);
339 vsm.getVirtualSpace("vs2").getCamera(0).posx=0;
340 vsm.getVirtualSpace("vs2").getCamera(0).posy=0;
341 vsm.getVirtualSpace("vs2").getCamera(0).setAltitude(800.0f);
342 }
343
344 void multiView(){
345 vsm.destroyGlyphsInSpace("vs1");
346 vsm.destroyVirtualSpace("vs2");
347 eh=new CameraDemoEvtHdlr(this);
348 AppEventHandler eh2=new CameraDemoEvtHdlr(this);
349 vsm.addCamera("vs1");
350 camNb++; //keep track of how many cameras have been created in the virtual space
351 Vector vc1=new Vector();
352 vc1.add(vsm.getVirtualSpace("vs1").getCamera(camNb));
353 vsm.addView(vc1,"Demo2",300,200,false,true);
354 vsm.getView("Demo").setEventHandler(eh);
355 vsm.getView("Demo2").setEventHandler(eh2);
356 vsm.getView("Demo2").setLocation(800,300);
357 VRectangle g1=new VRectangle(200,-200,0,100,50,Color.yellow);
358 VRectangle g2=new VRectangle(200,200,0,100,50,Color.green);
359 VRectangle g3=new VRectangle(-200,-200,0,100,50,Color.red);
360 VRectangle g4=new VRectangle(-200,200,0,100,50,Color.blue);
361 vsm.addGlyph(g1,"vs1");vsm.addGlyph(g2,"vs1");vsm.addGlyph(g3,"vs1");vsm.addGlyph(g4,"vs1");
362 vsm.getGlobalView(vsm.getVirtualSpace("vs1").getCamera(0),200);
363 vsm.getGlobalView(vsm.getVirtualSpace("vs1").getCamera(camNb),200);
364 }
365
366 public static void main(String[] args){
367 System.out.println("-----------------");
368 System.out.println("General information");
369 System.out.println("JVM version: "+System.getProperty("java.vm.vendor")+" "+System.getProperty("java.vm.name")+" "+System.getProperty("java.vm.version"));
370 System.out.println("OS type: "+System.getProperty("os.name")+" "+System.getProperty("os.version")+"/"+System.getProperty("os.arch")+" "+System.getProperty("sun.cpu.isalist"));
371 System.out.println("-----------------");
372 System.out.println("Directory information");
373 System.out.println("Java Classpath: "+System.getProperty("java.class.path"));
374 System.out.println("Java directory: "+System.getProperty("java.home"));
375 System.out.println("Launching from: "+System.getProperty("user.dir"));
376 System.out.println("-----------------");
377 System.out.println("User informations");
378 System.out.println("User name: "+System.getProperty("user.name"));
379 System.out.println("User home directory: "+System.getProperty("user.home"));
380 System.out.println("-----------------");
381 Introduction appli=new Introduction();
382 }
383
384 }