Beispiel #1
0
TEST_F(CoordinateTransformableDataObject_test, TransformAppliedToVisibleBounds)
{
    const auto coordsSpec = ReferencedCoordinateSystemSpecification(
        CoordinateSystemType::geographic,
        "testSystem",
        {}, {}, {}, {});
    const auto targetCoordsSpec = ReferencedCoordinateSystemSpecification(
        CoordinateSystemType::geographic,
        "otherTestSystem",
        {}, {}, {}, {});

    auto data = genPolyData<TransformedPolyData>();
    data->specifyCoordinateSystem(coordsSpec);
    auto transform = vtkSmartPointer<vtkTransform>::New();
    transform->Translate(3, 4, 5);
    data->setTransform(transform);

    const auto dataSetBounds = DataBounds(data->dataSet()->GetBounds());
    const auto dataBounds = data->bounds();
    const auto shiftedBounds = data->bounds().shifted(vtkVector3d(3, 4, 5));
    auto rendered = data->createRendered();
    rendered->setDefaultCoordinateSystem(targetCoordsSpec);
    const auto visibleBounds = rendered->visibleBounds();

    ASSERT_EQ(dataSetBounds, dataBounds);
    ASSERT_EQ(shiftedBounds, visibleBounds);
}
Beispiel #2
0
TEST_F(GlyphColorMapping_test, GlyphMagnitudeColorMappingCreated)
{
    auto poly = genPolyData();
    auto rendered = poly->createRendered();
    auto rendered3D = dynamic_cast<RenderedData3D *>(rendered.get());
    assert(rendered3D);

    auto glyphMappings = rendered3D->glyphMapping().vectors();
    auto vecGlyphMappingIt = std::find_if(glyphMappings.begin(), glyphMappings.end(),
        [] (GlyphMappingData * glyphMappingData)
    {
        assert(glyphMappingData);
        return glyphMappingData->name() == GlyphColorMapping_test::vectorName();
    });
    ASSERT_NE(glyphMappings.end(), vecGlyphMappingIt);

    auto vecGlyphMapping = *vecGlyphMappingIt;
    vecGlyphMapping->setVisible(true);

    auto & colorMapping = rendered3D->colorMapping();

    ASSERT_TRUE(colorMapping.scalarsNames().contains(glyphMagnitudeColorMappingName()));
    colorMapping.setCurrentScalarsByName(glyphMagnitudeColorMappingName(), true);

    auto glyphColorMapping = dynamic_cast<GlyphMagnitudeColorMapping *>(&colorMapping.currentScalars());
    ASSERT_TRUE(glyphColorMapping);
}
Beispiel #3
0
TEST_F(CoordinateTransformableDataObject_test, NullTransformKeepsBounds)
{
    auto data = genPolyData<TransformedPolyData>();
    const auto dataSetBounds = DataBounds(data->dataSet()->GetBounds());
    const auto dataBounds = data->bounds();
    const auto visibleBounds = data->createRendered()->visibleBounds();

    ASSERT_EQ(dataSetBounds, dataBounds);
    ASSERT_EQ(dataBounds, visibleBounds);
}