📄 coverageinfo.java
字号:
}
/**
* @return Returns the formatId.
*/
public String getFormatId() {
return formatId;
}
/**
* @return Returns the interpolationMethods.
*/
public List getInterpolationMethods() {
return interpolationMethods;
}
/**
* @return Returns the keywords.
*/
public List getKeywords() {
return keywords;
}
/**
* @return Returns the label.
*/
public String getLabel() {
return label;
}
/**
* @return Returns the meta.
*/
public Map getMeta() {
return meta;
}
/**
* @return Returns the metadataLink.
*/
public MetaDataLink getMetadataLink() {
return metadataLink;
}
/**
* @return String the namespace prefix.
*/
public String getPrefix() {
CoverageStoreInfo info = getFormatInfo();
if (info != null) {
return info.getNameSpace().getPrefix();
}
return null;
}
/**
* @return NameSpaceInfo the namespace specified for the specified
* CoverageStoreInfo (by ID)
*
* @throws IllegalStateException
* Thrown when disabled.
*/
public NameSpaceInfo getNameSpace() {
if (!isEnabled()) {
throw new IllegalStateException("This coverage is not " + "enabled");
}
return getFormatInfo().getNameSpace();
}
/**
* @return Returns the name.
*/
public String getName() {
return getPrefix() + ":" + name;
}
/**
* @return Returns the nativeFormat.
*/
public String getNativeFormat() {
return nativeFormat;
}
/**
* @return Returns the requestCRSs.
*/
public List getRequestCRSs() {
return requestCRSs;
}
/**
* @return Returns the responseCRSs.
*/
public List getResponseCRSs() {
return responseCRSs;
}
/**
* @return Returns the srsName.
*/
public String getSrsName() {
return srsName;
}
/**
* @return Returns the supportedFormats.
*/
public List getSupportedFormats() {
return supportedFormats;
}
/**
* By now just return the default style to be able to declare it in WMS
* capabilities, but all this stuff needs to be revisited since it seems
* currently there is no way of retrieving all the styles declared for a
* given Coverage.
*
* @return the default Style for the Coverage
*/
public Style getDefaultStyle() {
return data.getStyle(defaultStyle);
}
public ArrayList getStyles() {
final ArrayList realStyles = new ArrayList();
Iterator s_IT = styles.iterator();
while (s_IT.hasNext())
realStyles.add(data.getStyle((String) s_IT.next()));
return realStyles;
}
/**
*
*/
public CoordinateReferenceSystem getCrs() {
return crs;
}
/**
*
*/
public GridGeometry getGrid() {
return grid;
}
/**
*
*/
public InternationalString[] getDimensionNames() {
return dimensionNames;
}
/**
* @return Returns the dimensions.
*/
public CoverageDimension[] getDimensions() {
return dimensions;
}
public String getSrsWKT() {
return srsWKT;
}
public GeneralEnvelope getWGS84LonLatEnvelope() {
if (this.lonLatWGS84Envelope == null) {
try {
this.lonLatWGS84Envelope = CoverageStoreUtils.getWGS84LonLatEnvelope(this.envelope);
} catch (IndexOutOfBoundsException e) {
return null;
} catch (FactoryException e) {
return null;
} catch (TransformException e) {
return null;
}
}
return this.lonLatWGS84Envelope;
}
public String getWmsPath() {
return wmsPath;
}
public void setWmsPath(String wmsPath) {
this.wmsPath = wmsPath;
}
public GridCoverageReader getReader() {
// /////////////////////////////////////////////////////////
//
// Getting coverage config and then reader
//
// /////////////////////////////////////////////////////////
return data.getFormatInfo(formatId).getReader();
}
public GridCoverageReader createReader(Hints hints) {
// /////////////////////////////////////////////////////////
//
// Getting coverage config and then reader
//
// /////////////////////////////////////////////////////////
return data.getFormatInfo(formatId).createReader(hints);
}
public Map getParameters() {
return parameters;
}
public GridCoverage getCoverage() {
return getCoverage(null, null);
}
public GridCoverage getCoverage(GeneralEnvelope envelope, Rectangle dim) {
GridCoverage gc = null;
try {
if (envelope == null) {
envelope = this.envelope;
}
// /////////////////////////////////////////////////////////
//
// Do we need to proceed?
// I need to check the requested envelope in order to see if the
// coverage we ask intersect it otherwise it is pointless to load it
// since its reader might return null;
// /////////////////////////////////////////////////////////
final CoordinateReferenceSystem sourceCRS = envelope.getCoordinateReferenceSystem();
final CoordinateReferenceSystem destCRS = crs;
if (!CRSUtilities.equalsIgnoreMetadata(sourceCRS, destCRS)) {
// get a math transform
final MathTransform transform = CoverageUtils.getMathTransform(sourceCRS, destCRS);
// transform the envelope
if (!transform.isIdentity()) {
envelope = CRSUtilities.transform(transform, envelope);
}
}
// just do the intersection since
envelope.intersect(this.envelope);
if (envelope.isEmpty()) {
return null;
}
envelope.setCoordinateReferenceSystem(destCRS);
// /////////////////////////////////////////////////////////
//
// get a reader
//
// /////////////////////////////////////////////////////////
final GridCoverageReader reader = getReader();
if (reader == null) {
return null;
}
// /////////////////////////////////////////////////////////
//
// Reading the coverage
//
// /////////////////////////////////////////////////////////
gc = reader.read(CoverageUtils.getParameters(
getReader().getFormat().getReadParameters(), getParameters()));
if ((gc == null) || !(gc instanceof GridCoverage2D)) {
throw new IOException("The requested coverage could not be found.");
}
} catch (InvalidParameterValueException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
} catch (ParameterNotFoundException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
} catch (MalformedURLException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
} catch (IllegalArgumentException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
} catch (SecurityException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
} catch (IOException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
} catch (TransformException e) {
LOGGER.log(Level.SEVERE, e.getLocalizedMessage(), e);
}
return gc;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -