g2o
Toggle main menu visibility
Loading...
Searching...
No Matches
g2o
apps
g2o_viewer
viewer_properties_widget.cpp
Go to the documentation of this file.
1
// g2o - General Graph Optimization
2
// Copyright (C) 2011 R. Kuemmerle, G. Grisetti, W. Burgard
3
//
4
// This file is part of g2o.
5
//
6
// g2o is free software: you can redistribute it and/or modify
7
// it under the terms of the GNU General Public License as published by
8
// the Free Software Foundation, either version 3 of the License, or
9
// (at your option) any later version.
10
//
11
// g2o is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
15
//
16
// You should have received a copy of the GNU General Public License
17
// along with g2o. If not, see <http://www.gnu.org/licenses/>.
18
19
#include "
viewer_properties_widget.h
"
20
21
#include <QLineEdit>
22
#include <cassert>
23
#include <iostream>
24
25
#include "
g2o/stuff/property.h
"
26
#include "
g2o_qglviewer.h
"
27
28
#ifdef __GNUC__
29
#include <cxxabi.h>
30
#endif
31
32
using namespace
std
;
33
34
using namespace
g2o
;
35
39
static
std::string
demangleName
(
const
std::string& fullPropName) {
40
#ifdef __GNUC__
41
// find :: and extract the mangled class name from the whole string
42
string
mangledName;
43
string
propName;
44
string::size_type found = fullPropName.rfind(
"::"
);
45
if
(found != string::npos) {
46
mangledName = fullPropName.substr(0, found);
47
propName = fullPropName.substr(found);
48
}
else
{
49
mangledName = propName;
50
}
51
52
int
status;
53
char
* s = abi::__cxa_demangle(mangledName.c_str(), 0, 0, &status);
54
if
(status != 0) {
55
free(s);
56
return
fullPropName;
57
}
else
{
58
std::string demangled(s);
59
free(s);
60
return
demangled + propName;
61
}
62
#else
63
// TODO for other compilers
64
return
fullPropName;
65
#endif
66
}
67
68
ViewerPropertiesWidget::ViewerPropertiesWidget
(QWidget* parent)
69
:
PropertiesWidget
(parent),
_viewer
(nullptr) {}
70
71
ViewerPropertiesWidget::~ViewerPropertiesWidget
() {}
72
73
void
ViewerPropertiesWidget::applyProperties
() {
74
PropertiesWidget::applyProperties
();
75
76
// draw with the new properties
77
_viewer
->setUpdateDisplay(
true
);
78
_viewer
->update();
79
}
80
81
void
ViewerPropertiesWidget::setViewer
(
g2o::G2oQGLViewer
* viewer) {
82
_viewer
= viewer;
83
setProperties
(viewer->
parameters
());
84
}
85
86
std::string
ViewerPropertiesWidget::humanReadablePropName
(
87
const
std::string& propertyName)
const
{
88
return
demangleName
(propertyName);
89
}
PropertiesWidget::setProperties
void setProperties(g2o::PropertyMap *properties)
Definition
properties_widget.cpp:125
PropertiesWidget::applyProperties
virtual void applyProperties()
Definition
properties_widget.cpp:90
PropertiesWidget::PropertiesWidget
PropertiesWidget(QWidget *parent=0)
Definition
properties_widget.cpp:31
ViewerPropertiesWidget::setViewer
void setViewer(g2o::G2oQGLViewer *viewer)
Definition
viewer_properties_widget.cpp:81
ViewerPropertiesWidget::_viewer
g2o::G2oQGLViewer * _viewer
Definition
viewer_properties_widget.h:37
ViewerPropertiesWidget::ViewerPropertiesWidget
ViewerPropertiesWidget(QWidget *parent=0)
Definition
viewer_properties_widget.cpp:68
ViewerPropertiesWidget::~ViewerPropertiesWidget
virtual ~ViewerPropertiesWidget()
Definition
viewer_properties_widget.cpp:71
ViewerPropertiesWidget::applyProperties
virtual void applyProperties()
Definition
viewer_properties_widget.cpp:73
ViewerPropertiesWidget::humanReadablePropName
virtual std::string humanReadablePropName(const std::string &probName) const
Definition
viewer_properties_widget.cpp:86
g2o::G2oQGLViewer
OpenGL based viewer for the graph.
Definition
g2o_qglviewer.h:33
g2o::G2oQGLViewer::parameters
DrawAction::Parameters * parameters()
Definition
g2o_qglviewer.h:50
g2o_qglviewer.h
g2o
Definition
dl_wrapper.cpp:55
std
Definition
jet.h:876
property.h
demangleName
static std::string demangleName(const std::string &fullPropName)
Definition
viewer_properties_widget.cpp:39
viewer_properties_widget.h
Generated on
for g2o by
1.17.0