#include <vtkSmartPointer.h>
#include <vtkDataSet.h>
#include <vtkPolygon.h>
-#include <vtkPointPicker.h>
+//#include <vtkPointPicker.h>
#include <vtkUnstructuredGrid.h>
#include <vtkDiskSource.h>
#include <vtkPlaneSource.h>
#include <vtkCamera.h>
#include <vtkObjectFactory.h>
#include <vtkPlanes.h>
-#include <vtkImageViewer.h>
#include <vtkImageFlip.h>
#include <vtkRenderWindow.h>
#include <vtkTextProperty.h>
#include <vtkTextureMapToPlane.h>
#include <vtkPolyDataNormals.h>
#include <vtkAlgorithmOutput.h>
+#include <vtkImageMapper.h>
#if defined __GNUC__ && defined __DEPRECATED_DISABLED__
#define __DEPRECATED
{
typedef std::map<String, vtkSmartPointer<vtkProp> > WidgetActorMap;
typedef std::map<String, Viz3d> VizMap;
- typedef std::pair<String, Viz3d> VizPair;
class VizStorage
{
}
}
-#include "interactor_style.h"
+#include "interactor_style.hpp"
#include "viz3d_impl.hpp"
timer_id_ = interactor_->CreateRepeatingTimer(5000L);
// Set a simple PointPicker
- vtkSmartPointer<vtkPointPicker> pp = vtkSmartPointer<vtkPointPicker>::New();
- pp->SetTolerance(pp->GetTolerance() * 2);
- interactor_->SetPicker(pp);
+ //vtkSmartPointer<vtkPointPicker> pp = vtkSmartPointer<vtkPointPicker>::New();
+ //pp->SetTolerance(pp->GetTolerance() * 2);
+ //interactor_->SetPicker(pp);
exit_main_loop_timer_callback_ = vtkSmartPointer<ExitMainLoopTimerCallback>::New();
exit_main_loop_timer_callback_->viz_ = this;
//////////////////////////////
- String window_name;
- VizAccessor::generateWindowName(name, window_name);
+ String window_name = VizStorage::generateWindowName(name);
window_->SetWindowName(window_name.c_str());
}
return false;
}
-/////////////////////////////////////////////////////////////////////////////////////////////
-void cv::viz::Viz3d::VizImpl::createActorFromVTKDataSet(const vtkSmartPointer<vtkDataSet> &data, vtkSmartPointer<vtkLODActor> &actor, bool use_scalars)
-{
- if (!actor)
- actor = vtkSmartPointer<vtkLODActor>::New();
-
- vtkSmartPointer<vtkDataSetMapper> mapper = vtkSmartPointer<vtkDataSetMapper>::New();
-#if VTK_MAJOR_VERSION <= 5
- mapper->SetInput(data);
-#else
- mapper->SetInputData(data);
-#endif
-
- if (use_scalars)
- {
- vtkSmartPointer<vtkDataArray> scalars = data->GetPointData()->GetScalars();
- if (scalars)
- {
- cv::Vec3d minmax(scalars->GetRange());
- mapper->SetScalarRange(minmax.val);
- mapper->SetScalarModeToUsePointData();
-
- // interpolation OFF, if data is a vtkPolyData that contains only vertices, ON for anything else.
- vtkPolyData* polyData = vtkPolyData::SafeDownCast(data);
- bool interpolation = (polyData && polyData->GetNumberOfCells() != polyData->GetNumberOfVerts());
-
- mapper->SetInterpolateScalarsBeforeMapping(interpolation);
- mapper->ScalarVisibilityOn();
- }
- }
- mapper->ImmediateModeRenderingOff();
-
- actor->SetNumberOfCloudPoints(int(std::max<vtkIdType>(1, data->GetNumberOfPoints() / 10)));
- actor->GetProperty()->SetInterpolationToFlat();
- actor->GetProperty()->BackfaceCullingOn();
-
- actor->SetMapper(mapper);
-}
-
//////////////////////////////////////////////////////////////////////////////////////////////
void cv::viz::Viz3d::VizImpl::setBackgroundColor(const Color& color)
{
}
}
-//////////////////////////////////////////////////////////////////////////////////////////////
-void cv::viz::Viz3d::VizImpl::updateCells(vtkSmartPointer<vtkIdTypeArray> &cells, vtkSmartPointer<vtkIdTypeArray> &initcells, vtkIdType nr_points)
-{
- // If no init cells and cells has not been initialized...
- if (!cells)
- cells = vtkSmartPointer<vtkIdTypeArray>::New();
-
- // If we have less values then we need to recreate the array
- if (cells->GetNumberOfTuples() < nr_points)
- {
- cells = vtkSmartPointer<vtkIdTypeArray>::New();
-
- // If init cells is given, and there's enough data in it, use it
- if (initcells && initcells->GetNumberOfTuples() >= nr_points)
- {
- cells->DeepCopy(initcells);
- cells->SetNumberOfComponents(2);
- cells->SetNumberOfTuples(nr_points);
- }
- else
- {
- // If the number of tuples is still too small, we need to recreate the array
- cells->SetNumberOfComponents(2);
- cells->SetNumberOfTuples(nr_points);
- vtkIdType *cell = cells->GetPointer(0);
- // Fill it with 1s
- std::fill(cell, cell + nr_points * 2, 1);
- cell++;
- for (vtkIdType i = 0; i < nr_points; ++i, cell += 2)
- *cell = i;
- // Save the results in initcells
- initcells = vtkSmartPointer<vtkIdTypeArray>::New();
- initcells->DeepCopy(cells);
- }
- }
- else
- {
- // The assumption here is that the current set of cells has more data than needed
- cells->SetNumberOfComponents(2);
- cells->SetNumberOfTuples(nr_points);
- }
-}
//////////////////////////////////////////////////////////////////////////////////////////////
void cv::viz::Viz3d::VizImpl::setFullScreen(bool mode)