Examples of LineString


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

    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

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

   * @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

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

   *            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

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

   * @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

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

  private void createTempLine(FeatureTransaction featureTransaction, MouseEvent<?> event) {
    if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0
        && tempLine == null) {
      Coordinate position = getPanPosition(event);
      LineString lineString = getGeometryIndex().getGeometry(featureTransaction).getGeometryFactory()
          .createLineString(new Coordinate[] { position, position });
      tempLine = new GfxGeometry("LineStringEditController.updateLine");
      tempLine.setGeometry(lineString);
      tempLine.setStyle(new ShapeStyle("#FFFFFF", 0, "#FF3322", 1, 1));
      mapWidget.render(tempLine, RenderGroup.VECTOR, RenderStatus.ALL);
View Full Code Here

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

        createTempLine(featureTransaction, event);
      }
      Coordinate[] coordinates = getGeometryIndex().getGeometry(featureTransaction).getCoordinates();
      if (coordinates != null && coordinates.length > 0) {
        Coordinate lastCoordinate = getTransformer().worldToPan(coordinates[coordinates.length - 1]);
        LineString lineString = featureTransaction.getNewFeatures()[0].getGeometry().getGeometryFactory()
            .createLineString(new Coordinate[] { lastCoordinate, getPanPosition(event) });
        tempLine.setGeometry(lineString);
        mapWidget.render(tempLine, RenderGroup.VECTOR, RenderStatus.ALL);
      }
    }
View Full Code Here

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

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

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

  public void onMouseDown(MouseDownEvent event) {
    if (event.getNativeButton() != NativeEvent.BUTTON_RIGHT) {
      dragging = true;
      center = getScreenPosition(event);

      LineString radiusLine = mapWidget.getMapModel().getGeometryFactory().createLineString(
          new Coordinate[] { center, center });
      mapWidget.getVectorContext().drawGroup(mapWidget.getGroup(RenderGroup.SCREEN), circleGroup);
      mapWidget.getVectorContext().drawCircle(circleGroup, "outer", center, 1.0f, circleStyle);
      mapWidget.getVectorContext().drawCircle(circleGroup, "center", center, 2.0f, circleStyle);
      mapWidget.getVectorContext().drawLine(circleGroup, "radius", radiusLine, circleStyle);
View Full Code Here

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

    Coordinate position = getScreenPosition(event);
    double deltaX = position.getX() - getScreenCenter().getX();
    double deltaY = position.getY() - getScreenCenter().getY();
    radius = Math.sqrt((deltaX * deltaX) + (deltaY * deltaY));

    LineString radiusLine = mapWidget.getMapModel().getGeometryFactory().createLineString(
        new Coordinate[] { center, position });
    mapWidget.getVectorContext().drawCircle(circleGroup, "outer", center, radius, circleStyle);
    mapWidget.getVectorContext().drawLine(circleGroup, "radius", radiusLine, circleStyle);
  }
View Full Code Here

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

  protected void createTempLines(FeatureTransaction featureTransaction, MouseEvent<?> event) {
    if (featureTransaction.getNewFeatures() != null && featureTransaction.getNewFeatures().length > 0
        && tempLine1 == null) {
      Coordinate position = getPanPosition(event);
      Geometry geom = getGeometryIndex().getGeometry(featureTransaction);
      LineString lineString = geom.getGeometryFactory().createLineString(new Coordinate[] { position, position });
      tempLine1 = new GfxGeometry("LineStringEditController.updateLine1");
      tempLine1.setGeometry(lineString);
      tempLine1.setStyle(new ShapeStyle("#FFFFFF", 0, "#FF3322", 1, 1));
      mapWidget.render(tempLine1, RenderGroup.VECTOR, RenderStatus.ALL);
      tempLine2 = new GfxGeometry("LineStringEditController.updateLine2");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.