Package org.geomajas.gwt.client.spatial.geometry

Examples of org.geomajas.gwt.client.spatial.geometry.LinearRing


      if (oldCoords != null) {
        System.arraycopy(oldCoords, 0, newCoords, 0, length);
      }

      LinearRing linearRing;

      if (newCoords.length < 2) {
        newCoords[length] = getWorldPosition(event);
      } else {
        newCoords[length] = newCoords[length - 1];
View Full Code Here


    Polygon polygon = (Polygon) geometry;

    if (polygon != null && polygon.getCoordinates() != null && polygon.getCoordinates().length > 0) {

      LinearRing ring = geometry.getGeometryFactory().createLinearRing(polygon.getCoordinates());
      if (ring != null && geometry.getCoordinates().length > 0) {

        Coordinate[] coordinates = ring.getCoordinates();
        Coordinate firstCoordinate = coordinates[0];
        Coordinate lastCoordinate = coordinates[coordinates.length - 2];

        LineString lineString1 = geometry.getGeometryFactory().createLineString(
            new Coordinate[] { getTransformer().worldToPan(lastCoordinate), getPanPosition(event) });
View Full Code Here

    button3.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group2);
        GeometryFactory factory = map.getMapModel().getGeometryFactory();
        LinearRing shell = factory.createLinearRing(new Coordinate[] { new Coordinate(110, 10),
            new Coordinate(210, 10), new Coordinate(210, 110), new Coordinate(110, 110),
            new Coordinate(110, 10) });
        LinearRing hole = factory.createLinearRing(new Coordinate[] { new Coordinate(140, 40),
            new Coordinate(170, 40), new Coordinate(170, 70), new Coordinate(140, 70),
            new Coordinate(140, 40) });
        Polygon polygon = factory.createPolygon(shell, new LinearRing[] { hole });
        ShapeStyle style = new ShapeStyle("#9933EE", 0.5f, "#9900FF", 1, 2);
        map.getVectorContext().drawPolygon(group2, "Polygon", polygon, style);
View Full Code Here

    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),
View Full Code Here

    if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0) {
      if (tempLine1 == null) {
        createTempLines(featureTransaction, event);
      }
      Polygon polygon = (Polygon) getGeometryIndex().getGeometry(featureTransaction);
      LinearRing ring = getGeometryIndex().getLinearRing(polygon);
      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),
View Full Code Here

  // -------------------------------------------------------------------------
  // Private functions:
  // -------------------------------------------------------------------------

  private Polygon addRing(Polygon polygon) {
    LinearRing interiorRing = polygon.getGeometryFactory().createLinearRing(new Coordinate[] {});
    AddRingOperation op = new AddRingOperation(interiorRing);
    index.setInteriorRingIndex(polygon.getNumInteriorRing());
    index.setExteriorRing(false);
    return (Polygon) op.execute(polygon);
  }
View Full Code Here

    } else if (Geometry.LINEAR_RING.equals(geometryType)) {
      gwt = factory.createLinearRing(geometry.getCoordinates());
    } else if (Geometry.LINE_STRING.equals(geometryType)) {
      gwt = factory.createLineString(geometry.getCoordinates());
    } else if (Geometry.POLYGON.equals(geometryType)) {
      LinearRing exteriorRing = (LinearRing) toGwt(geometry.getGeometries()[0]);
      LinearRing[] interiorRings = new LinearRing[geometry.getGeometries().length - 1];
      for (int i = 0; i < interiorRings.length; i++) {
        interiorRings[i] = (LinearRing) toGwt(geometry.getGeometries()[i + 1]);
      }
      gwt = factory.createPolygon(exteriorRing, interiorRings);
View Full Code Here

          coordinates[i] = worldToView(geometry.getCoordinates()[i]);
        }
        return geometry.getGeometryFactory().createLineString(coordinates);
      } else if (geometry instanceof Polygon) {
        Polygon polygon = (Polygon) geometry;
        LinearRing shell = (LinearRing) worldToView(polygon.getExteriorRing());
        LinearRing[] holes = new LinearRing[polygon.getNumInteriorRing()];
        for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
          holes[n] = (LinearRing) worldToView(polygon.getInteriorRingN(n));
        }
        return polygon.getGeometryFactory().createPolygon(shell, holes);
View Full Code Here

          coordinates[i] = worldToPan(geometry.getCoordinates()[i]);
        }
        return geometry.getGeometryFactory().createLineString(coordinates);
      } else if (geometry instanceof Polygon) {
        Polygon polygon = (Polygon) geometry;
        LinearRing shell = (LinearRing) worldToPan(polygon.getExteriorRing());
        LinearRing[] holes = new LinearRing[polygon.getNumInteriorRing()];
        for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
          holes[n] = (LinearRing) worldToPan(polygon.getInteriorRingN(n));
        }
        return polygon.getGeometryFactory().createPolygon(shell, holes);
View Full Code Here

          coordinates[i] = viewToPan(geometry.getCoordinates()[i]);
        }
        return geometry.getGeometryFactory().createLineString(coordinates);
      } else if (geometry instanceof Polygon) {
        Polygon polygon = (Polygon) geometry;
        LinearRing shell = (LinearRing) worldToPan(polygon.getExteriorRing());
        LinearRing[] holes = new LinearRing[polygon.getNumInteriorRing()];
        for (int n = 0; n < polygon.getNumInteriorRing(); n++) {
          holes[n] = (LinearRing) viewToPan(polygon.getInteriorRingN(n));
        }
        return polygon.getGeometryFactory().createPolygon(shell, holes);
View Full Code Here

TOP

Related Classes of org.geomajas.gwt.client.spatial.geometry.LinearRing

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.