Package edu.uci.ics.jung.visualization.transform.shape

Examples of edu.uci.ics.jung.visualization.transform.shape.Intersector


        boolean containsV0 = rectangle.contains(v0);
        boolean containsV1 = rectangle.contains(v1);
       
        // horizontal scrollbar:
       
        Intersector intersector = new Intersector(rectangle, new Line2D.Double(h0, h1));
       
        int min = 0;
        int ext;
        int val = 0;
        int max;
       
        Set points = intersector.getPoints();
        Point2D first = null;
        Point2D second = null;
       
        Point2D[] pointArray = (Point2D[])points.toArray(new Point2D[points.size()]);
        if(pointArray.length > 1) {
            first = pointArray[0];
            second = pointArray[1];
        } else if(pointArray.length > 0) {
            first = second = pointArray[0];
        }
       
        if(first != null && second != null) {
            // correct direction of intersect points
            if((h0.getX() - h1.getX()) * (first.getX() - second.getX()) < 0) {
                // swap them
                Point2D temp = first;
                first = second;
                second = temp;
            }

            if(containsH0 && containsH1) {
                max = (int)first.distance(second);
                val = (int)first.distance(h0);
                ext = (int)h0.distance(h1);
               
            } else if(containsH0) {
                max = (int)first.distance(second);
                val = (int)first.distance(h0);
                ext = (int)h0.distance(second);
               
            } else if(containsH1) {
                max = (int) first.distance(second);
                val = 0;
                ext = (int) first.distance(h1);
               
            } else {
                max = ext = rectangle.width;
                val = min;
            }
            horizontalScrollBar.setValues(val, ext+1, min, max);
        }
       
        // vertical scroll bar
        min = val = 0;
       
        intersector.intersectLine(new Line2D.Double(v0, v1));
        points = intersector.getPoints();
       
        pointArray = (Point2D[])points.toArray(new Point2D[points.size()]);
        if(pointArray.length > 1) {
            first = pointArray[0];
            second = pointArray[1];
View Full Code Here


        boolean containsV0 = rectangle.contains(v0);
        boolean containsV1 = rectangle.contains(v1);
       
        // horizontal scrollbar:
       
        Intersector intersector = new Intersector(rectangle, new Line2D.Double(h0, h1));
       
        int min = 0;
        int ext;
        int val = 0;
        int max;
       
        Set points = intersector.getPoints();
        Point2D first = null;
        Point2D second = null;
       
        Point2D[] pointArray = (Point2D[])points.toArray(new Point2D[points.size()]);
        if(pointArray.length > 1) {
            first = pointArray[0];
            second = pointArray[1];
        } else if(pointArray.length > 0) {
            first = second = pointArray[0];
        }
       
        if(first != null && second != null) {
            // correct direction of intersect points
            if((h0.getX() - h1.getX()) * (first.getX() - second.getX()) < 0) {
                // swap them
                Point2D temp = first;
                first = second;
                second = temp;
            }

            if(containsH0 && containsH1) {
                max = (int)first.distance(second);
                val = (int)first.distance(h0);
                ext = (int)h0.distance(h1);
               
            } else if(containsH0) {
                max = (int)first.distance(second);
                val = (int)first.distance(h0);
                ext = (int)h0.distance(second);
               
            } else if(containsH1) {
                max = (int) first.distance(second);
                val = 0;
                ext = (int) first.distance(h1);
               
            } else {
                max = ext = rectangle.width;
                val = min;
            }
            horizontalScrollBar.setValues(val, ext+1, min, max);
        }
       
        // vertical scroll bar
        min = val = 0;
       
        intersector.intersectLine(new Line2D.Double(v0, v1));
        points = intersector.getPoints();
       
        pointArray = (Point2D[])points.toArray(new Point2D[points.size()]);
        if(pointArray.length > 1) {
            first = pointArray[0];
            second = pointArray[1];
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.visualization.transform.shape.Intersector

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.