52 demonstrateLocationWindowMapObjectsMethods();
58 private void demonstrateLocationWindowMapObjectsMethods() {
59 System.out.println(
"=== LocationWindowMapObjects Example ===");
61 demonstrateLocationScopedGeometryRecords();
63 demonstrateCircleMapObjects();
64 demonstrateIconMapObjects();
65 demonstrateClusterMapObjects();
66 demonstrateModelMapObjects();
67 demonstratePolygonMapObjects();
68 demonstratePolylineMapObjects();
69 demonstrateDottedPolylineMapObjects();
70 demonstrateRemoveAllMapObjects();
77 private void demonstrateLocationScopedGeometryRecords() {
78 System.out.println(
"--- LocationPolygon / LocationPolyline records ---");
81 List<Point> ring = Arrays.asList(
88 Polygon polygonBack = locationPolygon.getPolygon();
89 int polygonLocationId = locationPolygon.getLocationId();
90 int polygonSublocationId = locationPolygon.getSublocationId();
91 System.out.println(
"LocationPolygon: location " + polygonLocationId +
", sublocation "
92 + polygonSublocationId +
", vertices " + polygonBack.getPoints().size());
96 List<Point> linePoints = Arrays.asList(
new Point(0.0, 0.0),
new Point(10.0, 10.0));
99 Polyline polylineBack = locationPolyline.getPolyline();
100 System.out.println(
"LocationPolyline: points " + polylineBack.getPoints().size());
107 private void demonstrateCircleMapObjects() {
108 System.out.println(
"--- Circle Map Objects ---");
110 if (locationWindow ==
null) {
111 System.out.println(
"LocationWindow not available yet");
119 System.out.println(
"Created circle map object with center (" + center.getX() +
", " + center.getY() +
") and radius 5.0");
125 System.out.println(
"Circle center: (" + circleCenter.getX() +
", " + circleCenter.getY() +
")");
130 double radius = circleMapObject.getRadius();
131 System.out.println(
"Circle radius: " + radius);
137 System.out.println(
"Added circle map object");
140 if (circleMapObject !=
null) {
144 boolean success = circleMapObject.
setPosition(centerPoint);
145 System.out.println(
"Set circle position to (" + centerPoint.getX() +
", " + centerPoint.getY() +
"): " + success);
152 System.out.println(
"Set circle position with animation to (" + animatedPoint.getX() +
", " + animatedPoint.getY() +
"): " + animatedSuccess);
157 boolean radiusSuccess = circleMapObject.
setRadius(10.0);
158 System.out.println(
"Set circle radius to 10.0 meters: " + radiusSuccess);
164 System.out.println(
"Enabled collision detection for circle: " + collisionSuccess);
169 boolean bufferSuccess = circleMapObject.
setBuffer(5.0, 5.0);
170 System.out.println(
"Set collision buffer to 5x5 pixels: " + bufferSuccess);
175 boolean offsetSuccess = circleMapObject.
setOffset(2.0, 3.0);
176 System.out.println(
"Set position offset to (2.0, 3.0) pixels: " + offsetSuccess);
181 boolean outlineColorSuccess = circleMapObject.
setOutlineColor(0.0, 0.0, 1.0, 1.0);
182 System.out.println(
"Set circle outline color to blue: " + outlineColorSuccess);
188 System.out.println(
"Set circle outline alpha to 0.5: " + outlineAlphaSuccess);
194 System.out.println(
"Set circle outline radius to 2.0: " + outlineRadiusSuccess);
199 boolean colorSuccess = circleMapObject.
setColor(1.0, 0.0, 0.0, 0.8);
200 System.out.println(
"Set circle color to red with 80% opacity: " + colorSuccess);
205 boolean prioritySuccess = circleMapObject.
setPriority(1);
206 System.out.println(
"Set rendering priority to 1: " + prioritySuccess);
211 boolean visibleSuccess = circleMapObject.
setVisible(
true);
212 System.out.println(
"Set circle visibility to true: " + visibleSuccess);
217 MapObjectType objectType = circleMapObject.getMapObjectType();
218 System.out.println(
"Circle map object type: " + objectType);
223 boolean alphaSuccess = circleMapObject.
setAlpha(0.7);
224 System.out.println(
"Set circle alpha to 0.7: " + alphaSuccess);
229 boolean interactiveSuccess = circleMapObject.
setInteractive(
true);
230 System.out.println(
"Set circle interactive to true: " + interactiveSuccess);
235 boolean titleSuccess = circleMapObject.
setTitle(
"Circle Object");
236 System.out.println(
"Set circle title to 'Circle Object': " + titleSuccess);
241 Map<String, String> customData =
new HashMap<>();
242 customData.put(
"key",
"value");
243 customData.put(
"number",
"42");
244 boolean dataSuccess = circleMapObject.
setData(customData);
245 System.out.println(
"Set circle custom data: " + dataSuccess);
250 int objectId = circleMapObject.
getId();
251 System.out.println(
"Circle object ID: " + objectId);
256 String objectTypeString = circleMapObject.
getType();
257 System.out.println(
"Circle object type: " + objectTypeString);
262 Map<String, String> retrievedData = circleMapObject.
getData();
263 System.out.println(
"Circle custom data: " + retrievedData);
269 if (circleMapObject !=
null) {
270 boolean removed = locationWindow.removeCircleMapObject(circleMapObject);
271 System.out.println(
"Removed circle map object: " + removed);
272 circleMapObject =
null;
277 List<CircleMapObject> circles =
new ArrayList<>();
278 for (
int i = 0; i < 3; i++) {
279 CircleMapObject circle = locationWindow.addCircleMapObject();
280 if (circle !=
null) {
281 circle.
setPosition(
new LocationPoint(50.0 * i, 100.0 * i));
282 circle.
setColor(0.0, 1.0, 0.0, 0.6);
285 System.out.println(
"Created circle " + i +
" at (" + (50.0 * i) +
", " + (100.0 * i) +
") with radius " + (5.0 + i * 2.0));
289 for (
int i = 0; i < circles.size(); i++) {
290 locationWindow.removeCircleMapObject(circles.get(i));
291 System.out.println(
"Removed circle " + i);
298 private void demonstrateIconMapObjects() {
299 System.out.println(
"--- Icon Map Objects ---");
301 if (locationWindow ==
null) {
302 System.out.println(
"LocationWindow not available yet");
308 LocationPoint position =
new LocationPoint(30.0, 40.0);
309 iconMapObject = locationWindow.addIconMapObject();
310 System.out.println(
"Created icon map object at (" + position.getX() +
", " + position.getY() +
")");
315 LocationPoint iconPosition = iconMapObject.getPosition();
316 System.out.println(
"Icon position: (" + iconPosition.getX() +
", " + iconPosition.getY() +
")");
321 iconMapObject = locationWindow.addIconMapObject();
322 System.out.println(
"Added icon map object");
325 if (iconMapObject !=
null) {
328 LocationPoint iconPoint =
new LocationPoint(200.0, 300.0);
329 boolean success = iconMapObject.setPosition(iconPoint);
330 System.out.println(
"Set icon position to (" + iconPoint.getX() +
", " + iconPoint.getY() +
"): " + success);
335 LocationPoint animatedIconPoint =
new LocationPoint(250.0, 350.0);
336 boolean animatedSuccess = iconMapObject.setPositionAnimated(animatedIconPoint, 1.5, AnimationType.CUBIC);
337 System.out.println(
"Set icon position with animation to (" + animatedIconPoint.getX() +
", " + animatedIconPoint.getY() +
"): " + animatedSuccess);
342 boolean sizeSuccess = iconMapObject.setSize(32.0, 32.0);
343 System.out.println(
"Set icon size to 32x32 pixels: " + sizeSuccess);
348 boolean angleSuccess = iconMapObject.setAngle(45.0);
349 System.out.println(
"Set icon rotation angle to 45 degrees: " + angleSuccess);
354 boolean angleAnimatedSuccess = iconMapObject.setAngleAnimated(90.0, 2.0, AnimationType.SINE);
355 System.out.println(
"Set icon rotation with animation to 90 degrees: " + angleAnimatedSuccess);
360 boolean collisionSuccess = iconMapObject.setCollisionEnabled(
true);
361 System.out.println(
"Enabled collision detection for icon: " + collisionSuccess);
366 boolean bufferSuccess = iconMapObject.setBuffer(10.0, 10.0);
367 System.out.println(
"Set collision buffer to 10x10 pixels: " + bufferSuccess);
372 boolean offsetSuccess = iconMapObject.setOffset(0.0, -16.0);
373 System.out.println(
"Set position offset to (0.0, -16.0) pixels: " + offsetSuccess);
378 boolean prioritySuccess = iconMapObject.setPriority(2);
379 System.out.println(
"Set rendering priority to 2: " + prioritySuccess);
384 boolean visibleSuccess = iconMapObject.setVisible(
true);
385 System.out.println(
"Set icon visibility to true: " + visibleSuccess);
390 MapObjectType objectType = iconMapObject.getMapObjectType();
391 System.out.println(
"Icon map object type: " + objectType);
396 ImageProvider iconBitmap = ImageProvider.fromFile(
"/path/to/icon.png",
true);
397 boolean bitmapSuccess = iconMapObject.setBitmap(iconBitmap);
398 System.out.println(
"Set icon from ImageProvider: " + bitmapSuccess);
403 boolean flatSuccess = iconMapObject.setFlat(
true);
404 System.out.println(
"Set icon flat mode to true: " + flatSuccess);
409 boolean alphaSuccess = iconMapObject.setAlpha(0.8f);
410 System.out.println(
"Set icon alpha to 0.8: " + alphaSuccess);
415 boolean interactiveSuccess = iconMapObject.setInteractive(
true);
416 System.out.println(
"Set icon interactive to true: " + interactiveSuccess);
421 boolean titleSuccess = iconMapObject.setTitle(
"Icon Object");
422 System.out.println(
"Set icon title to 'Icon Object': " + titleSuccess);
427 Map<String, Object> customData =
new HashMap<>();
428 customData.put(
"key",
"value");
429 customData.put(
"number", 42);
430 boolean dataSuccess = iconMapObject.setData(customData);
431 System.out.println(
"Set icon custom data: " + dataSuccess);
436 int objectId = iconMapObject.getId();
437 System.out.println(
"Icon object ID: " + objectId);
442 String objectTypeString = iconMapObject.getType();
443 System.out.println(
"Icon object type: " + objectTypeString);
448 Map<String, Object> retrievedData = iconMapObject.getData();
449 System.out.println(
"Icon custom data: " + retrievedData);
455 if (iconMapObject !=
null) {
456 boolean removed = locationWindow.removeIconMapObject(iconMapObject);
457 System.out.println(
"Removed icon map object: " + removed);
458 iconMapObject =
null;
463 List<IconMapObject> icons =
new ArrayList<>();
464 for (
int i = 0; i < 3; i++) {
465 IconMapObject icon = locationWindow.addIconMapObject();
467 icon.
setPosition(
new LocationPoint(100.0 * i, 150.0 * i));
471 System.out.println(
"Created icon " + i +
" at (" + (100.0 * i) +
", " + (150.0 * i) +
") with angle " + (i * 30.0));
475 for (
int i = 0; i < icons.size(); i++) {
476 locationWindow.removeIconMapObject(icons.get(i));
477 System.out.println(
"Removed icon " + i);
484 private void demonstrateModelMapObjects() {
485 System.out.println(
"--- Model Map Objects ---");
487 if (locationWindow ==
null) {
488 System.out.println(
"LocationWindow not available yet");
493 modelMapObject = locationWindow.addModelMapObject();
494 System.out.println(
"Added model map object: " + (modelMapObject !=
null));
497 if (modelMapObject ==
null) {
502 LocationPoint modelPoint =
new LocationPoint(12.0, 34.0);
503 boolean posOk = modelMapObject.setPosition(modelPoint);
504 System.out.println(
"Model setPosition: " + posOk);
508 boolean posAnimOk = modelMapObject.setPositionAnimated(
509 new LocationPoint(15.0, 40.0), 0.5f, AnimationType.SINE);
510 System.out.println(
"Model setPositionAnimated: " + posAnimOk);
514 ImageProvider texture = ImageProvider.fromFile(
"/path/to/model_texture.png",
true);
515 ModelProvider model = ModelProvider.fromFile(
"/path/to/model.obj", texture);
516 boolean modelOk = modelMapObject.setModel(model);
517 System.out.println(
"Model setModel: " + modelOk);
521 boolean sizeOk = modelMapObject.setSize(64.0f, 64.0f);
522 System.out.println(
"Model setSize: " + sizeOk);
526 boolean collOk = modelMapObject.setCollisionEnabled(
true);
527 System.out.println(
"Model setCollisionEnabled: " + collOk);
531 boolean angleOk = modelMapObject.setAngle(45.0f);
532 System.out.println(
"Model setAngle: " + angleOk);
536 boolean angleAnimOk = modelMapObject.setAngleAnimated(90.0f, 0.5f, AnimationType.QUINT);
537 System.out.println(
"Model setAngleAnimated: " + angleAnimOk);
541 boolean bufOk = modelMapObject.setBuffer(4.0f, 4.0f);
542 System.out.println(
"Model setBuffer: " + bufOk);
546 boolean priOk = modelMapObject.setPriority(10.0f);
547 System.out.println(
"Model setPriority: " + priOk);
551 boolean removed = locationWindow.removeModelMapObject(modelMapObject);
552 System.out.println(
"Removed model map object: " + removed);
553 modelMapObject =
null;
560 private void demonstratePolygonMapObjects() {
561 System.out.println(
"--- Polygon Map Objects ---");
563 if (locationWindow ==
null) {
564 System.out.println(
"LocationWindow not available yet");
570 polygonMapObject = locationWindow.addPolygonMapObject();
571 System.out.println(
"Added polygon map object");
574 if (polygonMapObject !=
null) {
577 List<Point> points = Arrays.asList(
578 new Point(100.0, 200.0),
579 new Point(150.0, 250.0),
580 new Point(200.0, 200.0),
581 new Point(150.0, 150.0)
583 Polygon metricPolygon =
new Polygon(points);
584 LocationPolygon polygon =
new LocationPolygon(metricPolygon, 1, 0);
585 boolean success = polygonMapObject.setPolygon(polygon);
586 System.out.println(
"Set polygon with " + points.size() +
" points: " + success);
591 boolean colorSuccess = polygonMapObject.setColor(0.0, 1.0, 0.0, 0.7);
592 System.out.println(
"Set polygon color to green with 70% opacity: " + colorSuccess);
597 boolean visibleSuccess = polygonMapObject.setVisible(
true);
598 System.out.println(
"Set polygon visibility to true: " + visibleSuccess);
603 MapObjectType objectType = polygonMapObject.getMapObjectType();
604 System.out.println(
"Polygon map object type: " + objectType);
609 boolean orderSuccess = polygonMapObject.setOrder(2);
610 System.out.println(
"Set polygon rendering order to 2: " + orderSuccess);
615 boolean outlineColorSuccess = polygonMapObject.setOutlineColor(0.0, 0.0, 1.0, 1.0);
616 System.out.println(
"Set polygon outline color to blue: " + outlineColorSuccess);
621 boolean outlineWidthSuccess = polygonMapObject.setOutlineWidth(2.0);
622 System.out.println(
"Set polygon outline width to 2.0 pixels: " + outlineWidthSuccess);
627 boolean outlineAlphaSuccess = polygonMapObject.setOutlineAlpha(0.8);
628 System.out.println(
"Set polygon outline alpha to 0.8: " + outlineAlphaSuccess);
633 boolean outlineOrderSuccess = polygonMapObject.setOutlineOrder(1);
634 System.out.println(
"Set polygon outline order to 1: " + outlineOrderSuccess);
639 boolean alphaSuccess = polygonMapObject.setAlpha(0.7);
640 System.out.println(
"Set polygon alpha to 0.7: " + alphaSuccess);
645 boolean interactiveSuccess = polygonMapObject.setInteractive(
true);
646 System.out.println(
"Set polygon interactive to true: " + interactiveSuccess);
651 boolean titleSuccess = polygonMapObject.setTitle(
"Polygon Object");
652 System.out.println(
"Set polygon title to 'Polygon Object': " + titleSuccess);
657 Map<String, Object> customData =
new HashMap<>();
658 customData.put(
"key",
"value");
659 customData.put(
"number", 42);
660 boolean dataSuccess = polygonMapObject.setData(customData);
661 System.out.println(
"Set polygon custom data: " + dataSuccess);
666 int objectId = polygonMapObject.getId();
667 System.out.println(
"Polygon object ID: " + objectId);
672 String objectTypeString = polygonMapObject.getType();
673 System.out.println(
"Polygon object type: " + objectTypeString);
678 Map<String, Object> retrievedData = polygonMapObject.getData();
679 System.out.println(
"Polygon custom data: " + retrievedData);
685 if (polygonMapObject !=
null) {
686 boolean removed = locationWindow.removePolygonMapObject(polygonMapObject);
687 System.out.println(
"Removed polygon map object: " + removed);
688 polygonMapObject =
null;
693 List<PolygonMapObject> polygons =
new ArrayList<>();
694 for (
int i = 0; i < 3; i++) {
695 PolygonMapObject polygon = locationWindow.addPolygonMapObject();
696 if (polygon !=
null) {
697 List<Point> points = Arrays.asList(
698 new Point(300.0 + i * 50, 400.0 + i * 50),
699 new Point(350.0 + i * 50, 450.0 + i * 50),
700 new Point(400.0 + i * 50, 400.0 + i * 50),
701 new Point(350.0 + i * 50, 350.0 + i * 50)
703 Polygon metricPoly =
new Polygon(points);
704 LocationPolygon polygonGeometry =
new LocationPolygon(metricPoly, 1, 0);
706 polygon.
setColor(0.0, 0.0, 1.0, 0.5);
707 polygons.add(polygon);
708 System.out.println(
"Created polygon " + i +
" with " + points.size() +
" points");
712 for (
int i = 0; i < polygons.size(); i++) {
713 locationWindow.removePolygonMapObject(polygons.get(i));
714 System.out.println(
"Removed polygon " + i);
721 private void demonstratePolylineMapObjects() {
722 System.out.println(
"--- Polyline Map Objects ---");
724 if (locationWindow ==
null) {
725 System.out.println(
"LocationWindow not available yet");
731 List<Point> points =
new ArrayList<>();
732 points.add(
new Point(100.0, 110.0));
733 points.add(
new Point(105.0, 115.0));
734 points.add(
new Point(110.0, 120.0));
735 points.add(
new Point(115.0, 125.0));
736 Polyline polyline =
new Polyline(points);
737 LocationPolyline locationPolyline =
new LocationPolyline(polyline, 1, 0);
738 polylineMapObject = locationWindow.addPolylineMapObject();
739 System.out.println(
"Created polyline map object with " + points.size() +
" points");
744 LocationPolyline polylineShape = polylineMapObject.getPolyLine();
745 System.out.println(
"Polyline has " + polylineShape.getPolyline().getPoints().size() +
" points");
750 polylineMapObject = locationWindow.addPolylineMapObject();
751 System.out.println(
"Added polyline map object");
754 if (polylineMapObject !=
null) {
757 List<Point> polylinePoints =
new ArrayList<>();
758 polylinePoints.add(
new Point(0.0, 0.0));
759 polylinePoints.add(
new Point(50.0, 50.0));
760 polylinePoints.add(
new Point(100.0, 0.0));
761 polylinePoints.add(
new Point(150.0, 50.0));
762 Polyline polyline =
new Polyline(polylinePoints);
763 LocationPolyline locationPolyline =
new LocationPolyline(polyline, 1, 0);
764 boolean success = polylineMapObject.setPolyLine(locationPolyline);
765 System.out.println(
"Set polyline geometry: " + success);
770 boolean widthSuccess = polylineMapObject.setWidth(3.0);
771 System.out.println(
"Set polyline width to 3.0 pixels: " + widthSuccess);
776 boolean colorSuccess = polylineMapObject.setColor(1.0, 0.5, 0.0, 0.9);
777 System.out.println(
"Set polyline color to orange with 90% opacity: " + colorSuccess);
782 boolean orderSuccess = polylineMapObject.setOrder(2);
783 System.out.println(
"Set rendering order to 2: " + orderSuccess);
788 boolean capSuccess = polylineMapObject.setCapType(CapType.ROUND);
789 System.out.println(
"Set cap type to ROUND: " + capSuccess);
794 boolean joinSuccess = polylineMapObject.setJoinType(JoinType.ROUND);
795 System.out.println(
"Set join type to ROUND: " + joinSuccess);
800 boolean miterSuccess = polylineMapObject.setMiterLimit(5.0);
801 System.out.println(
"Set miter limit to 5.0: " + miterSuccess);
806 boolean visibleSuccess = polylineMapObject.setVisible(
true);
807 System.out.println(
"Set polyline visibility to true: " + visibleSuccess);
812 MapObjectType objectType = polylineMapObject.getMapObjectType();
813 System.out.println(
"Polyline map object type: " + objectType);
818 boolean alphaSuccess = polylineMapObject.setAlpha(0.7);
819 System.out.println(
"Set polyline alpha to 0.7: " + alphaSuccess);
824 boolean interactiveSuccess = polylineMapObject.setInteractive(
true);
825 System.out.println(
"Set polyline interactive to true: " + interactiveSuccess);
830 boolean titleSuccess = polylineMapObject.setTitle(
"Polyline Object");
831 System.out.println(
"Set polyline title to 'Polyline Object': " + titleSuccess);
836 Map<String, Object> customData =
new HashMap<>();
837 customData.put(
"key",
"value");
838 customData.put(
"number", 42);
839 boolean dataSuccess = polylineMapObject.setData(customData);
840 System.out.println(
"Set polyline custom data: " + dataSuccess);
845 int objectId = polylineMapObject.getId();
846 System.out.println(
"Polyline object ID: " + objectId);
851 String objectTypeString = polylineMapObject.getType();
852 System.out.println(
"Polyline object type: " + objectTypeString);
857 Map<String, Object> retrievedData = polylineMapObject.getData();
858 System.out.println(
"Polyline custom data: " + retrievedData);
863 boolean outlineWidthSuccess2 = polylineMapObject.setOutlineWidth(1.0);
864 System.out.println(
"Set polyline outline width to 1.0 pixels: " + outlineWidthSuccess2);
869 boolean outlineColorSuccess2 = polylineMapObject.setOutlineColor(0.0, 0.0, 0.0, 1.0);
870 System.out.println(
"Set polyline outline color to black: " + outlineColorSuccess2);
875 boolean outlineAlphaSuccess2 = polylineMapObject.setOutlineAlpha(0.5);
876 System.out.println(
"Set polyline outline alpha to 0.5: " + outlineAlphaSuccess2);
881 boolean outlineOrderSuccess2 = polylineMapObject.setOutlineOrder(0);
882 System.out.println(
"Set polyline outline rendering order to 0: " + outlineOrderSuccess2);
887 boolean outlineCapTypeSuccess2 = polylineMapObject.setOutlineCapType(CapType.SQUARE);
888 System.out.println(
"Set polyline outline cap type to SQUARE: " + outlineCapTypeSuccess2);
893 boolean outlineJoinTypeSuccess2 = polylineMapObject.setOutlineJoinType(JoinType.MITER);
894 System.out.println(
"Set polyline outline join type to MITER: " + outlineJoinTypeSuccess2);
899 boolean outlineMiterLimitSuccess2 = polylineMapObject.setOutlineMiterLimit(3.0);
900 System.out.println(
"Set polyline outline miter limit to 3.0: " + outlineMiterLimitSuccess2);
906 if (polylineMapObject !=
null) {
907 boolean removed = locationWindow.removePolylineMapObject(polylineMapObject);
908 System.out.println(
"Removed polyline map object: " + removed);
909 polylineMapObject =
null;
914 List<PolylineMapObject> polylines =
new ArrayList<>();
915 for (
int i = 0; i < 3; i++) {
916 PolylineMapObject polyline = locationWindow.addPolylineMapObject();
917 if (polyline !=
null) {
918 List<Point> points =
new ArrayList<>();
919 points.add(
new Point(i * 30.0, i * 30.0));
920 points.add(
new Point((i + 1) * 30.0, (i + 1) * 30.0));
921 Polyline poly =
new Polyline(points);
922 LocationPolyline locPoly =
new LocationPolyline(poly, 1, 0);
925 polyline.
setColor(0.0, 1.0, 1.0, 0.8);
926 polylines.add(polyline);
927 System.out.println(
"Created polyline " + i +
" with width " + (2.0 + i));
931 for (
int i = 0; i < polylines.size(); i++) {
932 locationWindow.removePolylineMapObject(polylines.get(i));
933 System.out.println(
"Removed polyline " + i);
940 private void demonstrateDottedPolylineMapObjects() {
941 System.out.println(
"--- Dotted Polyline Map Objects ---");
943 if (locationWindow ==
null) {
944 System.out.println(
"LocationWindow not available yet");
950 List<Point> points =
new ArrayList<>();
951 points.add(
new Point(160.0, 170.0));
952 points.add(
new Point(165.0, 175.0));
953 points.add(
new Point(170.0, 180.0));
954 points.add(
new Point(175.0, 185.0));
955 Polyline polyline =
new Polyline(points);
956 LocationPolyline locationPolyline =
new LocationPolyline(polyline, 1, 0);
957 dottedPolylineMapObject = locationWindow.addDottedPolylineMapObject();
958 System.out.println(
"Created dotted polyline map object with " + points.size() +
" points");
963 LocationPolyline dottedPolylineShape = dottedPolylineMapObject.getPolyLine();
964 System.out.println(
"Dotted polyline has " + dottedPolylineShape.getPolyline().getPoints().size() +
" points");
969 dottedPolylineMapObject = locationWindow.addDottedPolylineMapObject();
970 System.out.println(
"Added dotted polyline map object");
973 if (dottedPolylineMapObject !=
null) {
976 List<Point> dottedPoints =
new ArrayList<>();
977 dottedPoints.add(
new Point(0.0, 100.0));
978 dottedPoints.add(
new Point(50.0, 150.0));
979 dottedPoints.add(
new Point(100.0, 100.0));
980 dottedPoints.add(
new Point(150.0, 150.0));
981 Polyline dottedPolyline =
new Polyline(dottedPoints);
982 LocationPolyline locationDottedPolyline =
new LocationPolyline(dottedPolyline, 1, 0);
983 boolean success = dottedPolylineMapObject.setPolyLine(locationDottedPolyline);
984 System.out.println(
"Set dotted polyline geometry: " + success);
989 boolean widthSuccess = dottedPolylineMapObject.setWidth(2.0);
990 System.out.println(
"Set dotted polyline width to 2.0 pixels: " + widthSuccess);
995 boolean colorSuccess = dottedPolylineMapObject.setColor(0.5, 0.0, 1.0, 0.8);
996 System.out.println(
"Set dotted polyline color to purple with 80% opacity: " + colorSuccess);
1001 boolean orderSuccess = dottedPolylineMapObject.setOrder(3);
1002 System.out.println(
"Set rendering order to 3: " + orderSuccess);
1007 boolean visibleSuccess = dottedPolylineMapObject.setVisible(
true);
1008 System.out.println(
"Set dotted polyline visibility to true: " + visibleSuccess);
1013 MapObjectType objectType = dottedPolylineMapObject.getMapObjectType();
1014 System.out.println(
"Dotted polyline map object type: " + objectType);
1019 boolean alphaSuccess = dottedPolylineMapObject.setAlpha(0.8);
1020 System.out.println(
"Set dotted polyline alpha to 0.8: " + alphaSuccess);
1025 boolean interactiveSuccess = dottedPolylineMapObject.setInteractive(
true);
1026 System.out.println(
"Set dotted polyline interactive to true: " + interactiveSuccess);
1031 boolean titleSuccess = dottedPolylineMapObject.setTitle(
"Dotted Polyline Object");
1032 System.out.println(
"Set dotted polyline title to 'Dotted Polyline Object': " + titleSuccess);
1037 Map<String, Object> customData =
new HashMap<>();
1038 customData.put(
"key",
"value");
1039 customData.put(
"number", 42);
1040 boolean dataSuccess = dottedPolylineMapObject.setData(customData);
1041 System.out.println(
"Set dotted polyline custom data: " + dataSuccess);
1046 int objectId = dottedPolylineMapObject.getId();
1047 System.out.println(
"Dotted polyline object ID: " + objectId);
1052 String objectTypeString = dottedPolylineMapObject.getType();
1053 System.out.println(
"Dotted polyline object type: " + objectTypeString);
1058 Map<String, Object> retrievedData = dottedPolylineMapObject.getData();
1059 System.out.println(
"Dotted polyline custom data: " + retrievedData);
1064 boolean dottedCollisionSuccess = dottedPolylineMapObject.setCollisionEnabled(
true);
1065 System.out.println(
"Enabled collision detection for dotted polyline: " + dottedCollisionSuccess);
1070 boolean dottedPlacementSuccess = dottedPolylineMapObject.setPlacement(Placement.CENTER);
1071 System.out.println(
"Set dotted polyline placement to CENTER: " + dottedPlacementSuccess);
1076 boolean dottedMinRatioSuccess = dottedPolylineMapObject.setPlacementMinRatio(0.5);
1077 System.out.println(
"Set dotted polyline placement min ratio to 0.5: " + dottedMinRatioSuccess);
1082 boolean dottedSpacingSuccess = dottedPolylineMapObject.setPlacementSpacing(10.0);
1083 System.out.println(
"Set dotted polyline placement spacing to 10.0: " + dottedSpacingSuccess);
1088 boolean dottedPrioritySuccess = dottedPolylineMapObject.setPriority(1);
1089 System.out.println(
"Set dotted polyline rendering priority to 1: " + dottedPrioritySuccess);
1094 boolean dottedRepeatDistanceSuccess = dottedPolylineMapObject.setRepeatDistance(20.0);
1095 System.out.println(
"Set dotted polyline repeat distance to 20.0: " + dottedRepeatDistanceSuccess);
1100 boolean dottedRepeatGroupSuccess = dottedPolylineMapObject.setRepeatGroup(1);
1101 System.out.println(
"Set dotted polyline repeat group to 1: " + dottedRepeatGroupSuccess);
1106 Size dottedSize =
new Size(16.0, 16.0);
1107 boolean dottedSizeSuccess = dottedPolylineMapObject.setSize(dottedSize);
1108 System.out.println(
"Set dotted polyline size to (" + dottedSize.getWidth() +
", " + dottedSize.getHeight() +
"): " + dottedSizeSuccess);
1114 if (dottedPolylineMapObject !=
null) {
1115 boolean removed = locationWindow.removeDottedPolylineMapObject(dottedPolylineMapObject);
1116 System.out.println(
"Removed dotted polyline map object: " + removed);
1117 dottedPolylineMapObject =
null;
1122 List<DottedPolylineMapObject> dottedPolylines =
new ArrayList<>();
1123 for (
int i = 0; i < 2; i++) {
1124 DottedPolylineMapObject dottedPolyline = locationWindow.addDottedPolylineMapObject();
1125 if (dottedPolyline !=
null) {
1126 List<Point> points =
new ArrayList<>();
1127 points.add(
new Point(i * 40.0, i * 40.0 + 100.0));
1128 points.add(
new Point((i + 1) * 40.0, (i + 1) * 40.0 + 100.0));
1129 Polyline poly =
new Polyline(points);
1130 LocationPolyline locPoly =
new LocationPolyline(poly, 1, 0);
1132 dottedPolyline.setWidth(1.5);
1133 dottedPolyline.
setColor(1.0, 0.0, 1.0, 0.6);
1134 dottedPolylines.add(dottedPolyline);
1135 System.out.println(
"Created dotted polyline " + i);
1139 for (
int i = 0; i < dottedPolylines.size(); i++) {
1140 locationWindow.removeDottedPolylineMapObject(dottedPolylines.get(i));
1141 System.out.println(
"Removed dotted polyline " + i);
1148 private void demonstrateRemoveAllMapObjects() {
1149 System.out.println(
"--- Remove All Map Objects ---");
1151 if (locationWindow ==
null) {
1152 System.out.println(
"LocationWindow not available yet");
1157 CircleMapObject circle = locationWindow.addCircleMapObject();
1158 IconMapObject icon = locationWindow.addIconMapObject();
1159 PolygonMapObject polygon = locationWindow.addPolygonMapObject();
1160 PolylineMapObject polyline = locationWindow.addPolylineMapObject();
1161 DottedPolylineMapObject dottedPolyline = locationWindow.addDottedPolylineMapObject();
1163 System.out.println(
"Created 5 map objects");
1167 locationWindow.removeAllMapObjects();
1168 System.out.println(
"Removed all map objects");
1175 private void demonstrateClusterMapObjects() {
1176 System.out.println(
"--- Cluster map objects ---");
1178 if (locationWindow ==
null) {
1179 System.out.println(
"LocationWindow not available");
1184 clusterMapObjectController = locationWindow.addClusterMapObjectController();
1185 System.out.println(
"Added cluster map object controller");
1188 if (clusterMapObjectController ==
null) {
1192 IconMapObject clusterIcon1 = locationWindow.addIconMapObject();
1193 IconMapObject clusterIcon2 = locationWindow.addIconMapObject();
1194 if (clusterIcon1 !=
null) {
1195 clusterIcon1.
setPosition(
new LocationPoint(100.0, 100.0));
1197 if (clusterIcon2 !=
null) {
1198 clusterIcon2.
setPosition(
new LocationPoint(105.0, 102.0));
1202 boolean added1 = clusterMapObjectController.addIconMapObject(clusterIcon1);
1203 boolean added2 = clusterMapObjectController.addIconMapObject(clusterIcon2);
1204 System.out.println(
"Registered icons for clustering: " + added1 +
", " + added2);
1208 clusterMapObjectController.setEnabled(
true);
1209 System.out.println(
"Clustering enabled");
1213 boolean clusteringEnabled = clusterMapObjectController.isEnabled();
1214 System.out.println(
"Clustering is enabled: " + clusteringEnabled);
1218 clusterMapObjectController.setRadius(40.0f);
1219 System.out.println(
"Set cluster radius to 40 px");
1223 float clusterRadius = clusterMapObjectController.getRadius();
1224 System.out.println(
"Cluster radius: " + clusterRadius);
1228 boolean interactiveSuccess = clusterMapObjectController.
setInteractive(
true);
1229 System.out.println(
"Set cluster markers interactive: " + interactiveSuccess);
1233 boolean sizeSuccess = clusterMapObjectController.setClusterSize(32.0f, 32.0f);
1234 System.out.println(
"Set default cluster icon size: " + sizeSuccess);
1237 clusterMapObjectControllerListener =
new DemoClusterMapObjectControllerListener();
1240 clusterMapObjectController.addListener(clusterMapObjectControllerListener);
1241 System.out.println(
"Added cluster map object controller listener");
1245 List<ClusterMapObject> clusters = clusterMapObjectController.getClusters();
1246 System.out.println(
"Visible clusters: " + clusters.size());
1249 if (!clusters.isEmpty()) {
1250 ClusterMapObject cluster = clusters.get(0);
1252 ImageProvider clusterBitmap = ImageProvider.fromFile(
"/path/to/cluster.png",
true);
1253 boolean bitmapSuccess = cluster.
setBitmap(clusterBitmap);
1254 System.out.println(
"Set cluster bitmap from ImageProvider: " + bitmapSuccess);
1259 clusterMapObjectController.removeListener(clusterMapObjectControllerListener);
1260 System.out.println(
"Removed cluster map object controller listener");
1263 if (clusterIcon1 !=
null) {
1265 boolean removed = clusterMapObjectController.removeIconMapObject(clusterIcon1);
1266 System.out.println(
"Removed icon from cluster controller: " + removed);
1268 locationWindow.removeIconMapObject(clusterIcon1);
1270 if (clusterIcon2 !=
null) {
1271 locationWindow.removeIconMapObject(clusterIcon2);
1275 clusterMapObjectController.clear();
1276 System.out.println(
"Cleared cluster controller");
1280 boolean controllerRemoved =
1281 locationWindow.removeClusterMapObjectController(clusterMapObjectController);
1282 System.out.println(
"Removed cluster map object controller: " + controllerRemoved);
1285 clusterMapObjectController =
null;
1286 clusterMapObjectControllerListener =
null;
1293 if (circleMapObject !=
null) {
1294 locationWindow.removeCircleMapObject(circleMapObject);
1295 circleMapObject =
null;
1297 if (iconMapObject !=
null) {
1298 locationWindow.removeIconMapObject(iconMapObject);
1299 iconMapObject =
null;
1301 if (polygonMapObject !=
null) {
1303 polygonMapObject =
null;
1305 if (polylineMapObject !=
null) {
1306 locationWindow.removePolylineMapObject(polylineMapObject);
1307 polylineMapObject =
null;
1309 if (dottedPolylineMapObject !=
null) {
1310 locationWindow.removeDottedPolylineMapObject(dottedPolylineMapObject);
1311 dottedPolylineMapObject =
null;
1313 if (modelMapObject !=
null) {
1314 locationWindow.removeModelMapObject(modelMapObject);
1315 modelMapObject =
null;
1317 System.out.println(
"LocationWindowMapObjects example cleanup completed");