00001 #ifndef TEXT2D_H
00002 #define TEXT2D_H
00003 #include "std/support.H"
00004 #include "disp/cam.H"
00005 #include "disp/ray.H"
00006 #include "geom/geom.H"
00007 #include "disp/view.H"
00008 #include "dlhandler/dlhandler.H"
00009
00010
00011
00012
00013 MAKE_PTR_SUBC(TEXT2D,GEOM);
00014 typedef const TEXT2Dptr CTEXT2Dptr;
00015
00016 class TEXT2D : public GEOM {
00017 protected:
00018 str_ptr _string;
00019 str_ptr _tmp_string;
00020 mlib::XYpt _pt2d;
00021 bool _is2d;
00022 bool _center;
00023 bool _can_intersect;
00024 bool _show_boxes;
00025
00026
00027 static bool _suppress_draw;
00028
00029 static DLhandler _dl;
00030 static void initialize(CVIEWptr &v);
00031
00032 void recompute_xform();
00033 public:
00034 TEXT2D() {}
00035 TEXT2D(Cstr_ptr &n, Cstr_ptr &s) :
00036 GEOM(n), _string(s), _is2d(0), _center(0),
00037 _can_intersect(1), _show_boxes(0) {}
00038 TEXT2D(Cstr_ptr &n, Cstr_ptr &s, const mlib::XYpt &p);
00039
00040 static void draw_debug(const char* str, mlib::XYpt& pos, CVIEWptr& view);
00041 static void draw_debug(const char* str, mlib::Wpt& pos, CVIEWptr& view);
00042
00043 static bool toggle_suppress_draw() {
00044 return (_suppress_draw = !_suppress_draw);
00045 }
00046
00047 virtual BBOX2D bbox2d (int b=5, char*s=0, int r=0) const;
00048 virtual void update () { }
00049
00050 virtual int draw (CVIEWptr &v);
00051 virtual RAYhit &intersect (RAYhit &r, mlib::CWtransf &m, int uv = 0) const;
00052 virtual bool inside (mlib::CXYpt_list&)const;
00053
00054 bool can_intersect() const{ return _can_intersect; }
00055 void can_intersect(bool c) { _can_intersect = c;}
00056 virtual char *get_string () const;
00057 void set_string (Cstr_ptr &n) { _string = n; }
00058 void show_boxes (bool sb =1 ) { _show_boxes = sb;}
00059 void tmpstr (const char *s) { _tmp_string = str_ptr(s);}
00060 bool ¢ered () { return _center; }
00061 void set_loc (mlib::CXYpt &p) { set_xform(mlib::Wpt(p[0],p[1],0));}
00062 bool is2d () const { return _is2d;}
00063 void set_is2d (bool is2d) { _is2d = is2d;}
00064 DEFINE_RTTI_METHODS2("TEXT2D", GEOM, CDATA_ITEM *);
00065 };
00066
00067 #endif
00068
00069