From d74b495736f0c04522ec54274b70fed0ded2878d Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 27 Jun 2023 11:30:06 +0800
Subject: [PATCH] 任务新增导出

---
 public/map/controls/toolbar/tools/DrawBaseTool.js |  130 +++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 130 insertions(+), 0 deletions(-)

diff --git a/public/map/controls/toolbar/tools/DrawBaseTool.js b/public/map/controls/toolbar/tools/DrawBaseTool.js
new file mode 100644
index 0000000..5e507ad
--- /dev/null
+++ b/public/map/controls/toolbar/tools/DrawBaseTool.js
@@ -0,0 +1,130 @@
+/**
+* 地图浏览工具的基类
+* @author 温杨彪 2015-9-13
+**/
+define([
+  "dojo/_base/declare", 
+  "controls/toolbar/tools/BaseTool",
+  "esri/toolbars/draw",
+  "dojo/on",
+  "base/utils/RendererUtil",
+  "dojo/_base/lang"
+], function(
+  declare, 
+  BaseTool,
+  Draw,
+  on,
+  RendererUtil,
+  lang
+) {
+  var RL = declare([BaseTool], {
+	  _drawTool:null,
+	  _drawType:"",
+	  _isDrawOnece:true,
+    constructor: function(args) {
+    	this._normalIconClass="tool-zoomIn-normal";
+    	this._overIconClass="tool-zoomIn-over";
+    	this._selectedIconClass="tool-zoomIn-select";
+    },
+    _setIsDrawOneceAttr:function(value)
+    {
+    	this._isDrawOnece = value;
+    },
+    _getIsDrawOneceAttr:function()
+    {
+    	return this._isDrawOnece;
+    },
+    _setDrawTypeAttr:function(value)
+    {
+    	this._drawType = value;
+    },
+    _getDrawTypeAttr:function()
+    {
+    	return this._drawType;
+    },
+    activate:function(args)
+    {
+    	if(!this._drawTool.map)
+		{
+    		this._drawTool.map=this.map;
+		}
+    	this.inherited(arguments);
+    	this._drawTool.activate(this._drawType);
+    	this.map.infoWindow.hide();
+    	this.map.setInfoWindowOnClick(false);
+    },
+    postCreate:function()
+    {
+    	this.inherited(arguments);
+    	this._drawTool = new Draw(this.map);
+    	var smsSymbol = RendererUtil.createSymbol({
+			"type":"SimpleMarkerSymbol",
+			"style":"circle",
+			"size":12,
+			"color":"#00ffff"
+		});
+    	this._drawTool.setMarkerSymbol(smsSymbol);
+    	
+    	var slsSymbol=RendererUtil.createSymbol({
+    		"type":"SimpleLineSymbol",
+			"style":"dot",
+			"width":3,
+			"color":"#292424"
+    	})
+    	
+    	this._drawTool.setLineSymbol(slsSymbol);
+    	
+    	var sfsSymbol=RendererUtil.createSymbol({
+    		"type":"SimpleFillSymbol",
+			"style":"solid",
+			"color":"#292424",
+			"alpha":0.5,
+			"outline":{
+				"type":"SimpleLineSymbol",
+				"style":"dot",
+				"width":3,
+				"color":"#292424"
+			}
+    	});
+    	
+    	this._drawTool.setFillSymbol(sfsSymbol);
+    	
+    	on(this._drawTool,"draw-end",lang.hitch(this,this.onDrawEndHandler));
+    },
+    deactivate:function()
+    {
+    	if(!this._enable || !this._activated)
+			return;
+    	this.inherited(arguments);
+    	try
+    	{
+    		this._drawTool.deactivate();
+    	}
+    	catch(err)
+    	{
+    		
+    	}
+    	this.map.setInfoWindowOnClick(true);
+    },
+    
+    onDrawEndHandler:function(obj)
+    {
+    	if(this._isDrawOnece)
+		{
+    		this.deactivate();
+    		this.onselfDeactivate();
+		}
+    	this.onDrawEnd(obj.geometry);
+    },
+    onDrawEnd:function(geometry)
+    {
+    	return geometry;
+    },
+    onselfDeactivate:function()
+    {
+    	return this;
+    }
+    
+  });
+  return RL;
+});

--
Gitblit v1.9.3