LinkRefiningDialog.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2010-2016, Mathieu Labbe - IntRoLab - Universite de Sherbrooke
3 All rights reserved.
4 
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions are met:
7  * Redistributions of source code must retain the above copyright
8  notice, this list of conditions and the following disclaimer.
9  * Redistributions in binary form must reproduce the above copyright
10  notice, this list of conditions and the following disclaimer in the
11  documentation and/or other materials provided with the distribution.
12  * Neither the name of the Universite de Sherbrooke nor the
13  names of its contributors may be used to endorse or promote products
14  derived from this software without specific prior written permission.
15 
16 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
20 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 
29 #include "ui_linkRefiningDialog.h"
30 
31 #include <QPushButton>
32 
33 namespace rtabmap {
34 
36  QDialog(parent),
37  defaultNodeIdMin_(0),
38  defaultNodeIdMax_(0),
39  defaultMapIdMin_(0),
40  defaultMapIdMax_(0)
41 {
42  ui_ = new Ui_linkRefiningDialog();
43  ui_->setupUi(this);
44 
45  ui_->comboBox_link_type->addItem("All");
46  for(int i =0; i<Link::kPosePrior; ++i)
47  {
48  ui_->comboBox_link_type->addItem(Link::typeName((Link::Type)i).c_str());
50  {
51  ui_->comboBox_link_type->setItemData(i+1, 0, Qt::UserRole - 1);
52  }
53  }
54 
56 
57  connect(ui_->buttonBox->button(QDialogButtonBox::RestoreDefaults), SIGNAL(clicked()), this, SLOT(restoreDefaults()));
58  connect(ui_->comboBox_link_type, SIGNAL(currentIndexChanged(int)), this, SLOT(updateIntraInterState()));
59  connect(ui_->spinBox_node_from, SIGNAL(valueChanged(int)), this, SLOT(setRangeToNodeId()));
60  connect(ui_->spinBox_node_to, SIGNAL(valueChanged(int)), this, SLOT(setRangeToNodeId()));
61  connect(ui_->spinBox_map_from, SIGNAL(valueChanged(int)), this, SLOT(setRangeToMapId()));
62  connect(ui_->spinBox_map_to, SIGNAL(valueChanged(int)), this, SLOT(setRangeToMapId()));
63 }
64 
66 {
67  delete ui_;
68 }
69 
71  int nodeIdMin,
72  int nodeIdMax,
73  int mapIdMin,
74  int mapIdMax)
75 {
76  bool reset = defaultNodeIdMin_ == 0;
77  defaultNodeIdMin_ = nodeIdMin;
78  defaultNodeIdMax_ = nodeIdMax;
79  defaultMapIdMin_ = mapIdMin;
80  defaultMapIdMax_ = mapIdMax;
81  ui_->spinBox_node_from->setMinimum(defaultNodeIdMin_);
82  ui_->spinBox_node_to->setMaximum(defaultNodeIdMax_);
83  ui_->spinBox_map_from->setMinimum(defaultMapIdMin_);
84  ui_->spinBox_map_to->setMaximum(defaultMapIdMax_);
85  if(reset)
86  {
88  }
89 }
90 
92 {
93  if(ui_->comboBox_link_type->currentIndex() == 0)
94  {
95  return Link::kEnd;
96  }
97  return (Link::Type)(ui_->comboBox_link_type->currentIndex()-1);
98 }
99 
100 void LinkRefiningDialog::getIntraInterSessions(bool & intra, bool & inter) const
101 {
102  intra = ui_->comboBox_link_inter_intra->currentIndex() == 0 || ui_->comboBox_link_inter_intra->currentIndex() == 1 || getLinkType() == Link::kNeighbor;
103  inter = ui_->comboBox_link_inter_intra->currentIndex() == 0 || ui_->comboBox_link_inter_intra->currentIndex() == 2;
104 }
105 
107 {
108  return ui_->radioButton_nodes->isChecked();
109 }
110 
112 {
113  return ui_->radioButton_maps->isChecked();
114 }
115 
116 void LinkRefiningDialog::getRangeNodeId(int & from, int & to) const
117 {
118  from = ui_->spinBox_node_from->value();
119  to = ui_->spinBox_node_to->value();
120 }
121 
122 void LinkRefiningDialog::getRangeMapId(int & from, int & to) const
123 {
124  from = ui_->spinBox_map_from->value();
125  to = ui_->spinBox_map_to->value();
126 }
127 
129 {
130  ui_->comboBox_link_type->setCurrentIndex(0);
131  ui_->comboBox_link_inter_intra->setCurrentIndex(0);
132  ui_->spinBox_node_from->setValue(defaultNodeIdMin_);
133  ui_->spinBox_node_to->setValue(defaultNodeIdMax_);
134  ui_->spinBox_map_from->setValue(defaultMapIdMin_);
135  ui_->spinBox_map_to->setValue(defaultMapIdMax_);
136 
137  ui_->radioButton_nodes->setChecked(true);
138 }
139 
141 {
142  ui_->comboBox_link_inter_intra->setEnabled(getLinkType() != Link::kNeighbor);
143 }
144 
146 {
147  ui_->radioButton_nodes->setChecked(true);
148 }
149 
151 {
152  ui_->radioButton_maps->setChecked(true);
153 }
154 
155 
156 }
rtabmap::LinkRefiningDialog::isRangeByNodeId
bool isRangeByNodeId() const
Definition: LinkRefiningDialog.cpp:106
rtabmap::LinkRefiningDialog::isRangeByMapId
bool isRangeByMapId() const
Definition: LinkRefiningDialog.cpp:111
rtabmap::LinkRefiningDialog::getRangeNodeId
void getRangeNodeId(int &from, int &to) const
Definition: LinkRefiningDialog.cpp:116
rtabmap::LinkRefiningDialog::defaultNodeIdMax_
int defaultNodeIdMax_
Definition: LinkRefiningDialog.h:72
rtabmap::LinkRefiningDialog::setRangeToNodeId
void setRangeToNodeId()
Definition: LinkRefiningDialog.cpp:145
LinkRefiningDialog.h
rtabmap::LinkRefiningDialog::~LinkRefiningDialog
virtual ~LinkRefiningDialog()
Definition: LinkRefiningDialog.cpp:65
rtabmap::LinkRefiningDialog::defaultMapIdMin_
int defaultMapIdMin_
Definition: LinkRefiningDialog.h:73
rtabmap::LinkRefiningDialog::getLinkType
Link::Type getLinkType() const
Definition: LinkRefiningDialog.cpp:91
rtabmap::LinkRefiningDialog::getIntraInterSessions
void getIntraInterSessions(bool &intra, bool &inter) const
Definition: LinkRefiningDialog.cpp:100
rtabmap::LinkRefiningDialog::LinkRefiningDialog
LinkRefiningDialog(QWidget *parent=0)
Definition: LinkRefiningDialog.cpp:35
rtabmap::LinkRefiningDialog::setMinMax
void setMinMax(int nodeIdMin, int nodeIdMax, int mapIdMin, int mapIdMax)
Definition: LinkRefiningDialog.cpp:70
rtabmap::LinkRefiningDialog::updateIntraInterState
void updateIntraInterState()
Definition: LinkRefiningDialog.cpp:140
rtabmap::LinkRefiningDialog::getRangeMapId
void getRangeMapId(int &from, int &to) const
Definition: LinkRefiningDialog.cpp:122
rtabmap::LinkRefiningDialog::ui_
Ui_linkRefiningDialog * ui_
Definition: LinkRefiningDialog.h:70
rtabmap::LinkRefiningDialog::restoreDefaults
void restoreDefaults()
Definition: LinkRefiningDialog.cpp:128
c_str
const char * c_str(Args &&...args)
rtabmap::LinkRefiningDialog::setRangeToMapId
void setRangeToMapId()
Definition: LinkRefiningDialog.cpp:150
rtabmap::LinkRefiningDialog::defaultNodeIdMin_
int defaultNodeIdMin_
Definition: LinkRefiningDialog.h:71
rtabmap
Definition: CameraARCore.cpp:35
i
int i
rtabmap::LinkRefiningDialog::defaultMapIdMax_
int defaultMapIdMax_
Definition: LinkRefiningDialog.h:74


rtabmap
Author(s): Mathieu Labbe
autogenerated on Thu Jul 25 2024 02:50:11