]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/PlaneDirectionViewer.cxx
63c163f56849b4882f036414443ea554a682b868
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / PlaneDirectionViewer.cxx
1
2 #include "PlaneDirectionViewer.h"
3
4 /********************************************************************************************
5 ** Start of data viewmanagerData
6 *********************************************************************************************/
7
8
9 PlaneDirectionViewer* PlaneDirectionViewer::instance=NULL;
10
11 PlaneDirectionViewer::PlaneDirectionViewer(wxWindow* parent,int radio, double colour[3], int opacity)
12 :wxPanel(parent)
13 {
14         manager = new PlaneDirectionManager(radio, colour, opacity);    
15         wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
16         this->SetSizer(sizer);
17         this->SetAutoLayout(true);
18 }
19
20 PlaneDirectionViewer* PlaneDirectionViewer::getInstance(wxWindow* parent,int radio, double colour[3], int opacity){
21         if(instance==NULL){
22                 instance = new PlaneDirectionViewer(parent,radio,colour,opacity);
23         }
24         return instance;
25 }
26
27 PlaneDirectionViewer* PlaneDirectionViewer::getInstance(){
28         return instance;
29 }
30
31 PlaneDirectionViewer::~PlaneDirectionViewer(){
32         delete manager;
33 }
34
35 void PlaneDirectionViewer::SetRenderer(vtkRenderer* render){
36         manager->SetRenderer(render);
37 }
38
39 void PlaneDirectionViewer::SetVectors( std::vector<double> lstPointsx, std::vector<double> lstPointsy, std::vector<double> lstPointsz){
40         manager->SetVectors(lstPointsx,lstPointsy,lstPointsz);
41 }
42
43 void PlaneDirectionViewer::UpdateDirections() throw (std::exception){
44         manager->UpdateDirections();
45         std::vector<PlaneDirectionManagerData*> vectdata = manager->GetPlanesData();
46         for(int i = 0; i < viewdata.size();i++){
47                 this->GetSizer()->Remove(i);
48                 viewdata[i]->Destroy();
49         }
50         viewdata.clear();       
51         for(int i = 0; i < vectdata.size(); i++){
52                 PlaneDirectionViewerPanel* planedirview = new PlaneDirectionViewerPanel(this, vectdata[i],i);
53                 viewdata.push_back(planedirview);
54                 this->GetSizer()->Add(planedirview,1);
55         }
56         this->Layout(); 
57 }
58
59 void PlaneDirectionViewer::addRemoveActor(int index, bool addremove){
60         manager->addRemoveActor(index, addremove);
61 }
62
63 void PlaneDirectionViewer::changeColor(int index,double r,double g,double b){
64         manager->changeColor(index, r,g,b);
65 }
66
67 void PlaneDirectionViewer::WriteInformation(std::string  filename, double* spc){
68     manager->WriteInformation(filename,spc);
69 }
70
71 void PlaneDirectionViewer::SetArrowSize(int arrowsize){
72         manager->SetArrowSize(arrowsize);
73 }
74