~ubuntu-branches/ubuntu/trusty/ginkgocadx/trusty

« back to all changes in this revision

Viewing changes to src/visualizator/visualizator/wxvtk/gvistacompleja.cpp

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2013-07-21 11:58:53 UTC
  • mfrom: (7.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20130721115853-44e7n1xujqglu78e
Tags: 3.4.0.928.29+dfsg-1
* New upstream release [July 2013]
  + new B-D: "libjsoncpp-dev".
  + new patch "unbundle-libjsoncpp.patch" to avoid building bundled
    "libjsoncpp-dev".
  + new patch "fix-wx.patch" to avoid FTBFS due to missing
    "-lwx_gtk2u_html-2.8".
* Removed unnecessary versioned Build-Depends.
* Removed obsolete lintian override.
* Reference get-orig-source implementation for orig.tar clean-up and
  DFSG-repackaging.
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
#include <api/imodelointegracion.h>
55
55
#include <api/controllers/imodulecontroller.h>
56
56
#include <api/controllers/icontroladorpermisos.h>
57
 
#include <api/controllers/icommandscontroller.h>
 
57
#include <main/controllers/commandcontroller.h>
58
58
#include <main/controllers/hangingprotocolcontroller.h>
59
59
 
60
60
#include <main/entorno.h>
313
313
 
314
314
        void SetSlice(int slicenum)
315
315
        {
316
 
                return GView->GoToSlice(slicenum, false);
 
316
                int tsize = GView->IVista->VisualizatorStudy->GetTSizeActive();
 
317
 
 
318
                if (tsize == 1) {
 
319
                        GView->GoToSlice(slicenum, false);
 
320
                }
 
321
                else {
 
322
                        bool ok = true;
 
323
                        for(GVistaCompleja::TListaGVistasSimples::iterator it = GView->m_VistasSimples.begin(); it != GView-> m_VistasSimples.end(); ++it) {
 
324
                                GVistaSimple* vs = *it;
 
325
                                vs->GoToTSlice(slicenum, false);
 
326
                        }
 
327
                }
317
328
        }
318
329
 
319
330
        int GetSlice() const
320
331
        {
321
 
                return GView->GetCurrentSlice();
 
332
                int tsize = GView->IVista->VisualizatorStudy->GetTSizeActive();
 
333
 
 
334
                if (tsize == 1) {
 
335
                        return GView->IVista->VisualizatorStudy->GetSliceNumber();
 
336
                }
 
337
                else {
 
338
                        GVistaCompleja::TListaGVistasSimples::iterator it = GView->m_VistasSimples.begin();
 
339
                        if (it != GView-> m_VistasSimples.end()) {
 
340
                                GVistaSimple* vs = *it;
 
341
                                return vs->ViewImage2D->GetTindex();
 
342
                        }
 
343
                        else {
 
344
                                return 0;
 
345
                        }
 
346
                }
322
347
        }
323
348
 
324
349
        int GetNumberOfSlices() const
325
350
        {
326
 
                return GView->IVista->VisualizatorStudy->GetSliceNumber();
 
351
                int tsize = GView->IVista->VisualizatorStudy->GetTSizeActive();
 
352
 
 
353
                if (tsize == 1) {
 
354
                        return GView->IVista->VisualizatorStudy->GetSliceNumber();
 
355
                }
 
356
                else {
 
357
                        return tsize;
 
358
                }
327
359
        }
328
360
 
329
361
        virtual ListaWindowLevels& GetWindowLevelList()
367
399
                        {
368
400
                        }
369
401
 
370
 
                        virtual wxDragResult OnDragOver(wxCoord x, wxCoord y,
371
 
                                                                                                wxDragResult def)
 
402
                        virtual wxDragResult OnDragOver(wxCoord x, wxCoord y,
 
403
                                                                                                wxDragResult def)
372
404
                        { 
373
405
                                wxPoint coords(x, y);
374
406
                                coords = GView->ClientToScreen(coords);
447
479
        pToolBar->AddTool(HCore_Reset, (GNC::GCS::ISliderContract*) Delegate);
448
480
        pToolBar->AddTool(HCore_WindowLayout, WindowLayoutDelegate);
449
481
        pToolBar->AddTool(HCore_RotateAndFlip, (GNC::GCS::ISliderContract*) Delegate);
 
482
 
 
483
        pToolBar->AddTool(HCore_SecondaryCapture, (GNC::GCS::ISliderContract*)Delegate);
 
484
        pToolBar->AddTool(HCore_CopyImageToClipboard, (GNC::GCS::ISliderContract*)Delegate);
450
485
        //tools
451
486
        pToolBar->AddTool(HCore_ShowDicomTags, (GNC::GCS::IViewContract*) IVista);
452
487
        pToolBar->AddTool(HCore_ShowHistory, (GNC::GCS::IViewContract*) IVista);
454
489
        pToolBar->AddTool(HGNKVisualizator_Overlays, OverlaysDelegate);
455
490
        pToolBar->AddTool(HCore_ImageExport, ExportDelegate);
456
491
        pToolBar->AddTool(HCore_ImagePrint, ExportDelegate);
457
 
        pToolBar->AddTool(HCore_Deshacer, (GNC::GCS::IViewContract*) IVista);
 
492
        pToolBar->AddTool(HCore_Deshacer, (GNC::GCS::IViewContract*) IVista);
 
493
        pToolBar->AddTool(HCore_PACSUpload, (GNC::GCS::IViewContract*) IVista);
 
494
        pToolBar->AddTool(HCore_DicomizeFromView, (GNC::GCS::IViewContract*) IVista);
 
495
        pToolBar->AddTool(HCore_AddFileToHistory, (GNC::GCS::IViewContract*) IVista);
458
496
 
459
497
        m_pSizerTools->Add(pToolBar->CreateNewToolBar(this, GNC::GCS::ITool::TFamiliaVisualizacion), 0, wxEXPAND);
460
498
        m_pSizerTools->Add(pToolBar->CreateNewToolBar(this, GNC::GCS::ITool::TFamiliaMedicion), 0, wxEXPAND);
468
506
                m_pSizerTools->Add(pwxToolBar, 1, wxEXPAND);
469
507
        }
470
508
 
471
 
        //preview series and drag & drop        
472
 
        m_pSizerView->Insert(0, m_pPanelPreview, 0, wxEXPAND);
 
509
        //preview series and drag & drop        
 
510
        m_pSizerView->Insert(0, m_pPanelPreview, 0, wxEXPAND);
473
511
        SetDropTarget(new GNKVisualizator::GUI::wxDropTargetPreviewPanelVisualizator(this));            
474
512
 
475
513
        //se añaden los botones de ver/cine
529
567
        //m_pManager->InsertarWidget(new GNC::GCS::Widgets::WProgreso(m_VistasSimples.front()->ViewInteractor2D, m_pManager, -1, "progreso", 666));
530
568
        m_pManager->EnableAnimation();
531
569
 
532
 
        Layout();
 
570
        this->Layout();
533
571
}
534
572
 
