Back to project page zmap.
The source code is released under:
GNU Lesser General Public License
If you think the Android project zmap listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.zmap.geom; //from w w w . j a va 2s . c om import java.util.Arrays; public class Point implements IPoint { public Point() { coord = new double[4]; set(Double.NaN, Double.NaN, Double.NaN, Double.NaN); } @Override public double getX() { return coord[X_INDEX]; } @Override public double getY() { return coord[Y_INDEX]; } @Override public double getZ() { return coord[Z_INDEX]; } @Override public double getM() { return coord[M_INDEX]; } @Override public double[] get() { return Arrays.copyOf(coord, coord.length); } @Override public void setX(double x) { coord[X_INDEX] = x; } @Override public void setY(double y) { coord[Y_INDEX] = y; } @Override public void setZ(double z) { coord[Z_INDEX] = z; } @Override public void setM(double m) { coord[M_INDEX] = m; } @Override public void set(double x, double y) { set(x, y, getZ(), getM()); } @Override public void set(double x, double y, double z) { set(x, y, z, getM()); } @Override public void set(double x, double y, double z, double m) { coord[X_INDEX] = x; coord[Y_INDEX] = y; coord[Z_INDEX] = z; coord[M_INDEX] = m; } @Override public void set(double[] newCoords) { coord[X_INDEX] = newCoords[X_INDEX]; coord[Y_INDEX] = newCoords[Y_INDEX]; coord[Z_INDEX] = newCoords[Z_INDEX]; coord[M_INDEX] = newCoords[M_INDEX]; } @Override public boolean isEmpty() { return Double.isNaN(getX()) && Double.isNaN(getY()) && Double.isNaN(getZ()) && Double.isNaN(getM()); } @Override public IEnvelope envelope() { if(isEmpty()) { throw new EmptyGeometryException(); } return new Envelope(getX(), getY(), getX(), getY()); } private double coord[]; private static final int X_INDEX = 0; private static final int Y_INDEX = 1; private static final int Z_INDEX = 2; private static final int M_INDEX = 3; }