Package ca.nengo.ui.lib.world

Examples of ca.nengo.ui.lib.world.WorldObject


      boolean boundsIntersects = node.intersects(localBounds);
      boolean isMarquee = (node == marquee);

      if (node instanceof PiccoloNodeInWorld) {
        WorldObject wo = ((PiccoloNodeInWorld) node).getWorldObject();

        if (wo.isSelectable()) {
          return (node.getPickable() && boundsIntersects && !isMarquee && !(wo == selectableParent));
        }
      }
      return false;
View Full Code Here


  }

  private void processKeyboardEvent(PInputEvent event) {
    if ((event.getModifiers() & AppFrame.MENU_SHORTCUT_KEY_MASK) != 0) {

      WorldObject wo = getTooltipNode(event);
      if (wo != null) {
        setKeyboardTooltipFocus(wo);

      }
    } else {
View Full Code Here

    PNode node = event.getPickedNode();
    while (node != null) {

      if (node instanceof PiccoloNodeInWorld) {
        WorldObject wo = ((PiccoloNodeInWorld) node).getWorldObject();

        /*
         * Do nothing if the mouse is over the controls
         */
        if (node == controls) {
          setKeepPickAlive(true);
          return null;
        } else if (wo instanceof WorldLayer || wo instanceof Window) {
          break;
        } else if (wo.getTooltip() != null) {
          return null; // hack to eliminate tool tips
          //return wo;
        }

      }
View Full Code Here

  }

  @Override
  protected void nodePicked() {
    WorldObject node = getPickedNode();
    tooltipFrame.setSelected(node);

    mouseOverTooltip = getWorld().showTooltip(node);
  }
View Full Code Here

  }

  @Override
  protected void processMouseEvent(PInputEvent event) {
    WorldObject node = null;

    processKeyboardEvent(event);
    if (WorldImpl.isTooltipsVisible()) {
      node = getTooltipNode(event);
    } else {
View Full Code Here

    if (altClicked || doubleClicked) {
      PNode node = event.getPickedNode();
      while (node != null) {
        if (node instanceof PiccoloNodeInWorld) {

          WorldObject wo = ((PiccoloNodeInWorld) node).getWorldObject();

          if (wo.isSelectable()) {
            if (doubleClicked) {
              wo.doubleClicked();
            }
            if (altClicked) {
              wo.altClicked();
            }
            break;
          }

        }
View Full Code Here

  }
 
  private static Point2D getRelativePosition(WorldImpl world, Point2D globalPosition) {
    // We need to loop through each sub-network to transform
    // the point to each sub-network's coordinate system
    WorldObject obj = world;
   
    // First determine the path from the root node to the sub-network
    // into which we are pasting
    Stack<WorldObject> objStack = new Stack<WorldObject>();
    while (obj != null) {
      objStack.push(obj);
      if (obj instanceof NetworkViewer) {
        UINetwork nViewer = ((NetworkViewer) obj).getViewerParent();
        UINetwork v = nViewer.getNetworkParent();
        if (v != null)
          obj = v.getViewer();
        else
          obj = NengoGraphics.getInstance().getWorld();
      } else {
        obj = null;
      }
    }
   
    // Now loop through the stack of nodes and transform the point
    // into the proper network's coordinate system
    Point2D newPosition = globalPosition;
    while (!objStack.empty()) {
      obj = objStack.pop();
      newPosition = obj.globalToLocal(newPosition);
      if (obj instanceof NodeViewer)
        newPosition = ((NodeViewer)obj).localToView(newPosition);
      else
        newPosition = ((NodeContainer)obj).localToView(newPosition);
    }
View Full Code Here

    for (PXEdge uiEdge : getEdges()) {

      if (uiEdge instanceof ElasticEdge) {
        ElasticEdge elasticEdge = (ElasticEdge) uiEdge;
        WorldObject startNode = uiEdge.getStartNode();
        WorldObject endNode = uiEdge.getEndNode();

        // Find the Elastic Objects which are ancestors of the start and
        // end
        // nodes
        while (startNode.getParent() != this && startNode != null) {
          startNode = startNode.getParent();
          if (startNode == null) {
            break;
          }
        }

        while (endNode.getParent() != this && endNode != null) {
          endNode = endNode.getParent();
          if (endNode == null) {
            break;
          }
        }

        if (startNode == null || endNode == null) {
          Util.Assert(false, "Edge nodes do not exist on this ground");
        } else if (!(startNode instanceof ElasticObject || endNode instanceof ElasticGround)) {
          /*
           * The parent nodes are not elastic, we can ignore them
           */
        } else if (startNode.getParent() == this && endNode.getParent() == this) {
          ElasticVertex startVertex = myVertexMap.get(startNode);
          ElasticVertex endVertex = myVertexMap.get(endNode);

          if (!(startVertex != null && endVertex != null)) {
            Util.Assert(false, "Could not find vertice");
View Full Code Here

   
    // Loop through selected objects, compensate for camera panning
    // so that objects will remain stationary relative to cursor
    Iterator<WorldObject> selectionEn = selectionHandler.getSelection().iterator();
    while (selectionEn.hasNext()) {
      WorldObject node = selectionEn.next();
      node.localToParent(node.globalToLocal(delta));
      node.dragOffset(delta.getWidth(), delta.getHeight());
    }
  }
View Full Code Here

  }

  @Override
  public void updateEdgeBounds() {

    WorldObject start = getStartNode();
    WorldObject end = getEndNode();

    if (start.isDestroyed() || end.isDestroyed()) {
      removeFromWorld();
      return;
    }

    double sX = start.getX();
    double sY = start.getY();
    double sHY = start.getHeight() + sY;
    double sWX = start.getWidth() + sX;

    double eX = end.getX();
    double eY = end.getY();
    double eHY = end.getHeight() + eY;
    double eWX = end.getWidth() + eX;

    Point2D s0 = toLocal(start, sX, sY);
    Point2D s1 = toLocal(start, sWX, sY);
    Point2D s2 = toLocal(start, sX, sHY);
    Point2D s3 = toLocal(start, sWX, sHY);
View Full Code Here

TOP

Related Classes of ca.nengo.ui.lib.world.WorldObject

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.