本文整理汇总了Java中com.vividsolutions.jts.geom.CoordinateSequence.setOrdinate方法的典型用法代码示例。如果您正苦于以下问题:Java CoordinateSequence.setOrdinate方法的具体用法?Java CoordinateSequence.setOrdinate怎么用?Java CoordinateSequence.setOrdinate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vividsolutions.jts.geom.CoordinateSequence
的用法示例。
在下文中一共展示了CoordinateSequence.setOrdinate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: applyZValues
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private void applyZValues(CoordinateSequence cs, int idx,
CoordinateSequence csOrig, int origIdx) {
double lx1 = cs.getOrdinate(idx, 0);
double ly1 = cs.getOrdinate(idx, 1);
double lz1;
double ox1 = csOrig.getOrdinate(origIdx, 0);
double oy1 = csOrig.getOrdinate(origIdx, 1);
double oz1 = csOrig.getOrdinate(origIdx, 2);
double ox2 = csOrig.getOrdinate(origIdx + 1, 0);
double oy2 = csOrig.getOrdinate(origIdx + 1, 1);
double oz2 = csOrig.getOrdinate(origIdx + 1, 2);
if(lx1 == ox1 && ly1 == oy1) {
lz1 = oz1;
} else {
double d1 = distance(ox1, oy1, lx1, ly1);
double d = distance(ox1, oy1, ox2, oy2);
lz1 = oz1 + (oz2 - oz1) * (d1 / d);
}
cs.setOrdinate(idx, 2, lz1);
}
示例2: toCoordinateSequence
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private CoordinateSequence toCoordinateSequence(OsmEntityProvider resolver)
throws EntityNotFoundException {
CoordinateSequenceFactory csf = factory.getCoordinateSequenceFactory();
int len = this.getLength();
CoordinateSequence points = csf.create(len, 2);
int n = 0;
for (int i = 0; i < this.segments.size(); i++) {
WaySegment segment = this.segments.get(i);
OsmWay way = segment.getWay();
for (int k = 0; k < way.getNumberOfNodes(); k++) {
if (k > 0 || i == 0) {
OsmNode node = resolver.getNode(segment.getNodeId(k));
points.setOrdinate(n, 0, node.getLongitude());
points.setOrdinate(n, 1, node.getLatitude());
n++;
}
}
}
return points;
}
示例3: ringFromSegments
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
private static LinearRing ringFromSegments(List<LineSegment> segments) {
GeometryFactory factory = new GeometryFactory();
int nSegs = segments.size();
if (nSegs < 3) {
return null;
}
int len = segments.size() + 1;
CoordinateSequence seq = factory.getCoordinateSequenceFactory().create(
len, 2);
int i = 0;
for (LineSegment line : segments) {
seq.setOrdinate(i, 0, line.p0.x);
seq.setOrdinate(i, 1, line.p0.y);
i++;
}
seq.setOrdinate(i, 0, segments.get(0).p0.x);
seq.setOrdinate(i, 1, segments.get(0).p0.y);
return factory.createLinearRing(seq);
}
示例4: 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);
}
示例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: readCoordinates
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* read numPoints of coordinates from input source.
*
* @param reader the reader
* @param numPoints the num points
* @return the coordinate sequence
* @throws IOException Signals that an I/O exception has occurred.
*/
protected CoordinateSequence readCoordinates(ShapeReader reader, int numPoints)
{
CoordinateSequence coordinateSequence = geometryFactory.getCoordinateSequenceFactory().create(numPoints,2);
for(int i = 0; i < numPoints; ++i){
coordinateSequence.setOrdinate(i, 0, reader.readDouble());
coordinateSequence.setOrdinate(i, 1, reader.readDouble());
}
return coordinateSequence;
}
示例7: testCreateBySizeAndModify
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
public void testCreateBySizeAndModify()
{
Coordinate[] coords = createArray(SIZE);
CoordinateSequence seq = getCSFactory().create(SIZE, 3);
for (int i = 0; i < seq.size(); i++) {
seq.setOrdinate(i, 0, coords[i].x);
seq.setOrdinate(i, 1, coords[i].y);
seq.setOrdinate(i, 2, coords[i].z);
}
assertTrue(isEqual(seq, coords));
}
示例8: test2DZOrdinate
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
public void test2DZOrdinate()
{
Coordinate[] coords = createArray(SIZE);
CoordinateSequence seq = getCSFactory().create(SIZE, 2);
for (int i = 0; i < seq.size(); i++) {
seq.setOrdinate(i, 0, coords[i].x);
seq.setOrdinate(i, 1, coords[i].y);
}
for (int i = 0; i < seq.size(); i++) {
Coordinate p = seq.getCoordinate(i);
assertTrue(Double.isNaN(p.z));
}
}
示例9: 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;
}
示例10: 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;
}
示例11: filter
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
@Override
public void filter(CoordinateSequence seq, int index) {
seq.setOrdinate(index, 0, Math.round(seq.getOrdinate(index, 0)));
seq.setOrdinate(index, 1, Math.round(seq.getOrdinate(index, 1)));
}
示例12: filter
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* Rounds the Coordinates in the sequence to match the PrecisionModel
*/
@Override
public void filter(CoordinateSequence seq, int i) {
seq.setOrdinate(i, 0, this.precModel.makePrecise(seq.getOrdinate(i, 0)));
seq.setOrdinate(i, 1, this.precModel.makePrecise(seq.getOrdinate(i, 1)));
}
示例13: filter
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* Rounds the Coordinates in the sequence to match the PrecisionModel
*/
public void filter(CoordinateSequence seq, int i) {
seq.setOrdinate(i, 0, precModel.makePrecise(seq.getOrdinate(i, 0)));
seq.setOrdinate(i, 1, precModel.makePrecise(seq.getOrdinate(i, 1)));
}
示例14: transform
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* Applies this transformation to the i'th coordinate
* in the given CoordinateSequence.
*
* @param seq a <code>CoordinateSequence</code>
* @param i the index of the coordinate to transform
*/
public void transform(CoordinateSequence seq, int i) {
double xp = this.m00 * seq.getOrdinate(i, 0) + this.m01 * seq.getOrdinate(i, 1) + this.m02;
double yp = this.m10 * seq.getOrdinate(i, 0) + this.m11 * seq.getOrdinate(i, 1) + this.m12;
seq.setOrdinate(i, 0, xp);
seq.setOrdinate(i, 1, yp);
}
示例15: transform
import com.vividsolutions.jts.geom.CoordinateSequence; //导入方法依赖的package包/类
/**
* Applies this transformation to the i'th coordinate
* in the given CoordinateSequence.
*
* @param seq a <code>CoordinateSequence</code>
* @param i the index of the coordinate to transform
*/
public void transform(CoordinateSequence seq, int i) {
double xp = m00 * seq.getOrdinate(i, 0) + m01 * seq.getOrdinate(i, 1) + m02;
double yp = m10 * seq.getOrdinate(i, 0) + m11 * seq.getOrdinate(i, 1) + m12;
seq.setOrdinate(i, 0, xp);
seq.setOrdinate(i, 1, yp);
}