Revision: 7283
http://playerstage.svn.sourceforge.net/playerstage/?rev=7283&view=rev
Author: alexcb
Date: 2009-01-21 23:57:00 +0000 (Wed, 21 Jan 2009)
Log Message:
-----------
started to fix bug when changes to data filter doesnt redraw screen - fixed for
custom visualizations
Modified Paths:
--------------
code/stage/trunk/libstage/canvas.cc
code/stage/trunk/libstage/model.cc
code/stage/trunk/libstage/model_blinkenlight.cc
code/stage/trunk/libstage/model_blobfinder.cc
code/stage/trunk/libstage/model_camera.cc
code/stage/trunk/libstage/model_fiducial.cc
code/stage/trunk/libstage/model_laser.cc
code/stage/trunk/libstage/model_position.cc
code/stage/trunk/libstage/model_ranger.cc
code/stage/trunk/libstage/option.cc
code/stage/trunk/libstage/option.hh
code/stage/trunk/libstage/stage.hh
Modified: code/stage/trunk/libstage/canvas.cc
===================================================================
--- code/stage/trunk/libstage/canvas.cc 2009-01-21 23:07:45 UTC (rev 7282)
+++ code/stage/trunk/libstage/canvas.cc 2009-01-21 23:57:00 UTC (rev 7283)
@@ -56,25 +56,25 @@
last_selection( NULL ),
interval( 50 ), //msec between redraws
// initialize Option objects
- showBlinken( "Blinkenlights", "show_blinkenlights", "", true ),
- showBlocks( "Blocks", "show_blocks", "b", true ),
- showClock( "Clock", "show_clock", "c", true ),
- showData( "Data", "show_data", "d", false ),
- showFlags( "Flags", "show_flags", "l", true ),
- showFollow( "Follow", "show_follow", "f", false ),
- showFootprints( "Footprints", "show_footprints", "o", false ),
- showGrid( "Grid", "show_grid", "g", true ),
- showOccupancy( "Debug/Occupancy", "show_occupancy", "^o", false ),
- showScreenshots( "Save screenshots", "screenshots", "", false ),
- showStatus( "Status", "show_status", "s", true ),
- showTrailArrows( "Trails/Rising Arrows", "show_trailarrows", "^a", false ),
- showTrailRise( "Trails/Rising blocks", "show_trailrise", "^r", false ),
- showTrails( "Trails/Fast", "show_trailfast", "^f", false ),
- showTree( "Debug/Tree", "show_tree", "^t", false ),
- showBBoxes( "Debug/Bounding boxes", "show_boundingboxes", "^b", false ),
- showBlur( "Trails/Blur", "show_trailblur", "^d", false ),
- pCamOn( "Perspective camera", "pcam_on", "r", false ),
- visualizeAll( "Selected only", "vis_all", "^v", false ),
+ showBlinken( "Blinkenlights", "show_blinkenlights", "", true, world ),
+ showBlocks( "Blocks", "show_blocks", "b", true, world ),
+ showClock( "Clock", "show_clock", "c", true, world ),
+ showData( "Data", "show_data", "d", false, world ),
+ showFlags( "Flags", "show_flags", "l", true, world ),
+ showFollow( "Follow", "show_follow", "f", false, world ),
+ showFootprints( "Footprints", "show_footprints", "o", false, world ),
+ showGrid( "Grid", "show_grid", "g", true, world ),
+ showOccupancy( "Debug/Occupancy", "show_occupancy", "^o", false, world ),
+ showScreenshots( "Save screenshots", "screenshots", "", false, world ),
+ showStatus( "Status", "show_status", "s", true, world ),
+ showTrailArrows( "Trails/Rising Arrows", "show_trailarrows", "^a", false,
world ),
+ showTrailRise( "Trails/Rising blocks", "show_trailrise", "^r", false, world
),
+ showTrails( "Trails/Fast", "show_trailfast", "^f", false, world ),
+ showTree( "Debug/Tree", "show_tree", "^t", false, world ),
+ showBBoxes( "Debug/Bounding boxes", "show_boundingboxes", "^b", false, world
),
+ showBlur( "Trails/Blur", "show_trailblur", "^d", false, world ),
+ pCamOn( "Perspective camera", "pcam_on", "r", false, world ),
+ visualizeAll( "Selected only", "vis_all", "^v", false, world ),
// and the rest
graphics( true ),
world( world ),
Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc 2009-01-21 23:07:45 UTC (rev 7282)
+++ code/stage/trunk/libstage/model.cc 2009-01-21 23:57:00 UTC (rev 7283)
@@ -943,7 +943,7 @@
Canvas* canvas = world_gui->GetCanvas();
std::map< std::string, Option* >::iterator i =
canvas->_custom_options.find( custom_visual->name() );
if( i == canvas->_custom_options.end() ) {
- Option* op = new Option( custom_visual->name(),
custom_visual->name(), "", true );
+ Option* op = new Option( custom_visual->name(),
custom_visual->name(), "", true, world );
canvas->_custom_options[ custom_visual->name() ] = op;
registerOption( op );
}
Modified: code/stage/trunk/libstage/model_blinkenlight.cc
===================================================================
--- code/stage/trunk/libstage/model_blinkenlight.cc 2009-01-21 23:07:45 UTC
(rev 7282)
+++ code/stage/trunk/libstage/model_blinkenlight.cc 2009-01-21 23:57:00 UTC
(rev 7283)
@@ -51,7 +51,8 @@
#include "stage_internal.hh"
#include "option.hh"
-Option ModelBlinkenlight::showBlinkenData( "Show Blink", "show_blinken", "",
true );
+//TODO make instance attempt to register an option (as customvisualizations do)
+Option ModelBlinkenlight::showBlinkenData( "Show Blink", "show_blinken", "",
true, NULL );
ModelBlinkenlight::ModelBlinkenlight( World* world,
Modified: code/stage/trunk/libstage/model_blobfinder.cc
===================================================================
--- code/stage/trunk/libstage/model_blobfinder.cc 2009-01-21 23:07:45 UTC
(rev 7282)
+++ code/stage/trunk/libstage/model_blobfinder.cc 2009-01-21 23:57:00 UTC
(rev 7283)
@@ -25,7 +25,8 @@
static const unsigned int DEFAULT_BLOBFINDERSCANWIDTH = 80;
static const unsigned int DEFAULT_BLOBFINDERSCANHEIGHT = 60;
-Option ModelBlobfinder::showBlobData( "Show Blobfinder", "show_blob", "", true
);
+//TODO make instance attempt to register an option (as customvisualizations do)
+Option ModelBlobfinder::showBlobData( "Show Blobfinder", "show_blob", "",
true, NULL );
/**
@ingroup model
Modified: code/stage/trunk/libstage/model_camera.cc
===================================================================
--- code/stage/trunk/libstage/model_camera.cc 2009-01-21 23:07:45 UTC (rev
7282)
+++ code/stage/trunk/libstage/model_camera.cc 2009-01-21 23:57:00 UTC (rev
7283)
@@ -17,7 +17,8 @@
#include <sstream>
#include <iomanip>
-Option ModelCamera::showCameraData( "Show Camera Data", "show_camera", "",
true );
+//TODO make instance attempt to register an option (as customvisualizations do)
+Option ModelCamera::showCameraData( "Show Camera Data", "show_camera", "",
true, NULL );
static const Size DEFAULT_SIZE( 0.1, 0.07, 0.05 );
static const char DEFAULT_GEOM_COLOR[] = "black";
Modified: code/stage/trunk/libstage/model_fiducial.cc
===================================================================
--- code/stage/trunk/libstage/model_fiducial.cc 2009-01-21 23:07:45 UTC (rev
7282)
+++ code/stage/trunk/libstage/model_fiducial.cc 2009-01-21 23:57:00 UTC (rev
7283)
@@ -23,7 +23,8 @@
const stg_radians_t DEFAULT_FIDUCIAL_FOV = M_PI;
const stg_watts_t DEFAULT_FIDUCIAL_WATTS = 10.0;
-Option ModelFiducial::showFiducialData( "Show Fiducial", "show_fiducial", "",
true );
+//TODO make instance attempt to register an option (as customvisualizations do)
+Option ModelFiducial::showFiducialData( "Show Fiducial", "show_fiducial", "",
true, NULL );
/**
@ingroup model
@@ -38,9 +39,9 @@
@par Summary and default values
@verbatim
-fiducialfinder
+fiducial
(
- # fiducialfinder properties
+ # fiducial properties
range_min 0.0
range_max 8.0
range_max_id 5.0
@@ -68,8 +69,8 @@
Model* parent )
: Model( world, parent, MODEL_TYPE_FIDUCIAL )
{
- PRINT_DEBUG2( "Constructing ModelFiducial %d (%s)\n",
- id, typestr );
+ //PRINT_DEBUG2( "Constructing ModelFiducial %d (%s)\n",
+ // id, typestr );
// assert that Update() is reentrant for this derived model
thread_safe = true;
Modified: code/stage/trunk/libstage/model_laser.cc
===================================================================
--- code/stage/trunk/libstage/model_laser.cc 2009-01-21 23:07:45 UTC (rev
7282)
+++ code/stage/trunk/libstage/model_laser.cc 2009-01-21 23:57:00 UTC (rev
7283)
@@ -28,8 +28,9 @@
static const unsigned int DEFAULT_RESOLUTION = 1;
static const char* DEFAULT_COLOR = "blue";
-Option ModelLaser::showLaserData( "Laser scans", "show_laser", "", true );
-Option ModelLaser::showLaserStrikes( "Laser strikes", "show_laser_strikes",
"", false );
+//TODO make instance attempt to register an option (as customvisualizations do)
+Option ModelLaser::showLaserData( "Laser scans", "show_laser", "", true, NULL
);
+Option ModelLaser::showLaserStrikes( "Laser strikes", "show_laser_strikes",
"", false, NULL );
/**
@ingroup model
Modified: code/stage/trunk/libstage/model_position.cc
===================================================================
--- code/stage/trunk/libstage/model_position.cc 2009-01-21 23:07:45 UTC (rev
7282)
+++ code/stage/trunk/libstage/model_position.cc 2009-01-21 23:57:00 UTC (rev
7283)
@@ -82,8 +82,9 @@
const stg_position_localization_mode_t POSITION_LOCALIZATION_DEFAULT =
STG_POSITION_LOCALIZATION_GPS;
const stg_position_drive_mode_t POSITION_DRIVE_DEFAULT =
STG_POSITION_DRIVE_DIFFERENTIAL;
-Option ModelPosition::showCoords( "Position Coordinates", "show_coords", "",
false );
-Option ModelPosition::showWaypoints( "Position Waypoints", "show_waypoints",
"", false );
+//TODO make instance attempt to register an option (as customvisualizations do)
+Option ModelPosition::showCoords( "Position Coordinates", "show_coords", "",
false, NULL );
+Option ModelPosition::showWaypoints( "Position Waypoints", "show_waypoints",
"", false, NULL );
ModelPosition::ModelPosition( World* world,
Modified: code/stage/trunk/libstage/model_ranger.cc
===================================================================
--- code/stage/trunk/libstage/model_ranger.cc 2009-01-21 23:07:45 UTC (rev
7282)
+++ code/stage/trunk/libstage/model_ranger.cc 2009-01-21 23:57:00 UTC (rev
7283)
@@ -95,8 +95,9 @@
static const char RANGER_CONFIG_COLOR[] = "gray90";
static const char RANGER_GEOM_COLOR[] = "orange";
-Option ModelRanger::showRangerData( "Ranger ranges", "show_ranger", "", true );
-Option ModelRanger::showRangerTransducers( "Ranger transducers",
"show_ranger_transducers", "", false );
+//TODO make instance attempt to register an option (as customvisualizations do)
+Option ModelRanger::showRangerData( "Ranger ranges", "show_ranger", "", true,
NULL );
+Option ModelRanger::showRangerTransducers( "Ranger transducers",
"show_ranger_transducers", "", false, NULL );
ModelRanger::ModelRanger( World* world,
Modified: code/stage/trunk/libstage/option.cc
===================================================================
--- code/stage/trunk/libstage/option.cc 2009-01-21 23:07:45 UTC (rev 7282)
+++ code/stage/trunk/libstage/option.cc 2009-01-21 23:57:00 UTC (rev 7283)
@@ -3,13 +3,14 @@
using namespace Stg;
-Option::Option( std::string n, std::string tok, std::string key, bool v ) :
+Option::Option( std::string n, std::string tok, std::string key, bool v,
World* world ) :
optName( n ),
value( v ),
wf_token( tok ),
shortcut( key ),
menu( NULL ),
-menuCb( NULL )
+menuCb( NULL ),
+_world( world )
{ }
Fl_Menu_Item* getMenuItem( Fl_Menu_* menu, int i ) {
@@ -61,4 +62,12 @@
Fl_Menu_Item* item = getMenuItem( menu, menuIndex );
value ? item->set() : item->clear();
}
+
+ if( _world ) {
+ WorldGui* wg = dynamic_cast< WorldGui* >( _world );
+ if( wg == NULL ) return;
+ Canvas* canvas = wg->GetCanvas();
+ canvas->invalidate();
+ canvas->redraw();
+ }
}
Modified: code/stage/trunk/libstage/option.hh
===================================================================
--- code/stage/trunk/libstage/option.hh 2009-01-21 23:07:45 UTC (rev 7282)
+++ code/stage/trunk/libstage/option.hh 2009-01-21 23:57:00 UTC (rev 7283)
@@ -8,6 +8,7 @@
#include <FL/Fl_Menu_Item.H>
namespace Stg {
+ class World;
/** option.hh
Class that encapsulates a boolean and pairs it with a string
description
Used to pass settings between the GUI and the drawing classes
@@ -28,9 +29,10 @@
int menuIndex;
Fl_Callback* menuCb;
Fl_Widget* menuCbWidget;
+ World* _world;
public:
- Option( std::string n, std::string tok, std::string key, bool v
);
+ Option( std::string n, std::string tok, std::string key, bool
v, World *world );
const std::string name() const { return optName; }
inline bool isEnabled() const { return value; }
Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh 2009-01-21 23:07:45 UTC (rev 7282)
+++ code/stage/trunk/libstage/stage.hh 2009-01-21 23:57:00 UTC (rev 7283)
@@ -1301,6 +1301,7 @@
friend class Canvas;
friend class ModelCamera;
friend class Model;
+ friend class Option;
private:
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit