Represents a polygon object on the location view.
More...
#include <com/navigine/idl/objc/NCPolygonMapObject.h>
|
| (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.
|
| |
Represents a polygon object on the location view.
Referenced from LocationWindow.
Definition at line 21 of file NCPolygonMapObject.h.
◆ 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:
NSDictionary *retrievedData = circleObject.data;
NSLog(@"Circle custom data: %@", retrievedData);
◆ 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:
NSInteger objectId = circleObject.id;
NSLog(@"Circle object ID: %ld", (long)objectId);
◆ 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:
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
-
| alpha | Opacity 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:
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
-
| red | Red RGBA component. |
| green | Green RGBA component. |
| blue | Blue RGBA component. |
| alpha | Opacity 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:
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
-
| data | Data 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:
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
-
| interactive | Specifies 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:
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
-
| order | The 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:
BOOL orderSuccess = [polygonObject
setOrder:2];
NSLog(@"Set polygon rendering order to 2: %@", orderSuccess ? @"YES" : @"NO");
◆ setPolygon:
Method is used to specify the source polygon of the object.
- Parameters
-
- Returns
- true if success, false otherwise.
Swift code snippet:
// Set polygon geometry
let points = [
NCPoint(x: 50.0, y: 60.0),
NCPoint(x: 55.0, y: 65.0),
NCPoint(x: 60.0, y: 60.0),
NCPoint(x: 55.0, y: 55.0),
]
let metricPolygon = NCPolygon(points: points)
let polygon = NCLocationPolygon(polygon: metricPolygon, locationId: 1, sublocationId: 0)
let success = polygonMapObject.setPolygon(polygon)
print("Set polygon with \(points.count) points: \(success)")
Objective C code snippet:
NSArray<NCPoint *> *points = @[
[[
NCPoint alloc] initWithX:100.0 y:200.0],
[[
NCPoint alloc] initWithX:150.0 y:250.0],
[[
NCPoint alloc] initWithX:200.0 y:200.0],
[[
NCPoint alloc] initWithX:150.0 y:150.0],
];
NCPolygon *metricPolygon = [[
NCPolygon alloc] initWithPoints:points];
NCLocationPolygon *polygon = [[
NCLocationPolygon alloc] initWithPolygon:metricPolygon locationId:1 sublocationId:0];
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
-
| title | The 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:
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
-
| visible | Specifies 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:
BOOL visibleSuccess = [circleObject
setVisible:YES];
NSLog(@"Set circle visibility to true: %@", visibleSuccess ? @"YES" : @"NO");
◆ valid
Tells if this object is valid or not. Any method called on an invalid object will throw an exception. The object becomes invalid only on UI thread, and only when its implementation depends on objects already destroyed by now.
Definition at line 86 of file NCPolygonMapObject.h.
The documentation for this class was generated from the following file: