📄 selectbyfeaturebuffertask.java
字号:
package com.esri.solutions.jitk.web.tasks.query.featurebuffer;
import com.esri.adf.web.ags.data.AGSLocalMapResource;
import com.esri.adf.web.ags.data.AGSMapFunctionality;
import com.esri.adf.web.ags.data.AGSMapResource;
import com.esri.adf.web.aims.data.AIMSMapFunctionality;
import com.esri.adf.web.aims.data.AIMSMapResource;
import com.esri.adf.web.data.GISResource;
import com.esri.adf.web.data.GraphicElement;
import com.esri.adf.web.data.WebContext;
import com.esri.adf.web.data.WebMap;
import com.esri.adf.web.data.geometry.WebExtent;
import com.esri.adf.web.data.geometry.WebGeometry;
import com.esri.adf.web.data.geometry.WebPoint;
import com.esri.adf.web.data.geometry.WebPolygon;
import com.esri.adf.web.data.geometry.WebPolyline;
import com.esri.adf.web.data.query.IdentifyCriteria;
import com.esri.adf.web.data.query.PredefinedQueryCriteria;
import com.esri.adf.web.data.query.QueryResult;
import com.esri.adf.web.data.query.WebQuery;
import com.esri.adf.web.data.results.WebResults;
import com.esri.adf.web.data.symbol.WebSimpleLineSymbol;
import com.esri.adf.web.data.symbol.WebSimpleMarkerSymbol;
import com.esri.adf.web.data.symbol.WebSimplePolygonSymbol;
import com.esri.adf.web.data.symbol.WebSymbol;
import com.esri.adf.web.data.tasks.TaskInfo;
import com.esri.adf.web.faces.event.MapEvent;
import com.esri.adf.web.faces.event.TaskEvent;
import com.esri.adf.web.util.ADFDownloadServlet;
import com.esri.aims.mtier.model.map.layer.Layer;
import com.esri.arcgisws.MapLayerInfo;
import com.esri.solutions.jitk.common.agslocal.IServerContextFactory;
import com.esri.solutions.jitk.common.analysis.buffer.BufferCalculatorFactory;
import com.esri.solutions.jitk.common.analysis.buffer.IBufferCalculator;
import com.esri.solutions.jitk.common.resources.TextResources;
import com.esri.solutions.jitk.common.web.layer.WebLayerInfoUtil;
import com.esri.solutions.jitk.web.data.geometry.GeomUtil;
import com.esri.solutions.jitk.web.tasks.FeatureSelectionAgsLocalTask;
import com.esri.solutions.jitk.web.tasks.query.pointbuffer.AimsBufferUtil;
import com.esri.solutions.jitk.web.tasks.query.pointbuffer.LayerList;
import com.esri.solutions.jitk.web.wfs.data.WFSMapResource;
import com.esri.solutions.jitk.web.wfs.data.WFSWebLayerInfo;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* This task creates a buffer by selecting an existing point,
* line or polygon feature and providing a user entered distance.
*/
public class SelectByFeatureBufferTask extends FeatureSelectionAgsLocalTask {
private static final long serialVersionUID = -267592158453174656L;
private static final Logger _logger = LogManager.getLogger(SelectByFeatureBufferTask.class);
private static final String FEATURE_BUFFER_TASK = "Feature Buffer Task";
private static final int MAX_RECORDS = 8000;
private static final String FILL_COLOR = "255,255,0";
private static final String NO_RECORD_MESSAGE = "featurebuffertask.msg.noRecord";
private static final String LAYER_NOT_FOUND = "featurebuffertask.msg.error.layerNotFoundInMapResources";
private static final double TRANSPARENCY_FACTOR = 0.5;
private String distanceLabel = null;
private String specifyPointLabel = null;
private String errorLabel = null;
private SelectByFeatureBufferTaskInfo taskInfo = null;
private String taskName = null;
private LinkedHashMap<String, String> layerList = null;
private LinkedHashMap<String, String> targetLayerList = null;
private LinkedHashMap<Integer, String> unitList = null;
private String layer = null;
private String targetLayer = null;
private Integer unit = null;
private String distance = "0.0";
private String displayAttribute = "true";
private String unitParam = null;
private String bufferLayerParam = null;
private String targetLayerParam = null;
private String findDataLabel = null;
private String intersectingWithLabel = null;
private String messageLabel = null;
private String uiMessage = null;
private String footerNote = null;
private QueryResult currentHighlighted = null;
private WebGeometry queryGeometry = null;
private WebGeometry bufferGeom = null;
public SelectByFeatureBufferTask() {
super();
setTaskInfo(new SelectByFeatureBufferTaskInfo());
this.taskName = FEATURE_BUFFER_TASK;
}
public TaskInfo getTaskInfo() {
if (this._context == null) {
taskInfo.getTaskDescriptor().setDisabled(true);
}
// doSelectLayer(null);
if (this.unit == null) {
this.unit = GeomUtil.findUnit(this.unitParam);
}
if ((this.layer == null) && (this.bufferLayerParam != null)) {
Iterator<Map.Entry<String,String>> it = this.layerList.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> entry = (Map.Entry<String, String>) it.next();
String key = (String) entry.getKey();
String value = (String) entry.getValue();
if (value.equalsIgnoreCase(bufferLayerParam)) {
this.layer = key;
break;
}
}
}
if ((this.targetLayer == null) && (this.targetLayerParam != null)) {
Iterator<Map.Entry<String,String>> it = this.targetLayerList.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, String> entry = (Map.Entry<String, String>) it.next();
String key = (String) entry.getKey();
String value = (String) entry.getValue();
if (value.equalsIgnoreCase(targetLayerParam)) {
this.targetLayer = key;
break;
}
}
}
return this.taskInfo;
}
public void setTaskInfo(TaskInfo taskInfo) {
this.taskInfo = (SelectByFeatureBufferTaskInfo) taskInfo;
super.setTaskInfo(taskInfo);
}
public WebContext getContext() {
return _context;
}
public void setContext(WebContext context) {
if (context != null) {
super.setContext(context);
this.layerList = new LayerList(context);
this.targetLayerList = new LayerList(context);
} else {
taskInfo.getTaskDescriptor().setDisabled(true);
_logger.warn("Task WebContext set to null, disabling");
}
}
/**
* Get findData label
*/
public String getFindDataLabel() {
return this.findDataLabel;
}
/**
* Set findData label
*/
public void setFindDataLabel(String findDataLabel) {
this.findDataLabel = findDataLabel;
}
/**
* Get intersecting with label
*/
public String getIntersectingWithLabel() {
return this.intersectingWithLabel;
}
/**
* Set intersecting with label
*/
public void setIntersectingWithLabel(String intersectingWithLabel) {
this.intersectingWithLabel = intersectingWithLabel;
}
/**
* Get message label
*/
public String getMessageLabel() {
return this.messageLabel;
}
/**
* Set message label
*/
public void setMessageLabel(String messageLabel) {
this.messageLabel = messageLabel;
}
/**
* Get ui message
*/
public String getUiMessage() {
return this.uiMessage;
}
/**
* Set ui message
*/
public void setUiMessage(String uiMessage) {
this.uiMessage = uiMessage;
}
/**
* Get footer note
*/
public String getFooterNote() {
return this.footerNote;
}
/**
* Set footer note
*/
public void setFooterNote(String footerNote) {
this.footerNote = footerNote;
}
/**
* Get distance label
*/
public String getDistanceLabel() {
return this.distanceLabel;
}
/**
* Set distance label
*/
public void setDistanceLabel(String distanceLabel) {
this.distanceLabel = distanceLabel;
}
/**
* Get specify point label
*/
public String getSpecifyPointLabel() {
return this.specifyPointLabel;
}
/**
* Set specify point label
*/
public void setSpecifyPointLabel(String specifyPointLabel) {
this.specifyPointLabel = specifyPointLabel;
}
/**
* Get error label
*/
public String getErrorLabel() {
return this.errorLabel;
}
/**
* Set error label
*/
public void setErrorLabel(String errorLabel) {
this.errorLabel = errorLabel;
}
/**
* Get task name
*/
public String getTaskName() {
return taskName;
}
/**
* Set task name
*/
public void setTaskName(String taskName) {
this.taskName = taskName;
}
/**
* Get layer
*/
public String getLayer() {
return this.layer;
}
/**
* Set layer
*/
public void setLayer(String layer) {
this.layer = layer;
}
/**
* Get target layer
*/
public String getTargetLayer() {
return this.targetLayer;
}
/**
* Set target layer
*/
public void setTargetLayer(String targetLayer) {
this.targetLayer = targetLayer;
}
/**
* Get display attribute
*/
public String getDisplayAttribute() {
return this.displayAttribute;
}
/**
* Set display attribute
*/
public void setDisplayAttribute(String displayAttribute) {
this.displayAttribute = displayAttribute;
}
/**
* Get unit
*/
public Integer getUnit() {
return this.unit;
}
/**
* Set unit
*/
public void setUnit(Integer unit) {
this.unit = unit;
}
/**
* Get distance
*/
public String getDistance() {
return this.distance;
}
/**
* Set distance
*/
public void setDistance(String distance) {
this.distance = distance;
}
/**
* Get buffer layer parameter
*/
public String getBufferLayerParam() {
return this.bufferLayerParam;
}
/**
* Set buffer layer parameter
*/
public void setBufferLayerParam(String bufferLayerParam) {
this.bufferLayerParam = bufferLayerParam;
}
/**
* Get target layer parameter
*/
public String getTargetLayerParam() {
return this.targetLayerParam;
}
/**
* Set target layer parameter
*/
public void setTargetLayerParam(String targetLayerParam) {
this.targetLayerParam = targetLayerParam;
}
/**
* Get unit parameter
*/
public String getUnitParam() {
return this.unitParam;
}
/**
* Set unit parameter
*/
public void setUnitParam(String unitParam) {
this.unitParam = unitParam;
}
/**
* Get input layer list
*/
public Map<String, String> getInputLayerList() {
return this.layerList;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -