Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Stg::WorldGui Class Reference

#include <stage.hh>

Inheritance diagram for Stg::WorldGui:
Inheritance graph
[legend]

Public Member Functions

virtual std::string ClockString () const
 
void DrawBoundingBoxTree ()
 
std::string EnergyString (void) const
 
CanvasGetCanvas (void) const
 
virtual bool IsGUI () const
 
bool IsTopView ()
 
virtual void Load (const std::string &filename)
 
usec_t RealTimeNow (void) const
 
virtual ModelRecentlySelectedModel () const
 
virtual void Redraw (void)
 
virtual void RemoveChild (Model *mod)
 
virtual bool Save (const char *filename)
 
void Show ()
 
virtual void Start ()
 
virtual void Stop ()
 
virtual void UnLoad ()
 
virtual bool Update ()
 
 WorldGui (int W, int H, const char *L=0)
 
 ~WorldGui ()
 
- Public Member Functions inherited from Stg::World
void AddModelName (Model *mod, const std::string &name)
 
void AddPowerPack (PowerPack *pp)
 
SuperRegionAddSuperRegion (const point_int_t &coord)
 
void AddUpdateCallback (world_callback_t cb, void *user)
 
void CancelQuit ()
 
void CancelQuitAll ()
 
void ClearRays ()
 
void ConsumeQueue (unsigned int queue_num)
 
ModelCreateModel (Model *parent, const std::string &typestr)
 
SuperRegionCreateSuperRegion (point_int_t origin)
 
void DestroySuperRegion (SuperRegion *sr)
 
void DisableEnergy (Model *m)
 
void EnableEnergy (Model *m)
 
void Enqueue (unsigned int queue_num, usec_t delay, Model *mod, model_callback_t cb, void *arg)
 
void Extend (point3_t pt)
 
const std::set< Model * > GetAllModels () const
 
unsigned int GetEventQueue (Model *mod) const
 
const bounds3d_tGetExtent () const
 
ModelGetGround ()
 
ModelGetModel (const std::string &name) const
 
SuperRegionGetSuperRegion (const point_int_t &org)
 
SuperRegionGetSuperRegionCreate (const point_int_t &org)
 
uint64_t GetUpdateCount () const
 
WorldfileGetWorldFile ()
 
void LoadBlock (Worldfile *wf, int entity)
 
void LoadBlockGroup (Worldfile *wf, int entity)
 
void LoadModel (Worldfile *wf, int entity)
 
void LoadSensor (Worldfile *wf, int entity)
 
void Log (Model *mod)
 
void MapPoly (const std::vector< point_int_t > &poly, Block *block, unsigned int layer)
 
int32_t MetersToPixels (meters_t x) const
 
point_int_t MetersToPixels (const point_t &pt) const
 
void NeedRedraw ()
 
bool PastQuitTime ()
 
bool Paused () const
 
void Quit ()
 
void QuitAll ()
 
RaytraceResult Raytrace (const Ray &ray)
 
RaytraceResult Raytrace (const Pose &pose, const meters_t range, const ray_test_func_t func, const Model *finder, const void *arg, const bool ztest)
 
void Raytrace (const Pose &pose, const meters_t range, const radians_t fov, const ray_test_func_t func, const Model *finder, const void *arg, RaytraceResult *samples, const uint32_t sample_count, const bool ztest)
 
void RecordRay (double x1, double y1, double x2, double y2)
 
void RegisterOption (Option *opt)
 Register an Option for pickup by the GUI. More...
 
virtual void Reload ()
 
virtual void RemoveModel (Model *mod)
 
void RemovePowerPack (PowerPack *pp)
 
int RemoveUpdateCallback (world_callback_t cb, void *user)
 
double Resolution () const
 
void ShowClock (bool enable)
 Control printing time to stdout. More...
 
usec_t SimTimeNow (void) const
 
bool TestQuit () const
 
virtual void TogglePause ()
 
void TryCharge (PowerPack *pp, const Pose &pose)
 
uint64_t UpdateCount ()
 
 World (const std::string &name="MyWorld", double ppm=DEFAULT_PPM)
 
virtual ~World ()
 
- Public Member Functions inherited from Stg::Ancestor
virtual void AddChild (Model *mod)
 
 Ancestor ()
 
void ForEachDescendant (model_callback_t func, void *arg)
 
std::vector< Model * > & GetChildren ()
 
virtual Pose GetGlobalPose () const
 
void * GetProperty (std::string &key)
 
void SetProperty (std::string &key, void *value)
 
virtual void SetToken (const std::string &str)
 
const char * Token () const
 
const std::string & TokenStr () const
 
virtual ~Ancestor ()
 

Protected Member Functions

void DrawOccupancy () const
 
void DrawVoxels () const
 
virtual void PopColor ()
 
virtual void PushColor (Color col)
 
virtual void PushColor (double r, double g, double b, double a)
 
- Protected Member Functions inherited from Stg::World
void CallUpdateCallbacks ()
 Call all calbacks in cb_list, removing any that return true;. More...
 
- Protected Member Functions inherited from Stg::Ancestor
AncestorLoad (Worldfile *wf, int section)
 
void Save (Worldfile *wf, int section)
 

Private Member Functions

virtual void AddModel (Model *mod)
 
bool closeWindowQuery ()
 
bool saveAsDialog ()
 
void SetTimeouts ()
 

Static Private Member Functions

static void fasterCb (Fl_Widget *w, WorldGui *wg)
 
static void fasttimeCb (Fl_Widget *w, WorldGui *wg)
 
static void fileExitCb (Fl_Widget *w, WorldGui *wg)
 
static void fileLoadCb (Fl_Widget *w, WorldGui *wg)
 
static void fileSaveAsCb (Fl_Widget *w, WorldGui *wg)
 
static void fileSaveCb (Fl_Widget *w, WorldGui *wg)
 
static void helpAboutCb (Fl_Widget *w, WorldGui *wg)
 
static void moreHelptCb (Fl_Widget *w, WorldGui *wg)
 
static void onceCb (Fl_Widget *w, WorldGui *wg)
 
static void optionsDlgCb (OptionsDlg *oDlg, WorldGui *wg)
 
static void pauseCb (Fl_Widget *w, WorldGui *wg)
 
static void realtimeCb (Fl_Widget *w, WorldGui *wg)
 
static void resetViewCb (Fl_Widget *w, WorldGui *wg)
 
static void slowerCb (Fl_Widget *w, WorldGui *wg)
 
static void viewOptionsCb (OptionsDlg *oDlg, WorldGui *wg)
 
static void windowCb (Fl_Widget *w, WorldGui *wg)
 

Private Attributes

Canvascanvas
 
std::vector< Option * > drawOptions
 
FileManagerfileMan
 Used to load and save worldfiles. More...
 
std::vector< usec_tinterval_log
 
Fl_Menu_Bar * mbar
 
OptionsDlgoDlg
 
bool pause_time
 
usec_t real_time_interval
 
usec_t real_time_now
 
usec_t real_time_recorded
 
double speedup
 
uint64_t timing_interval
 

Friends

class Canvas
 
class Model
 
class ModelCamera
 
class Option
 

Additional Inherited Members

- Static Public Member Functions inherited from Stg::World
static void Run ()
 
static void * update_thread_entry (std::pair< World *, int > *info)
 
static bool UpdateAll ()
 
- Public Attributes inherited from Stg::World
std::set< Model * > active_energy
 
std::set< ModelPosition * > active_velocity
 
std::vector< std::priority_queue< Event > > event_queues
 
Modelground
 
bool paused
 if true, the simulation is stopped More...
 
std::vector< std::queue< Model * > > pending_update_callbacks
 
std::vector< point_int_trt_candidate_cells
 
std::vector< point_int_trt_cells
 
usec_t sim_interval
 
int update_cb_count
 
- Static Public Attributes inherited from Stg::World
static std::vector< std::string > args
 
static std::string ctrlargs
 
static const int DEFAULT_PPM = 50
 
- Protected Attributes inherited from Stg::World
std::list< std::pair< world_callback_t, void * > > cb_list
 List of callback functions and arguments. More...
 
bounds3d_t extent
 Describes the 3D volume of the world. More...
 
bool graphics
 true iff we have a GUI More...
 
std::set< Option * > option_table
 GUI options (toggles) registered by models. More...
 
