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

« back to all changes in this revision

Viewing changes to src/cadxcore/widgets/wrectangulo.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: wrectangulo.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 <vector>
 
17
 
 
18
namespace GNC {
 
19
        namespace GCS {
 
20
                namespace Widgets {
 
21
                        //---------------------------------------------------------------------
 
22
 
 
23
                        class EXTAPI WRectanguloBuilder : public GNC::GCS::Widgets::IWidgetBuilder {
 
24
                        public:
 
25
 
 
26
                                typedef GNC::GCS::Vector                 TVector;
 
27
                                typedef GNC::GCS::Eventos::EventoRaton   TEventoRaton;
 
28
                                typedef GNC::GCS::Eventos::EventoTeclado TEventoTeclado;
 
29
                                typedef GNC::GCS::IWidgetsManager        TWidgetsManager;
 
30
                                typedef GNC::GCS::Widgets::IWidget       TWidget;
 
31
 
 
32
                                WRectanguloBuilder(TWidgetsManager* pManager, long gid);
 
33
 
 
34
                                ~WRectanguloBuilder();
 
35
 
 
36
                                virtual void OnMouseEvents(TEventoRaton& event);
 
37
                                virtual void OnKeyEvents(TEventoTeclado& event);
 
38
 
 
39
                                virtual void Render(GNC::GCS::Contexto3D* c);
 
40
 
 
41
                                virtual GNC::GCS::Widgets::TipoCursor GetCursor();
 
42
 
 
43
                                //region "Helpers"
 
44
 
 
45
                                bool         m_Dentro;
 
46
                                //endregion
 
47
 
 
48
 
 
49
                        protected:
 
50
                                TVector                  m_NodoMoviendose;  // Cursor
 
51
                                TVector                  m_Start;           // Origen del boundingBox
 
52
                                TVector                  m_Stop;            // Destino del boundingBox
 
53
 
 
54
                                TVector                  m_Vertices[4];     // Vertices del bounding box.
 
55
 
 
56
                                bool                     m_MouseDown;
 
57
                                Estado                   m_Estado;
 
58
                        };
 
59
 
 
60
                        //---------------------------------------------------------------------
 
61
 
 
62
                        class EXTAPI WRectangulo : public GNC::GCS::Widgets::IWidget {
 
63
 
 
64
                        //region "Constructor y destructor"
 
65
 
 
66
                        public:
 
67
                                typedef GNC::GCS::Nodo                   TNodo;
 
68
                                typedef GNC::GCS::Vector                 TVector;
 
69
                                typedef GNC::GCS::Matriz                 TMatriz;
 
70
                                typedef GNC::GCS::Contexto3D             TContexto;
 
71
                                typedef GNC::GCS::Eventos::EventoRaton   TEventoRaton;
 
72
                                typedef GNC::GCS::Eventos::EventoTeclado TEventoTeclado;
 
73
 
 
74
                                WRectangulo(TVector bb[4], IWidgetsManager* pManager, long vid, const char* nombre, long gid);
 
75
 
 
76
                                ~WRectangulo();
 
77
 
 
78
                                //endregion
 
79
 
 
80
                                //region "Interfaz especifica"
 
81
 
 
82
                                virtual void OnMouseEvents(TEventoRaton&);
 
83
 
 
84
                                virtual void OnKeyEvents(TEventoTeclado&);
 
85
 
 
86
                                virtual bool HitTest(float x, float y, float umbralCuadrado);
 
87
 
 
88
                                virtual bool HitTest(TVector* vertices, int numVertices);
 
89
 
 
90
                                virtual void Render(TContexto* c);
 
91
 
 
92
                                virtual void OffscreenRender(Contexto3D* c);
 
93
 
 
94
                                virtual bool SoportaAutoBorrado() const {
 
95
                                        return true;
 
96
                                }
 
97
 
 
98
                                //endregion
 
99
 
 
100
                                //region "Estado interno"
 
101
                        private:
 
102
                                bool            m_MouseDown;
 
103
                                TVector         m_PosCursor;
 
104
                                //endregion
 
105
 
 
106
                                //region "Propiedades geometricas"
 
107
                        public:
 
108
                                TNodo m_Vertices[4];
 
109
 
 
110
                                friend std::ostream& operator<<(std::ostream& out, const WRectangulo& w) {
 
111
                                        out << "[ Rect = [ " << w.m_Vertices[0] << ", " << w.m_Vertices[1] << ", " << w.m_Vertices[2] << ", " << w.m_Vertices[3] <<  " ],  GID=" << w.m_GID << ", TID=" << w.m_TID << " UID=" << w.m_UID << " ]";
 
112
                                        return out;
 
113
                                };
 
114
 
 
115
                                friend std::ostream& operator<<(std::ostream& out, const WRectangulo* w) {
 
116
                                        if (w == NULL) {
 
117
                                                out << "[ NULL ]";
 
118
                                        }
 
119
                                        else {
 
120
                                                out << *w;
 
121
                                        }
 
122
                                        return out;
 
123
                                };
 
124
 
 
125
                        public:
 
126
                                //endregion
 
127
 
 
128
                                //region "Propiedades radiometricas"
 
129
 
 
130
                                //endregion
 
131
                        };
 
132
                };
 
133
        };
 
134
};