MultiPolygonEditController.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:geomajas-project-client-gwt 作者:
protected void updateTempLines(FeatureTransaction featureTransaction, MouseEvent<?> event) {
    if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0) {
        if (tempLine1 == null) {
            createTempLines(featureTransaction, event);
        }
        MultiPolygon multiPolygon = (MultiPolygon) getGeometryIndex().getGeometry(featureTransaction);
        LinearRing ring = getGeometryIndex().getLinearRing(multiPolygon.getGeometryN(0));
        if (ring != null) {
            Coordinate[] coordinates = ring.getCoordinates();
            if (coordinates != null && coordinates.length > 0) {
                Coordinate lastCoordinate = coordinates[coordinates.length - 2];
                LineString lineString1 = featureTransaction.getNewFeatures()[index.getFeatureIndex()].getGeometry()
                        .getGeometryFactory().createLineString(
                                new Coordinate[] {getTransformer().worldToPan(lastCoordinate),
                                        getPanPosition(event)});
                tempLine1.setGeometry(lineString1);
                mapWidget.render(tempLine1, RenderGroup.VECTOR, RenderStatus.ALL);

                LineString lineString2 = featureTransaction.getNewFeatures()[index.getFeatureIndex()].getGeometry()
                        .getGeometryFactory().createLineString(
                                new Coordinate[] {getTransformer().worldToPan(coordinates[0]),
                                        getPanPosition(event)});
                tempLine2.setGeometry(lineString2);
                mapWidget.render(tempLine2, RenderGroup.VECTOR, RenderStatus.ALL);
            }
        }
    }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号