Exemplo n.º 1
0
void RenderView::closeEvent(QCloseEvent * event)
{
    m_closingRequested = true;

    // remove all visualization and reset to null implementation to correctly cleanup OpenGL states
    prepareDeleteData(dataObjects());
    updateImplementation({});

    AbstractRenderView::closeEvent(event);
}
Exemplo n.º 2
0
 /// \brief update the design variable.
 void DesignVariable::update(const double* dp, int size)
 {
   // scale the design variable:
   updateImplementation(dp, size);
 }
Exemplo n.º 3
0
void RenderView::initializeRenderContext()
{
    assert(m_contents.empty() && m_contentCache.empty());
    updateImplementation({});
}
Exemplo n.º 4
0
void RenderView::showDataObjectsImpl(const QList<DataObject *> & uncheckedDataObjects, QList<DataObject *> & incompatibleObjects, unsigned int /*subViewIndex*/)
{
    if (uncheckedDataObjects.isEmpty())
    {
        return;
    }

    const bool wasEmpty = m_contents.empty();

    if (wasEmpty)
    {
        updateImplementation(uncheckedDataObjects);
    }

    AbstractVisualizedData * aNewObject = nullptr;

    const auto && dataObjects = implementation().filterCompatibleObjects(uncheckedDataObjects, incompatibleObjects);

    if (dataObjects.isEmpty())
    {
        return;
    }

    for (auto dataObject : dataObjects)
    {
        auto previouslyRendered = m_dataObjectToVisualization.value(dataObject);

        // create new rendered representation
        if (!previouslyRendered)
        {
            aNewObject = addDataObject(dataObject);

            if (m_closingRequested) // just abort here, if we processed a close event while addDataObject()
            {
                return;
            }

            continue;
        }

        // reuse currently rendered / cached data

        auto contensIt = findUnique(m_contents, previouslyRendered);
        if (contensIt != m_contents.end())
        {
            continue;
        }

        aNewObject = previouslyRendered;

        auto cacheIt = findUnique(m_contentCache, previouslyRendered);
        m_contents.push_back(std::move(*cacheIt));
        m_contentCache.erase(cacheIt);

        previouslyRendered->setVisible(true);
    }

    if (aNewObject)
    {
        implementation().renderViewContentsChanged();

        updateGuiForSelectedData(aNewObject);

        emit visualizationsChanged();
    }

    if (aNewObject)
    {
        implementation().resetCamera(wasEmpty, 0);
    }

    resetFriendlyName();
    updateTitle();
}