Class: DrawTool

Tools.Draw DrawTool

DrawModel

new DrawTool()

modules/tools/draw/model.js, line 217
Properties:
Name Type Default Description
nameTranslationKey String common:menu.tools.draw is used to translate the title, if no translation configured for thie title in config.json
drawInteraction * The draw interaction.
selectInteraction * The select interaction.
modifyInteraction * The modify interaction.
layer ol/layer The layer for the drawn features.
font String "Arial" Selected font of the model.
fontSize Number 10 Selected fontSize of the model.
text String "Klicken Sie auf die Karte um den Text zu platzieren" Placeholder.
color Array.<Number> [55, 126, 184, 1] Selectd color in rgba array.
radius Number 6 Selected radius.
strokeWidth Number 1 Selected stroke width.
drawType Object The drawType.
Properties
Name Type Description
geometry String The geometry of the draw type.
text String The placeholder text.
renderToWindow Boolean true Flag to render in tool window.
deactivateGFI Boolean true Flag to deactivate GFI if draw tool gets activated.
glyphicon String "glyphicon-pencil" CSS glyphicon class.
addFeatureListener Object Listener.
zIndex Number 0 zIndex.
currentLng: String "" contains the current language, view listens to it
clickToPlaceText: String "" contains the translated text
draw: String "" contains the translated text
geometryDrawFailed: String "" contains the translated text
defindeTwoCircles: String "" contains the translated text
defindeInnerCircle: String "" contains the translated text
defindeDiameter: String "" contains the translated text
defindeOuterCircle: String "" contains the translated text
drawPoint: String "" contains the translated text
writeText: String "" contains the translated text
drawLine: String "" contains the translated text
drawArea: String "" contains the translated text
drawCircle: String "" contains the translated text
drawDoubleCircle: String "" contains the translated text
doubleCirclePlaceholder: String "" contains the translated text
diameter: String "" contains the translated text
outerDiameter: String "" contains the translated text
unit: String "" contains the translated text
textI18n: String "" contains the translated text
method: String "" contains the translated text
interactive: String "" contains the translated text
defined: String "" contains the translated text
transparencyOutline: String "" contains the translated text
outlineColor: String "" contains the translated text
fontSizeText: String "" contains the translated text
fontName: String "" contains the translated text
size: String "" contains the translated text
lineWidth: String "" contains the translated text
transparency: String "" contains the translated text
colorText: String "" contains the translated text
blue: String "" contains the translated text
yellow: String "" contains the translated text
grey: String "" contains the translated text
green: String "" contains the translated text
orange: String "" contains the translated text
red: String "" contains the translated text
black: String "" contains the translated text
white: String "" contains the translated text
drawBtnText: String "" contains the translated text
editBtnText: String "" contains the translated text
downloadBtnText: String "" contains the translated text
uploadBtnText: String "" contains the translated text
deleteBtnText: String "" contains the translated text
deleteAllBtnText: String "" contains the translated text
createFirstText String "", filled with "Bitte erstellen Sie zuerst eine Zeichnung oder einen Text!"- translated
idCounter Number 0 counter for unique ids
Fires:
Listens to Events:

Extends

Methods

activateDrawInteraction(){void}

modules/tools/draw/model.js, line 1300
activate draw interaction

activateModifyInteraction(){void}

modules/tools/draw/model.js, line 1340
activate modify interaction and change glyphicon to wrench

activateSelectInteraction(mode){void}

modules/tools/draw/model.js, line 1365
activate selct interaction and change glyphicon to trash
Name Type Description
mode string mode of select interaction

adjustValueToUnits(diameter, unit){string}

modules/tools/draw/model.js, line 1541
Function to adjust the value / radius to the units meters or kilometers.
Name Type Description
diameter string diameter of the circle.
unit string unit of thfe diameter.
Returns:
returns value / string without comma.

alertForgetToDefineRadius(evt, layer, textMessage){Layer}

modules/tools/draw/model.js, line 537
Alert function that shows up the alert, if the user has not defined the radius. Because the function (or the review if the radius is defined) is called after the drawstart, the feature already set due to the drawstart has to be removed.
Name Type Description
evt Event DrawEvent with the drawn-feature.
layer Number Layer with the drawFeatures.
textMessage String Message shown up in the alert window.
Returns:
returns the layer without the event feature.

