new helper methods

improved elememt-selection
changed some parameters
show length for selected obstacles/doors
minor fixes
This commit is contained in:
2017-01-05 09:41:47 +01:00
parent 535e410ae9
commit 2297a76c53
17 changed files with 160 additions and 56 deletions

View File

@@ -11,6 +11,8 @@
#include <Indoor/floorplan/v2/Floorplan.h>
#include "ClickDist.h"
/** configuration */
namespace CFG {
const float MOVE_SNAP_SIZE_M = 0.1f; // in meter (= map-space)
@@ -33,7 +35,7 @@ public:
* move l into dst
* and calculate the cut-point between l and (p1, p2)
*/
static float getLineDistanceXY(Point2 p1, Point2 p2, Point2 dst) {
static ClickDist getLineDistanceXY(Point2 p1, Point2 p2, Point2 dst) {
// the line (p1, p2)
const Line2 line(p1, p2);
@@ -46,20 +48,21 @@ public:
// calculate the cut betwen L and (p1,p2) (if any)
Point2 cut(0,0);
ClickDist cutDist(99999999, ClickDistType::CUT);
if (line.getSegmentIntersection(perb, cut)) {
// distance between cut-point and mouse
return cut.getDistance(dst);
} else {
// no cut detected
const float d1 = p1.getDistance(dst);
const float d2 = p2.getDistance(dst);
return std::min(d1, d2);
cutDist.dst_px = cut.getDistance(dst);
}
// distance from endpoints
const ClickDist d1(p1.getDistance(dst), ClickDistType::DIRECT);
const ClickDist d2(p2.getDistance(dst), ClickDistType::DIRECT);
// return the nearest possibility:
return std::min(d1, std::min(d2, cutDist));
}
static QPen getPen(Floorplan::Material mat, Floorplan::ObstacleType type, bool focus) {