void LinkConnectionGraphicsItem::showToolTip(QGraphicsSceneHelpEvent* e) {
    Processor* p1 = inLink_->getProcessorGraphicsItem()->getProcessor();
    Processor* p2 = outLink_->getProcessorGraphicsItem()->getProcessor();

    auto propertyLinks =
        InviwoApplication::getPtr()->getProcessorNetwork()->getLinksBetweenProcessors(p1, p2);

    // collect all links based on their direction

    std::vector<PropertyLink> bidirectional;
    std::vector<PropertyLink> outgoing;  // from processor 1
    std::vector<PropertyLink> incoming;  // toward processor 1

    for (const auto& propertyLink : propertyLinks) {
        Processor* linkSrc =
            dynamic_cast<Processor*>(propertyLink.getSource()->getOwner()->getProcessor());

        if (linkSrc == p1) {
            // forward link
            auto sit = std::find_if(incoming.begin(), incoming.end(),
                                    LinkConnectionGraphicsItemMatchReverse(propertyLink));
            if (sit != incoming.end()) {
                bidirectional.push_back(propertyLink);
                incoming.erase(sit);
            } else {
                outgoing.push_back(propertyLink);
            }
        } else {  // if (linkSrc == processorB)
            auto sit = std::find_if(outgoing.begin(), outgoing.end(),
                                    LinkConnectionGraphicsItemMatchReverse(propertyLink));
            if (sit != outgoing.end()) {
                bidirectional.push_back(propertyLink);
                outgoing.erase(sit);
            } else {
                incoming.push_back(propertyLink);
            }
        }
    }

    // set up a HTML table containing three columns:
    //    props of outProcesser, link indicator, props of inProcessor
    std::string info =
        "<html><head/><body style=''>\
           <table border='0' cellspacing='2' cellpadding='0' style='border-color:white;white-space:pre;'>";
    // put in the table header consisting of both processor names
    info += "<tr style='color:#bbb;font-weight:bold;'><td align='center'>" + p1->getIdentifier() +
            "</td><td align='center'></td><td align='center'>" + p2->getIdentifier() + "</td></tr>";

    // add outgoing links first
    info.append(getLinkInfoTableRows(outgoing, ":/icons/linkarrow_right.png"));
    // add bidirectional links
    info.append(getLinkInfoTableRows(bidirectional, ":/icons/linkarrow_bidirectional.png"));
    // add incoming links
    info.append(getLinkInfoTableRows(incoming, ":/icons/linkarrow_left.png"));

    info.append("</table></body></html>");

    showToolTipHelper(e, QString(info.c_str()));
}
示例#2
0
void ProcessorGraphicsItem::showToolTip(QGraphicsSceneHelpEvent* e) {
    ToolTipHelper t(processor_->getDisplayName());
    t.row("Identifier", processor_->getIdentifier());
    t.row("Class", processor_->getClassIdentifier());
    t.row("Category", processor_->getCategory());
    t.row("Code", Processor::getCodeStateString(processor_->getCodeState()));
    t.row("Tags", processor_->getTags().getString());

#if IVW_PROFILING
    t.row("Ready", processor_->isReady()?"Yes":"No");
    t.row("Eval Count", processCount_);
    t.row("Eval Time", evalTime_);
    t.row("Mean Time", totEvalTime_/ std::max(static_cast<double>(processCount_), 1.0));
    t.row("Max Time", maxEvalTime_);
#endif

    showToolTipHelper(e, utilqt::toLocalQString(t));
}