This repository has been archived on 2020-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
Files
IndoorMap/mapview/2D/MapViewElementHelper.h
2018-10-25 12:23:40 +02:00

53 lines
1.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* © Copyright 2014 Urheberrechtshinweis
* Alle Rechte vorbehalten / All Rights Reserved
*
* Programmcode ist urheberrechtlich geschuetzt.
* Das Urheberrecht liegt, soweit nicht ausdruecklich anders gekennzeichnet, bei Frank Ebner.
* Keine Verwendung ohne explizite Genehmigung.
* (vgl. § 106 ff UrhG / § 97 UrhG)
*/
#ifndef MAPELEMENTHELPER_H
#define MAPELEMENTHELPER_H
#include <Indoor/geo/Point2.h>
#include <Indoor/geo/Point3.h>
#include <Indoor/geo/Line2.h>
#include <QPen>
#include <Indoor/floorplan/v2/Floorplan.h>
#include "ClickDist.h"
/** configuration */
namespace CFG {
const float MOVE_SNAP_SIZE_M = 0.1f; // in meter (= map-space)
const int SEL_THRESHOLD_SIZE_PX = 15; // in screen-pixels (-> should depend on the current zoom)
const QColor FOCUS_COLOR = Qt::black;
const QColor UNFOCUS_COLOR = Qt::gray;
const QColor SEL_COLOR = Qt::blue;
}
/**
* contains some common helper-methods
*/
class MapElementHelper {
public:
/**
* get the minimal distance of dst to the line denoted by (p1, p2).
* this will generate line l perpendicular to (p1, p2)
* move l into dst
* and calculate the cut-point between l and (p1, p2)
*/
static ClickDist getLineDistanceXY(Point2 p1, Point2 p2, Point2 dst);
static QPen getPen(Floorplan::Material mat, Floorplan::ObstacleType type, bool focus, float thickness_px);
};
#endif // MAPELEMENTHELPER_H