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

📄 ogccrs.java

📁 esri的ArcGIS Server超级学习模板程序(for java)
💻 JAVA
字号:
/**
 * 
 */
package com.esri.solutions.jitk.datasources.ogc.wcs.info;

import com.esri.solutions.jitk.datasources.ogc.wcs.Val;

/**
 * @author vlad2928
 *
 */
public class OGCCRS {

/*
 * OGC CRS formats:
 * ================ 
 * 0) EPSG:<EPSG code>
 * 1) urn:ogc:def:crs:EPSG:<versioin>:<EPSG code>
 * 2) urn:EPSG:geographicCRC:<EPSG code>
 * 3) epsg#<EPSG code>
 * 4) http://www.opengis.net/gml/srs/epsg.xml#<EPSG code>
*/
	
	private int type;
	private String authority;
	private String code;
	private String crsName;
	
	public OGCCRS() {
		type = -1;
		authority = "";
		code = "";
		crsName = "";
	}
	
	public OGCCRS(String crs) {
		this();
		
		if(crs != null) {
			int idx = -1;
			
			if((idx = crs.indexOf("epsg#")) != -1) {
				type = 3;
				authority = "EPSG";
				code = Val.chkStr(crs.substring(idx + "epsg#".length()), "");
				
			} else if((idx = crs.indexOf("epsg.xml#")) != -1) {
				type = 4;
				authority = "EPSG";
				code = Val.chkStr(crs.substring(idx + "epsg.xml#".length()), "");
				
			} else if((idx = crs.indexOf(":")) > 0) {
				String[] urn = crs.split(":");
					
				if(urn.length == 2 && urn[0].equalsIgnoreCase("EPSG")) {
					type = 0;
					authority = "EPSG";
					code = Val.chkStr(urn[urn.length-1], "");
						
				} else if(urn.length == 4 && urn[0].equalsIgnoreCase("urn") && urn[1].equalsIgnoreCase("EPSG") && urn[2].equalsIgnoreCase("geographicCRC")) {
					type = 2;
					authority = "EPSG";
					code = Val.chkStr(urn[urn.length-1], "");
					
				} else if(urn.length == 7 && urn[0].equalsIgnoreCase("urn") && (urn[1].equalsIgnoreCase("ogc") || urn[1].equalsIgnoreCase("ocg")) && urn[2].equalsIgnoreCase("def") && urn[3].equalsIgnoreCase("crs")) {
					type = 1;
					authority = urn[4];
					code = Val.chkStr(urn[urn.length-1], "");	
				} 	
			
			} else {
				crsName = crs;
			}
		}
	}

	public String getAuthority() {
		return this.authority;
	}
	
	public String getCode() {
		return this.code;
	}
	
	public String toString() {
		
		String ret = "";
		
		if(type != -1) {
			
			if(type == 0) {
				ret = "EPSG:";
				
			} else if(type == 1) {
				ret = "urn:ogc:def:crs:" + authority + "::";
				
			} else if(type == 2) {
				ret = "urn:EPSG:geographicCRC:";
				
			} else if(type == 3) {
				ret = "epsg#";
				
			} else if(type == 4) {
				ret = "http://www.opengis.net/gml/srs/epsg.xml#";
			}
			
		} else if(crsName.length() > 0) {
			ret = crsName;
		}
		
		return ret + code;
	}
}

⌨️ 快捷键说明

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