Loading...
Searching...
No Matches
LocationWindowMapObjectsExample.m
Go to the documentation of this file.
1#import <Foundation/Foundation.h>
2#import <UIKit/UIKit.h>
3#import <NavigineSDK/NavigineSDK.h>
4
12@interface LocationWindowMapObjectsExample : NSObject
13
14@property (nonatomic, strong) NCLocationWindow *locationWindow;
15@property (nonatomic, strong) NSMutableArray *mapObjects;
16
27- (void)cleanup;
28
29@end
30
31@implementation LocationWindowMapObjectsExample
32
33- (instancetype)init {
34 self = [super init];
35 if (self) {
36 _mapObjects = [NSMutableArray array];
38 }
39 return self;
40}
41
46 NSLog(@"=== LocationWindowMapObjects Example ===");
47
48 // Initialize LocationWindow (in real app, this would be provided by the framework)
49 // self.locationWindow = [self getLocationWindow];
50
52
61
62 [self cleanup];
63}
64
69 NSLog(@"--- LocationPolygon / LocationPolyline records ---");
70
71 // [objc_LocationPolygon_record]
72 NSArray<NCPoint *> *ring = @[
73 [[NCPoint alloc] initWithX:1.0 y:2.0],
74 [[NCPoint alloc] initWithX:3.0 y:4.0],
75 [[NCPoint alloc] initWithX:5.0 y:2.0],
76 ];
77 NCPolygon *metricPolygon = [[NCPolygon alloc] initWithPoints:ring];
78 NCLocationPolygon *locationPolygon = [[NCLocationPolygon alloc] initWithPolygon:metricPolygon locationId:42 sublocationId:7];
79 NCPolygon *polygonBack = locationPolygon.polygon;
80 NSLog(@"LocationPolygon location %d sublocation %d vertices %lu",
81 (int)locationPolygon.locationId, (int)locationPolygon.sublocationId, (unsigned long)polygonBack.points.count);
82 // [objc_LocationPolygon_record]
83
84 // [objc_LocationPolyline_record]
85 NSArray<NCPoint *> *linePts = @[
86 [[NCPoint alloc] initWithX:0.0 y:0.0],
87 [[NCPoint alloc] initWithX:10.0 y:10.0],
88 ];
89 NCPolyline *metricPolyline = [[NCPolyline alloc] initWithPoints:linePts];
90 NCLocationPolyline *locationPolyline = [[NCLocationPolyline alloc] initWithPolyline:metricPolyline locationId:42 sublocationId:7];
91 NCPolyline *polylineBack = locationPolyline.polyline;
92 NSLog(@"LocationPolyline points %lu", (unsigned long)polylineBack.points.count);
93 // [objc_LocationPolyline_record]
94}
95
100 NSLog(@"--- Circle Map Objects ---");
101
102 if (_locationWindow == nil) {
103 NSLog(@"LocationWindow not available yet");
104 return;
105 }
106
107 // [objc_CircleMapObject_constructor]
108 // Create circle map object
109 NCLocationPoint *center = [[NCLocationPoint alloc] initWithX:10.0 y:20.0];
110 NCCircleMapObject *circleObject = [[NCCircleMapObject alloc] initWithCenter:center radius:5.0];
111 NSLog(@"Created circle map object with center (%f, %f) and radius 5.0", center.x, center.y);
112 // [objc_CircleMapObject_constructor]
113
114 // [objc_CircleMapObject_getCenter]
115 // Access circle center
116 NCLocationPoint *circleCenter = circleObject.center;
117 NSLog(@"Circle center: (%f, %f)", circleCenter.x, circleCenter.y);
118 // [objc_CircleMapObject_getCenter]
119
120 // [objc_CircleMapObject_getRadius]
121 // Access circle radius
122 double radius = circleObject.radius;
123 NSLog(@"Circle radius: %f", radius);
124 // [objc_CircleMapObject_getRadius]
125
126 // [objc_LocationWindow_addCircleMapObject]
127 // Add circle map object
128 [_locationWindow addCircleMapObject:circleObject];
129 [_mapObjects addObject:circleObject];
130 NSLog(@"Added circle map object");
131 // [objc_LocationWindow_addCircleMapObject]
132
133 // Test multiple circle objects
134 NSArray *circles = @[
135 [[NCCircleMapObject alloc] initWithCenter:[[NCLocationPoint alloc] initWithX:15.0 y:25.0] radius:3.0],
136 [[NCCircleMapObject alloc] initWithCenter:[[NCLocationPoint alloc] initWithX:20.0 y:30.0] radius:7.0],
137 [[NCCircleMapObject alloc] initWithCenter:[[NCLocationPoint alloc] initWithX:25.0 y:35.0] radius:4.0]
138 ];
139
140 for (NCCircleMapObject *circle in circles) {
141 [_locationWindow addCircleMapObject:circle];
142 [_mapObjects addObject:circle];
143 NSLog(@"Added circle at (%f, %f) with radius %f", circle.center.x, circle.center.y, circle.radius);
144 }
145
146 // [objc_LocationWindow_removeCircleMapObject]
147 // Remove circle map object
148 [_locationWindow removeCircleMapObject:circleObject];
149 [_mapObjects removeObject:circleObject];
150 NSLog(@"Removed circle map object");
151 // [objc_LocationWindow_removeCircleMapObject]
152
153 if (circleObject != nil) {
154 // [objc_CircleMapObject_setPosition]
155 // Set circle position
156 NCLocationPoint *centerPoint = [[NCLocationPoint alloc] initWithX:100.0 y:200.0];
157 BOOL success = [circleObject setPosition:centerPoint];
158 NSLog(@"Set circle position to (%f, %f): %@", centerPoint.x, centerPoint.y, success ? @"YES" : @"NO");
159 // [objc_CircleMapObject_setPosition]
160
161 // [objc_CircleMapObject_setPositionAnimated]
162 // Set circle position with animation
163 NCLocationPoint *animatedPoint = [[NCLocationPoint alloc] initWithX:150.0 y:250.0];
164 BOOL animatedSuccess = [circleObject setPositionAnimated:animatedPoint duration:2.0 animationType:AnimationTypeLinear];
165 NSLog(@"Set circle position with animation to (%f, %f): %@", animatedPoint.x, animatedPoint.y, animatedSuccess ? @"YES" : @"NO");
166 // [objc_CircleMapObject_setPositionAnimated]
167
168 // [objc_CircleMapObject_setRadius]
169 // Set circle radius
170 BOOL radiusSuccess = [circleObject setRadius:10.0];
171 NSLog(@"Set circle radius to 10.0 meters: %@", radiusSuccess ? @"YES" : @"NO");
172 // [objc_CircleMapObject_setRadius]
173
174 // [objc_CircleMapObject_setCollisionEnabled]
175 // Enable collision detection
176 BOOL collisionSuccess = [circleObject setCollisionEnabled:YES];
177 NSLog(@"Enabled collision detection for circle: %@", collisionSuccess ? @"YES" : @"NO");
178 // [objc_CircleMapObject_setCollisionEnabled]
179
180 // [objc_CircleMapObject_setBuffer]
181 // Set collision buffer
182 BOOL bufferSuccess = [circleObject setBufferWithWidth:5.0 height:5.0];
183 NSLog(@"Set collision buffer to 5x5 pixels: %@", bufferSuccess ? @"YES" : @"NO");
184 // [objc_CircleMapObject_setBuffer]
185
186 // [objc_CircleMapObject_setOffset]
187 // Set position offset
188 BOOL offsetSuccess = [circleObject setOffsetWithX:2.0 y:3.0];
189 NSLog(@"Set position offset to (2.0, 3.0) pixels: %@", offsetSuccess ? @"YES" : @"NO");
190 // [objc_CircleMapObject_setOffset]
191
192 // [objc_CircleMapObject_setOutlineColor]
193 // Set outline color
194 BOOL outlineColorSuccess = [circleObject setOutlineColorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
195 NSLog(@"Set circle outline color to blue: %@", outlineColorSuccess ? @"YES" : @"NO");
196 // [objc_CircleMapObject_setOutlineColor]
197
198 // [objc_CircleMapObject_setOutlineAlpha]
199 // Set outline alpha
200 BOOL outlineAlphaSuccess = [circleObject setOutlineAlpha:0.5];
201 NSLog(@"Set circle outline alpha to 0.5: %@", outlineAlphaSuccess ? @"YES" : @"NO");
202 // [objc_CircleMapObject_setOutlineAlpha]
203
204 // [objc_CircleMapObject_setOutlineRadius]
205 // Set outline radius
206 BOOL outlineRadiusSuccess = [circleObject setOutlineRadius:2.0];
207 NSLog(@"Set circle outline radius to 2.0: %@", outlineRadiusSuccess ? @"YES" : @"NO");
208 // [objc_CircleMapObject_setOutlineRadius]
209
210 // [objc_CircleMapObject_setColor]
211 // Set circle color
212 BOOL colorSuccess = [circleObject setColorWithRed:1.0 green:0.0 blue:0.0 alpha:0.8];
213 NSLog(@"Set circle color to red with 80%% opacity: %@", colorSuccess ? @"YES" : @"NO");
214 // [objc_CircleMapObject_setColor]
215
216 // [objc_CircleMapObject_setPriority]
217 // Set rendering priority
218 BOOL prioritySuccess = [circleObject setPriority:1];
219 NSLog(@"Set rendering priority to 1: %@", prioritySuccess ? @"YES" : @"NO");
220 // [objc_CircleMapObject_setPriority]
221
222 // [objc_MapObject_setVisible]
223 // Set visibility
224 BOOL visibleSuccess = [circleObject setVisible:YES];
225 NSLog(@"Set circle visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
226 // [objc_MapObject_setVisible]
227
228 // [objc_CircleMapObject_getMapObjectType]
229 // Get map object type
230 NCMapObjectType objectType = circleObject.mapObjectType;
231 NSLog(@"Circle map object type: %@", objectType);
232 // [objc_CircleMapObject_getMapObjectType]
233
234 // [objc_MapObject_setAlpha]
235 // Set alpha transparency
236 BOOL alphaSuccess = [circleObject setAlpha:0.7];
237 NSLog(@"Set circle alpha to 0.7: %@", alphaSuccess ? @"YES" : @"NO");
238 // [objc_MapObject_setAlpha]
239
240 // [objc_MapObject_setInteractive]
241 // Set interactive mode
242 BOOL interactiveSuccess = [circleObject setInteractive:YES];
243 NSLog(@"Set circle interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
244 // [objc_MapObject_setInteractive]
245
246 // [objc_MapObject_setTitle]
247 // Set title
248 BOOL titleSuccess = [circleObject setTitle:@"Circle Object"];
249 NSLog(@"Set circle title to 'Circle Object': %@", titleSuccess ? @"YES" : @"NO");
250 // [objc_MapObject_setTitle]
251
252 // [objc_MapObject_setData]
253 // Set custom data
254 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
255 BOOL dataSuccess = [circleObject setData:customData];
256 NSLog(@"Set circle custom data: %@", dataSuccess ? @"YES" : @"NO");
257 // [objc_MapObject_setData]
258
259 // [objc_MapObject_getId]
260 // Get object ID
261 NSInteger objectId = circleObject.id;
262 NSLog(@"Circle object ID: %ld", (long)objectId);
263 // [objc_MapObject_getId]
264
265 // [objc_MapObject_getType]
266 // Get object type
267 NSString *objectTypeString = circleObject.type;
268 NSLog(@"Circle object type: %@", objectTypeString);
269 // [objc_MapObject_getType]
270
271 // [objc_MapObject_getData]
272 // Get custom data
273 NSDictionary *retrievedData = circleObject.data;
274 NSLog(@"Circle custom data: %@", retrievedData);
275 // [objc_MapObject_getData]
276 }
277}
278
283 NSLog(@"--- Icon Map Objects ---");
284
285 if (_locationWindow == nil) {
286 NSLog(@"LocationWindow not available yet");
287 return;
288 }
289
290 // [objc_IconMapObject_constructor]
291 // Create icon map object
292 NCLocationPoint *position = [[NCLocationPoint alloc] initWithX:30.0 y:40.0];
293 NCIconMapObject *iconObject = [[NCIconMapObject alloc] initWithPosition:position];
294 NSLog(@"Created icon map object at (%f, %f)", position.x, position.y);
295 // [objc_IconMapObject_constructor]
296
297 // [objc_IconMapObject_getPosition]
298 // Access icon position
299 NCLocationPoint *iconPosition = iconObject.position;
300 NSLog(@"Icon position: (%f, %f)", iconPosition.x, iconPosition.y);
301 // [objc_IconMapObject_getPosition]
302
303 // [objc_IconMapObject_setBitmap]
304 UIImage *iconImage = [UIImage imageWithContentsOfFile:@"/path/to/icon.png"];
305 BOOL bitmapSuccess = (iconImage != nil) && [iconObject setBitmap:iconImage];
306 NSLog(@"Set icon bitmap (UIImage): %@", 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_setPosition]
347 // Set icon position
348 NCLocationPoint *newPosition = [[NCLocationPoint alloc] initWithX:35.0 y:45.0];
349 BOOL positionSuccess = [iconObject setPosition:newPosition];
350 NSLog(@"Set icon position to (%.1f, %.1f): %@", newPosition.x, newPosition.y, positionSuccess ? @"YES" : @"NO");
351 // [objc_IconMapObject_setPosition]
352
353 // [objc_IconMapObject_setPositionAnimated]
354 // Set icon position with animation
355 NCLocationPoint *animatedPosition = [[NCLocationPoint alloc] initWithX:40.0 y:50.0];
356 BOOL animatedSuccess = [iconObject setPositionAnimated:animatedPosition duration:2.0 animationType:NCLinear];
357 NSLog(@"Set icon position with animation to (%.1f, %.1f): %@", animatedPosition.x, animatedPosition.y, animatedSuccess ? @"YES" : @"NO");
358 // [objc_IconMapObject_setPositionAnimated]
359
360 // [objc_IconMapObject_setOffset]
361 // Set icon offset
362 BOOL offsetSuccess = [iconObject setOffsetWithWidth:5.0 height:5.0];
363 NSLog(@"Set icon offset to 5x5 pixels: %@", offsetSuccess ? @"YES" : @"NO");
364 // [objc_IconMapObject_setOffset]
365
366 // [objc_IconMapObject_setPriority]
367 // Set icon priority
368 BOOL prioritySuccess = [iconObject setPriority:1];
369 NSLog(@"Set icon priority to 1: %@", prioritySuccess ? @"YES" : @"NO");
370 // [objc_IconMapObject_setPriority]
371
372 // [objc_IconMapObject_setVisible]
373 // Set visibility
374 BOOL visibleSuccess = [iconObject setVisible:YES];
375 NSLog(@"Set icon visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
376 // [objc_IconMapObject_setVisible]
377
378 // [objc_IconMapObject_getMapObjectType]
379 // Get map object type
380 NCMapObjectType objectType = iconObject.mapObjectType;
381 NSLog(@"Icon map object type: %@", objectType);
382 // [objc_IconMapObject_getMapObjectType]
383
384 // [objc_MapObject_setAlpha_1]
385 // Set alpha transparency
386 BOOL alphaSuccess = [iconObject setAlpha:0.8];
387 NSLog(@"Set icon alpha to 0.8: %@", alphaSuccess ? @"YES" : @"NO");
388 // [objc_MapObject_setAlpha_1]
389
390 // [objc_MapObject_setInteractive_1]
391 // Set interactive mode
392 BOOL interactiveSuccess = [iconObject setInteractive:YES];
393 NSLog(@"Set icon interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
394 // [objc_MapObject_setInteractive_1]
395
396 // [objc_MapObject_setTitle_1]
397 // Set title
398 BOOL titleSuccess = [iconObject setTitle:@"Icon Object"];
399 NSLog(@"Set icon title to 'Icon Object': %@", titleSuccess ? @"YES" : @"NO");
400 // [objc_MapObject_setTitle_1]
401
402 // [objc_MapObject_setData_1]
403 // Set custom data
404 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
405 BOOL dataSuccess = [iconObject setData:customData];
406 NSLog(@"Set icon custom data: %@", dataSuccess ? @"YES" : @"NO");
407 // [objc_MapObject_setData_1]
408
409 // [objc_MapObject_getId_1]
410 // Get object ID
411 NSInteger objectId = iconObject.id;
412 NSLog(@"Icon object ID: %ld", (long)objectId);
413 // [objc_MapObject_getId_1]
414
415 // [objc_MapObject_getType_1]
416 // Get object type
417 NSString *objectTypeString = iconObject.type;
418 NSLog(@"Icon object type: %@", objectTypeString);
419 // [objc_MapObject_getType_1]
420
421 // [objc_MapObject_getData_1]
422 // Get custom data
423 NSDictionary *retrievedData = iconObject.data;
424 NSLog(@"Icon custom data: %@", retrievedData);
425 // [objc_MapObject_getData_1]
426
427 // [objc_LocationWindow_addIconMapObject]
428 // Add icon map object
429 [_locationWindow addIconMapObject:iconObject];
430 [_mapObjects addObject:iconObject];
431 NSLog(@"Added icon map object");
432 // [objc_LocationWindow_addIconMapObject]
433
434 // Test multiple icon objects
435 NSArray *icons = @[
436 [[NCIconMapObject alloc] initWithPosition:[[NCLocationPoint alloc] initWithX:35.0 y:45.0]],
437 [[NCIconMapObject alloc] initWithPosition:[[NCLocationPoint alloc] initWithX:40.0 y:50.0]],
438 [[NCIconMapObject alloc] initWithPosition:[[NCLocationPoint alloc] initWithX:45.0 y:55.0]]
439 ];
440
441 UIImage *loopIcon = [UIImage imageWithContentsOfFile:@"/path/to/icon.png"];
442 for (NCIconMapObject *icon in icons) {
443 if (loopIcon != nil) {
444 [icon setBitmap:loopIcon];
445 }
446 [_locationWindow addIconMapObject:icon];
447 [_mapObjects addObject:icon];
448 NSLog(@"Added icon at (%f, %f)", icon.position.x, icon.position.y);
449 }
450
451 // [objc_LocationWindow_removeIconMapObject]
452 // Remove icon map object
453 [_locationWindow removeIconMapObject:iconObject];
454 [_mapObjects removeObject:iconObject];
455 NSLog(@"Removed icon map object");
456 // [objc_LocationWindow_removeIconMapObject]
457}
458
463 NSLog(@"--- Model Map Objects ---");
464
465 if (_locationWindow == nil) {
466 NSLog(@"LocationWindow not available yet");
467 return;
468 }
469
470 // [objc_LocationWindow_addModelMapObject]
472 NSLog(@"Added model map object: %@", modelObject != nil ? @"YES" : @"NO");
473 // [objc_LocationWindow_addModelMapObject]
474
475 if (modelObject == nil) {
476 return;
477 }
478
479 // [objc_ModelMapObject_setPosition]
480 NCLocationPoint *modelPoint = [[NCLocationPoint alloc] initWithX:12.0 y:34.0];
481 BOOL posOk = [modelObject setPosition:modelPoint];
482 NSLog(@"Model setPosition: %@", posOk ? @"YES" : @"NO");
483 // [objc_ModelMapObject_setPosition]
484
485 // [objc_ModelMapObject_setPositionAnimated]
486 NCLocationPoint *animatedModelPoint = [[NCLocationPoint alloc] initWithX:15.0 y:40.0];
487 BOOL posAnimOk = [modelObject setPositionAnimated:animatedModelPoint duration:0.5 animationType:AnimationTypeSine];
488 NSLog(@"Model setPositionAnimated: %@", posAnimOk ? @"YES" : @"NO");
489 // [objc_ModelMapObject_setPositionAnimated]
490
491 // [objc_ModelMapObject_setModel]
492 UIImage *texture = [UIImage imageWithContentsOfFile:@"/path/to/model_texture.png"];
493 if (texture != nil) {
494 id<NCModelProvider> provider = [NCModelProviderFactory fromFile:@"/path/to/model.obj" texture:texture];
495 BOOL modelOk = [modelObject setModel:provider];
496 NSLog(@"Model setModel: %@", modelOk ? @"YES" : @"NO");
497 }
498 // [objc_ModelMapObject_setModel]
499
500 // [objc_ModelMapObject_setSize]
501 BOOL sizeOk = [modelObject setSizeWithWidth:64.0 height:64.0];
502 NSLog(@"Model setSize: %@", sizeOk ? @"YES" : @"NO");
503 // [objc_ModelMapObject_setSize]
504
505 // [objc_ModelMapObject_setCollisionEnabled]
506 BOOL collOk = [modelObject setCollisionEnabled:YES];
507 NSLog(@"Model setCollisionEnabled: %@", collOk ? @"YES" : @"NO");
508 // [objc_ModelMapObject_setCollisionEnabled]
509
510 // [objc_ModelMapObject_setAngle]
511 BOOL angleOk = [modelObject setAngle:45.0];
512 NSLog(@"Model setAngle: %@", angleOk ? @"YES" : @"NO");
513 // [objc_ModelMapObject_setAngle]
514
515 // [objc_ModelMapObject_setAngleAnimated]
516 BOOL angleAnimOk = [modelObject setAngleAnimated:90.0 duration:0.5 animationType:AnimationTypeQuint];
517 NSLog(@"Model setAngleAnimated: %@", angleAnimOk ? @"YES" : @"NO");
518 // [objc_ModelMapObject_setAngleAnimated]
519
520 // [objc_ModelMapObject_setBuffer]
521 BOOL bufOk = [modelObject setBufferWithWidth:4.0 height:4.0];
522 NSLog(@"Model setBuffer: %@", bufOk ? @"YES" : @"NO");
523 // [objc_ModelMapObject_setBuffer]
524
525 // [objc_ModelMapObject_setPriority]
526 BOOL priOk = [modelObject setPriority:10.0];
527 NSLog(@"Model setPriority: %@", priOk ? @"YES" : @"NO");
528 // [objc_ModelMapObject_setPriority]
529
530 // [objc_LocationWindow_removeModelMapObject]
531 BOOL removed = [_locationWindow removeModelMapObject:modelObject];
532 NSLog(@"Removed model map object: %@", removed ? @"YES" : @"NO");
533 // [objc_LocationWindow_removeModelMapObject]
534}
535
540 NSLog(@"--- Polygon Map Objects ---");
541
542 if (_locationWindow == nil) {
543 NSLog(@"LocationWindow not available yet");
544 return;
545 }
546
547 // [objc_LocationWindow_addPolygonMapObject]
548 // Add polygon map object
550 NSLog(@"Added polygon map object");
551 // [objc_LocationWindow_addPolygonMapObject]
552
553 if (polygonObject != nil) {
554 // [objc_PolygonMapObject_setPolygon]
555 // Set polygon geometry
556 NSArray<NCPoint *> *points = @[
557 [[NCPoint alloc] initWithX:100.0 y:200.0],
558 [[NCPoint alloc] initWithX:150.0 y:250.0],
559 [[NCPoint alloc] initWithX:200.0 y:200.0],
560 [[NCPoint alloc] initWithX:150.0 y:150.0],
561 ];
562 NCPolygon *metricPolygon = [[NCPolygon alloc] initWithPoints:points];
563 NCLocationPolygon *polygon = [[NCLocationPolygon alloc] initWithPolygon:metricPolygon locationId:1 sublocationId:0];
564 BOOL success = [polygonObject setPolygon:polygon];
565 NSLog(@"Set polygon with %lu points: %@", (unsigned long)points.count, success ? @"YES" : @"NO");
566 // [objc_PolygonMapObject_setPolygon]
567
568 // [objc_PolygonMapObject_setColor]
569 // Set polygon color
570 BOOL colorSuccess = [polygonObject setColorWithRed:0.0 green:1.0 blue:0.0 alpha:0.7];
571 NSLog(@"Set polygon color to green with 70%% opacity: %@", colorSuccess ? @"YES" : @"NO");
572 // [objc_PolygonMapObject_setColor]
573
574 // [objc_PolygonMapObject_setVisible]
575 // Set visibility
576 BOOL visibleSuccess = [polygonObject setVisible:YES];
577 NSLog(@"Set polygon visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
578 // [objc_PolygonMapObject_setVisible]
579
580 // [objc_PolygonMapObject_getMapObjectType]
581 // Get map object type
582 NCMapObjectType objectType = polygonObject.mapObjectType;
583 NSLog(@"Polygon map object type: %@", objectType);
584 // [objc_PolygonMapObject_getMapObjectType]
585
586 // [objc_PolygonMapObject_setOrder]
587 // Set polygon rendering order
588 BOOL orderSuccess = [polygonObject setOrder:2];
589 NSLog(@"Set polygon rendering order to 2: %@", orderSuccess ? @"YES" : @"NO");
590 // [objc_PolygonMapObject_setOrder]
591
592 // [objc_PolygonMapObject_setOutlineColor]
593 // Set polygon outline color
594 BOOL outlineColorSuccess = [polygonObject setOutlineColorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0];
595 NSLog(@"Set polygon outline color to blue: %@", outlineColorSuccess ? @"YES" : @"NO");
596 // [objc_PolygonMapObject_setOutlineColor]
597
598 // [objc_PolygonMapObject_setOutlineWidth]
599 // Set polygon outline width
600 BOOL outlineWidthSuccess = [polygonObject setOutlineWidth:2.0];
601 NSLog(@"Set polygon outline width to 2.0 pixels: %@", outlineWidthSuccess ? @"YES" : @"NO");
602 // [objc_PolygonMapObject_setOutlineWidth]
603
604 // [objc_PolygonMapObject_setOutlineAlpha]
605 // Set polygon outline alpha
606 BOOL outlineAlphaSuccess = [polygonObject setOutlineAlpha:0.8];
607 NSLog(@"Set polygon outline alpha to 0.8: %@", outlineAlphaSuccess ? @"YES" : @"NO");
608 // [objc_PolygonMapObject_setOutlineAlpha]
609
610 // [objc_PolygonMapObject_setOutlineOrder]
611 // Set polygon outline order
612 BOOL outlineOrderSuccess = [polygonObject setOutlineOrder:1];
613 NSLog(@"Set polygon outline order to 1: %@", outlineOrderSuccess ? @"YES" : @"NO");
614 // [objc_PolygonMapObject_setOutlineOrder]
615
616 // [objc_MapObject_setAlpha_2]
617 // Set alpha transparency
618 BOOL alphaSuccess = [polygonObject setAlpha:0.6];
619 NSLog(@"Set polygon alpha to 0.6: %@", alphaSuccess ? @"YES" : @"NO");
620 // [objc_MapObject_setAlpha_2]
621
622 // [objc_MapObject_setInteractive_2]
623 // Set interactive mode
624 BOOL interactiveSuccess = [polygonObject setInteractive:YES];
625 NSLog(@"Set polygon interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
626 // [objc_MapObject_setInteractive_2]
627
628 // [objc_MapObject_setTitle_2]
629 // Set title
630 BOOL titleSuccess = [polygonObject setTitle:@"Polygon Object"];
631 NSLog(@"Set polygon title to 'Polygon Object': %@", titleSuccess ? @"YES" : @"NO");
632 // [objc_MapObject_setTitle_2]
633
634 // [objc_MapObject_setData_2]
635 // Set custom data
636 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
637 BOOL dataSuccess = [polygonObject setData:customData];
638 NSLog(@"Set polygon custom data: %@", dataSuccess ? @"YES" : @"NO");
639 // [objc_MapObject_setData_2]
640
641 // [objc_MapObject_getId_2]
642 // Get object ID
643 NSInteger objectId = polygonObject.id;
644 NSLog(@"Polygon object ID: %ld", (long)objectId);
645 // [objc_MapObject_getId_2]
646
647 // [objc_MapObject_getType_2]
648 // Get object type
649 NSString *objectTypeString = polygonObject.type;
650 NSLog(@"Polygon object type: %@", objectTypeString);
651 // [objc_MapObject_getType_2]
652
653 // [objc_MapObject_getData_2]
654 // Get custom data
655 NSDictionary *retrievedData = polygonObject.data;
656 NSLog(@"Polygon custom data: %@", retrievedData);
657 // [objc_MapObject_getData_2]
658 }
659
660 // [objc_LocationWindow_removePolygonMapObject]
661 // Remove polygon map object
662 if (polygonObject != nil) {
663 BOOL removed = [_locationWindow removePolygonMapObject:polygonObject];
664 NSLog(@"Removed polygon map object: %@", removed ? @"YES" : @"NO");
665 }
666 // [objc_LocationWindow_removePolygonMapObject]
667
668 // Test multiple polygon objects
669 NSMutableArray *polygons = [NSMutableArray array];
670 for (int i = 0; i < 3; i++) {
672 if (polygon != nil) {
673 NSArray<NCPoint *> *points = @[
674 [[NCPoint alloc] initWithX:300.0 + i * 50 y:400.0 + i * 50],
675 [[NCPoint alloc] initWithX:350.0 + i * 50 y:450.0 + i * 50],
676 [[NCPoint alloc] initWithX:400.0 + i * 50 y:400.0 + i * 50],
677 [[NCPoint alloc] initWithX:350.0 + i * 50 y:350.0 + i * 50],
678 ];
679 NCPolygon *metricPoly = [[NCPolygon alloc] initWithPoints:points];
680 NCLocationPolygon *polygonGeometry = [[NCLocationPolygon alloc] initWithPolygon:metricPoly locationId:1 sublocationId:0];
681 [polygon setPolygon:polygonGeometry];
682 [polygon setColorWithRed:0.0 green:0.0 blue:1.0 alpha:0.5];
683 [polygons addObject:polygon];
684 NSLog(@"Created polygon %d with %lu points", i, (unsigned long)points.count);
685 }
686 }
687
688 for (int i = 0; i < polygons.count; i++) {
689 [_locationWindow removePolygonMapObject:polygons[i]];
690 NSLog(@"Removed polygon %d", i);
691 }
692}
693
698 NSLog(@"--- Polyline Map Objects ---");
699
700 if (_locationWindow == nil) {
701 NSLog(@"LocationWindow not available yet");
702 return;
703 }
704
705 // [objc_PolylineMapObject_constructor]
706 // Create polyline map object
707 NSArray<NCPoint *> *points = @[
708 [[NCPoint alloc] initWithX:100.0 y:110.0],
709 [[NCPoint alloc] initWithX:105.0 y:115.0],
710 [[NCPoint alloc] initWithX:110.0 y:120.0],
711 [[NCPoint alloc] initWithX:115.0 y:125.0],
712 ];
713 NCPolyline *metricPolyline = [[NCPolyline alloc] initWithPoints:points];
714 NCLocationPolyline *polyline = [[NCLocationPolyline alloc] initWithPolyline:metricPolyline locationId:1 sublocationId:0];
715 NCPolylineMapObject *polylineObject = [[NCPolylineMapObject alloc] initWithPolyline:polyline];
716 NSLog(@"Created polyline map object with %lu points", (unsigned long)points.count);
717 // [objc_PolylineMapObject_constructor]
718
719 // [objc_PolylineMapObject_getPolyline]
720 // Access polyline
721 NCLocationPolyline *polylineShape = polylineObject.polyline;
722 NSLog(@"Polyline has %lu points", (unsigned long)polylineShape.polyline.points.count);
723 // [objc_PolylineMapObject_getPolyline]
724
725 // [objc_LocationWindow_addPolylineMapObject]
726 // Add polyline map object
727 [_locationWindow addPolylineMapObject:polylineObject];
728 [_mapObjects addObject:polylineObject];
729 NSLog(@"Added polyline map object");
730 // [objc_LocationWindow_addPolylineMapObject]
731
732 // Test multiple polyline objects
733 NSArray *polylines = @[
734 [[NCPolylineMapObject alloc] initWithPolyline:[[NCLocationPolyline alloc] initWithPolyline:[[NCPolyline alloc] initWithPoints:@[
735 [[NCPoint alloc] initWithX:120.0 y:130.0],
736 [[NCPoint alloc] initWithX:125.0 y:135.0],
737 [[NCPoint alloc] initWithX:130.0 y:140.0],
738 ]] locationId:1 sublocationId:0]],
739 [[NCPolylineMapObject alloc] initWithPolyline:[[NCLocationPolyline alloc] initWithPolyline:[[NCPolyline alloc] initWithPoints:@[
740 [[NCPoint alloc] initWithX:135.0 y:145.0],
741 [[NCPoint alloc] initWithX:140.0 y:150.0],
742 [[NCPoint alloc] initWithX:145.0 y:155.0],
743 [[NCPoint alloc] initWithX:150.0 y:160.0],
744 ]] locationId:1 sublocationId:0]],
745 ];
746
747 for (NCPolylineMapObject *line in polylines) {
748 [_locationWindow addPolylineMapObject:line];
749 [_mapObjects addObject:line];
750 NSLog(@"Added polyline with %lu points", (unsigned long)line.polyline.polyline.points.count);
751 }
752
753 // [objc_LocationWindow_removePolylineMapObject]
754 // Remove polyline map object
755 [_locationWindow removePolylineMapObject:polylineObject];
756 [_mapObjects removeObject:polylineObject];
757 NSLog(@"Removed polyline map object");
758 // [objc_LocationWindow_removePolylineMapObject]
759
760 if (polylineObject != nil) {
761 // [objc_PolylineMapObject_setPolyLine]
762 // Set polyline geometry
763 NSArray<NCPoint *> *polylinePoints = @[
764 [[NCPoint alloc] initWithX:100.0 y:200.0],
765 [[NCPoint alloc] initWithX:150.0 y:250.0],
766 [[NCPoint alloc] initWithX:200.0 y:300.0],
767 [[NCPoint alloc] initWithX:250.0 y:350.0],
768 ];
769 NCPolyline *metricPl = [[NCPolyline alloc] initWithPoints:polylinePoints];
770 NCLocationPolyline *polyline = [[NCLocationPolyline alloc] initWithPolyline:metricPl locationId:1 sublocationId:0];
771 BOOL polylineSuccess = [polylineObject setPolyLine:polyline];
772 NSLog(@"Set polyline with %lu points: %@", (unsigned long)polylinePoints.count, polylineSuccess ? @"YES" : @"NO");
773 // [objc_PolylineMapObject_setPolyLine]
774
775 // [objc_PolylineMapObject_setWidth]
776 // Set polyline width
777 BOOL widthSuccess = [polylineObject setWidth:3.0];
778 NSLog(@"Set polyline width to 3.0 pixels: %@", widthSuccess ? @"YES" : @"NO");
779 // [objc_PolylineMapObject_setWidth]
780
781 // [objc_PolylineMapObject_setColor]
782 // Set polyline color
783 BOOL polylineColorSuccess = [polylineObject setColorWithRed:0.0 green:1.0 blue:0.0 alpha:0.8];
784 NSLog(@"Set polyline color to green with 80%% opacity: %@", polylineColorSuccess ? @"YES" : @"NO");
785 // [objc_PolylineMapObject_setColor]
786
787 // [objc_PolylineMapObject_setOrder]
788 // Set polyline rendering order
789 BOOL polylineOrderSuccess = [polylineObject setOrder:1];
790 NSLog(@"Set polyline rendering order to 1: %@", polylineOrderSuccess ? @"YES" : @"NO");
791 // [objc_PolylineMapObject_setOrder]
792
793 // [objc_PolylineMapObject_setCapType]
794 // Set polyline cap type
795 BOOL capTypeSuccess = [polylineObject setCapType:NCCapTypeRound];
796 NSLog(@"Set polyline cap type to ROUND: %@", capTypeSuccess ? @"YES" : @"NO");
797 // [objc_PolylineMapObject_setCapType]
798
799 // [objc_PolylineMapObject_setJoinType]
800 // Set polyline join type
801 BOOL joinTypeSuccess = [polylineObject setJoinType:NCJoinTypeRound];
802 NSLog(@"Set polyline join type to ROUND: %@", joinTypeSuccess ? @"YES" : @"NO");
803 // [objc_PolylineMapObject_setJoinType]
804
805 // [objc_PolylineMapObject_setMiterLimit]
806 // Set polyline miter limit
807 BOOL miterLimitSuccess = [polylineObject setMiterLimit:2.0];
808 NSLog(@"Set polyline miter limit to 2.0: %@", miterLimitSuccess ? @"YES" : @"NO");
809 // [objc_PolylineMapObject_setMiterLimit]
810
811 // [objc_PolylineMapObject_setOutlineWidth]
812 // Set polyline outline width
813 BOOL outlineWidthSuccess = [polylineObject setOutlineWidth:1.0];
814 NSLog(@"Set polyline outline width to 1.0 pixels: %@", outlineWidthSuccess ? @"YES" : @"NO");
815 // [objc_PolylineMapObject_setOutlineWidth]
816
817 // [objc_PolylineMapObject_setOutlineColor]
818 // Set polyline outline color
819 BOOL outlineColorSuccess = [polylineObject setOutlineColorWithRed:0.0 green:0.0 blue:0.0 alpha:1.0];
820 NSLog(@"Set polyline outline color to black: %@", outlineColorSuccess ? @"YES" : @"NO");
821 // [objc_PolylineMapObject_setOutlineColor]
822
823 // [objc_PolylineMapObject_setOutlineAlpha]
824 // Set polyline outline alpha
825 BOOL outlineAlphaSuccess = [polylineObject setOutlineAlpha:0.5];
826 NSLog(@"Set polyline outline alpha to 0.5: %@", outlineAlphaSuccess ? @"YES" : @"NO");
827 // [objc_PolylineMapObject_setOutlineAlpha]
828
829 // [objc_PolylineMapObject_setOutlineOrder]
830 // Set polyline outline rendering order
831 BOOL outlineOrderSuccess = [polylineObject setOutlineOrder:0];
832 NSLog(@"Set polyline outline rendering order to 0: %@", outlineOrderSuccess ? @"YES" : @"NO");
833 // [objc_PolylineMapObject_setOutlineOrder]
834
835 // [objc_PolylineMapObject_setOutlineCapType]
836 // Set polyline outline cap type
837 BOOL outlineCapTypeSuccess = [polylineObject setOutlineCapType:NCCapTypeSquare];
838 NSLog(@"Set polyline outline cap type to SQUARE: %@", outlineCapTypeSuccess ? @"YES" : @"NO");
839 // [objc_PolylineMapObject_setOutlineCapType]
840
841 // [objc_PolylineMapObject_setOutlineJoinType]
842 // Set polyline outline join type
843 BOOL outlineJoinTypeSuccess = [polylineObject setOutlineJoinType:NCJoinTypeMiter];
844 NSLog(@"Set polyline outline join type to MITER: %@", outlineJoinTypeSuccess ? @"YES" : @"NO");
845 // [objc_PolylineMapObject_setOutlineJoinType]
846
847 // [objc_PolylineMapObject_setOutlineMiterLimit]
848 // Set polyline outline miter limit
849 BOOL outlineMiterLimitSuccess = [polylineObject setOutlineMiterLimit:3.0];
850 NSLog(@"Set polyline outline miter limit to 3.0: %@", outlineMiterLimitSuccess ? @"YES" : @"NO");
851 // [objc_PolylineMapObject_setOutlineMiterLimit]
852
853 // [objc_PolylineMapObject_setVisible]
854 // Set polyline visibility
855 BOOL visibleSuccess = [polylineObject setVisible:YES];
856 NSLog(@"Set polyline visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
857 // [objc_PolylineMapObject_setVisible]
858
859 // [objc_PolylineMapObject_getMapObjectType]
860 // Get map object type
861 NCMapObjectType objectType = polylineObject.mapObjectType;
862 NSLog(@"Polyline map object type: %@", objectType);
863 // [objc_PolylineMapObject_getMapObjectType]
864
865 // [objc_MapObject_setAlpha_3]
866 // Set alpha transparency
867 BOOL alphaSuccess = [polylineObject setAlpha:0.7];
868 NSLog(@"Set polyline alpha to 0.7: %@", alphaSuccess ? @"YES" : @"NO");
869 // [objc_MapObject_setAlpha_3]
870
871 // [objc_MapObject_setInteractive_3]
872 // Set interactive mode
873 BOOL interactiveSuccess = [polylineObject setInteractive:YES];
874 NSLog(@"Set polyline interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
875 // [objc_MapObject_setInteractive_3]
876
877 // [objc_MapObject_setTitle_3]
878 // Set title
879 BOOL titleSuccess = [polylineObject setTitle:@"Polyline Object"];
880 NSLog(@"Set polyline title to 'Polyline Object': %@", titleSuccess ? @"YES" : @"NO");
881 // [objc_MapObject_setTitle_3]
882
883 // [objc_MapObject_setData_3]
884 // Set custom data
885 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
886 BOOL dataSuccess = [polylineObject setData:customData];
887 NSLog(@"Set polyline custom data: %@", dataSuccess ? @"YES" : @"NO");
888 // [objc_MapObject_setData_3]
889
890 // [objc_MapObject_getId_3]
891 // Get object ID
892 NSInteger objectId = polylineObject.id;
893 NSLog(@"Polyline object ID: %ld", (long)objectId);
894 // [objc_MapObject_getId_3]
895
896 // [objc_MapObject_getType_3]
897 // Get object type
898 NSString *objectTypeString = polylineObject.type;
899 NSLog(@"Polyline object type: %@", objectTypeString);
900 // [objc_MapObject_getType_3]
901
902 // [objc_MapObject_getData_3]
903 // Get custom data
904 NSDictionary *retrievedData = polylineObject.data;
905 NSLog(@"Polyline custom data: %@", retrievedData);
906 // [objc_MapObject_getData_3]
907 }
908}
909
914 NSLog(@"--- Dotted Polyline Map Objects ---");
915
916 if (_locationWindow == nil) {
917 NSLog(@"LocationWindow not available yet");
918 return;
919 }
920
921 // [objc_DottedPolylineMapObject_constructor]
922 // Create dotted polyline map object
923 NSArray<NCPoint *> *points = @[
924 [[NCPoint alloc] initWithX:160.0 y:170.0],
925 [[NCPoint alloc] initWithX:165.0 y:175.0],
926 [[NCPoint alloc] initWithX:170.0 y:180.0],
927 [[NCPoint alloc] initWithX:175.0 y:185.0],
928 ];
929 NCPolyline *dottedMetric = [[NCPolyline alloc] initWithPoints:points];
930 NCLocationPolyline *polyline = [[NCLocationPolyline alloc] initWithPolyline:dottedMetric locationId:1 sublocationId:0];
931 NCDottedPolylineMapObject *dottedPolylineObject = [[NCDottedPolylineMapObject alloc] initWithPolyline:polyline];
932 NSLog(@"Created dotted polyline map object with %lu points", (unsigned long)points.count);
933 // [objc_DottedPolylineMapObject_constructor]
934
935 // [objc_DottedPolylineMapObject_getPolyline]
936 // Access dotted polyline
937 NCLocationPolyline *dottedPolylineShape = dottedPolylineObject.polyline;
938 NSLog(@"Dotted polyline has %lu points", (unsigned long)dottedPolylineShape.polyline.points.count);
939 // [objc_DottedPolylineMapObject_getPolyline]
940
941 // [objc_DottedPolylineMapObject_setPolyline]
942 // Set dotted polyline geometry
943 NSArray<NCPoint *> *dottedPoints = @[
944 [[NCPoint alloc] initWithX:160.0 y:170.0],
945 [[NCPoint alloc] initWithX:165.0 y:175.0],
946 [[NCPoint alloc] initWithX:170.0 y:180.0],
947 [[NCPoint alloc] initWithX:175.0 y:185.0],
948 ];
949 NCPolyline *dottedPl = [[NCPolyline alloc] initWithPoints:dottedPoints];
950 NCLocationPolyline *dottedPolyline = [[NCLocationPolyline alloc] initWithPolyline:dottedPl locationId:1 sublocationId:0];
951 BOOL dottedSuccess = [dottedPolylineObject setPolyline:dottedPolyline];
952 NSLog(@"Set dotted polyline with %lu points: %@", (unsigned long)dottedPoints.count, dottedSuccess ? @"YES" : @"NO");
953 // [objc_DottedPolylineMapObject_setPolyline]
954
955 // [objc_DottedPolylineMapObject_setColor]
956 // Set dotted polyline color
957 BOOL colorSuccess = [dottedPolylineObject setColorWithRed:0.5 green:0.0 blue:1.0 alpha:0.8];
958 NSLog(@"Set dotted polyline color to purple with 80%% opacity: %@", colorSuccess ? @"YES" : @"NO");
959 // [objc_DottedPolylineMapObject_setColor]
960
961 // [objc_DottedPolylineMapObject_setWidth]
962 // Set dotted polyline width
963 BOOL widthSuccess = [dottedPolylineObject setWidth:3.0];
964 NSLog(@"Set dotted polyline width to 3.0 pixels: %@", widthSuccess ? @"YES" : @"NO");
965 // [objc_DottedPolylineMapObject_setWidth]
966
967 // [objc_DottedPolylineMapObject_setOrder]
968 // Set dotted polyline rendering order
969 BOOL orderSuccess = [dottedPolylineObject setOrder:2];
970 NSLog(@"Set dotted polyline rendering order to 2: %@", orderSuccess ? @"YES" : @"NO");
971 // [objc_DottedPolylineMapObject_setOrder]
972
973 // [objc_DottedPolylineMapObject_setCollisionEnabled]
974 // Enable collision detection
975 BOOL collisionSuccess = [dottedPolylineObject setCollisionEnabled:YES];
976 NSLog(@"Enabled collision detection for dotted polyline: %@", collisionSuccess ? @"YES" : @"NO");
977 // [objc_DottedPolylineMapObject_setCollisionEnabled]
978
979 // [objc_DottedPolylineMapObject_setPlacement]
980 // Set placement type
981 BOOL placementSuccess = [dottedPolylineObject setPlacement:NCCenter];
982 NSLog(@"Set dotted polyline placement to CENTER: %@", placementSuccess ? @"YES" : @"NO");
983 // [objc_DottedPolylineMapObject_setPlacement]
984
985 // [objc_DottedPolylineMapObject_setPlacementMinRatio]
986 // Set placement min ratio
987 BOOL minRatioSuccess = [dottedPolylineObject setPlacementMinRatio:0.5];
988 NSLog(@"Set dotted polyline placement min ratio to 0.5: %@", minRatioSuccess ? @"YES" : @"NO");
989 // [objc_DottedPolylineMapObject_setPlacementMinRatio]
990
991 // [objc_DottedPolylineMapObject_setPlacementSpacing]
992 // Set placement spacing
993 BOOL spacingSuccess = [dottedPolylineObject setPlacementSpacing:10.0];
994 NSLog(@"Set dotted polyline placement spacing to 10.0: %@", spacingSuccess ? @"YES" : @"NO");
995 // [objc_DottedPolylineMapObject_setPlacementSpacing]
996
997 // [objc_DottedPolylineMapObject_setPriority]
998 // Set rendering priority
999 BOOL prioritySuccess = [dottedPolylineObject setPriority:1];
1000 NSLog(@"Set dotted polyline rendering priority to 1: %@", prioritySuccess ? @"YES" : @"NO");
1001 // [objc_DottedPolylineMapObject_setPriority]
1002
1003 // [objc_DottedPolylineMapObject_setRepeatDistance]
1004 // Set repeat distance
1005 BOOL repeatDistanceSuccess = [dottedPolylineObject setRepeatDistance:20.0];
1006 NSLog(@"Set dotted polyline repeat distance to 20.0: %@", repeatDistanceSuccess ? @"YES" : @"NO");
1007 // [objc_DottedPolylineMapObject_setRepeatDistance]
1008
1009 // [objc_DottedPolylineMapObject_setRepeatGroup]
1010 // Set repeat group
1011 BOOL repeatGroupSuccess = [dottedPolylineObject setRepeatGroup:1];
1012 NSLog(@"Set dotted polyline repeat group to 1: %@", repeatGroupSuccess ? @"YES" : @"NO");
1013 // [objc_DottedPolylineMapObject_setRepeatGroup]
1014
1015 // [objc_DottedPolylineMapObject_setSize]
1016 // Set size
1017 NCSize *size = [[NCSize alloc] initWithWidth:16.0 height:16.0];
1018 BOOL sizeSuccess = [dottedPolylineObject setSize:size];
1019 NSLog(@"Set dotted polyline size to (%.1f, %.1f): %@", size.width, size.height, sizeSuccess ? @"YES" : @"NO");
1020 // [objc_DottedPolylineMapObject_setSize]
1021
1022 // [objc_DottedPolylineMapObject_setVisible]
1023 // Set visibility
1024 BOOL visibleSuccess = [dottedPolylineObject setVisible:YES];
1025 NSLog(@"Set dotted polyline visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
1026 // [objc_DottedPolylineMapObject_setVisible]
1027
1028 // [objc_DottedPolylineMapObject_getMapObjectType]
1029 // Get map object type
1030 NCMapObjectType objectType = dottedPolylineObject.mapObjectType;
1031 NSLog(@"Dotted polyline map object type: %@", objectType);
1032 // [objc_DottedPolylineMapObject_getMapObjectType]
1033
1034 // [objc_MapObject_setAlpha_4]
1035 // Set alpha transparency
1036 BOOL alphaSuccess = [dottedPolylineObject setAlpha:0.8];
1037 NSLog(@"Set dotted polyline alpha to 0.8: %@", alphaSuccess ? @"YES" : @"NO");
1038 // [objc_MapObject_setAlpha_4]
1039
1040 // [objc_MapObject_setInteractive_4]
1041 // Set interactive mode
1042 BOOL interactiveSuccess = [dottedPolylineObject setInteractive:YES];
1043 NSLog(@"Set dotted polyline interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");
1044 // [objc_MapObject_setInteractive_4]
1045
1046 // [objc_MapObject_setTitle_4]
1047 // Set title
1048 BOOL titleSuccess = [dottedPolylineObject setTitle:@"Dotted Polyline Object"];
1049 NSLog(@"Set dotted polyline title to 'Dotted Polyline Object': %@", titleSuccess ? @"YES" : @"NO");
1050 // [objc_MapObject_setTitle_4]
1051
1052 // [objc_MapObject_setData_4]
1053 // Set custom data
1054 NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
1055 BOOL dataSuccess = [dottedPolylineObject setData:customData];
1056 NSLog(@"Set dotted polyline custom data: %@", dataSuccess ? @"YES" : @"NO");
1057 // [objc_MapObject_setData_4]
1058
1059 // [objc_MapObject_getId_4]
1060 // Get object ID
1061 NSInteger objectId = dottedPolylineObject.id;
1062 NSLog(@"Dotted polyline object ID: %ld", (long)objectId);
1063 // [objc_MapObject_getId_4]
1064
1065 // [objc_MapObject_getType_4]
1066 // Get object type
1067 NSString *objectTypeString = dottedPolylineObject.type;
1068 NSLog(@"Dotted polyline object type: %@", objectTypeString);
1069 // [objc_MapObject_getType_4]
1070
1071 // [objc_MapObject_getData_4]
1072 // Get custom data
1073 NSDictionary *retrievedData = dottedPolylineObject.data;
1074 NSLog(@"Dotted polyline custom data: %@", retrievedData);
1075 // [objc_MapObject_getData_4]
1076
1077 // [objc_LocationWindow_addDottedPolylineMapObject]
1078 // Add dotted polyline map object
1079 [_locationWindow addDottedPolylineMapObject:dottedPolylineObject];
1080 [_mapObjects addObject:dottedPolylineObject];
1081 NSLog(@"Added dotted polyline map object");
1082 // [objc_LocationWindow_addDottedPolylineMapObject]
1083
1084 // Test multiple dotted polyline objects
1085 NSArray *dottedPolylines = @[
1086 [[NCDottedPolylineMapObject alloc] initWithPolyline:[[NCLocationPolyline alloc] initWithPolyline:[[NCPolyline alloc] initWithPoints:@[
1087 [[NCPoint alloc] initWithX:180.0 y:190.0],
1088 [[NCPoint alloc] initWithX:185.0 y:195.0],
1089 [[NCPoint alloc] initWithX:190.0 y:200.0],
1090 ]] locationId:1 sublocationId:0]],
1091 [[NCDottedPolylineMapObject alloc] initWithPolyline:[[NCLocationPolyline alloc] initWithPolyline:[[NCPolyline alloc] initWithPoints:@[
1092 [[NCPoint alloc] initWithX:195.0 y:205.0],
1093 [[NCPoint alloc] initWithX:200.0 y:210.0],
1094 [[NCPoint alloc] initWithX:205.0 y:215.0],
1095 [[NCPoint alloc] initWithX:210.0 y:220.0],
1096 ]] locationId:1 sublocationId:0]],
1097 ];
1098
1099 for (NCDottedPolylineMapObject *dottedLine in dottedPolylines) {
1100 [_locationWindow addDottedPolylineMapObject:dottedLine];
1101 [_mapObjects addObject:dottedLine];
1102 NSLog(@"Added dotted polyline with %lu points", (unsigned long)dottedLine.polyline.polyline.points.count);
1103 }
1104
1105 // [objc_LocationWindow_removeDottedPolylineMapObject]
1106 // Remove dotted polyline map object
1107 [_locationWindow removeDottedPolylineMapObject:dottedPolylineObject];
1108 [_mapObjects removeObject:dottedPolylineObject];
1109 NSLog(@"Removed dotted polyline map object");
1110 // [objc_LocationWindow_removeDottedPolylineMapObject]
1111}
1112
1117 NSLog(@"--- Cluster map objects ---");
1118
1119 if (_locationWindow == nil) {
1120 NSLog(@"LocationWindow not available");
1121 return;
1122 }
1123
1124 // [objc_LocationWindow_addClusterMapObjectController]
1125 NCClusterMapObjectController *controller =
1127 NSLog(@"Added cluster map object controller");
1128 // [objc_LocationWindow_addClusterMapObjectController]
1129
1130 if (controller == nil) {
1131 return;
1132 }
1133
1136 [clusterIcon1 setPosition:[[NCLocationPoint alloc] initWithX:100.0 y:100.0]];
1137 [clusterIcon2 setPosition:[[NCLocationPoint alloc] initWithX:105.0 y:102.0]];
1138
1139 // [objc_ClusterMapObjectController_addIconMapObject]
1140 BOOL added1 = [controller addIconMapObject:clusterIcon1];
1141 BOOL added2 = [controller addIconMapObject:clusterIcon2];
1142 NSLog(@"Registered icons for clustering: %d, %d", added1, added2);
1143 // [objc_ClusterMapObjectController_addIconMapObject]
1144
1145 // [objc_ClusterMapObjectController_setEnabled]
1146 [controller setEnabled:YES];
1147 NSLog(@"Clustering enabled");
1148 // [objc_ClusterMapObjectController_setEnabled]
1149
1150 // [objc_ClusterMapObjectController_isEnabled]
1151 BOOL clusteringEnabled = [controller isEnabled];
1152 NSLog(@"Clustering is enabled: %d", clusteringEnabled);
1153 // [objc_ClusterMapObjectController_isEnabled]
1154
1155 // [objc_ClusterMapObjectController_setRadius]
1156 [controller setRadius:40.0f];
1157 NSLog(@"Set cluster radius to 40 px");
1158 // [objc_ClusterMapObjectController_setRadius]
1159
1160 // [objc_ClusterMapObjectController_getRadius]
1161 float clusterRadius = [controller getRadius];
1162 NSLog(@"Cluster radius: %f", clusterRadius);
1163 // [objc_ClusterMapObjectController_getRadius]
1164
1165 // [objc_ClusterMapObjectController_setInteractive]
1166 BOOL interactiveSuccess = [controller setInteractive:YES];
1167 NSLog(@"Set cluster markers interactive: %d", interactiveSuccess);
1168 // [objc_ClusterMapObjectController_setInteractive]
1169
1170 // [objc_ClusterMapObjectController_setClusterSize]
1171 BOOL sizeSuccess = [controller setClusterSizeWithWidth:32.0f height:32.0f];
1172 NSLog(@"Set default cluster icon size: %d", sizeSuccess);
1173 // [objc_ClusterMapObjectController_setClusterSize]
1174
1175 DemoClusterMapObjectControllerListener *listener =
1177
1178 // [objc_ClusterMapObjectController_addListener]
1179 [controller addListener:listener];
1180 NSLog(@"Added cluster map object controller listener");
1181 // [objc_ClusterMapObjectController_addListener]
1182
1183 // [objc_ClusterMapObjectController_getClusters]
1184 NSArray<NCClusterMapObject *> *clusters = [controller getClusters];
1185 NSLog(@"Visible clusters: %lu", (unsigned long)clusters.count);
1186 // [objc_ClusterMapObjectController_getClusters]
1187
1188 if (clusters.count > 0) {
1189 NCClusterMapObject *cluster = clusters.firstObject;
1190 // [objc_ClusterMapObject_setBitmap]
1191 UIImage *clusterImage = [UIImage imageWithContentsOfFile:@"/path/to/cluster.png"];
1192 BOOL bitmapSuccess = [cluster setBitmap:clusterImage];
1193 NSLog(@"Set cluster bitmap (UIImage): %d", bitmapSuccess);
1194 // [objc_ClusterMapObject_setBitmap]
1195 }
1196
1197 // [objc_ClusterMapObjectController_removeListener]
1198 [controller removeListener:listener];
1199 NSLog(@"Removed cluster map object controller listener");
1200 // [objc_ClusterMapObjectController_removeListener]
1201
1202 // [objc_ClusterMapObjectController_removeIconMapObject]
1203 BOOL removed = [controller removeIconMapObject:clusterIcon1];
1204 NSLog(@"Removed icon from cluster controller: %d", removed);
1205 // [objc_ClusterMapObjectController_removeIconMapObject]
1206 [_locationWindow removeIconMapObject:clusterIcon1];
1207 [_locationWindow removeIconMapObject:clusterIcon2];
1208
1209 // [objc_ClusterMapObjectController_clear]
1210 [controller clear];
1211 NSLog(@"Cleared cluster controller");
1212 // [objc_ClusterMapObjectController_clear]
1213
1214 // [objc_LocationWindow_removeClusterMapObjectController]
1215 BOOL controllerRemoved =
1216 [_locationWindow removeClusterMapObjectController:controller];
1217 NSLog(@"Removed cluster map object controller: %d", controllerRemoved);
1218 // [objc_LocationWindow_removeClusterMapObjectController]
1219}
1220
1225 NSLog(@"--- Remove All Map Objects ---");
1226
1227 if (_locationWindow == nil) {
1228 NSLog(@"LocationWindow not available yet");
1229 return;
1230 }
1231
1232 NSLog(@"Current map objects count: %lu", (unsigned long)_mapObjects.count);
1233
1234 // [objc_LocationWindow_removeAllMapObjects]
1235 // Remove all map objects
1237 [_mapObjects removeAllObjects];
1238 NSLog(@"Removed all map objects");
1239 // [objc_LocationWindow_removeAllMapObjects]
1240
1241 NSLog(@"Map objects count after removal: %lu", (unsigned long)_mapObjects.count);
1242}
1243
1247- (void)cleanup {
1248 NSLog(@"--- Cleanup ---");
1249
1250 if (_locationWindow != nil) {
1252 NSLog(@"Cleaned up all map objects");
1253 }
1254
1255 [_mapObjects removeAllObjects];
1256 NSLog(@"Cleared map objects list");
1257}
1258
1259@end
1260
1261@interface DemoClusterMapObjectControllerListener : NSObject <NCClusterMapObjectControllerListener>
1262@end
1263
1264@implementation DemoClusterMapObjectControllerListener {
1265 DemoClusterMapObjectListener *_clusterChangeListener;
1267}
1268
1269- (instancetype)init {
1270 self = [super init];
1271 if (self) {
1272 _clusterChangeListener = [[DemoClusterMapObjectListener alloc] init];
1273 }
1274 return self;
1275}
1276
1277// [objc_ClusterMapObjectControllerListener_onClusterCreated]
1278- (void)onClusterCreated:(NCClusterMapObjectController *)controller
1279 cluster:(NCClusterMapObject *)cluster {
1280 // [objc_ClusterMapObject_addListener]
1281 [cluster addListener:_clusterChangeListener];
1282 NSLog(@"Added cluster change listener, initial count: %d", [cluster getCount]);
1283 // [objc_ClusterMapObject_addListener]
1284 _activeCluster = cluster;
1285}
1286// [objc_ClusterMapObjectControllerListener_onClusterCreated]
1287
1288// [objc_ClusterMapObjectControllerListener_onClusterDestroyed]
1289- (void)onClusterDestroyed:(NCClusterMapObjectController *)controller
1290 clusterId:(int32_t)clusterId {
1291 if (_activeCluster != nil && [_activeCluster getId] == clusterId) {
1292 // [objc_ClusterMapObject_removeListener]
1293 [_activeCluster removeListener:_clusterChangeListener];
1294 NSLog(@"Removed cluster change listener");
1295 // [objc_ClusterMapObject_removeListener]
1296 _activeCluster = nil;
1297 }
1298 NSLog(@"Cluster destroyed, id: %d", clusterId);
1299}
1300// [objc_ClusterMapObjectControllerListener_onClusterDestroyed]
1301
1302@end
1303
1304@interface DemoClusterMapObjectListener : NSObject <NCClusterMapObjectListener>
1305@end
1306
1307@implementation DemoClusterMapObjectListener
1308
1309// [objc_ClusterMapObjectListener_onClusterChanged]
1310- (void)onClusterChanged:(NCClusterMapObject *)cluster {
1311 int32_t memberCount = [cluster getCount];
1312 NSLog(@"Cluster changed, member count: %d", memberCount);
1313}
1314// [objc_ClusterMapObjectListener_onClusterChanged]
1315
1316@end
1317
1318// Main function to run the example
1319int main(int argc, const char * argv[]) {
1320 @autoreleasepool {
1322 }
1323 return 0;
1324}