1 /*# ---------------------------------------------------------------------
3 # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image
5 # Authors : Eduardo Davila, Frederic Cervenansky, Claire Mouton
6 # Previous Authors : Laurent Guigues, Jean-Pierre Roux
7 # CreaTools website : www.creatis.insa-lyon.fr/site/fr/creatools_accueil
9 # This software is governed by the CeCILL-B license under French law and
10 # abiding by the rules of distribution of free software. You can use,
11 # modify and/ or redistribute the software under the terms of the CeCILL-B
12 # license as circulated by CEA, CNRS and INRIA at the following URL
13 # http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
14 # or in the file LICENSE.txt.
16 # As a counterpart to the access to the source code and rights to copy,
17 # modify and redistribute granted by the license, users are provided only
18 # with a limited warranty and the software's author, the holder of the
19 # economic rights, and the successive licensors have only limited
22 # The fact that you are presently reading this means that you have had
23 # knowledge of the CeCILL-B license and that you accept its terms.
24 # ------------------------------------------------------------------------ */
26 #include "PointView.h"
29 // ----------------------------------------------------------------------------
30 // ----------------------------------------------------------------------------
31 // ----------------------------------------------------------------------------
33 PointView::PointView()
35 _wxvtkbaseview = NULL;
38 // ----------------------------------------------------------------------------
39 PointView::~PointView()
44 // ----------------------------------------------------------------------------
45 void PointView::DeletePoints()
52 // ----------------------------------------------------------------------------
53 void PointView::SetWxVtkBaseView(wxVtkBaseView *wxvtkbaseview)
55 _wxvtkbaseview = wxvtkbaseview;
58 // ----------------------------------------------------------------------------
59 void PointView::Refresh()
61 _wxvtkbaseview->GetRenWin()->Render();
64 // ----------------------------------------------------------------------------
65 void PointView::CreateNewPoint(double x, double y, int type)
67 vtkSphereSource* aSphere =vtkSphereSource::New();
68 aSphere->SetRadius(1);
69 aSphere->SetCenter(x,y,0);
71 point_mapped.push_back(vtkPolyDataMapper::New());
72 // point_mapped.back()->ImmediateModeRenderingOn();
73 //point_mapped.back()->ScalarVisibilityOff( );
76 //EED 2017-01-01 Migration VTK7
77 #if VTK_MAJOR_VERSION <= 5
78 point_mapped.back()->SetInput(aSphere->GetOutput());
80 point_mapped.back()->SetInputData(aSphere->GetOutput());
83 point_actor.push_back(vtkActor::New());
84 point_actor.back()->SetMapper(point_mapped.back());
85 // point_actor.back()->GetProperty()->BackfaceCullingOff();
89 case PointView::BLUE : point_actor.back()->GetProperty()->SetColor(0, 0, 1);
91 case PointView::MAGENTA : point_actor.back()->GetProperty()->SetColor(1, 0, 1);
93 case PointView::GREEN : point_actor.back()->GetProperty()->SetColor(0, 1, 0);
95 case PointView::YELLOW : point_actor.back()->GetProperty()->SetColor(0, 1, 1);
97 default: point_actor.back()->GetProperty()->SetColor(0, 0, 1);
101 //point_actor.back()->GetProperty()->SetColor(0, 1, 0);
103 point_actor.back()->ApplyProperties();
105 _wxvtkbaseview->GetRenderer()->AddActor(point_actor.back());
106 _wxvtkbaseview->GetRenWin()->Render();
109 // ----------------------------------------------------------------------------
110 void PointView::DeleteVtkObjects()
112 int i,size=point_mapped.size();
113 for (i=0;i<size; i++){
114 if ( point_mapped[i] != NULL ) {
115 point_mapped[i] -> Delete();
117 if ( point_actor[i] != NULL ) {
118 _wxvtkbaseview->GetRenderer()->RemoveActor(point_actor[i]);
119 point_actor[i] -> Delete();
121 point_actor[i] = NULL;
122 point_mapped[i] = NULL;