Esempio n. 1
0
GlyphMappingData::GlyphMappingData(RenderedData & renderedData)
    : m_renderedData{ renderedData }
    , m_isVisible{ false }
    , m_actor{ vtkSmartPointer<vtkActor>::New() }
    , m_colorMappingData{ nullptr }
    , m_isValid{ false }
{
    auto lineArrow = vtkSmartPointer<vtkLineSource>::New();
    lineArrow->SetPoint1(0.f, 0.f, 0.f);
    lineArrow->SetPoint2(1.f, 0.f, 0.f);
    m_arrowSources.emplace(Representation::Line, lineArrow);

    m_arrowSources.emplace(Representation::SimpleArrow, createSimpleArrow());

    auto cylindricArrow = vtkSmartPointer<vtkArrowSource>::New();
    m_arrowSources.emplace(Representation::CylindricArrow, cylindricArrow);
    cylindricArrow->SetShaftRadius(0.02);
    cylindricArrow->SetTipRadius(0.07);
    cylindricArrow->SetTipLength(0.3);

    m_arrowGlyph = vtkSmartPointer<vtkGlyph3D>::New();
    m_arrowGlyph->ScalingOn();
    m_arrowGlyph->SetScaleModeToDataScalingOff();
    m_arrowGlyph->OrientOn();
    DataBounds bounds;
    auto processedData = renderedData.dataObject().processedOutputDataSet();
    if (!processedData)
    {
        qWarning() << "Pipeline failure in glyph mapping on data set"
            << renderedData.dataObject().name();
        return;
    }
    processedData->GetBounds(bounds.data());
    const double maxBoundsSize = maxComponent(bounds.componentSize());
    m_arrowGlyph->SetScaleFactor(maxBoundsSize * 0.1);

    setRepresentation(Representation::CylindricArrow);

    m_mapper = vtkSmartPointer<vtkPolyDataMapper>::New();
    m_mapper->UseLookupTableScalarRangeOn();
    m_mapper->SetInputConnection(m_arrowGlyph->GetOutputPort());
    m_mapper->ScalarVisibilityOff();

    AbstractVisualizedData::setupInformation(*m_mapper->GetInformation(), renderedData);

    m_actor->SetVisibility(m_isVisible);
    m_actor->PickableOff();
    m_actor->SetMapper(m_mapper);

    m_isValid = true;
}
Esempio n. 2
0
std::vector<ValueRange<>> PointCoordinateColorMapping::updateBounds()
{
    DataBounds dataSetBounds;
    DataBounds totalBounds;

    for (auto vis: m_visualizedData)
    {
        for (int port = 0; port < vis->numberOfColorMappingInputs(); ++port)
        {
            if (auto polyData = vtkPolyData::SafeDownCast(vis->colorMappingInputData(port)))
            {
                polyData->GetBounds(dataSetBounds.data());
                totalBounds.add(dataSetBounds);
            }
        }
    }

    return{
        totalBounds.extractDimension(0),
        totalBounds.extractDimension(1),
        totalBounds.extractDimension(2),
    };
}
Esempio n. 3
0
DataBounds RenderedImageData::updateVisibleBounds()
{
    DataBounds bounds;
    colorMappingInputData()->GetBounds(bounds.data());
    return bounds;
}
Esempio n. 4
0
DataBounds RenderedPolyData::updateVisibleBounds()
{
    DataBounds bounds;
    mainActor()->GetBounds(bounds.data());
    return bounds;
}