diff Framework/Widgets/WorldSceneWidget.cpp @ 91:81f73efd81a1 wasm

cleaning up
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 May 2017 11:18:35 +0200
parents bd48431ac285
children 53bd9277b025
line wrap: on
line diff
--- a/Framework/Widgets/WorldSceneWidget.cpp	Mon May 29 11:04:18 2017 +0200
+++ b/Framework/Widgets/WorldSceneWidget.cpp	Mon May 29 11:18:35 2017 +0200
@@ -38,23 +38,6 @@
   }
 
 
-  struct WorldSceneWidget::ViewChangeFunctor
-  {
-    const ViewportGeometry& view_;
-
-    ViewChangeFunctor(const ViewportGeometry& view) :
-      view_(view)
-    {
-    }
-
-    void operator() (IWorldObserver& observer,
-                     const WorldSceneWidget& source)
-    {
-      observer.NotifyViewChange(source, view_);
-    }
-  };
-
-
   struct WorldSceneWidget::SizeChangeFunctor
   {
     ViewportGeometry& view_;
@@ -144,8 +127,7 @@
       that_.view_.SetPan(previousPanX_ + x - downX_,
                          previousPanY_ + y - downY_);
 
-      ViewChangeFunctor functor(that_.view_);
-      that_.observers_.Notify(&that_, functor);
+      that_.observers_.Apply(that_, &IWorldObserver::NotifyViewChange, that_.view_);
     }
   };
 
@@ -223,8 +205,7 @@
       that_.view_.SetPan(panX + static_cast<double>(downX_ - tx),
                                panY + static_cast<double>(downY_ - ty));
 
-      ViewChangeFunctor functor(that_.view_);
-      that_.observers_.Notify(&that_, functor);
+      that_.observers_.Apply(that_, &IWorldObserver::NotifyViewChange, that_.view_);
     }
   };
 
@@ -273,7 +254,7 @@
     {
       // With a size observer, let it decide which view to use
       SizeChangeFunctor functor(view_);
-      observers_.Notify(this, functor);
+      observers_.Notify(*this, functor);
     }
   }
 
@@ -291,8 +272,7 @@
 
     NotifyChange();
 
-    ViewChangeFunctor functor(view_);
-    observers_.Notify(this, functor);
+    observers_.Apply(*this, &IWorldObserver::NotifyViewChange, view_);
   }
 
 
@@ -302,8 +282,7 @@
 
     NotifyChange();
 
-    ViewChangeFunctor functor(view_);
-    observers_.Notify(this, functor);
+    observers_.Apply(*this, &IWorldObserver::NotifyViewChange, view_);
   }