~ubuntu-branches/ubuntu/oneiric/ginkgocadx/oneiric

« back to all changes in this revision

Viewing changes to src/cadxcore/api/icontroladormodulo.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Tille
  • Date: 2011-05-02 08:09:26 UTC
  • Revision ID: james.westby@ubuntu.com-20110502080926-bql5wep49c7hg91t
Tags: upstream-2.4.1.1
Import upstream version 2.4.1.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  
 
3
 *  $Id: icontroladormodulo.h 3648 2011-04-04 11:56:18Z tovar $
 
4
 *  Ginkgo CADx Project
 
5
 *
 
6
 *  Copyright 2008-10 MetaEmotion S.L. All rights reserved.
 
7
 *  http://ginkgo-cadx.com
 
8
 *
 
9
 *  This file is licensed under LGPL v3 license.
 
10
 *  See License.txt for details
 
11
 *
 
12
 */
 
13
#pragma once
 
14
#include <api/api.h>
 
15
#include <string>
 
16
#include <list>
 
17
#include <vector>
 
18
#include <map>
 
19
#include <exception>
 
20
#include <yasper/yasper.h>
 
21
#include "imodelointegracion.h"
 
22
#include "imodelointegracion.h"
 
23
#include "icontextoestudio.h"
 
24
#include "ivista.h"
 
25
 
 
26
class IPasoConfiguracion;
 
27
class IWizard;
 
28
class IPasoWizard;
 
29
class wxWindow;
 
30
class wxBitmap;
 
31
 
 
32
namespace GNC {
 
33
        namespace GCS {
 
34
                class IEntorno;
 
35
        }
 
36
}
 
37
 
 
38
class IControladorImportacionPACS;
 
39
 
 
40
#define GINKGO_PARAMS_SEPARATOR "="
 
