當前位置: 首頁>>代碼示例>>Java>>正文


Java CRS.getProjectedCRS方法代碼示例

本文整理匯總了Java中org.geotools.referencing.CRS.getProjectedCRS方法的典型用法代碼示例。如果您正苦於以下問題:Java CRS.getProjectedCRS方法的具體用法?Java CRS.getProjectedCRS怎麽用?Java CRS.getProjectedCRS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.geotools.referencing.CRS的用法示例。


在下文中一共展示了CRS.getProjectedCRS方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: convertAndDisplayBoundingBox

import org.geotools.referencing.CRS; //導入方法依賴的package包/類
private void convertAndDisplayBoundingBox(
        Double x1,
        Double x2,
        Double y1,
        Double y2,
        CoordinateReferenceSystem sourceCRS,
        CoordinateReferenceSystem targetCRS
) throws TransformException, FactoryException {
    com.vividsolutions.jts.geom.Point p1 = convertDoublesToPoint(
            x1,
            y1,
            sourceCRS,
            targetCRS);
    com.vividsolutions.jts.geom.Point p2 = convertDoublesToPoint(
            x2,
            y2,
            sourceCRS,
            targetCRS);
    ReferencedEnvelope re = new ReferencedEnvelope(targetCRS);
    re.include(p1.getX(), p1.getY());
    re.include(p2.getX(), p2.getY());
    DirectPosition lowerCorner = re.getLowerCorner();
    DirectPosition upperCorner = re.getUpperCorner();
    if (lowerCorner != null && upperCorner != null) {
        double valX1 = lowerCorner.getCoordinate()[0];
        double valY1 = lowerCorner.getCoordinate()[1];
        double valX2 = upperCorner.getCoordinate()[0];
        double valY2 = upperCorner.getCoordinate()[1];
        if (CRS.getProjectedCRS(targetCRS) == null) {
            this.coordinateX1TextField.setText(String.valueOf(
                    Math.round(valX1 * HOUNDREDTHOUSAND) / HOUNDREDTHOUSAND
            ));
            this.coordinateY1TextField.setText(String.valueOf(
                    Math.round(valY1 * HOUNDREDTHOUSAND) / HOUNDREDTHOUSAND
            ));
            this.coordinateX2TextField.setText(String.valueOf(
                    Math.round(valX2 * HOUNDREDTHOUSAND) / HOUNDREDTHOUSAND
            ));
            this.coordinateY2TextField.setText(String.valueOf(
                    Math.round(valY2 * HOUNDREDTHOUSAND) / HOUNDREDTHOUSAND
            ));
        } else {
            this.coordinateX1TextField.setText(String.valueOf(
                    Math.round((float) valX1)
            ));
            this.coordinateY1TextField.setText(String.valueOf(
                    Math.round((float) valY1)
            ));
            this.coordinateX2TextField.setText(String.valueOf(
                    Math.round((float) valX2)
            ));
            this.coordinateY2TextField.setText(String.valueOf(
                    Math.round((float) valY2)
            ));
        }
    }
}
 
開發者ID:gdi-by,項目名稱:downloadclient,代碼行數:58,代碼來源:WMSMapSwing.java

示例2: Projection

import org.geotools.referencing.CRS; //導入方法依賴的package包/類
Projection(final IScope scope, final IProjection world, final CoordinateReferenceSystem crs, final Envelope3D env,
		final ProjectionFactory fact) {
	this.factory = fact;
	this.referenceProjection = world;
	initialCRS = crs;
	if (env != null) {
		if (CRS.getProjectedCRS(initialCRS) == null) {
			createTransformation(computeProjection(scope));
		}
		// We project the envelope and we use it for initializing the translations
		projectedEnv = transform(env);
		// createTranslations(projectedEnv.getMinX(), projectedEnv.getHeight(), projectedEnv.getMinY());
	}
}
 
開發者ID:gama-platform,項目名稱:gama,代碼行數:15,代碼來源:Projection.java


注:本文中的org.geotools.referencing.CRS.getProjectedCRS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。