Line | Hits | Source |
---|---|---|
1 | // A Java MapScript module for MapServer. | |
2 | // See <http://mapserver.gis.umn.edu> for information on MapServer. | |
3 | // | |
4 | // Copyright (C) 2003 Andrew Collins <andrewrcollins@yahoo.com> | |
5 | // | |
6 | // This library is free software; you can redistribute it | |
7 | // and/or modify it under the terms of the GNU Lesser General | |
8 | // Public License as published by the Free Software Foundation; | |
9 | // either version 2.1 of the License, or (at your option) any | |
10 | // 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 | |
14 | // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
15 | // See the GNU Lesser General Public License for more details. | |
16 | // | |
17 | // You should have received a copy of the GNU Lesser General | |
18 | // Public License along with this library; if not, write to | |
19 | // the Free Software Foundation, Inc., 59 Temple Place, | |
20 | // Suite 330, Boston, MA 02111-1307 USA | |
21 | package edu.umn.gis.mapscript; | |
22 | ||
23 | import edu.umn.gis.mapscript.imp.*; | |
24 | ||
25 | import java.io.*; | |
26 | ||
27 | import java.util.*; | |
28 | ||
29 | ||
30 | /** | |
31 | * DOCUMENT ME! | |
32 | * | |
33 | * @author <a href="mailto:ADDRESS">NAME</a> | |
34 | * | |
35 | * @todo CLASS_DESCRIPTION | |
36 | */ | |
37 | public class MapScriptBean | |
38 | { | |
39 | /** | |
40 | * DOCUMENT ME! | |
41 | * | |
42 | * @todo FIELD_DESCRIPTION | |
43 | */ | |
44 | private List theResultValues; | |
45 | ||
46 | /** | |
47 | * DOCUMENT ME! | |
48 | * | |
49 | * @todo FIELD_DESCRIPTION | |
50 | */ | |
51 | private String imagePath; | |
52 | ||
53 | /** | |
54 | * DOCUMENT ME! | |
55 | * | |
56 | * @todo FIELD_DESCRIPTION | |
57 | */ | |
58 | private String map; | |
59 | ||
60 | /** | |
61 | * DOCUMENT ME! | |
62 | * | |
63 | * @todo FIELD_DESCRIPTION | |
64 | */ | |
65 | private String mapImage; | |
66 | ||
67 | /** | |
68 | * DOCUMENT ME! | |
69 | * | |
70 | * @todo FIELD_DESCRIPTION | |
71 | */ | |
72 | private String mapPath; | |
73 | ||
74 | /** | |
75 | * DOCUMENT ME! | |
76 | * | |
77 | * @todo FIELD_DESCRIPTION | |
78 | */ | |
79 | private String referenceImage; | |
80 | ||
81 | /** | |
82 | * DOCUMENT ME! | |
83 | * | |
84 | * @todo FIELD_DESCRIPTION | |
85 | */ | |
86 | private String scaleBarImage; | |
87 | ||
88 | /** | |
89 | * DOCUMENT ME! | |
90 | * | |
91 | * @todo FIELD_DESCRIPTION | |
92 | */ | |
93 | private layerObj theLayer; | |
94 | ||
95 | /** | |
96 | * DOCUMENT ME! | |
97 | * | |
98 | * @todo FIELD_DESCRIPTION | |
99 | */ | |
100 | private mapObj theMap; | |
101 | ||
102 | /** | |
103 | * DOCUMENT ME! | |
104 | * | |
105 | * @todo FIELD_DESCRIPTION | |
106 | */ | |
107 | private pointObj thePoint; | |
108 | ||
109 | /** | |
110 | * DOCUMENT ME! | |
111 | * | |
112 | * @todo FIELD_DESCRIPTION | |
113 | */ | |
114 | private pointObj theQueryPoint; | |
115 | ||
116 | /** | |
117 | * DOCUMENT ME! | |
118 | * | |
119 | * @todo FIELD_DESCRIPTION | |
120 | */ | |
121 | private rectObj theCurrent; | |
122 | ||
123 | /** | |
124 | * DOCUMENT ME! | |
125 | * | |
126 | * @todo FIELD_DESCRIPTION | |
127 | */ | |
128 | private rectObj theMaximum; | |
129 | ||
130 | /** | |
131 | * DOCUMENT ME! | |
132 | * | |
133 | * @todo FIELD_DESCRIPTION | |
134 | */ | |
135 | private rectObj theQueryRectangle; | |
136 | ||
137 | /** | |
138 | * DOCUMENT ME! | |
139 | * | |
140 | * @todo FIELD_DESCRIPTION | |
141 | */ | |
142 | private rectObj theRectangle; | |
143 | ||
144 | /** | |
145 | * Create new MapScriptBean object. | |
146 | */ | |
147 | public MapScriptBean() | |
148 | 0 | { |
149 | 0 | theMap = null; |
150 | 0 | thePoint = null; |
151 | 0 | theQueryPoint = null; |
152 | 0 | theCurrent = null; |
153 | 0 | theMaximum = null; |
154 | 0 | theQueryRectangle = null; |
155 | 0 | theRectangle = null; |
156 | 0 | } |
157 | ||
158 | /** | |
159 | * DOCUMENT ME! | |
160 | * | |
161 | * @param minX PARAMETER | |
162 | * @param maxX PARAMETER | |
163 | * @param minY PARAMETER | |
164 | * @param maxY PARAMETER | |
165 | * | |
166 | * @todo METHOD_DESCRIPTION | |
167 | */ | |
168 | public void setCurrent(double minX, double maxX, double minY, double maxY) | |
169 | { | |
170 | 0 | freeCurrent(); |
171 | 0 | theCurrent = new rectObj(); |
172 | 0 | theCurrent.setMinx(minX); |
173 | 0 | theCurrent.setMaxx(maxX); |
174 | 0 | theCurrent.setMiny(minY); |
175 | 0 | theCurrent.setMaxy(maxY); |
176 | 0 | } |
177 | ||
178 | /** | |
179 | * DOCUMENT ME! | |
180 | * | |
181 | * @return RETURN | |
182 | * | |
183 | * @todo METHOD_DESCRIPTION | |
184 | */ | |
185 | public int getHeight() | |
186 | { | |
187 | 0 | return theMap.getHeight(); |
188 | } | |
189 | ||
190 | /** | |
191 | * DOCUMENT ME! | |
192 | * | |
193 | * @param imagePath PARAMETER | |
194 | * | |
195 | * @todo METHOD_DESCRIPTION | |
196 | */ | |
197 | public void setImagePath(String imagePath) | |
198 | { | |
199 | 0 | System.out.println("image path=[" + imagePath + "]"); |
200 | 0 | this.imagePath = imagePath; |
201 | 0 | } |
202 | ||
203 | /** | |
204 | * DOCUMENT ME! | |
205 | * | |
206 | * @return RETURN | |
207 | * | |
208 | * @todo METHOD_DESCRIPTION | |
209 | */ | |
210 | public String getImagePath() | |
211 | { | |
212 | 0 | System.out.println("image path=[" + imagePath + "]"); |
213 | ||
214 | 0 | return imagePath; |
215 | } | |
216 | ||
217 | /** | |
218 | * DOCUMENT ME! | |
219 | * | |
220 | * @param name PARAMETER | |
221 | * | |
222 | * @return RETURN | |
223 | * | |
224 | * @todo METHOD_DESCRIPTION | |
225 | */ | |
226 | public boolean getLayerByName(String name) | |
227 | { | |
228 | 0 | theLayer = theMap.getLayerByName(name); |
229 | ||
230 | 0 | return theLayer != null; |
231 | } | |
232 | ||
233 | /** | |
234 | * DOCUMENT ME! | |
235 | * | |
236 | * @param map PARAMETER | |
237 | * | |
238 | * @todo METHOD_DESCRIPTION | |
239 | */ | |
240 | public void setMap(String map) | |
241 | { | |
242 | 0 | this.map = map; |
243 | 0 | } |
244 | ||
245 | /** | |
246 | * DOCUMENT ME! | |
247 | * | |
248 | * @return RETURN | |
249 | * | |
250 | * @todo METHOD_DESCRIPTION | |
251 | */ | |
252 | public String getMap() | |
253 | { | |
254 | 0 | return map; |
255 | } | |
256 | ||
257 | /** | |
258 | * DOCUMENT ME! | |
259 | * | |
260 | * @param mapImage PARAMETER | |
261 | * | |
262 | * @todo METHOD_DESCRIPTION | |
263 | */ | |
264 | public void setMapImage(String mapImage) | |
265 | { | |
266 | 0 | this.mapImage = mapImage; |
267 | 0 | } |
268 | ||
269 | /** | |
270 | * DOCUMENT ME! | |
271 | * | |
272 | * @return RETURN | |
273 | * | |
274 | * @todo METHOD_DESCRIPTION | |
275 | */ | |
276 | public String getMapImage() | |
277 | { | |
278 | 0 | return mapImage; |
279 | } | |
280 | ||
281 | /** | |
282 | * DOCUMENT ME! | |
283 | * | |
284 | * @param mapPath PARAMETER | |
285 | * | |
286 | * @todo METHOD_DESCRIPTION | |
287 | */ | |
288 | public void setMapPath(String mapPath) | |
289 | { | |
290 | 0 | System.out.println("map path=[" + mapPath + "]"); |
291 | 0 | this.mapPath = mapPath; |
292 | 0 | } |
293 | ||
294 | /** | |
295 | * DOCUMENT ME! | |
296 | * | |
297 | * @return RETURN | |
298 | * | |
299 | * @todo METHOD_DESCRIPTION | |
300 | */ | |
301 | public String getMapPath() | |
302 | { | |
303 | 0 | System.out.println("map path=[" + mapPath + "]"); |
304 | ||
305 | 0 | return mapPath; |
306 | } | |
307 | ||
308 | /** | |
309 | * DOCUMENT ME! | |
310 | * | |
311 | * @param maxX PARAMETER | |
312 | * | |
313 | * @todo METHOD_DESCRIPTION | |
314 | */ | |
315 | public void setMaxX(double maxX) | |
316 | { | |
317 | 0 | rectObj extent = theMap.getExtent(); |
318 | 0 | extent.setMaxx(maxX); |
319 | 0 | } |
320 | ||
321 | /** | |
322 | * DOCUMENT ME! | |
323 | * | |
324 | * @return RETURN | |
325 | * | |
326 | * @todo METHOD_DESCRIPTION | |
327 | */ | |
328 | public double getMaxX() | |
329 | { | |
330 | 0 | rectObj extent = theMap.getExtent(); |
331 | ||
332 | 0 | return extent.getMaxx(); |
333 | } | |
334 | ||
335 | /** | |
336 | * DOCUMENT ME! | |
337 | * | |
338 | * @param maxY PARAMETER | |
339 | * | |
340 | * @todo METHOD_DESCRIPTION | |
341 | */ | |
342 | public void setMaxY(double maxY) | |
343 | { | |
344 | 0 | rectObj extent = theMap.getExtent(); |
345 | 0 | extent.setMaxy(maxY); |
346 | 0 | } |
347 | ||
348 | /** | |
349 | * DOCUMENT ME! | |
350 | * | |
351 | * @return RETURN | |
352 | * | |
353 | * @todo METHOD_DESCRIPTION | |
354 | */ | |
355 | public double getMaxY() | |
356 | { | |
357 | 0 | rectObj extent = theMap.getExtent(); |
358 | ||
359 | 0 | return extent.getMaxy(); |
360 | } | |
361 | ||
362 | /** | |
363 | * DOCUMENT ME! | |
364 | * | |
365 | * @param minX PARAMETER | |
366 | * @param maxX PARAMETER | |
367 | * @param minY PARAMETER | |
368 | * @param maxY PARAMETER | |
369 | * | |
370 | * @todo METHOD_DESCRIPTION | |
371 | */ | |
372 | public void setMaximum(double minX, double maxX, double minY, double maxY) | |
373 | { | |
374 | 0 | freeMaximum(); |
375 | 0 | theMaximum = new rectObj(); |
376 | 0 | theMaximum.setMinx(minX); |
377 | 0 | theMaximum.setMaxx(maxX); |
378 | 0 | theMaximum.setMiny(minY); |
379 | 0 | theMaximum.setMaxy(maxY); |
380 | 0 | } |
381 | ||
382 | /** | |
383 | * DOCUMENT ME! | |
384 | * | |
385 | * @param minX PARAMETER | |
386 | * | |
387 | * @todo METHOD_DESCRIPTION | |
388 | */ | |
389 | public void setMinX(double minX) | |
390 | { | |
391 | 0 | rectObj extent = theMap.getExtent(); |
392 | 0 | extent.setMinx(minX); |
393 | 0 | } |
394 | ||
395 | /** | |
396 | * DOCUMENT ME! | |
397 | * | |
398 | * @return RETURN | |
399 | * | |
400 | * @todo METHOD_DESCRIPTION | |
401 | */ | |
402 | public double getMinX() | |
403 | { | |
404 | 0 | rectObj extent = theMap.getExtent(); |
405 | ||
406 | 0 | return extent.getMinx(); |
407 | } | |
408 | ||
409 | /** | |
410 | * DOCUMENT ME! | |
411 | * | |
412 | * @param minY PARAMETER | |
413 | * | |
414 | * @todo METHOD_DESCRIPTION | |
415 | */ | |
416 | public void setMinY(double minY) | |
417 | { | |
418 | 0 | rectObj extent = theMap.getExtent(); |
419 | 0 | extent.setMiny(minY); |
420 | 0 | } |
421 | ||
422 | /** | |
423 | * DOCUMENT ME! | |
424 | * | |
425 | * @return RETURN | |
426 | * | |
427 | * @todo METHOD_DESCRIPTION | |
428 | */ | |
429 | public double getMinY() | |
430 | { | |
431 | 0 | rectObj extent = theMap.getExtent(); |
432 | ||
433 | 0 | return extent.getMiny(); |
434 | } | |
435 | ||
436 | /** | |
437 | * DOCUMENT ME! | |
438 | * | |
439 | * @param x PARAMETER | |
440 | * @param y PARAMETER | |
441 | * | |
442 | * @todo METHOD_DESCRIPTION | |
443 | */ | |
444 | public void setPoint(double x, double y) | |
445 | { | |
446 | 0 | freePoint(); |
447 | 0 | thePoint = new pointObj(); |
448 | 0 | thePoint.setX(x); |
449 | 0 | thePoint.setY(y); |
450 | 0 | } |
451 | ||
452 | /** | |
453 | * DOCUMENT ME! | |
454 | * | |
455 | * @param x PARAMETER | |
456 | * @param y PARAMETER | |
457 | * | |
458 | * @todo METHOD_DESCRIPTION | |
459 | */ | |
460 | public void setQueryPoint(double x, double y) | |
461 | { | |
462 | 0 | freeQueryPoint(); |
463 | 0 | theQueryPoint = new pointObj(); |
464 | 0 | theQueryPoint.setX(x); |
465 | 0 | theQueryPoint.setY(y); |
466 | 0 | } |
467 | ||
468 | /** | |
469 | * DOCUMENT ME! | |
470 | * | |
471 | * @param minX PARAMETER | |
472 | * @param maxX PARAMETER | |
473 | * @param minY PARAMETER | |
474 | * @param maxY PARAMETER | |
475 | * | |
476 | * @todo METHOD_DESCRIPTION | |
477 | */ | |
478 | public void setQueryRectangle(double minX, double maxX, double minY, | |
479 | double maxY) | |
480 | { | |
481 | 0 | freeQueryRectangle(); |
482 | 0 | theQueryRectangle = new rectObj(); |
483 | 0 | theQueryRectangle.setMinx(minX); |
484 | 0 | theQueryRectangle.setMaxx(maxX); |
485 | 0 | theQueryRectangle.setMiny(minY); |
486 | 0 | theQueryRectangle.setMaxy(maxY); |
487 | 0 | } |
488 | ||
489 | /** | |
490 | * DOCUMENT ME! | |
491 | * | |
492 | * @param minX PARAMETER | |
493 | * @param maxX PARAMETER | |
494 | * @param minY PARAMETER | |
495 | * @param maxY PARAMETER | |
496 | * | |
497 | * @todo METHOD_DESCRIPTION | |
498 | */ | |
499 | public void setRectangle(double minX, double maxX, double minY, double maxY) | |
500 | { | |
501 | 0 | freeRectangle(); |
502 | 0 | theRectangle = new rectObj(); |
503 | 0 | theRectangle.setMinx(minX); |
504 | 0 | theRectangle.setMaxx(maxX); |
505 | 0 | theRectangle.setMiny(minY); |
506 | 0 | theRectangle.setMaxy(maxY); |
507 | 0 | } |
508 | ||
509 | /** | |
510 | * DOCUMENT ME! | |
511 | * | |
512 | * @return RETURN | |
513 | * | |
514 | * @todo METHOD_DESCRIPTION | |
515 | */ | |
516 | public String getReferenceImage() | |
517 | { | |
518 | 0 | return referenceImage; |
519 | } | |
520 | ||
521 | /** | |
522 | * DOCUMENT ME! | |
523 | * | |
524 | * @return RETURN | |
525 | * | |
526 | * @todo METHOD_DESCRIPTION | |
527 | */ | |
528 | public List getResultValues() | |
529 | { | |
530 | 0 | System.out.println("result values=[" + theResultValues + "]"); |
531 | ||
532 | 0 | return theResultValues; |
533 | } | |
534 | ||
535 | /** | |
536 | * DOCUMENT ME! | |
537 | * | |
538 | * @return RETURN | |
539 | * | |
540 | * @todo METHOD_DESCRIPTION | |
541 | */ | |
542 | public String getScaleBarImage() | |
543 | { | |
544 | 0 | return scaleBarImage; |
545 | } | |
546 | ||
547 | /** | |
548 | * DOCUMENT ME! | |
549 | * | |
550 | * @param status PARAMETER | |
551 | * | |
552 | * @todo METHOD_DESCRIPTION | |
553 | */ | |
554 | public void setStatus(boolean status) | |
555 | { | |
556 | 0 | if (status) |
557 | { | |
558 | 0 | theLayer.setStatus(MapScript.MS_ON); |
559 | } | |
560 | else | |
561 | { | |
562 | 0 | theLayer.setStatus(MapScript.MS_OFF); |
563 | } | |
564 | 0 | } |
565 | ||
566 | /** | |
567 | * DOCUMENT ME! | |
568 | * | |
569 | * @return RETURN | |
570 | * | |
571 | * @todo METHOD_DESCRIPTION | |
572 | */ | |
573 | public int getWidth() | |
574 | { | |
575 | 0 | return theMap.getWidth(); |
576 | } | |
577 | ||
578 | /** | |
579 | * Utility function to convert a pixel position to geocoded position. The | |
580 | * parameter invert could be set to true for Y pixel coordinates where the | |
581 | * UL > LR. Else set to false. | |
582 | * | |
583 | * @param pix PARAMETER | |
584 | * @param pixMin PARAMETER | |
585 | * @param pixMax PARAMETER | |
586 | * @param geoMin PARAMETER | |
587 | * @param geoMax PARAMETER | |
588 | * @param invert PARAMETER | |
589 | * | |
590 | * @return RETURN | |
591 | */ | |
592 | public double convertPixToGeo(int pix, int pixMin, int pixMax, double geoMin, | |
593 | double geoMax, boolean invert) | |
594 | { | |
595 | 0 | if (pix < pixMin) |
596 | { | |
597 | 0 | return -1D; |
598 | } | |
599 | ||
600 | 0 | if (pix > pixMax) |
601 | { | |
602 | 0 | return -1D; |
603 | } | |
604 | ||
605 | 0 | if ((pixMin >= pixMax) || (geoMin >= geoMax)) |
606 | { | |
607 | 0 | return -1D; |
608 | } | |
609 | ||
610 | 0 | double widthGeo = geoMax - geoMin; |
611 | 0 | double widthPix = pixMax - pixMin; |
612 | 0 | double pixToGeo = widthGeo / widthPix; |
613 | double deltaPix; | |
614 | ||
615 | 0 | if (invert) |
616 | { | |
617 | 0 | deltaPix = pixMax - pix; |
618 | } | |
619 | else | |
620 | { | |
621 | 0 | deltaPix = pix - pixMin; |
622 | } | |
623 | ||
624 | 0 | double geo = geoMin + (deltaPix * pixToGeo); |
625 | ||
626 | 0 | return geo; |
627 | } | |
628 | ||
629 | /** | |
630 | * DOCUMENT ME! | |
631 | * | |
632 | * @todo METHOD_DESCRIPTION | |
633 | */ | |
634 | public void doQueryByPoint() | |
635 | { | |
636 | 0 | System.out.println("Doing QueryByPoint ..."); |
637 | ||
638 | 0 | int returnValue = theMap.queryByPoint(theQueryPoint, MapScript.MS_SINGLE, |
639 | -1D); | |
640 | 0 | System.out.println("returnValue=[" + returnValue + "]"); |
641 | 0 | System.out.println("QueryByPoint done."); |
642 | 0 | } |
643 | ||
644 | /** | |
645 | * DOCUMENT ME! | |
646 | * | |
647 | * @todo METHOD_DESCRIPTION | |
648 | */ | |
649 | public void doQueryByRectangle() | |
650 | { | |
651 | 0 | System.out.println("Doing QueryByRectangle ..."); |
652 | ||
653 | 0 | int returnValue = theMap.queryByRect(theQueryRectangle); |
654 | 0 | System.out.println("returnValue=[" + returnValue + "]"); |
655 | 0 | System.out.println("QueryByRectangle done."); |
656 | 0 | } |
657 | ||
658 | /** | |
659 | * DOCUMENT ME! | |
660 | * | |
661 | * @todo METHOD_DESCRIPTION | |
662 | */ | |
663 | public void draw() | |
664 | { | |
665 | 0 | draw(false); |
666 | 0 | } |
667 | ||
668 | /** | |
669 | * DOCUMENT ME! | |
670 | * | |
671 | * @todo METHOD_DESCRIPTION | |
672 | */ | |
673 | public void drawQuery() | |
674 | { | |
675 | 0 | draw(true); |
676 | ||
677 | 0 | int numberLayers = theMap.getNumlayers(); |
678 | 0 | List resultValues = new ArrayList(); |
679 | ||
680 | 0 | for (int i = 0; i < numberLayers; i++) |
681 | { | |
682 | 0 | layerObj layer = theMap.getLayer(i); |
683 | 0 | resultCacheObj resultCache = layer.getResultcache(); |
684 | ||
685 | 0 | if (resultCache != null) |
686 | { | |
687 | 0 | int numberResults = resultCache.getNumresults(); |
688 | ||
689 | 0 | if (numberResults != 0) |
690 | { | |
691 | 0 | layer.open(theMap.getShapepath()); |
692 | ||
693 | 0 | for (int j = 0; j < numberResults; j++) |
694 | { | |
695 | 0 | resultCacheMemberObj resultCacheMember = layer.getResult(j); |
696 | ||
697 | 0 | if (resultCacheMember != null) |
698 | { | |
699 | 0 | shapeObj shape = layer.getShape(resultCacheMember.getTileindex(), |
700 | resultCacheMember.getShapeindex()); | |
701 | ||
702 | 0 | if (shape != null) |
703 | { | |
704 | 0 | int numberValues = shape.getNumvalues(); |
705 | ||
706 | 0 | for (int k = 0; k < numberValues; k++) |
707 | { | |
708 | 0 | String value = shape.getValue(k); |
709 | 0 | resultValues.add(value); |
710 | } | |
711 | ||
712 | 0 | shape.delete(); |
713 | } | |
714 | } | |
715 | } | |
716 | ||
717 | 0 | layer.close(); |
718 | } | |
719 | } | |
720 | } | |
721 | ||
722 | 0 | theResultValues = resultValues; |
723 | 0 | } |
724 | ||
725 | /** | |
726 | * DOCUMENT ME! | |
727 | * | |
728 | * @todo METHOD_DESCRIPTION | |
729 | */ | |
730 | public void freeCurrent() | |
731 | { | |
732 | 0 | if (theCurrent != null) |
733 | { | |
734 | 0 | System.out.println("Freeing Current ..."); |
735 | 0 | theCurrent.delete(); |
736 | 0 | System.out.println("Current freed."); |
737 | 0 | theCurrent = null; |
738 | } | |
739 | else | |
740 | { | |
741 | 0 | System.out.println("Current already freed."); |
742 | } | |
743 | 0 | } |
744 | ||
745 | /** | |
746 | * DOCUMENT ME! | |
747 | * | |
748 | * @todo METHOD_DESCRIPTION | |
749 | */ | |
750 | public void freeMap() | |
751 | { | |
752 | 0 | if (theMap != null) |
753 | { | |
754 | 0 | System.out.println("Freeing map ..."); |
755 | 0 | theMap.delete(); |
756 | 0 | System.out.println("Map freed."); |
757 | 0 | theMap = null; |
758 | } | |
759 | else | |
760 | { | |
761 | 0 | System.out.println("Map already freed."); |
762 | } | |
763 | 0 | } |
764 | ||
765 | /** | |
766 | * DOCUMENT ME! | |
767 | * | |
768 | * @todo METHOD_DESCRIPTION | |
769 | */ | |
770 | public void freeMaximum() | |
771 | { | |
772 | 0 | if (theMaximum != null) |
773 | { | |
774 | 0 | System.out.println("Freeing Maximum ..."); |
775 | 0 | theMaximum.delete(); |
776 | 0 | System.out.println("Maximum freed."); |
777 | 0 | theMaximum = null; |
778 | } | |
779 | else | |
780 | { | |
781 | 0 | System.out.println("Maximum already freed."); |
782 | } | |
783 | 0 | } |
784 | ||
785 | /** | |
786 | * DOCUMENT ME! | |
787 | * | |
788 | * @todo METHOD_DESCRIPTION | |
789 | */ | |
790 | public void freePoint() | |
791 | { | |
792 | 0 | if (thePoint != null) |
793 | { | |
794 | 0 | System.out.println("Freeing Point ..."); |
795 | 0 | thePoint.delete(); |
796 | 0 | System.out.println("Point freed."); |
797 | 0 | thePoint = null; |
798 | } | |
799 | else | |
800 | { | |
801 | 0 | System.out.println("Point already freed."); |
802 | } | |
803 | 0 | } |
804 | ||
805 | /** | |
806 | * DOCUMENT ME! | |
807 | * | |
808 | * @todo METHOD_DESCRIPTION | |
809 | */ | |
810 | public void freeQueryPoint() | |
811 | { | |
812 | 0 | if (theQueryPoint != null) |
813 | { | |
814 | 0 | System.out.println("Freeing Query Point ..."); |
815 | 0 | theQueryPoint.delete(); |
816 | 0 | System.out.println("Query Point freed."); |
817 | 0 | theQueryPoint = null; |
818 | } | |
819 | else | |
820 | { | |
821 | 0 | System.out.println("Query Point already freed."); |
822 | } | |
823 | 0 | } |
824 | ||
825 | /** | |
826 | * DOCUMENT ME! | |
827 | * | |
828 | * @todo METHOD_DESCRIPTION | |
829 | */ | |
830 | public void freeQueryRectangle() | |
831 | { | |
832 | 0 | if (theQueryRectangle != null) |
833 | { | |
834 | 0 | System.out.println("Freeing Query Rectangle ..."); |
835 | 0 | theQueryRectangle.delete(); |
836 | 0 | System.out.println("Query Rectangle freed."); |
837 | 0 | theQueryRectangle = null; |
838 | } | |
839 | else | |
840 | { | |
841 | 0 | System.out.println("Query Rectangle already freed."); |
842 | } | |
843 | 0 | } |
844 | ||
845 | /** | |
846 | * DOCUMENT ME! | |
847 | * | |
848 | * @todo METHOD_DESCRIPTION | |
849 | */ | |
850 | public void freeRectangle() | |
851 | { | |
852 | 0 | if (theRectangle != null) |
853 | { | |
854 | 0 | System.out.println("Freeing Rectangle ..."); |
855 | 0 | theRectangle.delete(); |
856 | 0 | System.out.println("Rectangle freed."); |
857 | 0 | theRectangle = null; |
858 | } | |
859 | else | |
860 | { | |
861 | 0 | System.out.println("Rectangle already freed."); |
862 | } | |
863 | 0 | } |
864 | ||
865 | /** | |
866 | * DOCUMENT ME! | |
867 | * | |
868 | * @todo METHOD_DESCRIPTION | |
869 | */ | |
870 | public void load() | |
871 | { | |
872 | 0 | String mapFile = mapPath + map; |
873 | 0 | System.out.println("Loading map=[" + mapFile + "] ..."); |
874 | 0 | theMap = new mapObj(mapFile); |
875 | 0 | System.out.println("map=[" + mapFile + "] loaded."); |
876 | 0 | } |
877 | ||
878 | /** | |
879 | * DOCUMENT ME! | |
880 | * | |
881 | * @param factor PARAMETER | |
882 | * | |
883 | * @todo METHOD_DESCRIPTION | |
884 | */ | |
885 | public void zoomPoint(int factor) | |
886 | { | |
887 | 0 | theMap.zoomPoint(factor, thePoint, theMap.getWidth(), theMap.getHeight(), |
888 | theCurrent, theMaximum); | |
889 | 0 | } |
890 | ||
891 | /** | |
892 | * DOCUMENT ME! | |
893 | * | |
894 | * @todo METHOD_DESCRIPTION | |
895 | */ | |
896 | public void zoomRectangle() | |
897 | { | |
898 | 0 | theMap.zoomRectangle(theRectangle, theMap.getWidth(), theMap.getHeight(), |
899 | theCurrent, theMaximum); | |
900 | 0 | } |
901 | ||
902 | /** | |
903 | * DOCUMENT ME! | |
904 | * | |
905 | * @param doQuery PARAMETER | |
906 | * | |
907 | * @todo METHOD_DESCRIPTION | |
908 | */ | |
909 | private void draw(boolean doQuery) | |
910 | { | |
911 | 0 | imageObj theImage = null; |
912 | ||
913 | 0 | if (doQuery) |
914 | { | |
915 | 0 | System.out.println("Drawing map (and doing query) ..."); |
916 | 0 | theImage = theMap.drawQuery(); |
917 | 0 | System.out.println("Map drawn (and did query)."); |
918 | } | |
919 | else | |
920 | { | |
921 | 0 | System.out.println("Drawing map ..."); |
922 | 0 | theImage = theMap.draw(); |
923 | 0 | System.out.println("Map drawn."); |
924 | } | |
925 | ||
926 | 0 | System.out.println("Saving image ..."); |
927 | ||
928 | 0 | String timeStamp = (new Long((new Date()).getTime())).toString(); |
929 | 0 | String mapImage = timeStamp + "m.png"; |
930 | 0 | int returnValue = theImage.saveImage(imagePath + mapImage, |
931 | MapScript.MS_PNG, 0, 0, 95); | |
932 | 0 | System.out.println("map path=[" + imagePath + mapImage + "]"); |
933 | 0 | System.out.println("returnValue=[" + returnValue + "]"); |
934 | 0 | System.out.println("map image=[" + mapImage + "] saved."); |
935 | 0 | System.out.println("Freeing image ..."); |
936 | 0 | theImage.delete(); |
937 | 0 | System.out.println("Image freed."); |
938 | 0 | this.mapImage = mapImage; |
939 | 0 | System.out.println("Drawing ScaleBar ..."); |
940 | ||
941 | 0 | imageObj theScalebarImage = theMap.drawScalebar(); |
942 | 0 | System.out.println("ScaleBar drawn."); |
943 | 0 | System.out.println("Saving ScaleBar image ..."); |
944 | 0 | timeStamp = (new Long((new Date()).getTime())).toString(); |
945 | ||
946 | 0 | String scaleBarImage = timeStamp + "sb.png"; |
947 | 0 | returnValue = theScalebarImage.saveImage(imagePath + scaleBarImage, |
948 | MapScript.MS_PNG, 0, 0, 95); | |
949 | 0 | System.out.println("ScaleBar path=[" + imagePath + scaleBarImage + "]"); |
950 | 0 | System.out.println("returnValue=[" + returnValue + "]"); |
951 | 0 | System.out.println("ScaleBar image=[" + scaleBarImage + "] saved."); |
952 | 0 | System.out.println("Freeing ScaleBar image ..."); |
953 | 0 | theScalebarImage.delete(); |
954 | 0 | System.out.println("ScaleBar image freed."); |
955 | 0 | this.scaleBarImage = scaleBarImage; |
956 | 0 | } |
957 | } |
this report was generated by version 1.0.2 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |