mirror of
https://github.com/jiawanlong/Cesium-Examples.git
synced 2025-07-05 15:47:34 +00:00
11 lines
1018 KiB
JavaScript
11 lines
1018 KiB
JavaScript
![]() |
/*!
|
||
|
*
|
||
|
* iclient-plot-leaflet.(https://iclient.supermap.io)
|
||
|
* Copyright© 2000 - 2023 SuperMap Software Co.Ltd
|
||
|
* version: v11.1.0
|
||
|
*
|
||
|
*/(()=>{var t={705:()=>{L.Path.include({onBefore:function(t){this._renderer._beforePath(this,t),this._reset(),this._renderer._addPath(this)}})},714:()=>{L.SVG.include({_drawPlottingLayers:function(t){t.map(function(e){return e instanceof L.Polyline&&e._update(),e instanceof L.Polygon&&e._update(),t})},getEvents:function(){var t=this;this._map.on("layeradd",function(e){e.layer===t&&(L.DomEvent.on(t._container,"mousemove",L.Util.throttle(t._onMouseMove,32,t),t),L.DomEvent.on(t._container,"mouseout",t._handleMouseOut,t))});var e=L.Renderer.prototype.getEvents.call(this);return e.zoomstart=this._onZoomStart,e},_onClick:function(t){var e,i=this._map.mouseEventToLayerPoint(t),o=[],l=[];for(var s in this._layers){var n=this._layers[s];if(n.options.interactive&&"function"==typeof n._containsPoint&&n._containsPoint(i)&&!this._map._draggableMoved(n)&&(e=n,Object.prototype.hasOwnProperty.call(e,"_eventParents")&&null!=e._eventParents))for(var a in e._eventParents)l.push(e),o.push(e._eventParents[a])}if(e&&l.length>1){if(o.length>0){var r=!1,p=[],u=[];for(let t=0,e=o.length;t<e;t++)o[t].isSelected&&o[t].moveend&&(r=!0),o[t].enableEdit&&(p.push(o[t]),u.push(l[t]));for(let e=0,i=p.length;e<i;e++){if(p[e].isSelected&&p[e].moveend){p[e].moveend=!1,this._fireEvent([u[e]],t),p[e].moveend=!0;break}if(p[e].isSelected&&p.length>1){this._fireEvent([u[e]],t);break}if(!r){this._fireEvent([u[u.length-1]],t);break}}}}else e&&e._eventParents[0]&&e._eventParents[0].fire(t.type,t)},_onMouseMove:function(t){if(this._map&&!this._map.dragging.moving()&&!this._map._animatingZoom){var e=this._map.mouseEventToLayerPoint(t);this._handleMouseHover(t,e)}},_handleMouseOut:function(t){var e=this._hoveredLayer;e&&(L.DomUtil.removeClass(this._container,"leaflet-interactive"),this._fireEvent([e],t,"mouseout"),this._hoveredLayer=null)},_handleMouseHover:function(t,e){var i,o;for(var l in this._layers)(i=this._layers[l]).options.interactive&&"function"==typeof i._containsPoint&&i._containsPoint(e)&&(o=i);o!==this._hoveredLayer&&(this._handleMouseOut(t),o&&(L.DomUtil.addClass(this._container,"leaflet-interactive"),this._fireEvent([o],t,"mouseover"),this._hoveredLayer=o)),this._hoveredLayer&&this._fireEvent([this._hoveredLayer],t)},_fireEvent:function(t,e,i){this._map._fireDOMEvent(e,i||e.type,t)},_updateTextPt:function(t,e,i,o){var l;if(t.setAttributeNS(null,"x",e.x),t.setAttributeNS(null,"y",e.y),i.options.display&&t.setAttributeNS(null,"display",i.options.display),!0===i.options.fontStroke&&(i.options.fontStrokeColor&&t.setAttributeNS(null,"stroke",i.options.fontStrokeColor),i.options.fontStrokeWidth&&t.setAttributeNS(null,"stroke-width",i.options.fontStrokeWidth)),i.options.labelRotation&&t.setAttributeNS(null,"transform","rotate("+i.options.labelRotation+" "+e.x+","+e.y+")"),i.options.fontColor&&t.setAttributeNS(null,"fill",i.options.fontColor),i.options.fontOpacity&&t.setAttributeNS(null,"opacity",i.options.fontOpacity),i.options.fontFamily&&t.setAttributeNS(null,"font-family",i.options.fontFamily),i.options.fontSize&&t.setAttributeNS(null,"font-size",i.options.fontSize),i.options.fontWeight&&t.setAttributeNS(null,"font-weight",i.options.fontWeight),i.options.fontStyle&&t.setAttributeNS(null,"font-layer.options",i.options.fontStyle),L.Browser.gecko){if(100!==i.options.fontPercent&&0!==i.options.fontSpace&&(l=i.options.fontSpace+i.options.fontPercent/100*parseFloat(i.options.fontSize)*i.options.text.length),100!==i.options.fontPercent&&0===i.options.fontSpace){var s=document.createElement("span");document.body.appendChild(s),s.style.width="auto",s.style.height="auto",i.options.fontSize&&(s.style.fontSize=new String(i.options.fontSize)+"px"),i.options.fontFamily&&(s.style.fontFamily=i.options.fontFamily),i.options.fontWeight&&(s.style.fontWeight=i.options.fontWeight),s.style.position="absolute",s.style.visibility="hidden",s.innerHTML=i.options.text;var n=s.clientWidth;l=i.options.fontPercent/100*n+i.options.text.length}t.setAttributeNS(null,"textLength",l),t.setAttributeNS(null,"lengthAdjust","spacingAndGlyphs")}t.setAttributeNS(null,"pointer-events","visible")
|
||
|
/* Copyright© 2000 - 2018 SuperMap Software Co.Ltd. All rights reserved.
|
||
|
* This program are made available under the terms of the Apache License, Version 2.0
|
||
|
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
|
||
|
class h{constructor(t,e,i,o){this.x=parseFloat(t),this.y=parseFloat(e),this.tag=o||0==o?parseFloat(o):null,this.type=i||"Point",this.CLASS_NAME="SuperMapAlgoPlot"}clone(t){return null==t&&(t=new h(this.x,this.y)),SuperMap.Util.applyDefaults(t,this),t}calculateBounds(){this.bounds=new Bounds(this.x,this.y,this.x,this.y)}equals(t){var e=!1;return null!=t&&(e=this.x===t.x&&this.y===t.y||isNaN(this.x)&&isNaN(this.y)&&isNaN(t.x)&&isNaN(t.y)),e}move(t,e){this.x=this.x+t,this.y=this.y+e,this.clearBounds()}toShortString(){return this.x+", "+this.y}destroy(){this.x=null,this.y=null,this.tag=null,super.destroy()}getVertices(t){return[this]}}SuperMapAlgoPlot.Point=h;SuperMapAlgoPlot.AnalysisSymbol=SuperMapAlgoPlot.AnalysisSymbol||{};SuperMapAlgoPlot.AnalysisSymbol.analysisBasicInfo=function(t){let e=new Object;return e.libID=t.libID,e.code=t.code,e.symbolType=t.symbolType,e.symbolName=t.symbolName,e.textContent=t.textContent,e.minEditPts=t.algoMinEditPts,e.maxEditPts=t.algoMaxEditPts,e.surroundLineType=t.surroundLineType,e},SuperMapAlgoPlot.AnalysisSymbol.analysisDotBasicInfo=function(t){let e=SuperMapAlgoPlot.PlottingUtil.DPI,i=new Object;i.anchorPoint=new SuperMapAlgoPlot.Point(t.anchorPoint.x,t.anchorPoint.y);let o=0,l=0;return void 0!==t.symbolSizeInLib?(o=Math.round(t.symbolSizeInLib.x*e/25.4/10),l=Math.round(t.symbolSizeInLib.y*e/25.4/10)):(o=Math.round(t.symbolSize.x*e/25.4/10),l=Math.round(t.symbolSize.y*e/25.4/10)),i.symbolSizeInLib=new SuperMap.Size(o,l),i.symbolSizeInLib.w=o,i.symbolSizeInLib.h=l,t.middleMarkBounds&&(i.middleMarkBounds=new SuperMap.Bounds(t.middleMarkBounds.leftBottom.x,t.middleMarkBounds.leftBottom.y,t.middleMarkBounds.rightTop.x,t.middleMarkBounds.rightTop.y)),i},SuperMapAlgoPlot.AnalysisSymbol.analysisAlgoBasicInfo=function(t,e){let i=new Object;if(i.subSymbols=[],i.scalePoints=[],i.scaleValues=[],e&&t.subSymbols)for(let e=0;e<t.subSymbols.length;e++)i.subSymbols.push(new SuperMapAlgoPlot.SubSymbol(t.libID,t.subSymbols[e]));if(t.scalePoints){i.scalePoints=[];for(let e=0;e<t.scalePoints.length;e++){let o=new SuperMapAlgoPlot.Point(t.scalePoints[e].x,t.scalePoints[e].y);o.tag=e,o.isScalePoint=!0,i.scalePoints.push(o)}}if(t.scaleValues)for(let e=0;e<t.scaleValues.length;e++)i.scaleValues.push(t.scaleValues[e]);return i},SuperMapAlgoPlot.AnalysisSymbol.analysisSymbolCells=function(t,e){let i=[];if(t&&(function(t,i){if(t.innerCells&&t.innerCells.length)for(let o=0;o<t.innerCells.length;o++){let l=t.innerCells[o];if(t.symbolIsCanFill&&l.type!==SuperMapAlgoPlot.SymbolType.ARBITRARYPOLYGONSYMBOL){let o=new Object,s=SuperMapAlgoPlot.AnalysisSymbol.getStyle(t,e);o.type=32,o.style={fillSymbolID:s.fillSymbolID,fillColor:s.fillColor,fillOpacity:s.fillOpacity,strokeOpacity:0,strokeWidth:0,fillLimit:!1,lineColorLimit:!0,lineWidthLimit:!0},o.positionPoints=[];for(let t=0;t<l.positionPoints.length;t++){let e=new SuperMapAlgoPlot.Point(l.positionPoints[t].x,l.positionPoints[t].y);o.positionPoints.push(e)}i.push(o)}}}(t,i),t.innerCells)){let o=t.innerCells;if(0!==o.length)for(let t=0;t<o.length;t++)i.push(SuperMapAlgoPlot.AnalysisSymbol.analysisInnerCell(o[t],e))}return i},SuperMapAlgoPlot.AnalysisSymbol.analysisInnerCell=function(t,e){let i=new Object;if(i.positionPoints=[],t){if(void 0!==t.polybezierClose&&(i.polybezierClose=t.polybezierClose),i.type=t.type,i.surroundLineFlag=t.surroundLineFlag,i.textContent=t.textContent,i.style=SuperMapAlgoPlot.AnalysisSymbol.getStyle(t,e),null!=t.positionPoints){let e=t.positionPoints;for(let t=0;t<e.length;t++){let o=new SuperMapAlgoPlot.Point(e[t].x,e[t].y);i.positionPoints.push(o)}}if(i.style.lineColorLimit=t.lineColorLimit,i.style.lineTypeLimit=t.lineTypeLimit,i.style.lineWidthLimit=t.lineWidthLimit,i.style.fillLimit=t.fillLimit,i.style.fillColorLimit=t.fillColorLimit,i.style.fontColorLimit=t.fontColorLimit,i.style.surroundLineLimit=t.surroundLineLimit,i.style.surroundLineFlag=t.surroundLineFlag,i.style.surroundLineType=t.surroundLineType,34==t.type?i.style.fontColorLimit=!0:i.style.fontColorLimit=t.fontColorLimit,i.type===SuperMapAlgoPlot.SymbolType.RECTANGLESYMBOL){let t=i.p
|