22class LocationWindowInteractionExample {
23 LocationWindow? _locationWindow;
24 InputListener? _inputListener;
25 PickListener? _pickListener;
27 LocationWindowInteractionExample() {
28 _demonstrateLocationWindowInteractionMethods();
34 void _demonstrateLocationWindowInteractionMethods() {
35 print(
"=== LocationWindowInteraction Example ===");
37 _demonstrateGestureProperties();
38 _demonstratePickProperties();
39 _demonstratePickMethods();
40 _demonstrateInputListeners();
41 _demonstratePickListeners();
48 void _demonstrateGestureProperties() {
49 print(
"--- Gesture Properties ---");
51 if (_locationWindow ==
null) {
52 print(
"LocationWindow not available yet");
58 _locationWindow!.stickToBorder =
true;
59 print(
"Set stick to border to true");
64 _locationWindow!.rotateGestureEnabled =
true;
65 print(
"Set rotate gesture enabled to true");
70 _locationWindow!.tiltGesturesEnabled =
true;
71 print(
"Set tilt gestures enabled to true");
76 _locationWindow!.scrollGesturesEnabled =
true;
77 print(
"Set scroll gestures enabled to true");
82 _locationWindow!.zoomGesturesEnabled =
true;
83 print(
"Set zoom gestures enabled to true");
87 List<Map<String, dynamic>> gestureTests = [
88 {
"rotate":
true,
"tilt":
true,
"scroll":
true,
"zoom":
true,
"stick":
true},
89 {
"rotate":
false,
"tilt":
true,
"scroll":
true,
"zoom":
true,
"stick":
false},
90 {
"rotate":
true,
"tilt":
false,
"scroll":
true,
"zoom":
false,
"stick":
true},
91 {
"rotate":
false,
"tilt":
false,
"scroll":
false,
"zoom":
false,
"stick":
false},
94 for (
int i = 0; i < gestureTests.length; i++) {
95 Map<String, dynamic> test = gestureTests[i];
96 _locationWindow!.rotateGestureEnabled = test[
"rotate"];
97 _locationWindow!.tiltGesturesEnabled = test[
"tilt"];
98 _locationWindow!.scrollGesturesEnabled = test[
"scroll"];
99 _locationWindow!.zoomGesturesEnabled = test[
"zoom"];
100 _locationWindow!.stickToBorder = test[
"stick"];
101 print(
"Gesture test $i: Rotate=${test["rotate
"]}, Tilt=${test["tilt
"]}, Scroll=${test["scroll
"]}, Zoom=${test["zoom
"]}, Stick=${test["stick
"]}");
108 void _demonstratePickProperties() {
109 print(
"--- Pick Properties ---");
111 if (_locationWindow ==
null) {
112 print(
"LocationWindow not available yet");
118 _locationWindow!.pickRadius = 10.0;
119 print(
"Set pick radius to 10.0 pixels");
123 List<double> pickRadiusTests = [5.0, 10.0, 20.0, 50.0, 100.0];
125 for (
int i = 0; i < pickRadiusTests.length; i++) {
126 double radius = pickRadiusTests[i];
127 _locationWindow!.pickRadius = radius;
128 print(
"Pick radius test $i: ${radius} pixels");
135 void _demonstratePickMethods() {
136 print(
"--- Pick Methods ---");
138 if (_locationWindow ==
null) {
139 print(
"LocationWindow not available yet");
145 math.Point<
double> screenPoint = math.Point<
double>(100.0, 200.0);
146 _locationWindow!.pickMapObjectAt(screenPoint);
147 print(
"Picked map object at screen position (${screenPoint.x}, ${screenPoint.y})");
152 math.Point<
double> featurePoint = math.Point<
double>(150.0, 250.0);
153 _locationWindow!.pickMapFeatureAt(featurePoint);
154 print(
"Picked map feature at screen position (${featurePoint.x}, ${featurePoint.y})");
158 List<math.Point<
double>> pickTests = [
159 math.Point<
double>(50.0, 50.0),
160 math.Point<
double>(200.0, 300.0),
161 math.Point<
double>(400.0, 100.0),
162 math.Point<
double>(300.0, 400.0),
165 for (
int i = 0; i < pickTests.length; i++) {
166 math.Point<
double> point = pickTests[i];
167 _locationWindow!.pickMapObjectAt(point);
168 _locationWindow!.pickMapFeatureAt(point);
169 print(
"Pick test $i: Object and feature at (${point.x}, ${point.y})");
176 void _demonstrateInputListeners() {
177 print(
"--- Input Listeners ---");
179 if (_locationWindow ==
null) {
180 print(
"LocationWindow not available yet");
186 _inputListener = InputListenerImpl();
187 _locationWindow!.addInputListener(_inputListener!);
188 print(
"Added input listener");
193 _locationWindow!.removeInputListener(_inputListener!);
194 _inputListener =
null;
195 print(
"Removed input listener");
199 List<InputListener> listeners = [
205 for (
int i = 0; i < listeners.length; i++) {
206 _locationWindow!.addInputListener(listeners[i]);
207 print(
"Added input listener $i");
210 for (
int i = 0; i < listeners.length; i++) {
211 _locationWindow!.removeInputListener(listeners[i]);
212 print(
"Removed input listener $i");
219 void _demonstratePickListeners() {
220 print(
"--- Pick Listeners ---");
222 if (_locationWindow ==
null) {
223 print(
"LocationWindow not available yet");
229 _pickListener = PickListenerImpl();
230 _locationWindow!.addPickListener(_pickListener!);
231 print(
"Added pick listener");
235 List<PickListener> listeners = [
241 for (
int i = 0; i < listeners.length; i++) {
242 _locationWindow!.addPickListener(listeners[i]);
243 print(
"Added pick listener $i");
246 for (
int i = 0; i < listeners.length; i++) {
248 _locationWindow!.removePickListener(listeners[i]);
249 print(
"Removed pick listener $i");
258 if (_inputListener !=
null) {
259 _locationWindow?.removeInputListener(_inputListener!);
260 _inputListener =
null;
262 if (_pickListener !=
null) {
263 _locationWindow?.removePickListener(_pickListener!);
264 _pickListener =
null;
266 print(
"LocationWindowInteraction example cleanup completed");