Class: GraphicalSelectModel

Snippets.GraphicalSelect GraphicalSelectModel

GraphicalSelectModel

new GraphicalSelectModel()

modules/snippets/graphicalSelect/model.js, line 67
creates a dropdown to select an area in a map by square, circle or polygon. Create it like this: new GraphicalSelectModel({id: "idOfTheCaller"}). The id is used to react only on events of the caller, not on all components, that use a graphicalSelectModel.
Properties:
Name Type Default Description
isOpen Boolean false dropdown is open or closed
name String "Geometrie" name of the dropdown
type String "string" type of the dropdown values
displayName String "Geometrie auswählen" label of the dropdown
snippetType String "graphicalSelect" type of the dropdown values
isMultiple Boolean false dropdown multiple
drawInteraction Object the interaction to draw a square, circle or polygon
circleOverlay ol.overlay new Overlay({offset: [15, 0], positioning: "center-left"}) circle overlay (tooltip) - shows the radius
tooltipOverlay ol.overlay new Overlay({offset: [15, 20], positioning: "top-left"}) todo
snippetDropdownModel Object {} contains the model of the underlying dropdown
geographicValues Object {"Rechteck aufziehen": "Box", "Kreis aufziehen": "Circle", "Fläche zeichnen": "Polygon"} possible values
currentValue String "" contains the current geographic value for "Box", "Circle" or "Polygon"
tooltipMessage String "Klicken zum Starten und Beenden" Meassage for tooltip
tooltipMessagePolygon String "Klicken um Stützpunkt hinzuzufügen" Meassage for tooltip
selectedAreaGeoJson ol.geojson {} the selected area as GeoJSON
Fires:
Listens to Events:

Extends

  • SnippetDropdownModel

Methods

changeLang(lng){Void}

modules/snippets/graphicalSelect/model.js, line 107
change language - sets default values for the language
Name Type Description
lng String the language changed to

createDomOverlay(id, overlay){void}

modules/snippets/graphicalSelect/model.js, line 376
Creates a div element for the circle overlay and adds it to the overlay.
Name Type Description
id String id of the div to create
overlay ol.Overlay circleOverlay

createDrawInteraction(id, drawType){void}

modules/snippets/graphicalSelect/model.js, line 180
Creates a draw interaction and adds it to the map.
Name Type Description
id String of the caller
drawType String drawing type (Box | Circle | Polygon)
Fires:

featureToGeoJson(feature){object}

modules/snippets/graphicalSelect/model.js, line 263
Converts a feature to a geojson. If the feature geometry is a circle, it is converted to a polygon.
Name Type Description
feature ol.Feature drawn feature

precisionRound(number, precision){Number}

modules/snippets/graphicalSelect/model.js, line 333
Rounds the given number with the given precision.
Name Type Description
number Number to round
precision Number exponent
Returns:
rounded number

resetGeographicSelection(id){void}

modules/snippets/graphicalSelect/model.js, line 162
Sets the selection of the dropdown to the default value
Name Type Description
id String of the caller

resetView(id){void}

modules/snippets/graphicalSelect/model.js, line 280
Used to hide Geometry and Textoverlays if request was unsuccessful for any reason
Name Type Description
id String of the caller
Fires:

roundRadius(radius){String}

modules/snippets/graphicalSelect/model.js, line 362
Rounds the circle radius.
Name Type Description
radius number circle radius
Returns:
rounded radius

setCurrentValue(value){void}

modules/snippets/graphicalSelect/model.js, line 387
Sets the current geographic value for "Box", "Circle" or "Polygon"
Name Type Description
value String the current geographic value

setDrawInteraction(value){void}

modules/snippets/graphicalSelect/model.js, line 403
Sets the drawInteraction - the interaction to draw a square, circle or polygon
Name Type Description
value * interavtion to draw

setDrawInteractionListener(interaction, layer){void}

modules/snippets/graphicalSelect/model.js, line 235
Sets listeners for draw interaction events. On "drawend" the selected area is stored as geoJSON in the model-property "selectedAreaGeoJson".
Name Type Description
interaction ol.interaction.Draw Interaction for drawing feature geometries.
layer ol.layer.Vector Vector data that is rendered client-side

setDropDownSnippet(value){void}

modules/snippets/graphicalSelect/model.js, line 395
Sets the model of the underlying dropdown
Name Type Description
value * model

setSelectedAreaGeoJson(value){void}

modules/snippets/graphicalSelect/model.js, line 411
Sets the selected area as GeoJSON
Name Type Description
value * selected area as GeoJSON

setStatus(id, value){void}

modules/snippets/graphicalSelect/model.js, line 137
Handles (de-)activation of this Tool
Name Type Description
id String of the caller
value boolean flag if tool is active
Fires:

showOverlayOnSketch(radius, coords){void}

modules/snippets/graphicalSelect/model.js, line 301
Calculates the circle radius and places the circle overlay on geometry change.
Name Type Description
radius number circle radius
coords Array.<number> point coordinate

showTooltipOverlay(evt){void}

modules/snippets/graphicalSelect/model.js, line 313
Shows tooltips at position of the event.
Name Type Description
evt * of the pointermove

snapRadiusToInterval(coordinates, opt_geom){*}

modules/snippets/graphicalSelect/model.js, line 217
If drawtype == "Circle" set the radius to the circle-geometry
Name Type Description
coordinates * array of coordinates to get the radius from
opt_geom * optional existing geometry
Returns:
optional existing geometry or a circle geometry

toggleOverlay(type, overlay){void}

modules/snippets/graphicalSelect/model.js, line 348
Adds or removes the circle overlay from the map.
Name Type Description
type String geometry type
overlay ol.Overlay circleOverlay
Fires: