qwc2 2025.10.13 → 2025.10.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (241) hide show
  1. package/actions/display.js +30 -1
  2. package/actions/editing.js +22 -1
  3. package/actions/layerinfo.js +13 -1
  4. package/actions/layers.js +213 -3
  5. package/actions/localConfig.js +58 -1
  6. package/actions/locale.js +21 -1
  7. package/actions/locate.js +26 -1
  8. package/actions/logging.js +10 -1
  9. package/actions/map.js +105 -2
  10. package/actions/measurement.js +12 -1
  11. package/actions/processNotifications.js +37 -1
  12. package/actions/redlining.js +18 -1
  13. package/actions/redliningPick.js +12 -1
  14. package/actions/search.js +12 -1
  15. package/actions/serviceinfo.js +12 -1
  16. package/actions/task.js +55 -3
  17. package/actions/theme.js +339 -19
  18. package/actions/windows.js +164 -5
  19. package/components/AppMenu.js +435 -3
  20. package/components/AttributeForm.js +928 -32
  21. package/components/AttributeTableWidget.js +1105 -13
  22. package/components/AutoEditForm.js +189 -3
  23. package/components/CoordinateDisplayer.js +78 -2
  24. package/components/EditComboField.js +190 -6
  25. package/components/EditUploadField.js +315 -3
  26. package/components/ExportSelection.js +203 -2
  27. package/components/FullscreenSwitcher.js +90 -3
  28. package/components/Icon.js +81 -2
  29. package/components/IdentifyViewer.js +1161 -6
  30. package/components/ImportLayer.js +718 -20
  31. package/components/LayerInfoWindow.js +145 -2
  32. package/components/LinkFeatureForm.js +246 -5
  33. package/components/MapButton.js +88 -2
  34. package/components/MapSelection.js +287 -8
  35. package/components/MessageBar.js +68 -2
  36. package/components/NumericInputWindow.js +359 -2
  37. package/components/PickFeature.js +266 -2
  38. package/components/PluginsContainer.js +227 -8
  39. package/components/PrintSelection.js +620 -49
  40. package/components/ProcessNotifications.js +104 -2
  41. package/components/QtDesignerForm.js +1137 -18
  42. package/components/ResizeableWindow.js +591 -8
  43. package/components/SearchBox.js +1307 -20
  44. package/components/ServiceInfoWindow.js +107 -2
  45. package/components/SideBar.js +204 -4
  46. package/components/StandardApp.js +381 -20
  47. package/components/Swipeable.js +15 -1
  48. package/components/TaskBar.js +85 -2
  49. package/components/ThemeLayersListWindow.js +216 -4
  50. package/components/ThemeList.js +381 -7
  51. package/components/Toolbar.js +106 -2
  52. package/components/WindowManager.js +178 -2
  53. package/components/map/OlLayer.js +257 -6
  54. package/components/map/OlMap.js +405 -5
  55. package/components/map/layers/BingLayer.js +31 -2
  56. package/components/map/layers/GoogleLayer.js +222 -19
  57. package/components/map/layers/GraticuleLayer.js +21 -1
  58. package/components/map/layers/ImageLayer.js +15 -1
  59. package/components/map/layers/MVTLayer.js +52 -2
  60. package/components/map/layers/OSMLayer.js +24 -2
  61. package/components/map/layers/OverlayLayer.js +55 -3
  62. package/components/map/layers/VectorLayer.js +173 -8
  63. package/components/map/layers/WFSLayer.js +220 -6
  64. package/components/map/layers/WMSLayer.js +180 -6
  65. package/components/map/layers/WMTSLayer.js +67 -3
  66. package/components/map/layers/XYZLayer.js +24 -2
  67. package/components/map/layers/index.js +28 -1
  68. package/components/map3d/EditDataset3D.js +190 -3
  69. package/components/map3d/HeightProfile3D.js +402 -3
  70. package/components/map3d/ImportObjects3D.js +162 -2
  71. package/components/map3d/Map3D.js +1304 -38
  72. package/components/map3d/MapControls3D.js +392 -7
  73. package/components/map3d/SearchField3D.js +183 -11
  74. package/components/map3d/View3DSwitcher.js +98 -2
  75. package/components/map3d/drawtool/CreateTool3D.js +174 -4
  76. package/components/map3d/drawtool/EditTool3D.js +590 -6
  77. package/components/map3d/drawtool/NumericInput3D.js +336 -4
  78. package/components/map3d/layers/GeoTIFFLayer3D.js +15 -1
  79. package/components/map3d/layers/VectorLayer3D.js +53 -2
  80. package/components/map3d/layers/WFSLayer3D.js +109 -3
  81. package/components/map3d/layers/WMSLayer3D.js +70 -2
  82. package/components/map3d/layers/WMTSLayer3D.js +27 -3
  83. package/components/map3d/layers/index.js +14 -1
  84. package/components/map3d/utils/FirstPersonControls3D.js +423 -16
  85. package/components/map3d/utils/MiscUtils3D.js +221 -13
  86. package/components/map3d/utils/OrbitControls3D.js +176 -5
  87. package/components/map3d/utils/Tiles3DStyle.js +238 -9
  88. package/components/share/ShareLink.js +54 -2
  89. package/components/share/ShareQRCode.js +62 -2
  90. package/components/share/ShareSocials.js +125 -3
  91. package/components/timeline/FixedTimeline.js +236 -5
  92. package/components/timeline/InfiniteTimeline.js +347 -8
  93. package/components/timeline/TimelineFeaturesSlider.js +439 -5
  94. package/components/widgets/AccordeonWidget.js +96 -2
  95. package/components/widgets/ButtonBar.js +124 -2
  96. package/components/widgets/ColorButton.js +201 -3
  97. package/components/widgets/ComboBox.js +166 -2
  98. package/components/widgets/CopyButton.js +110 -2
  99. package/components/widgets/DateTimeInput.js +100 -3
  100. package/components/widgets/EditableSelect.js +230 -3
  101. package/components/widgets/FileSelector.js +128 -4
  102. package/components/widgets/Input.js +124 -2
  103. package/components/widgets/InputContainer.js +96 -2
  104. package/components/widgets/LayerCatalogWidget.js +219 -3
  105. package/components/widgets/MenuButton.js +157 -1
  106. package/components/widgets/ModalDialog.js +64 -2
  107. package/components/widgets/NavBar.js +119 -2
  108. package/components/widgets/NumberInput.js +226 -4
  109. package/components/widgets/PopupMenu.js +72 -1
  110. package/components/widgets/Primitives.js +6 -1
  111. package/components/widgets/ReCaptchaWidget.js +55 -1
  112. package/components/widgets/SearchWidget.js +255 -2
  113. package/components/widgets/Spinner.js +44 -2
  114. package/components/widgets/SuggestionInput.js +77 -2
  115. package/components/widgets/TextInput.js +308 -2
  116. package/components/widgets/ToggleSwitch.js +85 -2
  117. package/components/widgets/VectorLayerPicker.js +85 -3
  118. package/libs/openlayers.js +225 -5
  119. package/package.json +1 -1
  120. package/plugins/API.js +358 -15
  121. package/plugins/AttributeTable.js +109 -3
  122. package/plugins/Authentication.js +130 -5
  123. package/plugins/BackgroundSwitcher.js +218 -4
  124. package/plugins/Bookmark.js +289 -3
  125. package/plugins/BottomBar.js +298 -4
  126. package/plugins/CookiePopup.js +67 -3
  127. package/plugins/Cyclomedia.js +442 -5
  128. package/plugins/Editing.js +497 -9
  129. package/plugins/FeatureForm.js +366 -4
  130. package/plugins/FeatureSearch.js +458 -3
  131. package/plugins/GeometryDigitizer.js +664 -7
  132. package/plugins/HeightProfile.js +768 -15
  133. package/plugins/Help.js +102 -3
  134. package/plugins/HomeButton.js +80 -3
  135. package/plugins/Identify.js +543 -5
  136. package/plugins/LayerCatalog.js +215 -4
  137. package/plugins/LayerTree.js +1194 -6
  138. package/plugins/LocateButton.js +94 -3
  139. package/plugins/Map.js +320 -16
  140. package/plugins/MapCompare.js +94 -3
  141. package/plugins/MapCopyright.js +127 -5
  142. package/plugins/MapExport.js +613 -20
  143. package/plugins/MapFilter.js +868 -12
  144. package/plugins/MapInfoTooltip.js +277 -3
  145. package/plugins/MapLegend.js +253 -4
  146. package/plugins/MapTip.js +290 -4
  147. package/plugins/Measure.js +220 -4
  148. package/plugins/NewsPopup.js +137 -3
  149. package/plugins/OverviewMap.js +167 -7
  150. package/plugins/Panoramax.js +340 -2
  151. package/plugins/Portal.js +199 -4
  152. package/plugins/Print.js +1231 -15
  153. package/plugins/Redlining.js +750 -6
  154. package/plugins/Reports.js +332 -3
  155. package/plugins/Routing.js +1278 -15
  156. package/plugins/ScratchDrawing.js +173 -5
  157. package/plugins/Settings.js +241 -4
  158. package/plugins/Share.js +198 -3
  159. package/plugins/StartupMarker.js +84 -4
  160. package/plugins/TaskButton.js +88 -3
  161. package/plugins/ThemeSwitcher.js +164 -4
  162. package/plugins/TimeManager.js +971 -10
  163. package/plugins/TopBar.js +300 -7
  164. package/plugins/TourGuide.js +213 -2
  165. package/plugins/ValueTool.js +419 -4
  166. package/plugins/View3D.js +519 -14
  167. package/plugins/ZoomButtons.js +165 -3
  168. package/plugins/map/EditingSupport.js +199 -7
  169. package/plugins/map/LocateSupport.js +260 -4
  170. package/plugins/map/MeasurementSupport.js +216 -8
  171. package/plugins/map/RedliningPickSupport.js +201 -7
  172. package/plugins/map/RedliningSupport.js +726 -17
  173. package/plugins/map/SnapInteraction.js +101 -1
  174. package/plugins/map/SnapSupport.js +210 -2
  175. package/plugins/map/SnappingSupport.js +356 -17
  176. package/plugins/map3d/BackgroundSwitcher3D.js +44 -3
  177. package/plugins/map3d/BottomBar3D.js +118 -3
  178. package/plugins/map3d/Compare3D.js +422 -8
  179. package/plugins/map3d/Draw3D.js +353 -6
  180. package/plugins/map3d/ExportObjects3D.js +393 -18
  181. package/plugins/map3d/HideObjects3D.js +313 -12
  182. package/plugins/map3d/Identify3D.js +283 -12
  183. package/plugins/map3d/LayerTree3D.js +323 -3
  184. package/plugins/map3d/MapCopyright3D.js +128 -5
  185. package/plugins/map3d/MapExport3D.js +590 -10
  186. package/plugins/map3d/MapLight3D.js +553 -6
  187. package/plugins/map3d/Measure3D.js +571 -20
  188. package/plugins/map3d/OverviewMap3D.js +169 -3
  189. package/plugins/map3d/Settings3D.js +73 -3
  190. package/plugins/map3d/TopBar3D.js +207 -9
  191. package/plugins/redlining/RedliningBufferSupport.js +206 -3
  192. package/reducers/display.js +34 -2
  193. package/reducers/editing.js +68 -3
  194. package/reducers/index.js +9 -1
  195. package/reducers/layerinfo.js +26 -2
  196. package/reducers/layers.js +456 -9
  197. package/reducers/localConfig.js +122 -2
  198. package/reducers/locale.js +38 -2
  199. package/reducers/locate.js +40 -2
  200. package/reducers/map.js +176 -5
  201. package/reducers/measurement.js +42 -2
  202. package/reducers/processNotifications.js +49 -2
  203. package/reducers/redlining.js +50 -2
  204. package/reducers/redliningPick.js +27 -2
  205. package/reducers/search.js +20 -1
  206. package/reducers/serviceinfo.js +25 -2
  207. package/reducers/task.js +45 -2
  208. package/reducers/theme.js +51 -2
  209. package/reducers/windows.js +203 -2
  210. package/scripts/dist.sh +1 -1
  211. package/scripts/gen-plugin-docs.js +152 -2
  212. package/scripts/makeIconkit.js +85 -6
  213. package/scripts/themesConfig.js +742 -40
  214. package/scripts/updateTranslations.js +251 -10
  215. package/selectors/searchproviders.js +44 -2
  216. package/stores/StandardStore.js +42 -2
  217. package/utils/ConfigUtils.js +84 -3
  218. package/utils/CoordinatesUtils.js +234 -23
  219. package/utils/DxfUtils.js +237 -11
  220. package/utils/EditingInterface.js +421 -87
  221. package/utils/EditingUtils.js +357 -13
  222. package/utils/ElevationInterface.js +83 -22
  223. package/utils/FeatureStyles.js +429 -5
  224. package/utils/IdentifyUtils.js +443 -7
  225. package/utils/ImageEditor.js +79 -9
  226. package/utils/LayerUtils.js +1516 -50
  227. package/utils/LocaleUtils.js +117 -7
  228. package/utils/MapUtils.js +241 -59
  229. package/utils/MeasureUtils.js +323 -2
  230. package/utils/MiscUtils.js +189 -11
  231. package/utils/PermaLinkUtils.js +429 -6
  232. package/utils/PluginStore.js +27 -1
  233. package/utils/ResourceRegistry.js +15 -1
  234. package/utils/RoutingInterface.js +307 -7
  235. package/utils/SearchProviders.js +722 -19
  236. package/utils/ServiceLayerUtils.js +669 -14
  237. package/utils/Signal.js +32 -2
  238. package/utils/ThemeUtils.js +341 -7
  239. package/utils/VectorLayerUtils.js +589 -15
  240. package/utils/expr_grammar/grammar.js +2239 -2
  241. package/utils/expr_grammar/test.js +65 -3
