00001
00002
00003
00004
00005 #ifndef MERCATOR_AREA_H
00006 #define MERCATOR_AREA_H
00007
00008 #include <wfmath/axisbox.h>
00009 #include <wfmath/polygon.h>
00010
00011 namespace Mercator
00012 {
00013
00014 class Segment;
00015
00016 class Area
00017 {
00018 public:
00019 Area(int l, bool hole);
00020
00021 void setLayer(int l, bool hole);
00022
00023 void setShape(const WFMath::Polygon<2>& p);
00024
00025 bool contains(double x, double y) const;
00026
00027 int getLayer() const
00028 {
00029 return m_layer;
00030 }
00031
00032 bool isHole() const
00033 {
00034 return m_hole;
00035 }
00036
00037 const WFMath::AxisBox<2> & bbox() const
00038 {
00039 return m_box;
00040 }
00041
00042 const WFMath::Polygon<2> & shape() const
00043 {
00044 return m_shape;
00045 }
00046
00050 bool checkIntersects(const Segment& s) const;
00051
00052 WFMath::Polygon<2> clipToSegment(const Segment& s) const;
00053 private:
00054
00055 int m_layer;
00056 bool m_hole;
00057 WFMath::Polygon<2> m_shape;
00058 WFMath::AxisBox<2> m_box;
00059 };
00060
00061 }
00062
00063 #endif // of MERCATOR_AREA_H