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


Java CoordinateSystem类代码示例

本文整理汇总了Java中org.opengis.referencing.cs.CoordinateSystem的典型用法代码示例。如果您正苦于以下问题:Java CoordinateSystem类的具体用法?Java CoordinateSystem怎么用?Java CoordinateSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: toText

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
/**
 * Returns the string representation of this coordinates.
 * 
 * @return the coordinates values/units.
 */
public Text toText() {
    double[] coordinates = getCoordinates();
    CoordinateSystem cs = this.getCoordinateReferenceSystem().getCoordinateSystem();
    TextBuilder tb = TextBuilder.newInstance();
    tb.append('[');
    for (int i=0; i < coordinates.length; i++) {
        if (i != 0) {
            tb.append(", ");
        }
        tb.append(getOrdinate(i));
        tb.append(' ');
        tb.append(cs.getAxis(i).getUnit());
    }
    tb.append(']');
    return tb.toText();
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:22,代码来源:Coordinates.java

示例2: 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;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:26,代码来源:FeatureGeometryUtils.java

示例3: 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;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:31,代码来源:FeatureGeometryUtils.java

示例4: updatePixelUnit

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
public void updatePixelUnit(CoordinateReferenceSystem crs) {
    final CoordinateSystem coordinateSystem = crs.getCoordinateSystem();
    final String unitX = coordinateSystem.getAxis(0).getUnit().toString();
    if (!unitX.equals(pixelXUnit.getText())) {
        pixelXUnit.setText(unitX);
        pixelSizeXField.setValue(unitMap.get(unitX));
    }
    final String unitY = coordinateSystem.getAxis(1).getUnit().toString();
    if (!unitY.equals(pixelYUnit.getText())) {
        pixelYUnit.setText(unitY);
        pixelSizeYField.setValue(unitMap.get(unitY));
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:14,代码来源:BoundsInputPanel.java

示例5: 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);
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:18,代码来源:BoundingBoxImpl.java

示例6: 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;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:30,代码来源:FeatureGeometryUtils.java

示例7: 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";
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:12,代码来源:FeatureDataUtils.java

示例8: 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;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:13,代码来源:GeoWaveRasterReader.java

示例9: getCoordinateSystem

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
@Override
public CoordinateSystem getCoordinateSystem() {
    return TemporalCRS.TIME_CS;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:5,代码来源:Time.java

示例10: getCoordinateSystem

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
@Override
public CoordinateSystem getCoordinateSystem() {
    return ProjectedCRS.EASTING_NORTHING_CS;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:5,代码来源:UTM.java

示例11: getCoordinateSystem

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
@Override
public CoordinateSystem getCoordinateSystem() {
    return GeographicCRS.LATITUDE_LONGITUDE_CS;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:5,代码来源:LatLong.java

示例12: getCoordinateSystem

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
@Override
public CoordinateSystem getCoordinateSystem() {
    return VerticalCRS.HEIGHT_CS;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:5,代码来源:Height.java

示例13: getCoordinateSystem

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
@Override
public CoordinateSystem getCoordinateSystem() {
    return _coordinateSystem;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:5,代码来源:CompoundCRS.java

示例14: getCoordinateSystem

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
@Override
public CoordinateSystem getCoordinateSystem() {
    return GeocentricCRS.XYZ_CS;
}
 
开发者ID:jgaltidor,项目名称:VarJ,代码行数:5,代码来源:XYZ.java

示例15: RegularGridImpl

import org.opengis.referencing.cs.CoordinateSystem; //导入依赖的package包/类
/**
 * Constructs a RegularGrid from the given bounding box, with the given
 * width and height. Note that the bounding box represents the edges of the
 * grid, whereas grid coordinates represent the centre of the grid points.
 * 
 * @param minx
 *            the minimum x value of the bounding box
 * @param miny
 *            the minimum y value of the bounding box
 * @param maxx
 *            the maximum x value of the bounding box
 * @param maxy
 *            the maximum y value of the bounding box
 * @param crs
 *            the {@link CoordinateReferenceSystem}
 * @param width
 *            the number of grid points in the x-direction
 * @param height
 *            the number of grid points in the y-direction
 */
public RegularGridImpl(double minx, double miny, double maxx, double maxy,
        CoordinateReferenceSystem crs, int width, int height) {
    super(crs);
    if (maxx < minx || maxy < miny) {
        throw new IllegalArgumentException("Invalid bounding box");
    }

    this.crs = crs;

    double xSpacing = (maxx - minx) / width;
    double ySpacing = (maxy - miny) / height;

    // The axis values represent the centres of the grid points
    double firstXAxisValue = minx + (0.5 * xSpacing);
    double firstYAxisValue = miny + (0.5 * ySpacing);

    if (crs == null) {
        /*
         * If we don't have a crs, we can't tell if an axis is longitude
         */
        xAxis = new RegularAxisImpl("Unknown X axis", firstXAxisValue, xSpacing, width, false);
        yAxis = new RegularAxisImpl("Unknown Y axis", firstYAxisValue, ySpacing, height, false);
    } else {
        /*
         * If we do have a crs, we can use rangeMeaning==WRAPAROUND to
         * determine whether the axis is longitude
         * 
         * TODO There may be wrapped axes where this is inappropriate.
         * Perhaps change isLongitude to wraps in RegularAxisImpl, and set a
         * wrap value?
         */
        CoordinateSystem cs = crs.getCoordinateSystem();
        xAxis = new RegularAxisImpl(cs.getAxis(0).getName().toString(), firstXAxisValue,
                xSpacing, width, (cs.getAxis(0).getRangeMeaning() == RangeMeaning.WRAPAROUND));
        /*
         * y axis is very unlikely to be longitude
         */
        yAxis = new RegularAxisImpl(cs.getAxis(1).getName().toString(), firstYAxisValue,
                ySpacing, height, (cs.getAxis(1).getRangeMeaning() == RangeMeaning.WRAPAROUND));
    }
}
 
开发者ID:Reading-eScience-Centre,项目名称:edal-java,代码行数:62,代码来源:RegularGridImpl.java


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