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

📄 wcscapabilities.java

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

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

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


/**
 * @author vlad2928
 *
 */
public class WCSCapabilities {
	
	private String name;
	private String label;
	private String description;
	
	protected String version;
	private String exceptionFormat;
	private String getCapabilitiesURL;
	private String describeCoverageURL;
	private String getCoverageURL;
	
	private List<OGCCRS> supportedProjections;
	private List<String> supportedImageFormats;
	private List<String> keywords;
	private HashMap<String, WCSCoverageInfoBrief> coverageInfos;
	
	
	public WCSCapabilities() {	
		name = "";
		label = "";
		description = "";
		version = "";
		exceptionFormat = "";
		getCapabilitiesURL = "";
		describeCoverageURL = "";
		getCoverageURL = "";
		
		supportedProjections = new ArrayList<OGCCRS>();
		supportedImageFormats = new ArrayList<String>();
		keywords = new ArrayList<String>();
		coverageInfos = new HashMap<String, WCSCoverageInfoBrief>();
	}
	
	public String getName() {
		return this.name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getLabel() {
		return this.label;
	}

	public void setLabel(String label) {
		this.label = label;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getVersion() {
		return this.version;
	}
	
	public void setVersion(String version) {
		this.version = version;
	}
	
	public String getExceptionFormat() {
		return this.exceptionFormat;
	}
	
	public void setExceptionFormat(String exceptionFormat) {
		this.exceptionFormat = exceptionFormat;
	}
	
	public String getGetCapabilitiesURL() {
		return this.getCapabilitiesURL;
	}
	
	public void setGetCapabilitiesURL(String getCapabilitiesURL) {
		this.getCapabilitiesURL = getCapabilitiesURL;
	}
	
	public String getDescribeCoverageURL() {
		return this.describeCoverageURL;
	}
	
	public void setDescribeCoverageURL(String describeCoverageURL) {
		this.describeCoverageURL = describeCoverageURL;
	}
	
	public String getGetCoverageURL() {
		return this.getCoverageURL;
	}
	
	public void setGetCoverageURL(String getCoverageURL) {
		this.getCoverageURL = getCoverageURL;
	}

	public List<OGCCRS> getSupportedProjections() {
		return this.supportedProjections;
	}

	public void addSupportedProjection(String sCRS) {
		OGCCRS crs = new OGCCRS(sCRS.toLowerCase());
		if(crs.toString().length() > 0) {
			this.supportedProjections.add(crs);
		}
	}
	
	public List<String> getSupportedImageFormats() {
		return this.supportedImageFormats;
	}

	public void addSupportedImageFormat(String format) {
		format = Val.chkStr(format).toLowerCase();
		if(!(format.equals("") || this.supportedImageFormats.contains(format))) {
			this.supportedImageFormats.add(format);
		}
	}

	public List<String> getKeywords() {
		return this.keywords;
	}
	
	public HashMap<String, WCSCoverageInfoBrief> getCoverageInfos() {
		return this.coverageInfos;
	}
	
	public WCSCoverageInfoBrief getCoverageInfo(String coverageName) {	
		return (coverageInfos.containsKey(coverageName)) ? coverageInfos.get(coverageName) : null;
	}
	
	public int getDefaultDimension(String coverageName) {
		
		WCSCoverageInfoBrief coverageInfo = getCoverageInfo(coverageName);
		if(coverageInfo != null && coverageInfo instanceof WCSCoverageInfo) {
			return ((WCSCoverageInfo)coverageInfo).getSpatialDomain().getDimension();
		}
		
		return 2;
	}
	
	public boolean isSupportedFormat(String format) {
		return (format.toLowerCase().replaceAll("image/", "").trim().equals("png"));
	}
	
	public String getDefaultFormat(String coverageName) {
		
		WCSCoverageInfoBrief coverageInfo = getCoverageInfo(coverageName);
		if(coverageInfo != null && coverageInfo instanceof WCSCoverageInfo) {
			for(Iterator<String> i = ((WCSCoverageInfo)coverageInfo).getSupportedFormats().iterator(); i.hasNext();) {
				String format = i.next().toLowerCase();
				if(isSupportedFormat(format)) {
					return format;
				}
			}
			
		}
		
		return null;
	}
	
	public String getDefaultProjectionId(String coverageName) {
		
		WCSCoverageInfoBrief coverageInfo = getCoverageInfo(coverageName);
		if(coverageInfo != null && coverageInfo instanceof WCSCoverageInfo) {
			return ((WCSCoverageInfo)coverageInfo).getNativeCRSs().get(0).getCode();
		
		} else if(!supportedProjections.isEmpty()) {
			return supportedProjections.get(0).getCode();
		}
		
		return null;
	}
	
	public WCSBoundingBox getDefaultBoundingBox(String coverageName, String epsgCode) {
		
		WCSCoverageInfoBrief coverageInfo = getCoverageInfo(coverageName);
		if(coverageInfo != null && coverageInfo instanceof WCSCoverageInfo) {
			for(Iterator<WCSEnvelope> i = ((WCSCoverageInfo)coverageInfo).getSpatialDomain().getEnvelope().iterator(); i.hasNext();) {
				WCSEnvelope envelope = i.next();	
				if(envelope.getCRS().getCode().equalsIgnoreCase(epsgCode)) {
					return envelope.getBbox();
				}
			}
		}
		
		return null;
	}
}

⌨️ 快捷键说明

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