Java Code Examples for mil.nga.sf.Point#setZ()

The following examples show how to use mil.nga.sf.Point#setZ() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestUtils.java    From geopackage-android-map with MIT License 6 votes vote down vote up
/**
 * Create a random point
 *
 * @param hasZ
 * @param hasM
 * @return
 */
public static Point createPoint(boolean hasZ, boolean hasM) {

    double x = Math.random() * 180.0 * (Math.random() < .5 ? 1 : -1);
    double y = Math.random() * 90.0 * (Math.random() < .5 ? 1 : -1);

    Point point = new Point(hasZ, hasM, x, y);

    if (hasZ) {
        double z = Math.random() * 1000.0;
        point.setZ(z);
    }

    if (hasM) {
        double m = Math.random() * 1000.0;
        point.setM(m);
    }

    return point;
}
 
Example 2
Source File: TestUtils.java    From geopackage-android with MIT License 6 votes vote down vote up
/**
 * Create a random point
 *
 * @param hasZ
 * @param hasM
 * @return
 */
public static Point createPoint(boolean hasZ, boolean hasM) {

    double x = Math.random() * 180.0 * (Math.random() < .5 ? 1 : -1);
    double y = Math.random() * ProjectionConstants.WEB_MERCATOR_MIN_LAT_RANGE * (Math.random() < .5 ? 1 : -1);

    Point point = new Point(hasZ, hasM, x, y);

    if (hasZ) {
        double z = Math.random() * 1000.0;
        point.setZ(z);
    }

    if (hasM) {
        double m = Math.random() * 1000.0;
        point.setM(m);
    }

    return point;
}
 
Example 3
Source File: TestUtils.java    From geopackage-java with MIT License 6 votes vote down vote up
/**
 * Create a random point
 * 
 * @param hasZ
 * @param hasM
 * @return point
 */
public static Point createPoint(boolean hasZ, boolean hasM) {

	double x = Math.random() * 180.0 * (Math.random() < .5 ? 1 : -1);
	double y = Math.random()
			* ProjectionConstants.WEB_MERCATOR_MIN_LAT_RANGE
			* (Math.random() < .5 ? 1 : -1);

	Point point = new Point(hasZ, hasM, x, y);

	if (hasZ) {
		double z = Math.random() * 1000.0;
		point.setZ(z);
	}

	if (hasM) {
		double m = Math.random() * 1000.0;
		point.setM(m);
	}

	return point;
}
 
Example 4
Source File: FeatureUtils.java    From geopackage-android with MIT License 5 votes vote down vote up
/**
 * Update a point
 *
 * @param point
 */
private static void updatePoint(Point point) {
    point.setX(POINT_UPDATED_X);
    point.setY(POINT_UPDATED_Y);
    if (point.hasZ()) {
        point.setZ(POINT_UPDATED_Z);
    }
    if (point.hasM()) {
        point.setM(POINT_UPDATED_M);
    }
}
 
Example 5
Source File: FeatureUtils.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Update a point
 * 
 * @param point
 */
private static void updatePoint(Point point) {
	point.setX(POINT_UPDATED_X);
	point.setY(POINT_UPDATED_Y);
	if (point.hasZ()) {
		point.setZ(POINT_UPDATED_Z);
	}
	if (point.hasM()) {
		point.setM(POINT_UPDATED_M);
	}
}