Examples of PBounds


Examples of edu.umd.cs.piccolo.util.PBounds

  protected void paint(PPaintContext paintContext) {
    if (getImage() != null) {
      double iw = image.getWidth(null);
      double ih = image.getHeight(null);
      PBounds b = getBoundsReference();
      Graphics2D g2 = paintContext.getGraphics();

      if (b.x != 0 || b.y != 0 || b.width != iw || b.height != ih) {
        g2.translate(b.x, b.y);
        g2.scale(b.width / iw, b.height / ih);
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

 
  protected PBounds getMarqueeBounds() {
    if (marquee != null) {
      return marquee.getBounds();
    }
    return new PBounds();
  }
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

    this.marqueeStrokePaint = marqueeStrokePaint;
  }
 
  @SuppressWarnings("unchecked")
  protected void updateMarquee(PInputEvent pie) {
    PBounds b = new PBounds();

    if (marqueeParent.getPiccolo() instanceof PCamera) {
      b.add(canvasPressPt);
      b.add(pie.getCanvasPosition());
    } else {
      b.add(presspt);
      b.add(pie.getPosition());
    }

    b.reset();
    b.add(presspt);
    b.add(pie.getPosition());

    PBounds marqueeBounds = (PBounds) b.clone();

    selectableParent.globalToLocal(marqueeBounds);
    marqueeParent.viewToLocal(marqueeBounds);
    // marquee.globalToLocal(b);   
   
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

   *            Bounds to look at
   * @return Reference to the activity which is animating the zoom and
   *         positioning
   */
  public void zoomToBounds(Rectangle2D bounds, long time) {
    PBounds biggerBounds = new PBounds(bounds.getX() - OBJECT_ZOOM_PADDING, bounds.getY()
        - OBJECT_ZOOM_PADDING, bounds.getWidth() + OBJECT_ZOOM_PADDING * 2, bounds
        .getHeight()
        + OBJECT_ZOOM_PADDING * 2);

    getSky().animateViewToCenterBounds(biggerBounds, true, time);
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

        }
      }
    }

    if (zoomToLayout && foundNode) {
      PBounds fullBounds = new PBounds(startX, startY, endX - startX, endY - startY);
      getWorld().zoomToBounds(fullBounds);
    }

  }
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

  protected void dragActivityStep(PInputEvent aEvent) {
    if (!getAutopan())
      return;

    PCamera c = aEvent.getCamera();
    PBounds b = c.getBoundsReference();
    Point2D l = aEvent.getPositionRelativeTo(c);
    int outcode = b.outcode(l);
    PDimension delta = new PDimension();

    if ((outcode & Rectangle.OUT_TOP) != 0) {
      delta.height = validatePanningSpeed(-1.0
          - (0.5 * Math.abs(l.getY() - b.getY())));
    } else if ((outcode & Rectangle.OUT_BOTTOM) != 0) {
      delta.height = validatePanningSpeed(1.0 + (0.5 * Math.abs(l.getY()
          - (b.getY() + b.getHeight()))));
    }

    if ((outcode & Rectangle.OUT_RIGHT) != 0) {
      delta.width = validatePanningSpeed(1.0 + (0.5 * Math.abs(l.getX()
          - (b.getX() + b.getWidth()))));
    } else if ((outcode & Rectangle.OUT_LEFT) != 0) {
      delta.width = validatePanningSpeed(-1.0
          - (0.5 * Math.abs(l.getX() - b.getX())));
    }

    c.localToView(delta);

    if (delta.width != 0 || delta.height != 0) {
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

  @Override
  public void dragHandle(PDimension aLocalDimension, PInputEvent aEvent) {
    PBoundsLocator l = (PBoundsLocator) getLocator();

    PNode n = l.getNode();
    PBounds b = n.getBounds();

    PNode parent = getParent();
    if (parent != n && parent instanceof PCamera) {
      ((PCamera) parent).localToView(aLocalDimension);
    }

    localToGlobal(aLocalDimension);
    n.globalToLocal(aLocalDimension);

    double dx = aLocalDimension.getWidth();
    double dy = aLocalDimension.getHeight();

    switch (l.getSide()) {
    case SwingConstants.NORTH:
      b.setRect(b.x, b.y + dy, b.width, b.height - dy);
      break;

    case SwingConstants.SOUTH:
      b.setRect(b.x, b.y, b.width, b.height + dy);
      break;

    case SwingConstants.EAST:
      b.setRect(b.x, b.y, b.width + dx, b.height);
      break;

    case SwingConstants.WEST:
      b.setRect(b.x + dx, b.y, b.width - dx, b.height);
      break;

    case SwingConstants.NORTH_WEST:
      b.setRect(b.x + dx, b.y + dy, b.width - dx, b.height - dy);
      break;

    case SwingConstants.SOUTH_WEST:
      b.setRect(b.x + dx, b.y, b.width - dx, b.height + dy);
      break;

    case SwingConstants.NORTH_EAST:
      b.setRect(b.x, b.y + dy, b.width + dx, b.height - dy);
      break;

    case SwingConstants.SOUTH_EAST:
      b.setRect(b.x, b.y, b.width + dx, b.height + dy);
      break;
    }

    boolean flipX = false;
    boolean flipY = false;
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

                }
            }

        }

        PBounds fullBounds = new PBounds(startX, startY, endX - startX, endY - startY);
        zoomToBounds(fullBounds);

    }
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

        getGround().setElasticEnabled(false);
        boolean enableElasticMode = false;

        HashMap<String, Float[]> nodeXY = new HashMap<String, Float[]>();
        String line = null;
        PBounds fullBounds = null;

        while (true) {
            BufferedReader reader = null;
            try {
                reader = new BufferedReader(new FileReader(fileToOpen));
            } catch (IOException e) {
                System.err.println("NetworkViewer.restoreNodeLayout() - IOException encountered attempting to create BufferedReader: "
                        + e.getMessage());
                readFailed = true;
            }

            try {
                while((line = reader.readLine()) != null) {
                    if (line.length() >= 2 && line.substring(0, 2).equals("# ")) {
                        if (line.indexOf("elasticmode=") != -1) {
                            enableElasticMode = Boolean.parseBoolean(
                                    line.substring(line.indexOf('=') + 1));
                        } else if (line.indexOf("viewbounds=") != -1) {
                            float x = Float.parseFloat(line.substring(
                                    line.indexOf("x=") + 2, line.indexOf(',')));
                            float y = Float.parseFloat(line.substring(
                                    line.indexOf("y=") + 2, line.indexOf(',', line.indexOf("y="))));
                            float width = Float.parseFloat(line.substring(
                                    line.indexOf("width=") + 6, line.indexOf(',', line.indexOf("width="))));
                            float height = Float.parseFloat(line.substring(
                                    line.indexOf("height=") + 7, line.indexOf(']', line.indexOf("height="))));
                            // TODO: Hax
                            x += 161.5;
                            y += 100;
                            width -= 323;
                            height -= 200;
                            fullBounds = new PBounds(x, y, width, height);
                        } else {
                            float x = Float.parseFloat(line.substring(
                                    line.indexOf(")=Point2D.Double[") + 17, line.indexOf(',',
                                            line.indexOf(")=Point2D.Double["))));
                            float y = Float.parseFloat(line.substring(
View Full Code Here

Examples of edu.umd.cs.piccolo.util.PBounds

    ScreenOverlayWindow overlayWindow = new ScreenOverlayWindow();

    PNode node = PNodeFactory.createFrom(element);
    int x = (int) node.getXOffset();
    int y = (int) node.getYOffset();
    PBounds bounds = node.getBounds();
    node.setOffset(0,0);     
    overlayWindow.getCanvas().getLayer().addChild(node);

    overlayWindow.setLocation(screenBounds.x + x, screenBounds.y + y);
    overlayWindow.setSize((int)bounds.width, (int)bounds.height);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.