]> git.saurik.com Git - wxWidgets.git/blame - contrib/include/wx/canvas/bbox.h
implement wxColourDialog::Move() (patch 548048)
[wxWidgets.git] / contrib / include / wx / canvas / bbox.h
CommitLineData
09cc749c
RR
1#ifndef __WXBOUNDINGBOX_H__
2#define __WXBOUNDINGBOX_H__
3
4#ifdef __GNUG__
5 #pragma interface "bbox.cpp"
6#endif
7
8#ifndef WX_PRECOMP
9 #include "wx/wx.h"
10#endif
11
f9032263 12#include "wx/matrix.h"
09cc749c
RR
13#include "wx/geometry.h"
14
15enum OVERLAP {_IN,_ON,_OUT};
16
17//Purpose The wxBoundingBox class stores one wxBoundingBox.
18//The wxBoundingBox is defined by two coordiates,
19//a upperleft coordinate and a lowerright coordinate.
20class wxBoundingBox
21{
22public:
23 wxBoundingBox();
24 wxBoundingBox(wxBoundingBox&);
25 wxBoundingBox(const wxPoint2DDouble&);
26 wxBoundingBox(double xmin, double ymin, double xmax, double ymax);
27
28 bool And(wxBoundingBox*, double Marge = 0);
29
30 void EnLarge(const double Marge);
31 void Shrink(const double Marge);
32
33 void Expand(const wxPoint2DDouble& , const wxPoint2DDouble&);
34 void Expand(const wxPoint2DDouble&);
35 void Expand(double x,double y);
36 void Expand(const wxBoundingBox& bbox);
37
38 OVERLAP Intersect( wxBoundingBox &, double Marge = 0);
39 bool LineIntersect(const wxPoint2DDouble& begin, const wxPoint2DDouble& end );
40 bool PointInBox( const wxPoint2DDouble&, double Marge = 0);
41 bool PointInBox( double, double, double Marge = 0);
42
43 void Reset();
44
45 void Translate( wxPoint2DDouble& );
46 void MapBbox( const wxTransformMatrix& matrix);
47
48 double GetWidth() {return m_maxx-m_minx;};
49 double GetHeight(){return m_maxy-m_miny;};
50 bool GetValid() const;
51 void SetValid(bool);
52
53 void SetBoundingBox(const wxPoint2DDouble& a_point);
54
55 void SetMin(double, double);
56 void SetMax(double, double);
57 inline wxPoint2DDouble GetMin();
58 inline wxPoint2DDouble GetMax();
59 inline double GetMinX(){return m_minx;};
60 inline double GetMinY(){return m_miny;};
61 inline double GetMaxX(){return m_maxx;};
62 inline double GetMaxY(){return m_maxy;};
63
64 wxBoundingBox& operator+( wxBoundingBox& );
65 wxBoundingBox& operator=( const wxBoundingBox& );
66
67protected:
68 //bounding box in world
69 double m_minx;
70 double m_miny;
71 double m_maxx;
72 double m_maxy;
73 bool m_validbbox;
74};
75
76#endif