Last updated

API / geotoolkit / map / features / templates / Aggregation / Aggregation

Class: Aggregation

templates.Aggregation.Aggregation

Manages Aggregation-to-SymbolShape logic used by Template class

Example

import {Aggregation} from '@int/geotoolkit/map/features/templates/Aggregation';
import {DefaultColorProvider} from '@int/geotoolkit/util/DefaultColorProvider';
const template = new Aggregation({
...
// change shape size dynamically:
'size': {
// size is based on the sum of aggregated features' population:
'field': 'population',
// size is changing from 25px to 60px:
'range': [25, 60]
},
'color': {
// no 'field' provided i.e. color is based on amount of aggregated features
// color 'range' can be either a color provider or an array:
'range': new DefaultColorProvider({
// use first color for 2 aggregated points, second for 50 and third for 500
// (linear interpolation):
'values': [2, 50, 500],
'colors': ['rgba(0, 0, 255, 0.5)', 'rgba(0, 0, 127, 0.5)', 'rgba(0, 0, 0, 0.5)']
})
}
});

Example

const template = new Aggregation({
...
// change shape size dynamically:
'size': {
// 'field' can be a function, here's a callback to calculate the average 'age' of aggregated features:
'field': (feature) => {
let sum = 0, count = 0;
feature.getAggregation().forEach((element) => {
sum += +element.getAttributes()['age']; // add 'age' value
count++; // count the processed elements
});
return sum / count; // return average 'age' value
},
// now size is based on the average 'age' value:
'range': [25, 60]
},
'color': {
// color is based on the sum of aggregated features' priority:
'field': 'priority',
// color 'range' can be either a color provider or an array:
// color changes from white to black basing on priority:
'range': ['white', 'black']
}
});

Hierarchy

Table of contents

