00001 #ifndef JOT_CAM_FP_H
00002 #define JOT_CAM_FP_H
00003
00004 #include "disp/cam.H"
00005 #include "manip/manip.H"
00006 #include "manip/cam_pz.H"
00007 #include "widgets/collide.H"
00008 #include "std/stop_watch.H"
00009 #include "base_jotapp/base_jotapp.H"
00010 #include "widgets/collide.H"
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 class Cam_int_fp : public Interactor<Cam_int_fp,Event,State>,
00021 public UPobs {
00022 private:
00023 static void schedule_in_view(VIEWptr v, CamFocus* cf);
00024
00025 protected:
00026
00027
00028 class REF_CLASS(CAMwidget) {
00029 protected:
00030 GEOMptr _anchor;
00031
00032 int _a_displayed;
00033 public:
00034 CAMwidget();
00035 int anchor_displayed(){ return _a_displayed; }
00036 mlib::Wpt anchor_wpt() { return mlib::Wpt(_anchor->xform()); }
00037 mlib::XYpt anchor_pos() { return mlib::XYpt(anchor_wpt()); }
00038 double anchor_size() { return _anchor->xform().X().length(); }
00039 void undisplay_anchor();
00040 void display_anchor(mlib::CWpt &p);
00041 void drag_anchor (mlib::CXYpt &p2d);
00042 };
00043
00044 Gravity* _gravity;
00045 CamPhys _phys_cam;
00046 CAMwidget _camwidg;
00047 double _dtime;
00048 double _dist, _size;
00049 mlib::PIXEL _start_pix;
00050 mlib::XYpt _scale_pt;
00051 mlib::Wpt _down_pt;
00052 mlib::XYpt _down_pt_2d;
00053 VIEWptr _view;
00054 State _cam_rot, _cam_forward, _cam_back, _cam_left, _cam_right, _cam_choose;
00055 State _orbit, _breathe, _cruise, _grow, _grow_down;
00056 State _orb_rot, _orb_zoom, _cruise_zoom;
00057 State _breathe_rot, _cruise_rot;
00058 State _move_view, _icon_click;
00059
00060 State _entry2, _but_trans, _but_rot, _but_zoom, _but_drag, _phys;
00061
00062 ARRAY<UPobs*> _up_obs;
00063 int _do_reset;
00064 GEOMptr _geom;
00065 bool _resizing, _breathing;
00066 CamIcon *_icon;
00067 ICON2Dptr _button;
00068 Collide* _collision;
00069 XYpt _tp;
00070 XYpt _te;
00071 stop_watch _clock;
00072 stop_watch _land_clock;
00073
00074 stop_watch _move_clock;
00075
00076
00077
00078 public:
00079 void add_up_obs(UPobs *o) { _up_obs += o; }
00080 virtual int predown(CEvent &e,State *&s);
00081 virtual int down (CEvent &e,State *&s);
00082 virtual int down2 (CEvent &e,State *&s);
00083
00084
00085 virtual int rot (CEvent &e,State *&s);
00086 virtual int focus (CEvent &e,State *&s);
00087 virtual int choose (CEvent &e,State *&s);
00088 virtual int stop_orbit (CEvent &e,State *&s);
00089 virtual int orbit (CEvent &e,State *&s);
00090 virtual int cruise (CEvent &e,State *&s);
00091 virtual int cruise_zoom(CEvent &e,State *&s);
00092 virtual int cruise_zoom_up(CEvent &e,State *&s);
00093 virtual int cruise_down(CEvent &e,State *&s);
00094 virtual int stop_actions (CEvent &e,State *&s);
00095 virtual int stop_cruise (CEvent &e,State *&s);
00096 virtual int breathe (CEvent &e,State *&s);
00097 virtual int stop_breathe (CEvent &e,State *&s);
00098 virtual int orbit_zoom (CEvent &e,State *&s);
00099 virtual int orbit_rot (CEvent &e,State *&s);
00100 virtual int orbit_rot_up (CEvent &e,State *&s);
00101 virtual int move (CEvent &e,State *&s);
00102 virtual int forward (CEvent &e,State *&s);
00103 virtual int back (CEvent &e,State *&s);
00104 virtual int left (CEvent &e,State *&s);
00105 virtual int right (CEvent &e,State *&s);
00106 virtual int moveup (CEvent &e,State *&s);
00107 virtual int iconmove(CEvent &e,State *&s);
00108 virtual int iconup (CEvent &e,State *&s);
00109 virtual int up (CEvent &e,State *&s);
00110
00111 virtual int grow (CEvent &e,State *&s);
00112 virtual int grow_change (CEvent &e,State *&s);
00113
00114 virtual int dragup (CEvent &e,State *&s);
00115 virtual int noop (CEvent & ,State *&) { return 0; }
00116
00117 virtual int toggle_buttons (CEvent &e,State *&s);
00118
00119 virtual ~Cam_int_fp() {}
00120 Cam_int_fp(CEvent &d, CEvent &m, CEvent &u, CEvent &d2, CEvent &u2,
00121 CEvent &dt, CEvent &dr, CEvent &dz,
00122 CEvent &ut, CEvent &ur, CEvent &uz);
00123 void make_view (mlib::CXYpt &);
00124 virtual void reset(int rst);
00125 State *entry2 () { return &_entry2; }
00126 };
00127
00128
00129
00130 #endif // JOT_CAM_FP_H
00131