Main Page   Class Hierarchy   Compound List   File List   Compound Members  

bbox.h

00001 /*
00002 Program BBOX.CPP
00003 Purpose The BoundingBox class stores one boundingbox.
00004                 The boundingbox is defined by two coordiates,
00005                 a upperleft coordinate and a lowerright coordinate.
00006                 The boundingBox will be used by many classes:
00007                 boundary, path, text, sref, aref, structure and
00008                 gdsii. When an error occurs an object of class will be thrown.
00009 Last Update     12-12-1995
00010 */
00011 
00012 #ifndef BOUNDINGBOX_H
00013 #define BOUNDINGBOX_H
00014 
00015 #ifdef __GNUG__
00016 #pragma interface
00017 #endif
00018 
00019 
00020 #include "point.h"
00021 #include "wxmatrix.h"
00022 #include "gdserr.h"
00023 
00024 enum OVERLAP {_IN,_ON,_OUT};
00025 
00026 class BoundingBox
00027 {
00028         public:
00029                 // constructors
00030                 BoundingBox();
00031       //destructor
00032                 BoundingBox(BoundingBox&);
00033 
00034                 BoundingBox(const Point&);
00035 
00036       //constructor boundingbox
00037                 BoundingBox(double xmin, double ymin, double xmax, double ymax);
00038 
00039                 bool                    And(BoundingBox*, double Marge = 0);
00040 
00041                 void                            EnLarge(const double Marge);
00042                 void                            Shrink(const double Marge);
00043 
00044                 void                            Expand(const Point&,const Point&);
00045                 void                            Expand(const Point&);
00046                 void                            Expand(double x,double y);
00047                 void                            Expand(BoundingBox&);
00048 
00049                 OVERLAP                         Intersect(BoundingBox &, double Marge = 0);
00050                 bool                    LineIntersect(const Point&,const Point&);
00051                 bool                    PointInBox(const Point&, double Marge = 0);
00052                 bool                    PointInBox(double, double, double Marge = 0);
00053 
00054                 void                            Reset();
00055 
00056                 void                            SetBoundingBox(const Point&);
00057 
00058                 void                            Translate(Point&);
00059                 void                            MapBbox(wxTransformMatrix*);
00060                 Point   GetMin();
00061                 Point   GetMax();
00062       double   GetWidth(){return _xmax-_xmin;};
00063       double   GetHeight(){return _ymax-_ymin;};
00064                 bool    GetValid();
00065                 void            SetMin(double, double);
00066                 void            SetMax(double, double);
00067                 void            SetValid(bool);
00068 
00069                 BoundingBox&    operator+(BoundingBox&);
00070                 BoundingBox&    operator=(BoundingBox&);
00071 
00072         protected:
00073                 double  Min(double, double);
00074                 double  Max(double, double);
00075 
00076                 double                  _xmin;
00077                 double                  _ymin;
00078                 double                  _xmax;
00079                 double                  _ymax;
00080                 bool                    _valid_bbox;
00081 };
00082 
00083 #endif
bbox.h Source File -- Thu Nov 28 21:24:55 2002 -- 28 Nov 2002 -- 1.2.18 -- -- . -- Main Page