Package javafx.geometry

Examples of javafx.geometry.Bounds


        return fxPath.toString();
    }

    public static String convertRectangle(final Rectangle RECTANGLE) {
        final StringBuilder fxPath = new StringBuilder();
        final Bounds        bounds = RECTANGLE.getBoundsInLocal();
        if (Double.compare(RECTANGLE.getArcWidth(), 0.0) == 0 && Double.compare(RECTANGLE.getArcHeight(), 0.0) == 0) {
            fxPath.append("M ").append(bounds.getMinX()).append(" ").append(bounds.getMinY()).append(" ")
                  .append("H ").append(bounds.getMaxX()).append(" ")
                  .append("V ").append(bounds.getMaxY()).append(" ")
                  .append("H ").append(bounds.getMinX()).append(" ")
                  .append("V ").append(bounds.getMinY()).append(" ")
                  .append("Z");
        } else {
            double x         = bounds.getMinX();
            double y         = bounds.getMinY();
            double width     = bounds.getWidth();
            double height    = bounds.getHeight();
            double arcWidth  = RECTANGLE.getArcWidth();
            double arcHeight = RECTANGLE.getArcHeight();
            double r         = x + width;
            double b         = y + height;
            fxPath.append("M ").append(x + arcWidth).append(" ").append(y).append(" ")
View Full Code Here


        CANVAS.setLayoutX(SHAPE.getLayoutBounds().getMinX());
        CANVAS.setLayoutY(SHAPE.getLayoutBounds().getMinY());
        CANVAS.setClip(CLIP);
        // create the gradient with the given stops
        final GraphicsContext CTX          = CANVAS.getGraphicsContext2D();
        final Bounds          BOUNDS       = SHAPE.getLayoutBounds();
        final Point2D         CENTER       = new Point2D(BOUNDS.getWidth() / 2, BOUNDS.getHeight() / 2);
        final double          RADIUS       = Math.sqrt(BOUNDS.getWidth() * BOUNDS.getWidth() + BOUNDS.getHeight() * BOUNDS.getHeight()) / 2;
        final double          ANGLE_STEP   = 0.1;
        final GradientLookup COLOR_LOOKUP = new GradientLookup(STOPS);
        CTX.translate(CENTER.getX(), CENTER.getY());
        CTX.rotate(-90 + ROTATION_OFFSET);
        CTX.translate(-CENTER.getX(), -CENTER.getY());
View Full Code Here

    private final BooleanProperty attachNodesProperty = new SimpleBooleanProperty();

    @Override
    public boolean visible(OptimizableContentPane p, Transform t) {

        Bounds bounds = p.getBoundsInLocal();
        bounds = p.localToScene(bounds);

        boolean visible = getMinSceneArea() <= bounds.getWidth() * bounds.getHeight();

        if (visible) {
            visible = Math.min(bounds.getWidth(), bounds.getHeight()) > getMinSceneDimension();
        }

        return visible;
    }
View Full Code Here

            final double scaleX = n.localToSceneTransformProperty().
                    getValue().getMxx();
            final double scaleY = n.localToSceneTransformProperty().
                    getValue().getMyy();

            Bounds boundsInScene =
                    control.localToScene(control.getBoundsInLocal());

            double sceneX = boundsInScene.getMinX();
            double sceneY = boundsInScene.getMinY();

            double offsetX = event.getSceneX() - mouseX;
            double offsetY = event.getSceneY() - mouseY;

            if (resizeMode == ResizeMode.NONE && control.isMovable()) {
View Full Code Here

   * @param node
   *            Node to which the tooltip need to be shown.
   */
  private void showToolTip(StackPane node) {
    final Parent parent = node.getParent();
    final Bounds childBounds = node.getBoundsInParent();
    final Bounds parentBounds = parent.localToScene(parent.getBoundsInLocal());
    double layoutX = childBounds.getMinX() + parentBounds.getMinX() + parent.getScene().getX() + parent.getScene().getWindow().getX();
    double layoutY = childBounds.getMaxY() + parentBounds.getMinY() + parent.getScene().getY() + parent.getScene().getWindow().getY();
    getPopup().show(node, layoutX, layoutY + 5);
  }
View Full Code Here

     * @return list of indices of all elements that are fully visible in the
     * list.
     */
    List<Long> shown() {
        final ListView lv = (ListView) listViewWrap.getControl();
        final Bounds viewArea = lv.getBoundsInLocal();

        List<Long> res = new GetAction<List<Long>>() {

            @Override
            @SuppressWarnings("unchecked")
            public void run(Object... parameters) {
                final List<Long> res = new LinkedList<Long>();

                listViewWrap.as(Parent.class, Node.class).lookup(
                                     ListCell.class, new LookupCriteria<ListCell>() {

                    @Override
                    public boolean check(ListCell control) {
                        if (control.isVisible() && control.getOpacity() == 1.0 ) {
                            Bounds controlBounds = lv.sceneToLocal(
                                    control.localToScene(control.getBoundsInLocal()));
                            if (viewArea.contains(controlBounds)) {
                                Long index = new Long(control.getIndex());
                                    res.add(index);
                                    return false;
View Full Code Here

    public static Rectangle getScreenBounds(final Environment env, final Node nd) {
        GetAction<Rectangle> bounds = new GetAction<Rectangle>() {

            @Override
            public void run(Object... parameters) {
                Bounds rect = nd.localToScene(nd.getLayoutBounds());
                Rectangle res = SceneWrap.getScreenBounds(env, nd.getScene());
                res.x += rect.getMinX();
                res.y += rect.getMinY();
                res.width = (int) rect.getWidth();
                res.height = (int) rect.getHeight();
                setResult(res);
            }
        };
        env.getExecutor().execute(env, true, bounds);
        return bounds.getResult();
View Full Code Here

    static Point convertToAbsoluteLayout(final NodeWrap<? extends Node> node, final Point p) {
        return new GetAction<Point>() {
            @Override
            public void run(Object... parameters) {
                Bounds layout = node.getControl().getLayoutBounds();
                Bounds toScene = node.getControl().localToScene(layout);
                Point2D loc = node.getControl().localToScene(layout.getMinX() + p.x, layout.getMinY() + p.y);
                setResult(new Point(loc.getX() - toScene.getMinX(), loc.getY() - toScene.getMinY()));
            }
        }.dispatch(node.getEnvironment());
    }
View Full Code Here

    static Point convertToLocalLayout(final NodeWrap<? extends Node> node, final Point p) {
        return new GetAction<Point>() {
            @Override
            public void run(Object... parameters) {
                Bounds layout = node.getControl().getLayoutBounds();
                Bounds toScene = node.getControl().localToScene(layout);
                Point2D loc = node.getControl().sceneToLocal(toScene.getMinX() + p.x, toScene.getMinY() + p.y);
                setResult(new Point(loc.getX() - layout.getMinX(), loc.getY() - layout.getMinY()));
            }
        }.dispatch(node.getEnvironment());
    }
View Full Code Here

                Window window = node.getControl().getScene().getWindow();
                if (Double.isNaN(window.getX())) { // TODO: temporary stub for RT-12736
                    setResult(true);
                    return;
                }
                Bounds bounds = new BoundingBox(window.getX(), window.getY(), 0, window.getWidth(), window.getHeight(), 0);
                double x = node.getScreenBounds().getX();
                double y = node.getScreenBounds().getY();
                if (p == null) {
                    x+= node.getClickPoint().getX();
                    y+= node.getClickPoint().getY();
                } else {
                    x+= p.getX();
                    y+= p.getY();
                }
                setResult(bounds.contains(x, y));
            }
        }.dispatch(node.getEnvironment());
    }
View Full Code Here

TOP

Related Classes of javafx.geometry.Bounds

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.