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

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


        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) });
        tempLine1.setGeometry(lineString1);

        LineString lineString2 = geometry.getGeometryFactory().createLineString(
            new Coordinate[] { getTransformer().worldToPan(firstCoordinate), getPanPosition(event) });
        tempLine2.setGeometry(lineString2);

        mapWidget.render(tempLine1, RenderGroup.VECTOR, RenderStatus.ALL);
        mapWidget.render(tempLine2, RenderGroup.VECTOR, RenderStatus.ALL);
View Full Code Here


    IButton button2 = new IButton(I18nProvider.getSampleMessages().renderingDrawLineString());
    button2.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        map.getVectorContext().drawGroup(map.getGroup(RenderGroup.SCREEN), group2);
        LineString geometry = map.getMapModel().getGeometryFactory().createLineString(
            new Coordinate[] { new Coordinate(60, 20), new Coordinate(120, 80), new Coordinate(80, 100) });
        ShapeStyle style = new ShapeStyle("#994488", 0.0f, "#993388", 1, 2);
        map.getVectorContext().drawLine(group2, "LineString", geometry, style);
      }
    });
View Full Code Here

    Coordinate[] worldCoords = geometry.getCoordinates();
    for (int i = 0; i < srCoords.length; i++) {
      srCoords[i] = getTransformer().worldToPan(worldCoords[i]);
    }

    LineString lineString = geometry.getGeometryFactory().createLineString(srCoords);
    tempLine.setGeometry(lineString);
  }
View Full Code Here

    if (oldCoords != null && oldCoords.length > 0) {
      Coordinate[] newCoords = new Coordinate[oldCoords.length + 1];
      System.arraycopy(oldCoords, 0, newCoords, 0, oldCoords.length);
      newCoords[oldCoords.length] = getPanPosition(event);

      LineString lineString = geometry.getGeometryFactory().createLineString(newCoords);
      tempLineEnd.setGeometry(lineString);
      mapWidget.render(tempLineEnd, RenderGroup.VECTOR, RenderStatus.UPDATE);
    }
  }
View Full Code Here

              Coordinate[] coordinates = new Coordinate[4];
              coordinates[0] = new Coordinate(10, y);
              coordinates[1] = new Coordinate(10 + 10, y + 5);
              coordinates[2] = new Coordinate(10 + 5, y + 10);
              coordinates[3] = new Coordinate(10 + 15, y + 15);
              LineString line = mapModel.getGeometryFactory().createLineString(coordinates);
              graphics.drawLine(parentGroup, "style" + lineCount, line, style);
            } else if (vLayer.getLayerInfo().getLayerType() == LayerType.POLYGON
                || vLayer.getLayerInfo().getLayerType() == LayerType.MULTIPOLYGON) {
              // Polygons: draw a rectangle:
              Bbox rect = new Bbox(10, y, 16, 16);
View Full Code Here

    graphics.drawLine(parent, name + ".area", lineString, lineStringStyle);

    // Draw individual edges:
    Coordinate[] coordinates = lineString.getCoordinates();
    for (int i = 1; i < coordinates.length; i++) {
      LineString edge = lineString.getGeometryFactory().createLineString(
          new Coordinate[] { coordinates[i - 1], coordinates[i] });
      graphics.drawLine(parent, name + ".edge" + i, edge, edgeStyle);
    }

    // Draw individual vertices:
View Full Code Here

    graphics.drawLine(parent, name + ".area", linearRing, linearRingStyle);

    // Draw individual edges:
    Coordinate[] coordinates = linearRing.getCoordinates();
    for (int i = 1; i < coordinates.length; i++) {
      LineString edge = linearRing.getGeometryFactory().createLineString(
          new Coordinate[] { coordinates[i - 1], coordinates[i] });
      graphics.drawLine(parent, name + ".edge" + i, edge, edgeStyle);
    }

    // Draw individual vertices:
View Full Code Here

   * @param geometry
   *            The geometry to search in.
   * @return Returns the coordinate or null.
   */
  public Coordinate getCoordinate(Geometry geometry) {
    LineString lineString = getLineString(geometry);
    if (lineString != null && coordinateIndex >= 0) {
      return lineString.getCoordinateN(coordinateIndex);
    }
    return null;
  }
View Full Code Here

   *            A geometry that fits this index object.
   * @return Return an array of maximum 2 other indices, pointing to the 2 neighboring coordinates and edges. Can
   *         return null if no valid info is found (if no coordinate index is found).
   */
  public TransactionGeomIndex[] getNeighbors(Geometry geometry) {
    LineString lineString = getLineString(geometry);
    if (lineString != null && lineString.isClosed()) {
      // LinearRing geometry: goes round and round
      if (coordinateIndex >= 0) {
        int c1 = coordinateIndex - 1;
        int c2 = coordinateIndex + 1;
        if (c1 < 0) {
          c1 = lineString.getNumPoints() - 2;
        }
        int e1 = coordinateIndex;
        int e2 = coordinateIndex + 1;
        if (e2 > lineString.getNumPoints() - 1) {
          e2 = 1;
        }
        if (e1 == 0) {
          e1 = lineString.getNumPoints() - 1;
        }
        TransactionGeomIndex i1 = new TransactionGeomIndex(this);
        i1.setCoordinateIndex(c1);
        i1.setEdgeIndex(e1);
        TransactionGeomIndex i2 = new TransactionGeomIndex(this);
View Full Code Here

   * @param geometry
   *            A geometry that fits this index.
   * @return Returns true or false.
   */
  public boolean isNeighbor(String identifier, Geometry geometry) {
    LineString lineString = getLineString(geometry);
    if (lineString != null) {
      int index = TransactionGeomIndexUtil.getIndex(identifier).getCoordinateIndex();
      if (index >= 0 && coordinateIndex >= 0) {
        if (coordinateIndex == 0) {
          if (index == 1) {
            return true;
          }
          if (lineString.isClosed() && index == lineString.getNumPoints() - 2) {
            return true;
          }
        } else if (coordinateIndex == lineString.getNumPoints() - 2) {
          if (index == coordinateIndex - 1) {
            return true;
          } else if (lineString.isClosed() && index == 0) {
            return true;
          }
        } else {
          if (index == coordinateIndex - 1 || index == coordinateIndex + 1) {
            return true;
View Full Code Here

TOP

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

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.