12345678910 |
- /*!
- *
- * Copyright (c) 2014 Teralytics AG
- * Copyright© 2000-2017 SuperMap Software Co. Ltd
- * Leaflet.D3SvgOverlay.(https://github.com/SuperMap/Leaflet.D3SvgOverlay)
- * license: MIT
- * version: v2.2.0
- *
- */
- !function(t){function o(i){if(e[i])return e[i].exports;var n=e[i]={i:i,l:!1,exports:{}};return t[i].call(n.exports,n,n.exports,o),n.l=!0,n.exports}var e={};o.m=t,o.c=e,o.i=function(t){return t},o.d=function(t,e,i){o.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,o){return Object.prototype.hasOwnProperty.call(t,o)},o.p="",o(o.s=4)}([function(t,o,e){"use strict";Object.defineProperty(o,"__esModule",{value:!0}),o.d3SvgOverlay=o.D3SvgOverlay=void 0;var i=function(t){return t&&t.__esModule?t:{default:t}}(e(2)),n=function(t){if(t&&t.__esModule)return t;var o={};if(null!=t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(o[e]=t[e]);return o.default=t,o}(e(3));i.default.version>="1.0"&&n.select("head").append("style").attr("type","text/css").text("g.d3-overlay *{pointer-events:visiblePainted;}");var s=o.D3SvgOverlay=(i.default.version<"1.0"?i.default.Class:i.default.Layer).extend({includes:i.default.version<"1.0"?i.default.Mixin.Events:[],version:"2.2",_undef:function(t){return void 0===t},_options:function(t){return this._undef(t)?this.options:(t.zoomHide=!this._undef(t.zoomHide)&&t.zoomHide,t.zoomDraw=!!this._undef(t.zoomDraw)||t.zoomDraw,this.options=t)},_disableLeafletRounding:function(){this._leaflet_round=i.default.Point.prototype._round,i.default.Point.prototype._round=function(){return this}},_enableLeafletRounding:function(){i.default.Point.prototype._round=this._leaflet_round},draw:function(){this._disableLeafletRounding(),this._drawCallback(this.selection,this.projection,this.map.getZoom()),this._enableLeafletRounding()},initialize:function(t,o){this._options(o||{}),this._drawCallback=t},_zoomChange:function(t){this._disableLeafletRounding();var o=this._undef(t.zoom)?this.map._zoom:t.zoom;this._zoomDiff=o-this._zoom,this._scale=Math.pow(2,this._zoomDiff),this.projection.scale=this._scale,this._shift=this.map.latLngToLayerPoint(this._wgsOrigin)._subtract(this._wgsInitialShift.multiplyBy(this._scale));var e=["translate(",this._shift.x,",",this._shift.y,") "],i=["scale(",this._scale,",",this._scale,") "];this._rootGroup.attr("transform",e.concat(i).join("")),this.options.zoomDraw&&this.draw(),this._enableLeafletRounding()},onAdd:function(t){this.map=t;var o=this;i.default.version<"1.0"?(t._initPathRoot(),this._svg=n.select(t._panes.overlayPane).select("svg"),this._rootGroup=this._svg.append("g")):(this._svg=i.default.svg(),t.addLayer(this._svg),this._rootGroup=n.select(this._svg._rootGroup).classed("d3-overlay",!0)),this._rootGroup.classed("leaflet-zoom-hide",this.options.zoomHide),this.selection=this._rootGroup;var e=this,s=n.selection.prototype.on;n.selection.prototype.on=function(t,o,i){s.apply(e.selection,[t,o,i]),e.map.on(t,function(){e.selection.dispatch(t)})},this._pixelOrigin=t.getPixelOrigin(),this._wgsOrigin=i.default.latLng([0,0]),this._wgsInitialShift=this.map.latLngToLayerPoint(this._wgsOrigin),this._zoom=this.map.getZoom(),this._shift=i.default.point(0,0),this._scale=1,this.projection={latLngToLayerPoint:function(t,e){return e=o._undef(e)?o._zoom:e,o.map.project(i.default.latLng(t),e)._round()._subtract(o._pixelOrigin)},layerPointToLatLng:function(t,e){e=o._undef(e)?o._zoom:e;var n=i.default.point(t).add(o._pixelOrigin);return o.map.unproject(n,e)},unitsPerMeter:256*Math.pow(2,o._zoom)/40075017,map:o.map,layer:o,scale:1},this.projection._projectPoint=function(t,e){var n=o.projection.latLngToLayerPoint(new i.default.LatLng(e,t));this.stream.point(n.x,n.y)},this.projection.pathFromGeojson=n.geoPath().projection(n.geoTransform({point:this.projection._projectPoint})),this.projection.latLngToLayerFloatPoint=this.projection.latLngToLayerPoint,this.projection.getZoom=this.map.getZoom.bind(this.map),this.projection.getBounds=this.map.getBounds.bind(this.map),this.selection=this._rootGroup,i.default.version<"1.0"&&t.on("viewreset",this._zoomChange,this),this.draw()},getEvents:function(){return{zoomend:this._zoomChange}},onRemove:function(t){i.default.version<"1.0"?(t.off("viewreset",this._zoomChange,this),this._rootGroup.remove()):this._svg.remove()},addTo:function(t){return t.addLayer(this),this}}),r=o.d3SvgOverlay=function(t,o){return new s(t,o)};i.default.supermap=i.default.supermap||{},i.default.supermap.d3Layer=r},function(t,o,e){"use strict";e(0)},function(t,o){t.exports=L},function(t,o){t.exports=d3},function(t,o,e){e(1),t.exports=e(0)}]);
|