Last updated

API / geotoolkit / map / features / templates / BaseTemplate / BaseTemplate

Class: 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)
}
});

Hierarchy

Table of contents

Constructors
Methods
Css Properties
Name Type Description
shapeShapeCarnac shape to visualize a feature instance
shape-clipstyleClipStyleClipping style
shape-clipstyle-evenoddbooleanTrue if evenodd mode is on (&#x27;nonzero&#x27; mode otherwise)
shape-clipstyle-geometryGraphicsPathClipping geometry
shape-clipstyle-geometry-boundsRectBounds
shape-clipstyle-geometry-bounds-heightnumberHeight
shape-clipstyle-geometry-bounds-readonlybooleanReadonly
shape-clipstyle-geometry-bounds-widthnumberWidth
shape-clipstyle-geometry-bounds-xnumberLeft
shape-clipstyle-geometry-bounds-ynumberTop
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-fillstyle-colorstringColor in CSS form
shape-fillstyle-evenoddmodebooleanEven-odd fill mode
shape-fillstyle-fillpatternPatternPattern
shape-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
shape-fillstyle-fillpattern-patternnamestringName of this pattern for indexing
shape-fillstyle-fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
shape-fillstyle-foregroundstringForeground color
shape-fillstyle-patternPatternPattern
shape-idstring | numberId of the node, its a unique identifier
shape-linestylestringStyle applied on outline
shape-linestyleLineStyleStyle applied on outline
shape-linestyle-colorstringColor in CSS form
shape-linestyle-fillstringOptional fill style to be used to fill lines generated with this style
shape-linestyle-fillFillStyleOptional fill style to be used to fill lines generated with this style
shape-linestyle-linecapCapStyleThe line cap style
shape-linestyle-linedashoffsetnumberLine dash offset of dashed line
shape-linestyle-linejoinJoinStyleThe line join style
shape-linestyle-pixelsnapmodebooleanPixel Snap Mode, default(
shape-linestyle-scalablebooleanTrue if width should depend on transformation
shape-linestyle-unitstringOptional unit for the width
shape-linestyle-widthnumber | stringThe line thickness
shape-localtransformTransformationLocal transformation
shape-localtransform-dxnumberX axis translation
shape-localtransform-dynumberY axis translation
shape-localtransform-xxnumberX scale
shape-localtransform-xynumberXy skew
shape-localtransform-yxnumberYx skew
shape-localtransform-yynumberY scale
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-scalescrollstrategy-enabledbooleanEnable flag
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 &#x27;none&#x27;
shape-transformTransformationAdditional CSS transformation applied to node or &#x27;none&#x27;
shape-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
shape-z-indexnumberDefine node z-index
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-layoutstyle-constraintSizeConstraintLayout constrains
textshape-layoutstyle-flexgrownumberNumber specifying how much the item will grow relative to the rest of the items inside the same container
textshape-layoutstyle-flexshrinknumberNumber specifying how much the item will shrink relative to the rest of the items inside the same container
textshape-layoutstyle-floatstringFloat position
textshape-layoutstyle-positionstringLayout position
textshape-layoutstyle-sizenumber | stringLayout size
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-maxdimension-heightnumberHeight of dimension
textshape-maxdimension-widthnumberWidth of dimension or properties
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 &#x27;none&#x27;
textshape-transformTransformationAdditional CSS transformation applied to node or &#x27;none&#x27;
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 BaseTemplate(options)

new BaseTemplate(options?)

Parameters

Name Type Description
Optional optionsOptionsoptions
Methods

getClassName

getClassName(): string

Returns

string


getGeometryToShape

getGeometryToShape(): IGeometryToShape

Gets feature_geometry-to-shape_geometry adapter

Returns

IGeometryToShape


getGeometryToText

getGeometryToText(): IGeometryToText

Gets feature_geometry-to-text_anchor_position adapter

Returns

IGeometryToText


getProperties

getProperties(): OptionsOut

Gets template options

Returns

OptionsOut


getShape

getShape(): Shape

Gets Node carnac shape associated with a feature

Returns

Shape

carnac shape


getShapeCallback

getShapeCallback(): ShapeCallback

Gets optional shape callback

Returns

ShapeCallback


getTextShape

getTextShape(feature?): Text

Gets Text text shape for annotations

Parameters

Name Type Description
Optional featureAbstractFeaturefeature to annotate

Returns

Text


getTextStrategy

getTextStrategy(): IGetAnnotation

Returns strategy for getting annotation expression (if set)

Returns

IGetAnnotation

strategy


setProperties

setProperties(properties?): BaseTemplate

Sets template options. For the new options to take effect on layer, the layer has to be invalidated.

Parameters

Name Type Description
Optional propertiesOptionsproperties

Returns

BaseTemplate

this


setShapeCallback

setShapeCallback(callback): BaseTemplate

Sets callback function

Parameters

Name Type Description
callbackShapeCallbackcallback function

Returns

BaseTemplate

this


getClassName

Static getClassName(): string

Returns

string