Examples of JPowerGraphGraphics


Examples of net.sourceforge.jpowergraph.swtswinginteraction.JPowerGraphGraphics

        g.setForeground(getBorderColor(node, graphPane, theSubGraphHighlighter));
        g.drawOval(thePoint.x - radius / 2, thePoint.y - radius / 2, radius, radius);

        if (showNodes){
            JPowerGraphGraphics subG = g.getSubJPowerGraphGraphics(new JPowerGraphDimension(dummyRectangle.width, dummyRectangle.height));
            double scale = getInstanceScale(numInstances);
           
            subG.setBackground(g.getBackground());
            subG.setForeground(g.getForeground());
            subG.setAntialias(g.getAntialias());
            subG.fillRectangle(0, 0, dummyRectangle.width, dummyRectangle.height);
            nodePainter.paintNode(graphPane, subG, dummyNode, ShapeNodePainter.SMALL, theSubGraphHighlighter, new JPowerGraphPoint(dummyRectangle.width/2, dummyRectangle.height/2), scale);
            JPowerGraphColor nodeColor = nodePainter.getBackgroundColor(dummyNode, graphPane, theSubGraphHighlighter);
           
            for (int i = 0; i < rowSizes.length; i++) {
                int rowIndex = (((numRows - 1) / 2) - i) * -1;
                int normalisedRowIndex = rowIndex;
                if (normalisedRowIndex < 0){
                    normalisedRowIndex *= -1;
                }
   
                int rowdx = 0;
               
                int numFullNodes = 0;
                int numHalfNodes = 0;
                int numGaps = 0;
                if (i % 2 != 0) {
                    numFullNodes = (rowSizes[i] - 2);
                    numHalfNodes = 1;
                    numGaps = (rowSizes[i] - 1);
                }
                else{
                    numFullNodes = (rowSizes[i] - 1);
                    numHalfNodes = 0;
                    numGaps = (rowSizes[i] - 1);
                }
                rowdx = (numFullNodes * dummyRectangle.width) + (numHalfNodes * dummyRectangle.width) + (numGaps * hPadBetweenInstances) ;
                rowdx = rowdx / 2;
               
                JPowerGraphGraphics rowG = rowImageMap.retrieve(scale, rowSizes[i], g.getBackground(), nodeColor);
                if (rowG == null){
                    int rowWidth = (dummyRectangle.width + hPadBetweenInstances) * rowSizes[i] + 1;
                    rowG = g.getSubJPowerGraphGraphics(new JPowerGraphDimension(rowWidth, dummyRectangle.height));
                    rowG.setBackground(g.getBackground());
                    rowG.setForeground(g.getForeground());
                    rowG.setAntialias(g.getAntialias());
                    rowG.fillRectangle(0, 0, rowWidth, dummyRectangle.height);
                    for (int j = 0; j < rowSizes[i]; j++) {
                        int thisDx = (dummyRectangle.width + hPadBetweenInstances) * j;
                       
                        JPowerGraphPoint thisPoint = new JPowerGraphPoint(thisDx + dummyRectangle.width/2, dummyRectangle.height/2);
                        rowG.drawSubJPowerGraph(subG, thisPoint.x - dummyRectangle.width/2, thisPoint.y - dummyRectangle.height/2);
                    }
                    rowImageMap.register(scale, rowSizes[i], rowG, g.getBackground(), nodeColor);
                }
   
                int rowdy = rowIndex * (dummyRectangle.height + vPadBetweenInstances);
View Full Code Here

Examples of net.sourceforge.jpowergraph.swtswinginteraction.JPowerGraphGraphics

   
    public void dispose(){
        for (Double scale : scaleRowMap.keySet()){
            Map <Key, JPowerGraphGraphics> row = row = scaleRowMap.get(scale);
            for (Key p : row.keySet()){
                JPowerGraphGraphics g = row.get(p);
                g.dispose();
            }
        }
        scaleRowMap.clear();
        disposed = true;
    }
View Full Code Here

Examples of net.sourceforge.jpowergraph.swtswinginteraction.JPowerGraphGraphics

                theDimension.width += buttonWidth + widthPadding;
            }
        }
        else if (legendItem instanceof GroupLegendItem){
            if (((GroupLegendItem) legendItem).getLegendItems().size() > 0){
                JPowerGraphGraphics g = graphPane.getJPowerGraphGraphics();
                theDimension.width = Math.max(theDimension.width, g.getStringWidth(((GroupLegendItem) legendItem).getDescription()) + toggleWidth + 5);
                theDimension.height += Math.max(toggleHeight, g.getAscent() + g.getDescent() + 4);
               
                if (((GroupLegendItem) legendItem).isExpanded()){
                    for (LegendItem subLegendItem : ((GroupLegendItem) legendItem).getLegendItems()) {
                        JPowerGraphDimension subDimension = new JPowerGraphDimension (0, 0);
                        this.getLegendItemSize(graphPane, subLegendItem, theLegend, subDimension);
View Full Code Here

Examples of net.sourceforge.jpowergraph.swtswinginteraction.JPowerGraphGraphics

   
    public void getNodeScreenBounds(JGraphPane graphPane, Node node, int size, double theScale, JPowerGraphRectangle nodeScreenRectangle) {
        JPowerGraphPoint nodePoint = graphPane.getScreenPointForNode(node);
        String label=node.getLabel();
       
        JPowerGraphGraphics g = graphPane.getJPowerGraphGraphics();
       
        if (size == NodePainter.LARGE){
            int width=20;
            int height=5;
            if (label!=null) {
                int stringWidth = stringWidth(g, label);
                int numlines = countLines(label);
                width += (stringWidth + (stringWidth/4));
                height += ((g.getAscent() + g.getDescent() + 10) * numlines);
            }
            else {
                width+=40;
                height+=20;
            }
View Full Code Here

Examples of net.sourceforge.jpowergraph.swtswinginteraction.JPowerGraphGraphics

            nodeScreenRectangle.height = height;
        }
    }

    public JPowerGraphDimension getLegendItemSize(JGraphPane graphPane, String legendText) {
        JPowerGraphGraphics g = graphPane.getJPowerGraphGraphics();
       
        int padding = 2;
        int imageWidth = 18;
        int imageHeight = 8;
        int stringWidth = stringWidth(g, legendText);
        int width = imageWidth + stringWidth + (padding * 3);
        int height = Math.max(imageHeight, g.getAscent() + g.getDescent() + 4);
        return new JPowerGraphDimension(width, 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.