本文整理汇总了Java中org.opengis.referencing.ReferenceIdentifier类的典型用法代码示例。如果您正苦于以下问题:Java ReferenceIdentifier类的具体用法?Java ReferenceIdentifier怎么用?Java ReferenceIdentifier使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ReferenceIdentifier类属于org.opengis.referencing包,在下文中一共展示了ReferenceIdentifier类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCRSCode
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
/**
* Gets the CRS code.
*
* @param coordinateReferenceSystem the coordinate reference system
* @return the CRS code
*/
public String getCRSCode(CoordinateReferenceSystem coordinateReferenceSystem) {
ReferenceIdentifier identifier = null;
if (coordinateReferenceSystem != null) {
Set<ReferenceIdentifier> indentifierList = coordinateReferenceSystem.getIdentifiers();
if (indentifierList != null) {
if (indentifierList.iterator().hasNext()) {
identifier = indentifierList.iterator().next();
}
}
}
String code = NOT_SET_CRS;
if (identifier != null) {
ValueComboBoxData data = crsMap.get(identifier.toString());
if (data != null) {
code = data.getKey();
}
}
return code;
}
示例2: haveCommonReferenceIdentifiers
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
private static boolean haveCommonReferenceIdentifiers(CoordinateReferenceSystem crs1, CoordinateReferenceSystem crs2) {
Set<ReferenceIdentifier> identifiers1 = crs1.getIdentifiers();
Set<ReferenceIdentifier> identifiers2 = crs2.getIdentifiers();
// If a CRS does not have identifiers or if they have different number of identifiers
// they cannot be equal.
if (identifiers1 == null || identifiers1.isEmpty()
|| identifiers2 == null || identifiers2.isEmpty()
|| identifiers1.size() != identifiers2.size()) {
return false;
}
// The two CRSs can only be equal if they have the same number of identifiers
// and all of them are common to both.
int eqCount = 0;
for (ReferenceIdentifier refId1 : identifiers1) {
for (ReferenceIdentifier refId2 : identifiers2) {
if (compareRefIds(refId1, refId2)) {
eqCount++;
break;
}
}
}
return eqCount == identifiers1.size();
}
示例3: determineSourceEpsg
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
private int determineSourceEpsg(
FeatureSource<SimpleFeatureType, SimpleFeature> source) {
if (source != null) {
try {
Set<ReferenceIdentifier> identifiers = source.getSchema()
.getCoordinateReferenceSystem().getIdentifiers();
if (identifiers.size() > 0) {
String code = identifiers.iterator().next().getCode();
return Integer.valueOf(code);
}
} catch (RuntimeException e) {
LOGGER.warn("Could not determine EPSG code from WFS DataSource.");
}
}
return targetEpsg;
}
示例4: getCRSIdentifier
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
private String getCRSIdentifier(CoordinateReferenceSystem coordinateReferenceSystem) {
String name = "";
if (coordinateReferenceSystem.getIdentifiers() == null) {
name = coordinateReferenceSystem.getName().toString();
} else {
for (ReferenceIdentifier identifier : coordinateReferenceSystem.getIdentifiers()) {
name = identifier.toString();
break;
}
}
return name;
}
示例5: getProperties
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
/**
* Fills a {@link SRSInit} object with the correct initialization values
* needed by constructors (authority, description, srid).
*
* Note: The method tries to retrieve as much information from the
* {@link CoordinateReferenceSystem} <code>crs</code> as possible.
*
* @param init Pass the {@link SRSInit} object to allow multiple return-values.
* @param crs The {@link CoordinateReferenceSystem} where the information
* are retrieved from.
*/
private void getProperties(SRSInit init, CoordinateReferenceSystem crs) {
// Try to find srid, authority and description from the CRS.
// Abort if the correct EPSG identifiers were found.
Set<ReferenceIdentifier> identifiers = crs.getIdentifiers();
if (!identifiers.isEmpty()) {
for (ReferenceIdentifier id : identifiers) {
init.auth = Citations.getIdentifier(id.getAuthority());
init.srid = id.getCode();
try {
CRSAuthorityFactory factory = ReferencingFactoryFinder.getCRSAuthorityFactory(init.auth, HINTS);
init.desc = factory.getDescriptionText(init.srid).toString();
this.is_custom = false;
break;
} catch (Exception e) {
this.is_custom = true;
}
}
} else
this.is_custom = true;
// If this is not an EPSG spatial reference system, use WKT to describe it but get
// as much information as possible about the SRS from the WKT.
if (this.is_custom) {
init.srid = Const.NVL(init.srid, Integer.toString(UNKNOWN_SRID));
init.auth = Const.NVL(init.auth, "Custom Authority");
init.desc = Const.NVL(init.desc, "Custom SRS from WKT");
}
}
示例6: getSRID
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
protected static int getSRID(
final SimpleFeature geometryFeature ) {
final CoordinateReferenceSystem crs = geometryFeature
.getDefaultGeometryProperty()
.getDescriptor()
.getCoordinateReferenceSystem();
if (crs == null) {
return 4326;
}
final ReferenceIdentifier id = getFirst(crs.getIdentifiers());
if (id == null) {
return 4326;
}
return Integer.parseInt(id.getCode());
}
示例7: getFirst
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
protected static final <T> ReferenceIdentifier getFirst(
final Iterable<ReferenceIdentifier> iterable ) {
if (iterable == null) {
return null;
}
final Iterator<ReferenceIdentifier> it = iterable.iterator();
if (it.hasNext()) {
final ReferenceIdentifier id = it.next();
if ("EPSG".equals(id.getCodeSpace())) {
return id;
}
}
return null;
}
示例8: saveCustomizedCRS
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
/**
* @param text
* @param createdCRS
* @throws CoreException
* @throws IOException
* @throws BackingStoreException
*/
private CoordinateReferenceSystem saveCustomizedCRS(final String text, final boolean processWKT,
final CoordinateReferenceSystem createdCRS) throws CoreException, IOException, BackingStoreException {
final Preferences root = Preferences.userRoot();
final Preferences node = root.node(CUSTOM_ID);
int lastID;
String code;
String name;
String newWKT;
if (processWKT) {
lastID = Integer.parseInt(node.get(LAST_ID, "0")); //$NON-NLS-1$
code = "UDIG:" + lastID; //$NON-NLS-1$
name = createdCRS.getName().toString() + "(" + code + ")";//$NON-NLS-1$ //$NON-NLS-2$
lastID++;
node.putInt(LAST_ID, lastID);
newWKT = processingWKT(text, lastID);
} else {
final Set<ReferenceIdentifier> ids = createdCRS.getIdentifiers();
if (!ids.isEmpty()) {
final Identifier id = ids.iterator().next();
code = id.toString();
name = createdCRS.getName().getCode() + " (" + code + ")"; //$NON-NLS-1$ //$NON-NLS-2$
} else {
name = code = createdCRS.getName().getCode();
}
newWKT = text;
}
final Preferences child = node.node(code);
child.put(NAME_ID, name);
child.put(WKT_ID, newWKT);
final String[] keywords = keywordsText.getText().split(","); //$NON-NLS-1$
if (keywords.length > 0) {
final Preferences keyworkNode = child.node(ALIASES_ID);
for (String string : keywords) {
string = string.trim().toUpperCase();
keyworkNode.put(string, string);
}
}
node.flush();
return createdCRS;
}
示例9: compareRefIds
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
private static boolean compareRefIds(ReferenceIdentifier refId1, ReferenceIdentifier refId2) {
return ObjectUtils.equalObjects(refId1.getCodeSpace(), refId2.getCodeSpace())
&& ObjectUtils.equalObjects(refId1.getCode(), refId2.getCode())
&& compareVersions(refId1.getVersion(), refId2.getVersion());
}
示例10: getName
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
@Override
public ReferenceIdentifier getName() {
return identifier;
}
示例11: getIdentifiers
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
@Override
public Set<ReferenceIdentifier> getIdentifiers() {
// TODO Auto-generated method stub
return null;
}
示例12: getName
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
public ReferenceIdentifier getName() {
return base.getName();
}
示例13: getIdentifiers
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
public Set<ReferenceIdentifier> getIdentifiers() {
return base.getIdentifiers();
}
示例14: CoordinateReferenceSystemImpl
import org.opengis.referencing.ReferenceIdentifier; //导入依赖的package包/类
/** Construct a new CoordinateReferenceSystem with a ReferenceIdentifier<p>
* Note this implementation is only really a place holder to allow for codes to
* be specified when building {@linkplain GeometryTypeImpl} - Only the {@link #getName()}
* method returns other than {@code null}
*
* @param identifier If {@code null} then a new ReferenceIdentifier set to
* EPSG:4326 is created.
*/
public CoordinateReferenceSystemImpl(ReferenceIdentifier identifier) {
if (identifier==null) {
identifier = new ReferenceIdentifierImpl("4326", "EPSG", "1");
}
this.identifier = identifier;
}