⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 linedrawingtask.java

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JAVA
字号:
package com.esri.solutions.jitk.web.tasks.redlining.shape;

import java.util.LinkedHashMap;

import org.apache.log4j.Logger;

import com.esri.adf.web.data.symbol.WebSimpleLineSymbol;
import com.esri.adf.web.data.symbol.WebSymbol;
import com.esri.adf.web.faces.event.MapEvent;
import com.esri.solutions.jitk.web.tasks.redlining.map.JoinTypeMap;
import com.esri.solutions.jitk.web.tasks.redlining.map.LineTypeMap;

public class LineDrawingTask extends PointDrawingTask {
	
	private static final long serialVersionUID = -3717415756785249314L;
	private static final Logger _logger = Logger.getLogger(LineDrawingTask.class);
	
	protected String _lineColor = null;
	protected String _lineColorParam = null;
	protected String _lineWidth = null;
	protected String _lineWidthParam = null;	
	protected int _lineTypeId = -1;
	protected String _lineTypeParam = null;	
	
	protected LineTypeMap _lineTypeList = null;
	protected LinkedHashMap<Integer, String> _lineJoinTypeList = null;	
	
	public void initLineProperites() {
		this._lineTypeList = new LineTypeMap();
		this._lineJoinTypeList = new JoinTypeMap();
	}
	
	public void placeLine(MapEvent event) {
		
		try {
			_logger.info("Placing line redline on map.");
			requestTaskRender();
			
			mgResource.addGraphicFeature(event.getWebGeometry().toMapGeometry(event.getWebContext().getWebMap()), getLineSymbol());
			
			event.getWebContext().refresh();
		
		} catch (Exception ex) {
			renderExceptionMessage(ex);
			_logger.error("Could not place line redline on map.", ex);
		}
	}
	
	protected WebSymbol getLineSymbol() {
		
		WebSimpleLineSymbol symbol = new WebSimpleLineSymbol();
		symbol.setColor(getLineColor());
		symbol.setAntialiasing(true);
		symbol.setCapType(WebSimpleLineSymbol.ROUND);
		symbol.setJoinType(WebSimpleLineSymbol.ROUND);
		symbol.setLineType(_lineTypeList.getLineType(getLineTypeId()));
		symbol.setWidth(Integer.valueOf(getLineWidth()));	
		
		return symbol;
	}

	public int getLineTypeId() {
		if (_lineTypeId < 0) _lineTypeId = Integer.parseInt(this._lineTypeParam);
		return _lineTypeId;
	}

	public void setLineTypeId(int lineTypeId) {
		this._lineTypeId = lineTypeId;
	}	
	
	public String getLineTypeParam() {
		return this._lineTypeParam;
	}

	public void setLineTypeParam(String lineTypeParam) {
		this._lineTypeParam = lineTypeParam;
	}

	public String getLineColorParam() {
		return this._lineColorParam;
	}

	public void setLineColorParam(String lineColorParam) {
		this._lineColorParam = lineColorParam;
	}

	public String getLineWidthParam() {
		return this._lineWidthParam;
	}

	public void setLineWidthParam(String lineWidthParam) {
		this._lineWidthParam = lineWidthParam;
	}	
	
	public String getLineColor() {
		if (this._lineColor == null) this._lineColor = this._lineColorParam;
		return this._lineColor;
	}

	public void setLineColor(String lineColor) {
		this._lineColor = lineColor;
	}	
	
	public String getLineWidth() {
		if (this._lineWidth == null) this._lineWidth = this._lineWidthParam;
		return this._lineWidth;
	}

	public void setLineWidth(String lineWidth) {
		this._lineWidth = lineWidth;
	}	
	
	public LinkedHashMap<Integer, String> getLineJoinTypeList() {
		return _lineJoinTypeList;
	}

	public LinkedHashMap<Integer, String> getLineTypeList() {
		return _lineTypeList;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -