Revision: 8215
          http://playerstage.svn.sourceforge.net/playerstage/?rev=8215&view=rev
Author:   rtv
Date:     2009-08-21 22:35:30 +0000 (Fri, 21 Aug 2009)

Log Message:
-----------
disabled visualization drawing for unsubscribed models

Modified Paths:
--------------
    code/stage/trunk/examples/ctrl/CMakeLists.txt
    code/stage/trunk/libstage/model.cc
    code/stage/trunk/libstage/model_draw.cc
    code/stage/trunk/libstage/model_load.cc
    code/stage/trunk/libstage/stage.hh

Modified: code/stage/trunk/examples/ctrl/CMakeLists.txt
===================================================================
--- code/stage/trunk/examples/ctrl/CMakeLists.txt       2009-08-21 03:48:00 UTC 
(rev 8214)
+++ code/stage/trunk/examples/ctrl/CMakeLists.txt       2009-08-21 22:35:30 UTC 
(rev 8215)
@@ -1,6 +1,8 @@
 
 SET( PLUGINS
+         convoy
      fasr
+         fasr2
      lasernoise
      sink
      source

Modified: code/stage/trunk/libstage/model.cc
===================================================================
--- code/stage/trunk/libstage/model.cc  2009-08-21 03:48:00 UTC (rev 8214)
+++ code/stage/trunk/libstage/model.cc  2009-08-21 22:35:30 UTC (rev 8215)
@@ -657,6 +657,9 @@
 {
   //printf( "Shutdown model %s\n", this->token );
   CallCallbacks( &hooks.shutdown );
+
+  // allows data visualizations to be cleared.
+  NeedRedraw();
 }
 
 
@@ -760,7 +763,7 @@
                
                FOR_EACH( it, touchers )
                  {
-                        Model* toucher = (*it); //(Model*)touchers->data;      
        
+                        Model* toucher = (*it);
                         PowerPack* hispp =toucher->FindPowerPack();            
                         
                         if( hispp && toucher->watts_take > 0.0) 

Modified: code/stage/trunk/libstage/model_draw.cc
===================================================================
--- code/stage/trunk/libstage/model_draw.cc     2009-08-21 03:48:00 UTC (rev 
8214)
+++ code/stage/trunk/libstage/model_draw.cc     2009-08-21 22:35:30 UTC (rev 
8215)
@@ -525,17 +525,19 @@
 void Model::DataVisualizeTree( Camera* cam )
 {
   PushLocalCoords();
-  DataVisualize( cam ); // virtual function overridden by most model types  
 
-  for( std::list<Visualizer*>::iterator it = cv_list.begin();
-                it != cv_list.end();
-                it++ )
+  if( subs > 0 )
         {
-      Visualizer* vis = *it;
-               if( world_gui->GetCanvas()->_custom_options[ vis->GetMenuName() 
]->isEnabled() )
-                 vis->Visualize( this, cam );
+               DataVisualize( cam ); // virtual function overridden by some 
model types  
+               
+               FOR_EACH( it, cv_list )
+                 {
+                        Visualizer* vis = *it;
+                        if( world_gui->GetCanvas()->_custom_options[ 
vis->GetMenuName() ]->isEnabled() )
+                               vis->Visualize( this, cam );
+                 }
         }
-  
+
   // and draw the children
   FOR_EACH( it, children )
         (*it)->DataVisualizeTree( cam );

Modified: code/stage/trunk/libstage/model_load.cc
===================================================================
--- code/stage/trunk/libstage/model_load.cc     2009-08-21 03:48:00 UTC (rev 
8214)
+++ code/stage/trunk/libstage/model_load.cc     2009-08-21 22:35:30 UTC (rev 
8215)
@@ -145,6 +145,16 @@
     }  
     }
   
+  if( wf->ReadInt( wf_entity, "noblocks", 0 ) )
+        {
+      if( has_default_block )
+                 {
+                        blockgroup.Clear();
+                        has_default_block = false;
+                        blockgroup.CalcSize();
+                 }             
+        }
+  
   if( wf->PropertyExists( wf_entity, "bitmap" ) )
     {
       const char* bitmapfile = wf->ReadString( wf_entity, "bitmap", NULL );
@@ -162,21 +172,21 @@
   if( wf->PropertyExists( wf_entity, "boundary" ))
     {
       this->SetBoundary( wf->ReadInt(wf_entity, "boundary", this->boundary  ));
-
+               
       if( boundary )
-       {
-         //PRINT_WARN1( "setting boundary for %s\n", token );
+                 {
+                        //PRINT_WARN1( "setting boundary for %s\n", token );
                         
-         blockgroup.CalcSize();
-
-         double epsilon = 0.01;              
-         Size bgsize = blockgroup.GetSize();
-
-         AddBlockRect(blockgroup.minx,blockgroup.miny, epsilon, bgsize.y, 
bgsize.z );        
-         AddBlockRect(blockgroup.minx,blockgroup.miny, bgsize.x, epsilon, 
bgsize.z );        
-         AddBlockRect(blockgroup.minx,blockgroup.maxy-epsilon, bgsize.x, 
epsilon, bgsize.z );        
-         AddBlockRect(blockgroup.maxx-epsilon,blockgroup.miny, epsilon, 
bgsize.y, bgsize.z );        
-       }     
+                        blockgroup.CalcSize();
+                        
+                        double epsilon = 0.01;       
+                        Size bgsize = blockgroup.GetSize();
+                        
+                        AddBlockRect(blockgroup.minx,blockgroup.miny, epsilon, 
bgsize.y, bgsize.z );         
+                        AddBlockRect(blockgroup.minx,blockgroup.miny, 
bgsize.x, epsilon, bgsize.z );         
+                        AddBlockRect(blockgroup.minx,blockgroup.maxy-epsilon, 
bgsize.x, epsilon, bgsize.z );         
+                        AddBlockRect(blockgroup.maxx-epsilon,blockgroup.miny, 
epsilon, bgsize.y, bgsize.z );         
+                 }     
     }    
 
   if( wf->PropertyExists( wf_entity, "mass" ))

Modified: code/stage/trunk/libstage/stage.hh
===================================================================
--- code/stage/trunk/libstage/stage.hh  2009-08-21 03:48:00 UTC (rev 8214)
+++ code/stage/trunk/libstage/stage.hh  2009-08-21 22:35:30 UTC (rev 8215)
@@ -2326,11 +2326,17 @@
                  and has the type indicated by the string. This model is 
tagged as used. */
         Model* GetUnusedModelOfType( const std::string& type );
   
-
         /** Returns the value of the model's stall boolean, which is true
                  iff the model has crashed into another model */
         bool Stalled() const { return this->stall; }
         
+        /** Returns the current number of subscriptions. If alwayson, this
+                 is never less than 1.*/
+        unsigned int GetSubscriptionCount() const { return subs; }
+
+        /** Returns true if the model has one or more subscribers, else false. 
*/
+        bool HasSubscribers() const { return( subs > 0 ); }     
+
         static std::map< std::string, creator_t> name_map;      
   };
 
@@ -2433,8 +2439,7 @@
                stg_usec_t interval; ///< Time interval  between updates (TODO: 
is this used?)
         };
                
-  private:
-        
+  private:      
         class Vis : public Visualizer 
         {
         private:


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to