42 demonstrateLocationWindowMapObjectsMethods();
48 private void demonstrateLocationWindowMapObjectsMethods() {
49 System.out.println(
"=== LocationWindowMapObjects Example ===");
51 demonstrateLocationScopedGeometryRecords();
53 demonstrateCircleMapObjects();
54 demonstrateIconMapObjects();
55 demonstratePolygonMapObjects();
56 demonstratePolylineMapObjects();
57 demonstrateDottedPolylineMapObjects();
58 demonstrateRemoveAllMapObjects();
65 private void demonstrateLocationScopedGeometryRecords() {
66 System.out.println(
"--- LocationPolygon / LocationPolyline records ---");
69 List<Point> ring = Arrays.asList(
76 Polygon polygonBack = locationPolygon.getPolygon();
77 int polygonLocationId = locationPolygon.getLocationId();
78 int polygonSublocationId = locationPolygon.getSublocationId();
79 System.out.println(
"LocationPolygon: location " + polygonLocationId +
", sublocation "
80 + polygonSublocationId +
", vertices " + polygonBack.getPoints().size());
84 List<Point> linePoints = Arrays.asList(
new Point(0.0, 0.0),
new Point(10.0, 10.0));
87 Polyline polylineBack = locationPolyline.getPolyline();
88 System.out.println(
"LocationPolyline: points " + polylineBack.getPoints().size());
95 private void demonstrateCircleMapObjects() {
96 System.out.println(
"--- Circle Map Objects ---");
98 if (locationWindow ==
null) {
99 System.out.println(
"LocationWindow not available yet");
107 System.out.println(
"Created circle map object with center (" + center.getX() +
", " + center.getY() +
") and radius 5.0");
113 System.out.println(
"Circle center: (" + circleCenter.getX() +
", " + circleCenter.getY() +
")");
118 double radius = circleMapObject.getRadius();
119 System.out.println(
"Circle radius: " + radius);
125 System.out.println(
"Added circle map object");
128 if (circleMapObject !=
null) {
132 boolean success = circleMapObject.
setPosition(centerPoint);
133 System.out.println(
"Set circle position to (" + centerPoint.getX() +
", " + centerPoint.getY() +
"): " + success);
140 System.out.println(
"Set circle position with animation to (" + animatedPoint.getX() +
", " + animatedPoint.getY() +
"): " + animatedSuccess);
145 boolean radiusSuccess = circleMapObject.
setRadius(10.0);
146 System.out.println(
"Set circle radius to 10.0 meters: " + radiusSuccess);
152 System.out.println(
"Enabled collision detection for circle: " + collisionSuccess);
157 boolean bufferSuccess = circleMapObject.
setBuffer(5.0, 5.0);
158 System.out.println(
"Set collision buffer to 5x5 pixels: " + bufferSuccess);
163 boolean offsetSuccess = circleMapObject.
setOffset(2.0, 3.0);
164 System.out.println(
"Set position offset to (2.0, 3.0) pixels: " + offsetSuccess);
169 boolean outlineColorSuccess = circleMapObject.
setOutlineColor(0.0, 0.0, 1.0, 1.0);
170 System.out.println(
"Set circle outline color to blue: " + outlineColorSuccess);
176 System.out.println(
"Set circle outline alpha to 0.5: " + outlineAlphaSuccess);
182 System.out.println(
"Set circle outline radius to 2.0: " + outlineRadiusSuccess);
187 boolean colorSuccess = circleMapObject.
setColor(1.0, 0.0, 0.0, 0.8);
188 System.out.println(
"Set circle color to red with 80% opacity: " + colorSuccess);
193 boolean prioritySuccess = circleMapObject.
setPriority(1);
194 System.out.println(
"Set rendering priority to 1: " + prioritySuccess);
199 boolean visibleSuccess = circleMapObject.
setVisible(
true);
200 System.out.println(
"Set circle visibility to true: " + visibleSuccess);
205 MapObjectType objectType = circleMapObject.getMapObjectType();
206 System.out.println(
"Circle map object type: " + objectType);
211 boolean alphaSuccess = circleMapObject.
setAlpha(0.7);
212 System.out.println(
"Set circle alpha to 0.7: " + alphaSuccess);
217 boolean interactiveSuccess = circleMapObject.
setInteractive(
true);
218 System.out.println(
"Set circle interactive to true: " + interactiveSuccess);
223 boolean titleSuccess = circleMapObject.
setTitle(
"Circle Object");
224 System.out.println(
"Set circle title to 'Circle Object': " + titleSuccess);
229 Map<String, String> customData =
new HashMap<>();
230 customData.put(
"key",
"value");
231 customData.put(
"number",
"42");
232 boolean dataSuccess = circleMapObject.
setData(customData);
233 System.out.println(
"Set circle custom data: " + dataSuccess);
238 int objectId = circleMapObject.
getId();
239 System.out.println(
"Circle object ID: " + objectId);
244 String objectTypeString = circleMapObject.
getType();
245 System.out.println(
"Circle object type: " + objectTypeString);
250 Map<String, String> retrievedData = circleMapObject.
getData();
251 System.out.println(
"Circle custom data: " + retrievedData);
257 if (circleMapObject !=
null) {
258 boolean removed = locationWindow.removeCircleMapObject(circleMapObject);
259 System.out.println(
"Removed circle map object: " + removed);
260 circleMapObject =
null;
265 List<CircleMapObject> circles =
new ArrayList<>();
266 for (
int i = 0; i < 3; i++) {
267 CircleMapObject circle = locationWindow.addCircleMapObject();
268 if (circle !=
null) {
269 circle.
setPosition(
new LocationPoint(50.0 * i, 100.0 * i));
270 circle.
setColor(0.0, 1.0, 0.0, 0.6);
273 System.out.println(
"Created circle " + i +
" at (" + (50.0 * i) +
", " + (100.0 * i) +
") with radius " + (5.0 + i * 2.0));
277 for (
int i = 0; i < circles.size(); i++) {
278 locationWindow.removeCircleMapObject(circles.get(i));
279 System.out.println(
"Removed circle " + i);
286 private void demonstrateIconMapObjects() {
287 System.out.println(
"--- Icon Map Objects ---");
289 if (locationWindow ==
null) {
290 System.out.println(
"LocationWindow not available yet");
296 LocationPoint position =
new LocationPoint(30.0, 40.0);
297 iconMapObject = locationWindow.addIconMapObject();
298 System.out.println(
"Created icon map object at (" + position.getX() +
", " + position.getY() +
")");
303 LocationPoint iconPosition = iconMapObject.getPosition();
304 System.out.println(
"Icon position: (" + iconPosition.getX() +
", " + iconPosition.getY() +
")");
309 iconMapObject = locationWindow.addIconMapObject();
310 System.out.println(
"Added icon map object");
313 if (iconMapObject !=
null) {
316 LocationPoint iconPoint =
new LocationPoint(200.0, 300.0);
317 boolean success = iconMapObject.setPosition(iconPoint);
318 System.out.println(
"Set icon position to (" + iconPoint.getX() +
", " + iconPoint.getY() +
"): " + success);
323 LocationPoint animatedIconPoint =
new LocationPoint(250.0, 350.0);
324 boolean animatedSuccess = iconMapObject.setPositionAnimated(animatedIconPoint, 1.5, AnimationType.CUBIC);
325 System.out.println(
"Set icon position with animation to (" + animatedIconPoint.getX() +
", " + animatedIconPoint.getY() +
"): " + animatedSuccess);
330 boolean sizeSuccess = iconMapObject.setSize(32.0, 32.0);
331 System.out.println(
"Set icon size to 32x32 pixels: " + sizeSuccess);
336 boolean angleSuccess = iconMapObject.setAngle(45.0);
337 System.out.println(
"Set icon rotation angle to 45 degrees: " + angleSuccess);
342 boolean angleAnimatedSuccess = iconMapObject.setAngleAnimated(90.0, 2.0, AnimationType.SINE);
343 System.out.println(
"Set icon rotation with animation to 90 degrees: " + angleAnimatedSuccess);
348 boolean collisionSuccess = iconMapObject.setCollisionEnabled(
true);
349 System.out.println(
"Enabled collision detection for icon: " + collisionSuccess);
354 boolean bufferSuccess = iconMapObject.setBuffer(10.0, 10.0);
355 System.out.println(
"Set collision buffer to 10x10 pixels: " + bufferSuccess);
360 boolean offsetSuccess = iconMapObject.setOffset(0.0, -16.0);
361 System.out.println(
"Set position offset to (0.0, -16.0) pixels: " + offsetSuccess);
366 boolean prioritySuccess = iconMapObject.setPriority(2);
367 System.out.println(
"Set rendering priority to 2: " + prioritySuccess);
372 boolean visibleSuccess = iconMapObject.setVisible(
true);
373 System.out.println(
"Set icon visibility to true: " + visibleSuccess);
378 MapObjectType objectType = iconMapObject.getMapObjectType();
379 System.out.println(
"Icon map object type: " + objectType);
384 boolean iconSuccess = iconMapObject.setIcon(
"path/to/icon.png");
385 System.out.println(
"Set icon image: " + iconSuccess);
390 boolean bitmapSuccess = iconMapObject.setBitmap(
"path/to/bitmap.png");
391 System.out.println(
"Set icon bitmap: " + bitmapSuccess);
396 boolean flatSuccess = iconMapObject.setFlat(
true);
397 System.out.println(
"Set icon flat mode to true: " + flatSuccess);
402 boolean placementSuccess = iconMapObject.setPlacement(Placement.CENTER);
403 System.out.println(
"Set icon placement to CENTER: " + placementSuccess);
408 boolean alphaSuccess = iconMapObject.setAlpha(0.8);
409 System.out.println(
"Set icon alpha to 0.8: " + alphaSuccess);
414 boolean interactiveSuccess = iconMapObject.setInteractive(
true);
415 System.out.println(
"Set icon interactive to true: " + interactiveSuccess);
420 boolean titleSuccess = iconMapObject.setTitle(
"Icon Object");
421 System.out.println(
"Set icon title to 'Icon Object': " + titleSuccess);
426 Map<String, Object> customData =
new HashMap<>();
427 customData.put(
"key",
"value");
428 customData.put(
"number", 42);
429 boolean dataSuccess = iconMapObject.setData(customData);
430 System.out.println(
"Set icon custom data: " + dataSuccess);
435 int objectId = iconMapObject.getId();
436 System.out.println(
"Icon object ID: " + objectId);
441 String objectTypeString = iconMapObject.getType();
442 System.out.println(
"Icon object type: " + objectTypeString);
447 Map<String, Object> retrievedData = iconMapObject.getData();
448 System.out.println(
"Icon custom data: " + retrievedData);
454 if (iconMapObject !=
null) {
455 boolean removed = locationWindow.removeIconMapObject(iconMapObject);
456 System.out.println(
"Removed icon map object: " + removed);
457 iconMapObject =
null;
462 List<IconMapObject> icons =
new ArrayList<>();
463 for (
int i = 0; i < 3; i++) {
464 IconMapObject icon = locationWindow.addIconMapObject();
466 icon.
setPosition(
new LocationPoint(100.0 * i, 150.0 * i));
470 System.out.println(
"Created icon " + i +
" at (" + (100.0 * i) +
", " + (150.0 * i) +
") with angle " + (i * 30.0));
474 for (
int i = 0; i < icons.size(); i++) {
475 locationWindow.removeIconMapObject(icons.get(i));
476 System.out.println(
"Removed icon " + i);
483 private void demonstratePolygonMapObjects() {
484 System.out.println(
"--- Polygon Map Objects ---");
486 if (locationWindow ==
null) {
487 System.out.println(
"LocationWindow not available yet");
493 polygonMapObject = locationWindow.addPolygonMapObject();
494 System.out.println(
"Added polygon map object");
497 if (polygonMapObject !=
null) {
500 List<Point> points = Arrays.asList(
501 new Point(100.0, 200.0),
502 new Point(150.0, 250.0),
503 new Point(200.0, 200.0),
504 new Point(150.0, 150.0)
506 Polygon metricPolygon =
new Polygon(points);
507 LocationPolygon polygon =
new LocationPolygon(metricPolygon, 1, 0);
508 boolean success = polygonMapObject.setPolygon(polygon);
509 System.out.println(
"Set polygon with " + points.size() +
" points: " + success);
514 boolean colorSuccess = polygonMapObject.setColor(0.0, 1.0, 0.0, 0.7);
515 System.out.println(
"Set polygon color to green with 70% opacity: " + colorSuccess);
520 boolean visibleSuccess = polygonMapObject.setVisible(
true);
521 System.out.println(
"Set polygon visibility to true: " + visibleSuccess);
526 MapObjectType objectType = polygonMapObject.getMapObjectType();
527 System.out.println(
"Polygon map object type: " + objectType);
532 boolean orderSuccess = polygonMapObject.setOrder(2);
533 System.out.println(
"Set polygon rendering order to 2: " + orderSuccess);
538 boolean outlineColorSuccess = polygonMapObject.setOutlineColor(0.0, 0.0, 1.0, 1.0);
539 System.out.println(
"Set polygon outline color to blue: " + outlineColorSuccess);
544 boolean outlineWidthSuccess = polygonMapObject.setOutlineWidth(2.0);
545 System.out.println(
"Set polygon outline width to 2.0 pixels: " + outlineWidthSuccess);
550 boolean outlineAlphaSuccess = polygonMapObject.setOutlineAlpha(0.8);
551 System.out.println(
"Set polygon outline alpha to 0.8: " + outlineAlphaSuccess);
556 boolean outlineOrderSuccess = polygonMapObject.setOutlineOrder(1);
557 System.out.println(
"Set polygon outline order to 1: " + outlineOrderSuccess);
562 boolean alphaSuccess = polygonMapObject.setAlpha(0.7);
563 System.out.println(
"Set polygon alpha to 0.7: " + alphaSuccess);
568 boolean interactiveSuccess = polygonMapObject.setInteractive(
true);
569 System.out.println(
"Set polygon interactive to true: " + interactiveSuccess);
574 boolean titleSuccess = polygonMapObject.setTitle(
"Polygon Object");
575 System.out.println(
"Set polygon title to 'Polygon Object': " + titleSuccess);
580 Map<String, Object> customData =
new HashMap<>();
581 customData.put(
"key",
"value");
582 customData.put(
"number", 42);
583 boolean dataSuccess = polygonMapObject.setData(customData);
584 System.out.println(
"Set polygon custom data: " + dataSuccess);
589 int objectId = polygonMapObject.getId();
590 System.out.println(
"Polygon object ID: " + objectId);
595 String objectTypeString = polygonMapObject.getType();
596 System.out.println(
"Polygon object type: " + objectTypeString);
601 Map<String, Object> retrievedData = polygonMapObject.getData();
602 System.out.println(
"Polygon custom data: " + retrievedData);
608 if (polygonMapObject !=
null) {
609 boolean removed = locationWindow.removePolygonMapObject(polygonMapObject);
610 System.out.println(
"Removed polygon map object: " + removed);
611 polygonMapObject =
null;
616 List<PolygonMapObject> polygons =
new ArrayList<>();
617 for (
int i = 0; i < 3; i++) {
618 PolygonMapObject polygon = locationWindow.addPolygonMapObject();
619 if (polygon !=
null) {
620 List<Point> points = Arrays.asList(
621 new Point(300.0 + i * 50, 400.0 + i * 50),
622 new Point(350.0 + i * 50, 450.0 + i * 50),
623 new Point(400.0 + i * 50, 400.0 + i * 50),
624 new Point(350.0 + i * 50, 350.0 + i * 50)
626 Polygon metricPoly =
new Polygon(points);
627 LocationPolygon polygonGeometry =
new LocationPolygon(metricPoly, 1, 0);
629 polygon.
setColor(0.0, 0.0, 1.0, 0.5);
630 polygons.add(polygon);
631 System.out.println(
"Created polygon " + i +
" with " + points.size() +
" points");
635 for (
int i = 0; i < polygons.size(); i++) {
636 locationWindow.removePolygonMapObject(polygons.get(i));
637 System.out.println(
"Removed polygon " + i);
644 private void demonstratePolylineMapObjects() {
645 System.out.println(
"--- Polyline Map Objects ---");
647 if (locationWindow ==
null) {
648 System.out.println(
"LocationWindow not available yet");
654 List<Point> points =
new ArrayList<>();
655 points.add(
new Point(100.0, 110.0));
656 points.add(
new Point(105.0, 115.0));
657 points.add(
new Point(110.0, 120.0));
658 points.add(
new Point(115.0, 125.0));
659 Polyline polyline =
new Polyline(points);
660 LocationPolyline locationPolyline =
new LocationPolyline(polyline, 1, 0);
661 polylineMapObject = locationWindow.addPolylineMapObject();
662 System.out.println(
"Created polyline map object with " + points.size() +
" points");
667 LocationPolyline polylineShape = polylineMapObject.getPolyLine();
668 System.out.println(
"Polyline has " + polylineShape.getPolyline().getPoints().size() +
" points");
673 polylineMapObject = locationWindow.addPolylineMapObject();
674 System.out.println(
"Added polyline map object");
677 if (polylineMapObject !=
null) {
680 List<Point> polylinePoints =
new ArrayList<>();
681 polylinePoints.add(
new Point(0.0, 0.0));
682 polylinePoints.add(
new Point(50.0, 50.0));
683 polylinePoints.add(
new Point(100.0, 0.0));
684 polylinePoints.add(
new Point(150.0, 50.0));
685 Polyline polyline =
new Polyline(polylinePoints);
686 LocationPolyline locationPolyline =
new LocationPolyline(polyline, 1, 0);
687 boolean success = polylineMapObject.setPolyLine(locationPolyline);
688 System.out.println(
"Set polyline geometry: " + success);
693 boolean widthSuccess = polylineMapObject.setWidth(3.0);
694 System.out.println(
"Set polyline width to 3.0 pixels: " + widthSuccess);
699 boolean colorSuccess = polylineMapObject.setColor(1.0, 0.5, 0.0, 0.9);
700 System.out.println(
"Set polyline color to orange with 90% opacity: " + colorSuccess);
705 boolean orderSuccess = polylineMapObject.setOrder(2);
706 System.out.println(
"Set rendering order to 2: " + orderSuccess);
711 boolean capSuccess = polylineMapObject.setCapType(CapType.ROUND);
712 System.out.println(
"Set cap type to ROUND: " + capSuccess);
717 boolean joinSuccess = polylineMapObject.setJoinType(JoinType.ROUND);
718 System.out.println(
"Set join type to ROUND: " + joinSuccess);
723 boolean miterSuccess = polylineMapObject.setMiterLimit(5.0);
724 System.out.println(
"Set miter limit to 5.0: " + miterSuccess);
729 boolean visibleSuccess = polylineMapObject.setVisible(
true);
730 System.out.println(
"Set polyline visibility to true: " + visibleSuccess);
735 MapObjectType objectType = polylineMapObject.getMapObjectType();
736 System.out.println(
"Polyline map object type: " + objectType);
741 boolean alphaSuccess = polylineMapObject.setAlpha(0.7);
742 System.out.println(
"Set polyline alpha to 0.7: " + alphaSuccess);
747 boolean interactiveSuccess = polylineMapObject.setInteractive(
true);
748 System.out.println(
"Set polyline interactive to true: " + interactiveSuccess);
753 boolean titleSuccess = polylineMapObject.setTitle(
"Polyline Object");
754 System.out.println(
"Set polyline title to 'Polyline Object': " + titleSuccess);
759 Map<String, Object> customData =
new HashMap<>();
760 customData.put(
"key",
"value");
761 customData.put(
"number", 42);
762 boolean dataSuccess = polylineMapObject.setData(customData);
763 System.out.println(
"Set polyline custom data: " + dataSuccess);
768 int objectId = polylineMapObject.getId();
769 System.out.println(
"Polyline object ID: " + objectId);
774 String objectTypeString = polylineMapObject.getType();
775 System.out.println(
"Polyline object type: " + objectTypeString);
780 Map<String, Object> retrievedData = polylineMapObject.getData();
781 System.out.println(
"Polyline custom data: " + retrievedData);
786 boolean outlineWidthSuccess2 = polylineMapObject.setOutlineWidth(1.0);
787 System.out.println(
"Set polyline outline width to 1.0 pixels: " + outlineWidthSuccess2);
792 boolean outlineColorSuccess2 = polylineMapObject.setOutlineColor(0.0, 0.0, 0.0, 1.0);
793 System.out.println(
"Set polyline outline color to black: " + outlineColorSuccess2);
798 boolean outlineAlphaSuccess2 = polylineMapObject.setOutlineAlpha(0.5);
799 System.out.println(
"Set polyline outline alpha to 0.5: " + outlineAlphaSuccess2);
804 boolean outlineOrderSuccess2 = polylineMapObject.setOutlineOrder(0);
805 System.out.println(
"Set polyline outline rendering order to 0: " + outlineOrderSuccess2);
810 boolean outlineCapTypeSuccess2 = polylineMapObject.setOutlineCapType(CapType.SQUARE);
811 System.out.println(
"Set polyline outline cap type to SQUARE: " + outlineCapTypeSuccess2);
816 boolean outlineJoinTypeSuccess2 = polylineMapObject.setOutlineJoinType(JoinType.MITER);
817 System.out.println(
"Set polyline outline join type to MITER: " + outlineJoinTypeSuccess2);
822 boolean outlineMiterLimitSuccess2 = polylineMapObject.setOutlineMiterLimit(3.0);
823 System.out.println(
"Set polyline outline miter limit to 3.0: " + outlineMiterLimitSuccess2);
829 if (polylineMapObject !=
null) {
830 boolean removed = locationWindow.removePolylineMapObject(polylineMapObject);
831 System.out.println(
"Removed polyline map object: " + removed);
832 polylineMapObject =
null;
837 List<PolylineMapObject> polylines =
new ArrayList<>();
838 for (
int i = 0; i < 3; i++) {
839 PolylineMapObject polyline = locationWindow.addPolylineMapObject();
840 if (polyline !=
null) {
841 List<Point> points =
new ArrayList<>();
842 points.add(
new Point(i * 30.0, i * 30.0));
843 points.add(
new Point((i + 1) * 30.0, (i + 1) * 30.0));
844 Polyline poly =
new Polyline(points);
845 LocationPolyline locPoly =
new LocationPolyline(poly, 1, 0);
848 polyline.
setColor(0.0, 1.0, 1.0, 0.8);
849 polylines.add(polyline);
850 System.out.println(
"Created polyline " + i +
" with width " + (2.0 + i));
854 for (
int i = 0; i < polylines.size(); i++) {
855 locationWindow.removePolylineMapObject(polylines.get(i));
856 System.out.println(
"Removed polyline " + i);
863 private void demonstrateDottedPolylineMapObjects() {
864 System.out.println(
"--- Dotted Polyline Map Objects ---");
866 if (locationWindow ==
null) {
867 System.out.println(
"LocationWindow not available yet");
873 List<Point> points =
new ArrayList<>();
874 points.add(
new Point(160.0, 170.0));
875 points.add(
new Point(165.0, 175.0));
876 points.add(
new Point(170.0, 180.0));
877 points.add(
new Point(175.0, 185.0));
878 Polyline polyline =
new Polyline(points);
879 LocationPolyline locationPolyline =
new LocationPolyline(polyline, 1, 0);
880 dottedPolylineMapObject = locationWindow.addDottedPolylineMapObject();
881 System.out.println(
"Created dotted polyline map object with " + points.size() +
" points");
886 LocationPolyline dottedPolylineShape = dottedPolylineMapObject.getPolyLine();
887 System.out.println(
"Dotted polyline has " + dottedPolylineShape.getPolyline().getPoints().size() +
" points");
892 dottedPolylineMapObject = locationWindow.addDottedPolylineMapObject();
893 System.out.println(
"Added dotted polyline map object");
896 if (dottedPolylineMapObject !=
null) {
899 List<Point> dottedPoints =
new ArrayList<>();
900 dottedPoints.add(
new Point(0.0, 100.0));
901 dottedPoints.add(
new Point(50.0, 150.0));
902 dottedPoints.add(
new Point(100.0, 100.0));
903 dottedPoints.add(
new Point(150.0, 150.0));
904 Polyline dottedPolyline =
new Polyline(dottedPoints);
905 LocationPolyline locationDottedPolyline =
new LocationPolyline(dottedPolyline, 1, 0);
906 boolean success = dottedPolylineMapObject.setPolyLine(locationDottedPolyline);
907 System.out.println(
"Set dotted polyline geometry: " + success);
912 boolean widthSuccess = dottedPolylineMapObject.setWidth(2.0);
913 System.out.println(
"Set dotted polyline width to 2.0 pixels: " + widthSuccess);
918 boolean colorSuccess = dottedPolylineMapObject.setColor(0.5, 0.0, 1.0, 0.8);
919 System.out.println(
"Set dotted polyline color to purple with 80% opacity: " + colorSuccess);
924 boolean orderSuccess = dottedPolylineMapObject.setOrder(3);
925 System.out.println(
"Set rendering order to 3: " + orderSuccess);
930 boolean visibleSuccess = dottedPolylineMapObject.setVisible(
true);
931 System.out.println(
"Set dotted polyline visibility to true: " + visibleSuccess);
936 MapObjectType objectType = dottedPolylineMapObject.getMapObjectType();
937 System.out.println(
"Dotted polyline map object type: " + objectType);
942 boolean alphaSuccess = dottedPolylineMapObject.setAlpha(0.8);
943 System.out.println(
"Set dotted polyline alpha to 0.8: " + alphaSuccess);
948 boolean interactiveSuccess = dottedPolylineMapObject.setInteractive(
true);
949 System.out.println(
"Set dotted polyline interactive to true: " + interactiveSuccess);
954 boolean titleSuccess = dottedPolylineMapObject.setTitle(
"Dotted Polyline Object");
955 System.out.println(
"Set dotted polyline title to 'Dotted Polyline Object': " + titleSuccess);
960 Map<String, Object> customData =
new HashMap<>();
961 customData.put(
"key",
"value");
962 customData.put(
"number", 42);
963 boolean dataSuccess = dottedPolylineMapObject.setData(customData);
964 System.out.println(
"Set dotted polyline custom data: " + dataSuccess);
969 int objectId = dottedPolylineMapObject.getId();
970 System.out.println(
"Dotted polyline object ID: " + objectId);
975 String objectTypeString = dottedPolylineMapObject.getType();
976 System.out.println(
"Dotted polyline object type: " + objectTypeString);
981 Map<String, Object> retrievedData = dottedPolylineMapObject.getData();
982 System.out.println(
"Dotted polyline custom data: " + retrievedData);
987 boolean dottedCollisionSuccess = dottedPolylineMapObject.setCollisionEnabled(
true);
988 System.out.println(
"Enabled collision detection for dotted polyline: " + dottedCollisionSuccess);
993 boolean dottedPlacementSuccess = dottedPolylineMapObject.setPlacement(Placement.CENTER);
994 System.out.println(
"Set dotted polyline placement to CENTER: " + dottedPlacementSuccess);
999 boolean dottedMinRatioSuccess = dottedPolylineMapObject.setPlacementMinRatio(0.5);
1000 System.out.println(
"Set dotted polyline placement min ratio to 0.5: " + dottedMinRatioSuccess);
1005 boolean dottedSpacingSuccess = dottedPolylineMapObject.setPlacementSpacing(10.0);
1006 System.out.println(
"Set dotted polyline placement spacing to 10.0: " + dottedSpacingSuccess);
1011 boolean dottedPrioritySuccess = dottedPolylineMapObject.setPriority(1);
1012 System.out.println(
"Set dotted polyline rendering priority to 1: " + dottedPrioritySuccess);
1017 boolean dottedRepeatDistanceSuccess = dottedPolylineMapObject.setRepeatDistance(20.0);
1018 System.out.println(
"Set dotted polyline repeat distance to 20.0: " + dottedRepeatDistanceSuccess);
1023 boolean dottedRepeatGroupSuccess = dottedPolylineMapObject.setRepeatGroup(1);
1024 System.out.println(
"Set dotted polyline repeat group to 1: " + dottedRepeatGroupSuccess);
1029 Size dottedSize =
new Size(16.0, 16.0);
1030 boolean dottedSizeSuccess = dottedPolylineMapObject.setSize(dottedSize);
1031 System.out.println(
"Set dotted polyline size to (" + dottedSize.getWidth() +
", " + dottedSize.getHeight() +
"): " + dottedSizeSuccess);
1037 if (dottedPolylineMapObject !=
null) {
1038 boolean removed = locationWindow.removeDottedPolylineMapObject(dottedPolylineMapObject);
1039 System.out.println(
"Removed dotted polyline map object: " + removed);
1040 dottedPolylineMapObject =
null;
1045 List<DottedPolylineMapObject> dottedPolylines =
new ArrayList<>();
1046 for (
int i = 0; i < 2; i++) {
1047 DottedPolylineMapObject dottedPolyline = locationWindow.addDottedPolylineMapObject();
1048 if (dottedPolyline !=
null) {
1049 List<Point> points =
new ArrayList<>();
1050 points.add(
new Point(i * 40.0, i * 40.0 + 100.0));
1051 points.add(
new Point((i + 1) * 40.0, (i + 1) * 40.0 + 100.0));
1052 Polyline poly =
new Polyline(points);
1053 LocationPolyline locPoly =
new LocationPolyline(poly, 1, 0);
1055 dottedPolyline.setWidth(1.5);
1056 dottedPolyline.
setColor(1.0, 0.0, 1.0, 0.6);
1057 dottedPolylines.add(dottedPolyline);
1058 System.out.println(
"Created dotted polyline " + i);
1062 for (
int i = 0; i < dottedPolylines.size(); i++) {
1063 locationWindow.removeDottedPolylineMapObject(dottedPolylines.get(i));
1064 System.out.println(
"Removed dotted polyline " + i);
1071 private void demonstrateRemoveAllMapObjects() {
1072 System.out.println(
"--- Remove All Map Objects ---");
1074 if (locationWindow ==
null) {
1075 System.out.println(
"LocationWindow not available yet");
1080 CircleMapObject circle = locationWindow.addCircleMapObject();
1081 IconMapObject icon = locationWindow.addIconMapObject();
1082 PolygonMapObject polygon = locationWindow.addPolygonMapObject();
1083 PolylineMapObject polyline = locationWindow.addPolylineMapObject();
1084 DottedPolylineMapObject dottedPolyline = locationWindow.addDottedPolylineMapObject();
1086 System.out.println(
"Created 5 map objects");
1090 locationWindow.removeAllMapObjects();
1091 System.out.println(
"Removed all map objects");
1099 if (circleMapObject !=
null) {
1100 locationWindow.removeCircleMapObject(circleMapObject);
1101 circleMapObject =
null;
1103 if (iconMapObject !=
null) {
1104 locationWindow.removeIconMapObject(iconMapObject);
1105 iconMapObject =
null;
1107 if (polygonMapObject !=
null) {
1109 polygonMapObject =
null;
1111 if (polylineMapObject !=
null) {
1112 locationWindow.removePolylineMapObject(polylineMapObject);
1113 polylineMapObject =
null;
1115 if (dottedPolylineMapObject !=
null) {
1116 locationWindow.removeDottedPolylineMapObject(dottedPolylineMapObject);
1117 dottedPolylineMapObject =
null;
1119 System.out.println(
"LocationWindowMapObjects example cleanup completed");