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::drawOperation(DiagramDrawer &drawer, GraphPoint pos, OperationDefinition &operDef, const OperationGraph &graph, const OperationDrawOptions &options, std::set<const OperationDefinition*> &drawnOperations, bool draw) { std::vector<DrawString> drawStrings; if(draw) { drawer.groupShapes(true, Color(0,0,0), Color(245,245,255)); } GraphSize size = drawOperationNoText(drawer, pos, operDef, graph, options, drawnOperations, drawStrings, draw); if(draw) { drawer.groupShapes(false, Color(0,0,0), Color(245,245,255)); drawer.groupText(true, false); for(size_t i=0; i<drawStrings.size(); i++) { drawer.drawText(drawStrings[i].pos, drawStrings[i].str); } drawer.groupText(false, false); } return size; }
GraphSize OperationDrawer::drawClass(DiagramDrawer &drawer, const OperationClass &node, const OperationDrawOptions & /*options*/, bool draw) { GraphPoint startpos = node.getPosition(); const ModelType *type = node.getType(); OovStringRef const typeName = type->getName(); int rectx = 0; int recty = 0; const ModelClassifier *classifier = type->getClass(); if(classifier) { if(draw) { drawer.groupText(true, false); } OovStringVec strs; std::vector<GraphPoint> positions; strs.push_back(typeName); splitStrings(strs, 30, 40); for(auto const &str : strs) { recty += mCharHeight + (mPad * 2); positions.push_back(GraphPoint(startpos.x+mPad, startpos.y + recty - mPad)); int curx = static_cast<int>(drawer.getTextExtentWidth(str)) + mPad*2; if(curx > rectx) rectx = curx; } if(draw) { drawer.groupShapes(true, Color(0,0,0), Color(245,245,255)); drawer.drawRect(GraphRect(startpos.x, startpos.y, rectx, recty)); drawer.groupShapes(false, Color(0,0,0), Color(245,245,255)); for(size_t i=0; i<strs.size(); i++) { drawer.drawText(positions[i], strs[i]); } drawer.groupText(false, false); } } return GraphSize(rectx, recty); }