41
 
 
42
namespace GNC {
 
43
        namespace GCS {
 
44
 
 
45
 
 
46
                /* Appender / formatter para reordenar y/o añadir tags DICOM necesarios por el controlador o vista en la importacion */
 
47
                typedef struct TagsDICOM {
 
48
                        typedef std::vector<std::string> ListaArbolesPersonalizados;
 
49
                        typedef std::map<std::string, int> MapaTags;
 
50
 
 
51
                        // Vector de nombres de raices de tags DICOM que el modo necesita
 
52
                        ListaArbolesPersonalizados ArbolesPersonalizados;
 
53
                        // Mapa de tags a insertar/sobreescribir con sus id de raices asociadas (donde se insertaran)
 
54
                        MapaTags TagsAInsertar;
 
55
 
 
56
                } TagsDICOM;
 
57
 
 
58
                class EXTAPI ModoControlador {
 
59
                        public:
 
60
                        class EXTAPI TipoListaModalidades : public std::list<std::string> { };
 
61
 
 
62
                        ModoControlador(int id, const std::string& descripcion, TipoListaModalidades listaModalidades, bool abreSeriesSueltas, wxBitmap * bitmap = NULL)
 
63
                        {
 
64
                                this->id = id;
 
65
                                this->descripcion = descripcion;
 
66
                                this->bitmap = bitmap;
 
67
                                this->m_listaModalidades = listaModalidades;
 
68
                                this->m_abreSeriesSueltas = abreSeriesSueltas;
 
69
                        }
 
70
 
 
71
                        ~ModoControlador()
 
72
                        {
 
73
                                m_listaModalidades.clear();
 
74
                        }
 
75
 
 
76
                        const TipoListaModalidades GetModalidades(){
 
77
                                return m_listaModalidades;
 
78
                        }
 
79
 
 
80
                        const std::string& GetDescripcion(){
 
81
                                return descripcion;
 
82
                        }
 
83
 
 
84
                        wxBitmap* GetBitmap(){
 
85
                                return bitmap;
 
86
                        }
 
87
 
 
88
                        const int GetId(){
 
89
                                return id;
 
90
                        }
 
91
 
 
92
                        bool AbreSeriesSueltas()
 
93
                        {
 
94
                                return m_abreSeriesSueltas;
 
95
                        }
 
96
 
 
97
                        virtual bool SupportsModalityFile(const std::string &modalidad, const std::string& transferSyntax){
 
98
                                for(TipoListaModalidades::iterator it = m_listaModalidades.begin(); it!= m_listaModalidades.end(); ++it){
 
99
                                        if((*it) == modalidad){
 
100
                                                if (transferSyntax != "1.2.840.10008.1.2.4.100" && transferSyntax != "1.2.840.10008.1.2.4.101") {
 
101
                                                        return true;
 
102
                                                } else {
 
103
                                                        return false;
 
104
                                                }
 
105
                                        }
 
106
                                }
 
107
                                return false;
 
108
                        }
 
109
 
 
110
                protected:
 
111
                        TipoListaModalidades  m_listaModalidades;
 
112
                        int id;
 
113
                        std::string descripcion;
 
114
                        wxBitmap* bitmap;
 
115
                        bool m_abreSeriesSueltas;
 
116
                };
 
117
 
 
118
                class EXTAPI Plantilla{
 
119
                public:
 
120
                        Plantilla(const wxBitmap& plantilla, const std::string& nombre, const std::string& descripcion = "");
 
121
 
 
122
                        ~Plantilla();
 
123
 
 
124
                        const wxBitmap* GetImagen() const {
 
125
                                return m_plantilla;
 
126
                        }
 
127
 
 
128
                        const std::string& GetNombre() const {
 
129
                                return m_nombre;
 
130
                        }
 
131
 
 
132
                        const std::string& GetDescripcion() const {
 
133
                                return m_descripcion;
 
134
                        }
 
135
 
 
136
                protected:
 
137
                        wxBitmap*   m_plantilla;
 
138
                        std::string m_nombre;
 
139
                        std::string m_descripcion;
 
140
                };
 
141
 
 
142
                class EXTAPI IdHL7 {
 
143
                public:
 
144
                        std::string etiqueta;        // Etiqueta que usa Ginkgo para localizar el código
 
145
                        std::string codigo;          // Código formal para la etiqueta
 
146
                        std::string namespaceid;     // NamespaceID de la entidad asignatoria
 
147
                        std::string descripcion;     // Descripcion del codigo
 
148
                        std::string tipoobservacion; // Tipo de observacion. Solo se usa para Ids transportados en OBX
 
149
                        std::string tipodatos;
 
150
                        std::string version;                      //version of the id
 
151
 
 
152
                        inline IdHL7()
 
153
                        {
 
154
                        }
 
155
 
 
156
                        inline IdHL7(const IdHL7& o)
 
157
                        {
 
158
                                *this = o;
 
159
                        }
 
160
 
 
161
                        inline IdHL7(const std::string& e, const std::string& c, const std::string& d, const std::string& n, const std::string& t, const std::string& td, const std::string& v = "")
 
162
                        {
 
163
                                etiqueta        = e;
 
164
                                codigo          = c;
 
165
                                descripcion     = d;
 
166
                                namespaceid     = n;
 
167
                                tipoobservacion = t;
 
168
                                tipodatos       = td;
 
169
                                version                  = v;
 
170
                        }
 
171
 
 
172
                        inline IdHL7& operator = (const IdHL7& o)
 
173
                        {
 
174
                                etiqueta        = o.etiqueta;
 
175
                                codigo          = o.codigo;
 
176
                                descripcion     = o.descripcion;
 
177
                                namespaceid     = o.namespaceid;
 
178
                                tipoobservacion = o.tipoobservacion;
 
179
                                tipodatos       = o.tipodatos;
 
180
                                version                  = o.version;
 
181
                                return *this;
 
182
                        }
 
183
 
 
184
                        inline operator const std::string () const {
 
185
                                return codigo + "^" + descripcion + "^" + namespaceid;
 
186
                        }
 
187
                };
 
188
 
 
189
                /* Controlador de módulos. Responsable de proveer una factoría de controladores de estudios y registrarlos mediante el controlador de vistas. */
 
190
                class EXTAPI IControladorModulo {
 
191
                public:
 
192
                        typedef struct TPrivateTagReemplazable
 
193
                        {
 
194
                                typedef enum {STD, XML} TType;
 
195
                                TType type;
 
196
                                unsigned char id;
 
197
                                TPrivateTagReemplazable (unsigned char id, TType type)
 
198
                                {
 
199
                                        this->id = id;
 
200
                                        this->type = type;
 
201
                                }
 
202
                        } TPrivateTagReemplazable;
 
203
                        typedef std::list<TPrivateTagReemplazable> TListaIdsTagsPrivados;
 
204
                        //first element uid provider, second list of tags
 
205
                        typedef std::map<std::string, TListaIdsTagsPrivados> TMapaTagsPrivados;
 
206
 
 
207
                        class DescriptorSerie {
 
208
                        public:
 
209
                                DescriptorSerie(const std::string& uidSerie, const std::string& modalidad, const std::string& transferSyntax, GnkPtr<GIL::IModeloIntegracion> pModeloIntegracion){
 
210
                                        m_uidSerie = uidSerie;
 
211
                                        m_modalidad = modalidad;
 
212
                                        m_uidTransferSyntax = transferSyntax;
 
213
                                        m_pModeloIntegracion = pModeloIntegracion;
 
214
                                }
 
215
 
 
216
                                std::string m_uidSerie;
 
217
                                std::string m_modalidad;
 
218
                                std::string m_uidTransferSyntax;
 
219
                                GnkPtr<GIL::IModeloIntegracion> m_pModeloIntegracion;
 
220
                        };
 
221
 
 
222
                        typedef std::list<DescriptorSerie> ListaDescriptoresSerie;
 
223
                        typedef std::list<Plantilla*> TipoListaPlantillas;
 
224
                        typedef std::list<IdHL7> TipoListaIdsHL7;
 
225
                        typedef std::map<std::string,IdHL7> TipoMapaIdsHL7;
 
226
 
 
227
                        /* Constructor */
 
228
                        IControladorModulo(GNC::GCS::IEntorno* pEntorno, const std::string& uid, int priority, const std::string& sid = "Common");
 
229
 
 
230
                        /* Destructor */
 
231
                        virtual ~IControladorModulo();
 
232
 
 
233
                        /* Obtiene el UID único del módulo */
 
234
                        const std::string& GetUID() const
 
235
                        {
 
236
                                return m_UID;
 
237
                        }
 
238
 
 
239
                        /* Obtiene el SID (String Id) único del módulo. Usado para transferencia de parámetros de línea de comandos. */
 
240
                        const std::string& GetSID() const
 
241
                        {
 
242
                                return m_SID;
 
243
                        }
 
244
 
 
245
                        const wxBitmap* GetBitmap() {
 
246
                                return m_Bitmap;
 
247
                        }
 
248
 
 
249
                        /* Obtiene el Nombre del módulo (que aparece en el menú)*/
 
250
                        const std::string& GetNombre() const
 
251
                        {
 
252
                                return m_Nombre;
 
253
                        }
 
254
 
 
255
                        virtual bool SoportaImportacion() const
 
256
                        {
 
257
                                return false;
 
258
                        }
 
259
 
 
260
                        //si importa series true, si importa estudios false
 
261
                        virtual bool ImportaSeries() const
 
262
                        {
 
263
                                return true;
 
264
                        }
 
265
 
 
266
                        virtual TipoListaPlantillas& GetPlantillas() {
 
267
                                return m_listaPlantillas;
 
268
                        }
 
269
 
 
270
                        virtual void GetPasosImportacion(IWizard* , std::list<IPasoWizard*> &, wxWindow* , std::string &, GnkPtr<GIL::IModeloIntegracion> ){
 
271
 
 
272
                        }
 
273
 
 
274
                        virtual void GetPasosConfiguracion( std::list<IPasoConfiguracion*> &, wxWindow* ){
 
275
 
 
276
                        }
 
277
 
 
278
                        // Metodos de inicializacion de configuracion del modulo
 
279
                        void RegistrarConfiguracion();
 
280
 
 
281
                        //registra las vistas
 
282
                        virtual void RegistrarVistas() = 0;
 
283
 
 
284
                        const IdHL7 GetIdInforme(const std::string& key) const;
 
285
 
 
286
                        const IdHL7 GetIdEstudioHL7(const std::string& key) const;
 
287
 
 
288
                        const IdHL7 GetIdRegistroHL7(const std::string& key) const;
 
289
 
 
290
                        /* Abre un estudio de manera no interactiva desde un directorio y devuelve su controlador específico */
 
291
                        virtual GNC::GCS::IVista* AbrirVista(int modo, ListaDescriptoresSerie& series, const std::string& uidEstudioDiagnostico = "") = 0;
 
292
 
 
293
 
 
294
                //region "Manipulacion de paneles extra (Herramientas, etc.)"
 
295
 
 
296
                        virtual void InsertarPaneles()
 
297
                        {
 
298
                        }
 
299
 
 
300
                        virtual void EliminarPaneles()
 
301
                        {
 
302
                        }
 
303
 
 
304
                        virtual void MostrarPaneles(bool  = true, bool  = true)
 
305
                        {
 
306
                        }
 
307
 
 
308
                        virtual void OcultarPaneles(bool  = true, bool  = true)
 
309
                        {
 
310
                        }
 
311
                //endregion
 
312
 
 
313
 
 
314
                        typedef std::vector<ModoControlador*> ListaModos;
 
315
                        typedef std::vector<ModoControlador*>::iterator IteradorListaModos;
 
316
 
 
317
                        virtual ModoControlador* GetModo(int id) {
 
318
                                if (id >= (int)m_ListaModos.size()) {
 
319
                                        return NULL;
 
320
                                }
 
321
                                else {
 
322
                                        return m_ListaModos[id];
 
323
                                }
 
324
                        }
 
325
 
 
326
                        virtual ListaModos& GetListaModos(){
 
327
                                return m_ListaModos;
 
328
                        }
 
329
 
 
330
                        virtual int GetPriority()
 
331
                        {
 
332
                                return m_priority;
 
333
                        }
 
334
 
 
335
                        virtual void GetTagsPrivadosReplace(GNC::GCS::IControladorModulo::TMapaTagsPrivados& mapaTags);
 
336
                        virtual GNC::GCS::IContextoEstudio::TModoFuncionamiento GetDiagnosticMode();
 
337
 
 
338
                protected:
 
339
                        GNC::GCS::IEntorno*  m_pEntorno;
 
340
                        ListaModos           m_ListaModos;
 
341
                        TipoListaPlantillas  m_listaPlantillas;
 
342
 
 
343
                        TipoListaIdsHL7      m_ListaInformes;
 
344
                        TipoMapaIdsHL7       m_ListaEstudios;
 
345
                        TipoMapaIdsHL7       m_ListaRegistros;
 
346
 
 
347
                        std::string m_UID;
 
348
                        std::string m_SID;
 
349
                        std::string m_Nombre;
 
350
                        std::string m_CopyRight;
 
351
                        std::string m_Author;
 
352
                        int         m_VersionMayor;
 
353
                        int         m_VersionMinor;
 
354
                        int         m_VersionRelease;
 
355
                        std::string m_CodeName;
 
356
                        std::string m_Version;
 
357
                        int                 m_priority;
 
358
 
 
359
                        wxBitmap*   m_Bitmap;
 
360
                };
 
361
        }
 
362
}