Coordinate.h
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/*
3 * This file is part of the libmspub project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9
10#ifndef INCLUDED_COORDINATE_H
11#define INCLUDED_COORDINATE_H
12
13#include <cstdint>
14#include "MSPUBConstants.h"
15
16namespace libmspub
17{
19{
20 Coordinate(int xs, int ys, int xe, int ye) : m_xs(xs), m_ys(ys), m_xe(xe), m_ye(ye) { }
21 Coordinate() : m_xs(0), m_ys(0), m_xe(0), m_ye(0) { }
23 double getXIn(double pageWidth) const
24 {
25 return pageWidth / 2 + double(m_xs) / EMUS_IN_INCH;
26 }
27 double getYIn(double pageHeight) const
28 {
29 return pageHeight / 2 + double(m_ys) / EMUS_IN_INCH;
30 }
31 double getWidthIn() const
32 {
33 return double(int64_t(m_xe) - m_xs) / EMUS_IN_INCH;
34 }
35 double getHeightIn() const
36 {
37 return double(int64_t(m_ye) - m_ys) / EMUS_IN_INCH;
38 }
39};
40}
41#endif
42/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
#define EMUS_IN_INCH
Definition MSPUBConstants.h:13
Definition Arrow.h:14
int m_xe
Definition Coordinate.h:22
double getYIn(double pageHeight) const
Definition Coordinate.h:27
double getWidthIn() const
Definition Coordinate.h:31
double getXIn(double pageWidth) const
Definition Coordinate.h:23
Coordinate()
Definition Coordinate.h:21
int m_ye
Definition Coordinate.h:22
double getHeightIn() const
Definition Coordinate.h:35
int m_xs
Definition Coordinate.h:22
int m_ys
Definition Coordinate.h:22
Coordinate(int xs, int ys, int xe, int ye)
Definition Coordinate.h:20

Generated for libmspub by doxygen 1.13.2