FreeWRL / FreeX3D 4.3.0
FWProfInfo.java
1package sai;
2import org.web3d.x3d.sai.*;
3import java.util.*;
4
5public class FWProfInfo {
6 private static FWProfileInfo profiles[];
7 private static int numProfiles = 0;
8 private static HashMap profileMap;
9 private static final int NUM_COMPONENTS = 24;
10 private static final int NUM_PROFILES = 6;
11 private static FWComponentInfo components[];
12 private static int numComponents = 24;
13 private static HashMap componentMap;
14 private static ProfileInfo temp;
15 private static ComponentInfo temp2;
16
17 static {
18 System.out.println("in static intializer");
19 componentMap = new HashMap();
20 components = new FWComponentInfo[NUM_COMPONENTS];
21 components[0] = new FWComponentInfo("Core", 2, "Core component", "http://www.crc.ca/freewrl");
22 componentMap.put("Core", components[0]);
23 components[1] = new FWComponentInfo("DIS", 1, "DIS component", "http://www.crc.ca/freewrl");
24 componentMap.put("DIS", components[1]);
25 components[2] = new FWComponentInfo("EnvironmentalEffects", 3, "Environmental Effects component", "http://www.crc.ca/freewrl");
26 componentMap.put("EnvironmentalEffects", components[2]);
27 components[3] = new FWComponentInfo("EnvironmentalSensor", 2, "Environmental Sensor component", "http://www.crc.ca/freewrl");
28 componentMap.put("EnvironmentalSensor", components[3]);
29 components[4] = new FWComponentInfo("Geometry2D", 2, "2D Geometry component", "http://www.crc.ca/freewrl");
30 componentMap.put("Geometry2D", components[4]);
31 components[5] = new FWComponentInfo("Geometry3D", 4, "3D Geometry component", "http://www.crc.ca/freewrl");
32 componentMap.put("Geometry3D", components[5]);
33 components[6] = new FWComponentInfo("Geospatial", 1, "Geospatial Rendering component", "http://www.crc.ca/freewrl");
34 componentMap.put("Geospatial", components[6]);
35 components[7] = new FWComponentInfo("Grouping", 3, "Grouping component", "http://www.crc.ca/freewrl");
36 componentMap.put("Grouping", components[7]);
37 components[8] = new FWComponentInfo("H-Anim", 1, "Humanoid Animation component", "http://www.crc.ca/freewrl");
38 componentMap.put("H-Anim", components[8]);
39 components[9] = new FWComponentInfo("Interpolation", 3, "Interpolation component", "http://www.crc.ca/freewrl");
40 componentMap.put("Interpolation", components[9]);
41 components[10] = new FWComponentInfo("KeyDeviceSensor", 2, "Key Device Sensor component", "http://www.crc.ca/freewrl");
42 componentMap.put("KeyDeviceSensor", components[10]);
43 components[11] = new FWComponentInfo("Lighting", 3, "Lighting component", "http://www.crc.ca/freewrl");
44 componentMap.put("Lighting", components[11]);
45 components[12] = new FWComponentInfo("Navigation", 2, "Navigation component", "http://www.crc.ca/freewrl");
46 componentMap.put("Navigation", components[12]);
47 components[13] = new FWComponentInfo("Networking", 3, "Networking component", "http://www.crc.ca/freewrl");
48 componentMap.put("Networking", components[13]);
49 components[14] = new FWComponentInfo("NURBS", 4, "NURBS component", "http://www.crc.ca/freewrl");
50 componentMap.put("NURBS", components[14]);
51 components[15] = new FWComponentInfo("PointingDeviceSensor", 2, "Pointing Device Sensor component", "http://www.crc.ca/freewrl");
52 componentMap.put("PointingDeviceSensor", components[15]);
53 components[16] = new FWComponentInfo("Rendering", 4, "Rendering component", "http://www.crc.ca/freewrl");
54 componentMap.put("Rendering", components[16]);
55 components[17] = new FWComponentInfo("Scripting", 1, "Scripting component", "http://www.crc.ca/freewrl");
56 componentMap.put("Scripting", components[17]);
57 components[18] = new FWComponentInfo("Shape", 3, "Shape component", "http://www.crc.ca/freewrl");
58 componentMap.put("Shape", components[18]);
59 components[19] = new FWComponentInfo("Sound", 1, "Sound component", "http://www.crc.ca/freewrl");
60 componentMap.put("Sound", components[19]);
61 components[20] = new FWComponentInfo("Text", 1, "Text component", "http://www.crc.ca/freewrl");
62 componentMap.put("Text", components[20]);
63 components[21] = new FWComponentInfo("Texturing", 3, "Texturing component", "http://www.crc.ca/freewrl");
64 componentMap.put("Texturing", components[21]);
65 components[22] = new FWComponentInfo("Time", 2, "Time component", "http://www.crc.ca/freewrl");
66 componentMap.put("Time", components[22]);
67 components[23] = new FWComponentInfo("EventUtilities", 1, "Event Utilities component", "http://www.crc.ca/freewrl");
68 componentMap.put("EventUtilities", components[23]);
69
70 System.out.println("finished component init");
71 // set static profile info
72 profileMap = new HashMap();
73 profiles = new FWProfileInfo[NUM_PROFILES];
74 try {
75 FWComponentInfo[] components = new FWComponentInfo[1];
76 components[0] = getComponent("Core", 1);
77 profiles[numProfiles] = new FWProfileInfo("Core", "Core Profile", components);
78 profileMap.put("Core", profiles[numProfiles]);
79 numProfiles++;
80 } catch (Exception e) {
81 System.out.println(e);
82 }
83 System.out.println("finished Core init");
84 try {
85 FWComponentInfo[] components = new FWComponentInfo[12];
86 components[0] = getComponent("Core", 1);
87 components[1] = getComponent("Time", 1);
88 components[2] = getComponent("Networking", 1);
89 components[3] = getComponent("Grouping", 1);
90 components[4] = getComponent("Rendering", 3);
91 components[5] = getComponent("Shape", 1);
92 components[6] = getComponent("Geometry3D", 2);
93 components[7] = getComponent("Lighting", 1);
94 components[8] = getComponent("Texturing", 2);
95 components[9] = getComponent("Interpolation", 2);
96 components[10] = getComponent("Navigation", 1);
97 components[11] = getComponent("EnvironmentalEffects", 1);
98 profiles[numProfiles] = new FWProfileInfo("Interchange", "Interchange profile", components);
99 profileMap.put("Interchange", profiles[numProfiles]);
100 numProfiles++;
101 } catch (Exception e) {
102 System.out.println(e);
103 }
104 System.out.println("finished Interchange init");
105 try {
106 FWComponentInfo[] components = new FWComponentInfo[16];
107 components[0] = getComponent("Core", 1);
108 components[1] = getComponent("Time", 1);
109 components[2] = getComponent("Networking", 1);
110 components[3] = getComponent("Grouping", 2);
111 components[4] = getComponent("Rendering", 2);
112 components[5] = getComponent("Shape", 1);
113 components[6] = getComponent("Geometry3D", 3);
114 components[7] = getComponent("Lighting", 2);
115 components[8] = getComponent("Texturing", 2);
116 components[9] = getComponent("Interpolation", 2);
117 components[10] = getComponent("Navigation", 1);
118 components[11] = getComponent("EnvironmentalEffects", 1);
119 components[12] = getComponent("PointingDeviceSensor", 1);
120 components[13] = getComponent("KeyDeviceSensor", 1);
121 components[14] = getComponent("EnvironmentalSensor", 1);
122 components[15] = getComponent("EventUtilities", 1);
123 profiles[numProfiles] = new FWProfileInfo("Interactive", "Interactive profile", components);
124 profileMap.put("Interactive", profiles[numProfiles]);
125 numProfiles++;
126 } catch (Exception e) {
127 System.out.println(e);
128 }
129 try {
130 FWComponentInfo[] components = new FWComponentInfo[14];
131 components[0] = getComponent("Core", 1);
132 components[1] = getComponent("Time", 1);
133 components[2] = getComponent("Networking", 2);
134 components[3] = getComponent("Grouping", 2);
135 components[4] = getComponent("Rendering", 1);
136 components[5] = getComponent("Shape", 1);
137 components[6] = getComponent("Geometry3D", 2);
138 components[7] = getComponent("Lighting", 2);
139 components[8] = getComponent("Texturing", 1);
140 components[9] = getComponent("Interpolation", 2);
141 components[10] = getComponent("Navigation", 1);
142 components[11] = getComponent("EnvironmentalEffects", 1);
143 components[12] = getComponent("PointingDeviceSensor", 1);
144 components[13] = getComponent("EnvironmentalSensor", 1);
145 profiles[numProfiles] = new FWProfileInfo("MPEG-4", "MPEG-4 Interactive profile", components);
146 profileMap.put("MPEG-4", profiles[numProfiles]);
147 numProfiles++;
148 } catch (Exception e) {
149 System.out.println(e);
150 }
151 try {
152 FWComponentInfo[] components = new FWComponentInfo[20];
153 components[0] = getComponent("Core", 2);
154 components[1] = getComponent("Time", 1);
155 components[2] = getComponent("Networking", 3);
156 components[3] = getComponent("Grouping", 2);
157 components[4] = getComponent("Rendering", 3);
158 components[5] = getComponent("Shape", 2);
159 components[6] = getComponent("Geometry3D", 4);
160 components[7] = getComponent("Lighting", 2);
161 components[8] = getComponent("Texturing", 3);
162 components[9] = getComponent("Interpolation", 2);
163 components[10] = getComponent("Navigation", 2);
164 components[11] = getComponent("EnvironmentalEffects", 2);
165 components[12] = getComponent("PointingDeviceSensor", 1);
166 components[13] = getComponent("KeyDeviceSensor", 2);
167 components[14] = getComponent("EnvironmentalSensor", 2);
168 components[15] = getComponent("EventUtilities", 1);
169 components[16] = getComponent("Geometry2D", 1);
170 components[17] = getComponent("Text", 1);
171 components[18] = getComponent("Sound", 1);
172 components[19] = getComponent("Scripting", 1);
173 profiles[numProfiles] = new FWProfileInfo("Immersive", "Immersive profile", components);
174 profileMap.put("Immersive", profiles[numProfiles]);
175 numProfiles++;
176 } catch (Exception e) {
177 System.out.println(e);
178 }
179 try {
180 FWComponentInfo[] components = new FWComponentInfo[24];
181 components[0] = getComponent("Core", 2);
182 components[1] = getComponent("Time", 2);
183 components[2] = getComponent("Networking", 3);
184 components[3] = getComponent("Grouping", 2);
185 components[4] = getComponent("Rendering", 4);
186 components[5] = getComponent("Shape", 3);
187 components[6] = getComponent("Geometry3D", 4);
188 components[7] = getComponent("Lighting", 3);
189 components[8] = getComponent("Texturing", 3);
190 components[9] = getComponent("Interpolation", 3);
191 components[10] = getComponent("Navigation", 2);
192 components[11] = getComponent("EnvironmentalEffects", 3);
193 components[12] = getComponent("PointingDeviceSensor", 1);
194 components[13] = getComponent("KeyDeviceSensor", 2);
195 components[14] = getComponent("EnvironmentalSensor", 2);
196 components[15] = getComponent("EventUtilities", 1);
197 components[16] = getComponent("Geometry2D", 2);
198 components[17] = getComponent("Text", 1);
199 components[18] = getComponent("Sound", 1);
200 components[19] = getComponent("Scripting", 1);
201 components[20] = getComponent("Geospatial", 1);
202 components[21] = getComponent("H-Anim", 1);
203 components[22] = getComponent("NURBS", 4);
204 components[23] = getComponent("DIS", 1);
205 profiles[numProfiles] = new FWProfileInfo("Full", "Full profile", components);
206 profileMap.put("Full", profiles[numProfiles]);
207 numProfiles++;
208 } catch (Exception e) {
209 System.out.println(e);
210 }
211
212 }
213
214 public static FWProfileInfo getProfile(String name) throws NotSupportedException {
215 temp = (FWProfileInfo) profileMap.get(name);
216 if (temp == null) {
217 throw new NotSupportedException("The profile " + name + " is not currently supported");
218 } else {
219 return (FWProfileInfo) temp;
220 }
221
222 }
223
224 public static FWProfileInfo[] getProfiles() {
225 return profiles;
226 }
227 public static ComponentInfo[] getComponents() {
228 return components;
229 }
230
231 public static FWComponentInfo getComponent(String name, int level) throws NotSupportedException {
232 FWComponentInfo temp;
233
234 temp = (FWComponentInfo) componentMap.get(name);
235 if (temp == null) {
236 throw new NotSupportedException("Component " + name + " at level " + level + " is not supported");
237 } else if (temp.getLevel() >= level) {
238 return temp;
239 } else {
240 throw new NotSupportedException("Component " + name + " at level " + level + " is not supported");
241 }
242 }
243}