Package org.vaadin.gwtgraphics.client.shape

Examples of org.vaadin.gwtgraphics.client.shape.Path


  }

  public Path toPath(Geometry geometry) {
    if (geometry instanceof Point) {
      Point point = (Point) geometry;
      return new Path((int) point.getX(), (int) point.getY());
    } else if (geometry instanceof LineString) {
      return toPath((LineString) geometry);
    } else if (geometry instanceof LinearRing) {
      return toPath((LinearRing) geometry);
    } else if (geometry instanceof Polygon) {
View Full Code Here


  // ------------------------------------------------------------------------
  // Private methods:
  // ------------------------------------------------------------------------

  private Path toPath(LineString lineString) {
    Path path = new Path((int) lineString.getCoordinate().getX(), (int) lineString.getCoordinate().getY());
    for (int i = 1; i < lineString.getNumPoints(); i++) {
      Coordinate coordinate = lineString.getCoordinateN(i);
      path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
    }
    return path;
  }
View Full Code Here

    }
    return path;
  }

  private Path toPath(LinearRing linearRing) {
    Path path = new Path((int) linearRing.getCoordinate().getX(), (int) linearRing.getCoordinate().getY());
    for (int i = 1; i < linearRing.getNumPoints() - 1; i++) {
      Coordinate coordinate = linearRing.getCoordinateN(i);
      path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
    }
    path.close();
    return path;
  }
View Full Code Here

    path.close();
    return path;
  }

  private Path toPath(Polygon polygon) {
    Path path = toPath(polygon.getExteriorRing());
    for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
      LinearRing interiorRing = polygon.getInteriorRingN(i);
      path.moveTo((int) interiorRing.getCoordinate().getX(), (int) interiorRing.getCoordinate().getY());
      for (int j = 1; j < interiorRing.getNumPoints() - 1; j++) {
        Coordinate coordinate = interiorRing.getCoordinateN(j);
        path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
      }
      path.close();
    }
    return path;
  }
View Full Code Here

    }
    return path;
  }

  private Path toPath(MultiPoint multiPoint) {
    Path path = new Path((int) multiPoint.getCoordinate().getX(), (int) multiPoint.getCoordinate().getY());
    for (int i = 1; i < multiPoint.getNumGeometries(); i++) {
      Point point = (Point) multiPoint.getGeometryN(i);
      path.moveTo((int) point.getX(), (int) point.getY());
    }
    return path;
  }
View Full Code Here

    }
    return path;
  }

  private Path toPath(MultiLineString multiLineString) {
    Path path = toPath((LineString) multiLineString.getGeometryN(0));
    for (int i = 1; i < multiLineString.getNumGeometries(); i++) {
      LineString lineString = (LineString) multiLineString.getGeometryN(i);
      path.moveTo((int) lineString.getCoordinate().getX(), (int) lineString.getCoordinate().getY());
      for (int j = 1; j < lineString.getNumPoints(); j++) {
        Coordinate coordinate = lineString.getCoordinateN(j);
        path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
      }
    }
    return path;
  }
View Full Code Here

    }
    return path;
  }

  private Path toPath(MultiPolygon multiPolygon) {
    Path path = toPath((Polygon) multiPolygon.getGeometryN(0));
    for (int g = 1; g < multiPolygon.getNumGeometries(); g++) {
      Polygon polygon = (Polygon) multiPolygon.getGeometryN(g);

      LinearRing exteriorRing = polygon.getExteriorRing();
      path.moveTo((int) exteriorRing.getCoordinate().getX(), (int) exteriorRing.getCoordinate().getY());
      for (int i = 1; i < exteriorRing.getNumPoints() - 1; i++) {
        Coordinate coordinate = exteriorRing.getCoordinateN(i);
        path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
      }
      path.close();

      for (int i = 0; i < polygon.getNumInteriorRing(); i++) {
        LinearRing interiorRing = polygon.getInteriorRingN(i);
        path.moveTo((int) interiorRing.getCoordinate().getX(), (int) interiorRing.getCoordinate().getY());
        for (int j = 1; j < interiorRing.getNumPoints() - 1; j++) {
          Coordinate coordinate = interiorRing.getCoordinateN(j);
          path.lineTo((int) coordinate.getX(), (int) coordinate.getY());
        }
        path.close();
      }
    }
    return path;
  }
View Full Code Here

    public void onVisibilityMarked(LayerVisibilityMarkedEvent event) {
    }

    private void render(Feature f) {
      Path path = gfxUtil.toPath(f.getGeometry());
      if (f.getGeometry() instanceof Point || f.getGeometry() instanceof MultiPoint) {
        gfxUtil.applyStyle(path, pointStyle);
      } else if (f.getGeometry() instanceof LineString || f.getGeometry() instanceof MultiLineString) {
        gfxUtil.applyStyle(path, lineStyle);
      } else if (f.getGeometry() instanceof Polygon || f.getGeometry() instanceof MultiPolygon
View Full Code Here

    Button pathBtn = new Button("Draw path");
    pathBtn.setWidth("200");
    pathBtn.addClickHandler(new ClickHandler() {

      public void onClick(ClickEvent event) {
        Path path = new Path(120, 160);
        path.setFillColor("#0066AA");
        path.setFillOpacity(0.4);
        path.setStrokeColor("#004499");
        path.lineRelativelyTo(100, 0);
        path.lineRelativelyTo(0, 100);
        path.lineRelativelyTo(-100, 0);
        path.lineRelativelyTo(0, -100);
        path.moveTo(140, 180);
        path.lineRelativelyTo(50, 0);
        path.lineRelativelyTo(0, 50);
        path.lineRelativelyTo(-50, 0);
        path.lineRelativelyTo(0, -50);
        container.add(path);
      }
    });
    leftLayout.add(pathBtn);
View Full Code Here

    public ZoomToRectGroup(final ViewPort viewPort) {
      eventCatcher = new Rectangle(0, 0, viewPort.getMapWidth(), viewPort.getMapHeight());
      eventCatcher.setFillOpacity(0);
      eventCatcher.setStrokeOpacity(0);

      zoomInRect = new Path(0, 0);
      zoomInRect.setFillColor("#000000");
      zoomInRect.setFillOpacity(0.2);
      zoomInRect.setStrokeColor("#000000");
      zoomInRect.setStrokeWidth(1);
      zoomInRect.setStrokeOpacity(1);
View Full Code Here

TOP

Related Classes of org.vaadin.gwtgraphics.client.shape.Path

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.