当前位置: 首页>>代码示例>>Java>>正文


Java CoordinateReferenceSystem.getIdentifiers方法代码示例

本文整理汇总了Java中org.opengis.referencing.crs.CoordinateReferenceSystem.getIdentifiers方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinateReferenceSystem.getIdentifiers方法的具体用法?Java CoordinateReferenceSystem.getIdentifiers怎么用?Java CoordinateReferenceSystem.getIdentifiers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opengis.referencing.crs.CoordinateReferenceSystem的用法示例。


在下文中一共展示了CoordinateReferenceSystem.getIdentifiers方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCRSCode

import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的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;
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:29,代码来源:CoordManager.java

示例2: haveCommonReferenceIdentifiers

import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的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();
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:24,代码来源:ProductLayerAssistantPage.java

示例3: getCRSIdentifier

import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的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;
}
 
开发者ID:stefan0722,项目名称:gs-mvt,代码行数:13,代码来源:SlippyTilesController.java

示例4: getProperties

import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的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");
	}
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:40,代码来源:SRS.java

示例5: gotoCRS

import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的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);

		}
	}
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:50,代码来源:CRSChooser.java

示例6: getCRS

import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的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;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:62,代码来源:CRSChooser.java

示例7: saveCustomizedCRS

import org.opengis.referencing.crs.CoordinateReferenceSystem; //导入方法依赖的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;
}
 
开发者ID:gama-platform,项目名称:gama,代码行数:51,代码来源:CRSChooser.java


注:本文中的org.opengis.referencing.crs.CoordinateReferenceSystem.getIdentifiers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。