java类com.vividsolutions.jts.geom.Lineal的实例源码

PreparedGeometryFactory.java 文件源码 项目:Earth 阅读 23 收藏 0 点赞 0 评论 0
/**
 * 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);
}
ElementGeometry.java 文件源码 项目:StreetComplete 阅读 25 收藏 0 点赞 0 评论 0
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;
}
LinearIterator.java 文件源码 项目:Earth 阅读 27 收藏 0 点赞 0 评论 0
/**
 * 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();
}
AWTDisplayGraphics.java 文件源码 项目:gama 阅读 22 收藏 0 点赞 0 评论 0
@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;
    }
}
PreparedGeometryFactory.java 文件源码 项目:jts 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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);
}
SimpleFeatureShapeFigure.java 文件源码 项目:snap-desktop 阅读 27 收藏 0 点赞 0 评论 0
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;
    }
}
PreparedLineString.java 文件源码 项目:Earth 阅读 21 收藏 0 点赞 0 评论 0
public PreparedLineString(Lineal line) {
    super((Geometry) line);
}
PreparedLineString.java 文件源码 项目:jts 阅读 20 收藏 0 点赞 0 评论 0
public PreparedLineString(Lineal line) {
    super((Geometry) line);
}
GeomFunction.java 文件源码 项目:jeql 阅读 23 收藏 0 点赞 0 评论 0
public static boolean isLineal(Geometry geom) { return geom instanceof Lineal; }


问题


面经


文章

微信
公众号

扫码关注公众号