Package org.geomajas.geometry

Examples of org.geomajas.geometry.Coordinate


   * @return Returns a coordinate holding the event's X and Y ordinate, where the origin is the upper left corner of
   *         the DOM element catching the event. If used in a {@link GraphicsController}, these are screen
   *         coordinates.
   */
  public static Coordinate getPosition(MouseEvent<?> event) {
    return new Coordinate(event.getX(), event.getY());
  }
View Full Code Here


   * @return Returns a coordinate holding the event's X and Y ordinate, where the origin is the upper left corner of
   *         the DOM element catching the event. If used in a {@link GraphicsController}, these are screen
   *         coordinates.
   */
  public static Coordinate getPosition(MouseEvent<?> event, int offsetX, int offsetY) {
    return new Coordinate(event.getX() + offsetX, event.getY() + offsetY);
  }
View Full Code Here

  /**
   * Return the world position of the mouse event, unless snapping is activated. If that is the case, a snapped point
   * will be returned (still in world space).
   */
  protected Coordinate getWorldPosition(MouseEvent<?> event) {
    Coordinate world = super.getWorldPosition(event);
    if (snappingActive) {
      return snapper.snap(world);
    }
    return world;
  }
View Full Code Here

  /**
   * On mouse up, execute the search by location, and display a
   * {@link org.geomajas.gwt.client.widget.FeatureAttributeWindow} if a result is found.
   */
  public void onMouseUp(MouseUpEvent event) {
    Coordinate worldPosition = getWorldPosition(event);
    Point point = mapWidget.getMapModel().getGeometryFactory().createPoint(worldPosition);

    SearchByLocationRequest request = new SearchByLocationRequest();
    request.setLocation(GeometryConverter.toDto(point));
    request.setCrs(mapWidget.getMapModel().getCrs());
View Full Code Here

    return layerIds.toArray(new String[] {});
  }

  private double calculateBufferFromPixelTolerance() {
    WorldViewTransformer transformer = mapWidget.getMapModel().getMapView().getWorldViewTransformer();
    Coordinate c1 = transformer.viewToWorld(new Coordinate(0, 0));
    Coordinate c2 = transformer.viewToWorld(new Coordinate(pixelTolerance, 0));
    return Mathlib.distance(c1, c2);
  }
View Full Code Here

  /**
   * Return the origin (x, y) as a Coordinate.
   */
  public Coordinate getOrigin() {
    return new Coordinate(x, y);
  }
View Full Code Here

   * Get the center of the bounding box as a Coordinate.
   */
  public Coordinate getCenterPoint() {
    double centerX = (width == 0 ? x : x + width / 2);
    double centerY = (height == 0 ? y : y + height / 2);
    return new Coordinate(centerX, centerY);
  }
View Full Code Here

  /**
   * Get the end-point of the bounding box as a Coordinate.
   */
  public Coordinate getEndPoint() {
    return new Coordinate(x + width, y + height);
  }
View Full Code Here

   *         <code>LinearRing</code>.
   */
  public Coordinate[] getCoordinates() {
    Coordinate[] result = new Coordinate[5];

    result[0] = new Coordinate(x, y);
    result[1] = new Coordinate(x + width, y);
    result[2] = new Coordinate(x + width, y + height);
    result[3] = new Coordinate(x, y + height);
    result[4] = new Coordinate(x, y);
    return result;
  }
View Full Code Here

   */
  public Bbox scale(double factor) {
    if (factor > 0) {
      double scaledWidth = width * factor;
      double scaledHeight = height * factor;
      Coordinate center = getCenterPoint();
      return new Bbox(center.getX() - scaledWidth / 2, center.getY() - scaledHeight / 2, scaledWidth,
          scaledHeight);
    } else {
      return new Bbox(this);
    }
  }
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.