assortResultCoordinates(circleCenter, resultCoordinates){Array}

modules/tools/draw/model.js, line 487
Merges the coordinates of the circle center and the calculated ones for the defined radius in one array and the right order together.
Name Type Description
circleCenter Number Coordinates of the circlecenter.
resultCoordinates Number Calculated coordinates for defined radius.
Returns:
returns an array with the extent coordinates of the circle feature.

calculateCircle(evt, circleCenter, circleRadius){void}

modules/tools/draw/model.js, line 466
Function to coordinate the circle calculation.
Name Type Description
evt Event DrawEvent with the drawn-feature.
circleCenter Number Center of the circle.
circleRadius Number Diameter of the circle.

cancelDrawWithoutGUI(cursor){void}

modules/tools/draw/model.js, line 824
finishes the draw interaction via Radio
Name Type Description
cursor String check and receive the parameter from Cockpit

changeLang(lng, initial){Void}

modules/tools/draw/model.js, line 280
change language - sets default values for the language
Name Type Description
lng String the language changed to
initial Boolean initial set of lng

checkAndRemovePreviousDrawInteraction(){void}

modules/tools/draw/model.js, line 1326
removes previous draw interaction

createBuffer(selectInteraction, feature){void}

modules/tools/draw/model.js, line 1207
create a additional buffer geometry around selected feature
Name Type Description
selectInteraction ol/interaction/Select select interaction
feature ol/feature selected feature

createDrawInteraction(drawType, layer, color){ol/interaction/Draw}

modules/tools/draw/model.js, line 938
creates the draw interaction to draw in the map
Name Type Description
drawType object contains the geometry and description
layer ol/layer/Vector layer to draw
color array of geometries

createDrawInteractionAndAddToMap(layer, drawType, isActive, maxFeatures){ol/layer/Vector}

modules/tools/draw/model.js, line 880
creates a single new draw interactions. If the drawType "doubleCircle" is selected, then two new draw interactions will be initialized.
Name Type Description
layer ol/layer/Vector the layer for the drawing.
drawType object contains the geometry and description
isActive Boolean true or false. Sets the draw interaction active or deactive.
maxFeatures integer maximal number of features to be drawn.

createDrawInteractionListener(drawInteraction, maxFeatures, doubleIsActive){void}

modules/tools/draw/model.js, line 954
Listener to change the entries for the next drawing.
Name Type Description
drawInteraction ol/interaction/Draw drawInteraction
maxFeatures integer maximal number of features to be drawn.
doubleIsActive Boolean - Boolean to compute a double circle or single circle.

createLayer(layer, treeType){ol/layer/Vector}

modules/tools/draw/model.js, line 843
creates a vector layer for drawn features, if layer input is undefined adds vector layer to model list and tree
Name Type Description
layer ol/layer/Vector could be undefined
treeType string tree type of portal

createModifyInteraction(layer){void}

modules/tools/draw/model.js, line 1246
creates and sets a interaction for modify vector features
Name Type Description
layer ol/layer/Vector for the selected(deleted) features

createModifyInteractionAndAddToMap(layer, isActive){void}

modules/tools/draw/model.js, line 923
creates a modify interaction and adds it to the map, so the features can be modified.
Name Type Description
layer ol/layer/Vector the layer for the drawing.
isActive Boolean true or false. Sets the draw interaction active or deactive.

createSelectInteraction(layer){ol/interaction/Select}

modules/tools/draw/model.js, line 1158
creates an interaction for selecting vector features
Name Type Description
layer ol/layer/Vector for the selected(deleted) features

createSelectInteractionAndAddToMap(layer, isActive, mode){void}

modules/tools/draw/model.js, line 908
creates a select interaction and adds it to the map.
Name Type Description
layer ol/layer/Vector the layer for the drawing.
isActive Boolean true or false. Sets the draw interaction active or deactive.
mode Boolean true or false. Sets the draw interaction active or deactive.

createSelectInteractionListener(selectInteraction, layer){void}

modules/tools/draw/model.js, line 1174
craete an listener for select interaction
Name Type Description
selectInteraction ol/interaction/Select selectInteraction
layer ol/layer/Vector for the selected(deleted) features

deactivateDrawInteraction(){void}

modules/tools/draw/model.js, line 1313
deactivates draw interaction

deactivateModifyInteraction(){void}

