31#ifndef _OCPN_REGION_H_
32#define _OCPN_REGION_H_
58 OCPNRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
59 OCPNRegion(
const wxPoint& topLeft,
const wxPoint& bottomRight);
62 OCPNRegion(
size_t n,
const wxPoint* points,
int fillStyle = wxODDEVEN_RULE);
66 wxRegion* GetNew_wxRegion()
const;
71 void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
75 bool operator==(
const OCPNRegion& region)
const {
return ODoIsEqual(region); }
76 bool operator!=(
const OCPNRegion& region)
const {
return !(*
this == region); }
78 bool IsOk()
const {
return m_refData != NULL; }
79 bool Ok()
const {
return IsOk(); }
82 bool GetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h)
const {
83 return ODoGetBox(x, y, w, h);
85 wxRect GetBox()
const {
87 return ODoGetBox(x, y, w, h) ? wxRect(x, y, w, h) : wxRect();
91 wxRegionContain Contains(wxCoord x, wxCoord y)
const {
92 return ODoContainsPoint(x, y);
94 wxRegionContain Contains(
const wxPoint& pt)
const {
95 return ODoContainsPoint(pt.x, pt.y);
97 wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
const {
98 return ODoContainsRect(wxRect(x, y, w, h));
100 wxRegionContain Contains(
const wxRect& rect)
const {
101 return ODoContainsRect(rect);
108 virtual void Clear();
109 virtual bool IsEmpty()
const;
110 bool Empty()
const {
return IsEmpty(); }
115 void* GetRegion()
const;
117 bool Offset(wxCoord x, wxCoord y) {
return ODoOffset(x, y); }
118 bool Offset(
const wxPoint& pt) {
return ODoOffset(pt.x, pt.y); }
119 bool Intersect(
const OCPNRegion& region) {
return ODoIntersect(region); }
120 bool Union(
const OCPNRegion& region) {
return ODoUnionWithRegion(region); }
121 bool Union(wxCoord x, wxCoord y, wxCoord w, wxCoord h) {
122 return ODoUnionWithRect(wxRect(x, y, w, h));
124 bool Union(
const wxRect& rect) {
return ODoUnionWithRect(rect); }
125 bool Subtract(
const OCPNRegion& region) {
return ODoSubtract(region); }
129 virtual wxObjectRefData* CreateRefData()
const;
130 virtual wxObjectRefData* CloneRefData(
const wxObjectRefData* data)
const;
133 virtual bool ODoIsEqual(
const OCPNRegion& region)
const;
134 virtual bool ODoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h)
const;
135 virtual wxRegionContain ODoContainsPoint(wxCoord x, wxCoord y)
const;
136 virtual wxRegionContain ODoContainsRect(
const wxRect& rect)
const;
138 virtual bool ODoOffset(wxCoord x, wxCoord y);
139 virtual bool ODoUnionWithRect(
const wxRect& rect);
140 virtual bool ODoUnionWithRegion(
const OCPNRegion& region);
141 virtual bool ODoIntersect(
const OCPNRegion& region);
142 virtual bool ODoSubtract(
const OCPNRegion& region);
164 bool HaveRects()
const;
166 wxRect GetRect()
const;
179 wxRegionIterator* m_ri;