本文整理匯總了Java中org.opengis.referencing.cs.CartesianCS類的典型用法代碼示例。如果您正苦於以下問題:Java CartesianCS類的具體用法?Java CartesianCS怎麽用?Java CartesianCS使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
CartesianCS類屬於org.opengis.referencing.cs包,在下文中一共展示了CartesianCS類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: computeTargetCRS
import org.opengis.referencing.cs.CartesianCS; //導入依賴的package包/類
void computeTargetCRS(final IScope scope, final CoordinateReferenceSystem crs, final double longitude,
final double latitude) {
// If we already know in which CRS we project the data in GAMA, no need to recompute it. This information is
// normally wiped when an experiment is disposed
if (targetCRS != null) { return; }
try {
if (!GamaPreferences.External.LIB_TARGETED.getValue()) {
targetCRS = computeDefaultCRS(scope, GamaPreferences.External.LIB_TARGET_CRS.getValue(), true);
} else {
if (crs != null && crs instanceof ProjectedCRS) { // Temporary fix of issue 766... a better solution
CartesianCS ccs = ((ProjectedCRS) crs).getCoordinateSystem();
Unit<?> unitX = ccs.getAxis(0).getUnit();
if (unitX != null && !unitX.equals(SI.METER)) {
unitConverter = unitX.getConverterTo(SI.METER);
}
targetCRS = crs;
} else {
final int index = (int) (0.5 + (longitude + 186.0) / 6);
final boolean north = latitude > 0;
final String newCode = EPSGPrefix + (32600 + index + (north ? 0 : 100));
targetCRS = getCRS(scope, newCode);
}
}
} catch (final GamaRuntimeException e) {
e.addContext(
"The cause could be that you try to re-project already projected data (see Gama > Preferences... > External for turning the option to true)");
throw e;
}
}
示例2: premadeObjects
import org.opengis.referencing.cs.CartesianCS; //導入依賴的package包/類
/**
* A method with some examples of premade static objects.
*/
void premadeObjects() {
// premadeObjects start
GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
GeodeticDatum wgs84Datum = org.geotools.referencing.datum.DefaultGeodeticDatum.WGS84;
PrimeMeridian greenwichMeridian = org.geotools.referencing.datum.DefaultPrimeMeridian.GREENWICH;
CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
CoordinateSystemAxis latAxis = org.geotools.referencing.cs.DefaultCoordinateSystemAxis.GEODETIC_LATITUDE;
// premadeObjects end
}
示例3: createCRSByHand1
import org.opengis.referencing.cs.CartesianCS; //導入依賴的package包/類
/**
* Creates a WGS 84/UTM Zone 10N CRS mostly (uses some premade objects) by hand. Uses the higher
* level FactoryGroup instead of the lower level MathTransformFactory (commented out).
*
* @throws Exception
*/
void createCRSByHand1() throws Exception {
System.out.println("------------------------------------------");
System.out.println("Creating a CRS by hand:");
// createCRSByHand1 start
MathTransformFactory mtFactory = ReferencingFactoryFinder.getMathTransformFactory(null);
CRSFactory crsFactory = ReferencingFactoryFinder.getCRSFactory(null);
GeographicCRS geoCRS = org.geotools.referencing.crs.DefaultGeographicCRS.WGS84;
CartesianCS cartCS = org.geotools.referencing.cs.DefaultCartesianCS.GENERIC_2D;
ParameterValueGroup parameters = mtFactory.getDefaultParameters("Transverse_Mercator");
parameters.parameter("central_meridian").setValue(-111.0);
parameters.parameter("latitude_of_origin").setValue(0.0);
parameters.parameter("scale_factor").setValue(0.9996);
parameters.parameter("false_easting").setValue(500000.0);
parameters.parameter("false_northing").setValue(0.0);
Conversion conversion = new DefiningConversion("Transverse_Mercator", parameters);
Map<String, ?> properties = Collections.singletonMap("name", "WGS 84 / UTM Zone 12N");
ProjectedCRS projCRS = crsFactory.createProjectedCRS(properties, geoCRS, conversion, cartCS);
// createCRSByHand1 end
// parameters.parameter("semi_major").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMajorAxis());
// parameters.parameter("semi_minor").setValue(((GeodeticDatum)geoCRS.getDatum()).getEllipsoid().getSemiMinorAxis());
// MathTransform trans = mtFactory.createParameterizedTransform(parameters);
// ProjectedCRS projCRS = crsFactory.createProjectedCRS(
// Collections.singletonMap("name", "WGS 84 / UTM Zone 12N"),
// new org.geotools.referencing.operation.OperationMethod(trans),
// geoCRS, trans, cartCS);
System.out.println(" Projected CRS: " + projCRS.toWKT());
System.out.println("------------------------------------------");
// save for later use in createMathTransformBetweenCRSs()
this.utm10NCRS = projCRS;
}
示例4: getCoordinateSystem
import org.opengis.referencing.cs.CartesianCS; //導入依賴的package包/類
public CartesianCS getCoordinateSystem() {
return base.getCoordinateSystem();
}