Пример #1
0
void RenderView::lookAtData(const VisualizationSelection & selection, int DEBUG_ONLY(subViewIndex))
{
    assert(subViewIndex == 0 || subViewIndex == -1);
    assert(containsUnique(m_contents, selection.visualization));

    implementation().lookAtData(selection, 0u);
}
Пример #2
0
void DataMapping::removeDataObjects(const QList<DataObject *> & dataObjects)
{
    // copy, as this list can change while we are processing it
    // e.g., deleting an image -> delete related plots -> close related plot renderer
    const auto currentRenderViews = [this] ()
    {
        std::vector<AbstractRenderView *> views;
        for (auto && it : m_renderViews)
        {
            views.push_back(it.get());
        }
        return views;
    }();
    const auto currentTableViews = [this] ()
    {
        std::vector<TableView *> views;
        for (auto && it : m_tableViews)
        {
            views.push_back(it.get());
        }
        return views;
    }();


    for (auto renderView : currentRenderViews)
    {
        if (containsUnique(m_renderViews, renderView))
        {
            renderView->prepareDeleteData(dataObjects);
        }

    }

    for (auto tableView : currentTableViews)
    {
        if (containsUnique(m_tableViews, tableView)
            && dataObjects.contains(tableView->dataObject()))
        {
            tableView->close();
        }
    }
}
Пример #3
0
int RenderView::subViewContaining(const AbstractVisualizedData & visualizedData) const
{
    // single view implementation: if we currently show it, it's in the view 0

    if (containsUnique(m_contents, &visualizedData))
    {
        return 0;
    }

    return -1;
}
Пример #4
0
bool DataMapping::addToRenderView(const QList<DataObject *> & dataObjects, AbstractRenderView * renderView, unsigned int subViewIndex)
{
    assert(containsUnique(m_renderViews, renderView));
    assert(subViewIndex < renderView->numberOfSubViews());

    QList<DataObject *> incompatibleObjects;
    renderView->showDataObjects(dataObjects, incompatibleObjects, subViewIndex);

    // RenderView::showDataObjects triggers QApplication::processEvents(), so the view might be closed again
    // in that case, the user probably wants to abort his last action or close the app
    // so abort everything from here
    if (!containsUnique(m_renderViews, renderView))
    {
        return false;
    }

    // there is something the current view couldn't handle
    if (!incompatibleObjects.isEmpty() && askForNewRenderView(renderView->friendlyName(), incompatibleObjects))
    {
        openInRenderView(incompatibleObjects);
    }

    return true;
}
Пример #5
0
void RenderView::hideDataObjectsImpl(const QList<DataObject *> & dataObjects, int /*suViewIndex*/)
{
    bool changed = false;
    for (auto dataObject : dataObjects)
    {
        auto rendered = m_dataObjectToVisualization.value(dataObject);
        if (!rendered)
        {
            continue;
        }

        // cached data is only accessible internally in the view, so let others know that it's gone for the moment
        emit beforeDeleteVisualizations({ rendered });

        // move data to cache if it isn't already invisible
        auto contentsIt = findUnique(m_contents, rendered);
        if (contentsIt != m_contents.end())
        {
            m_contentCache.push_back(std::move(*contentsIt));
            m_contents.erase(contentsIt);

            rendered->setVisible(false);

            changed = true;
        }
        assert(!containsUnique(m_contents, (AbstractVisualizedData*)nullptr));
    }

    if (!changed)
    {
        return;
    }

    resetFriendlyName();

    updateGuiForRemovedData();

    implementation().renderViewContentsChanged();

    emit visualizationsChanged();

    render();
}