Module @luciad/ria/view/feature/transformation/ClusteringTransformer

Create a ClusteringTransformer with default settings

const defaultTransformer = create();

Create a ClusteringTransformer with non-default settings

const transformer = create({
defaultParameters: {
clusterSize: 100,
minimumPoints: 5
}
});

Create a transformer with specific parameters for a particular classification and defaults for all other classifications

class UnitsClassifier extends Classifier{
getClassification(object: Feature): string {
if (isAirUnit(object)) {
return "air";
} else if (isGroundUnit(object)) {
return "ground";
} else {
return "sea";
}
}
}

const unitsClassifier = new UnitsClassifier();
const airTransformer = create({
classifier: unitsClassifier,
//specify the settings for the air class
classParameters: [
{
classification: "air",
parameters: {
clusterSize: 100,
minimumPoints: 5
}
}
]
//all other classes will use the default settings
});

Create a transformer with specific parameters for a particular classification and other specific parameters for all other classifications

unitsClassifier.getClassification = function(object): string {
return object.id as string;
};
const bigTransformer = create({
classifier: unitsClassifier,
//these settings will be applied to all units
defaultParameters: {
clusterSize: 100,
minimumPoints: 2
},
// Except for air units, which override some of the settings
// note that the settings which are not overridden (e.g. clusterSize)
// will be taken from the "defaultParameters" settings
// So in this example, for this air class the clusterSize will be 100 as well
classParameters: [{
classMatcher: (classification): boolean => classification.toLowerCase() === "air",
parameters: {minimumPoints: 5}
}]
});

Create a transformer with specific configurations for different scale levels, reusing the unitsClassifier defined above.

const zoomedOutTransformer = create(); //default configurations applied
const zoomedInTransformer = create({
classifier: unitsClassifier,
classParameters: [
{
classification: "air",
parameters: {
clusterSize: 50,
minimumPoints: 5
}
}
]
});
const scaleDependentTransformer = createScaleDependent({
levelScales: [1 / 100000],
clusteringTransformers: [zoomedOutTransformer, zoomedInTransformer]
});

Using the ClusteringTransformer in combination with a FeatureLayer

const model = new KMLModel("");

const clusteringTransformerSnippets = create();
const layer = new FeatureLayer(model, {
transformer: clusteringTransformerSnippets
});

Index

Interfaces

Functions