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


Java CoordinateSequence.getDimension方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:19,代码来源:WKBWriter.java

示例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);
}
 
开发者ID:PDOK,项目名称:gml3-jts,代码行数:28,代码来源:GML321ToSurfaceConvertor.java

示例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 );
}
 
开发者ID:CDS-INSPIRE,项目名称:InSpider,代码行数:27,代码来源:ExtendedWKBReader.java

示例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);
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:19,代码来源:CoordinateArraySequence.java

示例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;
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:15,代码来源:WKBReader.java

示例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));
        }
    }
}
 
开发者ID:gegy1000,项目名称:Earth,代码行数:19,代码来源:WKTWriter.java

示例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);
    }
}
 
开发者ID:Semantive,项目名称:jts,代码行数:20,代码来源:CoordinateArraySequence.java

示例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;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:14,代码来源:SpatialiteWKBReader.java

示例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;
}
 
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:14,代码来源:OGCWKBReader.java

示例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);
	}
}
 
开发者ID:opengeospatial,项目名称:Java-OpenMobility,代码行数:13,代码来源:OGCWKBWriter.java

示例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);
}
 
开发者ID:ec-europa,项目名称:sumo,代码行数:5,代码来源:ClipProcess.java


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