Beispiel #1
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 #2
0
TEST_F(CoordinateTransformableDataObject_test, coordsPassToProcessedFieldData)
{
    auto dataObject = genPolyData();

    const auto coordsSpec = ReferencedCoordinateSystemSpecification(
        CoordinateSystemType::geographic,
        "testGeoSystem",
        "testMetricSystem",
        "",
        { 100, 200 }, { 0.2, 0.3 });

    dataObject->specifyCoordinateSystem(coordsSpec);

    auto processedDataSet = dataObject->processedDataSet();
    const auto passedSpec = ReferencedCoordinateSystemSpecification::fromFieldData(*processedDataSet->GetFieldData());

    ASSERT_EQ(coordsSpec, passedSpec);
}
Beispiel #3
0
TEST_F(CoordinateTransformableDataObject_test, PersistentCoordsSpec_PolyData)
{
    auto dataObject = genPolyData();

    const auto coordsSpec = ReferencedCoordinateSystemSpecification(
        CoordinateSystemType::geographic,
        "testGeoSystem",
        "testMetricSystem",
        "",
        { 100, 200 }, { 0.2, 0.3 });

    dataObject->specifyCoordinateSystem(coordsSpec);

    const auto fileName = QDir(TestEnvironment::testDirPath()).filePath("PersistentCoordsSpec.vtp");

    ASSERT_TRUE(Exporter::exportData(*dataObject, fileName));
    auto readDataObject = Loader::readFile<CoordinateTransformableDataObject>(fileName);
    ASSERT_TRUE(readDataObject);

    ASSERT_EQ(coordsSpec, readDataObject->coordinateSystem());
}