~ubuntu-branches/ubuntu/utopic/ginkgocadx/utopic-proposed

« back to all changes in this revision

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

  • Committer: Package Import Robot
  • Author(s): Dmitry Smirnov
  • Date: 2014-01-09 07:37:09 UTC
  • mfrom: (1.2.3)
  • Revision ID: package-import@ubuntu.com-20140109073709-rpuh5x3p3finvtze
Tags: 3.6.0.1228.33+dfsg-1
New upstream release [December 2013]

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include <eventos/render.h>
20
20
#include <wx/pen.h>
21
21
#include <wx/aui/auibar.h>
 
22
#include <api/iannotator.h>
22
23
#include <wx/ginkgostyle/ginkgostyle.h>
23
24
 
24
25
#include <visualizator/vistas/waveformview.h>
77
78
                protected:
78
79
                        GWaveformView* GView;
79
80
                };
 
81
                ////////////////////GWaveform annotator delegate
 
82
                class GWaveformAnnotatorDelegate: public GNC::GCS::IAnnotator
 
83
                {
 
84
                public:
 
85
                        GWaveformAnnotatorDelegate(GWaveformView* gView, GNKVisualizator::WaveFormView* pView):GNC::GCS::IAnnotator(pView),
 
86
                                GView(gView)
 
87
                        {
 
88
                        }
 
89
                        ~GWaveformAnnotatorDelegate()
 
90
                        {
 
91
                        }
 
92
 
 
93
                        virtual std::string GetAnnotationValue(GNC::GCS::Contexto3D* c, const std::string& key)
 
94
                        {
 
95
                                if (key == "${SLICE.WL.FULLTEXT}") {
 
96
                                        return "";
 
97
                                } else if (key == "${SLICE.IDX.FULLTEXT}") {
 
98
                                        return "";
 
99
                                } else if (key == "${VIEW.COORDLABELS}") {
 
100
                                        std::ostringstream os;
 
101
                                        os << "25 mm/s, 10 mm/mV";
 
102
                                        return os.str();
 
103
                                }
 
104
                                return GNC::GCS::IAnnotator::GetAnnotationValue(c, key);
 
105
                        }
 
106
 
 
107
 
 
108
 
 
109
                protected:
 
110
                        GWaveformView* GView;
 
111
                };
80
112
                //esta clase sirve para las barras de herramientas de abajo
