Mapper  0.9.0
API documentation
Namespaces | Macros | Functions
util.h File Reference

(a56e161 on 16 Oct 2019)

#include <cmath>
#include <functional>
#include <type_traits>
#include <QtGlobal>
#include <QtMath>
#include <QPointF>
#include <QRectF>
Include dependency graph for util.h:
This graph shows which files directly or indirectly include this file:

Namespaces

 OpenOrienteering
 
 OpenOrienteering::Util
 A collection of GUI utility functions.
 

Macros

#define BEZIER_KAPPA   0.5522847498
 Value to calculate the optimum handle distance of 4 cubic bezier curves used to approximate a circle. More...
 
#define BEZIER_HANDLE_DISTANCE   0.390524291729
 When drawing a cubic bezier curve, the distance between start and end point is multiplied by this value to get the handle distance from start respectively end points. More...
 

Functions

template<class T >
constexpr double std::log2 (T value)
 Fallback for missing std::log2 in some distributions of gcc. More...
 
void OpenOrienteering::blockSignalsRecursively (QObject *obj, bool block)
 (Un-)blocks recursively all signals from a QObject and its child-objects. More...
 
QRectF OpenOrienteering::infiniteRectF ()
 Returns a practically "infinitely" big QRectF. More...
 
double OpenOrienteering::fmod_pos (double x, double y)
 Modulus calculation like fmod(x, y), but works correctly for negative x. More...
 
void OpenOrienteering::rectInclude (QRectF &rect, const QPointF &point)
 Enlarges the rect to include the given point. More...
 
void OpenOrienteering::rectIncludeSafe (QRectF &rect, const QPointF &point)
 Enlarges the rect to include the given point. More...
 
void OpenOrienteering::rectInclude (QRectF &rect, const QRectF &other_rect)
 Enlarges the rect to include the given other_rect. More...
 
void OpenOrienteering::rectIncludeSafe (QRectF &rect, const QRectF &other_rect)
 Enlarges the rect to include the given other_rect. More...
 
void OpenOrienteering::rectIncludeSafe (QRect &rect, const QRect &other_rect)
 Enlarges the rect to include the given other_rect. More...
 
bool OpenOrienteering::lineIntersectsRect (const QRectF &rect, const QPointF &p1, const QPointF &p2)
 Checks for line - rect intersection. More...
 
double OpenOrienteering::parameterOfPointOnLine (double x0, double y0, double dx, double dy, double x, double y, bool &ok)
 Calculates the line parameter for a point on a straight line. More...
 
bool OpenOrienteering::isPointOnSegment (const MapCoordF &seg_start, const MapCoordF &seg_end, const MapCoordF &point)
 Checks if the point is on the segment defined by the given start and end coordinates. More...
 
void OpenOrienteering::Util::hatchingOperation (const QRectF &extent, double spacing, double offset, double rotation, std::function< void(const QPointF &, const QPointF &)> &process_line)
 Generates a pattern of parallel lines inside the box given by extent. More...
 
void OpenOrienteering::Util::gridOperation (const QRectF &extent, double horz_spacing, double vert_spacing, double horz_offset, double vert_offset, double rotation, std::function< void(const QPointF &, const QPointF &)> &process_line)
 Generates a grid of lines inside the given box. More...
 
bool OpenOrienteering::Util::pointsFormCorner (const MapCoord &point1, const MapCoord &anchor_point, const MapCoord &point2, qreal quantum_size)
 Tests whether three points form what we would call a corner. More...
 

Macro Definition Documentation

◆ BEZIER_HANDLE_DISTANCE

#define BEZIER_HANDLE_DISTANCE   0.390524291729

When drawing a cubic bezier curve, the distance between start and end point is multiplied by this value to get the handle distance from start respectively end points.

Calculated as BEZIER_HANDLE_DISTANCE = BEZIER_KAPPA / sqrt(2)

◆ BEZIER_KAPPA

#define BEZIER_KAPPA   0.5522847498

Value to calculate the optimum handle distance of 4 cubic bezier curves used to approximate a circle.

Function Documentation

◆ log2()

template<class T >
constexpr double std::log2 ( value)

Fallback for missing std::log2 in some distributions of gcc.

This template will be selected if std::log2 is not found. The function std::log2 is part of C++11, but the following distributions of gcc are known lack this function:

  • GCC 4.8 in Android NDK R10d

The argument must be a floating point value in order to avoid ambiguity when the regular std::log2 is present.