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 
26 #include <Inventor/events/SoMouseButtonEvent.h>
27 
29  SoQtExaminerViewer(widget), control(control)
30 {
31  this->setBackgroundColor(SbColor(100 / 255.0f, 100 / 255.0f, 100 / 255.0f));
32  this->setAccumulationBuffer(false);
33  this->setHeadlight(true);
34  this->setViewing(false);
35  this->setDecoration(false);
36 #ifdef WIN32
37 #ifndef _DEBUG
38  this->setAntialiasing(true, 4);
39 #endif
40 #endif
41  this->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND);
42  this->setFeedbackVisibility(true);
43 }
44 
45 //Override the default navigation behaviour of the SoQtExaminerViewer
46 SbBool
47 scene3D::MinimapViewer::processSoEvent(const SoEvent* const event)
48 {
49  const SoType type(event->getTypeId());
50 
51  //Just capture left mouse click and make scene zoom to clicked position
52  //Ignore all other events
53  if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId()))
54  {
55  SoMouseButtonEvent* const ev = (SoMouseButtonEvent*)event;
56  const int button = ev->getButton();
57 
58  //LEFT MOUSE BUTTON
59  if (button == SoMouseButtonEvent::BUTTON1)
60  {
61  //Trigger minimap clicked in conrtoller and let him handle this event
62 
64  {
65  controller->triggerMinimapClicked();
66  }
67 
68  return TRUE;
69  }
70  }
71 
72  //YOU SHALL NOT PASS!
73  return TRUE;
74 }
scene3D::MinimapViewer::MinimapViewer
MinimapViewer(const controller::ControllerPtr &control, QWidget *widget)
Constructor Creates an Instance of the Class.
Definition: MinimapViewer.cpp:28
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.