81
113
                class GWaveformViewButtonBar:public wxAuiToolBar{
82
114
                public:
97
129
                
98
130
                /* Constructor */
99
131
                GWaveformView::GWaveformView(GNKVisualizator::WaveFormView* pView) : GWaveformViewBase(pView->GetEstudio()->ParentWindow),
100
 
                                Delegate(new GWaveformViewDelegate(this))
 
132
                                Delegate(new GWaveformViewDelegate(this)),
 
133
                                AnnotatorDelegate(new GWaveformAnnotatorDelegate(this, pView))
101
134
                {
102
135
                        Freeze();
103
136
                        View = pView;
112
145
 
113
146
                        // Setup del manejador de widgets */
114
147
                        m_pManager = GNC::GCS::IEntorno::Instance()->NewWidgetsManager(View);
 
148
                        m_pManager->SetAnnotator(AnnotatorDelegate);
115
149
                        ViewInteractor2D->SetManager(m_pManager);
116
150
                        ViewInteractor2D->SetVID(0,false);
117
151
                        m_pManager->SetRendererActivo(ViewInteractor2D);
118
 
 
119
 
                        m_pManager->CrearWidgetAnotador(this);
120
 
 
 
152
                        
121
153
                        WidgetRepresentation* pWidgetsRepresentation = WidgetRepresentation::New();
122
154
                        pWidgetsRepresentation->SetRenderer(ViewInteractor2D->FindPokedRenderer(0,0));
123
155
                        ViewInteractor2D->FindPokedRenderer(0,0)->AddViewProp(pWidgetsRepresentation);
328
360
 
329
361
                void GWaveformView::OnShowHideCornerAnnotations(wxCommandEvent &)
330
362
                {
331
 
                        m_pManager->MostrarOcultarAnotador();                   
 
363
                        m_pManager->ShowAnnotations(!m_pManager->IsShownAnnotations());                 
332
364
                        GNC::GCS::IEntorno::Instance()->GetControladorEventos()->ProcesarEvento(new GNC::GCS::Events::EventoRender(View));
333
365
                }
334
366
 
335
 
                //IAnotador
336
 
                std::string GWaveformView::GetDICOMTag(std::string tagId)
337
 
                {
338
 
                        std::string str("");
339
 
                        View->GetEstudio()->GetTagActiveImage(tagId,str);
340
 
 
341
 
                        return str;
342
 
                }
343
 
 
344
 
                std::string GWaveformView::GetTopLeftAnnotation(GNC::GCS::Contexto3D*)
345
 
                {
346
 
                        if (!this->ViewImage2D->IsInstalledAndInitialized() || View == NULL)
347
 
                                return "";
348
 
 
349
 
                        std::ostringstream os;
350
 
                        std::string tag;
351
 
 
352
 
                        tag = "0010|0010"; // Patient's Name
353
 
 
354
 
                        os << _Std("Patient: ") << GetDICOMTag(tag).c_str() << std::endl;
355
 
 
356
 
                        tag = "0010|0020"; // Patient's ID
357
 
 
358
 
                        os << _Std("Patient Id: ") << GetDICOMTag(tag).c_str();
359
 
 
360
 
                        return os.str();
361
 
                }
362
 
 
363
 
                std::string GWaveformView::GetTopRightAnnotation(GNC::GCS::Contexto3D*)
364
 
                {
365
 
                        if (!this->ViewImage2D->IsInstalledAndInitialized() || View == NULL)
366
 
                                return "";
367
 
 
368
 
                        std::ostringstream os;
369
 
                        std::string tag;
370
 
                        std::string str;
371
 
 
372
 
                        tag = "0010|0040"; // Patient's Sex
373
 
 
374
 
                        os << GetDICOMTag(tag).c_str() << " ";
375
 
 
376
 
                        tag = "0010|0030"; // Patient's BirthDate
377
 
                        str = GetDICOMTag(tag);
378
 
                        if (str.size() == 8) {
379
 
                                os << str.substr(6, 2).c_str() << "-";
380
 
                                os << str.substr(4, 2).c_str() << "-";
381
 
                                os << str.substr(0, 4).c_str() << " ";
382
 
                        }
383
 
 
384
 
                        tag = "0010|1010"; // Patient's Age
385
 
                        str = GetDICOMTag(tag);
386
 
                        if(str.size() > 0) {
387
 
                                os << str.c_str() << "Y" << std::endl;
388
 
                        }
389
 
 
390
 
                        tag = "0008|0060"; // Modalidad
391
 
                        os << _Std("Modality: ") << GetDICOMTag(tag).c_str() << std::endl;
392
 
 
393
 
                        tag = "0008|0021"; // Series Date
394
 
                        str = GetDICOMTag(tag);
395
 
                        if (str.size() == 8) {
396
 
                                os << str.substr(6, 2).c_str() << "-";
397
 
                                os << str.substr(4, 2).c_str() << "-";
398
 
                                os << str.substr(0, 4).c_str() << " ";
399
 
                        }
400
 
                        os<<std::endl;
401
 
 
402
 
                        tag = "0008|103e"; // Series Description
403
 
                        str = GetDICOMTag(tag);
404
 
                        if (!str.empty()) {
405
 
                                if(str.size()<18){
406
 
                                        os << str.c_str();
407
 
                                }else {
408
 
                                        os << str.substr(0,18).c_str()<<"...";
409
 
                                }
410
 
                        }
411
 
 
412
 
                        return os.str();
413
 
                }
414
 
 
415
 
                std::string GWaveformView::GetBottomLeftAnnotation(GNC::GCS::Contexto3D*)
416
 
                {
417
 
                        
418
 
                        if (!this->ViewImage2D->IsInstalledAndInitialized() || View == NULL)
419
 
                                return "";
420
 
 
421
 
                        std::ostringstream os;
422
 
                        std::string tag;
423
 
                        std::string str;
424
 
 
425
 
                        tag = "0008|0020"; // study Date
426
 
                        str = GetDICOMTag(tag);
427
 
                        if (str.size() == 8) {
428
 
                                os << str.substr(6, 2).c_str() << "-";
429
 
                                os << str.substr(4, 2).c_str() << "-";
430
 
                                os << str.substr(0, 4).c_str() << " ";
431
 
                        }
432
 
                        os<<std::endl;
433
 
 
434
 
                        tag = "0008|1030"; // Study Description
435
 
                        str = GetDICOMTag(tag);
436
 
                        if (!str.empty()) {
437
 
                                if(str.size()<18){
438
 
                                        os << str.c_str()<<std::endl;
439
 
                                }else {
440
 
                                        os << str.substr(0,18).c_str()<<"..."<<std::endl;
441
 
                                }
442
 
                        }
443
 
 
444
 
                        tag = "0008|0080"; // Nombre del centro, si viene el centro en el estudio se pone si no el d los tags estaticos
445
 
                        str = GetDICOMTag(tag);
446
 
                        if (str.size() == 6) {
447
 
                                os << str.substr(0, 2).c_str() << ":";
448
 
                        } else {
449
 
                                std::string tag;
450
 
                                GNC::GCS::ConfigurationController::Instance()->readStringGeneral("/GinkgoCore/Estacion", "CentroNombre", tag);
451
 
 
452
 
                                if (!tag.empty()) {
453
 
                                        os << tag.c_str() << std::endl;
454
 
                                }
455
 
                        }
456
 
                        
457
 
                        
458
 
                        wxString appName ( wxString::FromUTF8(GNC::GCS::IEntorno::Instance()->GetApplicationName().c_str()));
459
 
                        wxString madewith( wxString::Format(_("Made with %s"), appName.c_str()));
460
 
                        
461
 
                        os << std::string(madewith.ToUTF8());
462
 
                        return os.str();
463
 
                }
464
 
 
465
 
                std::string GWaveformView::GetBottomRightAnnotation(GNC::GCS::Contexto3D*)
466
 
                {
467
 
                        if (!this->ViewImage2D->IsInstalledAndInitialized() || View == NULL)
468
 
                                return "";
469
 
                        std::ostringstream os;
470
 
                        os << "25 mm/s, 10 mm/mV";
471
 
                        return os.str();
472
 
                }
473
 
 
474
 
                std::string GWaveformView::GetPatientPosition(GNC::GCS::Contexto3D*)
475
 
                {
476
 
                        return "";
477
 
                }
478
 
 
479
 
                std::string GWaveformView::GetAnotacionPosicion(const GNC::GCS::Vector3D& /*wP*/, GNC::GCS::Contexto3D*)
480
 
                {
481
 
                        return "";
482
 
                }
483
 
 
484
 
                //end ianotador
485
367
 
486
368
                void GWaveformView::OnFocus(wxChildFocusEvent &)
487
369
                {