added earth-registration support
This commit is contained in:
@@ -10,6 +10,7 @@ enum class ParamType {
|
||||
BOOL,
|
||||
INT,
|
||||
FLOAT,
|
||||
DOUBLE,
|
||||
STRING,
|
||||
FILE,
|
||||
POINT2,
|
||||
@@ -23,6 +24,7 @@ private:
|
||||
bool _bool;
|
||||
int _int;
|
||||
float _float;
|
||||
double _double;
|
||||
float _arr[3];
|
||||
};
|
||||
std::string _str;
|
||||
@@ -35,6 +37,7 @@ public:
|
||||
|
||||
void setValue(const std::string& val) {_str = val;}
|
||||
void setValue(const float val) {_float = val;}
|
||||
void setValue(const double val) {_double = val;}
|
||||
void setValue(const int val) {_int = val;}
|
||||
void setValue(const bool val) {_bool = val;}
|
||||
void setValue(const Point2 p) {_arr[0] = p.x; _arr[1] = p.y;}
|
||||
@@ -44,6 +47,7 @@ public:
|
||||
Point3 toPoint3() const {return Point3(_arr[0], _arr[1], _arr[2]);}
|
||||
std::string toString() const {return _str;}
|
||||
float toFloat() const {return _float;}
|
||||
double toDouble() const {return _double;}
|
||||
int toInt() const {return _int;}
|
||||
bool toBool() const {return _bool;}
|
||||
|
||||
|
||||
48
mapview/model/MMRegistration.h
Normal file
48
mapview/model/MMRegistration.h
Normal file
@@ -0,0 +1,48 @@
|
||||
#ifndef MMREGISTRATION_H
|
||||
#define MMREGISTRATION_H
|
||||
|
||||
|
||||
#include "MMRegistrationPoint.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* layer that contains registriation points: earth <-> map
|
||||
*/
|
||||
class MMRegistration : public MapLayer {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::IndoorMap* map;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MMRegistration(MapLayer* parent, Floorplan::IndoorMap* map) : MapLayer(parent, MapLayerType::REGISTRATION), map(map) {
|
||||
|
||||
// the registered points
|
||||
for (Floorplan::EarthPosMapPos* reg : map->earthReg.correspondences) {
|
||||
addElement(new MMRegistrationPoint(this, map, reg));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//TODO: check
|
||||
MMRegistrationPoint* create(Floorplan::EarthPosMapPos* reg) {
|
||||
|
||||
// add to underlying model
|
||||
map->earthReg.correspondences.push_back(reg);
|
||||
|
||||
// add to myself as element
|
||||
MMRegistrationPoint* mm = new MMRegistrationPoint(this, map, reg);
|
||||
addElement(mm);
|
||||
return mm;
|
||||
|
||||
}
|
||||
|
||||
virtual std::string getLayerName() const override {return "registration";}
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif // MMREGISTRATION_H
|
||||
78
mapview/model/MMRegistrationPoint.h
Normal file
78
mapview/model/MMRegistrationPoint.h
Normal file
@@ -0,0 +1,78 @@
|
||||
#ifndef MMREGISTRATIONPOINT_H
|
||||
#define MMREGISTRATIONPOINT_H
|
||||
|
||||
|
||||
#include "IHasParams.h"
|
||||
#include "MapModelElement.h"
|
||||
|
||||
#include "../2D/MV2DElementRegistrationPoint.h"
|
||||
#include "../3D/MV3DElementRegistrationPoint.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
/**
|
||||
* one earth <-> map correspondcen
|
||||
*/
|
||||
class MMRegistrationPoint : public MapModelElement, public IHasParams {
|
||||
|
||||
private:
|
||||
|
||||
Floorplan::IndoorMap* map;
|
||||
Floorplan::EarthPosMapPos* reg;
|
||||
MV2DElementRegistrationPoint mv2d;
|
||||
MV3DElementRegistrationPoint mv3d;
|
||||
|
||||
std::string fileName;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor */
|
||||
MMRegistrationPoint(MapLayer* parent, Floorplan::IndoorMap* map, Floorplan::EarthPosMapPos* reg) :
|
||||
MapModelElement(parent), map(map), reg(reg), mv2d(reg), mv3d(reg) {
|
||||
;
|
||||
}
|
||||
|
||||
MV2DElement* getMV2D() const override {return (MV2DElement*) &mv2d;}
|
||||
MV3DElement* getMV3D() const override {return (MV3DElement*) &mv3d;}
|
||||
|
||||
void deleteMe() const override {
|
||||
;
|
||||
}
|
||||
|
||||
int getNumParams() const override {
|
||||
return 4;
|
||||
}
|
||||
|
||||
virtual Param getParamDesc(const int idx) const override {
|
||||
switch (idx) {
|
||||
case 0: return Param("map", ParamType::POINT3);
|
||||
case 1: return Param("lat", ParamType::DOUBLE);
|
||||
case 2: return Param("lon", ParamType::DOUBLE);
|
||||
case 3: return Param("alt", ParamType::FLOAT);
|
||||
default: throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
virtual ParamValue getParamValue(const int idx) const override {
|
||||
switch(idx) {
|
||||
case 0: return ParamValue(reg->posOnMap_m);
|
||||
case 1: return ParamValue(reg->posOnEarth.lat);
|
||||
case 2: return ParamValue(reg->posOnEarth.lon);
|
||||
case 3: return ParamValue(reg->posOnEarth.height);
|
||||
default: throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
virtual void setParamValue(const int idx, const ParamValue& val) override {
|
||||
switch (idx) {
|
||||
case 0: reg->posOnMap_m = val.toPoint3(); break;
|
||||
case 1: reg->posOnEarth.lat = val.toDouble(); break;
|
||||
case 2: reg->posOnEarth.lon = val.toDouble(); break;
|
||||
case 3: reg->posOnEarth.height = val.toFloat(); break;
|
||||
default: throw 1;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // MMREGISTRATIONPOINT_H
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include "MapLayer.h"
|
||||
#include "MMFloors.h"
|
||||
#include "MMRegistration.h"
|
||||
|
||||
#include <Indoor/floorplan/v2/Floorplan.h>
|
||||
|
||||
@@ -23,6 +24,7 @@ public:
|
||||
MMRoot(MapLayer* parent, Floorplan::IndoorMap* map) : MapLayer(parent), map(map) {
|
||||
|
||||
// all floors
|
||||
new MMRegistration(this, map);
|
||||
new MMFloors(this, map);
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ class MapModelElement;
|
||||
enum class MapLayerType {
|
||||
UNKNOWN,
|
||||
ROOT,
|
||||
REGISTRATION,
|
||||
FLOORS,
|
||||
FLOOR,
|
||||
FLOOR_GROUND,
|
||||
|
||||
Reference in New Issue
Block a user