Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

include/StateControl.h

Go to the documentation of this file.
00001 
00017 #define STATECONTROL_H
00018 
00019 #ifndef _STDLIB_H
00020 #include <stdlib.h>
00021 #endif
00022 
00023 #ifndef STDIO_H
00024 #include <stdio.h>
00025 #endif
00026 
00027 #ifndef _GLIBCXX_VECTOR
00028 #include <vector>
00029 #endif
00030 
00031 #ifndef _GLIBCXX_MAP
00032 #include <map>
00033 #endif
00034 
00035 #ifndef _GLIBCXX_STRING
00036 #include <string>
00037 #endif
00038 
00039 #ifndef _PTHREAD_H
00040 #include <pthread.h>
00041 #endif
00042 
00043 #ifndef OSG_GROUP 
00044 #include <osg/Group>
00045 #endif
00046 
00047 #ifndef OSG_NODE
00048 #include <osg/Node>
00049 #endif
00050 
00051 #ifndef OSGPRODUCER_VIEWER
00052 #include <osgProducer/Viewer>
00053 #endif
00054 
00055 #ifndef OSGGA_NODETRACKERMANIPULATOR
00056 #include <osgGA/NodeTrackerManipulator>
00057 #endif
00058 
00059 #ifndef ANIMATIONPATHTIMEDCALLBACK_H
00060 #include <AnimationPathTimedCallback.h>
00061 #endif
00062 
00063 #ifndef TRAPLASOBJECT_H
00064 #include "TraplasObject.h"
00065 #endif
00066 
00067 #ifndef BOOST_SHARED_PTR_HPP_INCLUDED
00068 #include <boost/shared_ptr.hpp>
00069 #endif
00070 
00071 //forward declaration.
00072 class Dispatcher;
00073 class UserInterface;
00074 
00075 using namespace boost;
00076 using namespace std; 
00077 
00078 #define CARGO 0
00079 #define TRANSPORT 1
00080 #define LOCATION 2
00081 
00082 
00083 
00091 class StateControl{
00092 
00093         public:
00098         StateControl(Dispatcher* disp); 
00102         ~StateControl();
00119         bool location(int loc_id, shared_ptr<string> desc, unsigned int capacity, double dist, double s, int tile, double width, double height, double x, double y, double rot);
00131         bool drv(int Rt, int Ri_a, int Ri_b, int Ri_d, double ts, double te);
00142         bool load(int Rt, int Ri, int C, double ts, double tf);
00153         bool unload(int Rt, int Ri, int C, double ts, double te);
00161         bool setspdinviz(int R, double s);
00171         bool trnew(int Rt, shared_ptr<string> desc, int Ri, double s);
00178         bool trdel(int Rt);
00187         bool newcarg(int C, shared_ptr<string> desc, int Ri);
00194         bool rmcarg(int C);
00202         bool arc(int Ri_a, int Ri_b);
00206         inline osg::Group* getOsgRoot(){return osgRoot;}
00212         friend void* go(void *none);
00218         bool adjustTimeFlow(double adj);
00222         double getTimeFlow();
00226         double getTime();
00230         void pause();
00236         int selectObject(TraplasObject* obj);
00240         TraplasObject* getLastSelected();
00246         int deselectObject(TraplasObject* obj);
00250         void clearSelection();
00251 
00252         /* TODO *
00253          * Toggle tracking camera mode.
00254          */
00255 //      void track();
00256         /* TODO *
00257          * Sets tracking of specified node.
00258          * @param n The node to track.
00259    */
00260 //      void trackThis(osg::Node* n);
00261         private:
00262         Dispatcher* dis;                                                 
00263         UserInterface* ui;                                
00264         osgProducer::Viewer* view; //Reference to the viewer. Could be used to set cameraManipulators to track selected nodes. 
00265         string trackingCamName;         //Name of the cameraManipulator that was going to be used for tracking selected objects. Work in progress. See StateControl::Track().
00266         string previousCamName;         //Name of the cameraManipulator to switch back to once we're done tracking a selected object. Work in progress.
00267         map<int, TraplasObject*> world; //all objects in the scene, by traplas id.
00268         vector<TraplasObject*> selected;  //selected objects in the scene.
00269         osg::Group* osgRoot;                                                    //the root of the OSG scene.
00270         map<int, string> tileMap; //tile model mappings.
00271         double tilescale;                                       //scaling of the tile models.
00272         string transmodel;                              //transport model mapping.
00273         double transscale;                              //scaling of the transport model.
00274         string cargomodel;                              //cargo model mapping.
00275         double cargoscale;                              //scaling of the cargo model.
00276         pthread_t osg_update_loop;//thread reference for the thread that handles the osg part of the visualisation. 
00277         bool readMapping(int);          //help function to read the model-resource mapping from file.
00278         void updateHudText(TraplasObject* upd); //Update the text of the selected object that is visible in the HUD.
00279         double pausetime;                                       //Used to store the timeflow before pausing. This makes it easier to 'unpause' by just clicking the pause button again.
00280 };
00281 
00282 

Generated on Mon Jun 19 10:22:04 2006 for TraplasVisualisation by  doxygen 1.4.4