Custom Gis Application with Arcgis Javascript API with modern layouting
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

13 lines
5.0 KiB

// All material copyright Esri, All Rights Reserved, unless otherwise specified.
// See https://js.arcgis.com/4.30/esri/copyright.txt for details.
//>>built
define("require ../../chunks/tslib.es6 ../../core/deprecate ../../core/handleUtils ../../core/Logger ../../core/maybe ../../core/accessorSupport/decorators/property ../../core/accessorSupport/decorators/cast ../../core/RandomLCG ../../core/has ../../core/accessorSupport/decorators/subclass ../Widget ../../chunks/componentsUtils ./globalCss ./widgetUtils ./decorators/messageBundle ./jsxFactory ./SelectionToolbar/SelectionToolbarViewModel".split(" "),function(k,d,l,p,m,q,e,r,c,B,t,u,v,w,C,x,f,y){const n=
{lassoTool:!0,rectangleTool:!0},z={createTool:"polygon",mode:"freehand"},A={createTool:"rectangle"};c=class extends u{constructor(a,b){super(a,b);this.messages=this.activeToolInfo=this._viewModelHandlesGroup=null;this.toolConfigs=[];this.viewModel=new y;this.visibleElements={...n};this._viewModelHandlesGroup=p.handlesGroup([this.viewModel.on("complete",g=>{this._set("activeToolInfo",null);this.emit("complete",g)})])}destroy(){this._viewModelHandlesGroup=q.removeMaybe(this._viewModelHandlesGroup)}loadDependencies(){return v.loadCalciteComponents({action:()=>
new Promise((a,b)=>k(["../../chunks/calcite-action"],a,b)),icon:()=>new Promise((a,b)=>k(["../../chunks/calcite-icon"],a,b))})}get label(){return this.messages?.widgetLabel??""}set label(a){this._overrideIfSome("label",a)}get layers(){l.deprecatedProperty(m.getLogger(this),"layers",{replacement:"Use SelectionToolbar.sources instead."});return this.viewModel.sources}set layers(a){l.deprecatedProperty(m.getLogger(this),"layers",{replacement:"Use SelectionToolbar.sources instead."});this.viewModel.sources=
a}get sources(){return this.viewModel.sources}set sources(a){this.viewModel.sources=a}get view(){return this.viewModel.view}set view(a){this.viewModel.view=a}castVisibleElements(a){return{...n,...a}}get visibleToolCount(){const {view:a,toolConfigs:b,visibleElements:g}=this;return(b?.length??0)+("2d"===a?.type?(g.lassoTool?1:0)+(g.rectangleTool?1:0):0)}activate(a){this.cancel();if("disabled"!==this.viewModel.state)switch(a){case "lasso":this._activateTool("lasso");break;case "rectangle":this._activateTool("rectangle");
break;default:this._activateTool(a)}}cancel(){this.viewModel.cancel();this._set("activeToolInfo",null)}render(){return f.tsx("div",{"aria-label":this.label,class:this.classes("esri-selection-toolbar",w.globalCss.widget)},f.tsx("div",{class:"esri-selection-toolbar__container"},this._renderDefaultTools(),this._renderCustomTools()))}_renderDefaultTools(){if("2d"===this.view?.type)return[this._renderRectangleTool(),this._renderLassoTool()]}_renderCustomTools(){if(this.toolConfigs?.length)return this.toolConfigs.map(({toolName:a,
icon:b})=>f.tsx("calcite-action",{active:this.activeToolInfo?.toolName===a,bind:this,class:"esri-selection-toolbar__tool-button",disabled:"disabled"===this.viewModel.state,onclick:()=>this._onCustomToolClick(a),scale:"s",text:a,title:a},f.tsx("calcite-icon",{icon:b||"selection",scale:"s"})))}_renderLassoTool(){const {activeToolInfo:a,messages:b,visibleElements:g}=this;if(g.lassoTool){var h=b.selectByLasso;return f.tsx("calcite-action",{active:"lasso"===a?.toolName,bind:this,disabled:"disabled"===
this.viewModel.state,onclick:this._onLassoToolClick,scale:"s",text:h,title:h},f.tsx("calcite-icon",{icon:"lasso-select",scale:"s"}))}}_renderRectangleTool(){const {activeToolInfo:a,messages:b,visibleElements:g}=this;if(g.rectangleTool){var h=b.selectByRectangle;return f.tsx("calcite-action",{active:"rectangle"===a?.toolName,bind:this,disabled:"disabled"===this.viewModel.state,onclick:this._onRectangleToolClick,scale:"s",text:h,title:h},f.tsx("calcite-icon",{icon:"cursor-marquee",scale:"s"}))}}_onCustomToolClick(a){this._toggleTool(a)}_onLassoToolClick(){this._toggleTool("lasso")}_onRectangleToolClick(){this._toggleTool("rectangle")}_activateTool(a){var b=
this._getToolOptions(a);b&&(b=this.viewModel.activate(b))&&this._set("activeToolInfo",{toolName:a,operation:b})}_toggleTool(a){if(this.activeToolInfo){const b=this.activeToolInfo.toolName;this.cancel();if(b===a)return}this._activateTool(a)}_getToolOptions(a){return"lasso"===a?z:"rectangle"===a?A:this.toolConfigs.find(b=>b.toolName===a)}};d.__decorate([e.property({readOnly:!0})],c.prototype,"activeToolInfo",void 0);d.__decorate([e.property()],c.prototype,"label",null);d.__decorate([e.property()],c.prototype,
"layers",null);d.__decorate([e.property(),x.messageBundle("esri/widgets/support/SelectionToolbar/t9n/SelectionToolbar")],c.prototype,"messages",void 0);d.__decorate([e.property()],c.prototype,"sources",null);d.__decorate([e.property()],c.prototype,"toolConfigs",void 0);d.__decorate([e.property()],c.prototype,"view",null);d.__decorate([e.property()],c.prototype,"viewModel",void 0);d.__decorate([e.property()],c.prototype,"visibleElements",void 0);d.__decorate([r.cast("visibleElements")],c.prototype,
"castVisibleElements",null);d.__decorate([e.property()],c.prototype,"visibleToolCount",null);return c=d.__decorate([t.subclass("esri.widgets.support.SelectionToolbar")],c)});