Package net.sf.myway.base.db

Examples of net.sf.myway.base.db.Position


  /**
   * @see org.eclipse.gef.commands.Command#execute()
   */
  @Override
  public void execute() {
    final Position position = _coordSys.toPosition(_location);
    MapNode n = EditPlugin.getBL().findNode(position);
    if (n == null) {
      n = _node;
      n.setPosition(position);
    }
View Full Code Here


  public Position toPosition(final Point location) {
    final Vector2d p = new Vector2d(_origin.getLongitude().getVal(), _origin.getLatitude()
      .getVal());
    p.add(_dx.mul(location.x));
    p.add(_dy.mul(location.y));
    return new Position(p.getY(), p.getX());
  }
View Full Code Here

    final double dlat = north - south;
    final double dlon = east - west;
    final double latCenter = south + dlat / 2;
    final double lonCenter = west + dlon / 2;

    final Position center = new Position(latCenter, lonCenter);
    final Position nCenter = new Position(north, lonCenter);
    final Position eCenter = new Position(latCenter, east);

    final double latDist = center.distance(nCenter);
    final double lonDist = center.distance(eCenter);

    final int width = m.getUpperleft().distance(m.getUpperright());
    final int height = m.getUpperleft().distance(m.getLowerleft());

    final int w = width;
    final int h = (int) Math.min(2000, height * latDist / lonDist);

    final Vector2d p0 = new Vector2d(m.getUpperleft().getX(), m.getUpperleft().getY());
    final Vector2d vx = new Vector2d(m.getUpperright().getX(), m.getUpperright().getY()).minus(
      p0).div(w);
    final Vector2d vy = new Vector2d(m.getLowerleft().getX(), m.getLowerleft().getY())
      .minus(p0).div(h);

    _coordinateSystem = new CoordinateSystem();
    _coordinateSystem.setOrigin(new Position(m.getNorth(), m.getWest()));
    _coordinateSystem.setDx(new Vector2d(m.getEast().diff(m.getWest()) / w, 0));
    _coordinateSystem.setDy(new Vector2d(0, m.getSouth().diff(m.getNorth()) / h));

    ImageData id = (ImageData) imageData.clone();
    id = id.scaledTo(w, h);
View Full Code Here

   * @see org.eclipse.gef.commands.Command#execute()
   */
  @Override
  public void execute() {
    final CoordinateSystem cs = _target.getCoordinateSystem();
    final Position position = cs.toPosition(_location);
    MapNode n = EditPlugin.getBL().findNode(position);
    if (n == null) {
      n = new MapNode();
      n.setPosition(position);
    }
View Full Code Here

    if (_relative) {
      final Point point = cs.toPoint(center.getPosition());
      pos.x += point.x;
      pos.y += point.y;
    }
    final Position position = cs.toPosition(pos);
    MapNode n = getBL().findNode(position);
    if (getBL().hasSingleReference(center)) {
      // there is only one reference to the current center node
      if (n == null)
        // at the move destination there is no node, so we can move it
View Full Code Here

   * @param latitude
   *            the latitude to set
   */
  public void setLatitude(final Angle latitude) {
    if (_position == null)
      _position = new Position();
    _position.setLatitude(latitude);
  }
View Full Code Here

   * @param longitude
   *            the longitude to set
   */
  public void setLongitude(final Angle longitude) {
    if (_position == null)
      _position = new Position();
    _position.setLongitude(longitude);
  }
View Full Code Here

          final Object data = sel[0].getData();
          if (data instanceof MapObjectType) {
            final MapObjectType type = (MapObjectType) data;
            System.out.println("create " + type.name()); //$NON-NLS-1$
            final MapObject obj = new MapObject();
            final Position p = new Position();
            // p.setLatitude(new Angle(_centerLatitude.getVal()));
            // p.setLongitude(new Angle(_centerLongitude.getVal()));
            // obj.setCenter(p);
            // BoundingBox b = new BoundingBox();
            // b.setNorth(new Angle(_centerLatitude.getVal()));
View Full Code Here

TOP

Related Classes of net.sf.myway.base.db.Position

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.