summaryrefslogtreecommitdiffstats
path: root/src/util/units.h
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2014-02-24 19:32:07 +0000
committerJohan B. C. Engelen <j.b.c.engelen@alumnus.utwente.nl>2014-02-24 19:32:07 +0000
commitf6060c9447e6f2e5a70e957c19bd4eb1ae4babef (patch)
tree9e3b09e1b7e94229eafefadf5c96cc2fa8869518 /src/util/units.h
parentfix typos in page-sizer (Bug 1240308) (diff)
downloadinkscape-f6060c9447e6f2e5a70e957c19bd4eb1ae4babef.tar.gz
inkscape-f6060c9447e6f2e5a70e957c19bd4eb1ae4babef.zip
inspired by r13052, fix up the code to hopefully work when someone has different units for height and width of the page.
Fixed bugs: - https://launchpad.net/bugs/1240308 (bzr r13053)
Diffstat (limited to 'src/util/units.h')
-rw-r--r--src/util/units.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/util/units.h b/src/util/units.h
index 597371369..efe1dbec7 100644
--- a/src/util/units.h
+++ b/src/util/units.h
@@ -16,6 +16,7 @@
#include <map>
#include <boost/operators.hpp>
#include <glibmm/ustring.h>
+#include <2geom/coord.h>
#include "svg/svg-length.h"
#include "unordered-containers.h"
@@ -112,10 +113,15 @@ public:
static double convert(double from_dist, char const *from, char const *to);
/** Comparison operators. */
- bool operator<(Quantity const &other) const;
+ bool operator<(Quantity const &rhs) const;
bool operator==(Quantity const &other) const;
};
+inline bool are_near(Quantity const &a, Quantity const &b, double eps=Geom::EPSILON)
+{
+ return Geom::are_near(a.quantity, b.value(a.unit), eps);
+}
+
class UnitTable {
public:
/**