00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef POLYLINE_H
00010 #define POLYLINE_H
00011
00012 #ifdef __GNUG__
00013 #pragma interface
00014 #endif
00015
00016 #define KLEIN 1.0e-30
00017 #define GROOT 1.0e30
00018 #define PHI_MARGE 0.3 //must be lager than 0, 0.3 -> 30% (graden)
00019 #define SEG_MARGE 0.3 //must be lager than 0, 0.3 -> 30%
00020 #define OUTSIDE_POLY 0
00021 #define INSIDE_POLY 1
00022 #define ON_POLY 2
00023
00024 #define SELECT_DPHI 10
00025
00026
00027 #include <math.h>
00028
00029 #include "misc.h"
00030 #include "wxmatrix.h"
00031 #include "bbox.h"
00032
00033 #include "segment.h"
00034 #include "_lnk_itr.h"
00035
00037
00042 class G_Polyline :public DL_List<void*>
00043 {
00044 public:
00045
00046 G_Polyline();
00047 virtual ~G_Polyline();
00048
00049 void MakeEmpty();
00050
00051 bool RemoveZero();
00052 bool ContainsArcs();
00053 bool CheckForArcs();
00054 void SetArcs(bool val){_hasarcs=val;};
00055 bool CheckForPerfectArc(Point& middle, double& radius);
00056 BoundingBox* CalcBoundingBox(BoundingBox* a_box);
00057 void Transform(wxTransformMatrix* _Matrix);
00058 void ConvertArcs(double aber);
00059 void ConvertArcs2(double dphi,int minseg = 6);
00060 void ConvertSplined(double Aber);
00061 void CalcArc(TDLI<Segment>* where,Point& mid,double& Radius,double& beginrad,double& midrad,double& endrad,double& phit);
00062 void Copy(G_Polyline* PIT);
00063 void AddSegment(Segment* a);
00064 void ConvertLine(double aber,double Rmin,double Rmax);
00065 bool PointOnPolyline(Point*, double);
00066 bool PointOnArcseg(Point*,double);
00067 double CalcLength();
00068 G_Polyline& operator=(G_Polyline&);
00069
00070 protected:
00071 int TestArc(TDLI<Segment>*,double aber,double Rmin,double Rmax,Point& center_p);
00072 void insertArc(TDLI<Segment>*,int n, Point& center_p);
00073
00074 static TDLI<Segment> _PI;
00075 bool _hasarcs;
00076 };
00077
00078
00080
00086 class G_Polygon : public G_Polyline
00087 {
00088 public:
00089 G_Polygon();
00090 ~G_Polygon();
00091 G_Polygon& operator=(G_Polygon &other);
00092
00093 double CalcArea();
00094 bool DirectionIsClockWise();
00095 void ConvertLine(double aber,double Rmin,double Rmax);
00096 int PointInPolygon(const Point&, double);
00097 bool ContainsHoles();
00098 bool CheckForHoles();
00099 bool CheckForPerfectArc(Point& middle, double& radius);
00100 void SetHoles(bool val){_hasholes=val;};
00101 bool RemoveZero();
00102 void ConvertSplined(double Aber);
00103 double CalcLength();
00104
00105 protected:
00106 void GetLRO(const Point& P, const Point& p1, const Point& p2, int &LRO1, int &LRO2,const double marge);
00107 int TestArc_back(TDLI<Segment>*,double aber,double Rmin,double Rmax, Point& center_p);
00108 bool _hasholes;
00109
00110 };
00111
00112 #endif
polyline.h Source File -- Thu Nov 28 21:24:56 2002 -- 28 Nov 2002 -- 1.2.18 -- -- . --