API / geotoolkit / map / features / templates / BaseTemplate / BaseTemplate
templates.BaseTemplate.BaseTemplate
Manages AbstractFeature-to-Node logic used by Template class or its inheritants
Example
function myShapeCallback(feature, shape) {
if(feature.getId() === 'Houston') shape.setFillStyle({ 'color': 'red' });
};Example
import {BaseTemplate} from '@int/geotoolkit/map/features/templates/BaseTemplate';
import {Text} from '@int/geotoolkit/scene/shapes/Text';
import {TextStyle} from '@int/geotoolkit/attributes/TextStyle';
const template = new BaseTemplate({
...,
'textshape': new Text({
'textstyle': new TextStyle('blue'), // style for annotation
'height': 12
}),
'textSizeInfo': { // change annotation size dynamically
'field': 'pop2015', // base size on population field
'minDataValue': 500, // population varies from 500 to 3000
'maxDataValue': 3000,
'minSize': 10, // annotation size varies from 10px (for features with pop2015 <= 500) to 15px (pop2015 >= 3000)
'maxSize': 15 // e.g. if pop2015 field value is 2000, it's annotation size is 13px (linear interpolation)
}
});Constructors
Methods
Css Properties
| Name | Type | Description |
|---|---|---|
shape | Shape | Carnac shape to visualize a feature instance |
shape-clipstyle | ClipStyle | Clipping style |
shape-clipstyle-evenodd | boolean | True if evenodd mode is on ('nonzero' mode otherwise) |
shape-clipstyle-geometry | GraphicsPath | Clipping geometry |
shape-clipstyle-geometry-bounds | Rect | Bounds |
shape-clipstyle-geometry-bounds-height | number | Height |
shape-clipstyle-geometry-bounds-readonly | boolean | Readonly |
shape-clipstyle-geometry-bounds-width | number | Width |
shape-clipstyle-geometry-bounds-x | number | Left |
shape-clipstyle-geometry-bounds-y | number | Top |
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-fillstyle-color | string | Color in CSS form |
shape-fillstyle-evenoddmode | boolean | Even-odd fill mode |
shape-fillstyle-fillpattern | Pattern | Pattern |
shape-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 |
shape-fillstyle-fillpattern-patternname | string | Name of this pattern for indexing |
shape-fillstyle-fillpattern-scalable | boolean | Flag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported) |
shape-fillstyle-foreground | string | Foreground color |
shape-fillstyle-pattern | Pattern | Pattern |
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-linestyle-color | string | Color in CSS form |
shape-linestyle-fill | string | Optional fill style to be used to fill lines generated with this style |
shape-linestyle-fill | FillStyle | Optional fill style to be used to fill lines generated with this style |
shape-linestyle-linecap | CapStyle | The line cap style |
shape-linestyle-linedashoffset | number | Line dash offset of dashed line |
shape-linestyle-linejoin | JoinStyle | The line join style |
shape-linestyle-pixelsnapmode | boolean | Pixel Snap Mode, default( |
shape-linestyle-scalable | boolean | True if width should depend on transformation |
shape-linestyle-unit | string | Optional unit for the width |
shape-linestyle-width | number | string | The line thickness |
shape-localtransform | Transformation | Local transformation |
shape-localtransform-dx | number | X axis translation |
shape-localtransform-dy | number | Y axis translation |
shape-localtransform-xx | number | X scale |
shape-localtransform-xy | number | Xy skew |
shape-localtransform-yx | number | Yx skew |
shape-localtransform-yy | number | Y scale |
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-scalescrollstrategy-enabled | boolean | Enable flag |
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 |
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-layoutstyle-constraint | SizeConstraint | Layout constrains |
textshape-layoutstyle-flexgrow | number | Number specifying how much the item will grow relative to the rest of the items inside the same container |
textshape-layoutstyle-flexshrink | number | Number specifying how much the item will shrink relative to the rest of the items inside the same container |
textshape-layoutstyle-float | string | Float position |
textshape-layoutstyle-position | string | Layout position |
textshape-layoutstyle-size | number | string | Layout size |
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-maxdimension-height | number | Height of dimension |
textshape-maxdimension-width | number | Width of dimension or properties |
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 |
Methods
▸ getClassName(): string
string
▸ getGeometryToShape(): IGeometryToShape
Gets feature_geometry-to-shape_geometry adapter
▸ getGeometryToText(): IGeometryToText
Gets feature_geometry-to-text_anchor_position adapter
▸ getProperties(): OptionsOut
Gets template options
▸ 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
▸ setProperties(properties?): BaseTemplate
Sets template options. For the new options to take effect on layer, the layer has to be invalidated.
| Name | Type | Description |
|---|---|---|
Optional properties | Options | properties |
this
▸ setShapeCallback(callback): BaseTemplate
Sets callback function
| Name | Type | Description |
|---|---|---|
callback | ShapeCallback | callback function |
this
▸ Static getClassName(): string
string