webgraphicsgecollection.java

来自「esri的ArcGIS Server超级学习模板程序(for java)」· Java 代码 · 共 56 行

JAVA
56
字号
package com.esri.solutions.jitk.data.svg.exporter;

import java.util.List;

import com.esri.adf.web.data.GraphicElement;
import com.esri.adf.web.data.WebContext;
import com.esri.solutions.jitk.web.tasks.IWebContextAware;

public class WebGraphicsGECollection implements IWebContextAware, IGraphicElementCollection {

	protected WebContext context;
	protected List<GraphicElement> graphicElements = null; 
	protected String graphicsLayerName = "";
	
	public WebContext getContext() {
		return context;
	}

	public void setContext(WebContext context) {
		this.context = context;
	}

	public void setGraphicsLayerName(String graphicsLayerName) {
		this.graphicsLayerName = graphicsLayerName;
	}
	
	private List<GraphicElement> getGraphicElements() {
	
		if(graphicsLayerName.equalsIgnoreCase("PointGraphics"))
			return context.getWebGraphics().getPointGraphics();
			
		else if(graphicsLayerName.equalsIgnoreCase("LineGraphics"))
			return context.getWebGraphics().getLineGraphics();
			
		else if(graphicsLayerName.equalsIgnoreCase("PolygonGraphics"))
			return context.getWebGraphics().getPolygonGraphics();
		
		return null;
	}
	
	public GraphicElement get(int i) {
		
		if(graphicElements == null)
			graphicElements = getGraphicElements();
		
		return (graphicElements != null) ? graphicElements.get(i) : null;
	}

	public int size() {
		
		if(graphicElements == null)
			graphicElements = getGraphicElements();
		
		return (graphicElements != null) ? graphicElements.size() : 0;
	}
}

⌨️ 快捷键说明

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