Revision 1933
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/.cdtproject | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<?eclipse-cdt version="2.0"?> |
|
3 |
|
|
4 |
<cdtproject> |
|
5 |
<data/> |
|
6 |
</cdtproject> |
|
0 | 7 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-ermapper/com/ermapper/util/JNCSWorldPoint.java | ||
---|---|---|
1 |
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov. |
|
2 |
// Jad home page: http://www.kpdus.com/jad.html |
|
3 |
// Decompiler options: packimports(3) |
|
4 |
// Source File Name: JNCSWorldPoint.java |
|
5 |
|
|
6 |
package com.ermapper.util; |
|
7 |
|
|
8 |
|
|
9 |
public class JNCSWorldPoint |
|
10 |
{ |
|
11 |
|
|
12 |
public JNCSWorldPoint() |
|
13 |
{ |
|
14 |
x = 0.0D; |
|
15 |
y = 0.0D; |
|
16 |
z = 0.0D; |
|
17 |
} |
|
18 |
|
|
19 |
public JNCSWorldPoint(double d, double d1) |
|
20 |
{ |
|
21 |
x = d; |
|
22 |
y = d1; |
|
23 |
} |
|
24 |
|
|
25 |
public JNCSWorldPoint(double d, double d1, double d2) |
|
26 |
{ |
|
27 |
x = d; |
|
28 |
y = d1; |
|
29 |
z = d2; |
|
30 |
} |
|
31 |
|
|
32 |
public double x; |
|
33 |
public double y; |
|
34 |
public double z; |
|
35 |
} |
|
0 | 36 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-ermapper/com/ermapper/util/JNCSDatasetPoint.java | ||
---|---|---|
1 |
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov. |
|
2 |
// Jad home page: http://www.kpdus.com/jad.html |
|
3 |
// Decompiler options: packimports(3) |
|
4 |
// Source File Name: JNCSDatasetPoint.java |
|
5 |
|
|
6 |
package com.ermapper.util; |
|
7 |
|
|
8 |
|
|
9 |
public class JNCSDatasetPoint |
|
10 |
{ |
|
11 |
|
|
12 |
public JNCSDatasetPoint() |
|
13 |
{ |
|
14 |
x = 0; |
|
15 |
y = 0; |
|
16 |
} |
|
17 |
|
|
18 |
public JNCSDatasetPoint(int i, int j) |
|
19 |
{ |
|
20 |
x = i; |
|
21 |
y = j; |
|
22 |
} |
|
23 |
|
|
24 |
public int x; |
|
25 |
public int y; |
|
26 |
} |
|
0 | 27 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-ermapper/com/ermapper/ecw/JNCSFile.java | ||
---|---|---|
1 |
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov. |
|
2 |
// Jad home page: http://www.kpdus.com/jad.html |
|
3 |
// Decompiler options: packimports(3) |
|
4 |
// Source File Name: JNCSFile.java |
|
5 |
|
|
6 |
package com.ermapper.ecw; |
|
7 |
|
|
8 |
import com.ermapper.util.JNCSDatasetPoint; |
|
9 |
import com.ermapper.util.JNCSWorldPoint; |
|
10 |
import java.io.FileInputStream; |
|
11 |
import java.io.PrintStream; |
|
12 |
import java.lang.reflect.Field; |
|
13 |
import java.lang.reflect.Method; |
|
14 |
import java.util.Properties; |
|
15 |
|
|
16 |
// Referenced classes of package com.ermapper.ecw: |
|
17 |
// JNCSNativeLibraryException, JNCSFileOpenFailedException, JNCSInvalidSetViewException, JNCSException, |
|
18 |
// JNCSFileNotOpenException, JNCSProgressiveUpdate |
|
19 |
|
|
20 |
public class JNCSFile |
|
21 |
implements JNCSProgressiveUpdate |
|
22 |
{ |
|
23 |
|
|
24 |
private native int ECWOpen(String s, boolean flag); |
|
25 |
|
|
26 |
private native void ECWClose(boolean flag); |
|
27 |
|
|
28 |
private native int ECWSetView(int i, int ai[], int j, int k, int l, int i1, double d, double d1, double d2, double d3, |
|
29 |
int j1, int k1); |
|
30 |
|
|
31 |
private native int ECWReadLineRGBA(int ai[]); |
|
32 |
|
|
33 |
private native int ECWReadImageRGBA(int ai[], int i, int j); |
|
34 |
|
|
35 |
private native short ECWGetPercentComplete(); |
|
36 |
|
|
37 |
private static native String ECWGetErrorString(int i); |
|
38 |
|
|
39 |
private static native int NCSJNIInit(); |
|
40 |
|
|
41 |
private static native String ECWGetLibVersion(); |
|
42 |
|
|
43 |
static void initClass() |
|
44 |
throws JNCSNativeLibraryException |
|
45 |
{ |
|
46 |
boolean flag = false; |
|
47 |
boolean flag1 = false; |
|
48 |
if(bHaveClassInit) |
|
49 |
return; |
|
50 |
if(System.getSecurityManager() != null) |
|
51 |
{ |
|
52 |
Object obj = null; |
|
53 |
String s3 = System.getProperty("java.vendor"); |
|
54 |
if(s3.startsWith("Netscape Communications Corporation")) |
|
55 |
try |
|
56 |
{ |
|
57 |
Class class1 = Class.forName("netscape.security.PrivilegeManager"); |
|
58 |
Class aclass[] = { |
|
59 |
java.lang.String.class |
|
60 |
}; |
|
61 |
Method method = class1.getMethod("enablePrivilege", aclass); |
|
62 |
Object obj1 = class1.newInstance(); |
|
63 |
Object aobj[] = { |
|
64 |
new String("UniversalLinkAccess") |
|
65 |
}; |
|
66 |
Object aobj1[] = { |
|
67 |
new String("UniversalPropertyRead") |
|
68 |
}; |
|
69 |
method.invoke(obj1, aobj); |
|
70 |
method.invoke(obj1, aobj1); |
|
71 |
} |
|
72 |
catch(NoSuchMethodException nosuchmethodexception) |
|
73 |
{ |
|
74 |
System.out.println("GetMethod : ".concat(String.valueOf(String.valueOf(nosuchmethodexception.getMessage())))); |
|
75 |
} |
|
76 |
catch(ClassNotFoundException classnotfoundexception) |
|
77 |
{ |
|
78 |
System.out.println("ClassNotFoundException : ".concat(String.valueOf(String.valueOf(classnotfoundexception.getMessage())))); |
|
79 |
} |
|
80 |
catch(Exception exception4) |
|
81 |
{ |
|
82 |
System.out.println("Netscape Privilige Manager Access Exception : ".concat(String.valueOf(String.valueOf(exception4.getMessage())))); |
|
83 |
} |
|
84 |
else |
|
85 |
if(s3.startsWith("Microsoft Corp.")) |
|
86 |
try |
|
87 |
{ |
|
88 |
Class class2 = Class.forName("com.ms.security.PolicyEngine"); |
|
89 |
Class class3 = Class.forName("com.ms.security.PermissionID"); |
|
90 |
Field field = class3.getField("SYSTEM"); |
|
91 |
Field field1 = class3.getField("FILEIO"); |
|
92 |
Class aclass1[] = { |
|
93 |
class3 |
|
94 |
}; |
|
95 |
Method method1 = class2.getMethod("assertPermission", aclass1); |
|
96 |
Object aobj2[] = { |
|
97 |
field.get(null) |
|
98 |
}; |
|
99 |
Object aobj3[] = { |
|
100 |
field1.get(null) |
|
101 |
}; |
|
102 |
method1.invoke(null, aobj2); |
|
103 |
method1.invoke(null, aobj3); |
|
104 |
} |
|
105 |
catch(NoSuchMethodException nosuchmethodexception1) |
|
106 |
{ |
|
107 |
System.out.println("Microsoft Policy Engine NoSuchMethodException : ".concat(String.valueOf(String.valueOf(nosuchmethodexception1.getMessage())))); |
|
108 |
} |
|
109 |
catch(SecurityException securityexception2) |
|
110 |
{ |
|
111 |
System.out.println("Microsoft Policy Engine SecurityException : ".concat(String.valueOf(String.valueOf(securityexception2.getMessage())))); |
|
112 |
} |
|
113 |
catch(Exception exception5) |
|
114 |
{ |
|
115 |
System.out.println("Microsoft Policy Engine Exception : ".concat(String.valueOf(String.valueOf(exception5.getMessage())))); |
|
116 |
} |
|
117 |
} else |
|
118 |
{ |
|
119 |
flag1 = true; |
|
120 |
} |
|
121 |
try |
|
122 |
{ |
|
123 |
System.loadLibrary("NCSUtil"); |
|
124 |
System.loadLibrary("NCScnet"); |
|
125 |
System.loadLibrary("NCSEcw"); |
|
126 |
bUseNativeMethods = true; |
|
127 |
bUnsatisfiedLink = false; |
|
128 |
} |
|
129 |
catch(UnsatisfiedLinkError unsatisfiedlinkerror) |
|
130 |
{ |
|
131 |
bUseNativeMethods = false; |
|
132 |
bUnsatisfiedLink = true; |
|
133 |
bUseNativeMethods = false; |
|
134 |
debug("Got UnsatisfiedLinkError looking on PATH"); |
|
135 |
} |
|
136 |
catch(SecurityException securityexception) |
|
137 |
{ |
|
138 |
bSecurityError = true; |
|
139 |
bUseNativeMethods = false; |
|
140 |
bUnsatisfiedLink = false; |
|
141 |
debug("Got SecurityException looking on PATH"); |
|
142 |
} |
|
143 |
catch(Exception exception) |
|
144 |
{ |
|
145 |
System.err.println("Unknown error loading ECW native libraries : ".concat(String.valueOf(String.valueOf(exception.getMessage())))); |
|
146 |
bUseNativeMethods = false; |
|
147 |
debug("Got Exception looking on PATH"); |
|
148 |
} |
|
149 |
if(bUseNativeMethods) |
|
150 |
try |
|
151 |
{ |
|
152 |
int i = NCSJNIInit(); |
|
153 |
if(i != 0) |
|
154 |
{ |
|
155 |
System.err.println("JNCSFile classes found on PATH failed to initialize correctly. Attempting to locate other NCS dlls...."); |
|
156 |
} else |
|
157 |
{ |
|
158 |
bHaveClassInit = true; |
|
159 |
return; |
|
160 |
} |
|
161 |
} |
|
162 |
catch(UnsatisfiedLinkError unsatisfiedlinkerror1) |
|
163 |
{ |
|
164 |
debug("Native ECW libraries have been found on the PATH, but could not be loaded. This may be because the version is insufficient to support the Java classes.\nAt least version 1,5,2,0 is required. Attempting to locate other NCS dlls...."); |
|
165 |
} |
|
166 |
catch(Exception exception1) |
|
167 |
{ |
|
168 |
debug("Unknown exception occured initialising ECW native libraries found on the PATH.".concat(String.valueOf(String.valueOf(exception1.getMessage())))); |
|
169 |
} |
|
170 |
if(flag1 && !bUseNativeMethods && !bSecurityError && System.getSecurityManager() != null) |
|
171 |
{ |
|
172 |
Properties properties = new Properties(); |
|
173 |
String s4 = null; |
|
174 |
String s5 = null; |
|
175 |
try |
|
176 |
{ |
|
177 |
String s6 = System.getProperty("user.home"); |
|
178 |
s5 = System.getProperty("file.separator"); |
|
179 |
FileInputStream fileinputstream = new FileInputStream(String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String.valueOf(s6)))).append(s5).append("jncsclasses.properties")))); |
|
180 |
properties.load(fileinputstream); |
|
181 |
s4 = properties.getProperty("clientDLLPath"); |
|
182 |
} |
|
183 |
catch(Exception exception6) |
|
184 |
{ |
|
185 |
s4 = null; |
|
186 |
} |
|
187 |
try |
|
188 |
{ |
|
189 |
if(s4 != null) |
|
190 |
{ |
|
191 |
System.load(String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String.valueOf(s4)))).append(s5).append("NCSUtil.dll")))); |
|
192 |
System.load(String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String.valueOf(s4)))).append(s5).append("NCScnet.dll")))); |
|
193 |
System.load(String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String.valueOf(s4)))).append(s5).append("NCSEcw.dll")))); |
|
194 |
bUseNativeMethods = true; |
|
195 |
bUnsatisfiedLink = false; |
|
196 |
bSecurityError = false; |
|
197 |
} |
|
198 |
} |
|
199 |
catch(SecurityException securityexception3) |
|
200 |
{ |
|
201 |
bSecurityError = true; |
|
202 |
bUseNativeMethods = false; |
|
203 |
bUnsatisfiedLink = false; |
|
204 |
debug("Got security exception looking on clientDLLPath"); |
|
205 |
} |
|
206 |
catch(RuntimeException runtimeexception1) |
|
207 |
{ |
|
208 |
System.out.println(runtimeexception1.getMessage()); |
|
209 |
bUseNativeMethods = false; |
|
210 |
bUnsatisfiedLink = true; |
|
211 |
debug("Got RuntimeException looking on clientDLLPath"); |
|
212 |
} |
|
213 |
catch(UnsatisfiedLinkError unsatisfiedlinkerror4) |
|
214 |
{ |
|
215 |
bUseNativeMethods = false; |
|
216 |
bUnsatisfiedLink = true; |
|
217 |
debug("Got UnsatisfiedLinkError looking on clientDLLPath"); |
|
218 |
} |
|
219 |
catch(Exception exception7) |
|
220 |
{ |
|
221 |
System.out.println(exception7.getMessage()); |
|
222 |
bUseNativeMethods = false; |
|
223 |
bUnsatisfiedLink = true; |
|
224 |
debug("Got Exception looking on clientDLLPath"); |
|
225 |
} |
|
226 |
} |
|
227 |
if(!bUseNativeMethods && !bSecurityError) |
|
228 |
try |
|
229 |
{ |
|
230 |
System.load("C:\\Program Files\\Earth Resource Mapping\\Image Web Server\\Client\\NCSUtil.dll"); |
|
231 |
System.load("C:\\Program Files\\Earth Resource Mapping\\Image Web Server\\Client\\NCScnet.dll"); |
|
232 |
System.load("C:\\Program Files\\Earth Resource Mapping\\Image Web Server\\Client\\NCSEcw.dll"); |
|
233 |
bUseNativeMethods = true; |
|
234 |
bUnsatisfiedLink = false; |
|
235 |
bSecurityError = false; |
|
236 |
debug("Loaded ECW libraries in C:\\Program Files\\..."); |
|
237 |
} |
|
238 |
catch(SecurityException securityexception1) |
|
239 |
{ |
|
240 |
bSecurityError = true; |
|
241 |
bUseNativeMethods = false; |
|
242 |
bUnsatisfiedLink = false; |
|
243 |
debug("Got security exception looking on C:\\Program Files\\"); |
|
244 |
} |
|
245 |
catch(RuntimeException runtimeexception) |
|
246 |
{ |
|
247 |
System.out.println(runtimeexception.getMessage()); |
|
248 |
bUseNativeMethods = false; |
|
249 |
bUnsatisfiedLink = true; |
|
250 |
debug("Got RuntimeException looking on C:\\Program Files\\"); |
|
251 |
} |
|
252 |
catch(UnsatisfiedLinkError unsatisfiedlinkerror2) |
|
253 |
{ |
|
254 |
bUseNativeMethods = false; |
|
255 |
bUnsatisfiedLink = true; |
|
256 |
debug("Got UnsatisfiedLinkError looking on C:\\Program Files\\"); |
|
257 |
} |
|
258 |
catch(Exception exception2) |
|
259 |
{ |
|
260 |
System.out.println(exception2.getMessage()); |
|
261 |
bUseNativeMethods = false; |
|
262 |
bUnsatisfiedLink = true; |
|
263 |
debug("Got Exception looking on C:\\Program Files\\"); |
|
264 |
} |
|
265 |
if(bUseNativeMethods) |
|
266 |
try |
|
267 |
{ |
|
268 |
int j = NCSJNIInit(); |
|
269 |
if(j != 0) |
|
270 |
{ |
|
271 |
System.err.println("JNCSFile classes failed to initialize correctly. Unrecoverable error."); |
|
272 |
String s = ECWGetErrorString(j); |
|
273 |
throw new JNCSNativeLibraryException(s); |
|
274 |
} |
|
275 |
bHaveClassInit = true; |
|
276 |
} |
|
277 |
catch(UnsatisfiedLinkError unsatisfiedlinkerror3) |
|
278 |
{ |
|
279 |
debug("UnsatisfiedLinkError: ".concat(String.valueOf(String.valueOf(unsatisfiedlinkerror3.getMessage())))); |
|
280 |
throw new JNCSNativeLibraryException("Native ECW libraries have been found, but could not be loaded. This may be because the version is insufficient to support the Java classes.\nAt least version 1,5,2,0 is required."); |
|
281 |
} |
|
282 |
catch(Exception exception3) |
|
283 |
{ |
|
284 |
debug("Exception: ".concat(String.valueOf(String.valueOf(exception3.getMessage())))); |
|
285 |
throw new JNCSNativeLibraryException("Unknown exception occured initialising ECW native libraries.".concat(String.valueOf(String.valueOf(exception3.getMessage())))); |
|
286 |
} |
|
287 |
if(bSecurityError) |
|
288 |
{ |
|
289 |
String s1 = "The security manager has denied loading of native libraries. Only trusted classes and signed JAR files can access native libraries."; |
|
290 |
System.out.println(s1); |
|
291 |
throw new JNCSNativeLibraryException(s1); |
|
292 |
} |
|
293 |
if(bUnsatisfiedLink) |
|
294 |
{ |
|
295 |
String s2 = "JNCSFile class failed to resolve some or all of the native ECW libraries.\nCheck that the NCSUtil, NCSCnet, and NCSUtil shared libraries are on the PATH environment variable (Win32),\nor the LD_LIBRARY_PATH (Unix), or that the parameters to the virtual machine specify their location,\nby setting the property : -Djava.library.path=<path_to_ncs_libraries>\nAlternatively, the file jncsclasses.properties in the user's home directory can specify the location.\n\nRefer to the ECW Java SDK documentation for more information on native library search paths."; |
|
296 |
throw new JNCSNativeLibraryException(s2); |
|
297 |
} else |
|
298 |
{ |
|
299 |
return; |
|
300 |
} |
|
301 |
} |
|
302 |
|
|
303 |
public JNCSFile() |
|
304 |
throws JNCSException |
|
305 |
{ |
|
306 |
bSetViewIsWorld = false; |
|
307 |
progImageClient = null; |
|
308 |
initClass(); |
|
309 |
cellSizeUnits = 0; |
|
310 |
bIsOpen = false; |
|
311 |
} |
|
312 |
|
|
313 |
public JNCSFile(String s, boolean flag) |
|
314 |
throws JNCSException |
|
315 |
{ |
|
316 |
bSetViewIsWorld = false; |
|
317 |
progImageClient = null; |
|
318 |
initClass(); |
|
319 |
open(s, flag); |
|
320 |
} |
|
321 |
|
|
322 |
protected void finalize() |
|
323 |
throws Throwable |
|
324 |
{ |
|
325 |
if(bIsOpen) |
|
326 |
ECWClose(false); |
|
327 |
super.finalize(); |
|
328 |
} |
|
329 |
|
|
330 |
public int open(String s, boolean flag) |
|
331 |
throws JNCSFileOpenFailedException |
|
332 |
{ |
|
333 |
if(s == null) |
|
334 |
throw new IllegalArgumentException(); |
|
335 |
int i = ECWOpen(s, flag); |
|
336 |
if(i != 0) |
|
337 |
{ |
|
338 |
bIsOpen = false; |
|
339 |
String s1 = ECWGetErrorString(i); |
|
340 |
throw new JNCSFileOpenFailedException(s1); |
|
341 |
} else |
|
342 |
{ |
|
343 |
bIsOpen = true; |
|
344 |
progressive = flag; |
|
345 |
return 0; |
|
346 |
} |
|
347 |
} |
|
348 |
|
|
349 |
public void close(boolean flag) |
|
350 |
{ |
|
351 |
ECWClose(flag); |
|
352 |
if(!flag); |
|
353 |
} |
|
354 |
|
|
355 |
public void addProgressiveUpdateListener(JNCSProgressiveUpdate jncsprogressiveupdate) |
|
356 |
{ |
|
357 |
progImageClient = jncsprogressiveupdate; |
|
358 |
} |
|
359 |
|
|
360 |
public void refreshUpdate(int i, int j, double d, double d1, double d2, double d3) |
|
361 |
{ |
|
362 |
if(progImageClient != null) |
|
363 |
progImageClient.refreshUpdate(i, j, d, d1, d2, d3); |
|
364 |
} |
|
365 |
|
|
366 |
public void refreshUpdate(int i, int j, int k, int l, int i1, int j1) |
|
367 |
{ |
|
368 |
if(progImageClient != null) |
|
369 |
progImageClient.refreshUpdate(i, j, k, l, i1, j1); |
|
370 |
} |
|
371 |
|
|
372 |
public int setView(int i, int ai[], int j, int k, int l, int i1, int j1, |
|
373 |
int k1) |
|
374 |
throws JNCSFileNotOpenException, JNCSInvalidSetViewException |
|
375 |
{ |
|
376 |
int l1 = ECWSetView(i, ai, j, k, l, i1, 0.0D, 0.0D, 0.0D, 0.0D, j1, k1); |
|
377 |
if(l1 != 0) |
|
378 |
{ |
|
379 |
String s = ECWGetErrorString(l1); |
|
380 |
throw new JNCSInvalidSetViewException(s); |
|
381 |
} else |
|
382 |
{ |
|
383 |
bSetViewIsWorld = false; |
|
384 |
return 0; |
|
385 |
} |
|
386 |
} |
|
387 |
|
|
388 |
public int setView(int i, int ai[], double d, double d1, double d2, double d3, int j, int k) |
|
389 |
throws JNCSFileNotOpenException, JNCSInvalidSetViewException |
|
390 |
{ |
|
391 |
JNCSDatasetPoint jncsdatasetpoint = convertWorldToDataset(d, d1); |
|
392 |
JNCSDatasetPoint jncsdatasetpoint1 = convertWorldToDataset(d2, d3); |
|
393 |
int l = ECWSetView(i, ai, jncsdatasetpoint.x, jncsdatasetpoint.y, jncsdatasetpoint1.x, jncsdatasetpoint1.y, d, d1, d2, d3, j, k); |
|
394 |
if(l != 0) |
|
395 |
{ |
|
396 |
String s = ECWGetErrorString(l); |
|
397 |
throw new JNCSInvalidSetViewException(s); |
|
398 |
} else |
|
399 |
{ |
|
400 |
bSetViewIsWorld = true; |
|
401 |
return 0; |
|
402 |
} |
|
403 |
} |
|
404 |
|
|
405 |
public int readLineRGBA(int ai[]) |
|
406 |
throws JNCSException |
|
407 |
{ |
|
408 |
int i = ECWReadLineRGBA(ai); |
|
409 |
if(i != 0) |
|
410 |
{ |
|
411 |
String s = ECWGetErrorString(i); |
|
412 |
throw new JNCSException(s); |
|
413 |
} else |
|
414 |
{ |
|
415 |
return 0; |
|
416 |
} |
|
417 |
} |
|
418 |
|
|
419 |
public int readLineBGRA(int ai[]) |
|
420 |
throws JNCSException |
|
421 |
{ |
|
422 |
throw new JNCSException("Not Yet Implemented!"); |
|
423 |
} |
|
424 |
|
|
425 |
public int readLineBIL(int ai[]) |
|
426 |
throws JNCSException |
|
427 |
{ |
|
428 |
throw new JNCSException("Not Yet Implemented!"); |
|
429 |
} |
|
430 |
|
|
431 |
public int readLineBIL(double ad[]) |
|
432 |
throws JNCSException |
|
433 |
{ |
|
434 |
throw new JNCSException("Not Yet Implemented!"); |
|
435 |
} |
|
436 |
|
|
437 |
public int readImageRGBA(int ai[], int i, int j) |
|
438 |
throws JNCSException |
|
439 |
{ |
|
440 |
int k = ECWReadImageRGBA(ai, i, j); |
|
441 |
if(k != 0) |
|
442 |
{ |
|
443 |
String s = ECWGetErrorString(k); |
|
444 |
throw new JNCSException(s); |
|
445 |
} else |
|
446 |
{ |
|
447 |
return 0; |
|
448 |
} |
|
449 |
} |
|
450 |
|
|
451 |
public String getLastErrorText(int i) |
|
452 |
{ |
|
453 |
return ECWGetErrorString(i); |
|
454 |
} |
|
455 |
|
|
456 |
public JNCSDatasetPoint convertWorldToDataset(double d, double d1) |
|
457 |
throws JNCSFileNotOpenException |
|
458 |
{ |
|
459 |
int i; |
|
460 |
int j; |
|
461 |
if(bIsOpen) |
|
462 |
{ |
|
463 |
i = (int)Math.round((d - originX) / cellIncrementX); |
|
464 |
j = (int)Math.round((d1 - originY) / cellIncrementY); |
|
465 |
} else |
|
466 |
{ |
|
467 |
throw new JNCSFileNotOpenException(); |
|
468 |
} |
|
469 |
return new JNCSDatasetPoint(i, j); |
|
470 |
} |
|
471 |
|
|
472 |
public JNCSWorldPoint convertDatasetToWorld(int i, int j) |
|
473 |
throws JNCSFileNotOpenException |
|
474 |
{ |
|
475 |
double d; |
|
476 |
double d1; |
|
477 |
if(bIsOpen) |
|
478 |
{ |
|
479 |
d = originX + (double)i * cellIncrementX; |
|
480 |
d1 = originY + (double)j * cellIncrementY; |
|
481 |
} else |
|
482 |
{ |
|
483 |
throw new JNCSFileNotOpenException(); |
|
484 |
} |
|
485 |
return new JNCSWorldPoint(d, d1); |
|
486 |
} |
|
487 |
|
|
488 |
public short getPercentComplete() |
|
489 |
{ |
|
490 |
return ECWGetPercentComplete(); |
|
491 |
} |
|
492 |
|
|
493 |
public static String getLibVersion() |
|
494 |
{ |
|
495 |
return ECWGetLibVersion(); |
|
496 |
} |
|
497 |
|
|
498 |
private static void debug(String s) |
|
499 |
{ |
|
500 |
if(debug) |
|
501 |
System.out.println(s); |
|
502 |
} |
|
503 |
|
|
504 |
private static boolean bUseNativeMethods = false; |
|
505 |
private static boolean bSecurityError = false; |
|
506 |
private static boolean bUnsatisfiedLink = false; |
|
507 |
static boolean bHaveClassInit = false; |
|
508 |
static boolean debug = false; |
|
509 |
public static final int ECW_CELL_UNITS_INVALID = 0; |
|
510 |
public static final int ECW_CELL_UNITS_METERS = 1; |
|
511 |
public static final int ECW_CELL_UNITS_DEGREES = 2; |
|
512 |
public static final int ECW_CELL_UNITS_FEET = 3; |
|
513 |
public int numBands; |
|
514 |
public int width; |
|
515 |
public int height; |
|
516 |
public double originX; |
|
517 |
public double originY; |
|
518 |
public double cellIncrementX; |
|
519 |
public double cellIncrementY; |
|
520 |
public int cellSizeUnits; |
|
521 |
public double compressionRate; |
|
522 |
public boolean progressive; |
|
523 |
public String fileName; |
|
524 |
public String datum; |
|
525 |
public String projection; |
|
526 |
public boolean bIsOpen; |
|
527 |
private long nativeDataPointer; |
|
528 |
private static final boolean doGarbageCollectionOnClose = false; |
|
529 |
private static final int ECW_OK = 0; |
|
530 |
private int nFileSetViewDatasetTLX; |
|
531 |
private int nFileSetViewDatasetTLY; |
|
532 |
private int nFileSetViewDatasetBRX; |
|
533 |
private int nFileSetViewDatasetBRY; |
|
534 |
private int nFileSetViewWidth; |
|
535 |
private int nFileSetViewHeight; |
|
536 |
private double dFileSetViewWorldTLX; |
|
537 |
private double dFileSetViewWorldTLY; |
|
538 |
private double dFileSetViewWorldBRX; |
|
539 |
private double dFileSetViewWorldBRY; |
|
540 |
private boolean bSetViewIsWorld; |
|
541 |
protected JNCSProgressiveUpdate progImageClient; |
|
542 |
|
|
543 |
} |
|
0 | 544 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-ermapper/com/ermapper/ecw/JNCSReadLineException.java | ||
---|---|---|
1 |
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov. |
|
2 |
// Jad home page: http://www.kpdus.com/jad.html |
|
3 |
// Decompiler options: packimports(3) |
|
4 |
// Source File Name: JNCSReadLineException.java |
|
5 |
|
|
6 |
package com.ermapper.ecw; |
|
7 |
|
|
8 |
|
|
9 |
// Referenced classes of package com.ermapper.ecw: |
|
10 |
// JNCSException |
|
11 |
|
|
12 |
public class JNCSReadLineException extends JNCSException |
|
13 |
{ |
|
14 |
|
|
15 |
public JNCSReadLineException() |
|
16 |
{ |
|
17 |
} |
|
18 |
} |
|
0 | 19 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-ermapper/com/ermapper/ecw/JNCSNativeLibraryException.java | ||
---|---|---|
1 |
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov. |
|
2 |
// Jad home page: http://www.kpdus.com/jad.html |
|
3 |
// Decompiler options: packimports(3) |
|
4 |
// Source File Name: JNCSNativeLibraryException.java |
|
5 |
|
|
6 |
package com.ermapper.ecw; |
|
7 |
|
|
8 |
|
|
9 |
// Referenced classes of package com.ermapper.ecw: |
|
10 |
// JNCSException |
|
11 |
|
|
12 |
public class JNCSNativeLibraryException extends JNCSException |
|
13 |
{ |
|
14 |
|
|
15 |
public JNCSNativeLibraryException() |
|
16 |
{ |
|
17 |
} |
|
18 |
|
|
19 |
public JNCSNativeLibraryException(String s) |
|
20 |
{ |
|
21 |
super(s); |
|
22 |
} |
|
23 |
} |
|
0 | 24 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-ermapper/com/ermapper/ecw/JNCSProgressiveUpdate.java | ||
---|---|---|
1 |
// Decompiled by Jad v1.5.8f. Copyright 2001 Pavel Kouznetsov. |
|
2 |
// Jad home page: http://www.kpdus.com/jad.html |
|
3 |
// Decompiler options: packimports(3) |
|
4 |
// Source File Name: JNCSProgressiveUpdate.java |
|
5 |
|
|
6 |
package com.ermapper.ecw; |
|
7 |
|
|
8 |
|
|
9 |
public interface JNCSProgressiveUpdate |
|
10 |
{ |
|
11 |
|
|
12 |
public abstract void refreshUpdate(int i, int j, double d, double d1, double d2, double d3); |
|
13 |
|
|
14 |
public abstract void refreshUpdate(int i, int j, int k, int l, int i1, int j1); |
|
15 |
} |
|
0 | 16 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/ant.xml | ||
---|---|---|
1 |
<project name="CMS for Java" default="dist" basedir="."> |
|
2 |
<description> |
|
3 |
Genera el jar con CMS y sus dependencias |
|
4 |
</description> |
|
5 |
<!-- set global properties for this build --> |
|
6 |
<property name="src" location="src"/> |
|
7 |
<property name="build" location="bin"/> |
|
8 |
<property name="dist" location="dist"/> |
|
9 |
<property name="jar" value="cms"/> |
|
10 |
<!--property name="fmapdir" value="../FMAP"/--> |
|
11 |
<property name="targetDir1" location="../FMAP/lib"/> |
|
12 |
<property name="targetDir" location="../FMap 03/lib"/> |
|
13 |
<property name="targetDir2" location="."/> |
|
14 |
|
|
15 |
<target name="init"> |
|
16 |
<!-- Create the time stamp --> |
|
17 |
<tstamp/> |
|
18 |
<!-- Create the build directory structure used by compile --> |
|
19 |
<mkdir dir="${build}"/> |
|
20 |
</target> |
|
21 |
|
|
22 |
<target name="compile" depends="init" |
|
23 |
description="compile the source " > |
|
24 |
<!-- Compile the java code from ${src} into ${build} |
|
25 |
<javac srcdir="${src}" destdir="${build}"/>--> |
|
26 |
</target> |
|
27 |
|
|
28 |
<target name="dist" depends="compile" |
|
29 |
description="generate the distribution" > |
|
30 |
<!-- Create the distribution directory --> |
|
31 |
<mkdir dir="${dist}"/> |
|
32 |
|
|
33 |
<!-- Put everything in ${build} into the cms-${DSTAMP}.jar file --> |
|
34 |
<jar jarfile="${dist}/${jar}.jar" basedir="${build}"/> |
|
35 |
<jar jarfile="${dist}/${jar}.jar" basedir="." includes = "images/*.gif" update="true" /> |
|
36 |
<copy todir="${dist}"> |
|
37 |
<fileset dir="./lib" includes="*.jar"/> |
|
38 |
</copy> |
|
39 |
<copy todir="${targetDir1}/"> |
|
40 |
<fileset dir="${dist}" includes="**/**"/> |
|
41 |
</copy> |
|
42 |
<copy todir="${targetDir2}/"> |
|
43 |
<fileset dir="${dist}" includes="${jar}.jar"/> |
|
44 |
</copy> |
|
45 |
<move todir="${targetDir}/"> |
|
46 |
<fileset dir="${dist}" includes="**/**"/> |
|
47 |
</move> |
|
48 |
</target> |
|
49 |
|
|
50 |
<target name="clean" |
|
51 |
description="clean up" > |
|
52 |
<!-- Delete the ${build} and ${dist} directory trees --> |
|
53 |
<delete dir="${build}"/> |
|
54 |
<delete dir="${dist}"/> |
|
55 |
</target> |
|
56 |
</project> |
|
57 |
|
|
0 | 58 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-test/org/cresques/io/raster/PruebaFilter.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 22-feb-2005 |
|
3 |
*/ |
|
4 |
package org.cresques.io.raster; |
|
5 |
|
|
6 |
import java.awt.Image; |
|
7 |
|
|
8 |
|
|
9 |
public abstract class PruebaFilter extends RasterFilter { |
|
10 |
|
|
11 |
protected RasterBuf rasterBuf = null; |
|
12 |
|
|
13 |
public void pre(){ |
|
14 |
rasterBuf = new RasterBuf(RasterBuf.TYPE_INT, width, height, 3, null); |
|
15 |
} |
|
16 |
public PruebaFilter(){ |
|
17 |
super(); |
|
18 |
} |
|
19 |
|
|
20 |
} |
|
21 |
|
|
0 | 22 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-test/org/cresques/io/raster/PruebaShortFilter.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 22-feb-2005 |
|
3 |
*/ |
|
4 |
package org.cresques.io.raster; |
|
5 |
|
|
6 |
import java.awt.Image; |
|
7 |
|
|
8 |
/** |
|
9 |
* Calcula el m?ximo y el m?nimo de un raster. |
|
10 |
* @author Luis W. Sevilla (sevilla_lui@gva.es) |
|
11 |
*/ |
|
12 |
public class PruebaShortFilter extends PruebaFilter { |
|
13 |
|
|
14 |
public PruebaShortFilter(){ |
|
15 |
super(); |
|
16 |
} |
|
17 |
|
|
18 |
public void pre(){ |
|
19 |
//Obtenci?n de par?metros |
|
20 |
|
|
21 |
this.raster = (RasterBuf)params.get("raster"); |
|
22 |
|
|
23 |
height = raster.getHeight(); |
|
24 |
width = raster.getWidth(); |
|
25 |
super.pre(); |
|
26 |
} |
|
27 |
|
|
28 |
public void process(int x, int y) { |
|
29 |
raster.getElemInt(x, y, px); |
|
30 |
this.rasterBuf.setElemInt(x, y, px); |
|
31 |
|
|
32 |
} |
|
33 |
|
|
34 |
public int getInRasterDataType(){ |
|
35 |
//return raster.getDataType(); |
|
36 |
return RasterBuf.TYPE_SHORT; |
|
37 |
} |
|
38 |
|
|
39 |
public int getOutRasterDataType(){ |
|
40 |
//return raster.getDataType(); |
|
41 |
return RasterBuf.TYPE_SHORT; |
|
42 |
} |
|
43 |
|
|
44 |
public Object getResult(String name){ |
|
45 |
if(name.equals("raster")) |
|
46 |
return rasterBuf; |
|
47 |
else |
|
48 |
return null; |
|
49 |
} |
|
50 |
|
|
51 |
public void processLine(int y){}; |
|
52 |
public void post(){}; |
|
53 |
|
|
54 |
} |
|
55 |
|
|
0 | 56 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-test/org/cresques/io/raster/PruebaImageFilter.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 25-feb-2005 |
|
3 |
*/ |
|
4 |
package org.cresques.io.raster; |
|
5 |
|
|
6 |
import java.awt.Image; |
|
7 |
import java.awt.Point; |
|
8 |
import java.awt.image.BufferedImage; |
|
9 |
|
|
10 |
/** |
|
11 |
* Clase base para los filtros de calculo de m?ximo y m?nimo en sus diferentes |
|
12 |
* tipos de datos. |
|
13 |
*/ |
|
14 |
public class PruebaImageFilter extends PruebaFilter { |
|
15 |
|
|
16 |
public PruebaImageFilter(){ |
|
17 |
super(); |
|
18 |
} |
|
19 |
|
|
20 |
public void pre(){ |
|
21 |
//Obtenci?n de par?metros |
|
22 |
|
|
23 |
this.image = (Image)params.get("raster"); |
|
24 |
|
|
25 |
height = image.getHeight(null); |
|
26 |
width = image.getWidth(null); |
|
27 |
|
|
28 |
super.pre(); |
|
29 |
|
|
30 |
} |
|
31 |
|
|
32 |
public void process(int x, int y) { |
|
33 |
int px = ((BufferedImage) image).getRGB(x,y); |
|
34 |
int []px3 = {(px & 0xff0000) >> 16, (px & 0x00ff00) >> 8, (px & 0x0000ff)}; |
|
35 |
this.rasterBuf.setElemInt(x, y, px3); |
|
36 |
} |
|
37 |
|
|
38 |
public int getInRasterDataType(){ |
|
39 |
return RasterBuf.TYPE_IMAGE; |
|
40 |
} |
|
41 |
|
|
42 |
public int getOutRasterDataType(){ |
|
43 |
return RasterBuf.TYPE_SHORT; |
|
44 |
} |
|
45 |
|
|
46 |
public void post(){ |
|
47 |
image = null; |
|
48 |
}; |
|
49 |
|
|
50 |
public Object getResult(String name){ |
|
51 |
if(name.equals("raster")) |
|
52 |
return rasterBuf; |
|
53 |
else return null; |
|
54 |
} |
|
55 |
|
|
56 |
public void processLine(int y){}; |
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
|
|
0 | 61 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-test/org/cresques/io/raster/PruebasRasterStack.java | ||
---|---|---|
1 |
package org.cresques.io.raster; |
|
2 |
|
|
3 |
public class PruebasRasterStack{ |
|
4 |
|
|
5 |
private PruebaStackManager stackManager = null; |
|
6 |
|
|
7 |
public PruebasRasterStack(PruebaStackManager stackManager){ |
|
8 |
this.stackManager = stackManager; |
|
9 |
|
|
10 |
int[][] r = {{0,15}}; |
|
11 |
stackManager.addTransparencyFilter( r, null, null, 0x10, 0xff, 0xff, 0xff); |
|
12 |
int[][] s = {{0,10}, {1,5}}; |
|
13 |
stackManager.addTransparencyFilter( r, s, null, 0x10, 0xff, 0xff, 0xff); |
|
14 |
stackManager.addPruebaFilter(); |
|
15 |
stackManager.removeFilter(4); |
|
16 |
stackManager.addPruebaFilter(); |
|
17 |
stackManager.removeFilter(4); |
|
18 |
stackManager.addTransparencyFilter( r, s, null, 0x10, 0xff, 0xff, 0xff); |
|
19 |
stackManager.removeFilter(0); |
|
20 |
stackManager.addPruebaFilter(); |
|
21 |
stackManager.addTransparencyFilter( r, s, null, 0x10, 0xff, 0xff, 0xff); |
|
22 |
stackManager.addEnhancedFilter(); |
|
23 |
stackManager.addTailFilter( 0.1, 0.5); |
|
24 |
stackManager.removeFilter(3); |
|
25 |
stackManager.removeFilter(1); |
|
26 |
} |
|
27 |
|
|
28 |
public void setRasterFilterStackManager(PruebaStackManager stackManager){ |
|
29 |
this.stackManager = stackManager; |
|
30 |
} |
|
31 |
|
|
32 |
} |
|
0 | 33 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src-test/org/cresques/io/raster/PruebaStackManager.java | ||
---|---|---|
1 |
package org.cresques.io.raster; |
|
2 |
|
|
3 |
public class PruebaStackManager extends RasterFilterStackManager{ |
|
4 |
|
|
5 |
public final static int prueba = 4; |
|
6 |
|
|
7 |
public PruebaStackManager(RasterFilterStack filterStack){ |
|
8 |
super(filterStack); |
|
9 |
addTypeFilter("prueba", PruebaStackManager.prueba, 3); |
|
10 |
} |
|
11 |
|
|
12 |
/** |
|
13 |
* Filtro de pruebas. |
|
14 |
*/ |
|
15 |
public void addPruebaFilter(){ |
|
16 |
RasterFilter filtro = null; |
|
17 |
switch(filterStack.getDataTypeInFilter(PruebaStackManager.prueba)){ |
|
18 |
case RasterBuf.TYPE_IMAGE:filtro = new PruebaImageFilter();break; |
|
19 |
case RasterBuf.TYPE_SHORT: |
|
20 |
case RasterBuf.TYPE_USHORT: |
|
21 |
case RasterBuf.TYPE_INT:filtro = new PruebaShortFilter();break; |
|
22 |
} |
|
23 |
filterStack.addFilter(PruebaStackManager.prueba, filtro); |
|
24 |
super.controlTypes(); |
|
25 |
} |
|
26 |
|
|
27 |
public int getType(RasterFilter rasterFilter){ |
|
28 |
if(rasterFilter instanceof PruebaFilter) |
|
29 |
return PruebaStackManager.prueba; |
|
30 |
|
|
31 |
return super.getType(rasterFilter); |
|
32 |
} |
|
33 |
|
|
34 |
} |
|
0 | 35 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/doc-files/overview.html | ||
---|---|---|
1 |
<html> |
|
2 |
<body>Overview 1 |
|
3 |
</body> |
|
4 |
</html> |
|
5 |
|
|
0 | 6 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/javadoc.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project default="javadoc"> |
|
3 |
<target name="javadoc"> |
|
4 |
<javadoc destdir="doc" access="package" source="1.4" use="true" notree="false" nonavbar="false" noindex="false" splitindex="true" author="true" version="true" nodeprecatedlist="false" nodeprecated="false" packagenames="org.cresques.cts.gt2,org.cresques.io,org.cresques.geo.cover,org.cresques.ui,org.cresques.geo,org.cresques.cts,org.cresques.ui.cmd,org.cresques.px.gml,org.cresques.px.dxf,org.cresques.px" sourcepath="src" classpath="lib/jmgeoraster.jar;lib/geojava.jar;bin;C:\java\lib\ermapper.jar;lib/gt2cts.jar" overview="C:\eclipse\workspace\Cq CMS for Java\doc-files\overview.html" doctitle="Cresques Mapping Suite for Java v0.1"> |
|
5 |
<link href="file:/C:/j2sdk1.4.2_03/docs/api/"/> |
|
6 |
<link href="jar:file:/C:/java/lib/ermapperdoc.jar!/Javadoc"/> |
|
7 |
</javadoc> |
|
8 |
</target> |
|
9 |
</project> |
|
0 | 10 |
tags/Root_CqCMSGisPlanet/libraries/libCq CMS for java.old/src/org/cresques/io/BookmarkList.java | ||
---|---|---|
1 |
/* |
|
2 |
* Creado el 31-ago-2004 |
|
3 |
*/ |
|
4 |
package org.cresques.io; |
|
5 |
|
|
6 |
import java.awt.event.ActionEvent; |
|
7 |
import java.awt.event.ActionListener; |
|
8 |
import java.util.Iterator; |
|
9 |
import java.util.Map; |
|
10 |
import java.util.TreeMap; |
|
11 |
import java.util.Vector; |
|
12 |
|
|
13 |
import javax.swing.ImageIcon; |
|
14 |
import javax.swing.JMenu; |
|
15 |
import javax.swing.JMenuItem; |
|
16 |
|
|
17 |
import org.cresques.cts.IProjection; |
|
18 |
import org.cresques.ui.CQApp; |
|
19 |
|
|
20 |
/** |
|
21 |
* @author "Luis W. Sevilla" <sevilla_lui@gva.es> |
|
22 |
*/ |
|
23 |
class Bookmark { |
|
24 |
String folder; |
|
25 |
String name; |
|
26 |
String [] fName; |
|
27 |
String projName; |
|
28 |
IProjection proj; |
|
29 |
|
|
30 |
public Bookmark(String fld, String n, String f, IProjection p) { |
|
31 |
projName = null; |
|
32 |
fName = new String[1]; |
|
33 |
folder = fld; name = n; fName[0] = f; proj = p; |
|
34 |
} |
|
35 |
public Bookmark(String fld, String n, String [] f, IProjection p) { |
|
36 |
projName = null; |
|
37 |
fName = new String[f.length]; |
|
38 |
folder = fld; name = n; proj = p; |
|
39 |
for (int i=0; i<f.length; i++) |
|
40 |
fName[i] = f[i]; |
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
public class BookmarkList extends TreeMap implements ActionListener { |
|
45 |
CQApp app = null; |
|
46 |
|
|
47 |
public BookmarkList(CQApp mainApp) { |
|
48 |
app = mainApp; |
|
49 |
loadList(); |
|
50 |
} |
|
51 |
|
|
52 |
public void loadList() { |
|
53 |
} |
|
54 |
|
|
55 |
public void addEntry(String fld, String n, String f, IProjection p) { |
|
56 |
addEntry(new Bookmark(fld, n, f, p)); |
|
57 |
} |
|
58 |
|
|
59 |
public void addEntry(String fld, String n, String [] f, IProjection p) { |
|
60 |
addEntry(new Bookmark(fld, n, f, p)); |
|
61 |
} |
|
62 |
|
|
63 |
public void addEntry(Bookmark bookmark) { |
|
64 |
Vector vector; |
|
65 |
if (containsKey(bookmark.folder)) { |
|
66 |
vector = (Vector) get(bookmark.folder); |
|
67 |
} else { |
|
68 |
vector = new Vector(); |
|
69 |
} |
|
70 |
vector.add(bookmark); |
|
71 |
put(bookmark.folder, vector); |
|
72 |
} |
|
73 |
|
|
74 |
public JMenu getJMenu() { |
|
75 |
JMenuItem it = null; |
|
76 |
JMenu menu = null, menu2 = null; |
|
77 |
ClassLoader loader = this.getClass().getClassLoader(); |
|
78 |
//loader.getResource("images/"+"folderXP.gif"); |
|
79 |
//System.err.println("URL="+loader.getResource("images/"+"folderXP.gif")); |
|
80 |
ImageIcon folderIcon = new ImageIcon(loader.getResource("images/"+"folderXP.gif")); |
|
81 |
ImageIcon dxfIcon = new ImageIcon(loader.getResource("images/"+"fileXPdxf.gif")); |
|
82 |
ImageIcon gmlIcon = new ImageIcon(loader.getResource("images/"+"fileXPgml.gif")); |
|
83 |
ImageIcon ecwIcon = new ImageIcon(loader.getResource("images/"+"fileXPecw.gif")); |
|
84 |
ImageIcon tifIcon = new ImageIcon(loader.getResource("images/"+"fileXPtif.gif")); |
|
85 |
ImageIcon fileIcon = new ImageIcon(loader.getResource("images/"+"fileXP.gif")); |
|
86 |
|
|
87 |
menu = new JMenu("Favoritos"); |
|
88 |
menu.setMnemonic('F'); |
|
89 |
|
|
90 |
// Arbol de carpetas |
|
91 |
TreeMap menuMap = new TreeMap(); |
|
92 |
String [] menuNames; |
|
93 |
JMenu parentMenu = null; |
|
94 |
String mName = null, key = null;; |
|
95 |
|
|
96 |
Iterator mIter = keySet().iterator(); |
|
97 |
while (mIter.hasNext()) { |
|
98 |
key = (String) mIter.next(); |
|
99 |
System.out.println("Key:"+key); |
|
100 |
menuNames = key.split("\\|"); |
|
101 |
|
|
102 |
parentMenu = menu; |
|
103 |
mName = ""; |
|
104 |
for (int i=0; i<menuNames.length; i++) { |
|
105 |
if (i>0) mName += "|"; |
|
106 |
mName += menuNames[i]; |
|
107 |
if (menuMap.containsKey(mName)) { |
|
108 |
//System.out.println(" mName:"+mName+", parent:"+parentMenu.getText()); |
|
109 |
parentMenu = (JMenu) menuMap.get(mName); |
|
110 |
} else { |
|
111 |
//System.out.println("+mName:"+mName+", parent:"+parentMenu.getText()); |
|
112 |
menu2 = new JMenu(menuNames[i]); |
|
113 |
menu2.setIcon(folderIcon); |
|
114 |
parentMenu.add(menu2); |
|
115 |
menuMap.put(mName, menu2); |
|
116 |
parentMenu = menu2; |
|
117 |
} |
|
118 |
} |
|
119 |
} |
|
120 |
|
|
121 |
// Entradas (Bookmarks) |
|
122 |
mIter = entrySet().iterator(); |
|
123 |
while (mIter.hasNext()) { |
|
124 |
Map.Entry entry = (Map.Entry) mIter.next(); |
|
125 |
String folder = (String) entry.getKey(); |
|
126 |
|
|
127 |
/*menu2 = new JMenu(folder); |
|
128 |
menu2.setIcon(folderIcon); |
|
129 |
menu.add(menu2);*/ |
|
130 |
menu2 = (JMenu) menuMap.get(folder); |
|
131 |
|
|
132 |
Vector vector = ((Vector) entry.getValue()); |
|
133 |
Bookmark bookmark; |
|
134 |
for (int i=0; i<vector.size(); i++) { |
|
135 |
bookmark = (Bookmark) vector.get(i); |
|
136 |
it = new JMenuItem(bookmark.name); |
|
137 |
it.setActionCommand(i+"|"+folder); |
|
138 |
it.addActionListener(this); |
|
139 |
if (bookmark.fName[0].endsWith("tif")) |
|
140 |
it.setIcon(tifIcon); |
|
141 |
else if (bookmark.fName[0].endsWith("ecw")) |
|
142 |
it.setIcon(ecwIcon); |
|
143 |
else if (bookmark.fName[0].endsWith("gml")) |
|
144 |
it.setIcon(gmlIcon); |
|
145 |
else if (bookmark.fName[0].endsWith("dxf") || bookmark.fName[0].endsWith("DXF")) |
|
146 |
it.setIcon(dxfIcon); |
|
147 |
else |
|
148 |
it.setIcon(fileIcon); |
|
149 |
|
|
150 |
menu2.add(it); |
|
151 |
} |
|
152 |
} |
|
153 |
//menu.add(menu2); |
|
154 |
return menu; |
|
155 |
} |
|
156 |
|
|
157 |
public void actionPerformed(ActionEvent event) { |
|
158 |
IProjection proj = null; |
|
159 |
String cmd = event.getActionCommand(); |
|
160 |
int mark = cmd.indexOf('|'); |
Also available in: Unified diff