comparison Framework/Scene2DViewport/ViewportController.cpp @ 1213:86a8266b8888 broker

moving the scene from IViewport to ViewportController
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 04 Dec 2019 17:54:10 +0100
parents 644baa70373d
children 741201eab130
comparison
equal deleted inserted replaced
1212:ab06dfdf3b75 1213:86a8266b8888
167 } 167 }
168 } 168 }
169 169
170 OrthancStone::AffineTransform2D ViewportController::GetCanvasToSceneTransform() const 170 OrthancStone::AffineTransform2D ViewportController::GetCanvasToSceneTransform() const
171 { 171 {
172 std::auto_ptr<IViewport::ILock> lock(viewport_->Lock()); 172 return scene_.GetCanvasToSceneTransform();
173 return lock->GetScene().GetCanvasToSceneTransform();
174 } 173 }
175 174
176 OrthancStone::AffineTransform2D ViewportController::GetSceneToCanvasTransform() const 175 OrthancStone::AffineTransform2D ViewportController::GetSceneToCanvasTransform() const
177 { 176 {
178 std::auto_ptr<IViewport::ILock> lock(viewport_->Lock()); 177 return scene_.GetSceneToCanvasTransform();
179 return lock->GetScene().GetSceneToCanvasTransform();
180 } 178 }
181 179
182 void ViewportController::SetSceneToCanvasTransform(const AffineTransform2D& transform) 180 void ViewportController::SetSceneToCanvasTransform(const AffineTransform2D& transform)
183 { 181 {
182 scene_.SetSceneToCanvasTransform(transform);
183
184 canvasToSceneFactor_ = scene_.GetCanvasToSceneTransform().ComputeZoom();
185 BroadcastMessage(SceneTransformChanged(*this));
186 }
187
188 void ViewportController::FitContent()
189 {
184 { 190 {
185 std::auto_ptr<IViewport::ILock> lock(viewport_->Lock()); 191 std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
186 lock->GetScene().SetSceneToCanvasTransform(transform); 192 lock->FitContent(scene_);
187 canvasToSceneFactor_ = lock->GetScene().GetCanvasToSceneTransform().ComputeZoom(); 193 }
188 } 194
189 195 canvasToSceneFactor_ = scene_.GetCanvasToSceneTransform().ComputeZoom();
190 BroadcastMessage(SceneTransformChanged(*this));
191 }
192
193 void ViewportController::FitContent()
194 {
195 {
196 std::auto_ptr<IViewport::ILock> lock(viewport_->Lock());
197 lock->FitContent();
198 canvasToSceneFactor_ = lock->GetScene().GetCanvasToSceneTransform().ComputeZoom();
199 }
200
201 BroadcastMessage(SceneTransformChanged(*this)); 196 BroadcastMessage(SceneTransformChanged(*this));
202 } 197 }
203 198
204 void ViewportController::AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool) 199 void ViewportController::AddMeasureTool(boost::shared_ptr<MeasureTool> measureTool)
205 { 200 {