Loading...
Searching...
No Matches
ModelMapObject Class Referenceabstract

A 3D model map object (Wavefront OBJ) placed on the location view. More...

+ Inheritance diagram for ModelMapObject:

Public Member Functions

bool setPosition (LocationPoint point)
 Sets the anchor position of the model in metric coordinates.
 
bool setPositionAnimated (LocationPoint point, double duration, AnimationType type)
 Animates the model anchor to a new position.
 
bool setModel (ModelProvider model)
 Sets the 3D asset (OBJ source + texture ImageProvider).
 
bool setSize (double width, double height)
 Sets the on-screen size of the model in pixels (width and height).
 
bool setCollisionEnabled (bool enabled)
 Enables or disables collision tests for this object.
 
bool setAngle (double angle)
 Sets rotation angle in degrees (around the placement axis used by the engine).
 
bool setAngleAnimated (double angle, double duration, AnimationType type)
 Animates rotation to the given angle.
 
bool setBuffer (double width, double height)
 Extra hit-test padding around the model in pixels.
 
bool setPriority (double priority)
 Render order priority (higher draws above).
 
int getId ()
 Gets the unique identifier of the map object.
 
MapObjectType getType ()
 Gets the type of the map object.
 
Uint8List getData ()
 Gets the user-defined data associated with the map object.
 
bool setVisible (bool visible)
 Method is used to specify the visibility of the map object.
 
bool setInteractive (bool interactive)
 Method is used to specify whether the map object can be interacted with.
 
void setData (Uint8List data)
 Method is used to set user-defined data for the map object.
 
bool setTitle (String title)
 Method is used to set the title of the map object.
 
bool setAlpha (double alpha)
 Method is used to set the opacity of the map object.
 

Detailed Description

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 28 of file model_map_object.dart.

Member Function Documentation

◆ getData()

Uint8List MapObject.getData ( )
inherited

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

Returns
The data stored in the map object.

Dart code snippet:

// Get custom data
Map<String, dynamic> retrievedData = _circleMapObject!.data;
print("Circle custom data: $retrievedData");

◆ getId()

int MapObject.getId ( )
inherited

Gets the unique identifier of the map object.

Returns
The unique identifier of the map object.

Dart code snippet:

// Get object ID
int objectId = _circleMapObject!.id;
print("Circle object ID: $objectId");

◆ getType()

MapObjectType MapObject.getType ( )
inherited

Gets the type of the map object.

Returns
The type of the map object MapObjectType.

Dart code snippet:

// Get object type
String objectTypeString = _circleMapObject!.type;
print("Circle object type: $objectTypeString");

◆ setAlpha()

bool MapObject.setAlpha ( double alpha)
inherited

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.

Dart code snippet:

// Set alpha transparency
bool alphaSuccess = _circleMapObject!.setAlpha(0.7);
print("Set circle alpha to 0.7: $alphaSuccess");

◆ setAngle()

bool ModelMapObject.setAngle ( double angle)

Sets rotation angle in degrees (around the placement axis used by the engine).

Returns
true if the operation is successful, false otherwise.

Dart code snippet:

bool angleOk = m.setAngle(45.0);
print("Model setAngle: $angleOk");

◆ setAngleAnimated()

bool ModelMapObject.setAngleAnimated ( double angle,
double duration,
AnimationType type )

Animates rotation to the given angle.

Returns
true if the operation is successful, false otherwise.

Dart code snippet:

bool angleAnimOk = m.setAngleAnimated(90.0, 0.5, AnimationType.QUINT);
print("Model setAngleAnimated: $angleAnimOk");

◆ setBuffer()

bool ModelMapObject.setBuffer ( double width,
double height )

Extra hit-test padding around the model in pixels.

Returns
true if the operation is successful, false otherwise.

Dart code snippet:

bool bufOk = m.setBuffer(4.0, 4.0);
print("Model setBuffer: $bufOk");

◆ setCollisionEnabled()

bool ModelMapObject.setCollisionEnabled ( bool enabled)

Enables or disables collision tests for this object.

Returns
true if the operation is successful, false otherwise.

Dart code snippet:

bool collOk = m.setCollisionEnabled(true);
print("Model setCollisionEnabled: $collOk");

◆ setData()

void MapObject.setData ( Uint8List data)
inherited

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

Parameters
dataData to store in the map object.

Dart code snippet:

// Set custom data
Map<String, dynamic> customData = {"key": "value", "number": 42};
bool dataSuccess = _circleMapObject!.setData(customData);
print("Set circle custom data: $dataSuccess");

◆ setInteractive()

bool MapObject.setInteractive ( bool interactive)
inherited

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.

Dart code snippet:

// Set interactive mode
bool interactiveSuccess = _circleMapObject!.setInteractive(true);
print("Set circle interactive to true: $interactiveSuccess");

◆ setModel()

bool ModelMapObject.setModel ( ModelProvider model)

Sets the 3D asset (OBJ source + texture ImageProvider).

Parameters
modelModel provider ModelProvider.
Returns
true if the operation is successful, false otherwise.

Dart code snippet:

ImageProvider texture = ImageProvider.fromImageProvider(
const AssetImage('assets/model_texture.png'),
cacheable: true,
);
ModelProvider modelProvider = ModelProvider(
texture,
onModelRequest: () async {
final bytes = await File('/path/to/model.obj').readAsBytes();
return ByteData.sublistView(bytes);
},
);
bool modelOk = m.setModel(modelProvider);
print("Model setModel: $modelOk");

◆ setPosition()

bool ModelMapObject.setPosition ( LocationPoint point)

Sets the anchor position of the model in metric coordinates.

Parameters
pointCenter / placement point LocationPoint.
Returns
true if the operation is successful, false otherwise.

Dart code snippet:

bool posOk = m.setPosition(LocationPoint(12.0, 34.0));
print("Model setPosition: $posOk");

◆ setPositionAnimated()

bool ModelMapObject.setPositionAnimated ( LocationPoint point,
double duration,
AnimationType type )

Animates the model anchor to a new position.

Parameters
pointTarget metrics coordinates LocationPoint.
durationAnimation duration in seconds.
typeAnimation easing AnimationType.
Returns
true if the operation is successful, false otherwise.

Dart code snippet:

bool posAnimOk = m.setPositionAnimated(
LocationPoint(15.0, 40.0),
0.5,
AnimationType.SINE,
);
print("Model setPositionAnimated: $posAnimOk");

◆ setPriority()

bool ModelMapObject.setPriority ( double priority)

Render order priority (higher draws above).

Returns
true if the operation is successful, false otherwise.

Dart code snippet:

bool priOk = m.setPriority(10.0);
print("Model setPriority: $priOk");

◆ setSize()

bool ModelMapObject.setSize ( double width,
double height )

Sets the on-screen size of the model in pixels (width and height).

Returns
true if the operation is successful, false otherwise.

Dart code snippet:

bool sizeOk = m.setSize(64.0, 64.0);
print("Model setSize: $sizeOk");

◆ setTitle()

bool MapObject.setTitle ( String title)
inherited

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.

Dart code snippet:

// Set title
bool titleSuccess = _circleMapObject!.setTitle("Circle Object");
print("Set circle title to 'Circle Object': $titleSuccess");

◆ setVisible()

bool MapObject.setVisible ( bool visible)
inherited

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.

Dart code snippet:

// Set visibility
bool visibleSuccess = _circleMapObject!.setVisible(true);
print("Set circle visibility to true: $visibleSuccess");

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