本文整理汇总了Java中org.opengis.referencing.cs.CoordinateSystem.getDimension方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinateSystem.getDimension方法的具体用法?Java CoordinateSystem.getDimension怎么用?Java CoordinateSystem.getDimension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.opengis.referencing.cs.CoordinateSystem
的用法示例。
在下文中一共展示了CoordinateSystem.getDimension方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: clipRange
import org.opengis.referencing.cs.CoordinateSystem; //导入方法依赖的package包/类
/**
*
* @param val
* the value
* @param crs
* @param axis
* the coordinate axis
* @return
*/
private static double clipRange(
final double val,
final CoordinateReferenceSystem crs,
final int axis ) {
final CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
if (coordinateSystem.getDimension() > axis) {
final CoordinateSystemAxis coordinateAxis = coordinateSystem.getAxis(axis);
if (val < coordinateAxis.getMinimumValue()) {
return coordinateAxis.getMinimumValue();
}
else if (val > coordinateAxis.getMaximumValue()) {
return coordinateAxis.getMaximumValue();
}
}
return val;
}
示例2: adjustCoordinateDimensionToRange
import org.opengis.referencing.cs.CoordinateSystem; //导入方法依赖的package包/类
/**
* This is perhaps a brain dead approach to do this, but it does handle wrap
* around cases. Also supports cases where the wrap around occurs many
* times.
*
* @param val
* the value
* @param crs
* @param axis
* the coordinate axis
* @return
*/
public static double adjustCoordinateDimensionToRange(
final double val,
final CoordinateReferenceSystem crs,
final int axis ) {
final CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
if (coordinateSystem.getDimension() > axis) {
final double lowerBound = coordinateSystem.getAxis(
axis).getMinimumValue();
final double bound = coordinateSystem.getAxis(
axis).getMaximumValue() - lowerBound;
final double sign = sign(val);
// re-scale to 0 to n, then determine how many times to 'loop
// around'
final double mult = Math.floor(Math.abs((val + (sign * (-1.0 * lowerBound))) / bound));
return val + (mult * bound * sign * (-1.0));
}
return val;
}
示例3: contains
import org.opengis.referencing.cs.CoordinateSystem; //导入方法依赖的package包/类
/**
* Provides a more efficient contains() method than the one in
* AbstractPolygon
*/
@Override
public boolean contains(double x, double y) {
CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
if (coordinateSystem.getDimension() >= 2) {
if (coordinateSystem.getAxis(0).getRangeMeaning() == RangeMeaning.WRAPAROUND) {
x = GISUtils.getNextEquivalentLongitude(minx, x);
}
if (coordinateSystem.getAxis(1).getRangeMeaning() == RangeMeaning.WRAPAROUND) {
y = GISUtils.getNextEquivalentLongitude(miny, y);
}
}
return (x >= minx && x <= maxx && y >= miny && y <= maxy);
}
示例4: toPolygonCoordinates
import org.opengis.referencing.cs.CoordinateSystem; //导入方法依赖的package包/类
private static Coordinate[] toPolygonCoordinates(
final CoordinateSystem coordinateSystem ) {
final Coordinate[] coordinates = new Coordinate[(int) Math.pow(
2,
coordinateSystem.getDimension()) + 1];
final BitSet greyCode = new BitSet(
coordinateSystem.getDimension());
final BitSet mask = getGreyCodeMask(coordinateSystem.getDimension());
for (int i = 0; i < coordinates.length; i++) {
coordinates[i] = new Coordinate(
getValue(
greyCode,
coordinateSystem.getAxis(0),
0),
getValue(
greyCode,
coordinateSystem.getAxis(1),
1),
coordinateSystem.getDimension() > 2 ? getValue(
greyCode,
coordinateSystem.getAxis(2),
2) : Double.NaN);
grayCode(
greyCode,
mask);
}
return coordinates;
}
示例5: getAxis
import org.opengis.referencing.cs.CoordinateSystem; //导入方法依赖的package包/类
public static String getAxis(
final CoordinateReferenceSystem crs ) {
// Some geometries do not have a CRS provided. Thus we default to
// urn:ogc:def:crs:EPSG::4326
final CoordinateSystem cs = crs == null ? null : crs.getCoordinateSystem();
if ((cs != null) && (cs.getDimension() > 0)) {
return cs.getAxis(
0).getDirection().name().toString();
}
return "EAST";
}
示例6: indexOf
import org.opengis.referencing.cs.CoordinateSystem; //导入方法依赖的package包/类
private static int indexOf(
final CoordinateReferenceSystem crs,
final Set<AxisDirection> direction ) {
final CoordinateSystem cs = crs.getCoordinateSystem();
for (int index = 0; index < cs.getDimension(); index++) {
final CoordinateSystemAxis axis = cs.getAxis(index);
if (direction.contains(axis.getDirection())) {
return index;
}
}
return -1;
}
示例7: internalCreatePrimaryIndex
import org.opengis.referencing.cs.CoordinateSystem; //导入方法依赖的package包/类
private static PrimaryIndex internalCreatePrimaryIndex(
final SpatialTemporalOptions options ) {
NumericDimensionDefinition[] dimensions;
NumericDimensionField<?>[] fields = null;
CoordinateReferenceSystem crs = null;
boolean isDefaultCRS;
String crsCode = null;
if (options.crs == null || options.crs.isEmpty() || options.crs.equalsIgnoreCase(GeometryUtils.DEFAULT_CRS_STR)) {
dimensions = SPATIAL_TEMPORAL_DIMENSIONS;
fields = SPATIAL_TEMPORAL_FIELDS;
isDefaultCRS = true;
crsCode = "EPSG:4326";
}
else {
crs = decodeCRS(options.crs);
CoordinateSystem cs = crs.getCoordinateSystem();
isDefaultCRS = false;
crsCode = options.crs;
dimensions = new NumericDimensionDefinition[cs.getDimension() + 1];
fields = new NumericDimensionField[dimensions.length];
for (int d = 0; d < dimensions.length - 1; d++) {
CoordinateSystemAxis csa = cs.getAxis(d);
dimensions[d] = new CustomCRSSpatialDimension(
(byte) d,
csa.getMinimumValue(),
csa.getMaximumValue());
fields[d] = new CustomCRSSpatialField(
(CustomCRSSpatialDimension) dimensions[d]);
}
dimensions[dimensions.length - 1] = new TimeDefinition(
options.periodicity);
fields[dimensions.length - 1] = new TimeField(
options.periodicity);
}
BasicIndexModel indexModel = null;
if (isDefaultCRS) {
indexModel = new BasicIndexModel(
fields);
}
else {
indexModel = new CustomCrsIndexModel(
fields,
crsCode);
}
String combinedArrayID;
if (isDefaultCRS) {
combinedArrayID = DEFAULT_SPATIAL_TEMPORAL_ID_STR + "_" + options.bias + "_" + options.periodicity;
}
else {
combinedArrayID = DEFAULT_SPATIAL_TEMPORAL_ID_STR + "_" + (crsCode.substring(crsCode.indexOf(":") + 1))
+ "_" + options.bias + "_" + options.periodicity;
}
final String combinedId = combinedArrayID;
return new CustomIdIndex(
XZHierarchicalIndexFactory.createFullIncrementalTieredStrategy(
dimensions,
new int[] {
options.bias.getSpatialPrecision(),
options.bias.getSpatialPrecision(),
options.bias.getTemporalPrecision()
},
SFCType.HILBERT,
options.maxDuplicates),
indexModel,
new ByteArrayId(
combinedId));
}