std::list< PowerPack * > powerpack_list
 List of all the powerpacks attached to models in the world. More...
 
usec_t quit_time
 
std::list< float * > ray_list
 List of rays traced for debug visualization. More...
 
usec_t sim_time
 the current sim time in this world in microseconds More...
 
std::map< point_int_t, SuperRegion * > superregions
 
std::vector< std::vector< Model * > > update_lists
 
uint64_t updates
 the number of simulated time steps executed so far More...
 
Worldfilewf
 If set, points to the worldfile used to create this world. More...
 
- Protected Attributes inherited from Stg::Ancestor
std::map< std::string, unsigned int > child_type_counts
 
std::vector< Model * > children
 
bool debug
 
std::map< std::string, void * > props
 
std::string token
 

Detailed Description

Extends World to implement an FLTK / OpenGL graphical user interface.

Definition at line 1498 of file stage.hh.

Constructor & Destructor Documentation

WorldGui::WorldGui ( int  W,
int  H,
const char *  L = 0 
)

Definition at line 187 of file worldgui.cc.

WorldGui::~WorldGui ( )

Definition at line 243 of file worldgui.cc.

Member Function Documentation

void WorldGui::AddModel ( Model mod)
privatevirtual

Reimplemented from Stg::World.

Definition at line 405 of file worldgui.cc.

std::string WorldGui::ClockString ( void  ) const
virtual

Get human readable string that describes the current simulation time.

Reimplemented from Stg::World.

Definition at line 387 of file worldgui.cc.

bool WorldGui::closeWindowQuery ( )
private

Definition at line 819 of file worldgui.cc.

void WorldGui::DrawBoundingBoxTree ( )

Definition at line 851 of file worldgui.cc.

void WorldGui::DrawOccupancy ( void  ) const
protected

Definition at line 434 of file worldgui.cc.

void WorldGui::DrawVoxels ( ) const
protected

Definition at line 454 of file worldgui.cc.

std::string WorldGui::EnergyString ( void  ) const

Get human readable string that describes the current global energy state.

Definition at line 421 of file worldgui.cc.

void WorldGui::fasterCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 560 of file worldgui.cc.

void WorldGui::fasttimeCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 577 of file worldgui.cc.

void WorldGui::fileExitCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 529 of file worldgui.cc.

void WorldGui::fileLoadCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 478 of file worldgui.cc.

void WorldGui::fileSaveAsCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 524 of file worldgui.cc.

void WorldGui::fileSaveCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 515 of file worldgui.cc.

Canvas* Stg::WorldGui::GetCanvas ( void  ) const
inline

Definition at line 1592 of file stage.hh.

void WorldGui::helpAboutCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 723 of file worldgui.cc.

virtual bool Stg::WorldGui::IsGUI ( ) const
inlinevirtual

Returns true iff this World implements a GUI. The base World class returns false, but subclasses can override this behaviour.

Reimplemented from Stg::World.

Definition at line 1582 of file stage.hh.

bool WorldGui::IsTopView ( )

Definition at line 876 of file worldgui.cc.

void WorldGui::Load ( const std::string &  worldfile_path)
virtual

Open the file at the specified location, create a Worldfile object, read the file and configure the world from the contents, creating models as necessary. The created object persists, and can be retrieved later with World::GetWorldFile().

Reimplemented from Stg::World.

Definition at line 256 of file worldgui.cc.

void WorldGui::moreHelptCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 767 of file worldgui.cc.

void WorldGui::onceCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 637 of file worldgui.cc.

void WorldGui::optionsDlgCb ( OptionsDlg oDlg,
WorldGui wg 
)
staticprivate

Definition at line 673 of file worldgui.cc.

void WorldGui::pauseCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 632 of file worldgui.cc.

void WorldGui::PopColor ( )
protectedvirtual

Reimplemented from Stg::World.

Definition at line 863 of file worldgui.cc.

void WorldGui::PushColor ( Color  col)
protectedvirtual

Reimplemented from Stg::World.

Definition at line 857 of file worldgui.cc.

void WorldGui::PushColor ( double  r,
double  g,
double  b,
double  a 
)
protectedvirtual

Reimplemented from Stg::World.

Definition at line 860 of file worldgui.cc.

void WorldGui::realtimeCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 568 of file worldgui.cc.

