Loading...
Searching...
No Matches
LocationWindowMapObjectsExample.m
Go to the documentation of this file.
1#import <Foundation/Foundation.h>
2#import <NavigineSDK/NavigineSDK.h>
3
10@interface LocationWindowMapObjectsExample : NSObject
11
12@property (nonatomic, strong) NCLocationWindow *locationWindow;
13@property (nonatomic, strong) NSMutableArray *mapObjects;
14
23- (void)cleanup;
24
25@end
26
27@implementation LocationWindowMapObjectsExample
28
29- (instancetype)init {
30 self = [super init];
31 if (self) {
32 _mapObjects = [NSMutableArray array];
34 }
35 return self;
36}
37
42 NSLog(@"=== LocationWindowMapObjects Example ===");
43
44 // Initialize LocationWindow (in real app, this would be provided by the framework)
45 // self.locationWindow = [self getLocationWindow];
46
48
55
56 [self cleanup];
57}
58
63 NSLog(@"--- LocationPolygon / LocationPolyline records ---");
64
65 // [objc_LocationPolygon_record]
66 NSArray<NCPoint *> *ring = @[
67 [[NCPoint alloc] initWithX:1.0 y:2.0],
68 [[NCPoint alloc] initWithX:3.0 y:4.0],
69 [[NCPoint alloc] initWithX:5.0 y:2.0],
70 ];
71 NCPolygon *metricPolygon = [[NCPolygon alloc] initWithPoints:ring];
72 NCLocationPolygon *locationPolygon = [[NCLocationPolygon alloc] initWithPolygon:metricPolygon locationId:42 sublocationId:7];
73 NCPolygon *polygonBack = locationPolygon.polygon;
74 NSLog(@"LocationPolygon location %d sublocation %d vertices %lu",
75 (int)locationPolygon.locationId, (int)locationPolygon.sublocationId, (unsigned long)polygonBack.points.count);
76 // [objc_LocationPolygon_record]
77
78 // [objc_LocationPolyline_record]
79 NSArray<NCPoint *> *linePts = @[
80 [[NCPoint alloc] initWithX:0.0 y:0.0],
81 [[NCPoint alloc] initWithX:10.0 y:10.0],
82 ];
83 NCPolyline *metricPolyline = [[NCPolyline alloc] initWithPoints:linePts];
84 NCLocationPolyline *locationPolyline = [[NCLocationPolyline alloc] initWithPolyline:metricPolyline locationId:42 sublocationId:7];
85 NCPolyline *polylineBack = locationPolyline.polyline;
86 NSLog(@"LocationPolyline points %lu", (unsigned long)polylineBack.points.count);
87 // [objc_LocationPolyline_record]
88}
89
94 NSLog(@"--- Circle Map Objects ---");
95
96 if (_locationWindow == nil) {
97 NSLog(@"LocationWindow not available yet");
98 return;
99 }
100
101 // [objc_CircleMapObject_constructor]
102 // Create circle map object
103 NCLocationPoint *center = [[NCLocationPoint alloc] initWithX:10.0 y:20.0];
104 NCCircleMapObject *circleObject = [[NCCircleMapObject alloc] initWithCenter:center radius:5.0];
105 NSLog(@"Created circle map object with center (%f, %f) and radius 5.0", center.x, center.y);
106 // [objc_CircleMapObject_constructor]
107
108 // [objc_CircleMapObject_getCenter]
109 // Access circle center
110 NCLocationPoint *circleCenter = circleObject.center;
111 NSLog(@"Circle center: (%f, %f)", circleCenter.x, circleCenter.y);
112 // [objc_CircleMapObject_getCenter]
113
114 // [objc_CircleMapObject_getRadius]
115 // Access circle radius
116 double radius = circleObject.radius;
117 NSLog(@"Circle radius: %f", radius);
118 // [objc_CircleMapObject_getRadius]
119
120 // [objc_LocationWindow_addCircleMapObject]
121 // Add circle map object
122 [_locationWindow addCircleMapObject:circleObject];
123 [_mapObjects addObject:circleObject];
124 NSLog(@"Added circle map object");
125 // [objc_LocationWindow_addCircleMapObject]
126
127 // Test multiple circle objects
128 NSArray *circles = @[
129 [[NCCircleMapObject alloc] initWithCenter:[[NCLocationPoint alloc] initWithX:15.0 y:25.0] radius:3.0],
130 [[NCCircleMapObject alloc] initWithCenter:[[NCLocationPoint alloc] initWithX:20.0 y:30.0] radius:7.0],
131 [[NCCircleMapObject alloc] initWithCenter:[[NCLocationPoint alloc] initWithX:25.0 y:35.0] radius:4.0]
132 ];
133
134 for (NCCircleMapObject *circle in circles) {
135 [_locationWindow addCircleMapObject:circle];
136 [_mapObjects addObject:circle];
137 NSLog(@"Added circle at (%f, %f) with radius %f", circle.center.x, circle.center.y, circle.radius);
138 }
139
140 // [objc_LocationWindow_removeCircleMapObject]
141 // Remove circle map object
142 [_locationWindow removeCircleMapObject:circleObject];
143 [_mapObjects removeObject:circleObject];
144 NSLog(@"Removed circle map object");
145 // [objc_LocationWindow_removeCircleMapObject]
146
147 if (circleObject != nil) {
148 // [objc_CircleMapObject_setPosition]
149 // Set circle position
150 NCLocationPoint *centerPoint = [[NCLocationPoint alloc] initWithX:100.0 y:200.0];
151 BOOL success = [circleObject setPosition:centerPoint];
152 NSLog(@"Set circle position to (%f, %f): %@", centerPoint.x, centerPoint.y, success ? @"YES" : @"NO");
153 // [objc_CircleMapObject_setPosition]
154
155 // [objc_CircleMapObject_setPositionAnimated]
156 // Set circle position with animation
157 NCLocationPoint *animatedPoint = [[NCLocationPoint alloc] initWithX:150.0 y:250.0];
158 BOOL animatedSuccess = [circleObject setPositionAnimated:animatedPoint duration:2.0 animationType:AnimationTypeLinear];
159 NSLog(@"Set circle position with animation to (%f, %f): %@", animatedPoint.x, animatedPoint.y, animatedSuccess ? @"YES" : @"NO");
160 // [objc_CircleMapObject_setPositionAnimated]
161
162 // [objc_CircleMapObject_setRadius]
163 // Set circle radius
164 BOOL radiusSuccess = [circleObject setRadius:10.0];
165 NSLog(@"Set circle radius to 10.0 meters: %@", radiusSuccess ? @"YES" : @"NO");
166 // [objc_CircleMapObject_setRadius]
167
168 // [objc_CircleMapObject_setCollisionEnabled]
169 // Enable collision detection
170 BOOL collisionSuccess = [circleObject setCollisionEnabled:YES];
171 NSLog(@"Enabled collision detection for circle: %@", collisionSuccess ? @"YES" : @"NO");
172 // [objc_CircleMapObject_setCollisionEnabled]
173
174 // [objc_CircleMapObject_setBuffer]
175 // Set collision buffer
176 BOOL bufferSuccess = [circleObject setBufferWithWidth:5.0 height:5.0];
177 NSLog(@"Set collision buffer to 5x5 pixels: %@", bufferSuccess ? @"YES" : @"NO");
178 // [objc_CircleMapObject_setBuffer]
179
180 // [objc_CircleMapObject_setOffset]
181 // Set position offset
182 BOOL offsetSuccess = [circleObject setOffsetWithX:2.0 y:3.0];
183 NSLog(@"Set position offset to (2.0, 3.0) pixels: %@", offsetSuccess ? @"YES" : @"NO");
184 // [objc_CircleMapObject_setOffset]
185
186 // [objc_CircleMapObject_setOutlineColor]
187 // Set outline color
188 BOOL outlineColorSuccess = [circleObject setOutlineColorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
189 NSLog(@"Set circle outline color to blue: %@", outlineColorSuccess ? @"YES" : @"NO");
190 // [objc_CircleMapObject_setOutlineColor]
191
192 // [objc_CircleMapObject_setOutlineAlpha]
193 // Set outline alpha
194 BOOL outlineAlphaSuccess = [circleObject setOutlineAlpha:0.5];
195 NSLog(@"Set circle outline alpha to 0.5: %@", outlineAlphaSuccess ? @"YES" : @"NO");
196 // [objc_CircleMapObject_setOutlineAlpha]
197
198 // [objc_CircleMapObject_setOutlineRadius]
199 // Set outline radius
200 BOOL outlineRadiusSuccess = [circleObject setOutlineRadius:2.0];
201 NSLog(@"Set circle outline radius to 2.0: %@", outlineRadiusSuccess ? @"YES" : @"NO");
202 // [objc_CircleMapObject_setOutlineRadius]
203
204 // [objc_CircleMapObject_setColor]
205 // Set circle color
206 BOOL colorSuccess = [circleObject setColorWithRed:1.0 green:0.0 blue:0.0 alpha:0.8];
207 NSLog(@"Set circle color to red with 80%% opacity: %@", colorSuccess ? @"YES" : @"NO");
208 // [objc_CircleMapObject_setColor]
209
210 // [objc_CircleMapObject_setPriority]
211 // Set rendering priority
212 BOOL prioritySuccess = [circleObject setPriority:1];
213 NSLog(@"Set rendering priority to 1: %@", prioritySuccess ? @"YES" : @"NO");
214 // [objc_CircleMapObject_setPriority]
215
216 // [objc_MapObject_setVisible]
217 // Set visibility
218 BOOL visibleSuccess = [circleObject setVisible:YES];
219 NSLog(@"Set circle visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
220 // [objc_MapObject_setVisible]
221
222 // [objc_CircleMapObject_getMapObjectType]
223 // Get map object type
224 NCMapObjectType objectType = circleObject.mapObjectType;
225 NSLog(@"Circle map object type: %@", objectType);
226 // [objc_CircleMapObject_getMapObjectType]
227
228 // [objc_MapObject_setAlpha]
229 // Set alpha transparency
230 BOOL alphaSuccess = [circleObject setAlpha:0.7];
231 NSLog(@"Set circle alpha to 0.7: %@", alphaSuccess ? @"YES" : @"NO");
232 // [objc_MapObject_setAlpha]
233
234 // [objc_MapObject_setInteractive]
235 // Set interactive mode
236 BOOL interactiveSuccess = [circleObject setInteractive:YES];
237 NSLog(@"Set circle interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
238 // [objc_MapObject_setInteractive]
239
240 // [objc_MapObject_setTitle]
241 // Set title
242 BOOL titleSuccess = [circleObject setTitle:@"Circle Object"];
243 NSLog(@"Set circle title to 'Circle Object': %@", titleSuccess ? @"YES" : @"NO");
244 // [objc_MapObject_setTitle]
245
246 // [objc_MapObject_setData]
247 // Set custom data
248 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
249 BOOL dataSuccess = [circleObject setData:customData];
250 NSLog(@"Set circle custom data: %@", dataSuccess ? @"YES" : @"NO");
251 // [objc_MapObject_setData]
252
253 // [objc_MapObject_getId]
254 // Get object ID
255 NSInteger objectId = circleObject.id;
256 NSLog(@"Circle object ID: %ld", (long)objectId);
257 // [objc_MapObject_getId]
258
259 // [objc_MapObject_getType]
260 // Get object type
261 NSString *objectTypeString = circleObject.type;
262 NSLog(@"Circle object type: %@", objectTypeString);
263 // [objc_MapObject_getType]
264
265 // [objc_MapObject_getData]
266 // Get custom data
267 NSDictionary *retrievedData = circleObject.data;
268 NSLog(@"Circle custom data: %@", retrievedData);
269 // [objc_MapObject_getData]
270 }
271}
272
277 NSLog(@"--- Icon Map Objects ---");
278
279 if (_locationWindow == nil) {
280 NSLog(@"LocationWindow not available yet");
281 return;
282 }
283
284 // [objc_IconMapObject_constructor]
285 // Create icon map object
286 NCLocationPoint *position = [[NCLocationPoint alloc] initWithX:30.0 y:40.0];
287 NCIconMapObject *iconObject = [[NCIconMapObject alloc] initWithPosition:position];
288 NSLog(@"Created icon map object at (%f, %f)", position.x, position.y);
289 // [objc_IconMapObject_constructor]
290
291 // [objc_IconMapObject_getPosition]
292 // Access icon position
293 NCLocationPoint *iconPosition = iconObject.position;
294 NSLog(@"Icon position: (%f, %f)", iconPosition.x, iconPosition.y);
295 // [objc_IconMapObject_getPosition]
296
297 // [objc_IconMapObject_setIcon]
298 // Set icon image
299 BOOL iconSuccess = [iconObject setIcon:@"path/to/icon.png"];
300 NSLog(@"Set icon image: %@", iconSuccess ? @"YES" : @"NO");
301 // [objc_IconMapObject_setIcon]
302
303 // [objc_IconMapObject_setBitmap]
304 // Set icon bitmap
305 BOOL bitmapSuccess = [iconObject setBitmap:@"path/to/bitmap.png"];
306 NSLog(@"Set icon bitmap: %@", bitmapSuccess ? @"YES" : @"NO");
307 // [objc_IconMapObject_setBitmap]
308
309 // [objc_IconMapObject_setFlat]
310 // Set icon flat mode
311 BOOL flatSuccess = [iconObject setFlat:YES];
312 NSLog(@"Set icon flat mode to true: %@", flatSuccess ? @"YES" : @"NO");
313 // [objc_IconMapObject_setFlat]
314
315 // [objc_IconMapObject_setSize]
316 // Set icon size
317 NCSize *size = [[NCSize alloc] initWithWidth:32.0 height:32.0];
318 BOOL sizeSuccess = [iconObject setSize:size];
319 NSLog(@"Set icon size to (%.1f, %.1f): %@", size.width, size.height, sizeSuccess ? @"YES" : @"NO");
320 // [objc_IconMapObject_setSize]
321
322 // [objc_IconMapObject_setAngle]
323 // Set icon rotation angle
324 BOOL angleSuccess = [iconObject setAngle:45.0];
325 NSLog(@"Set icon rotation angle to 45 degrees: %@", angleSuccess ? @"YES" : @"NO");
326 // [objc_IconMapObject_setAngle]
327
328 // [objc_IconMapObject_setAngleAnimated]
329 // Set icon rotation with animation
330 BOOL angleAnimatedSuccess = [iconObject setAngleAnimated:90.0 duration:2.0 animationType:NCSine];
331 NSLog(@"Set icon rotation with animation to 90 degrees: %@", angleAnimatedSuccess ? @"YES" : @"NO");
332 // [objc_IconMapObject_setAngleAnimated]
333
334 // [objc_IconMapObject_setCollisionEnabled]
335 // Enable collision detection
336 BOOL collisionSuccess = [iconObject setCollisionEnabled:YES];
337 NSLog(@"Enabled collision detection for icon: %@", collisionSuccess ? @"YES" : @"NO");
338 // [objc_IconMapObject_setCollisionEnabled]
339
340 // [objc_IconMapObject_setBuffer]
341 // Set collision buffer
342 BOOL bufferSuccess = [iconObject setBufferWithWidth:10.0 height:10.0];
343 NSLog(@"Set collision buffer to 10x10 pixels: %@", bufferSuccess ? @"YES" : @"NO");
344 // [objc_IconMapObject_setBuffer]
345
346 // [objc_IconMapObject_setPlacement]
347 // Set icon placement
348 BOOL placementSuccess = [iconObject setPlacement:NCCenter];
349 NSLog(@"Set icon placement to CENTER: %@", placementSuccess ? @"YES" : @"NO");
350 // [objc_IconMapObject_setPlacement]
351
352 // [objc_IconMapObject_setPosition]
353 // Set icon position
354 NCLocationPoint *newPosition = [[NCLocationPoint alloc] initWithX:35.0 y:45.0];
355 BOOL positionSuccess = [iconObject setPosition:newPosition];
356 NSLog(@"Set icon position to (%.1f, %.1f): %@", newPosition.x, newPosition.y, positionSuccess ? @"YES" : @"NO");
357 // [objc_IconMapObject_setPosition]
358
359 // [objc_IconMapObject_setPositionAnimated]
360 // Set icon position with animation
361 NCLocationPoint *animatedPosition = [[NCLocationPoint alloc] initWithX:40.0 y:50.0];
362 BOOL animatedSuccess = [iconObject setPositionAnimated:animatedPosition duration:2.0 animationType:NCLinear];
363 NSLog(@"Set icon position with animation to (%.1f, %.1f): %@", animatedPosition.x, animatedPosition.y, animatedSuccess ? @"YES" : @"NO");
364 // [objc_IconMapObject_setPositionAnimated]
365
366 // [objc_IconMapObject_setOffset]
367 // Set icon offset
368 BOOL offsetSuccess = [iconObject setOffsetWithWidth:5.0 height:5.0];
369 NSLog(@"Set icon offset to 5x5 pixels: %@", offsetSuccess ? @"YES" : @"NO");
370 // [objc_IconMapObject_setOffset]
371
372 // [objc_IconMapObject_setPriority]
373 // Set icon priority
374 BOOL prioritySuccess = [iconObject setPriority:1];
375 NSLog(@"Set icon priority to 1: %@", prioritySuccess ? @"YES" : @"NO");
376 // [objc_IconMapObject_setPriority]
377
378 // [objc_IconMapObject_setVisible]
379 // Set visibility
380 BOOL visibleSuccess = [iconObject setVisible:YES];
381 NSLog(@"Set icon visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
382 // [objc_IconMapObject_setVisible]
383
384 // [objc_IconMapObject_getMapObjectType]
385 // Get map object type
386 NCMapObjectType objectType = iconObject.mapObjectType;
387 NSLog(@"Icon map object type: %@", objectType);
388 // [objc_IconMapObject_getMapObjectType]
389
390 // [objc_MapObject_setAlpha_1]
391 // Set alpha transparency
392 BOOL alphaSuccess = [iconObject setAlpha:0.8];
393 NSLog(@"Set icon alpha to 0.8: %@", alphaSuccess ? @"YES" : @"NO");
394 // [objc_MapObject_setAlpha_1]
395
396 // [objc_MapObject_setInteractive_1]
397 // Set interactive mode
398 BOOL interactiveSuccess = [iconObject setInteractive:YES];
399 NSLog(@"Set icon interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
400 // [objc_MapObject_setInteractive_1]
401
402 // [objc_MapObject_setTitle_1]
403 // Set title
404 BOOL titleSuccess = [iconObject setTitle:@"Icon Object"];
405 NSLog(@"Set icon title to 'Icon Object': %@", titleSuccess ? @"YES" : @"NO");
406 // [objc_MapObject_setTitle_1]
407
408 // [objc_MapObject_setData_1]
409 // Set custom data
410 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
411 BOOL dataSuccess = [iconObject setData:customData];
412 NSLog(@"Set icon custom data: %@", dataSuccess ? @"YES" : @"NO");
413 // [objc_MapObject_setData_1]
414
415 // [objc_MapObject_getId_1]
416 // Get object ID
417 NSInteger objectId = iconObject.id;
418 NSLog(@"Icon object ID: %ld", (long)objectId);
419 // [objc_MapObject_getId_1]
420
421 // [objc_MapObject_getType_1]
422 // Get object type
423 NSString *objectTypeString = iconObject.type;
424 NSLog(@"Icon object type: %@", objectTypeString);
425 // [objc_MapObject_getType_1]
426
427 // [objc_MapObject_getData_1]
428 // Get custom data
429 NSDictionary *retrievedData = iconObject.data;
430 NSLog(@"Icon custom data: %@", retrievedData);
431 // [objc_MapObject_getData_1]
432
433 // [objc_LocationWindow_addIconMapObject]
434 // Add icon map object
435 [_locationWindow addIconMapObject:iconObject];
436 [_mapObjects addObject:iconObject];
437 NSLog(@"Added icon map object");
438 // [objc_LocationWindow_addIconMapObject]
439
440 // Test multiple icon objects
441 NSArray *icons = @[
442 [[NCIconMapObject alloc] initWithPosition:[[NCLocationPoint alloc] initWithX:35.0 y:45.0]],
443 [[NCIconMapObject alloc] initWithPosition:[[NCLocationPoint alloc] initWithX:40.0 y:50.0]],
444 [[NCIconMapObject alloc] initWithPosition:[[NCLocationPoint alloc] initWithX:45.0 y:55.0]]
445 ];
446
447 for (NCIconMapObject *icon in icons) {
448 [_locationWindow addIconMapObject:icon];
449 [_mapObjects addObject:icon];
450 NSLog(@"Added icon at (%f, %f)", icon.position.x, icon.position.y);
451 }
452
453 // [objc_LocationWindow_removeIconMapObject]
454 // Remove icon map object
455 [_locationWindow removeIconMapObject:iconObject];
456 [_mapObjects removeObject:iconObject];
457 NSLog(@"Removed icon map object");
458 // [objc_LocationWindow_removeIconMapObject]
459}
460
465 NSLog(@"--- Polygon Map Objects ---");
466
467 if (_locationWindow == nil) {
468 NSLog(@"LocationWindow not available yet");
469 return;
470 }
471
472 // [objc_LocationWindow_addPolygonMapObject]
473 // Add polygon map object
475 NSLog(@"Added polygon map object");
476 // [objc_LocationWindow_addPolygonMapObject]
477
478 if (polygonObject != nil) {
479 // [objc_PolygonMapObject_setPolygon]
480 // Set polygon geometry
481 NSArray<NCPoint *> *points = @[
482 [[NCPoint alloc] initWithX:100.0 y:200.0],
483 [[NCPoint alloc] initWithX:150.0 y:250.0],
484 [[NCPoint alloc] initWithX:200.0 y:200.0],
485 [[NCPoint alloc] initWithX:150.0 y:150.0],
486 ];
487 NCPolygon *metricPolygon = [[NCPolygon alloc] initWithPoints:points];
488 NCLocationPolygon *polygon = [[NCLocationPolygon alloc] initWithPolygon:metricPolygon locationId:1 sublocationId:0];
489 BOOL success = [polygonObject setPolygon:polygon];
490 NSLog(@"Set polygon with %lu points: %@", (unsigned long)points.count, success ? @"YES" : @"NO");
491 // [objc_PolygonMapObject_setPolygon]
492
493 // [objc_PolygonMapObject_setColor]
494 // Set polygon color
495 BOOL colorSuccess = [polygonObject setColorWithRed:0.0 green:1.0 blue:0.0 alpha:0.7];
496 NSLog(@"Set polygon color to green with 70%% opacity: %@", colorSuccess ? @"YES" : @"NO");
497 // [objc_PolygonMapObject_setColor]
498
499 // [objc_PolygonMapObject_setVisible]
500 // Set visibility
501 BOOL visibleSuccess = [polygonObject setVisible:YES];
502 NSLog(@"Set polygon visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
503 // [objc_PolygonMapObject_setVisible]
504
505 // [objc_PolygonMapObject_getMapObjectType]
506 // Get map object type
507 NCMapObjectType objectType = polygonObject.mapObjectType;
508 NSLog(@"Polygon map object type: %@", objectType);
509 // [objc_PolygonMapObject_getMapObjectType]
510
511 // [objc_PolygonMapObject_setOrder]
512 // Set polygon rendering order
513 BOOL orderSuccess = [polygonObject setOrder:2];
514 NSLog(@"Set polygon rendering order to 2: %@", orderSuccess ? @"YES" : @"NO");
515 // [objc_PolygonMapObject_setOrder]
516
517 // [objc_PolygonMapObject_setOutlineColor]
518 // Set polygon outline color
519 BOOL outlineColorSuccess = [polygonObject setOutlineColorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
520 NSLog(@"Set polygon outline color to blue: %@", outlineColorSuccess ? @"YES" : @"NO");
521 // [objc_PolygonMapObject_setOutlineColor]
522
523 // [objc_PolygonMapObject_setOutlineWidth]
524 // Set polygon outline width
525 BOOL outlineWidthSuccess = [polygonObject setOutlineWidth:2.0];
526 NSLog(@"Set polygon outline width to 2.0 pixels: %@", outlineWidthSuccess ? @"YES" : @"NO");
527 // [objc_PolygonMapObject_setOutlineWidth]
528
529 // [objc_PolygonMapObject_setOutlineAlpha]
530 // Set polygon outline alpha
531 BOOL outlineAlphaSuccess = [polygonObject setOutlineAlpha:0.8];
532 NSLog(@"Set polygon outline alpha to 0.8: %@", outlineAlphaSuccess ? @"YES" : @"NO");
533 // [objc_PolygonMapObject_setOutlineAlpha]
534
535 // [objc_PolygonMapObject_setOutlineOrder]
536 // Set polygon outline order
537 BOOL outlineOrderSuccess = [polygonObject setOutlineOrder:1];
538 NSLog(@"Set polygon outline order to 1: %@", outlineOrderSuccess ? @"YES" : @"NO");
539 // [objc_PolygonMapObject_setOutlineOrder]
540
541 // [objc_MapObject_setAlpha_2]
542 // Set alpha transparency
543 BOOL alphaSuccess = [polygonObject setAlpha:0.6];
544 NSLog(@"Set polygon alpha to 0.6: %@", alphaSuccess ? @"YES" : @"NO");
545 // [objc_MapObject_setAlpha_2]
546
547 // [objc_MapObject_setInteractive_2]
548 // Set interactive mode
549 BOOL interactiveSuccess = [polygonObject setInteractive:YES];
550 NSLog(@"Set polygon interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
551 // [objc_MapObject_setInteractive_2]
552
553 // [objc_MapObject_setTitle_2]
554 // Set title
555 BOOL titleSuccess = [polygonObject setTitle:@"Polygon Object"];
556 NSLog(@"Set polygon title to 'Polygon Object': %@", titleSuccess ? @"YES" : @"NO");
557 // [objc_MapObject_setTitle_2]
558
559 // [objc_MapObject_setData_2]
560 // Set custom data
561 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
562 BOOL dataSuccess = [polygonObject setData:customData];
563 NSLog(@"Set polygon custom data: %@", dataSuccess ? @"YES" : @"NO");
564 // [objc_MapObject_setData_2]
565
566 // [objc_MapObject_getId_2]
567 // Get object ID
568 NSInteger objectId = polygonObject.id;
569 NSLog(@"Polygon object ID: %ld", (long)objectId);
570 // [objc_MapObject_getId_2]
571
572 // [objc_MapObject_getType_2]
573 // Get object type
574 NSString *objectTypeString = polygonObject.type;
575 NSLog(@"Polygon object type: %@", objectTypeString);
576 // [objc_MapObject_getType_2]
577
578 // [objc_MapObject_getData_2]
579 // Get custom data
580 NSDictionary *retrievedData = polygonObject.data;
581 NSLog(@"Polygon custom data: %@", retrievedData);
582 // [objc_MapObject_getData_2]
583 }
584
585 // [objc_LocationWindow_removePolygonMapObject]
586 // Remove polygon map object
587 if (polygonObject != nil) {
588 BOOL removed = [_locationWindow removePolygonMapObject:polygonObject];
589 NSLog(@"Removed polygon map object: %@", removed ? @"YES" : @"NO");
590 }
591 // [objc_LocationWindow_removePolygonMapObject]
592
593 // Test multiple polygon objects
594 NSMutableArray *polygons = [NSMutableArray array];
595 for (int i = 0; i < 3; i++) {
597 if (polygon != nil) {
598 NSArray<NCPoint *> *points = @[
599 [[NCPoint alloc] initWithX:300.0 + i * 50 y:400.0 + i * 50],
600 [[NCPoint alloc] initWithX:350.0 + i * 50 y:450.0 + i * 50],
601 [[NCPoint alloc] initWithX:400.0 + i * 50 y:400.0 + i * 50],
602 [[NCPoint alloc] initWithX:350.0 + i * 50 y:350.0 + i * 50],
603 ];
604 NCPolygon *metricPoly = [[NCPolygon alloc] initWithPoints:points];
605 NCLocationPolygon *polygonGeometry = [[NCLocationPolygon alloc] initWithPolygon:metricPoly locationId:1 sublocationId:0];
606 [polygon setPolygon:polygonGeometry];
607 [polygon setColorWithRed:0.0 green:0.0 blue:1.0 alpha:0.5];
608 [polygons addObject:polygon];
609 NSLog(@"Created polygon %d with %lu points", i, (unsigned long)points.count);
610 }
611 }
612
613 for (int i = 0; i < polygons.count; i++) {
614 [_locationWindow removePolygonMapObject:polygons[i]];
615 NSLog(@"Removed polygon %d", i);
616 }
617}
618
623 NSLog(@"--- Polyline Map Objects ---");
624
625 if (_locationWindow == nil) {
626 NSLog(@"LocationWindow not available yet");
627 return;
628 }
629
630 // [objc_PolylineMapObject_constructor]
631 // Create polyline map object
632 NSArray<NCPoint *> *points = @[
633 [[NCPoint alloc] initWithX:100.0 y:110.0],
634 [[NCPoint alloc] initWithX:105.0 y:115.0],
635 [[NCPoint alloc] initWithX:110.0 y:120.0],
636 [[NCPoint alloc] initWithX:115.0 y:125.0],
637 ];
638 NCPolyline *metricPolyline = [[NCPolyline alloc] initWithPoints:points];
639 NCLocationPolyline *polyline = [[NCLocationPolyline alloc] initWithPolyline:metricPolyline locationId:1 sublocationId:0];
640 NCPolylineMapObject *polylineObject = [[NCPolylineMapObject alloc] initWithPolyline:polyline];
641 NSLog(@"Created polyline map object with %lu points", (unsigned long)points.count);
642 // [objc_PolylineMapObject_constructor]
643
644 // [objc_PolylineMapObject_getPolyline]
645 // Access polyline
646 NCLocationPolyline *polylineShape = polylineObject.polyline;
647 NSLog(@"Polyline has %lu points", (unsigned long)polylineShape.polyline.points.count);
648 // [objc_PolylineMapObject_getPolyline]
649
650 // [objc_LocationWindow_addPolylineMapObject]
651 // Add polyline map object
652 [_locationWindow addPolylineMapObject:polylineObject];
653 [_mapObjects addObject:polylineObject];
654 NSLog(@"Added polyline map object");
655 // [objc_LocationWindow_addPolylineMapObject]
656
657 // Test multiple polyline objects
658 NSArray *polylines = @[
659 [[NCPolylineMapObject alloc] initWithPolyline:[[NCLocationPolyline alloc] initWithPolyline:[[NCPolyline alloc] initWithPoints:@[
660 [[NCPoint alloc] initWithX:120.0 y:130.0],
661 [[NCPoint alloc] initWithX:125.0 y:135.0],
662 [[NCPoint alloc] initWithX:130.0 y:140.0],
663 ]] locationId:1 sublocationId:0]],
664 [[NCPolylineMapObject alloc] initWithPolyline:[[NCLocationPolyline alloc] initWithPolyline:[[NCPolyline alloc] initWithPoints:@[
665 [[NCPoint alloc] initWithX:135.0 y:145.0],
666 [[NCPoint alloc] initWithX:140.0 y:150.0],
667 [[NCPoint alloc] initWithX:145.0 y:155.0],
668 [[NCPoint alloc] initWithX:150.0 y:160.0],
669 ]] locationId:1 sublocationId:0]],
670 ];
671
672 for (NCPolylineMapObject *line in polylines) {
673 [_locationWindow addPolylineMapObject:line];
674 [_mapObjects addObject:line];
675 NSLog(@"Added polyline with %lu points", (unsigned long)line.polyline.polyline.points.count);
676 }
677
678 // [objc_LocationWindow_removePolylineMapObject]
679 // Remove polyline map object
680 [_locationWindow removePolylineMapObject:polylineObject];
681 [_mapObjects removeObject:polylineObject];
682 NSLog(@"Removed polyline map object");
683 // [objc_LocationWindow_removePolylineMapObject]
684
685 if (polylineObject != nil) {
686 // [objc_PolylineMapObject_setPolyLine]
687 // Set polyline geometry
688 NSArray<NCPoint *> *polylinePoints = @[
689 [[NCPoint alloc] initWithX:100.0 y:200.0],
690 [[NCPoint alloc] initWithX:150.0 y:250.0],
691 [[NCPoint alloc] initWithX:200.0 y:300.0],
692 [[NCPoint alloc] initWithX:250.0 y:350.0],
693 ];
694 NCPolyline *metricPl = [[NCPolyline alloc] initWithPoints:polylinePoints];
695 NCLocationPolyline *polyline = [[NCLocationPolyline alloc] initWithPolyline:metricPl locationId:1 sublocationId:0];
696 BOOL polylineSuccess = [polylineObject setPolyLine:polyline];
697 NSLog(@"Set polyline with %lu points: %@", (unsigned long)polylinePoints.count, polylineSuccess ? @"YES" : @"NO");
698 // [objc_PolylineMapObject_setPolyLine]
699
700 // [objc_PolylineMapObject_setWidth]
701 // Set polyline width
702 BOOL widthSuccess = [polylineObject setWidth:3.0];
703 NSLog(@"Set polyline width to 3.0 pixels: %@", widthSuccess ? @"YES" : @"NO");
704 // [objc_PolylineMapObject_setWidth]
705
706 // [objc_PolylineMapObject_setColor]
707 // Set polyline color
708 BOOL polylineColorSuccess = [polylineObject setColorWithRed:0.0 green:1.0 blue:0.0 alpha:0.8];
709 NSLog(@"Set polyline color to green with 80%% opacity: %@", polylineColorSuccess ? @"YES" : @"NO");
710 // [objc_PolylineMapObject_setColor]
711
712 // [objc_PolylineMapObject_setOrder]
713 // Set polyline rendering order
714 BOOL polylineOrderSuccess = [polylineObject setOrder:1];
715 NSLog(@"Set polyline rendering order to 1: %@", polylineOrderSuccess ? @"YES" : @"NO");
716 // [objc_PolylineMapObject_setOrder]
717
718 // [objc_PolylineMapObject_setCapType]
719 // Set polyline cap type
720 BOOL capTypeSuccess = [polylineObject setCapType:NCCapTypeRound];
721 NSLog(@"Set polyline cap type to ROUND: %@", capTypeSuccess ? @"YES" : @"NO");
722 // [objc_PolylineMapObject_setCapType]
723
724 // [objc_PolylineMapObject_setJoinType]
725 // Set polyline join type
726 BOOL joinTypeSuccess = [polylineObject setJoinType:NCJoinTypeRound];
727 NSLog(@"Set polyline join type to ROUND: %@", joinTypeSuccess ? @"YES" : @"NO");
728 // [objc_PolylineMapObject_setJoinType]
729
730 // [objc_PolylineMapObject_setMiterLimit]
731 // Set polyline miter limit
732 BOOL miterLimitSuccess = [polylineObject setMiterLimit:2.0];
733 NSLog(@"Set polyline miter limit to 2.0: %@", miterLimitSuccess ? @"YES" : @"NO");
734 // [objc_PolylineMapObject_setMiterLimit]
735
736 // [objc_PolylineMapObject_setOutlineWidth]
737 // Set polyline outline width
738 BOOL outlineWidthSuccess = [polylineObject setOutlineWidth:1.0];
739 NSLog(@"Set polyline outline width to 1.0 pixels: %@", outlineWidthSuccess ? @"YES" : @"NO");
740 // [objc_PolylineMapObject_setOutlineWidth]
741
742 // [objc_PolylineMapObject_setOutlineColor]
743 // Set polyline outline color
744 BOOL outlineColorSuccess = [polylineObject setOutlineColorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
745 NSLog(@"Set polyline outline color to black: %@", outlineColorSuccess ? @"YES" : @"NO");
746 // [objc_PolylineMapObject_setOutlineColor]
747
748 // [objc_PolylineMapObject_setOutlineAlpha]
749 // Set polyline outline alpha
750 BOOL outlineAlphaSuccess = [polylineObject setOutlineAlpha:0.5];
751 NSLog(@"Set polyline outline alpha to 0.5: %@", outlineAlphaSuccess ? @"YES" : @"NO");
752 // [objc_PolylineMapObject_setOutlineAlpha]
753
754 // [objc_PolylineMapObject_setOutlineOrder]
755 // Set polyline outline rendering order
756 BOOL outlineOrderSuccess = [polylineObject setOutlineOrder:0];
757 NSLog(@"Set polyline outline rendering order to 0: %@", outlineOrderSuccess ? @"YES" : @"NO");
758 // [objc_PolylineMapObject_setOutlineOrder]
759
760 // [objc_PolylineMapObject_setOutlineCapType]
761 // Set polyline outline cap type
762 BOOL outlineCapTypeSuccess = [polylineObject setOutlineCapType:NCCapTypeSquare];
763 NSLog(@"Set polyline outline cap type to SQUARE: %@", outlineCapTypeSuccess ? @"YES" : @"NO");
764 // [objc_PolylineMapObject_setOutlineCapType]
765
766 // [objc_PolylineMapObject_setOutlineJoinType]
767 // Set polyline outline join type
768 BOOL outlineJoinTypeSuccess = [polylineObject setOutlineJoinType:NCJoinTypeMiter];
769 NSLog(@"Set polyline outline join type to MITER: %@", outlineJoinTypeSuccess ? @"YES" : @"NO");
770 // [objc_PolylineMapObject_setOutlineJoinType]
771
772 // [objc_PolylineMapObject_setOutlineMiterLimit]
773 // Set polyline outline miter limit
774 BOOL outlineMiterLimitSuccess = [polylineObject setOutlineMiterLimit:3.0];
775 NSLog(@"Set polyline outline miter limit to 3.0: %@", outlineMiterLimitSuccess ? @"YES" : @"NO");
776 // [objc_PolylineMapObject_setOutlineMiterLimit]
777
778 // [objc_PolylineMapObject_setVisible]
779 // Set polyline visibility
780 BOOL visibleSuccess = [polylineObject setVisible:YES];
781 NSLog(@"Set polyline visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
782 // [objc_PolylineMapObject_setVisible]
783
784 // [objc_PolylineMapObject_getMapObjectType]
785 // Get map object type
786 NCMapObjectType objectType = polylineObject.mapObjectType;
787 NSLog(@"Polyline map object type: %@", objectType);
788 // [objc_PolylineMapObject_getMapObjectType]
789
790 // [objc_MapObject_setAlpha_3]
791 // Set alpha transparency
792 BOOL alphaSuccess = [polylineObject setAlpha:0.7];
793 NSLog(@"Set polyline alpha to 0.7: %@", alphaSuccess ? @"YES" : @"NO");
794 // [objc_MapObject_setAlpha_3]
795
796 // [objc_MapObject_setInteractive_3]
797 // Set interactive mode
798 BOOL interactiveSuccess = [polylineObject setInteractive:YES];
799 NSLog(@"Set polyline interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
800 // [objc_MapObject_setInteractive_3]
801
802 // [objc_MapObject_setTitle_3]
803 // Set title
804 BOOL titleSuccess = [polylineObject setTitle:@"Polyline Object"];
805 NSLog(@"Set polyline title to 'Polyline Object': %@", titleSuccess ? @"YES" : @"NO");
806 // [objc_MapObject_setTitle_3]
807
808 // [objc_MapObject_setData_3]
809 // Set custom data
810 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
811 BOOL dataSuccess = [polylineObject setData:customData];
812 NSLog(@"Set polyline custom data: %@", dataSuccess ? @"YES" : @"NO");
813 // [objc_MapObject_setData_3]
814
815 // [objc_MapObject_getId_3]
816 // Get object ID
817 NSInteger objectId = polylineObject.id;
818 NSLog(@"Polyline object ID: %ld", (long)objectId);
819 // [objc_MapObject_getId_3]
820
821 // [objc_MapObject_getType_3]
822 // Get object type
823 NSString *objectTypeString = polylineObject.type;
824 NSLog(@"Polyline object type: %@", objectTypeString);
825 // [objc_MapObject_getType_3]
826
827 // [objc_MapObject_getData_3]
828 // Get custom data
829 NSDictionary *retrievedData = polylineObject.data;
830 NSLog(@"Polyline custom data: %@", retrievedData);
831 // [objc_MapObject_getData_3]
832 }
833}
834
839 NSLog(@"--- Dotted Polyline Map Objects ---");
840
841 if (_locationWindow == nil) {
842 NSLog(@"LocationWindow not available yet");
843 return;
844 }
845
846 // [objc_DottedPolylineMapObject_constructor]
847 // Create dotted polyline map object
848 NSArray<NCPoint *> *points = @[
849 [[NCPoint alloc] initWithX:160.0 y:170.0],
850 [[NCPoint alloc] initWithX:165.0 y:175.0],
851 [[NCPoint alloc] initWithX:170.0 y:180.0],
852 [[NCPoint alloc] initWithX:175.0 y:185.0],
853 ];
854 NCPolyline *dottedMetric = [[NCPolyline alloc] initWithPoints:points];
855 NCLocationPolyline *polyline = [[NCLocationPolyline alloc] initWithPolyline:dottedMetric locationId:1 sublocationId:0];
856 NCDottedPolylineMapObject *dottedPolylineObject = [[NCDottedPolylineMapObject alloc] initWithPolyline:polyline];
857 NSLog(@"Created dotted polyline map object with %lu points", (unsigned long)points.count);
858 // [objc_DottedPolylineMapObject_constructor]
859
860 // [objc_DottedPolylineMapObject_getPolyline]
861 // Access dotted polyline
862 NCLocationPolyline *dottedPolylineShape = dottedPolylineObject.polyline;
863 NSLog(@"Dotted polyline has %lu points", (unsigned long)dottedPolylineShape.polyline.points.count);
864 // [objc_DottedPolylineMapObject_getPolyline]
865
866 // [objc_DottedPolylineMapObject_setPolyline]
867 // Set dotted polyline geometry
868 NSArray<NCPoint *> *dottedPoints = @[
869 [[NCPoint alloc] initWithX:160.0 y:170.0],
870 [[NCPoint alloc] initWithX:165.0 y:175.0],
871 [[NCPoint alloc] initWithX:170.0 y:180.0],
872 [[NCPoint alloc] initWithX:175.0 y:185.0],
873 ];
874 NCPolyline *dottedPl = [[NCPolyline alloc] initWithPoints:dottedPoints];
875 NCLocationPolyline *dottedPolyline = [[NCLocationPolyline alloc] initWithPolyline:dottedPl locationId:1 sublocationId:0];
876 BOOL dottedSuccess = [dottedPolylineObject setPolyline:dottedPolyline];
877 NSLog(@"Set dotted polyline with %lu points: %@", (unsigned long)dottedPoints.count, dottedSuccess ? @"YES" : @"NO");
878 // [objc_DottedPolylineMapObject_setPolyline]
879
880 // [objc_DottedPolylineMapObject_setColor]
881 // Set dotted polyline color
882 BOOL colorSuccess = [dottedPolylineObject setColorWithRed:0.5 green:0.0 blue:1.0 alpha:0.8];
883 NSLog(@"Set dotted polyline color to purple with 80%% opacity: %@", colorSuccess ? @"YES" : @"NO");
884 // [objc_DottedPolylineMapObject_setColor]
885
886 // [objc_DottedPolylineMapObject_setWidth]
887 // Set dotted polyline width
888 BOOL widthSuccess = [dottedPolylineObject setWidth:3.0];
889 NSLog(@"Set dotted polyline width to 3.0 pixels: %@", widthSuccess ? @"YES" : @"NO");
890 // [objc_DottedPolylineMapObject_setWidth]
891
892 // [objc_DottedPolylineMapObject_setOrder]
893 // Set dotted polyline rendering order
894 BOOL orderSuccess = [dottedPolylineObject setOrder:2];
895 NSLog(@"Set dotted polyline rendering order to 2: %@", orderSuccess ? @"YES" : @"NO");
896 // [objc_DottedPolylineMapObject_setOrder]
897
898 // [objc_DottedPolylineMapObject_setCollisionEnabled]
899 // Enable collision detection
900 BOOL collisionSuccess = [dottedPolylineObject setCollisionEnabled:YES];
901 NSLog(@"Enabled collision detection for dotted polyline: %@", collisionSuccess ? @"YES" : @"NO");
902 // [objc_DottedPolylineMapObject_setCollisionEnabled]
903
904 // [objc_DottedPolylineMapObject_setPlacement]
905 // Set placement type
906 BOOL placementSuccess = [dottedPolylineObject setPlacement:NCCenter];
907 NSLog(@"Set dotted polyline placement to CENTER: %@", placementSuccess ? @"YES" : @"NO");
908 // [objc_DottedPolylineMapObject_setPlacement]
909
910 // [objc_DottedPolylineMapObject_setPlacementMinRatio]
911 // Set placement min ratio
912 BOOL minRatioSuccess = [dottedPolylineObject setPlacementMinRatio:0.5];
913 NSLog(@"Set dotted polyline placement min ratio to 0.5: %@", minRatioSuccess ? @"YES" : @"NO");
914 // [objc_DottedPolylineMapObject_setPlacementMinRatio]
915
916 // [objc_DottedPolylineMapObject_setPlacementSpacing]
917 // Set placement spacing
918 BOOL spacingSuccess = [dottedPolylineObject setPlacementSpacing:10.0];
919 NSLog(@"Set dotted polyline placement spacing to 10.0: %@", spacingSuccess ? @"YES" : @"NO");
920 // [objc_DottedPolylineMapObject_setPlacementSpacing]
921
922 // [objc_DottedPolylineMapObject_setPriority]
923 // Set rendering priority
924 BOOL prioritySuccess = [dottedPolylineObject setPriority:1];
925 NSLog(@"Set dotted polyline rendering priority to 1: %@", prioritySuccess ? @"YES" : @"NO");
926 // [objc_DottedPolylineMapObject_setPriority]
927
928 // [objc_DottedPolylineMapObject_setRepeatDistance]
929 // Set repeat distance
930 BOOL repeatDistanceSuccess = [dottedPolylineObject setRepeatDistance:20.0];
931 NSLog(@"Set dotted polyline repeat distance to 20.0: %@", repeatDistanceSuccess ? @"YES" : @"NO");
932 // [objc_DottedPolylineMapObject_setRepeatDistance]
933
934 // [objc_DottedPolylineMapObject_setRepeatGroup]
935 // Set repeat group
936 BOOL repeatGroupSuccess = [dottedPolylineObject setRepeatGroup:1];
937 NSLog(@"Set dotted polyline repeat group to 1: %@", repeatGroupSuccess ? @"YES" : @"NO");
938 // [objc_DottedPolylineMapObject_setRepeatGroup]
939
940 // [objc_DottedPolylineMapObject_setSize]
941 // Set size
942 NCSize *size = [[NCSize alloc] initWithWidth:16.0 height:16.0];
943 BOOL sizeSuccess = [dottedPolylineObject setSize:size];
944 NSLog(@"Set dotted polyline size to (%.1f, %.1f): %@", size.width, size.height, sizeSuccess ? @"YES" : @"NO");
945 // [objc_DottedPolylineMapObject_setSize]
946
947 // [objc_DottedPolylineMapObject_setVisible]
948 // Set visibility
949 BOOL visibleSuccess = [dottedPolylineObject setVisible:YES];
950 NSLog(@"Set dotted polyline visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
951 // [objc_DottedPolylineMapObject_setVisible]
952
953 // [objc_DottedPolylineMapObject_getMapObjectType]
954 // Get map object type
955 NCMapObjectType objectType = dottedPolylineObject.mapObjectType;
956 NSLog(@"Dotted polyline map object type: %@", objectType);
957 // [objc_DottedPolylineMapObject_getMapObjectType]
958
959 // [objc_MapObject_setAlpha_4]
960 // Set alpha transparency
961 BOOL alphaSuccess = [dottedPolylineObject setAlpha:0.8];
962 NSLog(@"Set dotted polyline alpha to 0.8: %@", alphaSuccess ? @"YES" : @"NO");
963 // [objc_MapObject_setAlpha_4]
964
965 // [objc_MapObject_setInteractive_4]
966 // Set interactive mode
967 BOOL interactiveSuccess = [dottedPolylineObject setInteractive:YES];
968 NSLog(@"Set dotted polyline interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
969 // [objc_MapObject_setInteractive_4]
970
971 // [objc_MapObject_setTitle_4]
972 // Set title
973 BOOL titleSuccess = [dottedPolylineObject setTitle:@"Dotted Polyline Object"];
974 NSLog(@"Set dotted polyline title to 'Dotted Polyline Object': %@", titleSuccess ? @"YES" : @"NO");
975 // [objc_MapObject_setTitle_4]
976
977 // [objc_MapObject_setData_4]
978 // Set custom data
979 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
980 BOOL dataSuccess = [dottedPolylineObject setData:customData];
981 NSLog(@"Set dotted polyline custom data: %@", dataSuccess ? @"YES" : @"NO");
982 // [objc_MapObject_setData_4]
983
984 // [objc_MapObject_getId_4]
985 // Get object ID
986 NSInteger objectId = dottedPolylineObject.id;
987 NSLog(@"Dotted polyline object ID: %ld", (long)objectId);
988 // [objc_MapObject_getId_4]
989
990 // [objc_MapObject_getType_4]
991 // Get object type
992 NSString *objectTypeString = dottedPolylineObject.type;
993 NSLog(@"Dotted polyline object type: %@", objectTypeString);
994 // [objc_MapObject_getType_4]
995
996 // [objc_MapObject_getData_4]
997 // Get custom data
998 NSDictionary *retrievedData = dottedPolylineObject.data;
999 NSLog(@"Dotted polyline custom data: %@", retrievedData);
1000 // [objc_MapObject_getData_4]
1001
1002 // [objc_LocationWindow_addDottedPolylineMapObject]
1003 // Add dotted polyline map object
1004 [_locationWindow addDottedPolylineMapObject:dottedPolylineObject];
1005 [_mapObjects addObject:dottedPolylineObject];
1006 NSLog(@"Added dotted polyline map object");
1007 // [objc_LocationWindow_addDottedPolylineMapObject]
1008
1009 // Test multiple dotted polyline objects
1010 NSArray *dottedPolylines = @[
1011 [[NCDottedPolylineMapObject alloc] initWithPolyline:[[NCLocationPolyline alloc] initWithPolyline:[[NCPolyline alloc] initWithPoints:@[
1012 [[NCPoint alloc] initWithX:180.0 y:190.0],
1013 [[NCPoint alloc] initWithX:185.0 y:195.0],
1014 [[NCPoint alloc] initWithX:190.0 y:200.0],
1015 ]] locationId:1 sublocationId:0]],
1016 [[NCDottedPolylineMapObject alloc] initWithPolyline:[[NCLocationPolyline alloc] initWithPolyline:[[NCPolyline alloc] initWithPoints:@[
1017 [[NCPoint alloc] initWithX:195.0 y:205.0],
1018 [[NCPoint alloc] initWithX:200.0 y:210.0],
1019 [[NCPoint alloc] initWithX:205.0 y:215.0],
1020 [[NCPoint alloc] initWithX:210.0 y:220.0],
1021 ]] locationId:1 sublocationId:0]],
1022 ];
1023
1024 for (NCDottedPolylineMapObject *dottedLine in dottedPolylines) {
1025 [_locationWindow addDottedPolylineMapObject:dottedLine];
1026 [_mapObjects addObject:dottedLine];
1027 NSLog(@"Added dotted polyline with %lu points", (unsigned long)dottedLine.polyline.polyline.points.count);
1028 }
1029
1030 // [objc_LocationWindow_removeDottedPolylineMapObject]
1031 // Remove dotted polyline map object
1032 [_locationWindow removeDottedPolylineMapObject:dottedPolylineObject];
1033 [_mapObjects removeObject:dottedPolylineObject];
1034 NSLog(@"Removed dotted polyline map object");
1035 // [objc_LocationWindow_removeDottedPolylineMapObject]
1036}
1037
1042 NSLog(@"--- Remove All Map Objects ---");
1043
1044 if (_locationWindow == nil) {
1045 NSLog(@"LocationWindow not available yet");
1046 return;
1047 }
1048
1049 NSLog(@"Current map objects count: %lu", (unsigned long)_mapObjects.count);
1050
1051 // [objc_LocationWindow_removeAllMapObjects]
1052 // Remove all map objects
1054 [_mapObjects removeAllObjects];
1055 NSLog(@"Removed all map objects");
1056 // [objc_LocationWindow_removeAllMapObjects]
1057
1058 NSLog(@"Map objects count after removal: %lu", (unsigned long)_mapObjects.count);
1059}
1060
1064- (void)cleanup {
1065 NSLog(@"--- Cleanup ---");
1066
1067 if (_locationWindow != nil) {
1069 NSLog(@"Cleaned up all map objects");
1070 }
1071
1072 [_mapObjects removeAllObjects];
1073 NSLog(@"Cleared map objects list");
1074}
1075
1076@end
1077
1078// Main function to run the example
1079int main(int argc, const char * argv[]) {
1080 @autoreleasepool {
1082 }
1083 return 0;
1084}