void PortionDrawer::drawGraph(DiagramDrawer &drawer) { if(mGraph) { // This must be set for svg drawer.setDiagramSize(getDrawingSize(drawer)); drawNodes(drawer); drawer.groupShapes(true, Color(0,0,0), Color(245,245,255)); drawConnections(drawer); drawer.groupShapes(false, 0, 0); std::vector<DrawString> drawStrings; std::vector<bool> virtOpers; getNodeText(drawer, drawStrings, virtOpers); drawer.groupText(true, false); drawNodeText(drawer, false, drawStrings, virtOpers); drawer.groupText(false, false); drawer.groupText(true, true); drawNodeText(drawer, true, drawStrings, virtOpers); drawer.groupText(false, false); } }
GraphSize OperationDrawer::drawDiagram(DiagramDrawer &drawer, OperationGraph &graph, const OperationDrawOptions &options) { drawer.setDiagramSize(getDrawingSize(drawer, graph, options)); drawer.setCurrentDrawingFontSize(mDiagram.getDiagramBaseFontSize()); return drawOrSizeDiagram(drawer, graph, options, true); }
/** This method is called, if the window has been resized. * If the drawing previously has fit into the window, it is rescaled to the new window size. */ void SystemTopologyDrawing::setSize( const QSize &size ) { int eps = 50; QSize drawSize = getDrawingSize(); bool doesFit = ( ( ( drawSize.width() - parentSize.width() ) < eps ) && ( ( drawSize.height() - parentSize.height() ) < eps ) ); bool init = ( parentSize.width() <= 0 ); parentSize = size; if ( doesFit || init ) { transform->rescale( false ); } setMinimumSize( getMinimumPixmapSize() ); // for the scrollbars setMaximumSize( getMinimumPixmapSize() ); }
/** * @return the maximum of topology drawing size and widget size */ QSize SystemTopologyDrawing::getMinimumPixmapSize() { QSize ret = getDrawingSize(); // ensure that the drawing size is not smaller than the widget size int w = parentSize.width(); int h = parentSize.height(); if ( ret.width() < w ) { ret.setWidth( w ); } if ( ret.height() < h ) { ret.setHeight( h ); } return ret; }