📄 arcdrawingtask.java
字号:
package com.esri.solutions.jitk.web.tasks.redlining.shape;
import java.util.LinkedHashMap;
import java.util.List;
import org.apache.log4j.Logger;
import com.esri.adf.web.data.geometry.WebCircle;
import com.esri.adf.web.data.geometry.WebGeometry;
import com.esri.adf.web.data.geometry.WebPoint;
import com.esri.adf.web.data.symbol.WebSimpleLineSymbol;
import com.esri.adf.web.faces.event.MapEvent;
import com.esri.solutions.jitk.common.math.UnitsOfMeasureMap;
import com.esri.solutions.jitk.web.data.geometry.ConcentricWebArcs;
import com.esri.solutions.jitk.web.data.geometry.WebArc;
import com.esri.solutions.jitk.web.tasks.redlining.map.ArcAnglesMap;
import com.esri.solutions.jitk.web.tasks.redlining.map.ConcentricArcCountMap;
import com.esri.solutions.jitk.web.tasks.redlining.map.LineTypeMap;
//Needed for use of WebCircle
@SuppressWarnings("deprecation")
public class ArcDrawingTask extends PolygonDrawingTask {
private static final long serialVersionUID = 7296808088107951L;
private static final Logger _logger = Logger.getLogger(ArcDrawingTask.class);
protected com.esri.solutions.jitk.web.data.symbol.WebSimpleLineSymbol _arcSymbol = null;
protected ConcentricWebArcs _webArc = null;
protected double _webArcStartAngle = 0.0;
protected double _webArcEndAngle = 360.0;
protected int _arcCount = 1;
protected double _arcDistance = 1.0;
protected LinkedHashMap<Integer, String> _unitsOfMeasure = null;
protected String _units = "";
protected ConcentricArcCountMap _arcCountMap = null;
protected ArcAnglesMap _arcAnglesMap = null;
protected ArcAnglesMap _arcAnglesMapReversed = null;
public void initArcProperties() {
_arcSymbol = new com.esri.solutions.jitk.web.data.symbol.WebSimpleLineSymbol();
_arcSymbol.setColor("255,0,0");
_arcSymbol.setAntialiasing(true);
_arcSymbol.setCapType(WebSimpleLineSymbol.ROUND);
_arcSymbol.setJoinType(WebSimpleLineSymbol.ROUND);
_arcSymbol.setLineType(LineTypeMap.LINE_TYPE[0]);
_arcSymbol.setWidth(1);
_webArc = new ConcentricWebArcs(new WebPoint(), 0.0, _webArcStartAngle, _webArcEndAngle);
_webArc.setArcCount(1);
_webArc.setArcDistance(1.0);
_arcAnglesMap = new ArcAnglesMap(false);
_arcAnglesMapReversed = new ArcAnglesMap(true);
_arcCountMap = new ConcentricArcCountMap();
_unitsOfMeasure = new UnitsOfMeasureMap();
}
public void placeArc(MapEvent event) {
try {
_logger.info("Placing arc redline on map.");
requestTaskRender();
WebGeometry webGeo = event.getWebGeometry().toMapGeometry(event.getWebContext().getWebMap());
if(webGeo instanceof WebCircle) {
List<WebArc> arcs = getArcList(webGeo);
for(WebArc arc : arcs) {
mgResource.addGraphicFeature(arc, (WebSimpleLineSymbol)_arcSymbol.clone());
}
event.getWebContext().refresh();
} else throw new Exception("WebCircle not returned to placeArc event.");
} catch (Exception ex) {
renderExceptionMessage(ex);
_logger.error("Could not place arc redline on map.", ex);
}
}
protected List<WebArc> getArcList(WebGeometry webGeo) {
WebCircle webCircle = (WebCircle) webGeo;
ConcentricWebArcs concentricArcs = new ConcentricWebArcs(webCircle, _webArc.getStartAngle(), _webArc.getEndAngle());
concentricArcs.setArcCount(_webArc.getArcCount());
concentricArcs.setArcDistance(_webArc.getArcDistance());
List<WebArc> arcs = concentricArcs.getArcList();
return arcs;
}
public void setUnit(String unit) {
_units = unit;
}
public String getUnit() {
return _units;
}
public void setArcEndAngle(String angle) {
_webArcEndAngle = Double.valueOf(angle.substring(0, angle.length() - 1));
_webArc.setEndAngle(_webArcEndAngle);
}
public String getArcEndAngle() {
return Double.valueOf(_webArc.getEndAngle()).intValue() + "
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -