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


Java CoordinateSequence.setOrdinate方法代码示例

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

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

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

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

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

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

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

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

示例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)));
}
 
开发者ID:OrdnanceSurvey,项目名称:vt-support,代码行数:6,代码来源:RoundingFilter.java

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

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

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

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


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