20class LocationWindowCameraExample {
24 LocationWindowCameraExample() {
25 _demonstrateLocationWindowCameraMethods();
31 void _demonstrateLocationWindowCameraMethods() {
32 print(
"=== LocationWindowCamera Methods ===");
34 _demonstrateCameraProperties();
35 _demonstrateGetSetCamera();
36 _demonstrateCameraListeners();
37 _demonstrateFlyToMethod();
38 _demonstrateMoveToMethod();
39 _demonstrateZoomProperties();
40 _demonstrateCameraScenarios();
46 void _demonstrateCameraProperties() {
47 print(
"--- Camera Properties Setup ---");
50 print(
"LocationWindow not available yet");
57 print(
"Set minimum zoom factor to 10.0 pixels per meter");
63 print(
"Set maximum zoom factor to 1000.0 pixels per meter");
70 void _demonstrateGetSetCamera() {
71 print(
"--- getCamera and setCamera Methods ---");
74 print(
"LocationWindow not available yet");
81 print(
"Current camera position:");
82 print(
" Point: (${currentCamera.point.x}, ${currentCamera.point.y})");
83 print(
" Zoom: ${currentCamera.zoom}");
84 print(
" Rotation: ${currentCamera.rotation}°");
89 Point newPoint = Point(100.0, 200.0);
90 Camera newCamera = Camera(newPoint, 50.0, 0.0);
91 print(
"Created camera with point (${newPoint.x}, ${newPoint.y}), zoom 50.0, rotation 0°");
96 print(
"Camera properties:");
97 print(
" Point: (${newCamera.point.x}, ${newCamera.point.y})");
98 print(
" Zoom: ${newCamera.zoom}");
99 print(
" Rotation: ${newCamera.rotation}°");
105 print(
"Set camera position to (${newPoint.x}, ${newPoint.y}) with zoom 50.0 and rotation 0°");
110 Point rotatedPoint = Point(150.0, 250.0);
111 Camera rotatedCamera = Camera(rotatedPoint, 75.0, 45.0);
113 print(
"Set camera position to (${rotatedPoint.x}, ${rotatedPoint.y}) with zoom 75.0 and rotation 45°");
117 List<Camera> testCameras = [
118 Camera(Point(0.0, 0.0), 10.0, 0.0),
119 Camera(Point(50.0, 75.0), 500.0, 0.0),
120 Camera(Point(100.0, 150.0), 100.0, 30.0),
123 for (
int i = 0; i < testCameras.length; i++) {
124 Camera camera = testCameras[i];
126 print(
"Test camera $i: Point (${camera.point.x}, ${camera.point.y}), Zoom ${camera.zoom}, Rotation ${camera.rotation}°");
133 void _demonstrateCameraListeners() {
134 print(
"--- Camera Listener Methods ---");
137 print(
"LocationWindow not available yet");
145 print(
"Added camera listener");
152 print(
"Removed camera listener");
156 List<CameraListener> listeners = [
157 CameraListenerImpl(),
158 CameraListenerImpl(),
159 CameraListenerImpl(),
162 for (
int i = 0; i < listeners.length; i++) {
164 print(
"Added camera listener $i");
167 for (
int i = 0; i < listeners.length; i++) {
169 print(
"Removed camera listener $i");
176 void _demonstrateFlyToMethod() {
177 print(
"--- flyTo Method ---");
180 print(
"LocationWindow not available yet");
186 Point targetPoint = Point(150.0, 250.0);
187 Camera targetCamera = Camera(targetPoint, 75.0, 45.0);
188 CameraCallback callback = CameraCallback(
189 onMoveFinished: (completed) {
191 print(
"Fly to animation completed successfully");
193 print(
"Fly to animation was cancelled");
198 print(
"Started fly to animation to point (${targetPoint.x}, ${targetPoint.y})");
203 Point targetPoint2 = Point(300.0, 400.0);
204 Camera targetCamera2 = Camera(targetPoint2, 25.0, 180.0);
205 CameraCallback callback2 = CameraCallback(
206 onMoveFinished: (completed) {
207 print(
"Second fly to animation ${completed ? 'completed' : 'cancelled'}");
211 print(
"Started fly to animation to point (${targetPoint2.x}, ${targetPoint2.y}) with 3 second duration");
215 List<Map<String, dynamic>> flyToTests = [
216 {
"point": Point(50.0, 50.0),
"zoom": 100.0,
"rotation": 0.0,
"duration": 1000},
217 {
"point": Point(200.0, 300.0),
"zoom": 200.0,
"rotation": 90.0,
"duration": 1500},
218 {
"point": Point(400.0, 100.0),
"zoom": 50.0,
"rotation": 270.0,
"duration": 2500},
221 for (
int i = 0; i < flyToTests.length; i++) {
222 Map<String, dynamic> test = flyToTests[i];
223 Point point = test[
"point"];
224 double zoom = test[
"zoom"];
225 double rotation = test[
"rotation"];
226 int duration = test[
"duration"];
228 Camera camera = Camera(point, zoom, rotation);
229 CameraCallback testCallback = CameraCallback(
230 onMoveFinished: (completed) {
231 print(
"Fly to test $i ${completed ? 'completed' : 'cancelled'}");
235 print(
"Fly to test $i: Point (${point.x}, ${point.y}), Zoom $zoom, Rotation ${rotation}°, Duration ${duration}ms");
242 void _demonstrateMoveToMethod() {
243 print(
"--- moveTo Method ---");
246 print(
"LocationWindow not available yet");
252 Point targetPoint = Point(200.0, 300.0);
253 Camera targetCamera = Camera(targetPoint, 100.0, 90.0);
254 CameraCallback callback = CameraCallback(
255 onMoveFinished: (completed) {
256 print(
"Move to with linear animation ${completed ? 'completed' : 'cancelled'}");
259 _locationWindow!.moveTo(targetCamera, 1500, AnimationType.LINEAR, callback);
260 print(
"Started move to with linear animation");
265 CameraCallback callback2 = CameraCallback(
266 onMoveFinished: (completed) {
267 print(
"Move to with cubic animation ${completed ? 'completed' : 'cancelled'}");
270 _locationWindow!.moveTo(targetCamera, 1500, AnimationType.CUBIC, callback2);
271 print(
"Started move to with cubic animation");
276 CameraCallback callback3 = CameraCallback(
277 onMoveFinished: (completed) {
278 print(
"Move to with sine animation ${completed ? 'completed' : 'cancelled'}");
281 _locationWindow!.moveTo(targetCamera, 1500, AnimationType.SINE, callback3);
282 print(
"Started move to with sine animation");
287 Point instantPoint = Point(300.0, 400.0);
288 Camera instantCamera = Camera(instantPoint, 25.0, 180.0);
289 CameraCallback instantCallback = CameraCallback(
290 onMoveFinished: (completed) {
291 print(
"Instant move to completed");
294 _locationWindow!.moveTo(instantCamera, 0, AnimationType.NONE, instantCallback);
295 print(
"Executed instant move to position (${instantPoint.x}, ${instantPoint.y})");
300 List<AnimationType> animationTypes = [
301 AnimationType.LINEAR,
309 for (
int i = 0; i < animationTypes.length; i++) {
310 AnimationType animationType = animationTypes[i];
311 Point testPoint = Point(100.0 + i * 50.0, 200.0 + i * 50.0);
312 Camera testCamera = Camera(testPoint, 50.0 + i * 10.0, i * 30.0);
313 CameraCallback testCallback = CameraCallback(
314 onMoveFinished: (completed) {
315 print(
"Move to test with ${animationType.name} animation ${completed ? 'completed' : 'cancelled'}");
318 _locationWindow!.moveTo(testCamera, 1000, animationType, testCallback);
319 print(
"Move to test $i: Animation ${animationType.name}, Point (${testPoint.x}, ${testPoint.y})");
326 void _demonstrateZoomProperties() {
327 print(
"--- Zoom Properties ---");
330 print(
"LocationWindow not available yet");
337 print(
"Current zoom factor: $currentZoom pixels per meter");
343 print(
"Set zoom factor to 200.0 pixels per meter");
349 print(
"Minimum zoom factor: $minZoom pixels per meter");
355 print(
"Maximum zoom factor: $maxZoom pixels per meter");
359 List<double> zoomLevels = [50.0, 100.0, 150.0, 300.0, 500.0, 800.0];
361 for (
int i = 0; i < zoomLevels.length; i++) {
362 double zoom = zoomLevels[i];
364 print(
"Set zoom factor to $zoom pixels per meter");
368 print(
"Actual zoom factor: $actualZoom pixels per meter");
375 void _demonstrateCameraScenarios() {
376 print(
"--- Camera Scenarios ---");
379 print(
"LocationWindow not available yet");
385 Camera overviewCamera = Camera(Point(0.0, 0.0), 10.0, 0.0);
386 Camera detailCamera = Camera(Point(50.0, 75.0), 500.0, 0.0);
387 Camera angledCamera = Camera(Point(100.0, 150.0), 100.0, 30.0);
389 print(
"Created cameras for different scenarios:");
390 print(
" Overview camera: zoom ${overviewCamera.zoom}");
391 print(
" Detail camera: zoom ${detailCamera.zoom}");
392 print(
" Angled camera: rotation ${angledCamera.rotation}°");
396 List<Camera> scenarios = [overviewCamera, detailCamera, angledCamera];
397 List<String> scenarioNames = [
"Overview",
"Detail",
"Angled"];
399 for (
int i = 0; i < scenarios.length; i++) {
400 Camera scenario = scenarios[i];
401 String name = scenarioNames[i];
403 CameraCallback scenarioCallback = CameraCallback(
404 onMoveFinished: (completed) {
405 print(
"Transition to $name scenario ${completed ? 'completed' : 'cancelled'}");
409 _locationWindow!.moveTo(scenario, 2000, AnimationType.CUBIC, scenarioCallback);
410 print(
"Transitioning to $name scenario");
421 print(
"Camera listener removed");