modules/tools/draw/model.js, line 1352
deactivate modify interaction and change glyphicon to pencil

deactivateSelectInteraction(){void}

modules/tools/draw/model.js, line 1454
deactivate selct interaction and change glyphicon to pencil

deleteFeatures(){void}

modules/tools/draw/model.js, line 1256
deletes all geometries from the layer

disAbleAllDrawOptions(disAble){void}

modules/tools/draw/model.js, line 1517
enables or disables the input/select options
Name Type Description
disAble boolean true or false to disable or enable.

downloadFeaturesWithoutGUI(para_object){String}

modules/tools/draw/model.js, line 668
creates and returns a GeoJSON of all drawn Features without a GUI returns an empty Object if no init happened previously (= no layer set) by default single geometries are added to the GeoJSON if geomType is set to "multiGeometry" multiGeometry Features of all drawn Features are created for each geometry type individually
Name Type Description
para_object String an Object which includes the parameters {String} geomType singleGeometry (default) or multiGeometry ("multiGeometry") {Boolean} transformWGS if true, the coordinates will be transformed from WGS84 to UTM
Returns:
all Features as String

downloadViaRemoteInterface(geomType){void}

modules/tools/draw/model.js, line 810
sends the generated GeoJSON to the RemoteInterface in order to communicate with an iframe
Name Type Description
geomType String singleGeometry (default) or multiGeometry ("multiGeometry")

drawInteractionOnDrawevent(drawInteraction, doubleIsActive, layer){void}

modules/tools/draw/model.js, line 382
Creates an addfeature-Listener. This feature-listener checks the method how to draw the circle. If the method is "defined", then a variety of other function is called and the openlayers drawevent will be changed accordingly. If the method is not "defined" (but "interactiv"), the function to define the style of the drawn feature is called.
Name Type Description
drawInteraction Interaction drawInteraction.
doubleIsActive Boolean Boolean to compute a double circle or single circle.
layer ol.layer Layer, to which the Listener is registered.

editFeaturesWithoutGUI(){void}

modules/tools/draw/model.js, line 653
enable editing of already drawn Features without a GUI usefule for instance for the use via RemoteInterface

enableMethodDefined(deEnable){void}

modules/tools/draw/model.js, line 1505
activate the method "defined", to define a circle by diameter.
Name Type Description
deEnable boolean true or false to enable or disable.

getCircleExtentByDistanceLat(circleCenter, diameter, map, earthRadius){Array}

modules/tools/draw/model.js, line 553
Calculates new flat and extent latitude coordinates for the (circle-) feature. These coordiantes are calculated on the basis of the circle diameter specified by the user.
Name Type Description
circleCenter Array Centercoordinates of the circle.
diameter Array Diameter of the new circle.
map ol.Map Map to project to.
earthRadius Number Radius of the earth.
Returns:
returns new and transformed flat / extent coordinates of the circle.

getCircleExtentByDistanceLon(circleCenter, diameter, map, earthRadius){Array}

modules/tools/draw/model.js, line 571
Calculates new flat and extent longitude coordinates for the (circle-) feature. These coordiantes are calculated on the basis of the circle diameter specified by the user.
Name Type Description
circleCenter Array Centercoordinates of the circle.
diameter Array Diameter of the new circle.
map ol.Map Map to project to.
earthRadius Number Radius of the earth.
Returns:
returns new and transformed flat coordinates of the circle.

getCircleStyle(color, colorContour, strokeWidth, zIndex){ol/style/Style}

modules/tools/draw/model.js, line 1054
Creates and returns a feature style for points, lines, or faces and returns it
Name Type Description
color number of drawings
colorContour number color of the contours
strokeWidth number from geometry
zIndex number zIndex of Element

getDefinedRadius(doubleIsActive, circleRadiusOuter, circleRadiusInner){Number}

modules/tools/draw/model.js, line 455
Getter to get the radius of the inner or outer circle. Depends on whether a double circle is to be calculated or not.
Name Type Description
doubleIsActive Boolean defines if a doublecircle or singlecircle should be calculated.
circleRadiusOuter Number Diameter of the outer circle.
circleRadiusInner Number Diameter of the inner / single circle.
Returns:
returns the circle radius.

getDrawStyle(color, drawGeometryType, strokeWidth, radius, zIndex, colorContour){ol/style/Style}