@@ -1,10 +1,434 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o},_typeof(o)}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,o)}return t}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))})}return e}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+""}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}/**
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ /**
2
8
  * Copyright 2017-2024 Sourcepole AG
3
9
  * All rights reserved.
4
10
  *
5
11
  * This source code is licensed under the BSD-style license found in the
6
12
  * LICENSE file in the root directory of this source tree.
7
- */import ol from"openlayers";import minus from"../icons/minus.svg";import plus from"../icons/plus.svg";import ConfigUtils from"./ConfigUtils";import ResourceRegistry from"./ResourceRegistry";import arrowhead from"./img/arrowhead.svg";import markerIcon from"./img/marker-icon.png";import measurehead from"./img/measurehead.svg";ResourceRegistry.addResource("arrowhead",arrowhead);ResourceRegistry.addResource("measurehead",measurehead);ResourceRegistry.addResource("marker",markerIcon);ResourceRegistry.addResource("minus",minus);ResourceRegistry.addResource("plus",plus);var DEFAULT_FEATURE_STYLE={strokeColor:[0,0,255,1],strokeWidth:1,strokeDash:[4],fillColor:[255,0,255,0.33],circleRadius:10,textFill:"black",textStroke:"white",textFont:"11pt sans-serif"};var DEFAULT_MARKER_STYLE={iconAnchor:[0.5,1],opacity:1,iconSrc:markerIcon,color:undefined,scale:undefined,crossOrigin:undefined,textColor:"#000000",textStroke:"#FFFFFF"};var DEFAULT_INTERACTION_STYLE={fillColor:[255,0,0,0.5],strokeColor:"red",strokeWidth:1.5,vertexFillColor:"white",vertexStrokeColor:"red",snapFillColor:[255,255,255,0.05],snapStrokeColor:"#3399CC",snapStrokeWidth:1,snapVertexFillColor:[255,255,255,0.05],snapVertexStrokeColor:"#3399CC",measureFillColor:[255,0,0,0.25],measureStrokeColor:"red",measureStrokeWidth:4,measureVertexFillColor:"white",measureVertexStrokeColor:"red",measureVertexStrokeWidth:2,measurePointRadius:6,sketchPointFillColor:"#0099FF",sketchPointStrokeColor:"white",sketchPointRadius:6,printStrokeColor:"#3399CC",printStrokeWidth:3,printVertexColor:"#FFFFFF",printVertexRadius:6,printBackgroundColor:[0,0,0,0.5]};export var END_MARKERS={OUTARROW:{src:arrowhead,anchor:[0.05,0.5],baserotation:0},INARROW:{src:arrowhead,anchor:[0.05,0.5],baserotation:180},LINE:{src:measurehead,anchor:[0.05,0.5],baserotation:0}};export function computeFeatureStyle(layer,feature){return _objectSpread(_objectSpread(_objectSpread(_objectSpread({},DEFAULT_FEATURE_STYLE),ConfigUtils.getConfigProp("defaultFeatureStyle")),layer.styleOptions),feature.styleOptions)}var defaultStyle=function defaultStyle(feature,options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_FEATURE_STYLE),ConfigUtils.getConfigProp("defaultFeatureStyle")),options);var styles=[];styles.push(new ol.style.Style({fill:new ol.style.Fill({color:opts.fillColor}),stroke:new ol.style.Stroke({color:opts.strokeColor,width:opts.strokeWidth,lineDash:opts.strokeDash}),image:opts.circleRadius>0?new ol.style.Circle({radius:opts.circleRadius,fill:new ol.style.Fill({color:opts.fillColor}),stroke:new ol.style.Stroke({color:opts.strokeColor,width:opts.strokeWidth})}):null}));if(feature.getProperties().label){styles.push(new ol.style.Style({geometry:function geometry(f){if(f.getGeometry().getType().startsWith("Multi")){// Only label middle point
8
- var extent=f.getGeometry().getExtent();return new ol.geom.Point(f.getGeometry().getClosestPoint(ol.extent.getCenter(extent)))}return f.getGeometry()},text:new ol.style.Text({font:opts.textFont||"11pt sans-serif",text:feature.getProperties().label||"",overflow:true,fill:new ol.style.Fill({color:opts.textFill}),stroke:new ol.style.Stroke({color:opts.textStroke,width:3}),textAlign:feature.getGeometry().getType()==="Point"?"left":"center",textBaseline:feature.getGeometry().getType()==="Point"?"bottom":"middle",offsetX:feature.getGeometry().getType()==="Point"?5+opts.circleRadius:0})}))}if(feature.getProperties().segment_labels){var segmentLabels=feature.getProperties().segment_labels;var coo=feature.getGeometry().getCoordinates();for(var i=0;i<coo.length-1;++i){var p1=coo[i];var p2=coo[i+1];var angle=-Math.atan2(p2[1]-p1[1],p2[0]-p1[0]);while(angle<-0.5*Math.PI){angle+=Math.PI}while(angle>0.5*Math.PI){angle-=Math.PI}styles.push(new ol.style.Style({geometry:new ol.geom.Point([0.5*(p1[0]+p2[0]),0.5*(p1[1]+p2[1])]),text:new ol.style.Text({font:opts.textFont||"11pt sans-serif",text:segmentLabels[i],fill:new ol.style.Fill({color:opts.textFill}),stroke:new ol.style.Stroke({color:opts.textStroke,width:3}),rotation:angle,offsetY:10})}))}}if(feature.getGeometry().getType()==="LineString"&&opts.headmarker in END_MARKERS){var _p=feature.getGeometry().getCoordinates()[0];var _p2=feature.getGeometry().getCoordinates()[1];var rotation=0.5*Math.PI+Math.atan2(_p[0]-_p2[0],_p[1]-_p2[1]);styles.push(new ol.style.Style({geometry:new ol.geom.Point(_p),image:new ol.style.Icon(_objectSpread(_objectSpread({},END_MARKERS[opts.headmarker]),{},{anchorXUnits:"fraction",anchorYUnits:"fraction",color:opts.strokeColor,rotation:END_MARKERS[opts.headmarker].baserotation/180*Math.PI+rotation,scale:0.125*(1+opts.strokeWidth)// Also update in VectorLayerUtils.generateMarkerGeometry
9
- }))}))}if(feature.getGeometry().getType()==="LineString"&&opts.tailmarker in END_MARKERS){var l=feature.getGeometry().getCoordinates().length;var _p3=feature.getGeometry().getCoordinates()[l-1];var _p4=feature.getGeometry().getCoordinates()[l-2];var _rotation=0.5*Math.PI+Math.atan2(_p3[0]-_p4[0],_p3[1]-_p4[1]);styles.push(new ol.style.Style({geometry:new ol.geom.Point(_p3),image:new ol.style.Icon(_objectSpread(_objectSpread({},END_MARKERS[opts.tailmarker]),{},{anchorXUnits:"fraction",anchorYUnits:"fraction",color:opts.strokeColor,rotation:END_MARKERS[opts.tailmarker].baserotation/180*Math.PI+_rotation,scale:0.125*(1+opts.strokeWidth)// Also update in VectorLayerUtils.generateMarkerGeometry
10
- }))}))}return styles};export default{"default":defaultStyle,marker:function marker(feature,options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_MARKER_STYLE),ConfigUtils.getConfigProp("defaultMarkerStyle")),options);return[new ol.style.Style({image:new ol.style.Icon({anchor:opts.iconAnchor,anchorXUnits:"fraction",anchorYUnits:"fraction",opacity:opts.opacity,crossOrigin:opts.crossOrigin,src:opts.iconSrc,scale:opts.scale,color:opts.color}),text:new ol.style.Text({font:opts.textFont||"11pt sans-serif",text:feature.getProperties().label||"",offsetY:8,fill:new ol.style.Fill({color:opts.textColor}),stroke:new ol.style.Stroke({color:opts.textStroke,width:3})})})]},interaction:function interaction(options,isSnap){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);var fillColor=opts.fillColor;var strokeColor=opts.strokeColor;var strokeWidth=opts.strokeWidth;if(isSnap){fillColor=opts.snapFillColor;strokeColor=opts.snapStrokeColor;strokeWidth=opts.snapStrokeWidth}return new ol.style.Style({fill:new ol.style.Fill({color:fillColor}),stroke:new ol.style.Stroke({color:strokeColor,width:strokeWidth})})},interactionVertex:function interactionVertex(options,isSnap){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);var strokeWidth=opts.strokeWidth;var vertexFill=opts.vertexFillColor;var vertexStroke=opts.vertexStrokeColor;if(isSnap){strokeWidth=opts.snapStrokeWidth;vertexFill=opts.snapVertexFillColor;vertexStroke=opts.snapVertexStrokeColor}return new ol.style.Style({image:options.img?new ol.style.Icon({src:ResourceRegistry.getResource(options.img),rotation:options.rotation,anchor:[0.5,1],imgSize:options.size,rotateWithView:true}):new ol.style.RegularShape({fill:new ol.style.Fill({color:vertexFill}),stroke:new ol.style.Stroke({color:vertexStroke,width:strokeWidth}),points:4,radius:5,angle:Math.PI/4}),geometry:opts.geometryFunction})},measureInteraction:function measureInteraction(feature,options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);var styleOptions={strokeColor:opts.measureStrokeColor,strokeWidth:opts.measureStrokeWidth,fillColor:opts.measureFillColor,headmarker:opts.headmarker,tailmarker:opts.tailmarker,strokeDash:[]};return defaultStyle(feature,styleOptions)},measureInteractionVertex:function measureInteractionVertex(options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);return new ol.style.Style({image:new ol.style.Circle({radius:opts.measurePointRadius,fill:new ol.style.Fill({color:opts.measureVertexFillColor}),stroke:new ol.style.Stroke({color:opts.measureVertexStrokeColor,width:opts.measureVertexStrokeWidth})}),geometry:opts.geometryFunction})},sketchInteraction:function sketchInteraction(options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);return new ol.style.Style({image:new ol.style.Circle({fill:new ol.style.Fill({color:opts.sketchPointFillColor}),stroke:new ol.style.Stroke({color:opts.sketchPointStrokeColor,width:opts.strokeWidth}),radius:opts.sketchPointRadius})})},printInteraction:function printInteraction(options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);return new ol.style.Style({geometry:opts.geometryFunction,fill:new ol.style.Fill({color:[0,0,0,0]}),stroke:new ol.style.Stroke({color:opts.printStrokeColor,width:opts.printStrokeWidth})})},printInteractionVertex:function printInteractionVertex(options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);return new ol.style.Style({geometry:opts.geometryFunction,image:new ol.style.Circle({radius:opts.printVertexRadius,fill:new ol.style.Fill({color:opts.fill?opts.printStrokeColor:opts.printVertexColor}),stroke:new ol.style.Stroke({color:opts.printStrokeColor,width:opts.printStrokeWidth})})})},printInteractionBackground:function printInteractionBackground(options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);return new ol.style.Style({geometry:opts.geometryFunction,fill:new ol.style.Fill({color:opts.printBackgroundColor})})},printInteractionSeries:function printInteractionSeries(options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);return new ol.style.Style({geometry:opts.geometryFunction,stroke:new ol.style.Stroke({color:opts.printStrokeColor,width:opts.printStrokeWidth})})},printInteractionSeriesIcon:function printInteractionSeriesIcon(options){var opts=_objectSpread(_objectSpread(_objectSpread({},DEFAULT_INTERACTION_STYLE),ConfigUtils.getConfigProp("defaultInteractionStyle")),options);return[new ol.style.Style({geometry:opts.geometryFunction,image:new ol.style.Circle({radius:20*opts.radius,fill:new ol.style.Fill({color:opts.printVertexColor}),stroke:new ol.style.Stroke({color:opts.printStrokeColor,width:opts.printStrokeWidth})})}),new ol.style.Style({geometry:opts.geometryFunction,image:new ol.style.Icon({src:ResourceRegistry.getResource(opts.img),opacity:0.5,rotation:opts.rotation,scale:opts.radius,rotateWithView:true})})]},image:function image(feature,options){return new ol.style.Style({image:new ol.style.Icon({src:ResourceRegistry.getResource(options.img),rotation:options.rotation,anchor:options.anchor,imgSize:options.size,rotateWithView:true})})},text:function text(feature,options){return[new ol.style.Style({text:new ol.style.Text({font:"10pt sans-serif",text:feature.getProperties().label||"",rotation:feature.getProperties().rotation||0,scale:options.strokeWidth,fill:new ol.style.Fill({color:options.fillColor}),stroke:new ol.style.Stroke({color:options.strokeColor,width:2})})})]}};
13
+ */
14
+
15
+ import ol from 'openlayers';
16
+ import minus from '../icons/minus.svg';
17
+ import plus from '../icons/plus.svg';
18
+ import ConfigUtils from './ConfigUtils';
19
+ import ResourceRegistry from './ResourceRegistry';
20
+ import arrowhead from './img/arrowhead.svg';
21
+ import markerIcon from './img/marker-icon.png';
22
+ import measurehead from './img/measurehead.svg';
23
+ ResourceRegistry.addResource('arrowhead', arrowhead);
24
+ ResourceRegistry.addResource('measurehead', measurehead);
25
+ ResourceRegistry.addResource('marker', markerIcon);
26
+ ResourceRegistry.addResource('minus', minus);
27
+ ResourceRegistry.addResource('plus', plus);
28
+ var DEFAULT_FEATURE_STYLE = {
29
+ strokeColor: [0, 0, 255, 1],
30
+ strokeWidth: 1,
31
+ strokeDash: [4],
32
+ fillColor: [255, 0, 255, 0.33],
33
+ circleRadius: 10,
34
+ textFill: "black",
35
+ textStroke: "white",
36
+ textFont: "11pt sans-serif"
37
+ };
38
+ var DEFAULT_MARKER_STYLE = {
39
+ iconAnchor: [0.5, 1],
40
+ opacity: 1,
41
+ iconSrc: markerIcon,
42
+ color: undefined,
43
+ scale: undefined,
44
+ crossOrigin: undefined,
45
+ textColor: '#000000',
46
+ textStroke: '#FFFFFF'
47
+ };
48
+ var DEFAULT_INTERACTION_STYLE = {
49
+ fillColor: [255, 0, 0, 0.5],
50
+ strokeColor: "red",
51
+ strokeWidth: 1.5,
52
+ vertexFillColor: "white",
53
+ vertexStrokeColor: "red",
54
+ snapFillColor: [255, 255, 255, 0.05],
55
+ snapStrokeColor: '#3399CC',
56
+ snapStrokeWidth: 1,
57
+ snapVertexFillColor: [255, 255, 255, 0.05],
58
+ snapVertexStrokeColor: '#3399CC',
59
+ measureFillColor: [255, 0, 0, 0.25],
60
+ measureStrokeColor: "red",
61
+ measureStrokeWidth: 4,
62
+ measureVertexFillColor: "white",
63
+ measureVertexStrokeColor: "red",
64
+ measureVertexStrokeWidth: 2,
65
+ measurePointRadius: 6,
66
+ sketchPointFillColor: "#0099FF",
67
+ sketchPointStrokeColor: "white",
68
+ sketchPointRadius: 6,
69
+ printStrokeColor: '#3399CC',
70
+ printStrokeWidth: 3,
71
+ printVertexColor: '#FFFFFF',
72
+ printVertexRadius: 6,
73
+ printBackgroundColor: [0, 0, 0, 0.5]
74
+ };
75
+ export var END_MARKERS = {
76
+ OUTARROW: {
77
+ src: arrowhead,
78
+ anchor: [0.05, 0.5],
79
+ baserotation: 0
80
+ },
81
+ INARROW: {
82
+ src: arrowhead,
83
+ anchor: [0.05, 0.5],
84
+ baserotation: 180
85
+ },
86
+ LINE: {
87
+ src: measurehead,
88
+ anchor: [0.05, 0.5],
89
+ baserotation: 0
90
+ }
91
+ };
92
+ export function computeFeatureStyle(layer, feature) {
93
+ return _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, DEFAULT_FEATURE_STYLE), ConfigUtils.getConfigProp("defaultFeatureStyle")), layer.styleOptions), feature.styleOptions);
94
+ }
95
+ var defaultStyle = function defaultStyle(feature, options) {
96
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_FEATURE_STYLE), ConfigUtils.getConfigProp("defaultFeatureStyle")), options);
97
+ var styles = [];
98
+ styles.push(new ol.style.Style({
99
+ fill: new ol.style.Fill({
100
+ color: opts.fillColor
101
+ }),
102
+ stroke: new ol.style.Stroke({
103
+ color: opts.strokeColor,
104
+ width: opts.strokeWidth,
105
+ lineDash: opts.strokeDash
106
+ }),
107
+ image: opts.circleRadius > 0 ? new ol.style.Circle({
108
+ radius: opts.circleRadius,
109
+ fill: new ol.style.Fill({
110
+ color: opts.fillColor
111
+ }),
112
+ stroke: new ol.style.Stroke({
113
+ color: opts.strokeColor,
114
+ width: opts.strokeWidth
115
+ })
116
+ }) : null
117
+ }));
118
+ if (feature.getProperties().label) {
119
+ styles.push(new ol.style.Style({
120
+ geometry: function geometry(f) {
121
+ if (f.getGeometry().getType().startsWith("Multi")) {
122
+ // Only label middle point
123
+ var extent = f.getGeometry().getExtent();
124
+ return new ol.geom.Point(f.getGeometry().getClosestPoint(ol.extent.getCenter(extent)));
125
+ }
126
+ return f.getGeometry();
127
+ },
128
+ text: new ol.style.Text({
129
+ font: opts.textFont || '11pt sans-serif',
130
+ text: feature.getProperties().label || "",
131
+ overflow: true,
132
+ fill: new ol.style.Fill({
133
+ color: opts.textFill
134
+ }),
135
+ stroke: new ol.style.Stroke({
136
+ color: opts.textStroke,
137
+ width: 3
138
+ }),
139
+ textAlign: feature.getGeometry().getType() === "Point" ? 'left' : 'center',
140
+ textBaseline: feature.getGeometry().getType() === "Point" ? 'bottom' : 'middle',
141
+ offsetX: feature.getGeometry().getType() === "Point" ? 5 + opts.circleRadius : 0
142
+ })
143
+ }));
144
+ }
145
+ if (feature.getProperties().segment_labels) {
146
+ var segmentLabels = feature.getProperties().segment_labels;
147
+ var coo = feature.getGeometry().getCoordinates();
148
+ for (var i = 0; i < coo.length - 1; ++i) {
149
+ var p1 = coo[i];
150
+ var p2 = coo[i + 1];
151
+ var angle = -Math.atan2(p2[1] - p1[1], p2[0] - p1[0]);
152
+ while (angle < -0.5 * Math.PI) {
153
+ angle += Math.PI;
154
+ }
155
+ while (angle > 0.5 * Math.PI) {
156
+ angle -= Math.PI;
157
+ }
158
+ styles.push(new ol.style.Style({
159
+ geometry: new ol.geom.Point([0.5 * (p1[0] + p2[0]), 0.5 * (p1[1] + p2[1])]),
160
+ text: new ol.style.Text({
161
+ font: opts.textFont || '11pt sans-serif',
162
+ text: segmentLabels[i],
163
+ fill: new ol.style.Fill({
164
+ color: opts.textFill
165
+ }),
166
+ stroke: new ol.style.Stroke({
167
+ color: opts.textStroke,
168
+ width: 3
169
+ }),
170
+ rotation: angle,
171
+ offsetY: 10
172
+ })
173
+ }));
174
+ }
175
+ }
176
+ if (feature.getGeometry().getType() === "LineString" && opts.headmarker in END_MARKERS) {
177
+ var _p = feature.getGeometry().getCoordinates()[0];
178
+ var _p2 = feature.getGeometry().getCoordinates()[1];
179
+ var rotation = 0.5 * Math.PI + Math.atan2(_p[0] - _p2[0], _p[1] - _p2[1]);
180
+ styles.push(new ol.style.Style({
181
+ geometry: new ol.geom.Point(_p),
182
+ image: new ol.style.Icon(_objectSpread(_objectSpread({}, END_MARKERS[opts.headmarker]), {}, {
183
+ anchorXUnits: 'fraction',
184
+ anchorYUnits: 'fraction',
185
+ color: opts.strokeColor,
186
+ rotation: END_MARKERS[opts.headmarker].baserotation / 180 * Math.PI + rotation,
187
+ scale: 0.125 * (1 + opts.strokeWidth) // Also update in VectorLayerUtils.generateMarkerGeometry
188
+ }))
189
+ }));
190
+ }
191
+ if (feature.getGeometry().getType() === "LineString" && opts.tailmarker in END_MARKERS) {
192
+ var l = feature.getGeometry().getCoordinates().length;
193
+ var _p3 = feature.getGeometry().getCoordinates()[l - 1];
194
+ var _p4 = feature.getGeometry().getCoordinates()[l - 2];
195
+ var _rotation = 0.5 * Math.PI + Math.atan2(_p3[0] - _p4[0], _p3[1] - _p4[1]);
196
+ styles.push(new ol.style.Style({
197
+ geometry: new ol.geom.Point(_p3),
198
+ image: new ol.style.Icon(_objectSpread(_objectSpread({}, END_MARKERS[opts.tailmarker]), {}, {
199
+ anchorXUnits: 'fraction',
200
+ anchorYUnits: 'fraction',
201
+ color: opts.strokeColor,
202
+ rotation: END_MARKERS[opts.tailmarker].baserotation / 180 * Math.PI + _rotation,
203
+ scale: 0.125 * (1 + opts.strokeWidth) // Also update in VectorLayerUtils.generateMarkerGeometry
204
+ }))
205
+ }));
206
+ }
207
+ return styles;
208
+ };
209
+ export default {
210
+ "default": defaultStyle,
211
+ marker: function marker(feature, options) {
212
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_MARKER_STYLE), ConfigUtils.getConfigProp("defaultMarkerStyle")), options);
213
+ return [new ol.style.Style({
214
+ image: new ol.style.Icon({
215
+ anchor: opts.iconAnchor,
216
+ anchorXUnits: 'fraction',
217
+ anchorYUnits: 'fraction',
218
+ opacity: opts.opacity,
219
+ crossOrigin: opts.crossOrigin,
220
+ src: opts.iconSrc,
221
+ scale: opts.scale,
222
+ color: opts.color
223
+ }),
224
+ text: new ol.style.Text({
225
+ font: opts.textFont || '11pt sans-serif',
226
+ text: feature.getProperties().label || "",
227
+ offsetY: 8,
228
+ fill: new ol.style.Fill({
229
+ color: opts.textColor
230
+ }),
231
+ stroke: new ol.style.Stroke({
232
+ color: opts.textStroke,
233
+ width: 3
234
+ })
235
+ })
236
+ })];
237
+ },
238
+ interaction: function interaction(options, isSnap) {
239
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
240
+ var fillColor = opts.fillColor;
241
+ var strokeColor = opts.strokeColor;
242
+ var strokeWidth = opts.strokeWidth;
243
+ if (isSnap) {
244
+ fillColor = opts.snapFillColor;
245
+ strokeColor = opts.snapStrokeColor;
246
+ strokeWidth = opts.snapStrokeWidth;
247
+ }
248
+ return new ol.style.Style({
249
+ fill: new ol.style.Fill({
250
+ color: fillColor
251
+ }),
252
+ stroke: new ol.style.Stroke({
253
+ color: strokeColor,
254
+ width: strokeWidth
255
+ })
256
+ });
257
+ },
258
+ interactionVertex: function interactionVertex(options, isSnap) {
259
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
260
+ var strokeWidth = opts.strokeWidth;
261
+ var vertexFill = opts.vertexFillColor;
262
+ var vertexStroke = opts.vertexStrokeColor;
263
+ if (isSnap) {
264
+ strokeWidth = opts.snapStrokeWidth;
265
+ vertexFill = opts.snapVertexFillColor;
266
+ vertexStroke = opts.snapVertexStrokeColor;
267
+ }
268
+ return new ol.style.Style({
269
+ image: options.img ? new ol.style.Icon({
270
+ src: ResourceRegistry.getResource(options.img),
271
+ rotation: options.rotation,
272
+ anchor: [0.5, 1],
273
+ imgSize: options.size,
274
+ rotateWithView: true
275
+ }) : new ol.style.RegularShape({
276
+ fill: new ol.style.Fill({
277
+ color: vertexFill
278
+ }),
279
+ stroke: new ol.style.Stroke({
280
+ color: vertexStroke,
281
+ width: strokeWidth
282
+ }),
283
+ points: 4,
284
+ radius: 5,
285
+ angle: Math.PI / 4
286
+ }),
287
+ geometry: opts.geometryFunction
288
+ });
289
+ },
290
+ measureInteraction: function measureInteraction(feature, options) {
291
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
292
+ var styleOptions = {
293
+ strokeColor: opts.measureStrokeColor,
294
+ strokeWidth: opts.measureStrokeWidth,
295
+ fillColor: opts.measureFillColor,
296
+ headmarker: opts.headmarker,
297
+ tailmarker: opts.tailmarker,
298
+ strokeDash: []
299
+ };
300
+ return defaultStyle(feature, styleOptions);
301
+ },
302
+ measureInteractionVertex: function measureInteractionVertex(options) {
303
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
304
+ return new ol.style.Style({
305
+ image: new ol.style.Circle({
306
+ radius: opts.measurePointRadius,
307
+ fill: new ol.style.Fill({
308
+ color: opts.measureVertexFillColor
309
+ }),
310
+ stroke: new ol.style.Stroke({
311
+ color: opts.measureVertexStrokeColor,
312
+ width: opts.measureVertexStrokeWidth
313
+ })
314
+ }),
315
+ geometry: opts.geometryFunction
316
+ });
317
+ },
318
+ sketchInteraction: function sketchInteraction(options) {
319
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
320
+ return new ol.style.Style({
321
+ image: new ol.style.Circle({
322
+ fill: new ol.style.Fill({
323
+ color: opts.sketchPointFillColor
324
+ }),
325
+ stroke: new ol.style.Stroke({
326
+ color: opts.sketchPointStrokeColor,
327
+ width: opts.strokeWidth
328
+ }),
329
+ radius: opts.sketchPointRadius
330
+ })
331
+ });
332
+ },
333
+ printInteraction: function printInteraction(options) {
334
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
335
+ return new ol.style.Style({
336
+ geometry: opts.geometryFunction,
337
+ fill: new ol.style.Fill({
338
+ color: [0, 0, 0, 0]
339
+ }),
340
+ stroke: new ol.style.Stroke({
341
+ color: opts.printStrokeColor,
342
+ width: opts.printStrokeWidth
343
+ })
344
+ });
345
+ },
346
+ printInteractionVertex: function printInteractionVertex(options) {
347
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
348
+ return new ol.style.Style({
349
+ geometry: opts.geometryFunction,
350
+ image: new ol.style.Circle({
351
+ radius: opts.printVertexRadius,
352
+ fill: new ol.style.Fill({
353
+ color: opts.fill ? opts.printStrokeColor : opts.printVertexColor
354
+ }),
355
+ stroke: new ol.style.Stroke({
356
+ color: opts.printStrokeColor,
357
+ width: opts.printStrokeWidth
358
+ })
359
+ })
360
+ });
361
+ },
362
+ printInteractionBackground: function printInteractionBackground(options) {
363
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
364
+ return new ol.style.Style({
365
+ geometry: opts.geometryFunction,
366
+ fill: new ol.style.Fill({
367
+ color: opts.printBackgroundColor
368
+ })
369
+ });
370
+ },
371
+ printInteractionSeries: function printInteractionSeries(options) {
372
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
373
+ return new ol.style.Style({
374
+ geometry: opts.geometryFunction,
375
+ stroke: new ol.style.Stroke({
376
+ color: opts.printStrokeColor,
377
+ width: opts.printStrokeWidth
378
+ })
379
+ });
380
+ },
381
+ printInteractionSeriesIcon: function printInteractionSeriesIcon(options) {
382
+ var opts = _objectSpread(_objectSpread(_objectSpread({}, DEFAULT_INTERACTION_STYLE), ConfigUtils.getConfigProp("defaultInteractionStyle")), options);
383
+ return [new ol.style.Style({
384
+ geometry: opts.geometryFunction,
385
+ image: new ol.style.Circle({
386
+ radius: 20 * opts.radius,
387
+ fill: new ol.style.Fill({
388
+ color: opts.printVertexColor
389
+ }),
390
+ stroke: new ol.style.Stroke({
391
+ color: opts.printStrokeColor,
392
+ width: opts.printStrokeWidth
393
+ })
394
+ })
395
+ }), new ol.style.Style({
396
+ geometry: opts.geometryFunction,
397
+ image: new ol.style.Icon({
398
+ src: ResourceRegistry.getResource(opts.img),
399
+ opacity: 0.5,
400
+ rotation: opts.rotation,
401
+ scale: opts.radius,
402
+ rotateWithView: true
403
+ })
404
+ })];
405
+ },
406
+ image: function image(feature, options) {
407
+ return new ol.style.Style({
408
+ image: new ol.style.Icon({
409
+ src: ResourceRegistry.getResource(options.img),
410
+ rotation: options.rotation,
411
+ anchor: options.anchor,
412
+ imgSize: options.size,
413
+ rotateWithView: true
414
+ })
415
+ });
416
+ },
417
+ text: function text(feature, options) {
418
+ return [new ol.style.Style({
419
+ text: new ol.style.Text({
420
+ font: '10pt sans-serif',
421
+ text: feature.getProperties().label || "",
422
+ rotation: feature.getProperties().rotation || 0,
423
+ scale: options.strokeWidth,
424
+ fill: new ol.style.Fill({
425
+ color: options.fillColor
426
+ }),
427
+ stroke: new ol.style.Stroke({
428
+ color: options.strokeColor,
429
+ width: 2
430
+ })
431
+ })
432
+ })];
433
+ }
434
+ };