Package net.sf.myway.map.da.entities

Examples of net.sf.myway.map.da.entities.MapObject


        }
        if (no instanceof MapNode) {
          final List<EditPart> sel = getViewer().getSelectedEditParts();
          if (sel.isEmpty())
            return null;
          final MapObject mo = getFirstMapObject(sel);
          if (mo == null)
            return null;
          final AddNodeCommand cmd = new AddNodeCommand();
          cmd.setTarget(mo);
          cmd.setNode((MapNode) no);
View Full Code Here


  /**
   * @see org.eclipse.gef.requests.CreationFactory#getNewObject()
   */
  @Override
  public Object getNewObject() {
    final MapObject o = new MapObject();
    o.setType(_type);
    return o;
  }
View Full Code Here

      copyBackground(gc);
      final List<MapObject> obj = cm.getAllObjects();
      _log.info("cell " + _id + " has " + obj.size() + " objects");

      final IStructuredSelection sel = UIActivator.getDefault().getSelection();
      MapObject selO = null;
      if (sel != null && !sel.isEmpty()) {
        final Object f = sel.getFirstElement();
        if (f instanceof MapObject)
          selO = (MapObject) f;
      }
View Full Code Here

  /**
   * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#createFigure()
   */
  @Override
  protected IFigure createFigure() {
    final MapObject obj = (MapObject) getModel();
    final ScannedMap map = (ScannedMap) getParent().getModel();
    final String symbol = EditPlugin.getBL().getProfile(map).getIcon(obj.getType());
    final ImageDescriptor desc = EditUIPlugin.getImageDescriptor("/icons/" + symbol + ".png"); //$NON-NLS-1$ //$NON-NLS-2$
    if (desc == null)
      throw new IllegalArgumentException("Icon for " + obj.getType() + " not found! " //$NON-NLS-1$ //$NON-NLS-2$
        + symbol);
    final Image img = desc.createImage();
    final ImageFigure fig = new ImageFigure(img);
    final Rectangle bounds = img.getBounds();
    final CoordinateSystem cs = getCoordinateSystem();
    final Point p = cs.toPoint(obj.getCenter().getNode().getPosition());
    bounds.x = p.x - bounds.width / 2;
    bounds.y = p.y - bounds.height / 2;
    fig.setBounds(new org.eclipse.draw2d.geometry.Rectangle(bounds));
    fig.setLayoutManager(new XYLayout());
    return fig;
View Full Code Here

  /**
   * @see org.eclipse.gef.editparts.AbstractEditPart#refreshVisuals()
   */
  @Override
  protected void refreshVisuals() {
    final MapObject p = (MapObject) getModel();
    final CoordinateSystem cs = getCoordinateSystem();
    final Point loc = cs.toPoint(p.getCenter().getNode().getPosition());
    final Dimension size = getFigure().getSize();
    loc.x -= size.width / 2;
    loc.y -= size.height / 2;
    final org.eclipse.draw2d.geometry.Rectangle r = new org.eclipse.draw2d.geometry.Rectangle(
      loc, size);
View Full Code Here

          return ""; //$NON-NLS-1$
      }
    if (element instanceof MapObject)
      switch (columnIndex) {
        case 0:
          final MapObject mo = (MapObject) element;
          String name = mo.getName();
          if (name == null)
            name = mo.getTags().get("name"); //$NON-NLS-1$
          return name == null ? mo.getId() : name;
        default:
          return ""; //$NON-NLS-1$
      }
    return element.toString();
  }
View Full Code Here

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

TOP

Related Classes of net.sf.myway.map.da.entities.MapObject

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.