A 3D model map object (Wavefront OBJ) placed on the location view.
More...
#include <com/navigine/idl/objc/NCModelMapObject.h>
|
| (BOOL) | - setPosition: |
| | Sets the anchor position of the model in metric coordinates.
|
| |
| (BOOL) | - setPositionAnimated:duration:type: |
| | Animates the model anchor to a new position.
|
| |
| (BOOL) | - setModel: |
| | Sets the 3D asset (OBJ source + texture ImageProvider).
|
| |
| (BOOL) | - setSize:height: |
| | Sets the on-screen size of the model in pixels (width and height).
|
| |
| (BOOL) | - setCollisionEnabled: |
| | Enables or disables collision tests for this object.
|
| |
| (BOOL) | - setAngle: |
| | Sets rotation angle in degrees (around the placement axis used by the engine).
|
| |
| (BOOL) | - setAngleAnimated:duration:type: |
| | Animates rotation to the given angle.
|
| |
| (BOOL) | - setBuffer:height: |
| | Extra hit-test padding around the model in pixels.
|
| |
| (BOOL) | - setPriority: |
| | Render order priority (higher draws above).
|
| |
| (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.
|
| |
A 3D model map object (Wavefront OBJ) placed on the location view.
Geometry and texture come from ModelProvider. The mesh is loaded asynchronously in the render pipeline; blocking calls occur only inside provider callbacks.
Referenced from LocationWindow (addModelMapObject).
Definition at line 25 of file NCModelMapObject.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");
◆ setAngle:
| - (BOOL) setAngle: |
|
(float) | angle |
|
Sets rotation angle in degrees (around the placement axis used by the engine).
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
let angleOk = m.setAngle(45.0)
print("Model setAngle: \(angleOk)")
Objective C code snippet:
BOOL angleOk = [modelObject
setAngle:45.0];
NSLog(@"Model setAngle: %@", angleOk ? @"YES" : @"NO");
◆ setAngleAnimated:duration:type:
| - (BOOL) setAngleAnimated: |
|
(float) | angle |
| duration: |
|
(float) | duration |
| type: |
|
(NCAnimationType) | type |
Animates rotation to the given angle.
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
let angleAnimOk = m.setAngleAnimated(90.0, duration: 0.5, animationType: .quint)
print("Model setAngleAnimated: \(angleAnimOk)")
Objective C code snippet:
BOOL angleAnimOk = [modelObject setAngleAnimated:90.0 duration:0.5 animationType:AnimationTypeQuint];
NSLog(@"Model setAngleAnimated: %@", angleAnimOk ? @"YES" : @"NO");
◆ setBuffer:height:
| - (BOOL) setBuffer: |
|
(float) | width |
| height: |
|
(float) | height |
Extra hit-test padding around the model in pixels.
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
let bufOk = m.setBuffer(width: 4.0, height: 4.0)
print("Model setBuffer: \(bufOk)")
Objective C code snippet:
BOOL bufOk = [modelObject setBufferWithWidth:4.0 height:4.0];
NSLog(@"Model setBuffer: %@", bufOk ? @"YES" : @"NO");
◆ setCollisionEnabled:
| - (BOOL) setCollisionEnabled: |
|
(BOOL) | enabled |
|
Enables or disables collision tests for this object.
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
let collOk = m.setCollisionEnabled(true)
print("Model setCollisionEnabled: \(collOk)")
Objective C code snippet:
NSLog(@"Model setCollisionEnabled: %@", collOk ? @"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");
◆ setModel:
| - (BOOL) setModel: |
|
(nullable id< NCModelProvider >) | model |
|
Sets the 3D asset (OBJ source + texture ImageProvider).
- Parameters
-
| model | Model provider ModelProvider. |
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
if let texture = UIImage(contentsOfFile: "/path/to/model_texture.png") {
let provider = NCModelProviderFactory.fromFile("/path/to/model.obj", texture: texture)
let modelOk = m.setModel(provider)
print("Model setModel: \(modelOk)")
}
Objective C code snippet:
UIImage *texture = [UIImage imageWithContentsOfFile:@"/path/to/model_texture.png"];
if (texture != nil) {
id<NCModelProvider> provider = [NCModelProviderFactory fromFile:@"/path/to/model.obj" texture:texture];
BOOL modelOk = [modelObject
setModel:provider];
NSLog(@"Model setModel: %@", modelOk ? @"YES" : @"NO");
}
◆ setPosition:
Sets the anchor position of the model in metric coordinates.
- Parameters
-
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
let posOk = m.setPosition(NCLocationPoint(x: 12.0, y: 34.0))
print("Model setPosition: \(posOk)")
Objective C code snippet:
NCLocationPoint *modelPoint = [[
NCLocationPoint alloc] initWithX:12.0 y:34.0];
NSLog(@"Model setPosition: %@", posOk ? @"YES" : @"NO");
◆ setPositionAnimated:duration:type:
Animates the model anchor to a new position.
- Parameters
-
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
let posAnimOk = m.setPositionAnimated(
NCLocationPoint(x: 15.0, y: 40.0),
duration: 0.5,
animationType: .sine
)
print("Model setPositionAnimated: \(posAnimOk)")
Objective C code snippet:
NCLocationPoint *animatedModelPoint = [[
NCLocationPoint alloc] initWithX:15.0 y:40.0];
BOOL posAnimOk = [modelObject setPositionAnimated:animatedModelPoint duration:0.5 animationType:AnimationTypeSine];
NSLog(@"Model setPositionAnimated: %@", posAnimOk ? @"YES" : @"NO");
◆ setPriority:
| - (BOOL) setPriority: |
|
(float) | priority |
|
Render order priority (higher draws above).
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
let priOk = m.setPriority(10.0)
print("Model setPriority: \(priOk)")
Objective C code snippet:
NSLog(@"Model setPriority: %@", priOk ? @"YES" : @"NO");
◆ setSize:height:
| - (BOOL) setSize: |
|
(float) | width |
| height: |
|
(float) | height |
Sets the on-screen size of the model in pixels (width and height).
- Returns
- true if the operation is successful, false otherwise.
Swift code snippet:
let sizeOk = m.setSize(width: 64.0, height: 64.0)
print("Model setSize: \(sizeOk)")
Objective C code snippet:
BOOL sizeOk = [modelObject setSizeWithWidth:64.0 height:64.0];
NSLog(@"Model setSize: %@", sizeOk ? @"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");
The documentation for this class was generated from the following file: