~ubuntu-branches/ubuntu/wily/ginkgocadx/wily-proposed

« back to all changes in this revision

Viewing changes to src/cadxcore/widgets/wchroma.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: wchroma.h 3535 2011-03-18 17:57:05Z 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
 */
 
14
#pragma once
 
15
#include <api/iwidgets.h>
 
16
#include <widgets/observers/iobservadorchroma.h>
 
17
#include <vector>
 
18
 
 
19
class vtkImageData;
 
20
 
 
21
namespace GNC {
 
22
        namespace GCS {
 
23
                namespace Widgets {
 
24
 
 
25
                        //---------------------------------------------------------------------
 
26
 
 
27
                        class WChromaBuilder : public GNC::GCS::Widgets::IWidgetBuilder, public GNC::GCS::Widgets::Notificadores::INotificadorChroma {
 
28
                        public:
 
29
                                WChromaBuilder(GNC::GCS::IWidgetsManager* pManager, long gid, GNC::GCS::Widgets::Observadores::IObservadorChroma* pObservador = NULL);
 
30
 
 
31
                                ~WChromaBuilder();
 
32
 
 
33
                                virtual void OnMouseEvents(GNC::GCS::Eventos::EventoRaton&);
 
34
 
 
35
                                virtual void OnKeyEvents(GNC::GCS::Eventos::EventoTeclado&);
 
36
 
 
37
                                virtual void Render(GNC::GCS::Contexto3D* c);
 
38
 
 
39
                                virtual GNC::GCS::Widgets::TipoCursor GetCursor();
 
40
 
 
41
 
 
42
                        protected:
 
43
                                int                         m_NumMaxSemillas;
 
44
                                GNC::GCS::Vector m_VerticesSeleccion[2];
 
45
                                GNC::GCS::Nodo   m_Nodo;
 
46
                                bool                      m_MouseDown;
 
47
                                Estado                   m_Estado;
 
48
                        };
 
49
 
 
50
                        //---------------------------------------------------------------------
 
51
 
 
52
                        class WChroma : public GNC::GCS::Widgets::IWidget {
 
53
 
 
54
 
 
55
                        //region "Constructor y destructor"
 
56
 
 
57
                        public:
 
58
                                WChroma(IWidgetsManager* pManager, long vid, GNC::GCS::Nodo nodo, const char* nombre, long gid, bool oculto = false);
 
59
 
 
60
                                ~WChroma();
 
61
 
 
62
                                //endregion
 
63
 
 
64
                                //region "Interfaz especifica"
 
65
 
 
66
                                virtual void OnMouseEvents(GNC::GCS::Eventos::EventoRaton&);
 
67
 
 
68
                                virtual void OnKeyEvents(GNC::GCS::Eventos::EventoTeclado&);
 
69
 
 
70
                                virtual bool HitTest(float x, float y, float umbralCuadrado);
 
71
 
 
72
                                virtual bool HitTest(GNC::GCS::Vector* vertices, int numVertices);
 
73
 
 
74
                                virtual void Render(GNC::GCS::Contexto3D* c);
 
75
 
 
76
                                virtual bool SoportaAutoBorrado() const {
 
77
                                        return false;
 
78
                                }
 
79
 
 
80
                                virtual GNC::GCS::Nodo& GetNodo() {
 
81
                                        return m_Nodo;
 
82
                                }
 
83
 
 
84
                                virtual bool EsMarcador() const
 
85
                                {
 
86
                                        return false;
 
87
                                }
 
88
 
 
89
                                virtual bool DelimitaArea() const
 
90
                                {
 
91
                                        return false;
 
92
                                }
 
93
 
 
94
                                virtual void GetPosicion(GNC::GCS::Vector& posicion) const
 
95
                                {
 
96
                                        posicion = m_Nodo;
 
97
                                }
 
98
 
 
99
                                virtual void Seleccionar(bool seleccionar)
 
100
                                {
 
101
                                        SeleccionarNodo(m_Nodo, seleccionar);
 
102
                                }
 
103
 
 
104
                                virtual void Iluminar(bool iluminar)
 
105
                                {
 
106
                                        if (iluminar != m_Nodo.EstaIluminado()) {
 
107
                                                IluminarNodo(m_Nodo, iluminar);
 
108
                                                m_Modificado = true;
 
109
                                        }
 
110
                                }
 
111
 
 
112
                                virtual void SeleccionarNodo(GNC::GCS::Nodo& nodo, bool seleccionar)
 
113
                                {
 
114
                                        if(seleccionar != nodo.EstaSeleccionado()){
 
115
                                                nodo.Seleccionar(seleccionar);
 
116
                                                m_Modificado = true;
 
117
                                        }
 
118
                                }
 
119
 
 
120
                                virtual bool EstaSeleccionado() const
 
121
                                {
 
122
                                        return m_Nodo.EstaSeleccionado();
 
123
                                }
 
124
 
 
125
                                virtual bool EstaIluminado() const
 
126
                                {
 
127
                                        return m_Nodo.EstaIluminado();
 
128
                                }
 
129
 
 
130
                                //endregion
 
131
 
 
132
                                //region "Estado interno"
 
133
                        private:
 
134
                                bool            m_MouseDown;
 
135
                                //endregion
 
136
 
 
137
                                //region "Propiedades geometricas"
 
138
                        private:
 
139
                                GNC::GCS::Nodo   m_Nodo;
 
140
                                GNC::GCS::Vector m_PosAntigua;
 
141
 
 
142
                        public:
 
143
                                friend std::ostream& operator<<(std::ostream& out, const WChroma& w) {
 
144
                                        out << "[ P=" << w.m_Nodo << ", GID=" << w.m_GID << ", TID=" << w.m_TID << " UID=" << w.m_UID << " ]";
 
145
                                        return out;
 
146
                                }
 
147
 
 
148
                                friend std::ostream& operator<<(std::ostream& out, const WChroma* w) {
 
149
                                        if (w == NULL) {
 
150
                                                out << "[ NULL ]";
 
151
                                        }
 
152
                                        else {
 
153
                                                out << *w;
 
154
                                        }
 
155
                                        return out;
 
156
                                }
 
157
 
 
158
                        public:
 
159
                                //endregion
 
160
                        };
 
161
                }
 
162
        }
 
163
}