usec_t WorldGui::RealTimeNow ( void  ) const

Definition at line 869 of file worldgui.cc.

Model * WorldGui::RecentlySelectedModel ( ) const
virtual

Reimplemented from Stg::World.

Definition at line 866 of file worldgui.cc.

void WorldGui::Redraw ( void  )
virtual

Forces the window to be redrawn, even if paused.

Reimplemented from Stg::World.

Definition at line 586 of file worldgui.cc.

void WorldGui::RemoveChild ( Model mod)
virtual

Reimplemented from Stg::Ancestor.

Definition at line 414 of file worldgui.cc.

void WorldGui::resetViewCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 538 of file worldgui.cc.

bool WorldGui::Save ( const char *  filename)
virtual

Save the current world state into a worldfile with the given filename.

Parameters
Filenameto save as.

Reimplemented from Stg::World.

Definition at line 319 of file worldgui.cc.

bool WorldGui::saveAsDialog ( )
private

Definition at line 793 of file worldgui.cc.

void WorldGui::SetTimeouts ( )
private

Definition at line 605 of file worldgui.cc.

void WorldGui::Show ( )

show the window - need to call this if you don't Load().

Definition at line 251 of file worldgui.cc.

void WorldGui::slowerCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 549 of file worldgui.cc.

void WorldGui::Start ( )
virtual

Reimplemented from Stg::World.

Definition at line 592 of file worldgui.cc.

void WorldGui::Stop ( )
virtual

Reimplemented from Stg::World.

Definition at line 619 of file worldgui.cc.

void WorldGui::UnLoad ( )
virtual

Reimplemented from Stg::World.

Definition at line 314 of file worldgui.cc.

bool WorldGui::Update ( void  )
virtual

Run one simulation timestep. Advances the simulation clock, executes all simulation updates due at the current time, then queues up future events.

Reimplemented from Stg::World.

Definition at line 354 of file worldgui.cc.

void WorldGui::viewOptionsCb ( OptionsDlg oDlg,
WorldGui wg 
)
staticprivate

Definition at line 646 of file worldgui.cc.

void WorldGui::windowCb ( Fl_Widget *  w,
WorldGui wg 
)
staticprivate

Definition at line 462 of file worldgui.cc.

Friends And Related Function Documentation

friend class Canvas
friend

Definition at line 1500 of file stage.hh.

friend class Model
friend

Definition at line 1502 of file stage.hh.

friend class ModelCamera
friend

Definition at line 1501 of file stage.hh.

friend class Option
friend

Definition at line 1503 of file stage.hh.

Member Data Documentation

Canvas* Stg::WorldGui::canvas
private

Definition at line 1507 of file stage.hh.

std::vector<Option*> Stg::WorldGui::drawOptions
private

Definition at line 1508 of file stage.hh.

FileManager* Stg::WorldGui::fileMan
private

Used to load and save worldfiles.

Definition at line 1509 of file stage.hh.

std::vector<usec_t> Stg::WorldGui::interval_log
private

Definition at line 1510 of file stage.hh.

Fl_Menu_Bar* Stg::WorldGui::mbar
private

Definition at line 1516 of file stage.hh.

OptionsDlg* Stg::WorldGui::oDlg
private

Definition at line 1517 of file stage.hh.

bool Stg::WorldGui::pause_time
private

Definition at line 1518 of file stage.hh.

usec_t Stg::WorldGui::real_time_interval
private

The amount of real time elapsed between $timing_interval timesteps.

Definition at line 1522 of file stage.hh.

usec_t Stg::WorldGui::real_time_now
private

The current real time in microseconds.

Definition at line 1525 of file stage.hh.

usec_t Stg::WorldGui::real_time_recorded
private

The last recorded real time, sampled every $timing_interval updates.

Definition at line 1529 of file stage.hh.

double Stg::WorldGui::speedup
private

Stage attempts to run this many times faster than real time. If -1, Stage runs as fast as possible.

Definition at line 1514 of file stage.hh.

uint64_t Stg::WorldGui::timing_interval
private

Number of updates between measuring elapsed real time.

Definition at line 1532 of file stage.hh.


The documentation for this class was generated from the following files:


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Mon Jun 10 2019 15:06:12