Package de.hpi.eworld.networkview.objects

Examples of de.hpi.eworld.networkview.objects.NodeView


   * @param way
   */
  void addEdge(EdgeView way){
    mxGraphics2DCanvas.putShape(way.getShapeName(), way);
    EdgeModel e = way.getModelElement();
    mxCell from = addShape(new NodeView(e.getFromNode()));
    mxCell to = addShape(new NodeView(e.getToNode()));
    if (from != null && to != null) {
      getGraph().insertEdge(
          getGraph().getDefaultParent(),
          way.getShapeName(),
          way,
View Full Code Here


   * @param nodeViews
   * @param scrolledLocalCenter
   * @return the nearest node to a given point
   */
  public static NodeModel getNearestNode(List<NodeView> nodeViews, Point2D scrolledLocalCenter){
    NodeView nearestNodeTodropPoint = nodeViews.get(0);
    double nearestNodeDistance = Point2DUtils.distance(scrolledLocalCenter, nearestNodeTodropPoint.getPosition());
    for (NodeView node : nodeViews){
      double nodeDistance = Point2DUtils.distance(scrolledLocalCenter, node.getPosition());
      if (nodeDistance < nearestNodeDistance){
        nearestNodeTodropPoint = node;
        nearestNodeDistance = nodeDistance;
      }
    }
    return nearestNodeTodropPoint.getModelElement();
  }
View Full Code Here

TOP

Related Classes of de.hpi.eworld.networkview.objects.NodeView

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.