Constructors
Methods
Css Properties
Name Type Description
colorproviderColorProviderColor provider to change shape fill color depending on aggregation size (number of points aggregated)
colorprovider-maxnumber
colorprovider-minnumber
colorprovider-scaleKnownScales
expandedcolorproviderColorProviderColor provider to change shape fill color depending on expanded aggregation level (0 for root, 1 for its children, etc.)
expandedlineLineLine to connect expanded aggregation with its child (set visible false if no needed)
expandedline-boundsRectShape bounds
expandedline-bounds-heightnumberHeight
expandedline-bounds-readonlybooleanReadonly
expandedline-bounds-widthnumberWidth
expandedline-bounds-xnumberLeft
expandedline-bounds-ynumberTop
expandedline-clipstyleClipStyleClipping style
expandedline-clipstyle-evenoddbooleanTrue if evenodd mode is on ('nonzero' mode otherwise)
expandedline-clipstyle-geometryGraphicsPathClipping geometry
expandedline-clipstyle-geometry-boundsRectBounds
expandedline-clipstyleGraphicsPathClipping style
expandedline-cssclassstringThe css class name of this node
expandedline-csscursorstringCSS cursor associated with node
expandedline-cssstylestringCSS style to be applied to inserted elements
expandedline-fillstylestringStyle applied on fill
expandedline-fillstyleFillStyleStyle applied on fill
expandedline-fillstyle-colorstringColor in CSS form
expandedline-fillstyle-evenoddmodebooleanEven-odd fill mode
expandedline-fillstyle-fillpatternPatternPattern
expandedline-fillstyle-fillpattern-containernamestringAn optional container name, which creates an image pattern. This parameter is used for serialization if you want to save are reference to pattern instead of the pattern itself
expandedline-fillstyle-fillpattern-patternnamestringName of this pattern for indexing
expandedline-fillstyle-fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
expandedline-fillstyle-foregroundstringForeground color
expandedline-fillstyle-patternPatternPattern
expandedline-fromPointFrom position
expandedline-from-xnumberX coordinate
expandedline-from-ynumberY coordinate
expandedline-idstring | numberId of the node, its a unique identifier
expandedline-linedecorationstringLine decoration style
expandedline-linestylestringStyle applied on outline
expandedline-linestyleLineStyleStyle applied on outline
expandedline-linestyle-colorstringColor in CSS form
expandedline-linestyle-fillstringOptional fill style to be used to fill lines generated with this style
expandedline-linestyle-fillFillStyleOptional fill style to be used to fill lines generated with this style
expandedline-linestyle-linecapCapStyleThe line cap style
expandedline-linestyle-linedashoffsetnumberLine dash offset of dashed line
expandedline-linestyle-linejoinJoinStyleThe line join style
expandedline-linestyle-pixelsnapmodebooleanPixel Snap Mode, default(
expandedline-linestyle-scalablebooleanTrue if width should depend on transformation
expandedline-linestyle-unitstringOptional unit for the width
expandedline-linestyle-widthnumber | stringThe line thickness
expandedline-localtransformTransformationLocal transformation
expandedline-localtransform-dxnumberX axis translation
expandedline-localtransform-dynumberY axis translation
expandedline-localtransform-xxnumberX scale
expandedline-localtransform-xynumberXy skew
expandedline-localtransform-yxnumberYx skew
expandedline-localtransform-yynumberY scale
expandedline-marginsnumber | stringIt has properties for specifying the margins for each side
expandedline-namestringName of the node. It is often used for debugging purposes or to simplify queries
expandedline-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
expandedline-opacityblendmodeBlendModeNode opacity mode to blend it
expandedline-scalescrollstrategyScaleScrollStrategyScale scroll strategy
expandedline-scalescrollstrategy-enabledbooleanEnable flag
expandedline-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
expandedline-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
expandedline-toPointTo position
expandedline-transformstringAdditional CSS transformation applied to node or 'none'
expandedline-transformTransformationAdditional CSS transformation applied to node or 'none'
expandedline-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
expandedline-z-indexnumberDefine node z-index
expandedshapeAnchoredShapeCarnac shape to visualize expanded aggregation feature (if
expandedshape-alignmentAnchorTypeAlignment according to the anchor point
expandedshape-axnumberAnchor x position
expandedshape-aynumberAnchor y position
expandedshape-clipstyleClipStyleClipping style
expandedshape-clipstyleGraphicsPathClipping style
expandedshape-cssclassstringThe css class name of this node
expandedshape-csscursorstringCSS cursor associated with node
expandedshape-cssstylestringCSS style to be applied to inserted elements
expandedshape-fillstylestringStyle applied on fill
expandedshape-fillstyleFillStyleStyle applied on fill
expandedshape-heightnumberShape height
expandedshape-idstring | numberId of the node, its a unique identifier
expandedshape-ispointingupbooleanDefines whether the shape is always pointing up
expandedshape-layoutstyleLayoutStyleLayout style to specify how to lay out shape
expandedshape-layoutstyle-constraintSizeConstraintLayout constrains
expandedshape-layoutstyle-flexgrownumberNumber specifying how much the item will grow relative to the rest of the items inside the same container
expandedshape-layoutstyle-flexshrinknumberNumber specifying how much the item will shrink relative to the rest of the items inside the same container
expandedshape-layoutstyle-floatstringFloat position
expandedshape-layoutstyle-positionstringLayout position
expandedshape-layoutstyle-sizenumber | stringLayout size
expandedshape-linestylestringStyle applied on outline
expandedshape-linestyleLineStyleStyle applied on outline
expandedshape-localtransformTransformationLocal transformation
expandedshape-marginsnumber | stringIt has properties for specifying the margins for each side
expandedshape-maxdimensionDimensionMaximum size for rendering
expandedshape-maxdimension-heightnumberHeight of dimension
expandedshape-maxdimension-widthnumberWidth of dimension or properties
expandedshape-mindimensionDimensionMinimum size for rendering
expandedshape-namestringName of the node. It is often used for debugging purposes or to simplify queries
expandedshape-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
expandedshape-opacityblendmodeBlendModeNode opacity mode to blend it
expandedshape-preserveaspectratiobooleanPreserve aspect ratio of the anchored shape
expandedshape-preservereadingorientationbooleanPreserve reading orientation for local transform
expandedshape-preserverightanglebooleanPreserve right angle for local transformation
expandedshape-rotationanglenumberRotation angle at anchor
expandedshape-scalescrollstrategyScaleScrollStrategyScale scroll strategy
expandedshape-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
expandedshape-sizeisindevicespacebooleanIs coordinate in device space
expandedshape-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
expandedshape-transformstringAdditional CSS transformation applied to node or 'none'
expandedshape-transformTransformationAdditional CSS transformation applied to node or 'none'
expandedshape-useminmaxdimensionsbooleanUse the min max dimensions to limit visual size
expandedshape-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
expandedshape-widthnumberShape width
expandedshape-z-indexnumberDefine node z-index
shapeShapeCarnac shape to visualize a feature instance
shape-clipstyleClipStyleClipping style
shape-clipstyleGraphicsPathClipping style
shape-cssclassstringThe css class name of this node
shape-csscursorstringCSS cursor associated with node
shape-cssstylestringCSS style to be applied to inserted elements
shape-fillstylestringStyle applied on fill
shape-fillstyleFillStyleStyle applied on fill
shape-idstring | numberId of the node, its a unique identifier
shape-linestylestringStyle applied on outline
shape-linestyleLineStyleStyle applied on outline
shape-localtransformTransformationLocal transformation
shape-marginsnumber | stringIt has properties for specifying the margins for each side
shape-namestringName of the node. It is often used for debugging purposes or to simplify queries
shape-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
shape-opacityblendmodeBlendModeNode opacity mode to blend it
shape-scalescrollstrategyScaleScrollStrategyScale scroll strategy
shape-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
shape-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
shape-transformstringAdditional CSS transformation applied to node or 'none'
shape-transformTransformationAdditional CSS transformation applied to node or 'none'
shape-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
shape-z-indexnumberDefine node z-index
shapeAnchoredShapeCarnac shape to visualize aggregation feature
textshapeTextText shape to visualize a feature annotations
textshape-alignmentAnchorTypeAlignment according to the anchor point
textshape-autosizebooleanAutomatically fit shape bounds to text size, default is true Set it to false if you have more than one paragraph inside with different alignment
textshape-axnumberAnchor x position
textshape-aynumberAnchor y position
textshape-clipstyleClipStyleClipping style
textshape-clipstyleGraphicsPathClipping style
textshape-cssclassstringThe css class name of this node
textshape-csscursorstringCSS cursor associated with node
textshape-cssstylestringCSS style to be applied to inserted elements
textshape-ellipsisstringstringString ellipsis that renders if ellipsis is true
textshape-fillstylestringStyle applied on fill
textshape-fillstyleFillStyleStyle applied on fill
textshape-heightnumberShape height
textshape-idstring | numberId of the node, its a unique identifier
textshape-ispointingupbooleanDefines whether the shape is always pointing up
textshape-layoutstyleLayoutStyleLayout style to specify how to lay out shape
textshape-linestylestringStyle applied on outline
textshape-linestyleLineStyleStyle applied on outline
textshape-localtransformTransformationLocal transformation
textshape-marginsnumber | stringIt has properties for specifying the margins for each side
textshape-maxdimensionDimensionMaximum size for rendering
textshape-mindimensionDimensionMinimum size for rendering
textshape-namestringName of the node. It is often used for debugging purposes or to simplify queries
textshape-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
textshape-opacityblendmodeBlendModeNode opacity mode to blend it
textshape-paddingnumber
textshape-paddingstylenumber | stringInner padding style in device coordinates
textshape-preserveaspectratiobooleanPreserve aspect ratio of the anchored shape
textshape-preservereadingorientationbooleanPreserve reading orientation for local transform
textshape-preserverightanglebooleanPreserve right angle for local transformation
textshape-radiusnumberBorder radius in device coordinates
textshape-rotationanglenumberRotation angle at anchor
textshape-scalescrollstrategyScaleScrollStrategyScale scroll strategy
textshape-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
textshape-showellipsisbooleanEllipsis flag
textshape-sizeisindevicespacebooleanIs coordinate in device space
textshape-sizemodeSizeModeText size mode, default value depends on width and height settings
textshape-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
textshape-textstringText to display
textshape-textstylestringTextStyle to display
textshape-textstyleTextStyleTextStyle to display
textshape-textstyle-alignmentAlignmentStyleAlignment
textshape-textstyle-autosizebooleanAuto font size on high definition display
textshape-textstyle-backgroundstringBackground style
textshape-textstyle-backgroundFillStyleBackground style
textshape-textstyle-baselineBaseLineStyleBase line
textshape-textstyle-colorstringColor in CSS form
textshape-textstyle-fillFillStyleText fill style
textshape-textstyle-fontstringFont see
textshape-textstyle-fonturlstringThe place from which the font will be loaded, if null - uses system fonts. It can be base64 with url keyword
textshape-textstyle-lineheightstring | numberLine height
textshape-textstyle-multilinebooleanAllow multi-line text
textshape-textstyle-outlinestringOutline style
textshape-textstyle-outlineLineStyleOutline style
textshape-textstyle-overflowwrapOverflowWrapStyleOverflow wrap
textshape-textstyle-strikethroughstringStrikethrough style
textshape-textstyle-strikethroughLineStyleStrikethrough style
textshape-textstyle-textoverflowTextOverflowStyleText overflow
textshape-textstyle-underlinestringUnderline style
textshape-textstyle-underlineLineStyleUnderline style
textshape-textstyle-underlineoffsetstring | numberUnderline offset distance
textshape-textstyle-whitespaceWhiteSpaceStyleWhite space
textshape-textstyle-wordbreakWordBreakStyleWord break
textshape-texttransformTransformText-transform (uppercase, lowercase, capitalize)
textshape-transformstringAdditional CSS transformation applied to node or 'none'
textshape-transformTransformationAdditional CSS transformation applied to node or 'none'
textshape-useminmaxdimensionsbooleanUse the min max dimensions to limit visual size
textshape-userheightnumberHeight
textshape-userwidthnumberWidth
textshape-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
textshape-widthnumberShape width
textshape-z-indexnumberDefine node z-index
textsizeinfoTextSizeInfoOptions for dynamically changing the annotation size basing on some attribute value
textsizeinfo-fieldstringFeature attribute field name that specifies the annotation size
textsizeinfo-maxdatavaluenumberAttribute value maximum limit
textsizeinfo-maxsizenumberAnnotation size (in px) for maxDataValue attribute. The size is calculated dynamically from the attribute value using linear interpolation between minSize and maxSize values
textsizeinfo-mindatavaluenumberAttribute value minimum limit
textsizeinfo-minsizenumberAnnotation size (in px) for minDataValue attribute. The size is calculated dynamically from the attribute value using linear interpolation between minSize and maxSize values

Contents

Constructors

new Aggregation(options)

new Aggregation(options?)

Parameters

Name Type Description
Optional optionsOptionstemplate options

Overrides

BaseTemplate.constructor

Methods

getClassName

getClassName(): string

Returns

string

Inherited from

BaseTemplate.getClassName


getGeometryToShape

getGeometryToShape(): IGeometryToShape

Gets feature_geometry-to-shape_geometry adapter

Returns

IGeometryToShape

Inherited from

BaseTemplate.getGeometryToShape


getGeometryToText

getGeometryToText(): IGeometryToText

Gets feature_geometry-to-text_anchor_position adapter

Returns

IGeometryToText

Inherited from

BaseTemplate.getGeometryToText


getProperties

getProperties(): OptionsOut

Gets all the properties pertaining to this object

Returns

OptionsOut

object containing the properties

Overrides

BaseTemplate.getProperties


getShape

getShape(): Shape

Gets Node carnac shape associated with a feature

Returns

Shape

carnac shape

Inherited from

BaseTemplate.getShape


getShapeCallback

getShapeCallback(): ShapeCallback

Gets optional shape callback

Returns

ShapeCallback

Inherited from

BaseTemplate.getShapeCallback


getTextShape

getTextShape(feature?): Text

Gets Text text shape for annotations

Parameters

Name Type Description
Optional featureAbstractFeaturefeature to annotate

Returns

Text

Inherited from

BaseTemplate.getTextShape


getTextStrategy

getTextStrategy(): IGetAnnotation

Returns strategy for getting annotation expression (if set)

Returns

IGetAnnotation

strategy

Inherited from

BaseTemplate.getTextStrategy


isDynamicSize

isDynamicSize(): boolean

Returns true if aggregation template has dynamic resize component, false otherwise

Returns

boolean


setProperties

setProperties(properties?): Aggregation

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsproperties

Returns

Aggregation

this

Overrides

BaseTemplate.setProperties


setShapeCallback

setShapeCallback(callback): Aggregation

Sets callback function

Parameters

Name Type Description
callbackShapeCallbackcallback function

Returns

Aggregation

this

Inherited from

BaseTemplate.setShapeCallback


getClassName

Static getClassName(): string

Returns

string

Inherited from

BaseTemplate.getClassName