42 System.out.println(
"--- setSublocationId Method ---");
44 if (locationWindow ==
null) {
45 System.out.println(
"LocationWindow not available yet");
51 locationWindow.setSublocationId(1);
52 System.out.println(
"Set sublocation ID to 1 (first floor)");
57 locationWindow.setSublocationId(2);
58 System.out.println(
"Set sublocation ID to 2 (second floor)");
63 locationWindow.setSublocationId(0);
64 System.out.println(
"Set sublocation ID to 0 (ground floor)");
68 List<Integer> sublocationIds = Arrays.asList(1, 2, 3, 0, 5);
69 for (Integer
id : sublocationIds) {
70 locationWindow.setSublocationId(
id);
71 System.out.println(
"Switched to sublocation ID: " +
id);
106 System.out.println(
"--- Sublocation Change Listener ---");
108 if (locationWindow ==
null) {
109 System.out.println(
"LocationWindow not available yet");
113 DemoSublocationChangeListener listener =
new DemoSublocationChangeListener();
116 locationWindow.addSublocationChangeListener(listener);
117 System.out.println(
"Added sublocation change listener");
120 locationWindow.setSublocationId(1);
121 locationWindow.setSublocationId(2);
124 locationWindow.removeSublocationChangeListener(listener);
125 System.out.println(
"Removed sublocation change listener");
155 System.out.println(
"--- UserLocationLayer ---");
157 if (userLocationLayer ==
null) {
158 System.out.println(
"UserLocationLayer not available yet");
163 userLocationLayer.setVisible(
true);
164 System.out.println(
"User location layer set visible");
168 boolean visible = userLocationLayer.isVisible();
169 System.out.println(
"User location layer is visible: " + visible);
173 ScreenPoint anchor =
new ScreenPoint(100.0f, 200.0f);
174 userLocationLayer.setAnchor(anchor);
175 System.out.println(
"Set user location anchor to: (" + anchor.getX() +
", " + anchor.getY() +
")");
179 boolean anchorEnabled = userLocationLayer.anchorEnabled();
180 System.out.println(
"Anchor enabled: " + anchorEnabled);
184 userLocationLayer.resetAnchor();
185 System.out.println(
"Anchor reset to default");
193 System.out.println(
"--- Coordinate Conversion Methods ---");
195 if (locationWindow ==
null) {
196 System.out.println(
"LocationWindow not available yet");
203 Point metersPoint = locationWindow.screenPositionToMeters(screenPoint);
204 System.out.printf(
"Screen position (%.1f, %.1f) converted to meters: (%.1f, %.1f)%n",
205 screenPoint.
getX(), screenPoint.
getY(), metersPoint.
getX(), metersPoint.
getY());
211 Point metersPoint2 = locationWindow.screenPositionToMeters(screenPoint2);
212 System.out.printf(
"Screen position (%.1f, %.1f) converted to meters: (%.1f, %.1f)%n",
213 screenPoint2.
getX(), screenPoint2.
getY(), metersPoint2.
getX(), metersPoint2.
getY());
219 Point screenPoint3 = locationWindow.metersToScreenPosition(metersPoint3,
true);
220 System.out.printf(
"Meters position (%.1f, %.1f) converted to screen with clipping: (%.1f, %.1f)%n",
221 metersPoint3.
getX(), metersPoint3.
getY(), screenPoint3.
getX(), screenPoint3.
getY());
227 Point screenPoint4 = locationWindow.metersToScreenPosition(metersPoint4,
false);
228 System.out.printf(
"Meters position (%.1f, %.1f) converted to screen without clipping: (%.1f, %.1f)%n",
229 metersPoint4.
getX(), metersPoint4.
getY(), screenPoint4.
getX(), screenPoint4.
getY());
233 List<Point> testScreenPoints = Arrays.asList(
235 new Point(250.0, 250.0),
236 new Point(1000.0, 600.0)
239 for (
int i = 0; i < testScreenPoints.size(); i++) {
240 Point screenPoint = testScreenPoints.get(i);
241 Point metersPoint = locationWindow.screenPositionToMeters(screenPoint);
242 Point backToScreen = locationWindow.metersToScreenPosition(metersPoint,
false);
243 System.out.printf(
"Test %d: Screen (%.1f, %.1f) -> Meters (%.1f, %.1f) -> Screen (%.1f, %.1f)%n",
244 i, screenPoint.
getX(), screenPoint.
getY(),
245 metersPoint.
getX(), metersPoint.
getY(),
246 backToScreen.
getX(), backToScreen.
getY());
254 System.out.println(
"--- Map Feature Selection Methods ---");
256 if (locationWindow ==
null) {
257 System.out.println(
"LocationWindow not available yet");
263 String featureId =
"room_101";
264 boolean selected = locationWindow.selectMapFeature(featureId);
265 System.out.println(
"Selected map feature " + featureId +
": " + selected);
270 String featureId2 =
"office_205";
271 boolean selected2 = locationWindow.selectMapFeature(featureId2);
272 System.out.println(
"Selected map feature " + featureId2 +
": " + selected2);
277 List<String> selectedFeatures = locationWindow.getSelectedMapFeatures();
278 System.out.println(
"Currently selected map features: " + selectedFeatures.size() +
" features");
279 for (String feature : selectedFeatures) {
280 System.out.println(
" - " + feature);
286 boolean deselected = locationWindow.deselectMapFeature(featureId);
287 System.out.println(
"Deselected map feature " + featureId +
": " + deselected);
292 boolean deselected2 = locationWindow.deselectMapFeature(featureId2);
293 System.out.println(
"Deselected map feature " + featureId2 +
": " + deselected2);
298 locationWindow.deselectAllMapFeatures();
299 System.out.println(
"Deselected all map features");
304 List<String> remainingFeatures = locationWindow.getSelectedMapFeatures();
305 System.out.println(
"Remaining selected features after deselect all: " + remainingFeatures.size() +
" features");
309 List<String> testFeatureIds = Arrays.asList(
"room_101",
"office_205",
"meeting_room_301",
"cafe_401");
312 for (String featureId : testFeatureIds) {
313 boolean success = locationWindow.selectMapFeature(featureId);
314 System.out.println(
"Selected feature " + featureId +
": " + success);
318 List<String> allSelected = locationWindow.getSelectedMapFeatures();
319 System.out.println(
"All selected features: " + allSelected.size() +
" features");
322 locationWindow.deselectAllMapFeatures();
323 System.out.println(
"Deselected all features at once");
330 System.out.println(
"--- Zoom Properties ---");
332 if (locationWindow ==
null) {
333 System.out.println(
"LocationWindow not available yet");
339 double currentZoom = locationWindow.getZoomFactor();
340 System.out.println(
"Current zoom factor: " + currentZoom);
345 locationWindow.setZoomFactor(150.0);
346 System.out.println(
"Set zoom factor to 150.0");
351 double minZoomFactor = locationWindow.getMinZoomFactor();
352 System.out.println(
"Minimum zoom factor: " + minZoomFactor);
357 locationWindow.setMinZoomFactor(50.0);
358 System.out.println(
"Set minimum zoom factor to 50.0");
363 double maxZoomFactor = locationWindow.getMaxZoomFactor();
364 System.out.println(
"Maximum zoom factor: " + maxZoomFactor);
369 locationWindow.setMaxZoomFactor(300.0);
370 System.out.println(
"Set maximum zoom factor to 300.0");
374 List<Double> testZoomFactors = Arrays.asList(100.0, 125.0, 150.0, 200.0, 250.0);
375 for (Double zoom : testZoomFactors) {
376 locationWindow.setZoomFactor(zoom);
377 System.out.println(
"Changed zoom factor to: " + locationWindow.getZoomFactor());
381 System.out.println(
"Testing zoom limits...");
382 locationWindow.setZoomFactor(locationWindow.getMinZoomFactor());
383 System.out.println(
"Set to minimum zoom: " + locationWindow.getZoomFactor());
385 locationWindow.setZoomFactor(locationWindow.getMaxZoomFactor());
386 System.out.println(
"Set to maximum zoom: " + locationWindow.getZoomFactor());
389 locationWindow.setZoomFactor(100.0);
390 System.out.println(
"Reset zoom factor to default: " + locationWindow.getZoomFactor());