535
573
GVistaCompleja::~GVistaCompleja()
544
582
        IVista->VisualizatorStudy->Viewer = NULL;
545
583
 
546
584
        if (IVista != NULL) {
547
 
                GNC::GCS::IEntorno::Instance()->GetControladorComandos()->AbortarComandosDeOwner(IVista);
 
585
                GNC::GCS::IEntorno::Instance()->GetCommandController()->AbortarComandosDeOwner(IVista);
548
586
        }
549
587
 
550
588
        //Disconnect(wxEVT_CHILD_FOCUS, wxChildFocusEventHandler(GVistaCompleja::OnFocus),NULL,this);
628
666
        IniciarPipeline();
629
667
}
630
668
 
631
 
void GVistaCompleja::IniciarPipeline(const GNC::GCS::Ptr<GNC::GCS::HangingProtocol>& hangingProtocol)
 
669
void GVistaCompleja::IniciarPipeline(const GNC::GCS::Ptr<GNC::GCS::Layout>& layout)
632
670
{
633
671
        m_pManager->EliminarTodosLosWidgets(false);
634
672
        m_pPanelManipulacion->Enable(true);
672
710
        //contrato window level, hay que preguntarle al viewer de la primera vista porque el estudioatencionprimaria no tiene viewer
673
711
        IVista->GetToolController()->Enable(HCore_WindowLevel, m_VistasSimples[0]->ViewImage2D->GetNumberOfComponents() == 1);
674
712
 
675
 
        if (hangingProtocol.IsValid()) {
676
 
                if (hangingProtocol->getLayout().IsValid()) {
677
 
                        if (hangingProtocol->getLayout()->getMatcher().IsValid()) {
678
 
                                for (std::vector<long>::iterator it = IVista->VisualizatorStudy->OpenedSeries.begin(); it != IVista->VisualizatorStudy->OpenedSeries.end(); ++it)
 
713
        if (layout.IsValid()) {
 
714
                if (layout->getMatcher().IsValid()) {
 
715
                        for (std::vector<long>::iterator it = IVista->VisualizatorStudy->OpenedSeries.begin(); it != IVista->VisualizatorStudy->OpenedSeries.end(); ++it)
 
716
                        {
 
717
                                if (layout->getMatcher()->MatchesSeries((*it))) 
679
718
                                {
680
 
                                        if (hangingProtocol->getLayout()->getMatcher()->MatchesSeries((*it))) 
681
 
                                        {
682
 
                                                LoadSeries(*it);
683
 
                                        }
 
719
                                        LoadSeries(*it);
684
720
                                }
685
 
                                WindowLayoutDelegate->SetWindowLayout(hangingProtocol->getLayout()->getRows(), hangingProtocol->getLayout()->getColumns());
686
721
                        }
687
 
                } else {
688
 
                        LOG_WARN("HangingProtocolDelegate", "trying to build an invalid layout");
 
722
                        WindowLayoutDelegate->SetWindowLayout(layout->getRows(), layout->getColumns());
689
723
                }
 
724
                layout->applyWindowProperties(IVista);
690
725
        } else {
691
726
                GoToSlice(0,false,false);
692
 
                GNC::GCS::IEntorno::Instance()->GetControladorEventos()->ProcesarEvento(new GNC::GCS::Events::EventoModificacionImagen(IVista,GNC::GCS::Events::EventoModificacionImagen::ImagenCargada));
693
727
        }
 
728
        
694
729
        m_pManager->CrearWidgetAnotador(this);
695
730
}
696
731
 
705
740
}
706
741
 
707
742
void GVistaCompleja::OnCargaFinalizada()
708
 
{
709
 
        m_pPanelPreview->LoadModel(this, IVista->VisualizatorStudy);
 
743
{
 
744
        m_pPanelPreview->LoadModel();
710
745
        m_pManager->OcultarTodosLosWidgets(true, 666);
711
746
        m_pManager->DisableAnimation();
712
747
        m_pManager->Render();
738
773
                                                        LOG_ERROR("GVistaCompleja", "Textura no cargada en memoria de video")
739
774
                                                        GNC::GCS::IEntorno::Instance()->GetControladorEventos()->ProcesarEvento(new GNC::GCS::Events::EventoMensajes(NULL,_Std("Error: You have exhausted the system's video memory and has not been able to load the image. Close some studies to free memory."),GNC::GCS::Events::EventoMensajes::PopUpMessage,false));
740
775
                                                        GADAPI::ComandoDestruirVistaParams* pParams = new GADAPI::ComandoDestruirVistaParams(IVista);
741
 
                                                        GNC::GCS::IEntorno::Instance()->GetControladorComandos()->ProcessAsync(_Std("Destroy View"),new GADAPI::ComandoDestruirVista(pParams),NULL);
 
776
                                                        GNC::GCS::IEntorno::Instance()->GetCommandController()->ProcessAsync(_Std("Destroy View"),new GADAPI::ComandoDestruirVista(pParams),NULL);
742
777
                                                }
743
778
                                        } else {
744
779
                                                //se comprobara mas tarde porque la textura todavia no tiene id
749
784
                                        LOG_ERROR("GVistaCompleja","bad_alloc, error al reservar memoria física");
750
785
                                        GNC::GCS::IEntorno::Instance()->GetControladorEventos()->ProcesarEvento(new GNC::GCS::Events::EventoMensajes(NULL,_Std("Error: System out of memory. Close some studies to free memory."),GNC::GCS::Events::EventoMensajes::PopUpMessage,false));
751
786
                                        GADAPI::ComandoDestruirVistaParams* pParams = new GADAPI::ComandoDestruirVistaParams(IVista);
752
 
                                        GNC::GCS::IEntorno::Instance()->GetControladorComandos()->ProcessAsync(_Std("Destroy View"),new GADAPI::ComandoDestruirVista(pParams),NULL);
 
787
                                        GNC::GCS::IEntorno::Instance()->GetCommandController()->ProcessAsync(_Std("Destroy View"),new GADAPI::ComandoDestruirVista(pParams),NULL);
753
788
                                }
754
789
                                catch(...)
755
790
                                {
756
791
                                        LOG_ERROR("GVistaCompleja","excepción general al comprobar errores de memoria");
757
792
                                        GNC::GCS::IEntorno::Instance()->GetControladorEventos()->ProcesarEvento(new GNC::GCS::Events::EventoMensajes(NULL,_Std("Error: Internal error."),GNC::GCS::Events::EventoMensajes::PopUpMessage,false));
758
793
                                        GADAPI::ComandoDestruirVistaParams* pParams = new GADAPI::ComandoDestruirVistaParams(IVista);
759
 
                                        GNC::GCS::IEntorno::Instance()->GetControladorComandos()->ProcessAsync(_Std("Destroy View"),new GADAPI::ComandoDestruirVista(pParams),NULL);
 
794
                                        GNC::GCS::IEntorno::Instance()->GetCommandController()->ProcessAsync(_Std("Destroy View"),new GADAPI::ComandoDestruirVista(pParams),NULL);
760
795
                                }
761
796
                        }
762
797
                        m_hasBeenRendered = true;
902
937
 
903
938
void GVistaCompleja::OnSize(wxSizeEvent &)
904
939
{
905
 
        Layout();
 
940
        this->Layout();
906
941
}
907
942
 
908
943
void GVistaCompleja::OnZSliderScroll (wxScrollEvent& event) {
1073
1108
        return "";
1074
1109
}
1075
1110
 
 
1111
 
 
1112
std::string GVistaCompleja::GetPatientPosition(GNC::GCS::Contexto3D* c) {
 
1113
        GNC::GCS::IWidgetsRenderer* r = ( c == NULL? NULL : c->GetRenderer());
 
1114
        if (r == NULL) {
 
1115
                return m_VistasSimples[0]->GetPatientPosition(c);
 
1116
        } else {
 
1117
                for (TListaGVistasSimples::iterator it = m_VistasSimples.begin(); it != m_VistasSimples.end(); ++it) {
 
1118
                        if ( (*it)->ViewInteractor2D == r) {
 
1119
                                return (*it)->GetPatientPosition(c);
 
1120
                        }
 
1121
                }
 
1122
        }
 
1123
        return "";
 
1124
}
 
1125
 
1076
1126
std::string GVistaCompleja::GetAnotacionPosicion(GNC::GCS::Vector* pPosicion)
1077
1127
{
1078
1128
        GNC::GCS::IWidgetsRenderer* r = m_pManager->GetRendererActivo();
1091
1141
        GNC::GCS::IEntorno::Instance()->GetControladorEventos()->ProcesarEvento(new GNC::GCS::Events::EventoModificacionImagen(IVista,GNC::GCS::Events::EventoModificacionImagen::ImagenModificada, -1));
1092
1142
}
1093
1143
 
 
1144
GNC::GCS::IVista* GVistaCompleja::GetView()
 
1145
{
 
1146
        return IVista;
 
1147
}
 
1148
 
1094
1149
//----------DIALOGO SINCRONIZACION...-------------
1095
1150
class DialogoSincronizacion: public DialogoSincronizacionBase {
1096
1151
public:
1102
1157
                for(TipoListaVistas::iterator it = listaVistas.begin(); it!=listaVistas.end(); ++it){
1103
1158
                        m_pCheckListVistas->AppendString(wxString::FromUTF8((*it)->GetTitulo().c_str()));
1104
1159
                }
1105
 
                Layout();
 
1160
                this->Layout();
1106
1161
        }
1107
1162
 
1108
1163
        ~DialogoSincronizacion(){
1228
1283
 
1229
1284
void GVistaCompleja::GoToSlice(int pos, bool relativa, bool propagar, bool render){
1230
1285
        if (WindowLayoutDelegate->m_MaxSlice == WindowLayoutDelegate->m_MinSlice) {
 
1286
                if (render) {
 
1287
                        GNC::GCS::Events::EventoModificacionImagen* pEvt = new GNC::GCS::Events::EventoModificacionImagen(IVista,GNC::GCS::Events::EventoModificacionImagen::SliceCambiado, -1, render);
 
1288
                        GNC::GCS::IEntorno::Instance()->GetControladorEventos()->ProcesarEvento(pEvt);
 
1289
                }
1231
1290
                return;
1232
1291
        }
1233
1292
        int posicion;
1243
1302
        //si la posicion + las que se muestran en el layout actual es mayor al número de slices de la serie, no se avanza
1244
1303
 
1245
1304
        if(posicion + ( (int) m_VistasSimples.size() ) > IVista->GetEstudio()->GetSliceNumber()) {
 
1305
                if (render) {
 
1306
                        GNC::GCS::Events::EventoModificacionImagen* pEvt = new GNC::GCS::Events::EventoModificacionImagen(IVista,GNC::GCS::Events::EventoModificacionImagen::SliceCambiado, -1, render);
 
1307
                        GNC::GCS::IEntorno::Instance()->GetControladorEventos()->ProcesarEvento(pEvt);
 
1308
                }
1246
1309
                return;
1247
1310
        }
1248
1311