Esempio n. 1
0
void RendererImplementationPlot::handlePlotSelectionEvent(vtkObject * DEBUG_ONLY(subject), unsigned long /*eventId*/, void * callData)
{
    assert(subject == m_chart.Get());

    auto plot = reinterpret_cast<vtkPlot *>(callData);

    if (!plot)
    {
        m_renderView.clearSelection();
        return;
    }

    auto contextData = contextDataContaining(*plot);
    assert(contextData);

    auto selection = VisualizationSelection(
        contextData,
        contextData->defaultVisualizationPort(),
        IndexType::points);

    if (auto indexArray = plot->GetSelection())
    {
        selection.indices.resize(indexArray->GetNumberOfValues());
        for (vtkIdType i = 0; i < indexArray->GetNumberOfValues(); ++i)
        {
            selection.indices[static_cast<size_t>(i)] = indexArray->GetValue(i);
        }
    }

    m_selectedPlot = contextData;

    m_renderView.setVisualizationSelection(selection);
}
Esempio n. 2
0
void Highlighter::clear()
{
    clearIndices();

    setTargetInternal(VisualizationSelection());

    m_renderer = nullptr;
}
Esempio n. 3
0
void RenderView::lookAtData(const DataSelection & selection, int subViewIndex)
{
    auto vis = m_dataObjectToVisualization.value(selection.dataObject, nullptr);
    if (!vis)
    {
        return;
    }

    lookAtData(VisualizationSelection(
        selection, 
        vis,
        0), // TODO how to find the correct visualization output port?
        subViewIndex);
}
Esempio n. 4
0
void AbstractRenderView::onSetSelection(const DataSelection & selection)
{
    assert(selection.dataObject && dataObjects().contains(selection.dataObject));

    const auto vis = visualizationFor(selection.dataObject);
    assert(vis);

    auto && newVisSelection = VisualizationSelection(
        selection,
        vis,
        vis->defaultVisualizationPort()
    );

    setVisualizationSelection(newVisSelection);
}
Esempio n. 5
0
void RenderView::updateGuiForSelectedData(AbstractVisualizedData * renderedData)
{
    updateTitle();

    if (visualzationSelection().visualization != renderedData)
    {
        if (renderedData)
        {
            setVisualizationSelection(VisualizationSelection(renderedData));
        }
        else
        {
            clearSelection();
        }
    }
}
Esempio n. 6
0
void RendererImplementationBase3D::dataVisibilityChanged(RenderedData * rendered, unsigned int subViewIndex)
{
    assert(rendered);

    if (rendered->isVisible())
    {
        addToBounds(rendered, subViewIndex);
        connect(&rendered->dataObject(), &DataObject::boundsChanged, this, &RendererImplementationBase3D::updateBounds);
    }
    else
    {
        removeFromBounds(rendered, subViewIndex);
        disconnect(&rendered->dataObject(), &DataObject::boundsChanged, this, &RendererImplementationBase3D::updateBounds);
    }

    // If the object is currently removed, it's not yet removed from the list
    const auto && currentObjects = renderView().dataObjects();
    const bool isEmpty = currentObjects.isEmpty() ||
        (!rendered->isVisible()
            && currentObjects.size() == 1
            && currentObjects.front() == &rendered->dataObject());

    m_pickerHighlighter->SetEnabled(!isEmpty);

    if (rendered->isVisible())
    {
        // If there isn't any selected target and rendered is visible, use rendered as the currently
        // active object. This is the one the user most recently worked with.
        if (!selection().visualization)
        {
            m_renderView.setVisualizationSelection(VisualizationSelection(rendered));
        }
    }
    else if (selection().visualization == rendered)
    {
        // If the current object is selected but not visible anymore, clear the selection
        m_renderView.clearSelection();
    }

    onDataVisibilityChanged(rendered, subViewIndex);

    renderer(subViewIndex)->ResetCamera();
}