本文整理了Java中org.geomajas.geometry.Geometry.getCoordinates()
方法的一些代码示例,展示了Geometry.getCoordinates()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Geometry.getCoordinates()
方法的具体详情如下:
包路径:org.geomajas.geometry.Geometry
类名称:Geometry
方法名:getCoordinates
暂无
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
private Coordinate[] removeLastCoordinate(Geometry ring) {
if (ring.getCoordinates() == null) {
return new Coordinate[0];
}
Coordinate[] coordinates = ring.getCoordinates();
Coordinate[] pathCoords = new Coordinate[coordinates.length - 1];
System.arraycopy(coordinates, 0, pathCoords, 0, coordinates.length - 1);
return pathCoords;
}
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
private Coordinate[] removeLastCoordinate(Geometry ring) {
Coordinate[] coordinates = ring.getCoordinates();
Coordinate[] pathCoords = new Coordinate[coordinates.length - 1];
System.arraycopy(coordinates, 0, pathCoords, 0, coordinates.length - 1);
return pathCoords;
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
private void setLineString(Geometry lineString) {
if (lineString.getCoordinates() != null && lineString.getCoordinates().length > 0) {
setCoordinates(clone(lineString.getCoordinates()));
}
}
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
private void setLineString(Geometry lineString) {
if (lineString.getCoordinates() != null && lineString.getCoordinates().length > 0) {
setCoordinates(clone(lineString.getCoordinates()));
}
}
代码示例来源:origin: org.geomajas.project/geomajas-project-geometry-jts
private static com.vividsolutions.jts.geom.Coordinate[] convertCoordinates(Geometry geometry) {
com.vividsolutions.jts.geom.Coordinate[] coordinates = new com.vividsolutions.jts.geom.Coordinate[geometry
.getCoordinates().length];
for (int i = 0; i < coordinates.length; i++) {
coordinates[i] = new com.vividsolutions.jts.geom.Coordinate(geometry.getCoordinates()[i].getX(),
geometry.getCoordinates()[i].getY());
}
return coordinates;
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
private Circle toShapePoint(Geometry point) {
if (point.getCoordinates() != null && point.getCoordinates().length == 1) {
Coordinate first = point.getCoordinates()[0];
Circle circle = new Circle(first.getX(), first.getY(), 5);
circle.setFixedSize(true);
return circle;
}
return null;
}
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
private Circle toShapePoint(Geometry point) {
if (point.getCoordinates() != null && point.getCoordinates().length == 1) {
Coordinate first = point.getCoordinates()[0];
Circle circle = new Circle(first.getX(), first.getY(), 5);
circle.setFixedSize(true);
return circle;
}
return null;
}
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
private void setLinearRing(Geometry linearRing) {
Coordinate[] coordinates = linearRing.getCoordinates();
if (coordinates != null && coordinates.length > 1) {
Coordinate[] pathCoords = removeLastCoordinate(linearRing);
this.closed = true;
setCoordinates(pathCoords);
}
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
private void setLinearRing(Geometry linearRing) {
Coordinate[] coordinates = linearRing.getCoordinates();
if (coordinates != null && coordinates.length > 1) {
Coordinate[] pathCoords = removeLastCoordinate(linearRing);
setClosed(true);
setCoordinates(pathCoords);
}
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
private Geometry screenToWorld(Geometry geometry) {
if (geometry != null) {
Geometry result = new Geometry(geometry.getGeometryType(), geometry.getSrid(), geometry.getPrecision());
if (geometry.getGeometries() != null) {
Geometry[] transformed = new Geometry[geometry.getGeometries().length];
for (int i = 0; i < geometry.getGeometries().length; i++) {
transformed[i] = screenToWorld(geometry.getGeometries()[i]);
}
result.setGeometries(transformed);
}
if (geometry.getCoordinates() != null) {
Coordinate[] transformed = new Coordinate[geometry.getCoordinates().length];
for (int i = 0; i < geometry.getCoordinates().length; i++) {
transformed[i] = screenToWorld(geometry.getCoordinates()[i]);
}
result.setCoordinates(transformed);
}
return result;
}
throw new IllegalArgumentException("Cannot transform null geometry.");
}
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
private Geometry worldToScreen(Geometry geometry) {
if (geometry != null) {
Geometry result = new Geometry(geometry.getGeometryType(), geometry.getSrid(), geometry.getPrecision());
if (geometry.getGeometries() != null) {
Geometry[] transformed = new Geometry[geometry.getGeometries().length];
for (int i = 0; i < geometry.getGeometries().length; i++) {
transformed[i] = worldToScreen(geometry.getGeometries()[i]);
}
result.setGeometries(transformed);
}
if (geometry.getCoordinates() != null) {
Coordinate[] transformed = new Coordinate[geometry.getCoordinates().length];
for (int i = 0; i < geometry.getCoordinates().length; i++) {
transformed[i] = worldToScreen(geometry.getCoordinates()[i]);
}
result.setCoordinates(transformed);
}
return result;
}
throw new IllegalArgumentException("Cannot transform null geometry.");
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
private Geometry worldToScreen(Geometry geometry) {
if (geometry != null) {
Geometry result = new Geometry(geometry.getGeometryType(), geometry.getSrid(), geometry.getPrecision());
if (geometry.getGeometries() != null) {
Geometry[] transformed = new Geometry[geometry.getGeometries().length];
for (int i = 0; i < geometry.getGeometries().length; i++) {
transformed[i] = worldToScreen(geometry.getGeometries()[i]);
}
result.setGeometries(transformed);
}
if (geometry.getCoordinates() != null) {
Coordinate[] transformed = new Coordinate[geometry.getCoordinates().length];
for (int i = 0; i < geometry.getCoordinates().length; i++) {
transformed[i] = worldToScreen(geometry.getCoordinates()[i]);
}
result.setCoordinates(transformed);
}
return result;
}
throw new IllegalArgumentException("Cannot transform null geometry.");
}
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
private Geometry screenToWorld(Geometry geometry) {
if (geometry != null) {
Geometry result = new Geometry(geometry.getGeometryType(), geometry.getSrid(), geometry.getPrecision());
if (geometry.getGeometries() != null) {
Geometry[] transformed = new Geometry[geometry.getGeometries().length];
for (int i = 0; i < geometry.getGeometries().length; i++) {
transformed[i] = screenToWorld(geometry.getGeometries()[i]);
}
result.setGeometries(transformed);
}
if (geometry.getCoordinates() != null) {
Coordinate[] transformed = new Coordinate[geometry.getCoordinates().length];
for (int i = 0; i < geometry.getCoordinates().length; i++) {
transformed[i] = screenToWorld(geometry.getCoordinates()[i]);
}
result.setCoordinates(transformed);
}
return result;
}
throw new IllegalArgumentException("Cannot transform null geometry.");
}
代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-editing-puregwt
private void drawLineString(GeometryIndex parentIndex) throws GeometryIndexNotFoundException {
Geometry geometry = editService.getGeometry();
if (parentIndex != null) {
geometry = editService.getIndexService().getGeometry(editService.getGeometry(), parentIndex);
}
if (geometry.getCoordinates() != null) {
// Draw all edges:
for (int i = 0; i < geometry.getCoordinates().length - 1; i++) {
GeometryIndex index = editService.getIndexService().addChildren(parentIndex,
GeometryIndexType.TYPE_EDGE, i);
drawIndex(index);
}
// Then draw all vertices:
for (int i = 0; i < geometry.getCoordinates().length; i++) {
GeometryIndex index = editService.getIndexService().addChildren(parentIndex,
GeometryIndexType.TYPE_VERTEX, i);
drawIndex(index);
}
}
}
代码示例来源:origin: org.geomajas.plugin/geomajas-plugin-editing-puregwt
if (geometry.getCoordinates() != null) {
int max = geometry.getCoordinates().length - 1;
if (editService.getEditingState().equals(GeometryEditState.INSERTING)) {
max--;
Bbox bounds = mapPresenter.getViewPort().getBounds();
int j = 0;
for (int i = 0; i < geometry.getCoordinates().length; i++) {
if (contains(bounds, geometry.getCoordinates()[i])) {
indices[j++] = i;
if (j == 50) {
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
private void setMultiLineString(Geometry multiLineString) {
if (multiLineString.getGeometries() != null && multiLineString.getGeometries().length > 0) {
setLineString(multiLineString.getGeometries()[0]);
for (int i = 1; i < multiLineString.getGeometries().length; i++) {
Geometry lineString = multiLineString.getGeometries()[i];
addSubPath(clone(lineString.getCoordinates()), false);
}
}
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
private void setMultiLineString(Geometry multiLineString) {
if (multiLineString.getGeometries() != null && multiLineString.getGeometries().length > 0) {
setLineString(multiLineString.getGeometries()[0]);
for (int i = 1; i < multiLineString.getGeometries().length; i++) {
Geometry lineString = multiLineString.getGeometries()[i];
addSubPath(clone(lineString.getCoordinates()), false);
}
}
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-example-jar
private void transformInplace(Geometry geometry, Matrix matrix) {
if (geometry.getGeometries() != null) {
for (Geometry g : geometry.getGeometries()) {
transformInplace(g, matrix);
}
} else if (geometry.getCoordinates() != null) {
for (Coordinate c : geometry.getCoordinates()) {
double x = c.getX() * matrix.getXx() + c.getY() * matrix.getXy() + matrix.getDx();
double y = c.getX() * matrix.getYx() + c.getY() * matrix.getYy() + matrix.getDy();
c.setX(x);
c.setY(y);
}
}
}
代码示例来源:origin: org.geomajas/geomajas-client-gwt2-impl
@Override
public void paint(Canvas canvas, Matrix matrix) {
if (Geometry.POLYGON.equals(geometry.getGeometryType())) {
canvas.getContext2d().save();
canvas.getContext2d().setFillStyle(fillStyle);
canvas.getContext2d().setStrokeStyle(strokeStyle);
canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx());
canvas.getContext2d().beginPath();
for (Geometry ring : geometry.getGeometries()) {
Coordinate[] coords = ring.getCoordinates();
canvas.getContext2d().moveTo(coords[0].getX(), coords[0].getY());
for (int i = 1; i < coords.length - 1; i++) {
canvas.getContext2d().lineTo(coords[i].getX(), coords[i].getY());
}
}
canvas.getContext2d().closePath();
canvas.getContext2d().fill();
canvas.getContext2d().stroke();
canvas.getContext2d().restore();
}
}
代码示例来源:origin: org.geomajas/geomajas-gwt-client-impl
@Override
public void paint(Canvas canvas, Matrix matrix) {
if (Geometry.POLYGON.equals(geometry.getGeometryType())) {
canvas.getContext2d().save();
canvas.getContext2d().setFillStyle(fillStyle);
canvas.getContext2d().setStrokeStyle(strokeStyle);
canvas.getContext2d().setLineWidth(strokeWidthPixels / matrix.getXx());
canvas.getContext2d().beginPath();
for (Geometry ring : geometry.getGeometries()) {
Coordinate[] coords = ring.getCoordinates();
canvas.getContext2d().moveTo(coords[0].getX(), coords[0].getY());
for (int i = 1; i < coords.length - 1; i++) {
canvas.getContext2d().lineTo(coords[i].getX(), coords[i].getY());
}
}
canvas.getContext2d().closePath();
canvas.getContext2d().fill();
canvas.getContext2d().stroke();
canvas.getContext2d().restore();
}
}
内容来源于网络,如有侵权,请联系作者删除!