001: /*
002: * $RCSfile: NavigationInfo.java,v $
003: *
004: * @(#)NavigationInfo.java 1.23 98/11/05 20:34:46
005: *
006: * Copyright (c) 1996-1998 Sun Microsystems, Inc. All Rights Reserved.
007: *
008: * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
009: * modify and redistribute this software in source and binary code form,
010: * provided that i) this copyright notice and license appear on all copies of
011: * the software; and ii) Licensee does not utilize the software in a manner
012: * which is disparaging to Sun.
013: *
014: * This software is provided "AS IS," without a warranty of any kind. ALL
015: * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
016: * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
017: * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
018: * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
019: * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
020: * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
021: * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
022: * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
023: * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
024: * POSSIBILITY OF SUCH DAMAGES.
025: *
026: * This software is not designed or intended for use in on-line control of
027: * aircraft, air traffic, aircraft navigation or aircraft communications; or in
028: * the design, construction, operation or maintenance of any nuclear
029: * facility. Licensee represents and warrants that it will not use or
030: * redistribute the Software for such purposes.
031: *
032: * $Revision: 1.2 $
033: * $Date: 2005/02/03 23:06:58 $
034: * $State: Exp $
035: */
036: /*
037: * @Author: Rick Goldberg
038: * @Author: Doug Gehringer
039: *
040: */
041: package org.jdesktop.j3d.loaders.vrml97.impl;
042:
043: /** Description of the Class */
044: public class NavigationInfo extends BindableNode {
045:
046: // From BindableNode:
047: //SFBool bind;
048: //SFBool isBound;
049: //SFTime bindTime;
050:
051: // exposedField
052: MFFloat avatarSize;
053: SFBool headlight;
054: SFFloat speed;
055: MFString type;
056: SFFloat visibilityLimit;
057:
058: /**
059: *Constructor for the NavigationInfo object
060: *
061: *@param loader Description of the Parameter
062: */
063: public NavigationInfo(Loader loader) {
064: super (loader, loader.getNavigationInfoStack());
065: String[] navTypes = new String[1];
066: navTypes[0] = new String("EXAMINE");
067: float[] av = new float[3];
068: av[0] = .25f;
069: av[1] = 1.6f;
070: av[2] = .75f;
071: avatarSize = new MFFloat(av);
072: headlight = new SFBool(true);
073: speed = new SFFloat(1.0f);// 0.0f????
074: type = new MFString(navTypes);// really MFString?
075: visibilityLimit = new SFFloat(0.0f);
076: loader.addNavigationInfo(this );
077: initFields();
078: }
079:
080: /**
081: *Constructor for the NavigationInfo object
082: *
083: *@param loader Description of the Parameter
084: *@param bind Description of the Parameter
085: *@param bindTime Description of the Parameter
086: *@param isBound Description of the Parameter
087: *@param avatarSize Description of the Parameter
088: *@param healdlight Description of the Parameter
089: *@param speed Description of the Parameter
090: *@param type Description of the Parameter
091: *@param visibilityLimit Description of the Parameter
092: */
093: public NavigationInfo(Loader loader, SFBool bind, SFTime bindTime,
094: SFBool isBound, MFFloat avatarSize, SFBool healdlight,
095: SFFloat speed, MFString type, SFFloat visibilityLimit) {
096: super (loader, loader.getNavigationInfoStack(), bind, bindTime,
097: isBound);
098: this .bind = bind;
099: this .bindTime = bindTime;
100: this .avatarSize = avatarSize;
101: this .headlight = headlight;
102: this .speed = speed;
103: this .type = type;
104: this .visibilityLimit = visibilityLimit;
105: loader.addNavigationInfo(this );
106: initFields();
107: }
108:
109: /**
110: * Description of the Method
111: *
112: *@param eventInName Description of the Parameter
113: *@param time Description of the Parameter
114: */
115: public void notifyMethod(String eventInName, double time) {
116: if (eventInName.equals("bind")) {
117: super .notifyMethod(eventInName, time);
118: } else {
119: if (!browser.navigationInfoStack.empty()) {
120: NavigationInfo top = (NavigationInfo) browser.navigationInfoStack
121: .peek();
122: if (top == this ) {
123: System.out.println("navigation updateView");
124: browser.updateView();
125: }
126: }
127: }
128: }
129:
130: /**
131: * Gets the type attribute of the NavigationInfo object
132: *
133: *@return The type value
134: */
135: public String getType() {
136: return "NavigationInfo";
137: }
138:
139: /**
140: * Description of the Method
141: *
142: *@return Description of the Return Value
143: */
144: public Object clone() {
145: return new NavigationInfo(loader, (SFBool) bind.clone(),
146: (SFTime) bindTime.clone(), (SFBool) isBound.clone(),
147: (MFFloat) avatarSize.clone(), (SFBool) headlight
148: .clone(), (SFFloat) speed.clone(),
149: (MFString) type.clone(), (SFFloat) visibilityLimit
150: .clone());
151: }
152:
153: /** Description of the Method */
154: void initFields() {
155: initBindableFields();
156: speed.init(this , FieldSpec, Field.EXPOSED_FIELD, "speed");
157: headlight.init(this , FieldSpec, Field.EXPOSED_FIELD,
158: "headlight");
159: avatarSize.init(this , FieldSpec, Field.EXPOSED_FIELD,
160: "avatarSize");
161: type.init(this , FieldSpec, Field.EXPOSED_FIELD, "type");
162: visibilityLimit.init(this , FieldSpec, Field.EXPOSED_FIELD,
163: "visibilityLimit");
164:
165: }
166:
167: }
|