modules/tools/draw/model.js, line 1094
Creates and returns a feature style for points, lines, or polygon and returns it
Name Type Description
color number of drawings
drawGeometryType string geometry type of drawings
strokeWidth number from geometry
radius number from geometry
zIndex number zIndex of Element
colorContour number color of the contours

getStyle(drawType, color){ol/style/Style}

modules/tools/draw/model.js, line 997
Creates and returns the ol.style
Name Type Description
drawType object contains the geometry and description
color array of drawings

getTextStyle(color, text, fontSize, font, zIndex){ol/style/Style}

modules/tools/draw/model.js, line 1031
Creates a feature style for text and returns it
Name Type Description
color number of drawings
text string of drawings
fontSize number of drawings
font string of drawings
zIndex number zIndex of Element

inititalizeWithoutGUI(para_object){String}

modules/tools/draw/model.js, line 592
initialises the drawing functionality without a GUI useful for instance for the use via RemoteInterface
Name Type Description
para_object String an Object which includes the parameters {String} drawType - which type is meant to be drawn ["Point", "LineString", "Polygon", "Circle"] {String} color - color, in rgb (default: "55, 126, 184") {Integer} maxFeatures - maximum number of Features allowed to be drawn (default: unlimeted) {String} initialJSON - GeoJSON containing the Features to be drawn on the Layer, i.e. for editing {Boolean} transformWGS - The GeoJSON will be transformed from WGS84 to UTM if set to true {Boolean} zoomToExtent - The map will be zoomed to the extent of the GeoJson if set to true
Returns:
of all Features as a String

overwriteExtentCoordinates(evt, resultCoordinates){Object}

modules/tools/draw/model.js, line 506
Overwrites the extent coordinates of an existing (circle-) feature with recalculated ones.
Name Type Description
evt Event DrawEvent with the drawn-feature.
resultCoordinates Number New coordinates to describe the extent of the circle. Consists of four single values. The northernmost point of the circle is described by the longitude (northing) of that point (0). The southernmost point is described by the longitude (northing) of that point (1). The easternmost point is described by the latitude (easting) of that point (2). The westernmost point is described by the latitude (easting) of that point (3). They must be added to the array in the following order: [3, 1, 2, 0]
Returns:
returns the feature with the new extent coordinates.

overwriteFlatCoordinates(evt, flatCoordinates){Object}

modules/tools/draw/model.js, line 522
Overwrites the flat coordinates of an existing (circle-) feature with recalculated ones.
Name Type Description
evt Event DrawEvent with the drawn-feature.
flatCoordinates Number new flat coordinates of the drawn feature.
Returns:
returns the feature with the new flat coordinates.

pointerMoveBufferMode(evt){void}

modules/tools/draw/model.js, line 1391
Register pointermove listener for buffer mode
Name Type Description
evt Object map event

putGlyphToCursor(glyphicon){void}

modules/tools/draw/model.js, line 1467
Creates an HTML element, puts the glyph icon there and sticks it to the cursor
Name Type Description
glyphicon string of the mouse

resetModule(){void}

modules/tools/draw/model.js, line 1117
resets the module to its initial state

setAddFeatureListener(value){void}

modules/tools/draw/model.js, line 1772
setter for addFeatureListener
Name Type Description
value object addFeatureListener

setBufferDistance(value){void}

modules/tools/draw/model.js, line 1628
setter for color
Name Type Description
value array color

setCircleRadius(value){void}

modules/tools/draw/model.js, line 1678
setter for radius
Name Type Description
value number radius

setCircleRadiusOuter(value){void}

modules/tools/draw/model.js, line 1689
setter for outer radius
Name Type Description
value number radius

setColor(value){void}

modules/tools/draw/model.js, line 1614
setter for color
Name Type Description
value array color

setColorContour(value){void}

modules/tools/draw/model.js, line 1642
setter for color Contour
Name Type Description
value array color

setDrawInteraction(value){void}

modules/tools/draw/model.js, line 1746
setter for drawInteraction
Name Type Description
value ol/interaction/Draw drawInteraction

setDrawInteraction2(value){void}

modules/tools/draw/model.js, line 1755
setter for drawInteraction
Name Type Description
value ol/interaction/Draw drawInteraction

setDrawType(geometryType, id){void}

modules/tools/draw/model.js, line 1564
setter for drawType
Name Type Description
geometryType string geometry type
id string text

setEventualFeatureToDelete(value){void}

