本文整理汇总了Java中com.vividsolutions.jts.geom.CoordinateSequence.getDimension方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinateSequence.getDimension方法的具体用法?Java CoordinateSequence.getDimension怎么用?Java CoordinateSequence.getDimension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.CoordinateSequence
的用法示例。
在下文中一共展示了CoordinateSequence.getDimension方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeCoordinate
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private void writeCoordinate(CoordinateSequence seq, int index, OutStream os)
throws IOException {
ByteOrderValues.putDouble(seq.getX(index), this.buf, this.byteOrder);
os.write(this.buf, 8);
ByteOrderValues.putDouble(seq.getY(index), this.buf, this.byteOrder);
os.write(this.buf, 8);
// only write 3rd dim if caller has requested it for this writer
if (this.outputDimension >= 3) {
// if 3rd dim is requested, only write it if the CoordinateSequence provides it
double ordVal = Coordinate.NULL_ORDINATE;
if (seq.getDimension() >= 3) {
ordVal = seq.getOrdinate(index, 2);
}
ByteOrderValues.putDouble(ordVal, this.buf, this.byteOrder);
os.write(this.buf, 8);
}
}
示例2: reverseRing
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* Does what it says, reverses the order of the Coordinates in the ring.
* <p>
* This is different then lr.reverses() in that a copy is produced using a
* new coordinate sequence.
* </p>
*
* @param lr The ring to reverse.
* @return A new ring with the reversed Coordinates.
*/
public static final LinearRing reverseRing(LinearRing lr) {
GeometryFactory gf = lr.getFactory();
CoordinateSequenceFactory csf = gf.getCoordinateSequenceFactory();
CoordinateSequence csOrig = lr.getCoordinateSequence();
int numPoints = csOrig.size();
int dimensions = csOrig.getDimension();
CoordinateSequence csNew = csf.create(numPoints, dimensions);
for (int i = 0; i < numPoints; i++) {
for (int j = 0; j < dimensions; j++) {
csNew.setOrdinate(numPoints - 1 - i, j, csOrig.getOrdinate(i, j));
}
}
return gf.createLinearRing(csNew);
}
示例3: getAsPoints
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private static Points getAsPoints( CoordinateSequence seq, ICRS crs, boolean swapAxis ) {
int dim = seq.getDimension();
double[] coordinates = new double[ seq.size() * dim ];
int idx = 0;
for(int i = 0; i < seq.size(); i++) {
for(int j = 0; j < dim; j++) {
if(swapAxis) {
if(j == 0) {
coordinates[idx++] = seq.getOrdinate(i, 1);
} else if( j == 1) {
coordinates[idx++] = seq.getOrdinate(i, 0);
} else {
coordinates[idx++] = seq.getOrdinate(i, j);
}
} else {
coordinates[idx++] = seq.getOrdinate(i, j);
}
}
}
PackedCoordinateSequenceFactory factory = new PackedCoordinateSequenceFactory();
seq = factory.create(coordinates, dim);
return new JTSPoints( crs, seq );
}
示例4: CoordinateArraySequence
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* Creates a new sequence based on a deep copy of the given {@link CoordinateSequence}.
* The coordinate dimension is set to equal the dimension of the input.
*
* @param coordSeq the coordinate sequence that will be copied.
*/
public CoordinateArraySequence(CoordinateSequence coordSeq) {
if (coordSeq != null) {
this.dimension = coordSeq.getDimension();
this.coordinates = new Coordinate[coordSeq.size()];
} else {
this.coordinates = new Coordinate[0];
}
for (int i = 0; i < this.coordinates.length; i++) {
this.coordinates[i] = coordSeq.getCoordinateCopy(i);
}
}
示例5: readCoordinateSequence
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private CoordinateSequence readCoordinateSequence(int size) throws IOException {
CoordinateSequence seq = this.csFactory.create(size, this.inputDimension);
int targetDim = seq.getDimension();
if (targetDim > this.inputDimension) {
targetDim = this.inputDimension;
}
for (int i = 0; i < size; i++) {
this.readCoordinate();
for (int j = 0; j < targetDim; j++) {
seq.setOrdinate(i, j, this.ordValues[j]);
}
}
return seq;
}
示例6: appendCoordinate
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* Appends the i'th coordinate from the sequence to the writer
*
* @param seq the <code>CoordinateSequence</code> to process
* @param i the index of the coordinate to write
* @param writer the output writer to append to
*/
private void appendCoordinate(CoordinateSequence seq, int i, Writer writer)
throws IOException {
writer.write(this.writeNumber(seq.getX(i)) + " " + this.writeNumber(seq.getY(i)));
if (this.outputDimension >= 3 && seq.getDimension() >= 3) {
double z = seq.getOrdinate(i, 3);
if (!Double.isNaN(z)) {
writer.write(" ");
writer.write(this.writeNumber(z));
}
}
}
示例7: CoordinateArraySequence
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* Creates a new sequence based on a deep copy of the given {@link CoordinateSequence}.
* The coordinate dimension is set to equal the dimension of the input.
*
* @param coordSeq the coordinate sequence that will be copied.
*/
public CoordinateArraySequence(CoordinateSequence coordSeq) {
// NOTE: this will make a sequence of the default dimension
if (coordSeq == null) {
coordinates = new Coordinate[0];
return;
}
dimension = coordSeq.getDimension();
coordinates = new Coordinate[coordSeq.size()];
for (int i = 0; i < coordinates.length; i++) {
coordinates[i] = coordSeq.getCoordinateCopy(i);
}
}
示例8: readCoordinateSequence
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private CoordinateSequence readCoordinateSequence( int size ) throws IOException {
CoordinateSequence seq = csFactory.create(size, inputDimension);
int targetDim = seq.getDimension();
if (targetDim > inputDimension)
targetDim = inputDimension;
for( int i = 0; i < size; i++ ) {
readCoordinate();
for( int j = 0; j < targetDim; j++ ) {
seq.setOrdinate(i, j, ordValues[j]);
}
}
return seq;
}
示例9: readCoordinateSequence
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private CoordinateSequence readCoordinateSequence(int size) throws IOException {
CoordinateSequence seq = factory.getCoordinateSequenceFactory().create(size, inputDimension);
int targetDim = seq.getDimension();
if (targetDim > inputDimension)
targetDim = inputDimension;
for (int i = 0; i < size; i++) {
readCoordinate();
for (int j = 0; j < targetDim; j++) {
seq.setOrdinate(i, j, ordValues[j]);
}
}
return seq;
}
示例10: writeCoordinateSequence
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private void writeCoordinateSequence(CoordinateSequence seq, boolean writeSize, OutStream os)
throws IOException {
if (writeSize)
writeInt(seq.size(), os);
boolean output3D = false;
if (seq.getDimension() >= 3 && outputDimension >= 3) output3D = true;
for (int i = 0; i < seq.size(); i++) {
writeCoordinate(seq, i, output3D, os);
}
}
示例11: hasElevations
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
protected boolean hasElevations(CoordinateSequence seq) {
return (seq instanceof CoordinateArraySequence && !Double.isNaN(((CoordinateArraySequence) seq).getCoordinate(0).z))
|| (!(seq instanceof CoordinateArraySequence) && seq.getDimension() > 2);
}