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); }
std::unique_ptr<AbstractVisualizedData> RendererImplementationBase3D::requestVisualization(DataObject & dataObject) const { auto rendered = dataObject.createRendered(); const auto & coordinateSystem = renderView().currentCoordinateSystem(); if (coordinateSystem.isValid()) { rendered->setDefaultCoordinateSystem(coordinateSystem); } return std::move(rendered); }
void RendererImplementationBase3D::applyCurrentCoordinateSystem(const CoordinateSystemSpecification & spec) { const auto contents = renderView().visualizations(); for (auto visualization : contents) { auto rendered = static_cast<RenderedData *>(visualization); rendered->setDefaultCoordinateSystem(spec); } updateAxisLabelFormat(spec); updateBounds(); for (unsigned int i = 0; i < renderView().numberOfSubViews(); ++i) { resetCamera(true, i); } }