Package org.geomajas.geometry

Examples of org.geomajas.geometry.Coordinate


      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),
                      getPanPosition(event)});
          tempLine1.setGeometry(lineString1);
View Full Code Here


   * @param t
   *            the transformation matrix
   * @return the transformed bounds
   */
  public Bbox transform(Matrix t) {
    Coordinate c1 = transform(t, new Coordinate(x, y));
    Coordinate c2 = transform(t, new Coordinate(x + width, y + height));
    Coordinate origin = new Coordinate(Math.min(c1.getX(), c2.getX()), Math.min(c1.getY(), c2.getY()));
    Coordinate endPoint = new Coordinate(Math.max(c1.getX(), c2.getX()), Math.max(c1.getY(), c2.getY()));
    return new Bbox(origin.getX(), origin.getY(), endPoint.getX() - origin.getX(), endPoint.getY() - origin.getY());
  }
View Full Code Here

  }

  private Coordinate transform(Matrix t, Coordinate coordinate) {
    double x = t.getXx() * coordinate.getX() + t.getXy() * coordinate.getY() + t.getDx();
    double y = t.getYx() * coordinate.getY() + t.getYy() * coordinate.getY() + t.getDy();
    return new Coordinate(x, y);
  }
View Full Code Here

  @Override
  public void onMouseUp(MouseUpEvent event) {
    MapView mapView = mapWidget.getMapModel().getMapView();
    WorldViewTransformer transformer = mapView.getWorldViewTransformer();
    Coordinate viewPosition = getScreenPosition(event);
    Coordinate worldPosition = transformer.viewToWorld(viewPosition);
    mapView.setCenterPosition(worldPosition);
    mapView.scale(zoomFactor, MapView.ZoomOption.LEVEL_CHANGE);
  }
View Full Code Here

  // Private methods:

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

      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),
                      getPanPosition(event)});
          tempLine1.setGeometry(lineString1);
View Full Code Here

   * Return the middle point of this linesegment.
   */
  public Coordinate getMiddlePoint() {
    double x = this.x1() + 0.5 * (this.x2() - this.x1());
    double y = this.y1() + 0.5 * (this.y2() - this.y1());
    return new Coordinate(x, y);
  }
View Full Code Here

   *
   * @param c
   *            The {@link Coordinate} to check distance from.
   */
  public double distance(Coordinate c) {
    Coordinate nearest = this.nearest(c);
    LineSegment ls = new LineSegment(c, nearest);
    return ls.getLength();
  }
View Full Code Here

    double denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
    double u1 = ((x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3)) / denom;

    double x = x1 + u1 * (x2 - x1);
    double y = y1 + u1 * (y2 - y1);
    return new Coordinate(x, y);
  }
View Full Code Here

    if (u2 <= 0 || u2 >= 1) {
      return null;
    }
    double x = x1 + u1 * (x2 - x1);
    double y = y1 + u1 * (y2 - y1);
    return new Coordinate(x, y);
  }
View Full Code Here

TOP

Related Classes of org.geomajas.geometry.Coordinate

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.