added a ruler for measuring

added support for meta-data editing
improved element selection
changed zooming
fixed some issues with layer events
fixed issue with 3D outline
fixed loading issue for old maps
some interface changes
This commit is contained in:
2017-03-10 13:44:17 +01:00
parent 2297a76c53
commit f40fc9a823
32 changed files with 809 additions and 198 deletions

View File

@@ -4,9 +4,10 @@
#include "../mapview/model/MMFloorObstacleLine.h"
#include "../mapview/model/MMFloorOutlinePolygon.h"
#include "../mapview/model/IHasMAC.h"
#include "../mapview/model/IHasFile.h"
#include "../mapview/model/IHasParams.h"
#include "../mapview/model/IHasEditableMeta.h"
#include "MetaEditWidget.h"
#include <Indoor/floorplan/v2/Floorplan.h>
@@ -138,13 +139,15 @@ void ElementParamWidget::refresh() {
lay->addWidget(cmb,r,1);
cmb->setCurrentIndex((int)elem->getMethod());
connect(cmb, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), [elem, cmb] (int idx) {
(void) idx;
elem->setMethod( (Floorplan::OutlineMethod) cmb->currentData().toInt() );
});
++r;
}
}
{
{ // does the element have "parameters" ?
IHasParams* elem = dynamic_cast<IHasParams*>(el);
if (elem) {
@@ -160,6 +163,9 @@ void ElementParamWidget::refresh() {
switch(param.type) {
case ParamType::NOT_AVAILABLE:
break;
case ParamType::BOOL: {
QCheckBox* chk = new QCheckBox( );
chk->setChecked(value.toBool());
@@ -216,6 +222,7 @@ void ElementParamWidget::refresh() {
QPushButton* btn = new QPushButton("<");
btn->setMaximumSize(32,32);
connect(btn, &QPushButton::clicked, [i,elem,lblFile] (const bool checked) {
(void) checked;
QString res = QFileDialog::getOpenFileName();
elem->setParamValue(i, ParamValue(res.toStdString()));
lblFile->setText(res);
@@ -235,6 +242,7 @@ void ElementParamWidget::refresh() {
laySub->addWidget(txtY,0,1);
lay->addWidget(subWidget,r,1);
auto onChange = [i,elem,txtX,txtY] (const QString& str) {
(void) str;
elem->setParamValue(i, ParamValue( Point2(txtX->text().toFloat(), txtY->text().toFloat()) ));
};
connect(txtX, &QLineEdit::textChanged, onChange);
@@ -269,6 +277,23 @@ void ElementParamWidget::refresh() {
}
}
{ // does the element have editable metadata?
IHasEditableMeta* elem = dynamic_cast<IHasEditableMeta*>(el);
if (elem) {
QPushButton* btn = new QPushButton("edit");
connect(btn, &QPushButton::clicked, [elem] (const bool checked) {
(void) checked;
if (!elem->getMeta()) {elem->setMeta(new Floorplan::Meta());} // ensure meta-object is present
MetaEditWidget* mew = new MetaEditWidget(elem->getMeta()); // edit
mew->show();
});
lay->addWidget(new QLabel("Meta"),r,0);
lay->addWidget(btn,r,1);
}
}
}
//setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
@@ -294,23 +319,3 @@ void ElementParamWidget::onObstacleTypeChange() {
IHasObstacleType* el = dynamic_cast<IHasObstacleType*>(this->curElement);
if (el) {el->setObstacleType((Floorplan::ObstacleType) obstacleType.cmb->currentData().toInt() );}
}
//void ElementParamWidget::onNameChange() {
// IHasName* el = dynamic_cast<IHasName*>(this->curElement);
// if (el) {el->setName(name.txt->text().toStdString());}
//}
//void ElementParamWidget::onOutlineMethodChange() {
// MMFloorOutlinePolygon* el = dynamic_cast<MMFloorOutlinePolygon*>(this->curElement);
// if (el) {el->setMethod( (Floorplan::OutlineMethod) outlineMethod.cmb->currentData().toInt() );}
//}
//void ElementParamWidget::onMACChanged() {
// dynamic_cast<IHasMAC*>(curElement)->setMAC(mac.txt->text().toStdString());
//}
//void ElementParamWidget::onSelectFileName() {
// QString res = QFileDialog::getOpenFileName(this);
// dynamic_cast<IHasFile*>(curElement)->setFileName(res.toStdString());
// fileName.txt->setText(res);
//}