Loading...
Searching...
No Matches

Represents a polygon object on the location view. More...

#include <com/navigine/idl/objc/NCPolygonMapObject.h>

+ Inheritance diagram for NCPolygonMapObject:

Instance Methods

(BOOL) - setPolygon:
 Method is used to specify the source polygon of the object.
 
(BOOL) - setColor:green:blue:alpha:
 Method is used to specify the color of the object.
 
(BOOL) - setOrder:
 Method is used to specify the rendering order of the object.
 
(int32_t) - getId
 Gets the unique identifier of the map object.
 
(NCMapObjectType- getType
 Gets the type of the map object.
 
(nonnull NSData *) - getData
 Gets the user-defined data associated with the map object.
 
(BOOL) - setVisible:
 Method is used to specify the visibility of the map object.
 
(BOOL) - setInteractive:
 Method is used to specify whether the map object can be interacted with.
 
(void) - setData:
 Method is used to set user-defined data for the map object.
 
(BOOL) - setTitle:
 Method is used to set the title of the map object.
 
(BOOL) - setAlpha:
 Method is used to set the opacity of the map object.
 

Detailed Description

Represents a polygon object on the location view.

Referenced from LocationWindow.

Definition at line 21 of file NCPolygonMapObject.h.

Method Documentation

◆ getData

- (nonnull NSData *) getData

Gets the user-defined data associated with the map object.

Returns
The data stored in the map object.

Swift code snippet:

// Get custom data
let retrievedData = circleMapObject.data
print("Circle custom data: \‍(retrievedData)")

Objective C code snippet:

// Get custom data
NSDictionary *retrievedData = circleObject.data;
NSLog(@"Circle custom data: %@", retrievedData);

◆ getId

- (int32_t) getId

Gets the unique identifier of the map object.

Returns
The unique identifier of the map object.

Swift code snippet:

// Get object ID
let objectId = circleMapObject.id
print("Circle object ID: \‍(objectId)")

Objective C code snippet:

// Get object ID
NSInteger objectId = circleObject.id;
NSLog(@"Circle object ID: %ld", (long)objectId);

◆ getType

- (NCMapObjectType) getType

Gets the type of the map object.

Returns
The type of the map object MapObjectType.

Swift code snippet:

// Get object type
let objectTypeString = circleMapObject.type
print("Circle object type: \‍(objectTypeString)")

Objective C code snippet:

// Get object type
NSString *objectTypeString = circleObject.type;
NSLog(@"Circle object type: %@", objectTypeString);

◆ setAlpha:

- (BOOL) setAlpha: (float) alpha

Method is used to set the opacity of the map object.

Parameters
alphaOpacity multiplier. Values below 0 will be set to 0. Values above 1 will be set to 1. Default: 1.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

// Set alpha transparency
let alphaSuccess = circleMapObject.setAlpha(0.7)
print("Set circle alpha to 0.7: \‍(alphaSuccess)")

Objective C code snippet:

// Set alpha transparency
BOOL alphaSuccess = [circleObject setAlpha:0.7];
NSLog(@"Set circle alpha to 0.7: %@", alphaSuccess ? @"YES" : @"NO");

◆ setColor:green:blue:alpha:

- (BOOL) setColor: (float) red
green: (float) green
blue: (float) blue
alpha: (float) alpha 

Method is used to specify the color of the object.

Parameters
redRed RGBA component.
greenGreen RGBA component.
blueBlue RGBA component.
alphaOpacity multiplier. Values below 0 will be set to 0. Default: 1.
Returns
true if success, false otherwise.

Swift code snippet:

// Set polygon color
let colorSuccess = polygonMapObject.setColor(red: 0.0, green: 1.0, blue: 0.0, alpha: 0.7)
print("Set polygon color to green with 70% opacity: \‍(colorSuccess)")

Objective C code snippet:

// Set polygon color
BOOL colorSuccess = [polygonObject setColorWithRed:0.0 green:1.0 blue:0.0 alpha:0.7];
NSLog(@"Set polygon color to green with 70%% opacity: %@", colorSuccess ? @"YES" : @"NO");

◆ setData:

- (void) setData: (nonnull NSData *) data

Method is used to set user-defined data for the map object.

Parameters
dataData to store in the map object.

Swift code snippet:

// Set custom data
let customData = ["key": "value", "number": "42"]
let dataSuccess = circleMapObject.setData(customData)
print("Set circle custom data: \‍(dataSuccess)")

Objective C code snippet:

// Set custom data
NSDictionary *customData = @{@"key": @"value", @"number": @"42"};
BOOL dataSuccess = [circleObject setData:customData];
NSLog(@"Set circle custom data: %@", dataSuccess ? @"YES" : @"NO");

◆ setInteractive:

- (BOOL) setInteractive: (BOOL) interactive

Method is used to specify whether the map object can be interacted with.

Parameters
interactiveSpecifies whether the object can be picked in the pickMapObjectAt method (true) or not (false). Default: false.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

// Set interactive mode
let interactiveSuccess = circleMapObject.setInteractive(true)
print("Set circle interactive to true: \‍(interactiveSuccess)")

Objective C code snippet:

// Set interactive mode
BOOL interactiveSuccess = [circleObject setInteractive:YES];
NSLog(@"Set circle interactive to true: %@", interactiveSuccess ? @"YES" : @"NO");

◆ setOrder:

- (BOOL) setOrder: (int32_t) order

Method is used to specify the rendering order of the object.

Parameters
orderThe rendering order value. Default: 0.
Returns
true if success, false otherwise.

Swift code snippet:

// Set polygon rendering order
let orderSuccess = polygonMapObject.setOrder(2)
print("Set polygon rendering order to 2: \‍(orderSuccess)")

Objective C code snippet:

// Set polygon rendering order
BOOL orderSuccess = [polygonObject setOrder:2];
NSLog(@"Set polygon rendering order to 2: %@", orderSuccess ? @"YES" : @"NO");

◆ setPolygon:

- (BOOL) setPolygon: (nonnull NCLocationPolygon *) polygon

Method is used to specify the source polygon of the object.

Parameters
polygonMetrics coordinates of the polygon LocationPolygon.
Returns
true if success, false otherwise.

Swift code snippet:

// Set polygon geometry
let points = [
NCLocationPoint(x: 50.0, y: 60.0),
NCLocationPoint(x: 55.0, y: 65.0),
NCLocationPoint(x: 60.0, y: 60.0),
NCLocationPoint(x: 55.0, y: 55.0)
]
let polygon = NCLocationPolygon(points: points)
let success = polygonMapObject.setPolygon(polygon)
print("Set polygon with \‍(points.count) points: \‍(success)")

Objective C code snippet:

// Set polygon geometry
NSArray *points = @[
[[NCLocationPoint alloc] initWithX:100.0 y:200.0],
[[NCLocationPoint alloc] initWithX:150.0 y:250.0],
[[NCLocationPoint alloc] initWithX:200.0 y:200.0],
[[NCLocationPoint alloc] initWithX:150.0 y:150.0]
];
NCLocationPolygon *polygon = [[NCLocationPolygon alloc] initWithPoints:points];
BOOL success = [polygonObject setPolygon:polygon];
NSLog(@"Set polygon with %lu points: %@", (unsigned long)points.count, success ? @"YES" : @"NO");

◆ setTitle:

- (BOOL) setTitle: (nonnull NSString *) title

Method is used to set the title of the map object.

Parameters
titleThe title to display on the location view.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

// Set title
let titleSuccess = circleMapObject.setTitle("Circle Object")
print("Set circle title to 'Circle Object': \‍(titleSuccess)")

Objective C code snippet:

// Set title
BOOL titleSuccess = [circleObject setTitle:@"Circle Object"];
NSLog(@"Set circle title to 'Circle Object': %@", titleSuccess ? @"YES" : @"NO");

◆ setVisible:

- (BOOL) setVisible: (BOOL) visible

Method is used to specify the visibility of the map object.

Parameters
visibleSpecifies whether the object is visible (true) or hidden (false). Default: true.
Returns
true if the operation is successful, false otherwise.

Swift code snippet:

// Set visibility
let visibleSuccess = circleMapObject.setVisible(true)
print("Set circle visibility to true: \‍(visibleSuccess)")

Objective C code snippet:

// Set visibility
BOOL visibleSuccess = [circleObject setVisible:YES];
NSLog(@"Set circle visibility to true: %@", visibleSuccess ? @"YES" : @"NO");

The documentation for this class was generated from the following file: