53 demonstrateLocationWindowMapObjectsMethods();
59 private void demonstrateLocationWindowMapObjectsMethods() {
60 System.out.println(
"=== LocationWindowMapObjects Example ===");
62 demonstrateLocationScopedGeometryRecords();
64 demonstrateCircleMapObjects();
65 demonstrateIconMapObjects();
66 demonstrateClusterMapObjects();
67 demonstrateModelMapObjects();
68 demonstratePolygonMapObjects();
69 demonstratePolylineMapObjects();
70 demonstrateDottedPolylineMapObjects();
71 demonstrateRemoveAllMapObjects();
78 private void demonstrateLocationScopedGeometryRecords() {
79 System.out.println(
"--- LocationPolygon / LocationPolyline records ---");
82 List<GlobalPoint> ring = Arrays.asList(
88 int polygonSublocationId = locationPolygon.getSublocationId();
89 System.out.println(
"LocationPolygon: sublocation "
90 + polygonSublocationId +
", vertices " + locationPolygon.getPoints().size());
94 List<GlobalPoint> linePoints = Arrays.asList(
99 System.out.println(
"LocationPolyline: points " + locationPolyline.getPoints().size());
106 private void demonstrateCircleMapObjects() {
107 System.out.println(
"--- Circle Map Objects ---");
109 if (locationWindow ==
null) {
110 System.out.println(
"LocationWindow not available yet");
118 System.out.println(
"Created circle map object with center (" + center.getLatitude() +
", " + center.getLongitude() +
") and radius 5.0");
123 double radius = circleMapObject.getRadius();
124 System.out.println(
"Circle radius: " + radius);
130 System.out.println(
"Added circle map object");
133 if (circleMapObject !=
null) {
137 boolean success = circleMapObject.
setPosition(centerPoint, 7);
138 System.out.println(
"Set circle position to (" + centerPoint.getLatitude() +
", " + centerPoint.getLongitude() +
"): " + success);
145 System.out.println(
"Set circle position with animation to (" + animatedPoint.getLatitude() +
", " + animatedPoint.getLongitude() +
"): " + animatedSuccess);
150 boolean radiusSuccess = circleMapObject.
setRadius(10.0);
151 System.out.println(
"Set circle radius to 10.0 meters: " + radiusSuccess);
157 System.out.println(
"Enabled collision detection for circle: " + collisionSuccess);
162 boolean bufferSuccess = circleMapObject.
setBuffer(5.0, 5.0);
163 System.out.println(
"Set collision buffer to 5x5 pixels: " + bufferSuccess);
168 boolean offsetSuccess = circleMapObject.
setOffset(2.0, 3.0);
169 System.out.println(
"Set position offset to (2.0, 3.0) pixels: " + offsetSuccess);
174 boolean outlineColorSuccess = circleMapObject.
setOutlineColor(0xFF0000FF);
175 System.out.println(
"Set circle outline color to blue: " + outlineColorSuccess);
181 System.out.println(
"Set circle outline alpha to 0.5: " + outlineAlphaSuccess);
187 System.out.println(
"Set circle outline radius to 2.0: " + outlineRadiusSuccess);
192 boolean colorSuccess = circleMapObject.
setColor(0xCCFF0000);
193 System.out.println(
"Set circle color to red with 80% opacity: " + colorSuccess);
198 boolean prioritySuccess = circleMapObject.
setPriority(1);
199 System.out.println(
"Set rendering priority to 1: " + prioritySuccess);
204 boolean visibleSuccess = circleMapObject.
setVisible(
true);
205 System.out.println(
"Set circle visibility to true: " + visibleSuccess);
210 MapObjectType objectType = circleMapObject.getMapObjectType();
211 System.out.println(
"Circle map object type: " + objectType);
216 boolean alphaSuccess = circleMapObject.
setAlpha(0.7);
217 System.out.println(
"Set circle alpha to 0.7: " + alphaSuccess);
222 boolean interactiveSuccess = circleMapObject.
setInteractive(
true);
223 System.out.println(
"Set circle interactive to true: " + interactiveSuccess);
228 boolean titleSuccess = circleMapObject.
setTitle(
"Circle Object");
229 System.out.println(
"Set circle title to 'Circle Object': " + titleSuccess);
234 titleStyle.fontSize = 14f;
235 titleStyle.color = 0xFF3366CC;
236 titleStyle.outlineColor = 0xFFFFFFFF;
238 titleStyle.visible =
true;
243 boolean titleStyleSuccess = circleMapObject.
setTitleWithStyle(
"Styled Circle", titleStyle);
244 System.out.println(
"Set circle title with style: " + titleStyleSuccess);
249 Map<String, String> customData =
new HashMap<>();
250 customData.put(
"key",
"value");
251 customData.put(
"number",
"42");
252 boolean dataSuccess = circleMapObject.
setData(customData);
253 System.out.println(
"Set circle custom data: " + dataSuccess);
258 int objectId = circleMapObject.
getId();
259 System.out.println(
"Circle object ID: " + objectId);
264 String objectTypeString = circleMapObject.
getType();
265 System.out.println(
"Circle object type: " + objectTypeString);
270 Map<String, String> retrievedData = circleMapObject.
getData();
271 System.out.println(
"Circle custom data: " + retrievedData);
277 if (circleMapObject !=
null) {
278 boolean removed = locationWindow.removeCircleMapObject(circleMapObject);
279 System.out.println(
"Removed circle map object: " + removed);
280 circleMapObject =
null;
285 List<CircleMapObject> circles =
new ArrayList<>();
286 for (
int i = 0; i < 3; i++) {
287 CircleMapObject circle = locationWindow.addCircleMapObject();
288 if (circle !=
null) {
289 circle.
setPosition(
new GlobalPoint(50.0 * i, 100.0 * i));
293 System.out.println(
"Created circle " + i +
" at (" + (50.0 * i) +
", " + (100.0 * i) +
") with radius " + (5.0 + i * 2.0));
297 for (
int i = 0; i < circles.size(); i++) {
298 locationWindow.removeCircleMapObject(circles.get(i));
299 System.out.println(
"Removed circle " + i);
306 private void demonstrateIconMapObjects() {
307 System.out.println(
"--- Icon Map Objects ---");
309 if (locationWindow ==
null) {
310 System.out.println(
"LocationWindow not available yet");
316 GlobalPoint position =
new GlobalPoint(30.0, 40.0);
317 iconMapObject = locationWindow.addIconMapObject();
318 System.out.println(
"Created icon map object at (" + position.getLatitude() +
", " + position.getLongitude() +
")");
323 iconMapObject = locationWindow.addIconMapObject();
324 System.out.println(
"Added icon map object");
327 if (iconMapObject !=
null) {
330 GlobalPoint iconPoint =
new GlobalPoint(200.0, 300.0);
331 boolean success = iconMapObject.setPosition(iconPoint, 7);
332 System.out.println(
"Set icon position to (" + iconPoint.getLatitude() +
", " + iconPoint.getLongitude() +
"): " + success);
337 GlobalPoint animatedIconPoint =
new GlobalPoint(250.0, 350.0);
338 boolean animatedSuccess = iconMapObject.setPositionAnimated(animatedIconPoint, 7, 1.5, AnimationType.CUBIC);
339 System.out.println(
"Set icon position with animation to (" + animatedIconPoint.getLatitude() +
", " + animatedIconPoint.getLongitude() +
"): " + animatedSuccess);
344 boolean sizeSuccess = iconMapObject.setSize(32.0, 32.0);
345 System.out.println(
"Set icon size to 32x32 pixels: " + sizeSuccess);
350 boolean angleSuccess = iconMapObject.setAngle((
float) Math.toRadians(45.0));
351 System.out.println(
"Set icon rotation angle to π/4: " + angleSuccess);
356 boolean angleAnimatedSuccess = iconMapObject.setAngleAnimated((
float) Math.toRadians(90.0), 2.0, AnimationType.SINE);
357 System.out.println(
"Set icon rotation with animation to π/2: " + angleAnimatedSuccess);
362 boolean collisionSuccess = iconMapObject.setCollisionEnabled(
true);
363 System.out.println(
"Enabled collision detection for icon: " + collisionSuccess);
368 boolean bufferSuccess = iconMapObject.setBuffer(10.0, 10.0);
369 System.out.println(
"Set collision buffer to 10x10 pixels: " + bufferSuccess);
374 boolean offsetSuccess = iconMapObject.setOffset(0.0, -16.0);
375 System.out.println(
"Set position offset to (0.0, -16.0) pixels: " + offsetSuccess);
380 boolean prioritySuccess = iconMapObject.setPriority(2);
381 System.out.println(
"Set rendering priority to 2: " + prioritySuccess);
386 boolean visibleSuccess = iconMapObject.setVisible(
true);
387 System.out.println(
"Set icon visibility to true: " + visibleSuccess);
392 MapObjectType objectType = iconMapObject.getMapObjectType();
393 System.out.println(
"Icon map object type: " + objectType);
398 ImageProvider iconBitmap = ImageProvider.fromFile(
"/path/to/icon.png",
true);
399 boolean bitmapSuccess = iconMapObject.setBitmap(iconBitmap);
400 System.out.println(
"Set icon from ImageProvider: " + bitmapSuccess);
405 boolean flatSuccess = iconMapObject.setFlat(
true);
406 System.out.println(
"Set icon flat mode to true: " + flatSuccess);
411 boolean alphaSuccess = iconMapObject.setAlpha(0.8f);
412 System.out.println(
"Set icon alpha to 0.8: " + alphaSuccess);
417 boolean interactiveSuccess = iconMapObject.setInteractive(
true);
418 System.out.println(
"Set icon interactive to true: " + interactiveSuccess);
423 boolean titleSuccess = iconMapObject.setTitle(
"Icon Object");
424 System.out.println(
"Set icon title to 'Icon Object': " + titleSuccess);
429 Map<String, Object> customData =
new HashMap<>();
430 customData.put(
"key",
"value");
431 customData.put(
"number", 42);
432 boolean dataSuccess = iconMapObject.setData(customData);
433 System.out.println(
"Set icon custom data: " + dataSuccess);
438 int objectId = iconMapObject.getId();
439 System.out.println(
"Icon object ID: " + objectId);
444 String objectTypeString = iconMapObject.getType();
445 System.out.println(
"Icon object type: " + objectTypeString);
450 Map<String, Object> retrievedData = iconMapObject.getData();
451 System.out.println(
"Icon custom data: " + retrievedData);
457 if (iconMapObject !=
null) {
458 boolean removed = locationWindow.removeIconMapObject(iconMapObject);
459 System.out.println(
"Removed icon map object: " + removed);
460 iconMapObject =
null;
465 List<IconMapObject> icons =
new ArrayList<>();
466 for (
int i = 0; i < 3; i++) {
467 IconMapObject icon = locationWindow.addIconMapObject();
469 icon.
setPosition(
new GlobalPoint(100.0 * i, 150.0 * i));
471 icon.
setAngle((
float) (i * Math.toRadians(30.0)));
473 System.out.println(
"Created icon " + i +
" at (" + (100.0 * i) +
", " + (150.0 * i) +
") with angle " + (i * Math.toRadians(30.0)) +
" rad");
477 for (
int i = 0; i < icons.size(); i++) {
478 locationWindow.removeIconMapObject(icons.get(i));
479 System.out.println(
"Removed icon " + i);
486 private void demonstrateModelMapObjects() {
487 System.out.println(
"--- Model Map Objects ---");
489 if (locationWindow ==
null) {
490 System.out.println(
"LocationWindow not available yet");
495 modelMapObject = locationWindow.addModelMapObject();
496 System.out.println(
"Added model map object: " + (modelMapObject !=
null));
499 if (modelMapObject ==
null) {
504 GlobalPoint modelPoint =
new GlobalPoint(12.0, 34.0);
505 boolean posOk = modelMapObject.setPosition(modelPoint, 7);
506 System.out.println(
"Model setPosition: " + posOk);
510 boolean posAnimOk = modelMapObject.setPositionAnimated(
new GlobalPoint(15.0, 40.0), 7, 0.5f, AnimationType.SINE);
511 System.out.println(
"Model setPositionAnimated: " + posAnimOk);
515 ImageProvider texture = ImageProvider.fromFile(
"/path/to/model_texture.png",
true);
516 ModelProvider model = ModelProvider.fromFile(
"/path/to/model.obj", texture);
517 boolean modelOk = modelMapObject.setModel(model);
518 System.out.println(
"Model setModel: " + modelOk);
522 boolean sizeOk = modelMapObject.setSize(64.0f, 64.0f);
523 System.out.println(
"Model setSize: " + sizeOk);
527 boolean collOk = modelMapObject.setCollisionEnabled(
true);
528 System.out.println(
"Model setCollisionEnabled: " + collOk);
532 boolean angleOk = modelMapObject.setAngle((
float) Math.toRadians(45.0));
533 System.out.println(
"Model setAngle: " + angleOk);
537 boolean angleAnimOk = modelMapObject.setAngleAnimated((
float) Math.toRadians(90.0), 0.5f, AnimationType.QUINT);
538 System.out.println(
"Model setAngleAnimated: " + angleAnimOk);
542 boolean bufOk = modelMapObject.setBuffer(4.0f, 4.0f);
543 System.out.println(
"Model setBuffer: " + bufOk);
547 boolean priOk = modelMapObject.setPriority(10.0f);
548 System.out.println(
"Model setPriority: " + priOk);
552 boolean removed = locationWindow.removeModelMapObject(modelMapObject);
553 System.out.println(
"Removed model map object: " + removed);
554 modelMapObject =
null;
561 private void demonstratePolygonMapObjects() {
562 System.out.println(
"--- Polygon Map Objects ---");
564 if (locationWindow ==
null) {
565 System.out.println(
"LocationWindow not available yet");
571 polygonMapObject = locationWindow.addPolygonMapObject();
572 System.out.println(
"Added polygon map object");
575 if (polygonMapObject !=
null) {
578 List<GlobalPoint> points = Arrays.asList(
579 new GlobalPoint(100.0, 200.0),
580 new GlobalPoint(150.0, 250.0),
581 new GlobalPoint(200.0, 200.0),
582 new GlobalPoint(150.0, 150.0)
584 LocationPolygon polygon =
new LocationPolygon(points, 0);
585 boolean success = polygonMapObject.setPolygon(polygon);
586 System.out.println(
"Set polygon with " + points.size() +
" points: " + success);
591 boolean colorSuccess = polygonMapObject.setColor(0xB300FF00);
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(0xFF0000FF);
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<GlobalPoint> points = Arrays.asList(
698 new GlobalPoint(300.0 + i * 50, 400.0 + i * 50),
699 new GlobalPoint(350.0 + i * 50, 450.0 + i * 50),
700 new GlobalPoint(400.0 + i * 50, 400.0 + i * 50),
701 new GlobalPoint(350.0 + i * 50, 350.0 + i * 50)
703 LocationPolygon polygonGeometry =
new LocationPolygon(points, 0);
706 polygons.add(polygon);
707 System.out.println(
"Created polygon " + i +
" with " + points.size() +
" points");
711 for (
int i = 0; i < polygons.size(); i++) {
712 locationWindow.removePolygonMapObject(polygons.get(i));
713 System.out.println(
"Removed polygon " + i);
720 private void demonstratePolylineMapObjects() {
721 System.out.println(
"--- Polyline Map Objects ---");
723 if (locationWindow ==
null) {
724 System.out.println(
"LocationWindow not available yet");
730 List<GlobalPoint> points =
new ArrayList<>();
731 points.add(
new GlobalPoint(100.0, 110.0));
732 points.add(
new GlobalPoint(105.0, 115.0));
733 points.add(
new GlobalPoint(110.0, 120.0));
734 points.add(
new GlobalPoint(115.0, 125.0));
735 LocationPolyline locationPolyline =
new LocationPolyline(points, 0);
736 polylineMapObject = locationWindow.addPolylineMapObject();
737 System.out.println(
"Created polyline map object with " + points.size() +
" points");
742 LocationPolyline polylineShape = polylineMapObject.getPolyLine();
743 System.out.println(
"Polyline has " + polylineShape.getPoints().size() +
" points");
748 polylineMapObject = locationWindow.addPolylineMapObject();
749 System.out.println(
"Added polyline map object");
752 if (polylineMapObject !=
null) {
755 List<GlobalPoint> polylinePoints =
new ArrayList<>();
756 polylinePoints.add(
new GlobalPoint(0.0, 0.0));
757 polylinePoints.add(
new GlobalPoint(50.0, 50.0));
758 polylinePoints.add(
new GlobalPoint(100.0, 0.0));
759 polylinePoints.add(
new GlobalPoint(150.0, 50.0));
760 LocationPolyline locationPolyline =
new LocationPolyline(polylinePoints, 0);
761 boolean success = polylineMapObject.setPolyLine(locationPolyline);
762 System.out.println(
"Set polyline geometry: " + success);
767 boolean widthSuccess = polylineMapObject.setWidth(3.0);
768 System.out.println(
"Set polyline width to 3.0 pixels: " + widthSuccess);
773 boolean colorSuccess = polylineMapObject.setColor(0xE6FF8000);
774 System.out.println(
"Set polyline color to orange with 90% opacity: " + colorSuccess);
779 boolean orderSuccess = polylineMapObject.setOrder(2);
780 System.out.println(
"Set rendering order to 2: " + orderSuccess);
785 boolean capSuccess = polylineMapObject.setCapType(CapType.ROUND);
786 System.out.println(
"Set cap type to ROUND: " + capSuccess);
791 boolean joinSuccess = polylineMapObject.setJoinType(JoinType.ROUND);
792 System.out.println(
"Set join type to ROUND: " + joinSuccess);
797 boolean miterSuccess = polylineMapObject.setMiterLimit(5.0);
798 System.out.println(
"Set miter limit to 5.0: " + miterSuccess);
803 boolean visibleSuccess = polylineMapObject.setVisible(
true);
804 System.out.println(
"Set polyline visibility to true: " + visibleSuccess);
809 MapObjectType objectType = polylineMapObject.getMapObjectType();
810 System.out.println(
"Polyline map object type: " + objectType);
815 boolean alphaSuccess = polylineMapObject.setAlpha(0.7);
816 System.out.println(
"Set polyline alpha to 0.7: " + alphaSuccess);
821 boolean interactiveSuccess = polylineMapObject.setInteractive(
true);
822 System.out.println(
"Set polyline interactive to true: " + interactiveSuccess);
827 boolean titleSuccess = polylineMapObject.setTitle(
"Polyline Object");
828 System.out.println(
"Set polyline title to 'Polyline Object': " + titleSuccess);
833 Map<String, Object> customData =
new HashMap<>();
834 customData.put(
"key",
"value");
835 customData.put(
"number", 42);
836 boolean dataSuccess = polylineMapObject.setData(customData);
837 System.out.println(
"Set polyline custom data: " + dataSuccess);
842 int objectId = polylineMapObject.getId();
843 System.out.println(
"Polyline object ID: " + objectId);
848 String objectTypeString = polylineMapObject.getType();
849 System.out.println(
"Polyline object type: " + objectTypeString);
854 Map<String, Object> retrievedData = polylineMapObject.getData();
855 System.out.println(
"Polyline custom data: " + retrievedData);
860 boolean outlineWidthSuccess2 = polylineMapObject.setOutlineWidth(1.0);
861 System.out.println(
"Set polyline outline width to 1.0 pixels: " + outlineWidthSuccess2);
866 boolean outlineColorSuccess2 = polylineMapObject.setOutlineColor(0xFF000000);
867 System.out.println(
"Set polyline outline color to black: " + outlineColorSuccess2);
872 boolean outlineAlphaSuccess2 = polylineMapObject.setOutlineAlpha(0.5);
873 System.out.println(
"Set polyline outline alpha to 0.5: " + outlineAlphaSuccess2);
878 boolean outlineOrderSuccess2 = polylineMapObject.setOutlineOrder(0);
879 System.out.println(
"Set polyline outline rendering order to 0: " + outlineOrderSuccess2);
884 boolean outlineCapTypeSuccess2 = polylineMapObject.setOutlineCapType(CapType.SQUARE);
885 System.out.println(
"Set polyline outline cap type to SQUARE: " + outlineCapTypeSuccess2);
890 boolean outlineJoinTypeSuccess2 = polylineMapObject.setOutlineJoinType(JoinType.MITER);
891 System.out.println(
"Set polyline outline join type to MITER: " + outlineJoinTypeSuccess2);
896 boolean outlineMiterLimitSuccess2 = polylineMapObject.setOutlineMiterLimit(3.0);
897 System.out.println(
"Set polyline outline miter limit to 3.0: " + outlineMiterLimitSuccess2);
903 if (polylineMapObject !=
null) {
904 boolean removed = locationWindow.removePolylineMapObject(polylineMapObject);
905 System.out.println(
"Removed polyline map object: " + removed);
906 polylineMapObject =
null;
911 List<PolylineMapObject> polylines =
new ArrayList<>();
912 for (
int i = 0; i < 3; i++) {
913 PolylineMapObject polyline = locationWindow.addPolylineMapObject();
914 if (polyline !=
null) {
915 List<GlobalPoint> points =
new ArrayList<>();
916 points.add(
new GlobalPoint(i * 30.0, i * 30.0));
917 points.add(
new GlobalPoint((i + 1) * 30.0, (i + 1) * 30.0));
918 LocationPolyline locPoly =
new LocationPolyline(points, 0);
922 polylines.add(polyline);
923 System.out.println(
"Created polyline " + i +
" with width " + (2.0 + i));
927 for (
int i = 0; i < polylines.size(); i++) {
928 locationWindow.removePolylineMapObject(polylines.get(i));
929 System.out.println(
"Removed polyline " + i);
936 private void demonstrateDottedPolylineMapObjects() {
937 System.out.println(
"--- Dotted Polyline Map Objects ---");
939 if (locationWindow ==
null) {
940 System.out.println(
"LocationWindow not available yet");
946 List<GlobalPoint> points =
new ArrayList<>();
947 points.add(
new GlobalPoint(160.0, 170.0));
948 points.add(
new GlobalPoint(165.0, 175.0));
949 points.add(
new GlobalPoint(170.0, 180.0));
950 points.add(
new GlobalPoint(175.0, 185.0));
951 LocationPolyline locationPolyline =
new LocationPolyline(points, 0);
952 dottedPolylineMapObject = locationWindow.addDottedPolylineMapObject();
953 System.out.println(
"Created dotted polyline map object with " + points.size() +
" points");
958 LocationPolyline dottedPolylineShape = dottedPolylineMapObject.getPolyLine();
959 System.out.println(
"Dotted polyline has " + dottedPolylineShape.getPoints().size() +
" points");
964 dottedPolylineMapObject = locationWindow.addDottedPolylineMapObject();
965 System.out.println(
"Added dotted polyline map object");
968 if (dottedPolylineMapObject !=
null) {
971 List<GlobalPoint> dottedPoints =
new ArrayList<>();
972 dottedPoints.add(
new GlobalPoint(0.0, 100.0));
973 dottedPoints.add(
new GlobalPoint(50.0, 150.0));
974 dottedPoints.add(
new GlobalPoint(100.0, 100.0));
975 dottedPoints.add(
new GlobalPoint(150.0, 150.0));
976 LocationPolyline locationDottedPolyline =
new LocationPolyline(dottedPoints, 0);
977 boolean success = dottedPolylineMapObject.setPolyLine(locationDottedPolyline);
978 System.out.println(
"Set dotted polyline geometry: " + success);
983 boolean widthSuccess = dottedPolylineMapObject.setWidth(2.0);
984 System.out.println(
"Set dotted polyline width to 2.0 pixels: " + widthSuccess);
989 boolean colorSuccess = dottedPolylineMapObject.setColor(0xCC8000FF);
990 System.out.println(
"Set dotted polyline color to purple with 80% opacity: " + colorSuccess);
995 boolean orderSuccess = dottedPolylineMapObject.setOrder(3);
996 System.out.println(
"Set rendering order to 3: " + orderSuccess);
1001 boolean visibleSuccess = dottedPolylineMapObject.setVisible(
true);
1002 System.out.println(
"Set dotted polyline visibility to true: " + visibleSuccess);
1007 MapObjectType objectType = dottedPolylineMapObject.getMapObjectType();
1008 System.out.println(
"Dotted polyline map object type: " + objectType);
1013 boolean alphaSuccess = dottedPolylineMapObject.setAlpha(0.8);
1014 System.out.println(
"Set dotted polyline alpha to 0.8: " + alphaSuccess);
1019 boolean interactiveSuccess = dottedPolylineMapObject.setInteractive(
true);
1020 System.out.println(
"Set dotted polyline interactive to true: " + interactiveSuccess);
1025 boolean titleSuccess = dottedPolylineMapObject.setTitle(
"Dotted Polyline Object");
1026 System.out.println(
"Set dotted polyline title to 'Dotted Polyline Object': " + titleSuccess);
1031 Map<String, Object> customData =
new HashMap<>();
1032 customData.put(
"key",
"value");
1033 customData.put(
"number", 42);
1034 boolean dataSuccess = dottedPolylineMapObject.setData(customData);
1035 System.out.println(
"Set dotted polyline custom data: " + dataSuccess);
1040 int objectId = dottedPolylineMapObject.getId();
1041 System.out.println(
"Dotted polyline object ID: " + objectId);
1046 String objectTypeString = dottedPolylineMapObject.getType();
1047 System.out.println(
"Dotted polyline object type: " + objectTypeString);
1052 Map<String, Object> retrievedData = dottedPolylineMapObject.getData();
1053 System.out.println(
"Dotted polyline custom data: " + retrievedData);
1058 boolean dottedCollisionSuccess = dottedPolylineMapObject.setCollisionEnabled(
true);
1059 System.out.println(
"Enabled collision detection for dotted polyline: " + dottedCollisionSuccess);
1064 boolean dottedPlacementSuccess = dottedPolylineMapObject.setPlacement(Placement.CENTER);
1065 System.out.println(
"Set dotted polyline placement to CENTER: " + dottedPlacementSuccess);
1070 boolean dottedMinRatioSuccess = dottedPolylineMapObject.setPlacementMinRatio(0.5);
1071 System.out.println(
"Set dotted polyline placement min ratio to 0.5: " + dottedMinRatioSuccess);
1076 boolean dottedSpacingSuccess = dottedPolylineMapObject.setPlacementSpacing(10.0);
1077 System.out.println(
"Set dotted polyline placement spacing to 10.0: " + dottedSpacingSuccess);
1082 boolean dottedPrioritySuccess = dottedPolylineMapObject.setPriority(1);
1083 System.out.println(
"Set dotted polyline rendering priority to 1: " + dottedPrioritySuccess);
1088 boolean dottedRepeatDistanceSuccess = dottedPolylineMapObject.setRepeatDistance(20.0);
1089 System.out.println(
"Set dotted polyline repeat distance to 20.0: " + dottedRepeatDistanceSuccess);
1094 boolean dottedRepeatGroupSuccess = dottedPolylineMapObject.setRepeatGroup(1);
1095 System.out.println(
"Set dotted polyline repeat group to 1: " + dottedRepeatGroupSuccess);
1100 Size dottedSize =
new Size(16.0, 16.0);
1101 boolean dottedSizeSuccess = dottedPolylineMapObject.setSize(dottedSize);
1102 System.out.println(
"Set dotted polyline size to (" + dottedSize.getWidth() +
", " + dottedSize.getHeight() +
"): " + dottedSizeSuccess);
1108 if (dottedPolylineMapObject !=
null) {
1109 boolean removed = locationWindow.removeDottedPolylineMapObject(dottedPolylineMapObject);
1110 System.out.println(
"Removed dotted polyline map object: " + removed);
1111 dottedPolylineMapObject =
null;
1116 List<DottedPolylineMapObject> dottedPolylines =
new ArrayList<>();
1117 for (
int i = 0; i < 2; i++) {
1118 DottedPolylineMapObject dottedPolyline = locationWindow.addDottedPolylineMapObject();
1119 if (dottedPolyline !=
null) {
1120 List<GlobalPoint> points =
new ArrayList<>();
1121 points.add(
new GlobalPoint(i * 40.0, i * 40.0 + 100.0));
1122 points.add(
new GlobalPoint((i + 1) * 40.0, (i + 1) * 40.0 + 100.0));
1123 LocationPolyline locPoly =
new LocationPolyline(points, 0);
1125 dottedPolyline.setWidth(1.5);
1126 dottedPolyline.
setColor(0x99FF00FF);
1127 dottedPolylines.add(dottedPolyline);
1128 System.out.println(
"Created dotted polyline " + i);
1132 for (
int i = 0; i < dottedPolylines.size(); i++) {
1133 locationWindow.removeDottedPolylineMapObject(dottedPolylines.get(i));
1134 System.out.println(
"Removed dotted polyline " + i);
1141 private void demonstrateRemoveAllMapObjects() {
1142 System.out.println(
"--- Remove All Map Objects ---");
1144 if (locationWindow ==
null) {
1145 System.out.println(
"LocationWindow not available yet");
1150 CircleMapObject circle = locationWindow.addCircleMapObject();
1151 IconMapObject icon = locationWindow.addIconMapObject();
1152 PolygonMapObject polygon = locationWindow.addPolygonMapObject();
1153 PolylineMapObject polyline = locationWindow.addPolylineMapObject();
1154 DottedPolylineMapObject dottedPolyline = locationWindow.addDottedPolylineMapObject();
1156 System.out.println(
"Created 5 map objects");
1160 locationWindow.removeAllMapObjects();
1161 System.out.println(
"Removed all map objects");
1168 private void demonstrateClusterMapObjects() {
1169 System.out.println(
"--- Cluster map objects ---");
1171 if (locationWindow ==
null) {
1172 System.out.println(
"LocationWindow not available");
1177 clusterMapObjectController = locationWindow.addClusterMapObjectController();
1178 System.out.println(
"Added cluster map object controller");
1181 if (clusterMapObjectController ==
null) {
1185 IconMapObject clusterIcon1 = locationWindow.addIconMapObject();
1186 IconMapObject clusterIcon2 = locationWindow.addIconMapObject();
1187 if (clusterIcon1 !=
null) {
1188 clusterIcon1.
setPosition(
new GlobalPoint(100.0, 100.0));
1190 if (clusterIcon2 !=
null) {
1191 clusterIcon2.
setPosition(
new GlobalPoint(105.0, 102.0));
1195 boolean added1 = clusterMapObjectController.addIconMapObject(clusterIcon1);
1196 boolean added2 = clusterMapObjectController.addIconMapObject(clusterIcon2);
1197 System.out.println(
"Registered icons for clustering: " + added1 +
", " + added2);
1201 clusterMapObjectController.setEnabled(
true);
1202 System.out.println(
"Clustering enabled");
1206 boolean clusteringEnabled = clusterMapObjectController.isEnabled();
1207 System.out.println(
"Clustering is enabled: " + clusteringEnabled);
1211 clusterMapObjectController.setRadius(40.0f);
1212 System.out.println(
"Set cluster radius to 40 px");
1216 float clusterRadius = clusterMapObjectController.getRadius();
1217 System.out.println(
"Cluster radius: " + clusterRadius);
1221 boolean interactiveSuccess = clusterMapObjectController.setInteractive(
true);
1222 System.out.println(
"Set cluster markers interactive: " + interactiveSuccess);
1226 boolean sizeSuccess = clusterMapObjectController.setClusterSize(32.0f, 32.0f);
1227 System.out.println(
"Set default cluster icon size: " + sizeSuccess);
1230 clusterMapObjectControllerListener =
new DemoClusterMapObjectControllerListener();
1233 clusterMapObjectController.addListener(clusterMapObjectControllerListener);
1234 System.out.println(
"Added cluster map object controller listener");
1238 List<ClusterMapObject> clusters = clusterMapObjectController.getClusters();
1239 System.out.println(
"Visible clusters: " + clusters.size());
1242 if (!clusters.isEmpty()) {
1243 ClusterMapObject cluster = clusters.get(0);
1245 ImageProvider clusterBitmap = ImageProvider.fromFile(
"/path/to/cluster.png",
true);
1246 boolean bitmapSuccess = cluster.
setBitmap(clusterBitmap);
1247 System.out.println(
"Set cluster bitmap from ImageProvider: " + bitmapSuccess);
1252 clusterMapObjectController.removeListener(clusterMapObjectControllerListener);
1253 System.out.println(
"Removed cluster map object controller listener");
1256 if (clusterIcon1 !=
null) {
1258 boolean removed = clusterMapObjectController.removeIconMapObject(clusterIcon1);
1259 System.out.println(
"Removed icon from cluster controller: " + removed);
1261 locationWindow.removeIconMapObject(clusterIcon1);
1263 if (clusterIcon2 !=
null) {
1264 locationWindow.removeIconMapObject(clusterIcon2);
1268 clusterMapObjectController.clear();
1269 System.out.println(
"Cleared cluster controller");
1273 boolean controllerRemoved =
1274 locationWindow.removeClusterMapObjectController(clusterMapObjectController);
1275 System.out.println(
"Removed cluster map object controller: " + controllerRemoved);
1278 clusterMapObjectController =
null;
1279 clusterMapObjectControllerListener =
null;
1286 if (circleMapObject !=
null) {
1287 locationWindow.removeCircleMapObject(circleMapObject);
1288 circleMapObject =
null;
1290 if (iconMapObject !=
null) {
1291 locationWindow.removeIconMapObject(iconMapObject);
1292 iconMapObject =
null;
1294 if (polygonMapObject !=
null) {
1296 polygonMapObject =
null;
1298 if (polylineMapObject !=
null) {
1299 locationWindow.removePolylineMapObject(polylineMapObject);
1300 polylineMapObject =
null;
1302 if (dottedPolylineMapObject !=
null) {
1303 locationWindow.removeDottedPolylineMapObject(dottedPolylineMapObject);
1304 dottedPolylineMapObject =
null;
1306 if (modelMapObject !=
null) {
1307 locationWindow.removeModelMapObject(modelMapObject);
1308 modelMapObject =
null;
1310 System.out.println(
"LocationWindowMapObjects example cleanup completed");