diff Framework/Widgets/WorldSceneWidget.cpp @ 329:b10dfdb96866 am-2

removing WorldSceneWidget::IWorldObserver
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 17 Oct 2018 12:30:32 +0200
parents 8716176ff7f0
children 7a364e44fbb4
line wrap: on
line diff
--- a/Framework/Widgets/WorldSceneWidget.cpp	Wed Oct 17 10:26:33 2018 +0200
+++ b/Framework/Widgets/WorldSceneWidget.cpp	Wed Oct 17 12:30:32 2018 +0200
@@ -43,23 +43,6 @@
   }
 
 
-  struct WorldSceneWidget::SizeChangeFunctor
-  {
-    ViewportGeometry& view_;
-
-    SizeChangeFunctor(ViewportGeometry& view) :
-      view_(view)
-    {
-    }
-
-    void operator() (IWorldObserver& observer,
-                     const WorldSceneWidget& source)
-    {
-      observer.NotifySizeChange(source, view_);
-    }
-  };
-
-
   // this is an adapter between a IWorldSceneMouseTracker
   // that is tracking a mouse in scene coordinates/mm and
   // an IMouseTracker that is tracking a mouse
@@ -112,14 +95,14 @@
     that_.view_.GetPan(previousPanX_, previousPanY_);
   }
 
+  
   void WorldSceneWidget::PanMouseTracker::MouseMove(int x, int y)
   {
     that_.view_.SetPan(previousPanX_ + x - downX_,
                        previousPanY_ + y - downY_);
-
-    that_.observers_.Apply(that_, &IWorldObserver::NotifyViewChange, that_.view_);
   }
 
+  
   WorldSceneWidget::ZoomMouseTracker::ZoomMouseTracker(WorldSceneWidget&  that,
                                                        int x,
                                                        int y) :
@@ -174,8 +157,6 @@
     that_.view_.MapSceneToDisplay(tx, ty, centerX_, centerY_);
     that_.view_.SetPan(panX + static_cast<double>(downX_ - tx),
                        panY + static_cast<double>(downY_ - ty));
-
-    that_.observers_.Apply(that_, &IWorldObserver::NotifyViewChange, that_.view_);
   }
 
 
@@ -209,20 +190,7 @@
                                  unsigned int height)
   {
     CairoWidget::SetSize(width, height);
-
     view_.SetDisplaySize(width, height);
-
-    if (observers_.IsEmpty())
-    {
-      // Without a size observer, reset to the default view
-      // view_.SetDefaultView();
-    }
-    else
-    {
-      // With a size observer, let it decide which view to use
-      SizeChangeFunctor functor(view_);
-      observers_.Notify(*this, functor);
-    }
   }
 
 
@@ -238,8 +206,6 @@
     view_.SetDefaultView();
 
     NotifyContentChanged();
-
-    observers_.Apply(*this, &IWorldObserver::NotifyViewChange, view_);
   }
 
 
@@ -248,8 +214,6 @@
     view_ = view;
 
     NotifyContentChanged();
-
-    observers_.Apply(*this, &IWorldObserver::NotifyViewChange, view_);
   }