API / geotoolkit / map / features / templates / Aggregation / 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']
}
});↳
Aggregation
Constructors
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
colorprovider | ColorProvider | Color provider to change shape fill color depending on aggregation size (number of points aggregated) |
colorprovider-max | number | |
colorprovider-min | number | |
colorprovider-scale | KnownScales | |
expandedcolorprovider | ColorProvider | Color provider to change shape fill color depending on expanded aggregation level (0 for root, 1 for its children, etc.) |
expandedline | Line | Line to connect expanded aggregation with its child (set visible false if no needed) |
expandedline-bounds | Rect | Shape bounds |
expandedline-bounds-height | number | Height |
expandedline-bounds-readonly | boolean | Readonly |
expandedline-bounds-width | number | Width |
expandedline-bounds-x | number | Left |
expandedline-bounds-y | number | Top |
expandedline-clipstyle | ClipStyle | Clipping style |
expandedline-clipstyle-evenodd | boolean | True if evenodd mode is on ('nonzero' mode otherwise) |
expandedline-clipstyle-geometry | GraphicsPath | Clipping geometry |
expandedline-clipstyle-geometry-bounds | Rect | Bounds |
expandedline-clipstyle | GraphicsPath | Clipping style |
expandedline-cssclass | string | The css class name of this node |
expandedline-csscursor | string | CSS cursor associated with node |
expandedline-cssstyle | string | CSS style to be applied to inserted elements |
expandedline-fillstyle | string | Style applied on fill |
expandedline-fillstyle | FillStyle | Style applied on fill |
expandedline-fillstyle-color | string | Color in CSS form |
expandedline-fillstyle-evenoddmode | boolean | Even-odd fill mode |
expandedline-fillstyle-fillpattern | Pattern | Pattern |
expandedline-fillstyle-fillpattern-containername | string | An 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-patternname | string | Name of this pattern for indexing |
expandedline-fillstyle-fillpattern-scalable | boolean | Flag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported) |
expandedline-fillstyle-foreground | string | Foreground color |
expandedline-fillstyle-pattern | Pattern | Pattern |
expandedline-from | Point | From position |
expandedline-from-x | number | X coordinate |
expandedline-from-y | number | Y coordinate |
expandedline-id | string | number | Id of the node, its a unique identifier |
expandedline-linedecoration | string | Line decoration style |
expandedline-linestyle | string | Style applied on outline |
expandedline-linestyle | LineStyle | Style applied on outline |
expandedline-linestyle-color | string | Color in CSS form |
expandedline-linestyle-fill | string | Optional fill style to be used to fill lines generated with this style |
expandedline-linestyle-fill | FillStyle | Optional fill style to be used to fill lines generated with this style |
expandedline-linestyle-linecap | CapStyle | The line cap style |
expandedline-linestyle-linedashoffset | number | Line dash offset of dashed line |
expandedline-linestyle-linejoin | JoinStyle | The line join style |
expandedline-linestyle-pixelsnapmode | boolean | Pixel Snap Mode, default( |
expandedline-linestyle-scalable | boolean | True if width should depend on transformation |
expandedline-linestyle-unit | string | Optional unit for the width |
expandedline-linestyle-width | number | string | The line thickness |
expandedline-localtransform | Transformation | Local transformation |
expandedline-localtransform-dx | number | X axis translation |
expandedline-localtransform-dy | number | Y axis translation |
expandedline-localtransform-xx | number | X scale |
expandedline-localtransform-xy | number | Xy skew |
expandedline-localtransform-yx | number | Yx skew |
expandedline-localtransform-yy | number | Y scale |
expandedline-margins | number | string | It has properties for specifying the margins for each side |
expandedline-name | string | Name of the node. It is often used for debugging purposes or to simplify queries |
expandedline-opacity | number | Node 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-opacityblendmode | BlendMode | Node opacity mode to blend it |
expandedline-scalescrollstrategy | ScaleScrollStrategy | Scale scroll strategy |
expandedline-scalescrollstrategy-enabled | boolean | Enable flag |
expandedline-selectable | boolean | Selectable node, a boolean to determine if selection should consider this node |
expandedline-tag | any | Custom 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-to | Point | To position |
expandedline-transform | string | Additional CSS transformation applied to node or 'none' |
expandedline-transform | Transformation | Additional CSS transformation applied to node or 'none' |
expandedline-visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
expandedline-z-index | number | Define node z-index |
expandedshape | AnchoredShape | Carnac shape to visualize expanded aggregation feature (if |
expandedshape-alignment | AnchorType | Alignment according to the anchor point |
expandedshape-ax | number | Anchor x position |
expandedshape-ay | number | Anchor y position |
expandedshape-clipstyle | ClipStyle | Clipping style |
expandedshape-clipstyle | GraphicsPath | Clipping style |
expandedshape-cssclass | string | The css class name of this node |
expandedshape-csscursor | string | CSS cursor associated with node |
expandedshape-cssstyle | string | CSS style to be applied to inserted elements |
expandedshape-fillstyle | string | Style applied on fill |
expandedshape-fillstyle | FillStyle | Style applied on fill |
expandedshape-height | number | Shape height |
expandedshape-id | string | number | Id of the node, its a unique identifier |
expandedshape-ispointingup | boolean | Defines whether the shape is always pointing up |
expandedshape-layoutstyle | LayoutStyle | Layout style to specify how to lay out shape |
expandedshape-layoutstyle-constraint | SizeConstraint | Layout constrains |
expandedshape-layoutstyle-flexgrow | number | Number specifying how much the item will grow relative to the rest of the items inside the same container |
expandedshape-layoutstyle-flexshrink | number | Number specifying how much the item will shrink relative to the rest of the items inside the same container |
expandedshape-layoutstyle-float | string | Float position |
expandedshape-layoutstyle-position | string | Layout position |
expandedshape-layoutstyle-size | number | string | Layout size |
expandedshape-linestyle | string | Style applied on outline |
expandedshape-linestyle | LineStyle | Style applied on outline |
expandedshape-localtransform | Transformation | Local transformation |
expandedshape-margins | number | string | It has properties for specifying the margins for each side |
expandedshape-maxdimension | Dimension | Maximum size for rendering |
expandedshape-maxdimension-height | number | Height of dimension |
expandedshape-maxdimension-width | number | Width of dimension or properties |
expandedshape-mindimension | Dimension | Minimum size for rendering |
expandedshape-name | string | Name of the node. It is often used for debugging purposes or to simplify queries |
expandedshape-opacity | number | Node 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-opacityblendmode | BlendMode | Node opacity mode to blend it |
expandedshape-preserveaspectratio | boolean | Preserve aspect ratio of the anchored shape |
expandedshape-preservereadingorientation | boolean | Preserve reading orientation for local transform |
expandedshape-preserverightangle | boolean | Preserve right angle for local transformation |
expandedshape-rotationangle | number | Rotation angle at anchor |
expandedshape-scalescrollstrategy | ScaleScrollStrategy | Scale scroll strategy |
expandedshape-selectable | boolean | Selectable node, a boolean to determine if selection should consider this node |
expandedshape-sizeisindevicespace | boolean | Is coordinate in device space |
expandedshape-tag | any | Custom 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-transform | string | Additional CSS transformation applied to node or 'none' |
expandedshape-transform | Transformation | Additional CSS transformation applied to node or 'none' |
expandedshape-useminmaxdimensions | boolean | Use the min max dimensions to limit visual size |
expandedshape-visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
expandedshape-width | number | Shape width |
expandedshape-z-index | number | Define node z-index |
shape | Shape | Carnac shape to visualize a feature instance |
shape-clipstyle | ClipStyle | Clipping style |
shape-clipstyle | GraphicsPath | Clipping style |
shape-cssclass | string | The css class name of this node |
shape-csscursor | string | CSS cursor associated with node |
shape-cssstyle | string | CSS style to be applied to inserted elements |
shape-fillstyle | string | Style applied on fill |
shape-fillstyle | FillStyle | Style applied on fill |
shape-id | string | number | Id of the node, its a unique identifier |
shape-linestyle | string | Style applied on outline |
shape-linestyle | LineStyle | Style applied on outline |
shape-localtransform | Transformation | Local transformation |
shape-margins | number | string | It has properties for specifying the margins for each side |
shape-name | string | Name of the node. It is often used for debugging purposes or to simplify queries |
shape-opacity | number | Node 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-opacityblendmode | BlendMode | Node opacity mode to blend it |
shape-scalescrollstrategy | ScaleScrollStrategy | Scale scroll strategy |
shape-selectable | boolean | Selectable node, a boolean to determine if selection should consider this node |
shape-tag | any | Custom 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-transform | string | Additional CSS transformation applied to node or 'none' |
shape-transform | Transformation | Additional CSS transformation applied to node or 'none' |
shape-visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
shape-z-index | number | Define node z-index |
shape | AnchoredShape | Carnac shape to visualize aggregation feature |
textshape | Text | Text shape to visualize a feature annotations |
textshape-alignment | AnchorType | Alignment according to the anchor point |
textshape-autosize | boolean | Automatically 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-ax | number | Anchor x position |
textshape-ay | number | Anchor y position |
textshape-clipstyle | ClipStyle | Clipping style |
textshape-clipstyle | GraphicsPath | Clipping style |
textshape-cssclass | string | The css class name of this node |
textshape-csscursor | string | CSS cursor associated with node |
textshape-cssstyle | string | CSS style to be applied to inserted elements |
textshape-ellipsisstring | string | String ellipsis that renders if ellipsis is true |
textshape-fillstyle | string | Style applied on fill |
textshape-fillstyle | FillStyle | Style applied on fill |
textshape-height | number | Shape height |
textshape-id | string | number | Id of the node, its a unique identifier |
textshape-ispointingup | boolean | Defines whether the shape is always pointing up |
textshape-layoutstyle | LayoutStyle | Layout style to specify how to lay out shape |
textshape-linestyle | string | Style applied on outline |
textshape-linestyle | LineStyle | Style applied on outline |
textshape-localtransform | Transformation | Local transformation |
textshape-margins | number | string | It has properties for specifying the margins for each side |
textshape-maxdimension | Dimension | Maximum size for rendering |
textshape-mindimension | Dimension | Minimum size for rendering |
textshape-name | string | Name of the node. It is often used for debugging purposes or to simplify queries |
textshape-opacity | number | Node 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-opacityblendmode | BlendMode | Node opacity mode to blend it |
textshape-padding | number | |
textshape-paddingstyle | number | string | Inner padding style in device coordinates |
textshape-preserveaspectratio | boolean | Preserve aspect ratio of the anchored shape |
textshape-preservereadingorientation | boolean | Preserve reading orientation for local transform |
textshape-preserverightangle | boolean | Preserve right angle for local transformation |
textshape-radius | number | Border radius in device coordinates |
textshape-rotationangle | number | Rotation angle at anchor |
textshape-scalescrollstrategy | ScaleScrollStrategy | Scale scroll strategy |
textshape-selectable | boolean | Selectable node, a boolean to determine if selection should consider this node |
textshape-showellipsis | boolean | Ellipsis flag |
textshape-sizeisindevicespace | boolean | Is coordinate in device space |
textshape-sizemode | SizeMode | Text size mode, default value depends on width and height settings |
textshape-tag | any | Custom 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-text | string | Text to display |
textshape-textstyle | string | TextStyle to display |
textshape-textstyle | TextStyle | TextStyle to display |
textshape-textstyle-alignment | AlignmentStyle | Alignment |
textshape-textstyle-autosize | boolean | Auto font size on high definition display |
textshape-textstyle-background | string | Background style |
textshape-textstyle-background | FillStyle | Background style |
textshape-textstyle-baseline | BaseLineStyle | Base line |
textshape-textstyle-color | string | Color in CSS form |
textshape-textstyle-fill | FillStyle | Text fill style |
textshape-textstyle-font | string | Font see |
textshape-textstyle-fonturl | string | The place from which the font will be loaded, if null - uses system fonts. It can be base64 with url keyword |
textshape-textstyle-lineheight | string | number | Line height |
textshape-textstyle-multiline | boolean | Allow multi-line text |
textshape-textstyle-outline | string | Outline style |
textshape-textstyle-outline | LineStyle | Outline style |
textshape-textstyle-overflowwrap | OverflowWrapStyle | Overflow wrap |
textshape-textstyle-strikethrough | string | Strikethrough style |
textshape-textstyle-strikethrough | LineStyle | Strikethrough style |
textshape-textstyle-textoverflow | TextOverflowStyle | Text overflow |
textshape-textstyle-underline | string | Underline style |
textshape-textstyle-underline | LineStyle | Underline style |
textshape-textstyle-underlineoffset | string | number | Underline offset distance |
textshape-textstyle-whitespace | WhiteSpaceStyle | White space |
textshape-textstyle-wordbreak | WordBreakStyle | Word break |
textshape-texttransform | Transform | Text-transform (uppercase, lowercase, capitalize) |
textshape-transform | string | Additional CSS transformation applied to node or 'none' |
textshape-transform | Transformation | Additional CSS transformation applied to node or 'none' |
textshape-useminmaxdimensions | boolean | Use the min max dimensions to limit visual size |
textshape-userheight | number | Height |
textshape-userwidth | number | Width |
textshape-visible | boolean | Visibility of the node, a boolean to determine if the node should be rendered or not |
textshape-width | number | Shape width |
textshape-z-index | number | Define node z-index |
textsizeinfo | TextSizeInfo | Options for dynamically changing the annotation size basing on some attribute value |
textsizeinfo-field | string | Feature attribute field name that specifies the annotation size |
textsizeinfo-maxdatavalue | number | Attribute value maximum limit |
textsizeinfo-maxsize | number | Annotation size (in px) for maxDataValue attribute. The size is calculated dynamically from the attribute value using linear interpolation between minSize and maxSize values |
textsizeinfo-mindatavalue | number | Attribute value minimum limit |
textsizeinfo-minsize | number | Annotation size (in px) for minDataValue attribute. The size is calculated dynamically from the attribute value using linear interpolation between minSize and maxSize values |
Constructors
• new Aggregation(options?)
| Name | Type | Description |
|---|---|---|
Optional options | Options | template options |
BaseTemplate.constructor
Methods
▸ getClassName(): string
string
▸ getGeometryToShape(): IGeometryToShape
Gets feature_geometry-to-shape_geometry adapter
BaseTemplate.getGeometryToShape
▸ getGeometryToText(): IGeometryToText
Gets feature_geometry-to-text_anchor_position adapter
BaseTemplate.getGeometryToText
▸ getProperties(): OptionsOut
Gets all the properties pertaining to this object
object containing the properties
▸ getShape(): Shape
Gets Node carnac shape associated with a feature
carnac shape
▸ getShapeCallback(): ShapeCallback
Gets optional shape callback
▸ getTextShape(feature?): Text
Gets Text text shape for annotations
| Name | Type | Description |
|---|---|---|
Optional feature | AbstractFeature | feature to annotate |
▸ getTextStrategy(): IGetAnnotation
Returns strategy for getting annotation expression (if set)
strategy
▸ isDynamicSize(): boolean
Returns true if aggregation template has dynamic resize component, false otherwise
boolean
▸ setProperties(properties?): Aggregation
Sets all the properties pertaining to this object
| Name | Type | Description |
|---|---|---|
Optional properties | Options | properties |
this
▸ setShapeCallback(callback): Aggregation
Sets callback function
| Name | Type | Description |
|---|---|---|
callback | ShapeCallback | callback function |
this
▸ Static getClassName(): string
string