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

📄 projectioncontrol.java

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

import java.io.IOException;

import javax.faces.component.UIOutput;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseWriter;

import com.esri.adf.web.data.WebMap;
import com.esri.adf.web.data.geometry.WebSpatialReference;


/**
 * The {@link TableControl} provides the functionality to display results in a
 * in form of a table.
 * 
 */
public class ProjectionControl extends UIOutput {	
    /**
     * The standard component family for this component.
     */
    public static final String COMPONENT_FAMILY = "com.esri.jitk.web.Information.Projection";
    /**
     * The standard component type for this component.
     */
    public static final String COMPONENT_TYPE = "com.esri.jitk.web.Information.Projection";
          
    /**
     * Encode begin.
     * .
     * @param FacesContext
     */
    public void encodeBegin(FacesContext context) throws IOException {
      
      ResponseWriter writer = context.getResponseWriter();
      
      writer.startElement("script", this);
      writer.writeAttribute("language", "javascript", null);
      writer.write("jitkTaskInformation_addTagHandler();");
      writer.write("jitkTaskProjInfoArray[jitkTaskProjInfoArray.length]='" + getClientId(context) + "';");
      writer.endElement("script");
      
      writer.startElement("span", this);
      writer.writeAttribute("id", getClientId(context), null);
      String style = (String)this.getAttributes().get("style");
      if (style != null) writer.writeAttribute("style", style, null);
      String styleClass = (String)this.getAttributes().get("styleClass");
      if (styleClass != null) writer.writeAttribute("class", styleClass, null);
      writer.write(this.getFormattedSpatialReferenceString());
      writer.endElement("span");
      
      writer.flush();
    }

    protected String getFormattedSpatialReferenceString () {
    	String wsrString = getSpatialReferenceString();
        
    	if (wsrString.trim().length() == 0) {
    		return "";
    	}
    	
        wsrString = wsrString.replaceAll("_", " ");
		String[] comps = wsrString.split("\"");
    	return comps[1];
    }

	protected String getSpatialReferenceString() {
		WebMap webMap = (WebMap) this.getValue();
        
        WebSpatialReference wsr = webMap.getWebContext().getSpatialReference();
        if (wsr == null) {
        	return "";
        }
        
        String wsrString = wsr.getDefinitionString();
        if (wsrString == null) {
        	return "";
        }
        
		return wsrString;
	}
	
    /**
     * Encode end
     * 
     * @param FacesContext
     */
    public void encodeEnd(FacesContext context) throws IOException {
    	return;
    }   
}

⌨️ 快捷键说明

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