00001
00002 #include "PlaneDirectionViewer.h"
00003
00004
00005
00006
00007
00008
00009 PlaneDirectionViewer* PlaneDirectionViewer::instance=NULL;
00010
00011 PlaneDirectionViewer::PlaneDirectionViewer(wxWindow* parent,int radio, double colour[3], int opacity)
00012 :wxPanel(parent)
00013 {
00014 manager = new PlaneDirectionManager(radio, colour, opacity);
00015 wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
00016 this->SetSizer(sizer);
00017 this->SetAutoLayout(true);
00018
00019 }
00020
00021
00022 PlaneDirectionViewer* PlaneDirectionViewer::getInstance(wxWindow* parent,int radio, double colour[3], int opacity){
00023 if(instance==NULL){
00024 instance = new PlaneDirectionViewer(parent,radio,colour,opacity);
00025 }
00026 return instance;
00027 }
00028
00029 PlaneDirectionViewer* PlaneDirectionViewer::getInstance(){
00030 return instance;
00031 }
00032
00033 PlaneDirectionViewer::~PlaneDirectionViewer(){
00034 delete manager;
00035 }
00036
00037 void PlaneDirectionViewer::SetRenderer(vtkRenderer* render){
00038 manager->SetRenderer(render);
00039 }
00040 void PlaneDirectionViewer::SetVectors( std::vector<double> lstPointsx, std::vector<double> lstPointsy, std::vector<double> lstPointsz){
00041 manager->SetVectors(lstPointsx,lstPointsy,lstPointsz);
00042 }
00043
00044 void PlaneDirectionViewer::UpdateDirections() throw (std::exception){
00045 manager->UpdateDirections();
00046 std::vector<PlaneDirectionManagerData*> vectdata = manager->GetPlanesData();
00047 for(int i = 0; i < viewdata.size();i++){
00048 this->GetSizer()->Remove(i);
00049 viewdata[i]->Destroy();
00050 }
00051 viewdata.clear();
00052 for(int i = 0; i < vectdata.size(); i++){
00053 PlaneDirectionViewerPanel* planedirview = new PlaneDirectionViewerPanel(this, vectdata[i],i);
00054 viewdata.push_back(planedirview);
00055 this->GetSizer()->Add(planedirview,1);
00056 }
00057 this->Layout();
00058
00059 }
00060
00061 void PlaneDirectionViewer::addRemoveActor(int index, bool addremove){
00062 manager->addRemoveActor(index, addremove);
00063 }
00064
00065 void PlaneDirectionViewer::changeColor(int index,double r,double g,double b){
00066 manager->changeColor(index, r,g,b);
00067 }
00068
00069 void PlaneDirectionViewer::WriteInformation(std::string filename, double* spc){
00070 manager->WriteInformation(filename,spc);
00071 }
00072
00073 void PlaneDirectionViewer::SetArrowSize(int arrowsize){
00074 manager->SetArrowSize(arrowsize);
00075
00076 }