Package net.sourceforge.jpowergraph.swtswinginteraction.geometry

Examples of net.sourceforge.jpowergraph.swtswinginteraction.geometry.JPowerGraphRectangle


     *
     * @param node
     *            the node that needs to be repainted
     */
    public void repaintNode(Node node) {
        JPowerGraphRectangle nodeScreenRectangle = new JPowerGraphRectangle(0, 0, 0, 0);
        getNodeScreenBounds(node, nodeScreenRectangle);
        synchronized (SWTJGraphPane.this){
            SWTJGraphPane.this.redraw();
        }
    }
View Full Code Here


     *
     * @param edge
     *            the edge that needs to be repainted
     */
    public void repaintEdge(Edge edge) {
        JPowerGraphRectangle edgeScreenRectangle = new JPowerGraphRectangle(0, 0, 0, 0);
        getEdgeScreenBounds(edge, edgeScreenRectangle);

        edgeScreenRectangle.x -= 5;
        edgeScreenRectangle.y -= 5;
        edgeScreenRectangle.width += 10;
View Full Code Here

            m_manipulators.get(i).notifyGraphPaneScrolled();
    }

    public JPowerGraphRectangle getVisibleRectangle() {
        Rectangle r = getClientArea();
        return new JPowerGraphRectangle(r.x, r.y, r.width, r.height);
    }
View Full Code Here

        Rectangle r = getClientArea();
        return new JPowerGraphRectangle(r.x, r.y, r.width, r.height);
    }
   
    public void scrollRectToVisible(JPowerGraphPoint thePoint) {
        scrollRectToVisible(new JPowerGraphRectangle(thePoint.x, thePoint.y, 300, 300));
    }
View Full Code Here

        }
    }

    public JPowerGraphRectangle getClipping() {
        Rectangle r = gc.getClipping();
        return new JPowerGraphRectangle(r.x, r.y, r.width, r.height);
    }
View Full Code Here

     */
    public void paintEdge(JGraphPane graphPane, JPowerGraphGraphics g, T edge, SubGraphHighlighter theSubGraphHighlighter) {
        JPowerGraphPoint from = graphPane.getScreenPointForNode(edge.getFrom());
        JPowerGraphPoint to = graphPane.getScreenPointForNode(edge.getTo());
       
        JPowerGraphRectangle nodeRectangle = new JPowerGraphRectangle(0, 0, 0, 0);
        graphPane.getNodeScreenBounds(edge.getTo(), nodeRectangle);
       
        JPowerGraphColor oldBGColor = g.getBackground();
        JPowerGraphColor oldFGColor = g.getForeground();
        g.setBackground(normal);
View Full Code Here

                int buttonY = thePoint.y - heightpadding;
                int buttonHeight = d.getHeight() - 5;
               
                boolean canFilterNode = graphPane.getGraph().getNodeFilter().canChangeFilterState(nodeLegendItem.getNodeClass());
                boolean isChecked = graphPane.getGraph().getNodeFilter().getFilterState(nodeLegendItem.getNodeClass());
                JPowerGraphRectangle r = new JPowerGraphRectangle(buttonX, buttonY, buttonWidth, buttonHeight);
                if (canFilterNode){
                    g.setForeground(enabledButtonColor);
                    theLegend.addActionRectangle(r, new AbstractAction() {
                        public void actionPerformed(ActionEvent e) {
                            graphPane.getGraph().getNodeFilter().setFilterState(nodeLegendItem.getNodeClass(), !graphPane.getGraph().getNodeFilter().getFilterState(nodeLegendItem.getNodeClass()));
                        }
                    });
                }
                else{
                    g.setForeground(disabledButtonColor);
                }
               
                g.drawRectangle(r.x, r.y, r.width, r.height);
                if (isChecked){
                    g.drawLine(r.x + 3, r.y + 3, r.x + r.width - 3, r.y + r.height - 3);
                    g.drawLine(r.x + 3, r.y + r.height - 3, r.x + r.width - 3, r.y + 3);
                }
            }
        }
        else if (legendItem instanceof GroupLegendItem){
            final GroupLegendItem groupLegendItem = (GroupLegendItem) legendItem;
            if (groupLegendItem.getLegendItems().size() > 0){
                JPowerGraphRectangle r = new JPowerGraphRectangle(thePoint.x + 5, thePoint.y, toggleWidth - 10, toggleHeight);
               
                theLegend.addActionRectangle(r, new AbstractAction() {
                    public void actionPerformed(ActionEvent e) {
                        groupLegendItem.setExpanded(!groupLegendItem.isExpanded());
                        graphPane.redraw();
View Full Code Here

            if (dimension.width != widthPad && dimension.height != heightPad){
                width = Math.max(width, dimension.width + widthPad);
                height += dimension.height;
            }
        }
        JPowerGraphRectangle legendRectangle = new JPowerGraphRectangle(10, graphPane.getHeight() - (height + 10), width, height);
       
        JPowerGraphColor oldColor = g.getForeground();
        g.setForeground(white);
        g.fillRoundRectangle(legendRectangle.x, legendRectangle.y, legendRectangle.width, legendRectangle.height, 10, 10);
        g.setForeground(black);
View Full Code Here

        edgeColor3 = normal;
        shape = theShape;
    }
   
    public void paintEdge(JGraphPane graphPane, JPowerGraphGraphics g, T edge, SubGraphHighlighter theSubGraphHighlighter) {
        JPowerGraphRectangle r = new JPowerGraphRectangle(0, 0, 0, 0);
        getEdgeScreenBounds(graphPane, edge, r);

        JPowerGraphColor oldFGColor = g.getForeground();
        JPowerGraphColor oldBGColor = g.getBackground();       
        g.setForeground(getEdgeColor(edge,graphPane, false, theSubGraphHighlighter));
View Full Code Here

    }
   
    public double screenDistanceFromEdge(JGraphPane graphPane, T edge, JPowerGraphPoint point) {
        int px=point.x;
        int py=point.y;
        JPowerGraphRectangle r = new JPowerGraphRectangle(0, 0, 0, 0);
        getEdgeScreenBounds(graphPane, edge, r);
       
        int x1=r.x;
        int y1=r.y + 1;
        int x2=x1 + r.width;
        int y2=y1;
        int x3=x1;
        int y3=y1 + r.height;
       
        JPowerGraphRectangle r1 = new JPowerGraphRectangle(x1 - 6, y1 - 6, 16 + (x2 - x1), 16);
        JPowerGraphRectangle r2 = new JPowerGraphRectangle(x1 - 6, y1 - 6, 16, 16 + (y3 - y1));
       
        double dist=1000;
        if (r1.contains(point)){
            if (x1 <= px && px <= x2){
                dist = Math.abs(y1 - py);
            }
            else if (px < x1){
                dist = Math.abs(x1 - px) + Math.abs(y1 - py);
            }
            else if (px > x2){
                dist = Math.abs(x2 - px) + Math.abs(y2 - py);
            }
        }
        else if (r2.contains(point)){
            if (y1 <= py && py <= y3){
                dist = Math.abs(x1 - px);
            }
            else if (py < y1){
                dist = Math.abs(x1 - px) + Math.abs(y1 - py);
View Full Code Here

TOP

Related Classes of net.sourceforge.jpowergraph.swtswinginteraction.geometry.JPowerGraphRectangle

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.