Mercurial > hg > orthanc-stone
view Deprecated/Samples/Qt/Scene2DInteractor.cpp @ 1473:9cbc6d21ae89
SeriesThumbnailsLoader::SuccessMessage::DecodeImage(), fix static builds
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 15 Jun 2020 18:02:49 +0200 |
parents | 182bf3106ee2 |
children |
line wrap: on
line source
/** * Stone of Orthanc * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics * Department, University Hospital of Liege, Belgium * Copyright (C) 2017-2020 Osimis S.A., Belgium * * This program is free software: you can redistribute it and/or * modify it under the terms of the GNU Affero General Public License * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. **/ #include "Scene2DInteractor.h" #include "../../Framework/Scene2D/PanSceneTracker.h" #include "../../Framework/Scene2D/ZoomSceneTracker.h" #include "../../Framework/Scene2D/RotateSceneTracker.h" namespace OrthancStone { } using namespace OrthancStone; bool BasicScene2DInteractor::OnMouseEvent(const GuiAdapterMouseEvent& event, const PointerEvent& pointerEvent) { if (currentTracker_.get() != NULL) { switch (event.type) { case GUIADAPTER_EVENT_MOUSEUP: { currentTracker_->PointerUp(pointerEvent); if (!currentTracker_->IsAlive()) { currentTracker_.reset(); } };break; case GUIADAPTER_EVENT_MOUSEMOVE: { currentTracker_->PointerMove(pointerEvent); };break; } return true; } else { if (event.button == GUIADAPTER_MOUSEBUTTON_LEFT) { currentTracker_.reset(new RotateSceneTracker(viewportController_, pointerEvent)); } else if (event.button == GUIADAPTER_MOUSEBUTTON_MIDDLE) { currentTracker_.reset(new PanSceneTracker(viewportController_, pointerEvent)); } else if (event.button == GUIADAPTER_MOUSEBUTTON_RIGHT && compositor_.get() != NULL) { currentTracker_.reset(new ZoomSceneTracker(viewportController_, pointerEvent, compositor_->GetHeight())); } return true; } return false; } bool BasicScene2DInteractor::OnKeyboardEvent(const GuiAdapterKeyboardEvent& guiEvent) { switch (guiEvent.sym[0]) { case 's': { viewportController_->FitContent(compositor_->GetWidth(), compositor_->GetHeight()); return true; }; } return false; } bool BasicScene2DInteractor::OnWheelEvent(const GuiAdapterWheelEvent& guiEvent) { return false; }