Loading...
Searching...
No Matches
ClusterMapObjectController Class Referenceabstract

Groups IconMapObject instances into clusters depending on zoom and proximity. More...

Inherits Finalizable.

Public Member Functions

bool addIconMapObject (IconMapObject iconMapObject)
 Adds an icon map object to the cluster controller.
 
bool removeIconMapObject (IconMapObject iconMapObject)
 Removes an icon map object from the cluster controller.
 
void clear ()
 Removes all icon map objects from the controller and destroys visible cluster markers.
 
void setEnabled (bool enabled)
 Enables or disables clustering. Default: true.
 
bool isEnabled ()
 Returns whether clustering is enabled.
 
void setRadius (double radius)
 Cluster radius in density-independent pixels. Default: 40.
 
double getRadius ()
 Returns cluster radius in density-independent pixels.
 
bool setInteractive (bool interactive)
 Specifies whether cluster markers can be picked. Default: true.
 
bool setClusterSize (double width, double height)
 Specifies the size of the default cluster icon in pixels.
 
void addListener (ClusterMapObjectControllerListener listener)
 Adds a listener for cluster lifecycle events ClusterMapObjectControllerListener.
 
void removeListener (ClusterMapObjectControllerListener listener)
 Removes a previously added listener.
 
List< ClusterMapObjectgetClusters ()
 Returns a snapshot of currently visible clusters.
 

Detailed Description

Groups IconMapObject instances into clusters depending on zoom and proximity.

Referenced from LocationWindow.

Register icons with addIconMapObject, then optionally customize cluster appearance in ClusterMapObjectControllerListener (onClusterCreated) and ClusterMapObjectListener (onClusterChanged).

Definition at line 27 of file cluster_map_object_controller.dart.

Member Function Documentation

◆ addIconMapObject()

bool ClusterMapObjectController.addIconMapObject ( IconMapObject iconMapObject)

Adds an icon map object to the cluster controller.

Parameters
iconMapObjectIcon to cluster IconMapObject. Must be added to the same LocationWindow via addIconMapObject.
Returns
true if the icon was added, false otherwise.

Dart code snippet:

final added1 = controller.addIconMapObject(clusterIcon1);
final added2 = controller.addIconMapObject(clusterIcon2);
print("Registered icons for clustering: $added1, $added2");

◆ addListener()

void ClusterMapObjectController.addListener ( ClusterMapObjectControllerListener listener)

Adds a listener for cluster lifecycle events ClusterMapObjectControllerListener.

Parameters
listenerListener instance.

Dart code snippet:

controller.addListener(_clusterMapObjectControllerListener!);
print("Added cluster map object listener");

◆ clear()

void ClusterMapObjectController.clear ( )

Removes all icon map objects from the controller and destroys visible cluster markers.

Dart code snippet:

controller.clear();
print("Cleared cluster controller");

◆ getClusters()

List< ClusterMapObject > ClusterMapObjectController.getClusters ( )

Returns a snapshot of currently visible clusters.

Dart code snippet:

final clusters = controller.getClusters();
print("Visible clusters: ${clusters.length}");

◆ getRadius()

double ClusterMapObjectController.getRadius ( )

Returns cluster radius in density-independent pixels.

Dart code snippet:

final clusterRadius = controller.getRadius();
print("Cluster radius: $clusterRadius");

◆ isEnabled()

bool ClusterMapObjectController.isEnabled ( )

Returns whether clustering is enabled.

Dart code snippet:

final clusteringEnabled = controller.isEnabled;
print("Clustering is enabled: $clusteringEnabled");

◆ removeIconMapObject()

bool ClusterMapObjectController.removeIconMapObject ( IconMapObject iconMapObject)

Removes an icon map object from the cluster controller.

Parameters
iconMapObjectIcon to remove.
Returns
true if the icon was removed, false otherwise.

Dart code snippet:

final removed = controller.removeIconMapObject(clusterIcon1);
print("Removed icon from cluster controller: $removed");

◆ removeListener()

void ClusterMapObjectController.removeListener ( ClusterMapObjectControllerListener listener)

Removes a previously added listener.

Parameters
listenerListener instance to remove.

Dart code snippet:

controller.removeListener(_clusterMapObjectControllerListener!);
print("Removed cluster map object listener");

◆ setClusterSize()

bool ClusterMapObjectController.setClusterSize ( double width,
double height )

Specifies the size of the default cluster icon in pixels.

Returns
true if the operation is successful, false otherwise.

Dart code snippet:

final sizeSuccess = controller.setClusterSize(32.0, 32.0);
print("Set default cluster icon size: $sizeSuccess");

◆ setEnabled()

void ClusterMapObjectController.setEnabled ( bool enabled)

Enables or disables clustering. Default: true.

Dart code snippet:

controller.setEnabled(true);
print("Clustering enabled");

◆ setInteractive()

bool ClusterMapObjectController.setInteractive ( bool interactive)

Specifies whether cluster markers can be picked. Default: true.

Returns
true if the operation is successful, false otherwise.

Dart code snippet:

final interactiveSuccess = controller.setInteractive(true);
print("Set cluster markers interactive: $interactiveSuccess");

◆ setRadius()

void ClusterMapObjectController.setRadius ( double radius)

Cluster radius in density-independent pixels. Default: 40.

Dart code snippet:

controller.setRadius(40.0);
print("Set cluster radius to 40 px");

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