modules/tools/draw/model.js, line 1719
setter for a draw feature to eventual delete it in another iteration.
Name Type Description
value Object Draw-event-feature.

setFont(value){void}

modules/tools/draw/model.js, line 1596
setter for font
Name Type Description
value string font

setFontSize(value){void}

modules/tools/draw/model.js, line 1605
setter for fontSize
Name Type Description
value number fontSize

inherited setGlyphicon(value){void}

modules/core/modelList/item.js, line 69
Setter for glyphicon
Name Type Description
value String Glyphicon

inherited setId(value){void}

modules/core/modelList/item.js, line 34
Setter for id
Name Type Description
value String Id

setIdCounter(value){void}

modules/tools/draw/model.js, line 1812
Sets the idCounter.
Name Type Description
value string counter

inherited setIsActive(value){void}

modules/core/modelList/tool/model.js, line 129
Activates or deactivates tool
Name Type Description
value Boolean Flag if tool is active

inherited setIsInThemen(value){void}

modules/core/modelList/item.js, line 78
Setter for isInThemen
Name Type Description
value Boolean Flag if item is in themen

inherited setIsVisibleInMenu(value){void}

modules/core/modelList/item.js, line 105
Setter for setIsVisibleInMenu
Name Type Description
value Boolean Flag if item is visible in menu

inherited setIsVisibleInTree(value){void}

modules/core/modelList/item.js, line 96
Setter for isVisibleInTree
Name Type Description
value Boolean Flag if item is visible in layertree

setLayer(value){void}

modules/tools/draw/model.js, line 1728
setter for layer
Name Type Description
value ol/layer/Vector layer

inherited setLevel(value){void}

modules/core/modelList/item.js, line 87
Setter for level
Name Type Description
value String Level

setMethodCircle(value){void}

modules/tools/draw/model.js, line 1709
Setter for the method to draw a circle.
Name Type Description
value string interactive or defined

setModifyInteraction(value){void}

modules/tools/draw/model.js, line 1763
setter for modifyInteraction
Name Type Description
value ol/interaction/modify modifyInteraction

inherited setName(value){void}

modules/core/modelList/item.js, line 52
Setter for name
Name Type Description
value String Name

inherited setParentId(value){void}

modules/core/modelList/item.js, line 43
Setter for parentId
Name Type Description
value String ParentId

setRadius(value){void}

modules/tools/draw/model.js, line 1660
setter for radius
Name Type Description
value number radius

setSelectInteraction(value){void}

modules/tools/draw/model.js, line 1737
setter for selectInteraction
Name Type Description
value ol/interaction/select selectInteraction

setStrokeWidth(value){void}

modules/tools/draw/model.js, line 1669
setter for strokeWidth
Name Type Description
value number strokeWidth

setText(value){void}

modules/tools/draw/model.js, line 1651
setter for text
Name Type Description
value string text

inherited setType(value){void}

modules/core/modelList/item.js, line 60
Setter for type
Name Type Description
value String Type

setUnit(value){void}

modules/tools/draw/model.js, line 1700
Setter for unit
Name Type Description
value string m/km

startDownloadTool(){void}

modules/tools/draw/model.js, line 1491
Starts the download tool

startSelectInteraction(layer){void}

modules/tools/draw/model.js, line 1146
creates and sets an interaction for selecting vector features
Name Type Description
layer ol/layer/Vector for the selected(deleted) features

inherited superChangeLang(){Void}

modules/core/modelList/tool/model.js, line 113
change language - sets or translates the name of this tool, if property i18nextTranslate is no function. If name is defined in config.json, the name is not translated else property nameTranslationKey is used.

toggleInteraction(mode){void}

modules/tools/draw/model.js, line 1265
toggle between modify, trash and draw modes
Name Type Description
mode string from active button

transformNaNToUndefined(radius){undefined}

modules/tools/draw/model.js, line 443
Function to transform value "not a number (NaN)" to undefined.
Name Type Description
radius Boolean radius of the circle.
Returns:
returns undefined.

uniqueId(prefix){string}

modules/tools/draw/model.js, line 1550
Returns a unique id, starts with the given prefix
Name Type Description
prefix string prefix for the id
Returns:
unique id

updateDrawInteraction(){void}

modules/tools/draw/model.js, line 986
Updates the draw interaction if some changes are made by the user.