MinimapViewer.cpp
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2012-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package MemoryX::gui-plugins::SceneEditor
19  * @date 2015
20  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
21  * GNU General Public License
22  */
23 
24 #include "MinimapViewer.h"
25 #include <Inventor/events/SoMouseButtonEvent.h>
26 
27 scene3D::MinimapViewer::MinimapViewer(const controller::ControllerPtr& control, QWidget* widget) : SoQtExaminerViewer(widget), control(control)
28 {
29  this->setBackgroundColor(SbColor(100 / 255.0f, 100 / 255.0f, 100 / 255.0f));
30  this->setAccumulationBuffer(false);
31  this->setHeadlight(true);
32  this->setViewing(false);
33  this->setDecoration(false);
34 #ifdef WIN32
35 #ifndef _DEBUG
36  this->setAntialiasing(true, 4);
37 #endif
38 #endif
39  this->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND);
40  this->setFeedbackVisibility(true);
41 }
42 
43 //Override the default navigation behaviour of the SoQtExaminerViewer
44 SbBool scene3D::MinimapViewer::processSoEvent(const SoEvent* const event)
45 {
46  const SoType type(event->getTypeId());
47 
48  //Just capture left mouse click and make scene zoom to clicked position
49  //Ignore all other events
50  if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId()))
51  {
52  SoMouseButtonEvent* const ev = (SoMouseButtonEvent*) event;
53  const int button = ev->getButton();
54 
55  //LEFT MOUSE BUTTON
56  if (button == SoMouseButtonEvent::BUTTON1)
57  {
58  //Trigger minimap clicked in conrtoller and let him handle this event
59 
61  {
62  controller->triggerMinimapClicked();
63  }
64 
65  return TRUE;
66  }
67  }
68 
69  //YOU SHALL NOT PASS!
70  return TRUE;
71 }
scene3D::MinimapViewer::MinimapViewer
MinimapViewer(const controller::ControllerPtr &control, QWidget *widget)
Constructor Creates an Instance of the Class.
Definition: MinimapViewer.cpp:27
controller
Definition: AddOperation.h:39
controller::ControllerPtr
std::shared_ptr< Controller > ControllerPtr
Definition: ClassDefinitions.h:41
MinimapViewer.h
control
This file is part of ArmarX.