Java 类com.vividsolutions.jts.geom.Lineal 实例源码

项目:Earth    文件:PreparedGeometryFactory.java   
/**
 * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}.
 *
 * @param geom the geometry to prepare
 * @return the prepared geometry
 */
public PreparedGeometry create(Geometry geom) {
    if (geom instanceof Polygonal) {
        return new PreparedPolygon((Polygonal) geom);
    }
    if (geom instanceof Lineal) {
        return new PreparedLineString((Lineal) geom);
    }
    if (geom instanceof Puntal) {
        return new PreparedPoint((Puntal) geom);
    }

    /**
     * Default representation.
     */
    return new BasicPreparedGeometry(geom);
}
项目:StreetComplete    文件:ElementGeometry.java   
private LatLon findCenterPoint()
{
    try
    {
        Geometry geom = JTSConst.toGeometry(this);
        if(!geom.isValid()) return null;

        if(geom instanceof Polygonal)
        {
            return JTSConst.toLatLon(geom.getInteriorPoint());
        }
        else if(geom instanceof Lineal)
        {
            LengthIndexedLine lil = new LengthIndexedLine(geom);
            return JTSConst.toLatLon(lil.extractPoint(geom.getLength() / 2.0));
        }
    }
    catch (Exception e)
    {
        // unable to create proper geometry...
        return null;
    }
    return null;
}
项目:Earth    文件:LinearIterator.java   
/**
 * Creates an iterator starting at
 * a specified component and vertex in a linear {@link Geometry}
 *
 * @param linearGeom the linear geometry to iterate over
 * @param componentIndex the component to start at
 * @param vertexIndex the vertex to start at
 * @throws IllegalArgumentException if linearGeom is not lineal
 */
public LinearIterator(Geometry linearGeom, int componentIndex, int vertexIndex) {
    if (!(linearGeom instanceof Lineal)) {
        throw new IllegalArgumentException("Lineal geometry is required");
    }
    this.linearGeom = linearGeom;
    this.numLines = linearGeom.getNumGeometries();
    this.componentIndex = componentIndex;
    this.vertexIndex = vertexIndex;
    this.loadCurrentLine();
}
项目:gama    文件:AWTDisplayGraphics.java   
@Override
public Rectangle2D drawShape(final Geometry geometry, final ShapeDrawingAttributes attributes) {
    if (geometry == null) { return null; }
    if (geometry instanceof GeometryCollection) {
        final Rectangle2D result = new Rectangle2D.Double();
        GeometryUtils.applyToInnerGeometries(geometry, (g) -> result.add(drawShape(g, attributes)));
        return result;
    }
    final boolean isLine = geometry instanceof Lineal || geometry instanceof Puntal;

    GamaColor border = isLine ? attributes.getColor() : attributes.getBorder();
    if (border == null && attributes.isEmpty()) {
        border = attributes.getColor();
    }
    if (highlight) {
        attributes.setColor(GamaColor.getInt(data.getHighlightColor().getRGB()));
        if (border != null)
            border = attributes.getColor();
    }
    final Shape s = sw.toShape(geometry);
    try {
        final Rectangle2D r = s.getBounds2D();
        currentRenderer.setColor(attributes.getColor());
        if (!isLine && !attributes.isEmpty()) {
            currentRenderer.fill(s);
        }
        if (isLine || border != null || attributes.isEmpty()) {
            if (border != null) {
                currentRenderer.setColor(border);
            }
            currentRenderer.draw(s);
        }
        return r;
    } catch (final Exception e) {
        e.printStackTrace();
        return null;
    }
}
项目:jts    文件:PreparedGeometryFactory.java   
/**
 * Creates a new {@link PreparedGeometry} appropriate for the argument {@link Geometry}.
 *
 * @param geom the geometry to prepare
 * @return the prepared geometry
 */
public PreparedGeometry create(Geometry geom) {
    if (geom instanceof Polygonal)
        return new PreparedPolygon((Polygonal) geom);
    if (geom instanceof Lineal)
        return new PreparedLineString((Lineal) geom);
    if (geom instanceof Puntal)
        return new PreparedPoint((Puntal) geom);

    /**
     * Default representation.
     */
    return new BasicPreparedGeometry(geom);
}
项目:snap-desktop    文件:SimpleFeatureShapeFigure.java   
static Rank getRank(Geometry geometry) {
    if (geometry instanceof Puntal) {
        return Rank.POINT;
    } else if (geometry instanceof Lineal) {
        return Rank.LINE;
    } else if (geometry instanceof Polygonal) {
        return Rank.AREA;
    } else {
        return Rank.NOT_SPECIFIED;
    }
}
项目:Earth    文件:PreparedLineString.java   
public PreparedLineString(Lineal line) {
    super((Geometry) line);
}
项目:jts    文件:PreparedLineString.java   
public PreparedLineString(Lineal line) {
    super((Geometry) line);
}
项目:jeql    文件:GeomFunction.java   
public static boolean isLineal(Geometry geom) { return geom instanceof Lineal; }