Exemplo n.º 1
0
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;
    }
Exemplo n.º 2
0
void PortionDrawer::drawNodeText(DiagramDrawer &drawer, bool drawVirts,
    std::vector<DrawString> const &drawStrings, std::vector<bool> const &virtOpers)
    {
    for(size_t i=0; i<drawStrings.size(); i++)
        {
        if(drawVirts == virtOpers[i])
            {
            drawer.drawText(drawStrings[i].pos, drawStrings[i].str);
            }
        }
    }
Exemplo n.º 3
0
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);
    }