本文整理汇总了Java中org.opengis.metadata.Identifier类的典型用法代码示例。如果您正苦于以下问题:Java Identifier类的具体用法?Java Identifier怎么用?Java Identifier使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Identifier类属于org.opengis.metadata包,在下文中一共展示了Identifier类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isInCodeMap
import org.opengis.metadata.Identifier; //导入依赖的package包/类
private boolean isInCodeMap(final Identifier identifier, final String item) {
final String name = crsCodeMap.get(identifier.getCode());
if (name == null)
return false;
return name.equals(item);
}
示例2: printIdentifierStuff
import org.opengis.metadata.Identifier; //导入依赖的package包/类
/**
* Print out information about an identified object
*/
// START SNIPPET: identifiedObject
void printIdentifierStuff(IdentifiedObject identObj) {
System.out.println(" getName().getCode() - " + identObj.getName().getCode());
System.out.println(" getName().getAuthority() - " + identObj.getName().getAuthority());
System.out.println(" getRemarks() - " + identObj.getRemarks());
System.out.println(" getAliases():");
Iterator<GenericName> aliases = identObj.getAlias().iterator();
if (!aliases.hasNext()) {
System.out.println(" no aliases");
} else {
for (int i = 0; aliases.hasNext(); i++) {
System.out.println(" alias(" + i + "): " + (GenericName) aliases.next());
}
}
System.out.println(" getIdentifiers():");
// Identifier[]
Iterator<? extends Identifier> idents = identObj.getIdentifiers().iterator();
if (!idents.hasNext()) {
System.out.println(" no extra identifiers");
} else {
for (int i = 0; idents.hasNext(); i++) {
Identifier ident = idents.next();
System.out.println(" identifier(" + i + ").getCode() - " + ident.getCode());
System.out
.println(" identifier(" + i + ").getAuthority() - " + ident.getAuthority());
}
}
}
示例3: getName
import org.opengis.metadata.Identifier; //导入依赖的package包/类
public Identifier getName() {
throw new UnsupportedOperationException();
}
示例4: getName
import org.opengis.metadata.Identifier; //导入依赖的package包/类
public final Identifier getName() {
return _name;
}
示例5: gotoCRS
import org.opengis.metadata.Identifier; //导入依赖的package包/类
/**
* Takes in a CRS, finds it in the list and highlights it
*
* @param crs
*/
@SuppressWarnings("unchecked")
public void gotoCRS(final CoordinateReferenceSystem crs) {
if (crs != null) {
final List list = codesList.getList();
final Set<Identifier> identifiers = new HashSet<Identifier>(crs.getIdentifiers());
final Set<Integer> candidates = new HashSet<Integer>();
for (int i = 0; i < list.getItemCount(); i++) {
for (final Identifier identifier : identifiers) {
final String item = list.getItem(i);
if (sameEPSG(crs, identifier, item) || exactMatch(crs, identifier, item)) {
codesList.setSelection(new StructuredSelection(item), false);
list.setTopIndex(i);
return;
}
if (isMatch(crs, identifier, item)) {
candidates.add(i);
}
}
}
if (candidates.isEmpty()) {
final java.util.List<String> input = (java.util.List<String>) codesList.getInput();
final String sourceCRSName = crs.getName().toString();
sourceCRS = crs;
input.add(0, sourceCRSName);
codesList.setInput(input);
codesList.setSelection(new StructuredSelection(sourceCRSName), false);
list.setTopIndex(0);
try {
final String toWKT = crs.toWKT();
wktText.setText(toWKT);
} catch (final RuntimeException e) {
ExceptionMonitor.show(wktText.getShell(), e, crs.toString() + " cannot be formatted as WKT"); //$NON-NLS-1$
wktText.setText("Unknown/Illegal WKT");
}
} else {
final Integer next = candidates.iterator().next();
codesList.setSelection(new StructuredSelection(list.getItem(next)), false);
list.setTopIndex(next);
}
}
}
示例6: exactMatch
import org.opengis.metadata.Identifier; //导入依赖的package包/类
private boolean exactMatch(final CoordinateReferenceSystem crs, final Identifier identifier, final String item) {
return crs == DefaultGeographicCRS.WGS84 && item.equals("WGS 84 (4326)") || //$NON-NLS-1$
item.equalsIgnoreCase(identifier.toString()) || isInCodeMap(identifier, item);
}
示例7: sameEPSG
import org.opengis.metadata.Identifier; //导入依赖的package包/类
private boolean sameEPSG(final CoordinateReferenceSystem crs, final Identifier identifier, final String item) {
final String toString = identifier.toString();
return toString.contains("EPSG:") && item.contains(toString); //$NON-NLS-1$
}
示例8: isMatch
import org.opengis.metadata.Identifier; //导入依赖的package包/类
private boolean isMatch(final CoordinateReferenceSystem crs, final Identifier identifier, final String item) {
return crs == DefaultGeographicCRS.WGS84 && item.contains("4326") || item.contains(identifier.toString()); //$NON-NLS-1$
}
示例9: getCRS
import org.opengis.metadata.Identifier; //导入依赖的package包/类
/**
* returns the selected CRS
*
* @return selected CRS
*/
public CoordinateReferenceSystem getCRS() {
if (folder == null)
return selectedCRS;
if (folder.getSelectionIndex() == 1) {
try {
final String text = wktText.getText();
final CoordinateReferenceSystem createdCRS = ReferencingFactoryFinder.getCRSFactory(null)
.createFromWKT(text);
if (keywordsText.getText().trim().length() > 0) {
final Preferences node = findNode(createdCRS.getName().getCode());
if (node != null) {
final Preferences kn = node.node(ALIASES_ID);
final String[] keywords = keywordsText.getText().split(","); //$NON-NLS-1$
kn.clear();
for (String string : keywords) {
string = string.trim().toUpperCase();
if (string.length() > 0)
kn.put(string, string);
}
kn.flush();
} else {
CoordinateReferenceSystem found = createCRS(createdCRS.getName().getCode());
if (found != null && CRS.findMathTransform(found, createdCRS, true).isIdentity()) {
saveKeywords(found);
return found;
}
final Set<Identifier> identifiers = new HashSet<Identifier>(createdCRS.getIdentifiers());
for (final Identifier identifier : identifiers) {
found = createCRS(identifier.toString());
if (found != null && CRS.findMathTransform(found, createdCRS, true).isIdentity()) {
saveKeywords(found);
return found;
}
}
return saveCustomizedCRS(text, true, createdCRS);
}
}
return createdCRS;
} catch (final Exception e) {
ExceptionMonitor.show(wktText.getShell(), e);
}
}
if (selectedCRS == null) {
final String crsCode = (String) ((IStructuredSelection) codesList.getSelection()).getFirstElement();
if (sourceCRS != null && crsCode.equals(sourceCRS.getName().toString())) {
// System.out.println("source crs: " +
// sourceCRS.getName().toString());
return sourceCRS;
}
return createCRS(searchText.getText());
}
return selectedCRS;
}
示例10: saveCustomizedCRS
import org.opengis.metadata.Identifier; //导入依赖的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;
}