maplair 4.0.0-alpha.1
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.
- package/CHANGELOG.md +2804 -0
- package/LICENSE +27 -0
- package/README.md +40 -0
- package/dist/esm/Maplair.js +71 -0
- package/dist/esm/Maplair.js.map +1 -0
- package/dist/esm/_virtual/_rolldown/runtime.js +13 -0
- package/dist/esm/control/AttributionControl.js +79 -0
- package/dist/esm/control/AttributionControl.js.map +1 -0
- package/dist/esm/control/Control.js +81 -0
- package/dist/esm/control/Control.js.map +1 -0
- package/dist/esm/control/LayersControl.js +220 -0
- package/dist/esm/control/LayersControl.js.map +1 -0
- package/dist/esm/control/ScaleControl.js +72 -0
- package/dist/esm/control/ScaleControl.js.map +1 -0
- package/dist/esm/control/ZoomControl.js +86 -0
- package/dist/esm/control/ZoomControl.js.map +1 -0
- package/dist/esm/core/Browser.js +31 -0
- package/dist/esm/core/Browser.js.map +1 -0
- package/dist/esm/core/Class.js +52 -0
- package/dist/esm/core/Class.js.map +1 -0
- package/dist/esm/core/Events.js +149 -0
- package/dist/esm/core/Events.js.map +1 -0
- package/dist/esm/core/Handler.js +32 -0
- package/dist/esm/core/Handler.js.map +1 -0
- package/dist/esm/core/I18n.js +36 -0
- package/dist/esm/core/I18n.js.map +1 -0
- package/dist/esm/core/Util.js +71 -0
- package/dist/esm/core/Util.js.map +1 -0
- package/dist/esm/dom/DomEvent.DoubleTap.js +74 -0
- package/dist/esm/dom/DomEvent.DoubleTap.js.map +1 -0
- package/dist/esm/dom/DomEvent.PointerEvents.js +46 -0
- package/dist/esm/dom/DomEvent.PointerEvents.js.map +1 -0
- package/dist/esm/dom/DomEvent.js +135 -0
- package/dist/esm/dom/DomEvent.js.map +1 -0
- package/dist/esm/dom/DomUtil.js +107 -0
- package/dist/esm/dom/DomUtil.js.map +1 -0
- package/dist/esm/dom/Draggable.js +107 -0
- package/dist/esm/dom/Draggable.js.map +1 -0
- package/dist/esm/dom/PosAnimation.js +56 -0
- package/dist/esm/dom/PosAnimation.js.map +1 -0
- package/dist/esm/geo/LatLng.js +65 -0
- package/dist/esm/geo/LatLng.js.map +1 -0
- package/dist/esm/geo/LatLngBounds.js +114 -0
- package/dist/esm/geo/LatLngBounds.js.map +1 -0
- package/dist/esm/geo/crs/CRS.js +51 -0
- package/dist/esm/geo/crs/CRS.js.map +1 -0
- package/dist/esm/geo/crs/EPSG3395.js +16 -0
- package/dist/esm/geo/crs/EPSG3395.js.map +1 -0
- package/dist/esm/geo/crs/EPSG3857.js +19 -0
- package/dist/esm/geo/crs/EPSG3857.js.map +1 -0
- package/dist/esm/geo/crs/EPSG4326.js +13 -0
- package/dist/esm/geo/crs/EPSG4326.js.map +1 -0
- package/dist/esm/geo/crs/EarthCRS.js +14 -0
- package/dist/esm/geo/crs/EarthCRS.js.map +1 -0
- package/dist/esm/geo/crs/SimpleCRS.js +23 -0
- package/dist/esm/geo/crs/SimpleCRS.js.map +1 -0
- package/dist/esm/geo/projection/Projection.LonLat.js +19 -0
- package/dist/esm/geo/projection/Projection.LonLat.js.map +1 -0
- package/dist/esm/geo/projection/Projection.Mercator.js +33 -0
- package/dist/esm/geo/projection/Projection.Mercator.js.map +1 -0
- package/dist/esm/geo/projection/Projection.SphericalMercator.js +27 -0
- package/dist/esm/geo/projection/Projection.SphericalMercator.js.map +1 -0
- package/dist/esm/geo/projection/index.js +14 -0
- package/dist/esm/geo/projection/index.js.map +1 -0
- package/dist/esm/geometry/Bounds.js +91 -0
- package/dist/esm/geometry/Bounds.js.map +1 -0
- package/dist/esm/geometry/LineUtil.js +169 -0
- package/dist/esm/geometry/LineUtil.js.map +1 -0
- package/dist/esm/geometry/Point.js +119 -0
- package/dist/esm/geometry/Point.js.map +1 -0
- package/dist/esm/geometry/PolyUtil.js +89 -0
- package/dist/esm/geometry/PolyUtil.js.map +1 -0
- package/dist/esm/geometry/Transformation.js +34 -0
- package/dist/esm/geometry/Transformation.js.map +1 -0
- package/dist/esm/layer/BlanketOverlay.js +87 -0
- package/dist/esm/layer/BlanketOverlay.js.map +1 -0
- package/dist/esm/layer/DivOverlay.js +192 -0
- package/dist/esm/layer/DivOverlay.js.map +1 -0
- package/dist/esm/layer/FeatureGroup.js +40 -0
- package/dist/esm/layer/FeatureGroup.js.map +1 -0
- package/dist/esm/layer/GeoJSON.js +192 -0
- package/dist/esm/layer/GeoJSON.js.map +1 -0
- package/dist/esm/layer/ImageOverlay.js +140 -0
- package/dist/esm/layer/ImageOverlay.js.map +1 -0
- package/dist/esm/layer/Layer.js +119 -0
- package/dist/esm/layer/Layer.js.map +1 -0
- package/dist/esm/layer/LayerGroup.js +58 -0
- package/dist/esm/layer/LayerGroup.js.map +1 -0
- package/dist/esm/layer/Popup.js +224 -0
- package/dist/esm/layer/Popup.js.map +1 -0
- package/dist/esm/layer/SVGOverlay.js +21 -0
- package/dist/esm/layer/SVGOverlay.js.map +1 -0
- package/dist/esm/layer/Tooltip.js +228 -0
- package/dist/esm/layer/Tooltip.js.map +1 -0
- package/dist/esm/layer/VideoOverlay.js +54 -0
- package/dist/esm/layer/VideoOverlay.js.map +1 -0
- package/dist/esm/layer/marker/DefaultIcon.js +50 -0
- package/dist/esm/layer/marker/DefaultIcon.js.map +1 -0
- package/dist/esm/layer/marker/DivIcon.js +37 -0
- package/dist/esm/layer/marker/DivIcon.js.map +1 -0
- package/dist/esm/layer/marker/Icon.js +65 -0
- package/dist/esm/layer/marker/Icon.js.map +1 -0
- package/dist/esm/layer/marker/Marker.Drag.js +77 -0
- package/dist/esm/layer/marker/Marker.Drag.js.map +1 -0
- package/dist/esm/layer/marker/Marker.js +235 -0
- package/dist/esm/layer/marker/Marker.js.map +1 -0
- package/dist/esm/layer/tile/GridLayer.js +447 -0
- package/dist/esm/layer/tile/GridLayer.js.map +1 -0
- package/dist/esm/layer/tile/TileLayer.js +139 -0
- package/dist/esm/layer/tile/TileLayer.js.map +1 -0
- package/dist/esm/layer/tile/WMSTileLayer.js +68 -0
- package/dist/esm/layer/tile/WMSTileLayer.js.map +1 -0
- package/dist/esm/layer/vector/Canvas.js +292 -0
- package/dist/esm/layer/vector/Canvas.js.map +1 -0
- package/dist/esm/layer/vector/Circle.js +35 -0
- package/dist/esm/layer/vector/Circle.js.map +1 -0
- package/dist/esm/layer/vector/CircleMarker.js +69 -0
- package/dist/esm/layer/vector/CircleMarker.js.map +1 -0
- package/dist/esm/layer/vector/Path.js +68 -0
- package/dist/esm/layer/vector/Path.js.map +1 -0
- package/dist/esm/layer/vector/Polygon.js +70 -0
- package/dist/esm/layer/vector/Polygon.js.map +1 -0
- package/dist/esm/layer/vector/Polyline.js +152 -0
- package/dist/esm/layer/vector/Polyline.js.map +1 -0
- package/dist/esm/layer/vector/Rectangle.js +25 -0
- package/dist/esm/layer/vector/Rectangle.js.map +1 -0
- package/dist/esm/layer/vector/Renderer.getRenderer.js +31 -0
- package/dist/esm/layer/vector/Renderer.getRenderer.js.map +1 -0
- package/dist/esm/layer/vector/Renderer.js +39 -0
- package/dist/esm/layer/vector/Renderer.js.map +1 -0
- package/dist/esm/layer/vector/SVG.js +115 -0
- package/dist/esm/layer/vector/SVG.js.map +1 -0
- package/dist/esm/map/Map.js +844 -0
- package/dist/esm/map/Map.js.map +1 -0
- package/dist/esm/map/handler/BoxZoomHandler.js +105 -0
- package/dist/esm/map/handler/BoxZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/DoubleClickZoomHandler.js +27 -0
- package/dist/esm/map/handler/DoubleClickZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/DragHandler.js +133 -0
- package/dist/esm/map/handler/DragHandler.js.map +1 -0
- package/dist/esm/map/handler/KeyboardHandler.js +117 -0
- package/dist/esm/map/handler/KeyboardHandler.js.map +1 -0
- package/dist/esm/map/handler/PinchZoomHandler.js +96 -0
- package/dist/esm/map/handler/PinchZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js +50 -0
- package/dist/esm/map/handler/ScrollWheelZoomHandler.js.map +1 -0
- package/dist/esm/map/handler/TapHoldHandler.js +77 -0
- package/dist/esm/map/handler/TapHoldHandler.js.map +1 -0
- package/dist/esm/package.js +6 -0
- package/dist/esm/package.js.map +1 -0
- package/dist/images/layers.svg +1 -0
- package/dist/images/logo.svg +1 -0
- package/dist/images/marker-icon.svg +1 -0
- package/dist/images/marker-shadow.svg +1 -0
- package/dist/maplair-global-src.js +6810 -0
- package/dist/maplair-global-src.js.map +1 -0
- package/dist/maplair-global.js +12 -0
- package/dist/maplair-global.js.map +1 -0
- package/dist/maplair-src.js +6704 -0
- package/dist/maplair-src.js.map +1 -0
- package/dist/maplair.css +730 -0
- package/dist/maplair.js +7 -0
- package/dist/maplair.js.map +1 -0
- package/i18n/cs.json +12 -0
- package/i18n/de.json +12 -0
- package/i18n/en.json +12 -0
- package/i18n/es.json +12 -0
- package/i18n/fr.json +12 -0
- package/i18n/hu.json +12 -0
- package/i18n/it.json +12 -0
- package/i18n/rm.json +12 -0
- package/i18n/sk.json +12 -0
- package/i18n/sl.json +12 -0
- package/package.json +87 -0
- package/src/Maplair.js +24 -0
- package/src/control/AttributionControl.js +147 -0
- package/src/control/Control.js +174 -0
- package/src/control/LayersControl.js +444 -0
- package/src/control/ScaleControl.js +141 -0
- package/src/control/ZoomControl.js +147 -0
- package/src/control/index.js +5 -0
- package/src/core/Browser.js +75 -0
- package/src/core/Class.js +97 -0
- package/src/core/Events.js +334 -0
- package/src/core/Handler.js +59 -0
- package/src/core/I18n.js +76 -0
- package/src/core/Util.js +122 -0
- package/src/core/index.js +8 -0
- package/src/dom/DomEvent.DoubleTap.js +120 -0
- package/src/dom/DomEvent.PointerEvents.js +75 -0
- package/src/dom/DomEvent.js +282 -0
- package/src/dom/DomUtil.js +175 -0
- package/src/dom/Draggable.js +204 -0
- package/src/dom/PosAnimation.js +115 -0
- package/src/dom/index.js +9 -0
- package/src/geo/LatLng.js +163 -0
- package/src/geo/LatLngBounds.js +260 -0
- package/src/geo/crs/CRS.js +143 -0
- package/src/geo/crs/EPSG3395.js +19 -0
- package/src/geo/crs/EPSG3857.js +26 -0
- package/src/geo/crs/EPSG4326.js +21 -0
- package/src/geo/crs/EarthCRS.js +32 -0
- package/src/geo/crs/SimpleCRS.js +35 -0
- package/src/geo/crs/index.js +6 -0
- package/src/geo/index.js +7 -0
- package/src/geo/projection/Projection.LonLat.js +30 -0
- package/src/geo/projection/Projection.Mercator.js +53 -0
- package/src/geo/projection/Projection.SphericalMercator.js +46 -0
- package/src/geo/projection/index.js +26 -0
- package/src/geometry/Bounds.js +222 -0
- package/src/geometry/LineUtil.js +299 -0
- package/src/geometry/Point.js +239 -0
- package/src/geometry/PolyUtil.js +129 -0
- package/src/geometry/Transformation.js +67 -0
- package/src/geometry/index.js +8 -0
- package/src/images/layers.svg +1 -0
- package/src/images/logo.svg +1 -0
- package/src/images/marker-icon.svg +1 -0
- package/src/images/marker-shadow.svg +1 -0
- package/src/layer/BlanketOverlay.js +171 -0
- package/src/layer/DivOverlay.js +353 -0
- package/src/layer/FeatureGroup.js +93 -0
- package/src/layer/GeoJSON.js +432 -0
- package/src/layer/ImageOverlay.js +279 -0
- package/src/layer/Layer.js +273 -0
- package/src/layer/LayerGroup.js +129 -0
- package/src/layer/Popup.js +528 -0
- package/src/layer/SVGOverlay.js +47 -0
- package/src/layer/Tooltip.js +469 -0
- package/src/layer/VideoOverlay.js +111 -0
- package/src/layer/index.js +18 -0
- package/src/layer/marker/DefaultIcon.js +79 -0
- package/src/layer/marker/DivIcon.js +76 -0
- package/src/layer/marker/Icon.js +164 -0
- package/src/layer/marker/Marker.Drag.js +161 -0
- package/src/layer/marker/Marker.js +465 -0
- package/src/layer/marker/index.js +5 -0
- package/src/layer/tile/GridLayer.js +901 -0
- package/src/layer/tile/TileLayer.js +299 -0
- package/src/layer/tile/WMSTileLayer.js +133 -0
- package/src/layer/tile/index.js +3 -0
- package/src/layer/vector/Canvas.js +479 -0
- package/src/layer/vector/Circle.js +87 -0
- package/src/layer/vector/CircleMarker.js +110 -0
- package/src/layer/vector/Path.js +145 -0
- package/src/layer/vector/Polygon.js +160 -0
- package/src/layer/vector/Polyline.js +296 -0
- package/src/layer/vector/Rectangle.js +52 -0
- package/src/layer/vector/Renderer.getRenderer.js +48 -0
- package/src/layer/vector/Renderer.js +75 -0
- package/src/layer/vector/SVG.js +216 -0
- package/src/layer/vector/index.js +10 -0
- package/src/map/Map.js +1830 -0
- package/src/map/handler/BoxZoomHandler.js +156 -0
- package/src/map/handler/DoubleClickZoomHandler.js +62 -0
- package/src/map/handler/DragHandler.js +240 -0
- package/src/map/handler/KeyboardHandler.js +188 -0
- package/src/map/handler/PinchZoomHandler.js +157 -0
- package/src/map/handler/ScrollWheelZoomHandler.js +98 -0
- package/src/map/handler/TapHoldHandler.js +111 -0
- package/src/map/index.js +8 -0
- package/src/maplair.css +730 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Path.js","names":[],"sources":["../../../../src/layer/vector/Path.js"],"sourcesContent":["import {Layer} from '../Layer.js';\nimport * as Util from '../../core/Util.js';\n\n/*\n * @class Path\n * @inherits Interactive layer\n *\n * An abstract class that contains options and constants shared between vector\n * overlays (Polygon, Polyline, Circle). Do not use it directly. Extends `Layer`.\n */\n\nexport class Path extends Layer {\n\n\tstatic {\n\t\t// @section\n\t\t// @aka Path options\n\t\tthis.setDefaultOptions({\n\t\t\t// @option stroke: Boolean = true\n\t\t\t// Whether to draw stroke along the path. Set it to `false` to disable borders on polygons or circles.\n\t\t\tstroke: true,\n\n\t\t\t// @option color: String = '#3388ff'\n\t\t\t// Stroke color\n\t\t\tcolor: '#3388ff',\n\n\t\t\t// @option weight: Number = 3\n\t\t\t// Stroke width in pixels\n\t\t\tweight: 3,\n\n\t\t\t// @option opacity: Number = 1.0\n\t\t\t// Stroke opacity\n\t\t\topacity: 1,\n\n\t\t\t// @option lineCap: String= 'round'\n\t\t\t// A string that defines [shape to be used at the end](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linecap) of the stroke.\n\t\t\tlineCap: 'round',\n\n\t\t\t// @option lineJoin: String = 'round'\n\t\t\t// A string that defines [shape to be used at the corners](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-linejoin) of the stroke.\n\t\t\tlineJoin: 'round',\n\n\t\t\t// @option dashArray: String = null\n\t\t\t// A string that defines the stroke [dash pattern](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dasharray).\n\t\t\tdashArray: null,\n\n\t\t\t// @option dashOffset: String = null\n\t\t\t// A string that defines the [distance into the dash pattern to start the dash](https://developer.mozilla.org/docs/Web/SVG/Attribute/stroke-dashoffset).\n\t\t\tdashOffset: null,\n\n\t\t\t// @option fill: Boolean = depends\n\t\t\t// Whether to fill the path with color. Set it to `false` to disable filling on polygons or circles.\n\t\t\tfill: false,\n\n\t\t\t// @option fillColor: String = *\n\t\t\t// Fill color. Defaults to the value of the [`color`](#path-color) option\n\t\t\tfillColor: null,\n\n\t\t\t// @option fillOpacity: Number = 0.2\n\t\t\t// Fill opacity.\n\t\t\tfillOpacity: 0.2,\n\n\t\t\t// @option fillRule: String = 'evenodd'\n\t\t\t// A string that defines [how the inside of a shape](https://developer.mozilla.org/docs/Web/SVG/Attribute/fill-rule) is determined.\n\t\t\tfillRule: 'evenodd',\n\n\t\t\t// className: '',\n\n\t\t\t// Option inherited from \"Interactive layer\" abstract class\n\t\t\tinteractive: true,\n\n\t\t\t// @option bubblingPointerEvents: Boolean = true\n\t\t\t// When `true`, a pointer event on this path will trigger the same event on the map\n\t\t\t// (unless [`DomEvent.stopPropagation`](#domevent-stoppropagation) is used).\n\t\t\tbubblingPointerEvents: true\n\t\t});\n\t}\n\n\tbeforeAdd(map) {\n\t\t// Renderer is set here because we need to call renderer.getEvents\n\t\t// before this.getEvents.\n\t\tthis._renderer = map.getRenderer(this);\n\t}\n\n\tonAdd() {\n\t\tthis._renderer._initPath(this);\n\t\tthis._reset();\n\t\tthis._renderer._addPath(this);\n\t}\n\n\tonRemove() {\n\t\tthis._renderer._removePath(this);\n\t}\n\n\t// @method redraw(): this\n\t// Redraws the layer. Sometimes useful after you changed the coordinates that the path uses.\n\tredraw() {\n\t\tif (this._map) {\n\t\t\tthis._renderer._updatePath(this);\n\t\t}\n\t\treturn this;\n\t}\n\n\t// @method setStyle(style: Path options): this\n\t// Changes the appearance of a Path based on the options in the `Path options` object.\n\tsetStyle(style) {\n\t\tUtil.setOptions(this, style);\n\t\tif (this._renderer) {\n\t\t\tthis._renderer._updateStyle(this);\n\t\t\tif (this.options.stroke && style && Object.hasOwn(style, 'weight')) {\n\t\t\t\tthis._updateBounds();\n\t\t\t}\n\t\t}\n\t\treturn this;\n\t}\n\n\t// @method bringToFront(): this\n\t// Brings the layer to the top of all path layers.\n\tbringToFront() {\n\t\tthis._renderer?._bringToFront(this);\n\t\treturn this;\n\t}\n\n\t// @method bringToBack(): this\n\t// Brings the layer to the bottom of all path layers.\n\tbringToBack() {\n\t\tthis._renderer?._bringToBack(this);\n\t\treturn this;\n\t}\n\n\tgetElement() {\n\t\treturn this._path;\n\t}\n\n\t_reset() {\n\t\t// defined in child classes\n\t\tthis._project();\n\t\tthis._update();\n\t}\n\n\t_clickTolerance() {\n\t\t// used when doing hit detection for Canvas layers\n\t\treturn (this.options.stroke ? this.options.weight / 2 : 0) +\n\t\t (this._renderer.options.tolerance || 0);\n\t}\n}\n"],"mappings":";;;AAWA,IAAa,OAAb,cAA0B,MAAM;CAE/B;EAGC,KAAK,kBAAkB;GAGtB,QAAQ;GAIR,OAAO;GAIP,QAAQ;GAIR,SAAS;GAIT,SAAS;GAIT,UAAU;GAIV,WAAW;GAIX,YAAY;GAIZ,MAAM;GAIN,WAAW;GAIX,aAAa;GAIb,UAAU;GAKV,aAAa;GAKb,uBAAuB;EACxB,CAAC;CACF;CAEA,UAAU,KAAK;EAGd,KAAK,YAAY,IAAI,YAAY,IAAI;CACtC;CAEA,QAAQ;EACP,KAAK,UAAU,UAAU,IAAI;EAC7B,KAAK,OAAO;EACZ,KAAK,UAAU,SAAS,IAAI;CAC7B;CAEA,WAAW;EACV,KAAK,UAAU,YAAY,IAAI;CAChC;CAIA,SAAS;EACR,IAAI,KAAK,MACR,KAAK,UAAU,YAAY,IAAI;EAEhC,OAAO;CACR;CAIA,SAAS,OAAO;EACf,WAAgB,MAAM,KAAK;EAC3B,IAAI,KAAK,WAAW;GACnB,KAAK,UAAU,aAAa,IAAI;GAChC,IAAI,KAAK,QAAQ,UAAU,SAAS,OAAO,OAAO,OAAO,QAAQ,GAChE,KAAK,cAAc;EAErB;EACA,OAAO;CACR;CAIA,eAAe;EACd,KAAK,WAAW,cAAc,IAAI;EAClC,OAAO;CACR;CAIA,cAAc;EACb,KAAK,WAAW,aAAa,IAAI;EACjC,OAAO;CACR;CAEA,aAAa;EACZ,OAAO,KAAK;CACb;CAEA,SAAS;EAER,KAAK,SAAS;EACd,KAAK,QAAQ;CACd;CAEA,kBAAkB;EAEjB,QAAQ,KAAK,QAAQ,SAAS,KAAK,QAAQ,SAAS,IAAI,MACrD,KAAK,UAAU,QAAQ,aAAa;CACxC;AACD"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Point } from "../../geometry/Point.js";
|
|
2
|
+
import { Bounds } from "../../geometry/Bounds.js";
|
|
3
|
+
import { LatLng } from "../../geo/LatLng.js";
|
|
4
|
+
import { clipPolygon, polygonCenter } from "../../geometry/PolyUtil.js";
|
|
5
|
+
import { isFlat } from "../../geometry/LineUtil.js";
|
|
6
|
+
import { Polyline } from "./Polyline.js";
|
|
7
|
+
//#region src/layer/vector/Polygon.js
|
|
8
|
+
var Polygon = class Polygon extends Polyline {
|
|
9
|
+
static {
|
|
10
|
+
this.setDefaultOptions({ fill: true });
|
|
11
|
+
}
|
|
12
|
+
constructor(...args) {
|
|
13
|
+
super(...args);
|
|
14
|
+
this.callInitHooks(Polygon);
|
|
15
|
+
}
|
|
16
|
+
isEmpty() {
|
|
17
|
+
return !this._latlngs.length || !this._latlngs[0].length;
|
|
18
|
+
}
|
|
19
|
+
getCenter() {
|
|
20
|
+
if (!this._map) throw new Error("Must add layer to map before using getCenter()");
|
|
21
|
+
return polygonCenter(this._defaultShape(), this._map.options.crs);
|
|
22
|
+
}
|
|
23
|
+
_convertLatLngs(latlngs) {
|
|
24
|
+
const result = super._convertLatLngs(latlngs), len = result.length;
|
|
25
|
+
if (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) result.pop();
|
|
26
|
+
return result;
|
|
27
|
+
}
|
|
28
|
+
_setLatLngs(latlngs) {
|
|
29
|
+
super._setLatLngs(latlngs);
|
|
30
|
+
if (isFlat(this._latlngs)) this._latlngs = [this._latlngs];
|
|
31
|
+
}
|
|
32
|
+
_defaultShape() {
|
|
33
|
+
return isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];
|
|
34
|
+
}
|
|
35
|
+
_clipPoints() {
|
|
36
|
+
let bounds = this._renderer._bounds;
|
|
37
|
+
const w = this.options.weight, p = new Point(w, w);
|
|
38
|
+
bounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p));
|
|
39
|
+
this._parts = [];
|
|
40
|
+
if (!this._pxBounds || !this._pxBounds.intersects(bounds)) return;
|
|
41
|
+
if (this.options.noClip) {
|
|
42
|
+
this._parts = this._rings;
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
for (const ring of this._rings) {
|
|
46
|
+
const clipped = clipPolygon(ring, bounds, true);
|
|
47
|
+
if (clipped.length) this._parts.push(clipped);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
_updatePath() {
|
|
51
|
+
this._renderer._updatePoly(this, true);
|
|
52
|
+
}
|
|
53
|
+
_containsPoint(p) {
|
|
54
|
+
let inside = false, part, p1, p2, i, j, k, len, len2;
|
|
55
|
+
if (!this._pxBounds || !this._pxBounds.contains(p)) return false;
|
|
56
|
+
for (i = 0, len = this._parts.length; i < len; i++) {
|
|
57
|
+
part = this._parts[i];
|
|
58
|
+
for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
|
|
59
|
+
p1 = part[j];
|
|
60
|
+
p2 = part[k];
|
|
61
|
+
if (p1.y > p.y !== p2.y > p.y && p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x) inside = !inside;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return inside || super._containsPoint(p, true);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { Polygon };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=Polygon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Polygon.js","names":["PolyUtil.polygonCenter","LineUtil.isFlat","PolyUtil.clipPolygon"],"sources":["../../../../src/layer/vector/Polygon.js"],"sourcesContent":["import {Polyline} from './Polyline.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport * as LineUtil from '../../geometry/LineUtil.js';\nimport {Point} from '../../geometry/Point.js';\nimport {Bounds} from '../../geometry/Bounds.js';\nimport * as PolyUtil from '../../geometry/PolyUtil.js';\n\n/*\n * @class Polygon\n * @inherits Polyline\n *\n * A class for drawing polygon overlays on a map. Extends `Polyline`.\n *\n * Note that points you pass when creating a polygon shouldn't have an additional last point equal to the first one — it's better to filter out such points.\n *\n *\n * @example\n *\n * ```js\n * // create a red polygon from an array of LatLng points\n * const latlngs = [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]];\n *\n * const polygon = new Polygon(latlngs, {color: 'red'}).addTo(map);\n *\n * // zoom the map to the polygon\n * map.fitBounds(polygon.getBounds());\n * ```\n *\n * You can also pass an array of arrays of latlngs, with the first array representing the outer shape and the other arrays representing holes in the outer shape:\n *\n * ```js\n * const latlngs = [\n * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring\n * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole\n * ];\n * ```\n *\n * Additionally, you can pass a multi-dimensional array to represent a MultiPolygon shape.\n *\n * ```js\n * const latlngs = [\n * [ // first polygon\n * [[37, -109.05],[41, -109.03],[41, -102.05],[37, -102.04]], // outer ring\n * [[37.29, -108.58],[40.71, -108.58],[40.71, -102.50],[37.29, -102.50]] // hole\n * ],\n * [ // second polygon\n * [[41, -111.03],[45, -111.04],[45, -104.05],[41, -104.05]]\n * ]\n * ];\n * ```\n */\n\n// @constructor Polygon(latlngs: LatLng[], options?: Polyline options)\nexport class Polygon extends Polyline {\n\n\tstatic {\n\t\tthis.setDefaultOptions({\n\t\t\tfill: true\n\t\t});\n\t}\n\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis.callInitHooks(Polygon);\n\t}\n\n\tisEmpty() {\n\t\treturn !this._latlngs.length || !this._latlngs[0].length;\n\t}\n\n\t// @method getCenter(): LatLng\n\t// Returns the center ([centroid](http://en.wikipedia.org/wiki/Centroid)) of the Polygon.\n\tgetCenter() {\n\t\t// throws error when not yet added to map as this center calculation requires projected coordinates\n\t\tif (!this._map) {\n\t\t\tthrow new Error('Must add layer to map before using getCenter()');\n\t\t}\n\t\treturn PolyUtil.polygonCenter(this._defaultShape(), this._map.options.crs);\n\t}\n\n\t_convertLatLngs(latlngs) {\n\t\tconst result = super._convertLatLngs(latlngs),\n\t\tlen = result.length;\n\n\t\t// remove last point if it equals first one\n\t\tif (len >= 2 && result[0] instanceof LatLng && result[0].equals(result[len - 1])) {\n\t\t\tresult.pop();\n\t\t}\n\t\treturn result;\n\t}\n\n\t_setLatLngs(latlngs) {\n\t\tsuper._setLatLngs(latlngs);\n\t\tif (LineUtil.isFlat(this._latlngs)) {\n\t\t\tthis._latlngs = [this._latlngs];\n\t\t}\n\t}\n\n\t_defaultShape() {\n\t\treturn LineUtil.isFlat(this._latlngs[0]) ? this._latlngs[0] : this._latlngs[0][0];\n\t}\n\n\t_clipPoints() {\n\t\t// polygons need a different clipping algorithm so we redefine that\n\n\t\tlet bounds = this._renderer._bounds;\n\t\tconst w = this.options.weight,\n\t\tp = new Point(w, w);\n\n\t\t// increase clip padding by stroke width to avoid stroke on clip edges\n\t\tbounds = new Bounds(bounds.min.subtract(p), bounds.max.add(p));\n\n\t\tthis._parts = [];\n\t\tif (!this._pxBounds || !this._pxBounds.intersects(bounds)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.options.noClip) {\n\t\t\tthis._parts = this._rings;\n\t\t\treturn;\n\t\t}\n\n\t\tfor (const ring of this._rings) {\n\t\t\tconst clipped = PolyUtil.clipPolygon(ring, bounds, true);\n\t\t\tif (clipped.length) {\n\t\t\t\tthis._parts.push(clipped);\n\t\t\t}\n\t\t}\n\t}\n\n\t_updatePath() {\n\t\tthis._renderer._updatePoly(this, true);\n\t}\n\n\t// Needed by the `Canvas` renderer for interactivity\n\t_containsPoint(p) {\n\t\tlet inside = false,\n\t\tpart, p1, p2, i, j, k, len, len2;\n\n\t\tif (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }\n\n\t\t// ray casting algorithm for detecting if point is in polygon\n\t\tfor (i = 0, len = this._parts.length; i < len; i++) {\n\t\t\tpart = this._parts[i];\n\n\t\t\tfor (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {\n\t\t\t\tp1 = part[j];\n\t\t\t\tp2 = part[k];\n\n\t\t\t\tif (((p1.y > p.y) !== (p2.y > p.y)) && (p.x < (p2.x - p1.x) * (p.y - p1.y) / (p2.y - p1.y) + p1.x)) {\n\t\t\t\t\tinside = !inside;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// also check if it's on polygon stroke\n\t\treturn inside || super._containsPoint(p, true);\n\t}\n\n}\n"],"mappings":";;;;;;;AAqDA,IAAa,UAAb,MAAa,gBAAgB,SAAS;CAErC;EACC,KAAK,kBAAkB,EACtB,MAAM,KACP,CAAC;CACF;CAEA,YAAY,GAAG,MAAM;EACpB,MAAM,GAAG,IAAI;EACb,KAAK,cAAc,OAAO;CAC3B;CAEA,UAAU;EACT,OAAO,CAAC,KAAK,SAAS,UAAU,CAAC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EAE5B,IAAI,CAAC,KAAK,aAAa,CAAC,KAAK,UAAU,SAAS,CAAC,GAAK,OAAO;EAG7D,KAAK,IAAI,GAAG,MAAM,KAAK,OAAO,QAAQ,IAAI,KAAK,KAAK;GACnD,OAAO,KAAK,OAAO;GAEnB,KAAK,IAAI,GAAG,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,IAAI,MAAM,IAAI,KAAK;IAChE,KAAK,KAAK;IACV,KAAK,KAAK;IAEV,IAAM,GAAG,IAAI,EAAE,MAAQ,GAAG,IAAI,EAAE,KAAQ,EAAE,KAAK,GAAG,IAAI,GAAG,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,KAAK,GAAG,GAC/F,SAAS,CAAC;GAEZ;EACD;EAGA,OAAO,UAAU,MAAM,eAAe,GAAG,IAAI;CAC9C;AAED"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { setOptions } from "../../core/Util.js";
|
|
2
|
+
import { Point } from "../../geometry/Point.js";
|
|
3
|
+
import { Bounds } from "../../geometry/Bounds.js";
|
|
4
|
+
import { LatLngBounds } from "../../geo/LatLngBounds.js";
|
|
5
|
+
import { LatLng } from "../../geo/LatLng.js";
|
|
6
|
+
import { _sqClosestPointOnSegment, clipSegment, isFlat, pointToSegmentDistance, polylineCenter, simplify } from "../../geometry/LineUtil.js";
|
|
7
|
+
import { Path } from "./Path.js";
|
|
8
|
+
//#region src/layer/vector/Polyline.js
|
|
9
|
+
var Polyline = class Polyline extends Path {
|
|
10
|
+
static {
|
|
11
|
+
this.setDefaultOptions({
|
|
12
|
+
smoothFactor: .5,
|
|
13
|
+
noClip: false
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
constructor(latlngs, options) {
|
|
17
|
+
super();
|
|
18
|
+
setOptions(this, options);
|
|
19
|
+
this._setLatLngs(latlngs);
|
|
20
|
+
this.callInitHooks(Polyline);
|
|
21
|
+
}
|
|
22
|
+
getLatLngs() {
|
|
23
|
+
return this._latlngs;
|
|
24
|
+
}
|
|
25
|
+
setLatLngs(latlngs) {
|
|
26
|
+
this._setLatLngs(latlngs);
|
|
27
|
+
return this.redraw();
|
|
28
|
+
}
|
|
29
|
+
isEmpty() {
|
|
30
|
+
return !this._latlngs.length;
|
|
31
|
+
}
|
|
32
|
+
closestLayerPoint(p) {
|
|
33
|
+
p = new Point(p);
|
|
34
|
+
let minDistance = Infinity, minPoint = null, p1, p2;
|
|
35
|
+
const closest = _sqClosestPointOnSegment;
|
|
36
|
+
for (const points of this._parts) for (let i = 1, len = points.length; i < len; i++) {
|
|
37
|
+
p1 = points[i - 1];
|
|
38
|
+
p2 = points[i];
|
|
39
|
+
const sqDist = closest(p, p1, p2, true);
|
|
40
|
+
if (sqDist < minDistance) {
|
|
41
|
+
minDistance = sqDist;
|
|
42
|
+
minPoint = closest(p, p1, p2);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (minPoint) minPoint.distance = Math.sqrt(minDistance);
|
|
46
|
+
return minPoint;
|
|
47
|
+
}
|
|
48
|
+
getCenter() {
|
|
49
|
+
if (!this._map) throw new Error("Must add layer to map before using getCenter()");
|
|
50
|
+
return polylineCenter(this._defaultShape(), this._map.options.crs);
|
|
51
|
+
}
|
|
52
|
+
getBounds() {
|
|
53
|
+
return this._bounds;
|
|
54
|
+
}
|
|
55
|
+
addLatLng(latlng, latlngs) {
|
|
56
|
+
latlngs ??= this._defaultShape();
|
|
57
|
+
latlng = new LatLng(latlng);
|
|
58
|
+
latlngs.push(latlng);
|
|
59
|
+
this._bounds.extend(latlng);
|
|
60
|
+
return this.redraw();
|
|
61
|
+
}
|
|
62
|
+
_setLatLngs(latlngs) {
|
|
63
|
+
this._bounds = new LatLngBounds();
|
|
64
|
+
this._latlngs = this._convertLatLngs(latlngs);
|
|
65
|
+
}
|
|
66
|
+
_defaultShape() {
|
|
67
|
+
return isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];
|
|
68
|
+
}
|
|
69
|
+
_convertLatLngs(latlngs) {
|
|
70
|
+
const result = [], flat = isFlat(latlngs);
|
|
71
|
+
for (let i = 0, len = latlngs.length; i < len; i++) if (flat) {
|
|
72
|
+
result[i] = new LatLng(latlngs[i]);
|
|
73
|
+
this._bounds.extend(result[i]);
|
|
74
|
+
} else result[i] = this._convertLatLngs(latlngs[i]);
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
_project() {
|
|
78
|
+
const pxBounds = new Bounds();
|
|
79
|
+
this._rings = [];
|
|
80
|
+
this._projectLatlngs(this._latlngs, this._rings, pxBounds);
|
|
81
|
+
if (this._bounds.isValid() && pxBounds.isValid()) {
|
|
82
|
+
this._rawPxBounds = pxBounds;
|
|
83
|
+
this._updateBounds();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
_updateBounds() {
|
|
87
|
+
const w = this._clickTolerance(), p = new Point(w, w);
|
|
88
|
+
if (!this._rawPxBounds) return;
|
|
89
|
+
this._pxBounds = new Bounds([this._rawPxBounds.min.subtract(p), this._rawPxBounds.max.add(p)]);
|
|
90
|
+
}
|
|
91
|
+
_projectLatlngs(latlngs, result, projectedBounds) {
|
|
92
|
+
if (latlngs[0] instanceof LatLng) {
|
|
93
|
+
const ring = latlngs.map((latlng) => this._map.latLngToLayerPoint(latlng));
|
|
94
|
+
ring.forEach((r) => projectedBounds.extend(r));
|
|
95
|
+
result.push(ring);
|
|
96
|
+
} else latlngs.forEach((latlng) => this._projectLatlngs(latlng, result, projectedBounds));
|
|
97
|
+
}
|
|
98
|
+
_clipPoints() {
|
|
99
|
+
const bounds = this._renderer._bounds;
|
|
100
|
+
this._parts = [];
|
|
101
|
+
if (!this._pxBounds || !this._pxBounds.intersects(bounds)) return;
|
|
102
|
+
if (this.options.noClip) {
|
|
103
|
+
this._parts = this._rings;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const parts = this._parts;
|
|
107
|
+
let i, j, k, len, len2, segment, points;
|
|
108
|
+
for (i = 0, k = 0, len = this._rings.length; i < len; i++) {
|
|
109
|
+
points = this._rings[i];
|
|
110
|
+
for (j = 0, len2 = points.length; j < len2 - 1; j++) {
|
|
111
|
+
segment = clipSegment(points[j], points[j + 1], bounds, j, true);
|
|
112
|
+
if (!segment) continue;
|
|
113
|
+
parts[k] ??= [];
|
|
114
|
+
parts[k].push(segment[0]);
|
|
115
|
+
if (segment[1] !== points[j + 1] || j === len2 - 2) {
|
|
116
|
+
parts[k].push(segment[1]);
|
|
117
|
+
k++;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
_simplifyPoints() {
|
|
123
|
+
const parts = this._parts, tolerance = this.options.smoothFactor;
|
|
124
|
+
for (let i = 0, len = parts.length; i < len; i++) parts[i] = simplify(parts[i], tolerance);
|
|
125
|
+
}
|
|
126
|
+
_update() {
|
|
127
|
+
if (!this._map) return;
|
|
128
|
+
this._clipPoints();
|
|
129
|
+
this._simplifyPoints();
|
|
130
|
+
this._updatePath();
|
|
131
|
+
}
|
|
132
|
+
_updatePath() {
|
|
133
|
+
this._renderer._updatePoly(this);
|
|
134
|
+
}
|
|
135
|
+
_containsPoint(p, closed) {
|
|
136
|
+
let i, j, k, len, len2, part;
|
|
137
|
+
const w = this._clickTolerance();
|
|
138
|
+
if (!this._pxBounds || !this._pxBounds.contains(p)) return false;
|
|
139
|
+
for (i = 0, len = this._parts.length; i < len; i++) {
|
|
140
|
+
part = this._parts[i];
|
|
141
|
+
for (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {
|
|
142
|
+
if (!closed && j === 0) continue;
|
|
143
|
+
if (pointToSegmentDistance(p, part[k], part[j]) <= w) return true;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
//#endregion
|
|
150
|
+
export { Polyline };
|
|
151
|
+
|
|
152
|
+
//# sourceMappingURL=Polyline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Polyline.js","names":["LineUtil._sqClosestPointOnSegment","LineUtil.polylineCenter","LineUtil.isFlat","LineUtil.clipSegment","LineUtil.simplify","LineUtil.pointToSegmentDistance"],"sources":["../../../../src/layer/vector/Polyline.js"],"sourcesContent":["import {Path} from './Path.js';\nimport * as Util from '../../core/Util.js';\nimport * as LineUtil from '../../geometry/LineUtil.js';\nimport {LatLng} from '../../geo/LatLng.js';\nimport {LatLngBounds} from '../../geo/LatLngBounds.js';\nimport {Bounds} from '../../geometry/Bounds.js';\nimport {Point} from '../../geometry/Point.js';\n\n/*\n * @class Polyline\n * @inherits Path\n *\n * A class for drawing polyline overlays on a map. Extends `Path`.\n *\n * @example\n *\n * ```js\n * // create a red polyline from an array of LatLng points\n * const latlngs = [\n * \t[45.51, -122.68],\n * \t[37.77, -122.43],\n * \t[34.04, -118.2]\n * ];\n *\n * const polyline = new Polyline(latlngs, {color: 'red'}).addTo(map);\n *\n * // zoom the map to the polyline\n * map.fitBounds(polyline.getBounds());\n * ```\n *\n * You can also pass a multi-dimensional array to represent a `MultiPolyline` shape:\n *\n * ```js\n * // create a red polyline from an array of arrays of LatLng points\n * const latlngs = [\n * \t[[45.51, -122.68],\n * \t [37.77, -122.43],\n * \t [34.04, -118.2]],\n * \t[[40.78, -73.91],\n * \t [41.83, -87.62],\n * \t [32.76, -96.72]]\n * ];\n * ```\n */\n\n// @constructor Polyline(latlngs: LatLng[], options?: Polyline options)\n// Instantiates a polyline object given an array of geographical points and\n// optionally an options object. You can create a `Polyline` object with\n// multiple separate lines (`MultiPolyline`) by passing an array of arrays\n// of geographic points.\nexport class Polyline extends Path {\n\n\tstatic {\n\t\t// @section\n\t\t// @aka Polyline options\n\t\tthis.setDefaultOptions({\n\t\t\t// @option smoothFactor: Number = 0.5\n\t\t\t// How much to simplify the polyline on each zoom level (Douglas–Peucker\n\t\t\t// epsilon, in pixels). Higher values mean faster rendering but less\n\t\t\t// accuracy; lower values mean more accuracy but slower rendering.\n\t\t\tsmoothFactor: 0.5,\n\n\t\t\t// @option noClip: Boolean = false\n\t\t\t// Disable polyline clipping.\n\t\t\tnoClip: false\n\t\t});\n\t}\n\n\tconstructor(latlngs, options) {\n\t\tsuper();\n\t\tUtil.setOptions(this, options);\n\t\tthis._setLatLngs(latlngs);\n\n\t\tthis.callInitHooks(Polyline);\n\t}\n\n\t// @method getLatLngs(): LatLng[]\n\t// Returns an array of the points in the path, or nested arrays of points in case of multi-polyline.\n\tgetLatLngs() {\n\t\treturn this._latlngs;\n\t}\n\n\t// @method setLatLngs(latlngs: LatLng[]): this\n\t// Replaces all the points in the polyline with the given array of geographical points.\n\tsetLatLngs(latlngs) {\n\t\tthis._setLatLngs(latlngs);\n\t\treturn this.redraw();\n\t}\n\n\t// @method isEmpty(): Boolean\n\t// Returns `true` if the Polyline has no LatLngs.\n\tisEmpty() {\n\t\treturn !this._latlngs.length;\n\t}\n\n\t// @method closestLayerPoint(p: Point): Point\n\t// Returns the point closest to `p` on the Polyline.\n\tclosestLayerPoint(p) {\n\t\tp = new Point(p);\n\t\tlet minDistance = Infinity,\n\t\tminPoint = null,\n\t\tp1, p2;\n\t\tconst closest = LineUtil._sqClosestPointOnSegment;\n\n\t\tfor (const points of this._parts) {\n\t\t\tfor (let i = 1, len = points.length; i < len; i++) {\n\t\t\t\tp1 = points[i - 1];\n\t\t\t\tp2 = points[i];\n\n\t\t\t\tconst sqDist = closest(p, p1, p2, true);\n\n\t\t\t\tif (sqDist < minDistance) {\n\t\t\t\t\tminDistance = sqDist;\n\t\t\t\t\tminPoint = closest(p, p1, p2);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (minPoint) {\n\t\t\tminPoint.distance = Math.sqrt(minDistance);\n\t\t}\n\t\treturn minPoint;\n\t}\n\n\t// @method getCenter(): LatLng\n\t// Returns the center ([centroid](https://en.wikipedia.org/wiki/Centroid)) of the polyline.\n\tgetCenter() {\n\t\t// throws error when not yet added to map as this center calculation requires projected coordinates\n\t\tif (!this._map) {\n\t\t\tthrow new Error('Must add layer to map before using getCenter()');\n\t\t}\n\t\treturn LineUtil.polylineCenter(this._defaultShape(), this._map.options.crs);\n\t}\n\n\t// @method getBounds(): LatLngBounds\n\t// Returns the `LatLngBounds` of the path.\n\tgetBounds() {\n\t\treturn this._bounds;\n\t}\n\n\t// @method addLatLng(latlng: LatLng, latlngs?: LatLng[]): this\n\t// Adds a given point to the polyline. By default, adds to the first ring of\n\t// the polyline in case of a multi-polyline, but can be overridden by passing\n\t// a specific ring as a LatLng array (that you can earlier access with [`getLatLngs`](#polyline-getlatlngs)).\n\taddLatLng(latlng, latlngs) {\n\t\tlatlngs ??= this._defaultShape();\n\t\tlatlng = new LatLng(latlng);\n\t\tlatlngs.push(latlng);\n\t\tthis._bounds.extend(latlng);\n\t\treturn this.redraw();\n\t}\n\n\t_setLatLngs(latlngs) {\n\t\tthis._bounds = new LatLngBounds();\n\t\tthis._latlngs = this._convertLatLngs(latlngs);\n\t}\n\n\t_defaultShape() {\n\t\treturn LineUtil.isFlat(this._latlngs) ? this._latlngs : this._latlngs[0];\n\t}\n\n\t// recursively convert latlngs input into actual LatLng instances; calculate bounds along the way\n\t_convertLatLngs(latlngs) {\n\t\tconst result = [],\n\t\tflat = LineUtil.isFlat(latlngs);\n\n\t\tfor (let i = 0, len = latlngs.length; i < len; i++) {\n\t\t\tif (flat) {\n\t\t\t\tresult[i] = new LatLng(latlngs[i]);\n\t\t\t\tthis._bounds.extend(result[i]);\n\t\t\t} else {\n\t\t\t\tresult[i] = this._convertLatLngs(latlngs[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t}\n\n\t_project() {\n\t\tconst pxBounds = new Bounds();\n\t\tthis._rings = [];\n\t\tthis._projectLatlngs(this._latlngs, this._rings, pxBounds);\n\n\t\tif (this._bounds.isValid() && pxBounds.isValid()) {\n\t\t\tthis._rawPxBounds = pxBounds;\n\t\t\tthis._updateBounds();\n\t\t}\n\t}\n\n\t_updateBounds() {\n\t\tconst w = this._clickTolerance(),\n\t\tp = new Point(w, w);\n\n\t\tif (!this._rawPxBounds) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._pxBounds = new Bounds([\n\t\t\tthis._rawPxBounds.min.subtract(p),\n\t\t\tthis._rawPxBounds.max.add(p)\n\t\t]);\n\t}\n\n\t// recursively turns latlngs into a set of rings with projected coordinates\n\t_projectLatlngs(latlngs, result, projectedBounds) {\n\t\tconst flat = latlngs[0] instanceof LatLng;\n\n\t\tif (flat) {\n\t\t\tconst ring = latlngs.map(latlng => this._map.latLngToLayerPoint(latlng));\n\t\t\tring.forEach(r => projectedBounds.extend(r));\n\t\t\tresult.push(ring);\n\t\t} else {\n\t\t\tlatlngs.forEach(latlng => this._projectLatlngs(latlng, result, projectedBounds));\n\t\t}\n\t}\n\n\t// clip polyline by renderer bounds so that we have less to render for performance\n\t_clipPoints() {\n\t\tconst bounds = this._renderer._bounds;\n\n\t\tthis._parts = [];\n\t\tif (!this._pxBounds || !this._pxBounds.intersects(bounds)) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.options.noClip) {\n\t\t\tthis._parts = this._rings;\n\t\t\treturn;\n\t\t}\n\n\t\tconst parts = this._parts;\n\t\tlet i, j, k, len, len2, segment, points;\n\n\t\tfor (i = 0, k = 0, len = this._rings.length; i < len; i++) {\n\t\t\tpoints = this._rings[i];\n\n\t\t\tfor (j = 0, len2 = points.length; j < len2 - 1; j++) {\n\t\t\t\tsegment = LineUtil.clipSegment(points[j], points[j + 1], bounds, j, true);\n\n\t\t\t\tif (!segment) { continue; }\n\n\t\t\t\tparts[k] ??= [];\n\t\t\t\tparts[k].push(segment[0]);\n\n\t\t\t\t// if segment goes out of screen, or it's the last one, it's the end of the line part\n\t\t\t\tif ((segment[1] !== points[j + 1]) || (j === len2 - 2)) {\n\t\t\t\t\tparts[k].push(segment[1]);\n\t\t\t\t\tk++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// simplify each clipped part of the polyline for performance\n\t_simplifyPoints() {\n\t\tconst parts = this._parts,\n\t\ttolerance = this.options.smoothFactor;\n\n\t\tfor (let i = 0, len = parts.length; i < len; i++) {\n\t\t\tparts[i] = LineUtil.simplify(parts[i], tolerance);\n\t\t}\n\t}\n\n\t_update() {\n\t\tif (!this._map) { return; }\n\n\t\tthis._clipPoints();\n\t\tthis._simplifyPoints();\n\t\tthis._updatePath();\n\t}\n\n\t_updatePath() {\n\t\tthis._renderer._updatePoly(this);\n\t}\n\n\t// Needed by the `Canvas` renderer for interactivity\n\t_containsPoint(p, closed) {\n\t\tlet i, j, k, len, len2, part;\n\t\tconst w = this._clickTolerance();\n\n\t\tif (!this._pxBounds || !this._pxBounds.contains(p)) { return false; }\n\n\t\t// hit detection for polylines\n\t\tfor (i = 0, len = this._parts.length; i < len; i++) {\n\t\t\tpart = this._parts[i];\n\n\t\t\tfor (j = 0, len2 = part.length, k = len2 - 1; j < len2; k = j++) {\n\t\t\t\tif (!closed && (j === 0)) { continue; }\n\n\t\t\t\tif (LineUtil.pointToSegmentDistance(p, part[k], part[j]) <= w) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}\n"],"mappings":";;;;;;;;AAkDA,IAAa,WAAb,MAAa,iBAAiB,KAAK;CAElC;EAGC,KAAK,kBAAkB;GAKtB,cAAc;GAId,QAAQ;EACT,CAAC;CACF;CAEA,YAAY,SAAS,SAAS;EAC7B,MAAM;EACN,WAAgB,MAAM,OAAO;EAC7B,KAAK,YAAY,OAAO;EAExB,KAAK,cAAc,QAAQ;CAC5B;CAIA,aAAa;EACZ,OAAO,KAAK;CACb;CAIA,WAAW,SAAS;EACnB,KAAK,YAAY,OAAO;EACxB,OAAO,KAAK,OAAO;CACpB;CAIA,UAAU;EACT,OAAO,CAAC,KAAK,SAAS;CACvB;CAIA,kBAAkB,GAAG;EACpB,IAAI,IAAI,MAAM,CAAC;EACf,IAAI,cAAc,UAClB,WAAW,MACX,IAAI;EACJ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,SAAW;IAEhB,MAAM,OAAO,CAAC;IACd,MAAM,EAAE,CAAC,KAAK,QAAQ,EAAE;IAGxB,IAAK,QAAQ,OAAO,OAAO,IAAI,MAAQ,MAAM,OAAO,GAAI;KACvD,MAAM,EAAE,CAAC,KAAK,QAAQ,EAAE;KACxB;IACD;GACD;EACD;CACD;CAGA,kBAAkB;EACjB,MAAM,QAAQ,KAAK,QACnB,YAAY,KAAK,QAAQ;EAEzB,KAAK,IAAI,IAAI,GAAG,MAAM,MAAM,QAAQ,IAAI,KAAK,KAC5C,MAAM,KAAKC,SAAkB,MAAM,IAAI,SAAS;CAElD;CAEA,UAAU;EACT,IAAI,CAAC,KAAK,MAAQ;EAElB,KAAK,YAAY;EACjB,KAAK,gBAAgB;EACrB,KAAK,YAAY;CAClB;CAEA,cAAc;EACb,KAAK,UAAU,YAAY,IAAI;CAChC;CAGA,eAAe,GAAG,QAAQ;EACzB,IAAI,GAAG,GAAG,GAAG,KAAK,MAAM;EACxB,MAAM,IAAI,KAAK,gBAAgB;EAE/B,IAAI,CAAC,KAAK,aAAa,CAAC,KAAK,UAAU,SAAS,CAAC,GAAK,OAAO;EAG7D,KAAK,IAAI,GAAG,MAAM,KAAK,OAAO,QAAQ,IAAI,KAAK,KAAK;GACnD,OAAO,KAAK,OAAO;GAEnB,KAAK,IAAI,GAAG,OAAO,KAAK,QAAQ,IAAI,OAAO,GAAG,IAAI,MAAM,IAAI,KAAK;IAChE,IAAI,CAAC,UAAW,MAAM,GAAM;IAE5B,IAAIC,uBAAgC,GAAG,KAAK,IAAI,KAAK,EAAE,KAAK,GAC3D,OAAO;GAET;EACD;EACA,OAAO;CACR;AACD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { LatLngBounds } from "../../geo/LatLngBounds.js";
|
|
2
|
+
import { Polygon } from "./Polygon.js";
|
|
3
|
+
//#region src/layer/vector/Rectangle.js
|
|
4
|
+
var Rectangle = class Rectangle extends Polygon {
|
|
5
|
+
constructor(latLngBounds, options) {
|
|
6
|
+
super(Rectangle._boundsToLatLngs(latLngBounds), options);
|
|
7
|
+
this.callInitHooks(Rectangle);
|
|
8
|
+
}
|
|
9
|
+
setBounds(latLngBounds) {
|
|
10
|
+
return this.setLatLngs(Rectangle._boundsToLatLngs(latLngBounds));
|
|
11
|
+
}
|
|
12
|
+
static _boundsToLatLngs(latLngBounds) {
|
|
13
|
+
latLngBounds = new LatLngBounds(latLngBounds);
|
|
14
|
+
return [
|
|
15
|
+
latLngBounds.getSouthWest(),
|
|
16
|
+
latLngBounds.getNorthWest(),
|
|
17
|
+
latLngBounds.getNorthEast(),
|
|
18
|
+
latLngBounds.getSouthEast()
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { Rectangle };
|
|
24
|
+
|
|
25
|
+
//# sourceMappingURL=Rectangle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Rectangle.js","names":[],"sources":["../../../../src/layer/vector/Rectangle.js"],"sourcesContent":["import {Polygon} from './Polygon.js';\nimport {LatLngBounds} from '../../geo/LatLngBounds.js';\n\n/*\n * Rectangle extends Polygon and creates a rectangle when passed a LatLngBounds object.\n */\n\n/*\n * @class Rectangle\n * @inherits Polygon\n *\n * A class for drawing rectangle overlays on a map. Extends `Polygon`.\n *\n * @example\n *\n * ```js\n * // define rectangle geographical bounds\n * const bounds = [[54.559322, -5.767822], [56.1210604, -3.021240]];\n *\n * // create an orange rectangle\n * new Rectangle(bounds, {color: \"#ff7800\", weight: 1}).addTo(map);\n *\n * // zoom the map to the rectangle bounds\n * map.fitBounds(bounds);\n * ```\n *\n */\n\n// @constructor Rectangle(latLngBounds: LatLngBounds, options?: Polyline options)\nexport class Rectangle extends Polygon {\n\tconstructor(latLngBounds, options) {\n\t\tsuper(Rectangle._boundsToLatLngs(latLngBounds), options);\n\n\t\tthis.callInitHooks(Rectangle);\n\t}\n\n\t// @method setBounds(latLngBounds: LatLngBounds): this\n\t// Redraws the rectangle with the passed bounds.\n\tsetBounds(latLngBounds) {\n\t\treturn this.setLatLngs(Rectangle._boundsToLatLngs(latLngBounds));\n\t}\n\n\tstatic _boundsToLatLngs(latLngBounds) {\n\t\tlatLngBounds = new LatLngBounds(latLngBounds);\n\t\treturn [\n\t\t\tlatLngBounds.getSouthWest(),\n\t\t\tlatLngBounds.getNorthWest(),\n\t\t\tlatLngBounds.getNorthEast(),\n\t\t\tlatLngBounds.getSouthEast()\n\t\t];\n\t}\n}\n"],"mappings":";;;AA6BA,IAAa,YAAb,MAAa,kBAAkB,QAAQ;CACtC,YAAY,cAAc,SAAS;EAClC,MAAM,UAAU,iBAAiB,YAAY,GAAG,OAAO;EAEvD,KAAK,cAAc,SAAS;CAC7B;CAIA,UAAU,cAAc;EACvB,OAAO,KAAK,WAAW,UAAU,iBAAiB,YAAY,CAAC;CAChE;CAEA,OAAO,iBAAiB,cAAc;EACrC,eAAe,IAAI,aAAa,YAAY;EAC5C,OAAO;GACN,aAAa,aAAa;GAC1B,aAAa,aAAa;GAC1B,aAAa,aAAa;GAC1B,aAAa,aAAa;EAC3B;CACD;AACD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { Canvas } from "./Canvas.js";
|
|
3
|
+
import { SVG } from "./SVG.js";
|
|
4
|
+
//#region src/layer/vector/Renderer.getRenderer.js
|
|
5
|
+
var Renderer_getRenderer_exports = /* @__PURE__ */ __exportAll({ register: () => register });
|
|
6
|
+
function register(MaplairMap) {
|
|
7
|
+
MaplairMap.include({
|
|
8
|
+
getRenderer(layer) {
|
|
9
|
+
let renderer = layer.options.renderer ?? this._getPaneRenderer(layer.options.pane) ?? this.options.renderer ?? this._renderer;
|
|
10
|
+
if (!renderer) renderer = this._renderer = this._createRenderer();
|
|
11
|
+
if (!this.hasLayer(renderer)) this.addLayer(renderer);
|
|
12
|
+
return renderer;
|
|
13
|
+
},
|
|
14
|
+
_getPaneRenderer(name) {
|
|
15
|
+
if (name === "overlayPane" || name === void 0) return;
|
|
16
|
+
let renderer = this._paneRenderers[name];
|
|
17
|
+
if (renderer === void 0) {
|
|
18
|
+
renderer = this._createRenderer({ pane: name });
|
|
19
|
+
this._paneRenderers[name] = renderer;
|
|
20
|
+
}
|
|
21
|
+
return renderer;
|
|
22
|
+
},
|
|
23
|
+
_createRenderer(options) {
|
|
24
|
+
return this.options.preferCanvas && new Canvas(options) || new SVG(options);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Renderer_getRenderer_exports, register };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=Renderer.getRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Renderer.getRenderer.js","names":[],"sources":["../../../../src/layer/vector/Renderer.getRenderer.js"],"sourcesContent":["import {Canvas} from './Canvas.js';\nimport {SVG} from './SVG.js';\n\n// Registers `getRenderer()` and related methods on the given map class, called by `MaplairMap` itself.\nexport function register(MaplairMap) {\n\tMaplairMap.include({\n\t\t// @namespace MaplairMap; @method getRenderer(layer: Path): Renderer\n\t\t// Returns the instance of `Renderer` that should be used to render the given\n\t\t// `Path`. It will ensure that the `renderer` options of the map and paths\n\t\t// are respected, and that the renderers do exist on the map.\n\t\tgetRenderer(layer) {\n\t\t\t// @namespace Path; @option renderer: Renderer\n\t\t\t// Use this specific instance of `Renderer` for this path. Takes\n\t\t\t// precedence over the map's [default renderer](#map-renderer).\n\t\t\t// If set, it will override the `pane` option of the path.\n\t\t\tlet renderer = layer.options.renderer ?? this._getPaneRenderer(layer.options.pane) ?? this.options.renderer ?? this._renderer;\n\n\t\t\tif (!renderer) {\n\t\t\t\trenderer = this._renderer = this._createRenderer();\n\t\t\t}\n\n\t\t\tif (!this.hasLayer(renderer)) {\n\t\t\t\tthis.addLayer(renderer);\n\t\t\t}\n\t\t\treturn renderer;\n\t\t},\n\n\t\t_getPaneRenderer(name) {\n\t\t\tif (name === 'overlayPane' || name === undefined) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tlet renderer = this._paneRenderers[name];\n\t\t\tif (renderer === undefined) {\n\t\t\t\trenderer = this._createRenderer({pane: name});\n\t\t\t\tthis._paneRenderers[name] = renderer;\n\t\t\t}\n\t\t\treturn renderer;\n\t\t},\n\n\t\t_createRenderer(options) {\n\t\t\t// @namespace MaplairMap; @option preferCanvas: Boolean = false\n\t\t\t// Whether `Path`s should be rendered on a `Canvas` renderer.\n\t\t\t// By default, all `Path`s are rendered in a `SVG` renderer.\n\t\t\treturn (this.options.preferCanvas && new Canvas(options)) || new SVG(options);\n\t\t}\n\t});\n}\n"],"mappings":";;;;;AAIA,SAAgB,SAAS,YAAY;CACpC,WAAW,QAAQ;EAKlB,YAAY,OAAO;GAKlB,IAAI,WAAW,MAAM,QAAQ,YAAY,KAAK,iBAAiB,MAAM,QAAQ,IAAI,KAAK,KAAK,QAAQ,YAAY,KAAK;GAEpH,IAAI,CAAC,UACJ,WAAW,KAAK,YAAY,KAAK,gBAAgB;GAGlD,IAAI,CAAC,KAAK,SAAS,QAAQ,GAC1B,KAAK,SAAS,QAAQ;GAEvB,OAAO;EACR;EAEA,iBAAiB,MAAM;GACtB,IAAI,SAAS,iBAAiB,SAAS,KAAA,GACtC;GAGD,IAAI,WAAW,KAAK,eAAe;GACnC,IAAI,aAAa,KAAA,GAAW;IAC3B,WAAW,KAAK,gBAAgB,EAAC,MAAM,KAAI,CAAC;IAC5C,KAAK,eAAe,QAAQ;GAC7B;GACA,OAAO;EACR;EAEA,gBAAgB,SAAS;GAIxB,OAAQ,KAAK,QAAQ,gBAAgB,IAAI,OAAO,OAAO,KAAM,IAAI,IAAI,OAAO;EAC7E;CACD,CAAC;AACF"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { stamp } from "../../core/Util.js";
|
|
2
|
+
import { BlanketOverlay } from "../BlanketOverlay.js";
|
|
3
|
+
//#region src/layer/vector/Renderer.js
|
|
4
|
+
var Renderer = class Renderer extends BlanketOverlay {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
super({
|
|
7
|
+
...options,
|
|
8
|
+
continuous: false
|
|
9
|
+
});
|
|
10
|
+
stamp(this);
|
|
11
|
+
this._layers ??= {};
|
|
12
|
+
this.callInitHooks(Renderer);
|
|
13
|
+
}
|
|
14
|
+
onAdd(map) {
|
|
15
|
+
super.onAdd(map);
|
|
16
|
+
this.on("update", this._updatePaths, this);
|
|
17
|
+
}
|
|
18
|
+
onRemove() {
|
|
19
|
+
super.onRemove();
|
|
20
|
+
this.off("update", this._updatePaths, this);
|
|
21
|
+
}
|
|
22
|
+
_onZoomEnd() {
|
|
23
|
+
for (const layer of Object.values(this._layers)) layer._project();
|
|
24
|
+
}
|
|
25
|
+
_updatePaths() {
|
|
26
|
+
for (const layer of Object.values(this._layers)) layer._update();
|
|
27
|
+
}
|
|
28
|
+
_onViewReset() {
|
|
29
|
+
for (const layer of Object.values(this._layers)) layer._reset();
|
|
30
|
+
}
|
|
31
|
+
_onSettled() {
|
|
32
|
+
this._update();
|
|
33
|
+
}
|
|
34
|
+
_update() {}
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { Renderer };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=Renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Renderer.js","names":[],"sources":["../../../../src/layer/vector/Renderer.js"],"sourcesContent":["import {BlanketOverlay} from '../BlanketOverlay.js';\nimport * as Util from '../../core/Util.js';\n\n/*\n * @class Renderer\n * @inherits BlanketOverlay\n *\n * Base class for vector renderer implementations (`SVG`, `Canvas`). Handles the\n * DOM container of the renderer, its bounds, and its zoom animation.\n *\n * A `Renderer` works as an implicit layer group for all `Path`s - the renderer\n * itself can be added or removed to the map. All paths use a renderer, which can\n * be implicit (the map will decide the type of renderer and use it automatically)\n * or explicit (using the [`renderer`](#path-renderer) option of the path).\n *\n * Do not use this class directly, use `SVG` and `Canvas` instead.\n *\n * The `continuous` option inherited from `BlanketOverlay` cannot be set to `true`\n * (otherwise, renderers get out of place during a pinch-zoom operation).\n *\n * @event update: Event\n * Fired when the renderer updates its bounds, center and zoom, for example when\n * its map has moved\n */\n\nexport class Renderer extends BlanketOverlay {\n\n\tconstructor(options) {\n\t\tsuper({...options, continuous: false});\n\t\tUtil.stamp(this);\n\t\tthis._layers ??= {};\n\n\t\tthis.callInitHooks(Renderer);\n\t}\n\n\tonAdd(map) {\n\t\tsuper.onAdd(map);\n\t\tthis.on('update', this._updatePaths, this);\n\t}\n\n\tonRemove() {\n\t\tsuper.onRemove();\n\t\tthis.off('update', this._updatePaths, this);\n\t}\n\n\t_onZoomEnd() {\n\t\t// When a zoom ends, the \"origin pixel\" changes. Internal coordinates\n\t\t// of paths are relative to the origin pixel and therefore need to\n\t\t// be recalculated.\n\t\tfor (const layer of Object.values(this._layers)) {\n\t\t\tlayer._project();\n\t\t}\n\t}\n\n\t_updatePaths() {\n\t\tfor (const layer of Object.values(this._layers)) {\n\t\t\tlayer._update();\n\t\t}\n\t}\n\n\t_onViewReset() {\n\t\tfor (const layer of Object.values(this._layers)) {\n\t\t\tlayer._reset();\n\t\t}\n\t}\n\n\t_onSettled() {\n\t\tthis._update();\n\t}\n\n\t// Subclasses are responsible of implementing `_update()`. It should fire\n\t// the 'update' event whenever appropriate (before/after rendering).\n\t_update() {}\n\n}\n"],"mappings":";;;AAyBA,IAAa,WAAb,MAAa,iBAAiB,eAAe;CAE5C,YAAY,SAAS;EACpB,MAAM;GAAC,GAAG;GAAS,YAAY;EAAK,CAAC;EACrC,MAAW,IAAI;EACf,KAAK,YAAY,CAAC;EAElB,KAAK,cAAc,QAAQ;CAC5B;CAEA,MAAM,KAAK;EACV,MAAM,MAAM,GAAG;EACf,KAAK,GAAG,UAAU,KAAK,cAAc,IAAI;CAC1C;CAEA,WAAW;EACV,MAAM,SAAS;EACf,KAAK,IAAI,UAAU,KAAK,cAAc,IAAI;CAC3C;CAEA,aAAa;EAIZ,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,OAAO,GAC7C,MAAM,SAAS;CAEjB;CAEA,eAAe;EACd,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,OAAO,GAC7C,MAAM,QAAQ;CAEhB;CAEA,eAAe;EACd,KAAK,MAAM,SAAS,OAAO,OAAO,KAAK,OAAO,GAC7C,MAAM,OAAO;CAEf;CAEA,aAAa;EACZ,KAAK,QAAQ;CACd;CAIA,UAAU,CAAC;AAEZ"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { splitWords, stamp } from "../../core/Util.js";
|
|
2
|
+
import { toBack, toFront } from "../../dom/DomUtil.js";
|
|
3
|
+
import { Renderer } from "./Renderer.js";
|
|
4
|
+
//#region src/layer/vector/SVG.js
|
|
5
|
+
var SVG = class SVG extends Renderer {
|
|
6
|
+
constructor(...args) {
|
|
7
|
+
super(...args);
|
|
8
|
+
this.callInitHooks(SVG);
|
|
9
|
+
}
|
|
10
|
+
_initContainer() {
|
|
11
|
+
this._container = SVG.create("svg");
|
|
12
|
+
this._container.setAttribute("pointer-events", "none");
|
|
13
|
+
this._rootGroup = SVG.create("g");
|
|
14
|
+
this._container.appendChild(this._rootGroup);
|
|
15
|
+
}
|
|
16
|
+
_destroyContainer() {
|
|
17
|
+
super._destroyContainer();
|
|
18
|
+
delete this._rootGroup;
|
|
19
|
+
delete this._svgSize;
|
|
20
|
+
}
|
|
21
|
+
_resizeContainer() {
|
|
22
|
+
const size = super._resizeContainer();
|
|
23
|
+
if (!this._svgSize || !this._svgSize.equals(size)) {
|
|
24
|
+
this._svgSize = size;
|
|
25
|
+
this._container.setAttribute("width", size.x);
|
|
26
|
+
this._container.setAttribute("height", size.y);
|
|
27
|
+
}
|
|
28
|
+
const b = this._bounds;
|
|
29
|
+
if (b) this._container.setAttribute("viewBox", [
|
|
30
|
+
b.min.x,
|
|
31
|
+
b.min.y,
|
|
32
|
+
size.x,
|
|
33
|
+
size.y
|
|
34
|
+
].join(" "));
|
|
35
|
+
}
|
|
36
|
+
_update() {
|
|
37
|
+
if (this._map._animatingZoom && this._bounds) return;
|
|
38
|
+
const b = this._bounds, size = b.getSize();
|
|
39
|
+
this._container.setAttribute("viewBox", [
|
|
40
|
+
b.min.x,
|
|
41
|
+
b.min.y,
|
|
42
|
+
size.x,
|
|
43
|
+
size.y
|
|
44
|
+
].join(" "));
|
|
45
|
+
this.fire("update");
|
|
46
|
+
}
|
|
47
|
+
_initPath(layer) {
|
|
48
|
+
const path = layer._path = SVG.create("path");
|
|
49
|
+
if (layer.options.className) path.classList.add(...splitWords(layer.options.className));
|
|
50
|
+
if (layer.options.interactive) path.classList.add("maplair-interactive");
|
|
51
|
+
this._updateStyle(layer);
|
|
52
|
+
this._layers[stamp(layer)] = layer;
|
|
53
|
+
}
|
|
54
|
+
_addPath(layer) {
|
|
55
|
+
if (!this._rootGroup) this._initContainer();
|
|
56
|
+
this._rootGroup.appendChild(layer._path);
|
|
57
|
+
layer.addInteractiveTarget(layer._path);
|
|
58
|
+
}
|
|
59
|
+
_removePath(layer) {
|
|
60
|
+
layer._path.remove();
|
|
61
|
+
layer.removeInteractiveTarget(layer._path);
|
|
62
|
+
delete this._layers[stamp(layer)];
|
|
63
|
+
}
|
|
64
|
+
_updatePath(layer) {
|
|
65
|
+
layer._project();
|
|
66
|
+
layer._update();
|
|
67
|
+
}
|
|
68
|
+
_updateStyle(layer) {
|
|
69
|
+
const path = layer._path, options = layer.options;
|
|
70
|
+
if (!path) return;
|
|
71
|
+
if (options.stroke) {
|
|
72
|
+
path.setAttribute("stroke", options.color);
|
|
73
|
+
path.setAttribute("stroke-opacity", options.opacity);
|
|
74
|
+
path.setAttribute("stroke-width", options.weight);
|
|
75
|
+
path.setAttribute("stroke-linecap", options.lineCap);
|
|
76
|
+
path.setAttribute("stroke-linejoin", options.lineJoin);
|
|
77
|
+
if (options.dashArray) path.setAttribute("stroke-dasharray", options.dashArray);
|
|
78
|
+
else path.removeAttribute("stroke-dasharray");
|
|
79
|
+
if (options.dashOffset) path.setAttribute("stroke-dashoffset", options.dashOffset);
|
|
80
|
+
else path.removeAttribute("stroke-dashoffset");
|
|
81
|
+
} else path.setAttribute("stroke", "none");
|
|
82
|
+
if (options.fill) {
|
|
83
|
+
path.setAttribute("fill", options.fillColor || options.color);
|
|
84
|
+
path.setAttribute("fill-opacity", options.fillOpacity);
|
|
85
|
+
path.setAttribute("fill-rule", options.fillRule || "evenodd");
|
|
86
|
+
} else path.setAttribute("fill", "none");
|
|
87
|
+
}
|
|
88
|
+
_updatePoly(layer, closed) {
|
|
89
|
+
this._setPath(layer, SVG.pointsToPath(layer._parts, closed));
|
|
90
|
+
}
|
|
91
|
+
_updateCircle(layer) {
|
|
92
|
+
const p = layer._point, r = Math.max(Math.round(layer._pxRadius), 1), arc = `a${r},${Math.max(Math.round(layer._pxRadiusY), 1) || r} 0 1,0 `;
|
|
93
|
+
const d = layer._empty() ? "M0 0" : `M${p.x - r},${p.y}${arc}${r * 2},0 ${arc}${-r * 2},0 `;
|
|
94
|
+
this._setPath(layer, d);
|
|
95
|
+
}
|
|
96
|
+
_setPath(layer, path) {
|
|
97
|
+
layer._path.setAttribute("d", path);
|
|
98
|
+
}
|
|
99
|
+
_bringToFront(layer) {
|
|
100
|
+
toFront(layer._path);
|
|
101
|
+
}
|
|
102
|
+
_bringToBack(layer) {
|
|
103
|
+
toBack(layer._path);
|
|
104
|
+
}
|
|
105
|
+
static create(name) {
|
|
106
|
+
return document.createElementNS("http://www.w3.org/2000/svg", name);
|
|
107
|
+
}
|
|
108
|
+
static pointsToPath(rings, closed) {
|
|
109
|
+
return rings.flatMap((points) => [...points.map((p, j) => `${(j ? "L" : "M") + p.x} ${p.y}`), closed ? "z" : ""]).join("") || "M0 0";
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
//#endregion
|
|
113
|
+
export { SVG };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=SVG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SVG.js","names":[],"sources":["../../../../src/layer/vector/SVG.js"],"sourcesContent":["import {Renderer} from './Renderer.js';\nimport * as DomUtil from '../../dom/DomUtil.js';\nimport {splitWords, stamp} from '../../core/Util.js';\n\n/*\n * @class SVG\n * @inherits Renderer\n *\n * Allows vector layers to be displayed with [SVG](https://developer.mozilla.org/docs/Web/SVG).\n * Inherits `Renderer`.\n *\n * @example\n *\n * Use SVG by default for all paths in the map:\n *\n * ```js\n * const map = new MaplairMap('map', {\n * \trenderer: new SVG()\n * });\n * ```\n *\n * Use a SVG renderer with extra padding for specific vector geometries:\n *\n * ```js\n * const map = new MaplairMap('map');\n * const myRenderer = new SVG({ padding: 0.5 });\n * const line = new Polyline( coordinates, { renderer: myRenderer } );\n * const circle = new Circle( center, { renderer: myRenderer, radius: 100 } );\n * ```\n */\n\n// @namespace SVG\n// @constructor SVG(options?: Renderer options)\n// Creates a SVG renderer with the given options.\nexport class SVG extends Renderer {\n\tconstructor(...args) {\n\t\tsuper(...args);\n\t\tthis.callInitHooks(SVG);\n\t}\n\n\n\t_initContainer() {\n\t\tthis._container = SVG.create('svg');\n\n\t\t// makes it possible to click through svg root; we'll reset it back in individual paths\n\t\tthis._container.setAttribute('pointer-events', 'none');\n\n\t\tthis._rootGroup = SVG.create('g');\n\t\tthis._container.appendChild(this._rootGroup);\n\t}\n\n\t_destroyContainer() {\n\t\tsuper._destroyContainer();\n\t\tdelete this._rootGroup;\n\t\tdelete this._svgSize;\n\t}\n\n\t_resizeContainer() {\n\t\tconst size = super._resizeContainer();\n\n\t\t// set size of svg-container if changed\n\t\tif (!this._svgSize || !this._svgSize.equals(size)) {\n\t\t\tthis._svgSize = size;\n\t\t\tthis._container.setAttribute('width', size.x);\n\t\t\tthis._container.setAttribute('height', size.y);\n\t\t}\n\n\t\t// Reset the <SVG>'s viewBox as per _update, but skip redrawing paths.\n\t\t// This keeps paths visually aligned when resizing.\n\t\tconst b = this._bounds;\n\t\tif (b) {\n\t\t\tthis._container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' '));\n\t\t}\n\t}\n\n\t_update() {\n\t\tif (this._map._animatingZoom && this._bounds) { return; }\n\n\t\tconst b = this._bounds,\n\t\tsize = b.getSize();\n\n\t\t// movement: update container viewBox so that we don't have to change coordinates of individual layers\n\t\tthis._container.setAttribute('viewBox', [b.min.x, b.min.y, size.x, size.y].join(' '));\n\n\t\tthis.fire('update');\n\t}\n\n\t// methods below are called by vector layers implementations\n\n\t_initPath(layer) {\n\t\tconst path = layer._path = SVG.create('path');\n\n\t\t// @namespace Path\n\t\t// @option className: String = null\n\t\t// Custom class name set on an element. Only for SVG renderer.\n\t\tif (layer.options.className) {\n\t\t\tpath.classList.add(...splitWords(layer.options.className));\n\t\t}\n\n\t\tif (layer.options.interactive) {\n\t\t\tpath.classList.add('maplair-interactive');\n\t\t}\n\n\t\tthis._updateStyle(layer);\n\t\tthis._layers[stamp(layer)] = layer;\n\t}\n\n\t_addPath(layer) {\n\t\tif (!this._rootGroup) { this._initContainer(); }\n\t\tthis._rootGroup.appendChild(layer._path);\n\t\tlayer.addInteractiveTarget(layer._path);\n\t}\n\n\t_removePath(layer) {\n\t\tlayer._path.remove();\n\t\tlayer.removeInteractiveTarget(layer._path);\n\t\tdelete this._layers[stamp(layer)];\n\t}\n\n\t_updatePath(layer) {\n\t\tlayer._project();\n\t\tlayer._update();\n\t}\n\n\t_updateStyle(layer) {\n\t\tconst path = layer._path,\n\t\toptions = layer.options;\n\n\t\tif (!path) { return; }\n\n\t\tif (options.stroke) {\n\t\t\tpath.setAttribute('stroke', options.color);\n\t\t\tpath.setAttribute('stroke-opacity', options.opacity);\n\t\t\tpath.setAttribute('stroke-width', options.weight);\n\t\t\tpath.setAttribute('stroke-linecap', options.lineCap);\n\t\t\tpath.setAttribute('stroke-linejoin', options.lineJoin);\n\n\t\t\tif (options.dashArray) {\n\t\t\t\tpath.setAttribute('stroke-dasharray', options.dashArray);\n\t\t\t} else {\n\t\t\t\tpath.removeAttribute('stroke-dasharray');\n\t\t\t}\n\n\t\t\tif (options.dashOffset) {\n\t\t\t\tpath.setAttribute('stroke-dashoffset', options.dashOffset);\n\t\t\t} else {\n\t\t\t\tpath.removeAttribute('stroke-dashoffset');\n\t\t\t}\n\t\t} else {\n\t\t\tpath.setAttribute('stroke', 'none');\n\t\t}\n\n\t\tif (options.fill) {\n\t\t\tpath.setAttribute('fill', options.fillColor || options.color);\n\t\t\tpath.setAttribute('fill-opacity', options.fillOpacity);\n\t\t\tpath.setAttribute('fill-rule', options.fillRule || 'evenodd');\n\t\t} else {\n\t\t\tpath.setAttribute('fill', 'none');\n\t\t}\n\t}\n\n\t_updatePoly(layer, closed) {\n\t\tthis._setPath(layer, SVG.pointsToPath(layer._parts, closed));\n\t}\n\n\t_updateCircle(layer) {\n\t\tconst p = layer._point,\n\t\tr = Math.max(Math.round(layer._pxRadius), 1),\n\t\tr2 = Math.max(Math.round(layer._pxRadiusY), 1) || r,\n\t\tarc = `a${r},${r2} 0 1,0 `;\n\n\t\t// drawing a circle with two half-arcs\n\t\tconst d = layer._empty() ? 'M0 0' :\n\t\t\t`M${p.x - r},${p.y\n\t\t\t}${arc}${r * 2},0 ${\n\t\t\t\tarc}${-r * 2},0 `;\n\n\t\tthis._setPath(layer, d);\n\t}\n\n\t_setPath(layer, path) {\n\t\tlayer._path.setAttribute('d', path);\n\t}\n\n\t// SVG does not have the concept of zIndex so we resort to changing the DOM order of elements\n\t_bringToFront(layer) {\n\t\tDomUtil.toFront(layer._path);\n\t}\n\n\t_bringToBack(layer) {\n\t\tDomUtil.toBack(layer._path);\n\t}\n\n\t// @function create(name: String): SVGElement\n\t// Returns a instance of [SVGElement](https://developer.mozilla.org/docs/Web/API/SVGElement),\n\t// corresponding to the class name passed. For example, using 'line' will return\n\t// an instance of [SVGLineElement](https://developer.mozilla.org/docs/Web/API/SVGLineElement).\n\tstatic create(name) {\n\t\treturn document.createElementNS('http://www.w3.org/2000/svg', name);\n\t}\n\n\t// @function pointsToPath(rings: Point[], closed: Boolean): String\n\t// Generates a SVG path string for multiple rings, with each ring turning\n\t// into \"M..L..L..\" instructions\n\tstatic pointsToPath(rings, closed) {\n\t\tconst str = rings.flatMap(points => [\n\t\t\t...points.map((p, j) => `${(j ? 'L' : 'M') + p.x} ${p.y}`),\n\t\t\t// closes the ring for polygons\n\t\t\tclosed ? 'z' : ''\n\t\t]).join('');\n\n\t\t// SVG complains about empty path strings\n\t\treturn str || 'M0 0';\n\t}\n\n}\n"],"mappings":";;;;AAkCA,IAAa,MAAb,MAAa,YAAY,SAAS;CACjC,YAAY,GAAG,MAAM;EACpB,MAAM,GAAG,IAAI;EACb,KAAK,cAAc,GAAG;CACvB;CAGA,iBAAiB;EAChB,KAAK,aAAa,IAAI,OAAO,KAAK;EAGlC,KAAK,WAAW,aAAa,kBAAkB,MAAM;EAErD,KAAK,aAAa,IAAI,OAAO,GAAG;EAChC,KAAK,WAAW,YAAY,KAAK,UAAU;CAC5C;CAEA,oBAAoB;EACnB,MAAM,kBAAkB;EACxB,OAAO,KAAK;EACZ,OAAO,KAAK;CACb;CAEA,mBAAmB;EAClB,MAAM,OAAO,MAAM,iBAAiB;EAGpC,IAAI,CAAC,KAAK,YAAY,CAAC,KAAK,SAAS,OAAO,IAAI,GAAG;GAClD,KAAK,WAAW;GAChB,KAAK,WAAW,aAAa,SAAS,KAAK,CAAC;GAC5C,KAAK,WAAW,aAAa,UAAU,KAAK,CAAC;EAC9C;EAIA,MAAM,IAAI,KAAK;EACf,IAAI,GACH,KAAK,WAAW,aAAa,WAAW;GAAC,EAAE,IAAI;GAAG,EAAE,IAAI;GAAG,KAAK;GAAG,KAAK;EAAC,CAAC,CAAC,KAAK,GAAG,CAAC;CAEtF;CAEA,UAAU;EACT,IAAI,KAAK,KAAK,kBAAkB,KAAK,SAAW;EAEhD,MAAM,IAAI,KAAK,SACf,O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