performance enhancements
memory enhancements prevent starting sensors more than once fix for wifi lag issues map scaling for huge buildings
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QPoint>
|
||||
#include <Indoor/geo/Point2.h>
|
||||
#include <Indoor/geo/BBox2.h>
|
||||
|
||||
class Scaler2D {
|
||||
|
||||
@@ -13,6 +14,8 @@ private:
|
||||
float rotation_rad = 0.0f;
|
||||
float scaleFactor = 1;
|
||||
|
||||
BBox2 mapBBox_m;
|
||||
|
||||
public:
|
||||
|
||||
Scaler2D() {
|
||||
@@ -32,11 +35,17 @@ public:
|
||||
/** change the point displayed within the center of the screen */
|
||||
void setCenterM(const Point2 center_m) {
|
||||
this->center_m = center_m;
|
||||
if (!mapBBox_m.isInvalid()) {
|
||||
if (this->center_m.x < mapBBox_m.getMin().x) {this->center_m.x = mapBBox_m.getMin().x;}
|
||||
if (this->center_m.y < mapBBox_m.getMin().y) {this->center_m.y = mapBBox_m.getMin().y;}
|
||||
if (this->center_m.x > mapBBox_m.getMax().x) {this->center_m.x = mapBBox_m.getMax().x;}
|
||||
if (this->center_m.y > mapBBox_m.getMax().y) {this->center_m.y = mapBBox_m.getMax().y;}
|
||||
}
|
||||
}
|
||||
|
||||
/** change the point displayed within the center of the screen */
|
||||
void setCenterPX(const Point2 center_px) {
|
||||
this->center_m = pxToM(center_px);
|
||||
setCenterM(pxToM(center_px));
|
||||
}
|
||||
|
||||
Point2 getCenterPX() const {
|
||||
@@ -48,10 +57,21 @@ public:
|
||||
this->rotation_rad = rad;
|
||||
}
|
||||
|
||||
/** set the map's scaling */
|
||||
void setScale(const float scale) {
|
||||
this->scaleFactor = scale;
|
||||
if (this->scaleFactor < 0.1) {this->scaleFactor = 0.1;}
|
||||
if (this->scaleFactor > 4.0) {this->scaleFactor = 4.0;}
|
||||
}
|
||||
|
||||
void mulScale(const float mod) {
|
||||
setScale(this->scaleFactor * mod);
|
||||
}
|
||||
|
||||
/** set the map's bbox. used to prevent from scrolling outside of the map */
|
||||
void setMapBBox(const BBox2 bbox_m) {
|
||||
this->mapBBox_m = bbox_m;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user