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

« back to all changes in this revision

Viewing changes to src/cadxcore/commands/comandochroma.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: comandochroma.h 3521 2011-03-16 14:54:22Z carlos $
 
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
//#define _GINKGO_TRACE
 
15
#include <api/globals.h>
 
16
#include <api/icomando.h>
 
17
 
 
18
#ifdef __DEPRECATED
 
19
#undef __DEPRECATED
 
20
#endif
 
21
#include <vtkSmartPointer.h>
 
22
#include <vtkImageData.h>
 
23
 
 
24
class wxCriticalSection;
 
25
class vtkGinkgoImageViewer;
 
26
 
 
27
class INotificadorChroma;
 
28
namespace GNC {
 
29
        namespace GCS {
 
30
                class Nodo;
 
31
                class IElementoCache;
 
32
        }
 
33
}
 
34
 
 
35
namespace GADAPI {
 
36
 
 
37
        namespace Chroma {
 
38
 
 
39
                typedef enum TipoAccion {
 
40
                        TAC_Resetear,
 
41
                        TAC_Todo,
 
42
                        TAC_Invertir,
 
43
                        TAC_SegmentarPunto,
 
44
                        TAC_CancelarSegmentacion,
 
45
                        TAC_InsertarRegion,
 
46
                        TAC_EliminarRegion,
 
47
                        TAC_SegmentarLazo
 
48
                } TipoAccion;
 
49
 
 
50
                typedef enum TipoAmbito {
 
51
                        TAC_Contiguo,
 
52
                        TAC_Global
 
53
                } TipoAmbito;
 
54
 
 
55
                class TipoPunto {
 
56
 
 
57
                public:
 
58
 
 
59
                        double coord[3];
 
60
                        unsigned long UID;
 
61
 
 
62
                        TipoPunto() {
 
63
                                coord[0] = 0.0f;
 
64
                                coord[1] = 0.0f;
 
65
                                coord[2] = 0.0f;
 
66
                                UID = 0;
 
67
                        }
 
68
 
 
69
                        TipoPunto(unsigned long uid, float x, float y, float z) {
 
70
                                coord[0] = x;
 
71
                                coord[1] = y;
 
72
                                coord[2] = z;
 
73
                                UID = uid;
 
74
                        }
 
75
 
 
76
                        inline friend std::ostream & operator <<(std::ostream& out, const TipoPunto& c) {
 
77
                                out << "[ x = " << c.coord[0] << ", y = " << c.coord[1] << ", UID = " << c.UID << " ]";
 
78
 
 
79
                                return out;
 
80
                        }
 
81
 
 
82
                        inline friend std::ostream & operator <<(std::ostream& out, TipoPunto* c) {
 
83
                                if (c == NULL) {
 
84
                                        out << "[ NULL ]";
 
85
                                }
 
86
                                else {
 
87
                                        out << *c;
 
88
                                }
 
89
                                return out;
 
90
                        }
 
91
                };
 
92
        }
 
93
 
 
94
        typedef enum {
 
95
                MASCARA_SET_CHROMA = 0x80, //un uno en el chroma
 
96
                MASCARA_SET_PRESELECCION = 0x40, //un uno en la preseleccion
 
97
                MASCARA_UNSET_CHROMA = 0x7F, //un cero en el chroma
 
98
                MASCARA_UNSET_PRESELECCION = 0xBF       //un cero en la preseleccion
 
99
        } TSeleccion;
 
100
 
 
101
 
 
102
        class ComandoChromaParams : public GNC::GCS::IComandoParams {
 
103
        public:
 
104
                typedef std::list<GNC::GCS::Nodo> TVerticesLazo;
 
105
 
 
106
                ComandoChromaParams( GNC::GCS::IElementoCache* pImagen,
 
107
                        vtkSmartPointer<vtkImageData> pMapaValoracion,
 
108
                        GADAPI::Chroma::TipoAccion tipoAccion,
 
109
                        wxCriticalSection* pMEF_CriticalSection,
 
110
                        INotificadorChroma*  pNotificador,
 
111
                        float sensibilidad,
 
112
                        GADAPI::Chroma::TipoAmbito tipoAmbito = GADAPI::Chroma::TAC_Contiguo);
 
113
 
 
114
                ComandoChromaParams( GNC::GCS::IElementoCache* pImagen,
 
115
                        vtkSmartPointer<vtkImageData> pMapaValoracion,
 
116
                        wxCriticalSection* pMEF_CriticalSection,
 
117
                        INotificadorChroma*  pNotificador,
 
118
                        const TVerticesLazo& vertices, vtkGinkgoImageViewer* pVista);
 
119
 
 
120
                virtual ~ComandoChromaParams();
 
121
 
 
122
        public:
 
123
 
 
124
                GNC::GCS::IElementoCache* m_pImagen;
 
125
                vtkSmartPointer<vtkImageData> m_pMapaValoracion;
 
126
                wxCriticalSection* m_pMEFCriticalSection;
 
127
                INotificadorChroma* m_pNotificador;
 
128
                float m_sensibilidad;
 
129
 
 
130
                GADAPI::Chroma::TipoAccion m_TipoAccion;
 
131
                GADAPI::Chroma::TipoAmbito m_TipoAmbito;
 
132
                double x;
 
133
                double y;
 
134
                bool bloqueado;
 
135
                bool empty;
 
136
 
 
137
                TVerticesLazo         m_Vertices;
 
138
                vtkGinkgoImageViewer* m_pVista;
 
139
        };
 
140
 
 
141
        class ComandoChromaResult : public GNC::GCS::IComandoResult {
 
142
        public:
 
143
                ComandoChromaResult() {
 
144
                }
 
145
 
 
146
        };
 
147
 
 
148
        class ComandoChroma : public GNC::GCS::IComando {
 
149
        public:
 
150
                ComandoChroma(ComandoChromaParams* pParams);
 
151
 
 
152
    protected:
 
153
                void Execute();
 
154
                void Update();
 
155
 
 
156
        protected:
 
157
                ComandoChromaParams* m_pChromaParams;
 
158
        };
 
159
}