Package org.joshy.gfx.node

Examples of org.joshy.gfx.node.Bounds


            this.node = node;
        }

        @Override
        public double getX() {
            Bounds bounds = node.getBounds();
            switch(position) {
                case BottomLeft:
                case Left:
                case TopLeft: return bounds.getX();

                case Bottom:
                case Top: return bounds.getX()+(bounds.getWidth()*node.getScaleX())/2.0;

                case TopRight:
                case Right:
                case BottomRight: return bounds.getX()+bounds.getWidth()*node.getScaleX();
            }
            return 0;
        }
View Full Code Here


            }
            return 0;
        }
        @Override
        public double getY() {
            Bounds bounds = node.getBounds();
            switch(position) {
                case TopLeft:
                case Top:
                case TopRight:    return bounds.getY();

                case Left:
                case Right:       return bounds.getY()+(bounds.getHeight()*node.getScaleY())/2.0;
               
                case BottomLeft:
                case Bottom:
                case BottomRight: return bounds.getY()+bounds.getHeight()*node.getScaleY();
            }
            return 0;
        }
View Full Code Here

        double y = Double.MAX_VALUE;
        double x2 = Double.MIN_VALUE;
        double y2 = Double.MIN_VALUE;

        for(SNode node : nodes) {
            Bounds bounds = node.getTransformedBounds();
            if(bounds == null) {
                u.p("waring. null bounds: " + node);
            }
            x = Math.min(x,bounds.getX());
            y = Math.min(y,bounds.getY());
            x2 = Math.max(x2,bounds.getX()+bounds.getWidth());
            y2 = Math.max(y2,bounds.getY()+bounds.getHeight());
        }

        this.nodes.addAll(nodes);

        this.boundsWidth = x2-x;
View Full Code Here

            return 0;
        }

        @Override
        public void setY(double y, boolean constrain) {
            Bounds bounds = node.getBounds();
            switch(position) {
                case TopLeft:
                case Top:
                case TopRight:
                    double height = bounds.getHeight();
                    double realHeight = height*node.getScaleY();
                    double deltay = node.getTranslateY()-y;
                    realHeight += deltay;
                    node.setTranslateY(y);
                    node.setScaleY((realHeight/height));
                    return;

                case Left:
                case Right: return;

                case BottomLeft:
                case Bottom:
                case BottomRight:
                    node.setScaleY((y-bounds.getY())/bounds.getHeight());
                    return;
            }
        }
View Full Code Here

        }


        @Override
        public void setX(double x, boolean constrain) {
            Bounds bounds = node.getBounds();
            double width = node.getBounds().getWidth();
            switch(position) {
                case TopLeft:
                case Left:
                case BottomLeft:
View Full Code Here

        return nodes;
    }

    @Override
    public Bounds getBounds() {
        return new Bounds(getTranslateX(),getTranslateY(),boundsWidth,boundsHeight);
    }
View Full Code Here

                point.setLocation(hotspot);
                poly.setClosed(true);
                //remove the last point since it would be a duplicate
                poly.removePoint(point);
                context.getSelection().setSelectedNode(poly);
                Bounds bounds = poly.getTransformedBounds();
                poly.setAnchorX(bounds.getCenterX());
                poly.setAnchorY(bounds.getCenterY());
                poly = null;
                hotspot = null;
                point = null;
                context.releaseControl();
            }
View Full Code Here

    }

    @Override
    public Bounds getBounds() {
        if(image == null) {
            return new Bounds(getTranslateX()+getX(),getTranslateY()+getY(),getWidth(),getHeight());
        }
        double sx = width/((double)image.getWidth());
        return new Bounds(getTranslateX()+getX(),getTranslateY()+getY(),img.getWidth()*sx,img.getHeight()*sx);
    }
View Full Code Here

    @Override
    public Bounds getBounds() {
        if(path2d != null) {
            Rectangle bds = path2d.getBounds();
            return new Bounds(
                    bds.getX(),
                    bds.getY(),
                    bds.getWidth(),
                    bds.getHeight());
        }
        return new Bounds(0,0,100,100);
    }
View Full Code Here

            Shape sh = af.createTransformedShape(path2d);
            Rectangle2D bds = sh.getBounds2D();
            return Util.toBounds(bds);

        }
        return new Bounds(0,0,100,100);
    }
View Full Code Here

TOP

Related Classes of org.joshy.gfx.node.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.