34 private LocationWindow locationWindow;
35 private CircleMapObject circleMapObject;
36 private IconMapObject iconMapObject;
37 private PolygonMapObject polygonMapObject;
38 private PolylineMapObject polylineMapObject;
39 private DottedPolylineMapObject dottedPolylineMapObject;
42 demonstrateLocationWindowMapObjectsMethods();
48 private void demonstrateLocationWindowMapObjectsMethods() {
49 System.out.println(
"=== LocationWindowMapObjects Example ===");
51 demonstrateCircleMapObjects();
52 demonstrateIconMapObjects();
53 demonstratePolygonMapObjects();
54 demonstratePolylineMapObjects();
55 demonstrateDottedPolylineMapObjects();
56 demonstrateRemoveAllMapObjects();
63 private void demonstrateCircleMapObjects() {
64 System.out.println(
"--- Circle Map Objects ---");
66 if (locationWindow ==
null) {
67 System.out.println(
"LocationWindow not available yet");
73 LocationPoint center =
new LocationPoint(10.0, 20.0);
74 circleMapObject = locationWindow.addCircleMapObject();
75 System.out.println(
"Created circle map object with center (" + center.getX() +
", " + center.getY() +
") and radius 5.0");
80 LocationPoint circleCenter = circleMapObject.getPosition();
81 System.out.println(
"Circle center: (" + circleCenter.getX() +
", " + circleCenter.getY() +
")");
86 double radius = circleMapObject.getRadius();
87 System.out.println(
"Circle radius: " + radius);
92 circleMapObject = locationWindow.addCircleMapObject();
93 System.out.println(
"Added circle map object");
96 if (circleMapObject !=
null) {
99 LocationPoint centerPoint =
new LocationPoint(100.0, 200.0);
100 boolean success = circleMapObject.setPosition(centerPoint);
101 System.out.println(
"Set circle position to (" + centerPoint.getX() +
", " + centerPoint.getY() +
"): " + success);
106 LocationPoint animatedPoint =
new LocationPoint(150.0, 250.0);
107 boolean animatedSuccess = circleMapObject.setPositionAnimated(animatedPoint, 2.0, AnimationType.LINEAR);
108 System.out.println(
"Set circle position with animation to (" + animatedPoint.getX() +
", " + animatedPoint.getY() +
"): " + animatedSuccess);
113 boolean radiusSuccess = circleMapObject.setRadius(10.0);
114 System.out.println(
"Set circle radius to 10.0 meters: " + radiusSuccess);
119 boolean collisionSuccess = circleMapObject.setCollisionEnabled(
true);
120 System.out.println(
"Enabled collision detection for circle: " + collisionSuccess);
125 boolean bufferSuccess = circleMapObject.setBuffer(5.0, 5.0);
126 System.out.println(
"Set collision buffer to 5x5 pixels: " + bufferSuccess);
131 boolean offsetSuccess = circleMapObject.setOffset(2.0, 3.0);
132 System.out.println(
"Set position offset to (2.0, 3.0) pixels: " + offsetSuccess);
137 boolean outlineColorSuccess = circleMapObject.setOutlineColor(0.0, 0.0, 1.0, 1.0);
138 System.out.println(
"Set circle outline color to blue: " + outlineColorSuccess);
143 boolean outlineAlphaSuccess = circleMapObject.setOutlineAlpha(0.5);
144 System.out.println(
"Set circle outline alpha to 0.5: " + outlineAlphaSuccess);
149 boolean outlineRadiusSuccess = circleMapObject.setOutlineRadius(2.0);
150 System.out.println(
"Set circle outline radius to 2.0: " + outlineRadiusSuccess);
155 boolean colorSuccess = circleMapObject.setColor(1.0, 0.0, 0.0, 0.8);
156 System.out.println(
"Set circle color to red with 80% opacity: " + colorSuccess);
161 boolean prioritySuccess = circleMapObject.setPriority(1);
162 System.out.println(
"Set rendering priority to 1: " + prioritySuccess);
167 boolean visibleSuccess = circleMapObject.setVisible(
true);
168 System.out.println(
"Set circle visibility to true: " + visibleSuccess);
173 MapObjectType objectType = circleMapObject.getMapObjectType();
174 System.out.println(
"Circle map object type: " + objectType);
179 boolean alphaSuccess = circleMapObject.setAlpha(0.7);
180 System.out.println(
"Set circle alpha to 0.7: " + alphaSuccess);
185 boolean interactiveSuccess = circleMapObject.setInteractive(
true);
186 System.out.println(
"Set circle interactive to true: " + interactiveSuccess);
191 boolean titleSuccess = circleMapObject.setTitle(
"Circle Object");
192 System.out.println(
"Set circle title to 'Circle Object': " + titleSuccess);
197 Map<String, String> customData =
new HashMap<>();
198 customData.put(
"key",
"value");
199 customData.put(
"number",
"42");
200 boolean dataSuccess = circleMapObject.setData(customData);
201 System.out.println(
"Set circle custom data: " + dataSuccess);
206 int objectId = circleMapObject.getId();
207 System.out.println(
"Circle object ID: " + objectId);
212 String objectTypeString = circleMapObject.getType();
213 System.out.println(
"Circle object type: " + objectTypeString);
218 Map<String, String> retrievedData = circleMapObject.getData();
219 System.out.println(
"Circle custom data: " + retrievedData);
225 if (circleMapObject !=
null) {
226 boolean removed = locationWindow.removeCircleMapObject(circleMapObject);
227 System.out.println(
"Removed circle map object: " + removed);
228 circleMapObject =
null;
233 List<CircleMapObject> circles =
new ArrayList<>();
234 for (
int i = 0; i < 3; i++) {
235 CircleMapObject circle = locationWindow.addCircleMapObject();
236 if (circle !=
null) {
237 circle.setPosition(
new LocationPoint(50.0 * i, 100.0 * i));
238 circle.setColor(0.0, 1.0, 0.0, 0.6);
239 circle.setRadius(5.0 + i * 2.0);
241 System.out.println(
"Created circle " + i +
" at (" + (50.0 * i) +
", " + (100.0 * i) +
") with radius " + (5.0 + i * 2.0));
245 for (
int i = 0; i < circles.size(); i++) {
246 locationWindow.removeCircleMapObject(circles.get(i));
247 System.out.println(
"Removed circle " + i);
254 private void demonstrateIconMapObjects() {
255 System.out.println(
"--- Icon Map Objects ---");
257 if (locationWindow ==
null) {
258 System.out.println(
"LocationWindow not available yet");
264 LocationPoint position =
new LocationPoint(30.0, 40.0);
265 iconMapObject = locationWindow.addIconMapObject();
266 System.out.println(
"Created icon map object at (" + position.getX() +
", " + position.getY() +
")");
271 LocationPoint iconPosition = iconMapObject.getPosition();
272 System.out.println(
"Icon position: (" + iconPosition.getX() +
", " + iconPosition.getY() +
")");
277 iconMapObject = locationWindow.addIconMapObject();
278 System.out.println(
"Added icon map object");
281 if (iconMapObject !=
null) {
284 LocationPoint iconPoint =
new LocationPoint(200.0, 300.0);
285 boolean success = iconMapObject.setPosition(iconPoint);
286 System.out.println(
"Set icon position to (" + iconPoint.getX() +
", " + iconPoint.getY() +
"): " + success);
291 LocationPoint animatedIconPoint =
new LocationPoint(250.0, 350.0);
292 boolean animatedSuccess = iconMapObject.setPositionAnimated(animatedIconPoint, 1.5, AnimationType.CUBIC);
293 System.out.println(
"Set icon position with animation to (" + animatedIconPoint.getX() +
", " + animatedIconPoint.getY() +
"): " + animatedSuccess);
298 boolean sizeSuccess = iconMapObject.setSize(32.0, 32.0);
299 System.out.println(
"Set icon size to 32x32 pixels: " + sizeSuccess);
304 boolean angleSuccess = iconMapObject.setAngle(45.0);
305 System.out.println(
"Set icon rotation angle to 45 degrees: " + angleSuccess);
310 boolean angleAnimatedSuccess = iconMapObject.setAngleAnimated(90.0, 2.0, AnimationType.SINE);
311 System.out.println(
"Set icon rotation with animation to 90 degrees: " + angleAnimatedSuccess);
316 boolean collisionSuccess = iconMapObject.setCollisionEnabled(
true);
317 System.out.println(
"Enabled collision detection for icon: " + collisionSuccess);
322 boolean bufferSuccess = iconMapObject.setBuffer(10.0, 10.0);
323 System.out.println(
"Set collision buffer to 10x10 pixels: " + bufferSuccess);
328 boolean offsetSuccess = iconMapObject.setOffset(0.0, -16.0);
329 System.out.println(
"Set position offset to (0.0, -16.0) pixels: " + offsetSuccess);
334 boolean prioritySuccess = iconMapObject.setPriority(2);
335 System.out.println(
"Set rendering priority to 2: " + prioritySuccess);
340 boolean visibleSuccess = iconMapObject.setVisible(
true);
341 System.out.println(
"Set icon visibility to true: " + visibleSuccess);
346 MapObjectType objectType = iconMapObject.getMapObjectType();
347 System.out.println(
"Icon map object type: " + objectType);
352 boolean iconSuccess = iconMapObject.setIcon(
"path/to/icon.png");
353 System.out.println(
"Set icon image: " + iconSuccess);
358 boolean bitmapSuccess = iconMapObject.setBitmap(
"path/to/bitmap.png");
359 System.out.println(
"Set icon bitmap: " + bitmapSuccess);
364 boolean flatSuccess = iconMapObject.setFlat(
true);
365 System.out.println(
"Set icon flat mode to true: " + flatSuccess);
370 boolean placementSuccess = iconMapObject.setPlacement(Placement.CENTER);
371 System.out.println(
"Set icon placement to CENTER: " + placementSuccess);
376 boolean alphaSuccess = iconMapObject.setAlpha(0.8);
377 System.out.println(
"Set icon alpha to 0.8: " + alphaSuccess);
382 boolean interactiveSuccess = iconMapObject.setInteractive(
true);
383 System.out.println(
"Set icon interactive to true: " + interactiveSuccess);
388 boolean titleSuccess = iconMapObject.setTitle(
"Icon Object");
389 System.out.println(
"Set icon title to 'Icon Object': " + titleSuccess);
394 Map<String, Object> customData =
new HashMap<>();
395 customData.put(
"key",
"value");
396 customData.put(
"number", 42);
397 boolean dataSuccess = iconMapObject.setData(customData);
398 System.out.println(
"Set icon custom data: " + dataSuccess);
403 int objectId = iconMapObject.getId();
404 System.out.println(
"Icon object ID: " + objectId);
409 String objectTypeString = iconMapObject.getType();
410 System.out.println(
"Icon object type: " + objectTypeString);
415 Map<String, Object> retrievedData = iconMapObject.getData();
416 System.out.println(
"Icon custom data: " + retrievedData);
422 if (iconMapObject !=
null) {
423 boolean removed = locationWindow.removeIconMapObject(iconMapObject);
424 System.out.println(
"Removed icon map object: " + removed);
425 iconMapObject =
null;
430 List<IconMapObject> icons =
new ArrayList<>();
431 for (
int i = 0; i < 3; i++) {
432 IconMapObject icon = locationWindow.addIconMapObject();
434 icon.setPosition(
new LocationPoint(100.0 * i, 150.0 * i));
435 icon.setSize(24.0, 24.0);
436 icon.setAngle(i * 30.0);
438 System.out.println(
"Created icon " + i +
" at (" + (100.0 * i) +
", " + (150.0 * i) +
") with angle " + (i * 30.0));
442 for (
int i = 0; i < icons.size(); i++) {
443 locationWindow.removeIconMapObject(icons.get(i));
444 System.out.println(
"Removed icon " + i);
451 private void demonstratePolygonMapObjects() {
452 System.out.println(
"--- Polygon Map Objects ---");
454 if (locationWindow ==
null) {
455 System.out.println(
"LocationWindow not available yet");
461 polygonMapObject = locationWindow.addPolygonMapObject();
462 System.out.println(
"Added polygon map object");
465 if (polygonMapObject !=
null) {
468 List<LocationPoint> points = Arrays.asList(
469 new LocationPoint(100.0, 200.0),
470 new LocationPoint(150.0, 250.0),
471 new LocationPoint(200.0, 200.0),
472 new LocationPoint(150.0, 150.0)
474 LocationPolygon polygon =
new LocationPolygon(points);
475 boolean success = polygonMapObject.setPolygon(polygon);
476 System.out.println(
"Set polygon with " + points.size() +
" points: " + success);
481 boolean colorSuccess = polygonMapObject.setColor(0.0, 1.0, 0.0, 0.7);
482 System.out.println(
"Set polygon color to green with 70% opacity: " + colorSuccess);
487 boolean visibleSuccess = polygonMapObject.setVisible(
true);
488 System.out.println(
"Set polygon visibility to true: " + visibleSuccess);
493 MapObjectType objectType = polygonMapObject.getMapObjectType();
494 System.out.println(
"Polygon map object type: " + objectType);
499 boolean orderSuccess = polygonMapObject.setOrder(2);
500 System.out.println(
"Set polygon rendering order to 2: " + orderSuccess);
505 boolean outlineColorSuccess = polygonMapObject.setOutlineColor(0.0, 0.0, 1.0, 1.0);
506 System.out.println(
"Set polygon outline color to blue: " + outlineColorSuccess);
511 boolean outlineWidthSuccess = polygonMapObject.setOutlineWidth(2.0);
512 System.out.println(
"Set polygon outline width to 2.0 pixels: " + outlineWidthSuccess);
517 boolean outlineAlphaSuccess = polygonMapObject.setOutlineAlpha(0.8);
518 System.out.println(
"Set polygon outline alpha to 0.8: " + outlineAlphaSuccess);
523 boolean outlineOrderSuccess = polygonMapObject.setOutlineOrder(1);
524 System.out.println(
"Set polygon outline order to 1: " + outlineOrderSuccess);
529 boolean alphaSuccess = polygonMapObject.setAlpha(0.7);
530 System.out.println(
"Set polygon alpha to 0.7: " + alphaSuccess);
535 boolean interactiveSuccess = polygonMapObject.setInteractive(
true);
536 System.out.println(
"Set polygon interactive to true: " + interactiveSuccess);
541 boolean titleSuccess = polygonMapObject.setTitle(
"Polygon Object");
542 System.out.println(
"Set polygon title to 'Polygon Object': " + titleSuccess);
547 Map<String, Object> customData =
new HashMap<>();
548 customData.put(
"key",
"value");
549 customData.put(
"number", 42);
550 boolean dataSuccess = polygonMapObject.setData(customData);
551 System.out.println(
"Set polygon custom data: " + dataSuccess);
556 int objectId = polygonMapObject.getId();
557 System.out.println(
"Polygon object ID: " + objectId);
562 String objectTypeString = polygonMapObject.getType();
563 System.out.println(
"Polygon object type: " + objectTypeString);
568 Map<String, Object> retrievedData = polygonMapObject.getData();
569 System.out.println(
"Polygon custom data: " + retrievedData);
575 if (polygonMapObject !=
null) {
576 boolean removed = locationWindow.removePolygonMapObject(polygonMapObject);
577 System.out.println(
"Removed polygon map object: " + removed);
578 polygonMapObject =
null;
583 List<PolygonMapObject> polygons =
new ArrayList<>();
584 for (
int i = 0; i < 3; i++) {
585 PolygonMapObject polygon = locationWindow.addPolygonMapObject();
586 if (polygon !=
null) {
587 List<LocationPoint> points = Arrays.asList(
588 new LocationPoint(300.0 + i * 50, 400.0 + i * 50),
589 new LocationPoint(350.0 + i * 50, 450.0 + i * 50),
590 new LocationPoint(400.0 + i * 50, 400.0 + i * 50),
591 new LocationPoint(350.0 + i * 50, 350.0 + i * 50)
593 LocationPolygon polygonGeometry =
new LocationPolygon(points);
594 polygon.setPolygon(polygonGeometry);
595 polygon.setColor(0.0, 0.0, 1.0, 0.5);
596 polygons.add(polygon);
597 System.out.println(
"Created polygon " + i +
" with " + points.size() +
" points");
601 for (
int i = 0; i < polygons.size(); i++) {
602 locationWindow.removePolygonMapObject(polygons.get(i));
603 System.out.println(
"Removed polygon " + i);
610 private void demonstratePolylineMapObjects() {
611 System.out.println(
"--- Polyline Map Objects ---");
613 if (locationWindow ==
null) {
614 System.out.println(
"LocationWindow not available yet");
620 List<Point> points =
new ArrayList<>();
621 points.add(
new Point(100.0, 110.0));
622 points.add(
new Point(105.0, 115.0));
623 points.add(
new Point(110.0, 120.0));
624 points.add(
new Point(115.0, 125.0));
625 Polyline polyline =
new Polyline(points);
626 LocationPolyline locationPolyline =
new LocationPolyline(polyline);
627 polylineMapObject = locationWindow.addPolylineMapObject();
628 System.out.println(
"Created polyline map object with " + points.size() +
" points");
633 LocationPolyline polylineShape = polylineMapObject.getPolyLine();
634 System.out.println(
"Polyline has " + polylineShape.getPoints().size() +
" points");
639 polylineMapObject = locationWindow.addPolylineMapObject();
640 System.out.println(
"Added polyline map object");
643 if (polylineMapObject !=
null) {
646 List<Point> polylinePoints =
new ArrayList<>();
647 polylinePoints.add(
new Point(0.0, 0.0));
648 polylinePoints.add(
new Point(50.0, 50.0));
649 polylinePoints.add(
new Point(100.0, 0.0));
650 polylinePoints.add(
new Point(150.0, 50.0));
651 Polyline polyline =
new Polyline(polylinePoints);
652 LocationPolyline locationPolyline =
new LocationPolyline(polyline);
653 boolean success = polylineMapObject.setPolyLine(locationPolyline);
654 System.out.println(
"Set polyline geometry: " + success);
659 boolean widthSuccess = polylineMapObject.setWidth(3.0);
660 System.out.println(
"Set polyline width to 3.0 pixels: " + widthSuccess);
665 boolean colorSuccess = polylineMapObject.setColor(1.0, 0.5, 0.0, 0.9);
666 System.out.println(
"Set polyline color to orange with 90% opacity: " + colorSuccess);
671 boolean orderSuccess = polylineMapObject.setOrder(2);
672 System.out.println(
"Set rendering order to 2: " + orderSuccess);
677 boolean capSuccess = polylineMapObject.setCapType(CapType.ROUND);
678 System.out.println(
"Set cap type to ROUND: " + capSuccess);
683 boolean joinSuccess = polylineMapObject.setJoinType(JoinType.ROUND);
684 System.out.println(
"Set join type to ROUND: " + joinSuccess);
689 boolean miterSuccess = polylineMapObject.setMiterLimit(5.0);
690 System.out.println(
"Set miter limit to 5.0: " + miterSuccess);
695 boolean visibleSuccess = polylineMapObject.setVisible(
true);
696 System.out.println(
"Set polyline visibility to true: " + visibleSuccess);
701 MapObjectType objectType = polylineMapObject.getMapObjectType();
702 System.out.println(
"Polyline map object type: " + objectType);
707 boolean alphaSuccess = polylineMapObject.setAlpha(0.7);
708 System.out.println(
"Set polyline alpha to 0.7: " + alphaSuccess);
713 boolean interactiveSuccess = polylineMapObject.setInteractive(
true);
714 System.out.println(
"Set polyline interactive to true: " + interactiveSuccess);
719 boolean titleSuccess = polylineMapObject.setTitle(
"Polyline Object");
720 System.out.println(
"Set polyline title to 'Polyline Object': " + titleSuccess);
725 Map<String, Object> customData =
new HashMap<>();
726 customData.put(
"key",
"value");
727 customData.put(
"number", 42);
728 boolean dataSuccess = polylineMapObject.setData(customData);
729 System.out.println(
"Set polyline custom data: " + dataSuccess);
734 int objectId = polylineMapObject.getId();
735 System.out.println(
"Polyline object ID: " + objectId);
740 String objectTypeString = polylineMapObject.getType();
741 System.out.println(
"Polyline object type: " + objectTypeString);
746 Map<String, Object> retrievedData = polylineMapObject.getData();
747 System.out.println(
"Polyline custom data: " + retrievedData);
752 boolean outlineWidthSuccess2 = polylineMapObject.setOutlineWidth(1.0);
753 System.out.println(
"Set polyline outline width to 1.0 pixels: " + outlineWidthSuccess2);
758 boolean outlineColorSuccess2 = polylineMapObject.setOutlineColor(0.0, 0.0, 0.0, 1.0);
759 System.out.println(
"Set polyline outline color to black: " + outlineColorSuccess2);
764 boolean outlineAlphaSuccess2 = polylineMapObject.setOutlineAlpha(0.5);
765 System.out.println(
"Set polyline outline alpha to 0.5: " + outlineAlphaSuccess2);
770 boolean outlineOrderSuccess2 = polylineMapObject.setOutlineOrder(0);
771 System.out.println(
"Set polyline outline rendering order to 0: " + outlineOrderSuccess2);
776 boolean outlineCapTypeSuccess2 = polylineMapObject.setOutlineCapType(CapType.SQUARE);
777 System.out.println(
"Set polyline outline cap type to SQUARE: " + outlineCapTypeSuccess2);
782 boolean outlineJoinTypeSuccess2 = polylineMapObject.setOutlineJoinType(JoinType.MITER);
783 System.out.println(
"Set polyline outline join type to MITER: " + outlineJoinTypeSuccess2);
788 boolean outlineMiterLimitSuccess2 = polylineMapObject.setOutlineMiterLimit(3.0);
789 System.out.println(
"Set polyline outline miter limit to 3.0: " + outlineMiterLimitSuccess2);
795 if (polylineMapObject !=
null) {
796 boolean removed = locationWindow.removePolylineMapObject(polylineMapObject);
797 System.out.println(
"Removed polyline map object: " + removed);
798 polylineMapObject =
null;
803 List<PolylineMapObject> polylines =
new ArrayList<>();
804 for (
int i = 0; i < 3; i++) {
805 PolylineMapObject polyline = locationWindow.addPolylineMapObject();
806 if (polyline !=
null) {
807 List<Point> points =
new ArrayList<>();
808 points.add(
new Point(i * 30.0, i * 30.0));
809 points.add(
new Point((i + 1) * 30.0, (i + 1) * 30.0));
810 Polyline poly =
new Polyline(points);
811 LocationPolyline locPoly =
new LocationPolyline(poly);
812 polyline.setPolyLine(locPoly);
813 polyline.setWidth(2.0 + i);
814 polyline.setColor(0.0, 1.0, 1.0, 0.8);
815 polylines.add(polyline);
816 System.out.println(
"Created polyline " + i +
" with width " + (2.0 + i));
820 for (
int i = 0; i < polylines.size(); i++) {
821 locationWindow.removePolylineMapObject(polylines.get(i));
822 System.out.println(
"Removed polyline " + i);
829 private void demonstrateDottedPolylineMapObjects() {
830 System.out.println(
"--- Dotted Polyline Map Objects ---");
832 if (locationWindow ==
null) {
833 System.out.println(
"LocationWindow not available yet");
839 List<Point> points =
new ArrayList<>();
840 points.add(
new Point(160.0, 170.0));
841 points.add(
new Point(165.0, 175.0));
842 points.add(
new Point(170.0, 180.0));
843 points.add(
new Point(175.0, 185.0));
844 Polyline polyline =
new Polyline(points);
845 LocationPolyline locationPolyline =
new LocationPolyline(polyline);
846 dottedPolylineMapObject = locationWindow.addDottedPolylineMapObject();
847 System.out.println(
"Created dotted polyline map object with " + points.size() +
" points");
852 LocationPolyline dottedPolylineShape = dottedPolylineMapObject.getPolyLine();
853 System.out.println(
"Dotted polyline has " + dottedPolylineShape.getPoints().size() +
" points");
858 dottedPolylineMapObject = locationWindow.addDottedPolylineMapObject();
859 System.out.println(
"Added dotted polyline map object");
862 if (dottedPolylineMapObject !=
null) {
865 List<Point> dottedPoints =
new ArrayList<>();
866 dottedPoints.add(
new Point(0.0, 100.0));
867 dottedPoints.add(
new Point(50.0, 150.0));
868 dottedPoints.add(
new Point(100.0, 100.0));
869 dottedPoints.add(
new Point(150.0, 150.0));
870 Polyline dottedPolyline =
new Polyline(dottedPoints);
871 LocationPolyline locationDottedPolyline =
new LocationPolyline(dottedPolyline);
872 boolean success = dottedPolylineMapObject.setPolyLine(locationDottedPolyline);
873 System.out.println(
"Set dotted polyline geometry: " + success);
878 boolean widthSuccess = dottedPolylineMapObject.setWidth(2.0);
879 System.out.println(
"Set dotted polyline width to 2.0 pixels: " + widthSuccess);
884 boolean colorSuccess = dottedPolylineMapObject.setColor(0.5, 0.0, 1.0, 0.8);
885 System.out.println(
"Set dotted polyline color to purple with 80% opacity: " + colorSuccess);
890 boolean orderSuccess = dottedPolylineMapObject.setOrder(3);
891 System.out.println(
"Set rendering order to 3: " + orderSuccess);
896 boolean visibleSuccess = dottedPolylineMapObject.setVisible(
true);
897 System.out.println(
"Set dotted polyline visibility to true: " + visibleSuccess);
902 MapObjectType objectType = dottedPolylineMapObject.getMapObjectType();
903 System.out.println(
"Dotted polyline map object type: " + objectType);
908 boolean alphaSuccess = dottedPolylineMapObject.setAlpha(0.8);
909 System.out.println(
"Set dotted polyline alpha to 0.8: " + alphaSuccess);
914 boolean interactiveSuccess = dottedPolylineMapObject.setInteractive(
true);
915 System.out.println(
"Set dotted polyline interactive to true: " + interactiveSuccess);
920 boolean titleSuccess = dottedPolylineMapObject.setTitle(
"Dotted Polyline Object");
921 System.out.println(
"Set dotted polyline title to 'Dotted Polyline Object': " + titleSuccess);
926 Map<String, Object> customData =
new HashMap<>();
927 customData.put(
"key",
"value");
928 customData.put(
"number", 42);
929 boolean dataSuccess = dottedPolylineMapObject.setData(customData);
930 System.out.println(
"Set dotted polyline custom data: " + dataSuccess);
935 int objectId = dottedPolylineMapObject.getId();
936 System.out.println(
"Dotted polyline object ID: " + objectId);
941 String objectTypeString = dottedPolylineMapObject.getType();
942 System.out.println(
"Dotted polyline object type: " + objectTypeString);
947 Map<String, Object> retrievedData = dottedPolylineMapObject.getData();
948 System.out.println(
"Dotted polyline custom data: " + retrievedData);
953 boolean dottedCollisionSuccess = dottedPolylineMapObject.setCollisionEnabled(
true);
954 System.out.println(
"Enabled collision detection for dotted polyline: " + dottedCollisionSuccess);
959 boolean dottedPlacementSuccess = dottedPolylineMapObject.setPlacement(Placement.CENTER);
960 System.out.println(
"Set dotted polyline placement to CENTER: " + dottedPlacementSuccess);
965 boolean dottedMinRatioSuccess = dottedPolylineMapObject.setPlacementMinRatio(0.5);
966 System.out.println(
"Set dotted polyline placement min ratio to 0.5: " + dottedMinRatioSuccess);
971 boolean dottedSpacingSuccess = dottedPolylineMapObject.setPlacementSpacing(10.0);
972 System.out.println(
"Set dotted polyline placement spacing to 10.0: " + dottedSpacingSuccess);
977 boolean dottedPrioritySuccess = dottedPolylineMapObject.setPriority(1);
978 System.out.println(
"Set dotted polyline rendering priority to 1: " + dottedPrioritySuccess);
983 boolean dottedRepeatDistanceSuccess = dottedPolylineMapObject.setRepeatDistance(20.0);
984 System.out.println(
"Set dotted polyline repeat distance to 20.0: " + dottedRepeatDistanceSuccess);
989 boolean dottedRepeatGroupSuccess = dottedPolylineMapObject.setRepeatGroup(1);
990 System.out.println(
"Set dotted polyline repeat group to 1: " + dottedRepeatGroupSuccess);
995 Size dottedSize =
new Size(16.0, 16.0);
996 boolean dottedSizeSuccess = dottedPolylineMapObject.setSize(dottedSize);
997 System.out.println(
"Set dotted polyline size to (" + dottedSize.getWidth() +
", " + dottedSize.getHeight() +
"): " + dottedSizeSuccess);
1003 if (dottedPolylineMapObject !=
null) {
1004 boolean removed = locationWindow.removeDottedPolylineMapObject(dottedPolylineMapObject);
1005 System.out.println(
"Removed dotted polyline map object: " + removed);
1006 dottedPolylineMapObject =
null;
1011 List<DottedPolylineMapObject> dottedPolylines =
new ArrayList<>();
1012 for (
int i = 0; i < 2; i++) {
1013 DottedPolylineMapObject dottedPolyline = locationWindow.addDottedPolylineMapObject();
1014 if (dottedPolyline !=
null) {
1015 List<Point> points =
new ArrayList<>();
1016 points.add(
new Point(i * 40.0, i * 40.0 + 100.0));
1017 points.add(
new Point((i + 1) * 40.0, (i + 1) * 40.0 + 100.0));
1018 Polyline poly =
new Polyline(points);
1019 LocationPolyline locPoly =
new LocationPolyline(poly);
1020 dottedPolyline.setPolyLine(locPoly);
1021 dottedPolyline.setWidth(1.5);
1022 dottedPolyline.setColor(1.0, 0.0, 1.0, 0.6);
1023 dottedPolylines.add(dottedPolyline);
1024 System.out.println(
"Created dotted polyline " + i);
1028 for (
int i = 0; i < dottedPolylines.size(); i++) {
1029 locationWindow.removeDottedPolylineMapObject(dottedPolylines.get(i));
1030 System.out.println(
"Removed dotted polyline " + i);
1037 private void demonstrateRemoveAllMapObjects() {
1038 System.out.println(
"--- Remove All Map Objects ---");
1040 if (locationWindow ==
null) {
1041 System.out.println(
"LocationWindow not available yet");
1046 CircleMapObject circle = locationWindow.addCircleMapObject();
1047 IconMapObject icon = locationWindow.addIconMapObject();
1048 PolygonMapObject polygon = locationWindow.addPolygonMapObject();
1049 PolylineMapObject polyline = locationWindow.addPolylineMapObject();
1050 DottedPolylineMapObject dottedPolyline = locationWindow.addDottedPolylineMapObject();
1052 System.out.println(
"Created 5 map objects");
1056 locationWindow.removeAllMapObjects();
1057 System.out.println(
"Removed all map objects");
1065 if (circleMapObject !=
null) {
1066 locationWindow.removeCircleMapObject(circleMapObject);
1067 circleMapObject =
null;
1069 if (iconMapObject !=
null) {
1070 locationWindow.removeIconMapObject(iconMapObject);
1071 iconMapObject =
null;
1073 if (polygonMapObject !=
null) {
1075 polygonMapObject =
null;
1077 if (polylineMapObject !=
null) {
1078 locationWindow.removePolylineMapObject(polylineMapObject);
1079 polylineMapObject =
null;
1081 if (dottedPolylineMapObject !=
null) {
1082 locationWindow.removeDottedPolylineMapObject(dottedPolylineMapObject);
1083 dottedPolylineMapObject =
null;
1085 System.out.println(
"LocationWindowMapObjects example cleanup completed");