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

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


        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

      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

  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

    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

  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

      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),
                      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

  // -------------------------------------------------------------------------

  @Test
  public void testLineStringZeroIndex() {
    RemoveCoordinateOperation op = new RemoveCoordinateOperation(0);
    LineString result = (LineString) op.execute(lineString);
    Assert.assertEquals(20.0, result.getCoordinateN(0).getX(), DELTA);
    Assert.assertEquals(20.0, result.getCoordinateN(1).getX(), DELTA);
    Assert.assertEquals(lineString.getNumPoints(), result.getNumPoints() + 1);
  }
View Full Code Here

  }

  @Test
  public void testLineStringBigIndex() {
    RemoveCoordinateOperation op = new RemoveCoordinateOperation(lineString.getNumPoints());
    LineString result = (LineString) op.execute(lineString);
    Assert.assertEquals(10.0, result.getCoordinateN(0).getX(), DELTA);
    Assert.assertEquals(20.0, result.getCoordinateN(result.getNumPoints() - 1).getX(), DELTA);
    Assert.assertEquals(lineString.getNumPoints(), result.getNumPoints() + 1);
  }
View Full Code Here

  }

  @Test
  public void testLineStringMiddleIndex() {
    RemoveCoordinateOperation op = new RemoveCoordinateOperation(1);
    LineString result = (LineString) op.execute(lineString);
    Assert.assertEquals(10.0, result.getCoordinateN(0).getX(), DELTA);
    Assert.assertEquals(20.0, result.getCoordinateN(1).getX(), DELTA);
    Assert.assertEquals(lineString.getNumPoints(), result.getNumPoints() + 1, DELTA);
  }
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.