Commit b2cd526e authored by Anatoly Baksheev's avatar Anatoly Baksheev

removed extra code

parent 84d6fe39
...@@ -63,11 +63,6 @@ void cv::viz::InteractorStyle::Initialize() ...@@ -63,11 +63,6 @@ void cv::viz::InteractorStyle::Initialize()
win_pos_ = Vec2i(0, 0); win_pos_ = Vec2i(0, 0);
max_win_size_ = Vec2i(-1, -1); max_win_size_ = Vec2i(-1, -1);
// Create the image filter and PNG writer objects
wif_ = vtkSmartPointer<vtkWindowToImageFilter>::New();
snapshot_writer_ = vtkSmartPointer<vtkPNGWriter>::New();
snapshot_writer_->SetInputConnection(wif_->GetOutputPort());
init_ = true; init_ = true;
stereo_anaglyph_mask_default_ = true; stereo_anaglyph_mask_default_ = true;
...@@ -84,11 +79,14 @@ void cv::viz::InteractorStyle::Initialize() ...@@ -84,11 +79,14 @@ void cv::viz::InteractorStyle::Initialize()
void cv::viz::InteractorStyle::saveScreenshot(const String &file) void cv::viz::InteractorStyle::saveScreenshot(const String &file)
{ {
FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]); FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]);
wif_->SetInput(Interactor->GetRenderWindow());
wif_->Modified(); // Update the WindowToImageFilter vtkSmartPointer<vtkWindowToImageFilter> wif = vtkSmartPointer<vtkWindowToImageFilter>::New();
snapshot_writer_->Modified(); wif->SetInput(Interactor->GetRenderWindow());
snapshot_writer_->SetFileName(file.c_str());
snapshot_writer_->Write(); vtkSmartPointer<vtkPNGWriter> snapshot_writer = vtkSmartPointer<vtkPNGWriter>::New();
snapshot_writer->SetInputConnection(wif->GetOutputPort());
snapshot_writer->SetFileName(file.c_str());
snapshot_writer->Write();
} }
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////
...@@ -196,21 +194,13 @@ int cv::viz::InteractorStyle::getModifiers() ...@@ -196,21 +194,13 @@ int cv::viz::InteractorStyle::getModifiers()
} }
////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////
void void cv::viz::InteractorStyle::OnKeyDown()
cv::viz::InteractorStyle::OnKeyDown()
{ {
CV_Assert("Interactor style not initialized. Please call Initialize() before continuing" && init_); CV_Assert("Interactor style not initialized. Please call Initialize() before continuing" && init_);
CV_Assert("No renderer given! Use SetRendererCollection() before continuing." && renderer_); CV_Assert("No renderer given! Use SetRendererCollection() before continuing." && renderer_);
FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]); FindPokedRenderer(Interactor->GetEventPosition()[0], Interactor->GetEventPosition()[1]);
if (wif_->GetInput() == NULL)
{
wif_->SetInput(Interactor->GetRenderWindow());
wif_->Modified();
snapshot_writer_->Modified();
}
// Save the initial windows width/height // Save the initial windows width/height
if (win_size_[0] == -1 || win_size_[1] == -1) if (win_size_[0] == -1 || win_size_[1] == -1)
win_size_ = Vec2i(Interactor->GetRenderWindow()->GetSize()); win_size_ = Vec2i(Interactor->GetRenderWindow()->GetSize());
......
...@@ -79,12 +79,6 @@ namespace cv ...@@ -79,12 +79,6 @@ namespace cv
Vec2i win_pos_; Vec2i win_pos_;
Vec2i max_win_size_; Vec2i max_win_size_;
/** \brief A PNG writer for screenshot captures. */
vtkSmartPointer<vtkPNGWriter> snapshot_writer_;
/** \brief Internal window to image filter. Needed by \a snapshot_writer_. */
vtkSmartPointer<vtkWindowToImageFilter> wif_;
/** \brief Interactor style internal method. Gets called whenever a key is pressed. */ /** \brief Interactor style internal method. Gets called whenever a key is pressed. */
virtual void OnChar(); virtual void OnChar();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment