Coordinate.h Source File documentation

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
15#include <boost/cstdint.hpp>
16
17#include <cstdint>
18#include "MSPUBConstants.h"
19
20namespace libmspub
21{
22 struct Coordinate
23{
24 Coordinate(int xs, int ys, int xe, int ye);
25 Coordinate() : m_xs(0), m_ys(0), m_xe(0), m_ye(0) { }
26 void arrange();
27 int m_xs, m_ys, m_xe, m_ye;
28 double getXIn(double pageWidth) const
29 {
30 return pageWidth / 2 + double(m_xs) / EMUS_IN_INCH;
31 }
32 double getYIn(double pageHeight) const
33 {
34 return pageHeight / 2 + double(m_ys) / EMUS_IN_INCH;
35 }
36 double getWidthIn() const
37 {
38 return double(int64_t(m_xe) - m_xs) / EMUS_IN_INCH;
39 }
40 double getHeightIn() const
41 {
42 return double(int64_t(m_ye) - m_ys) / EMUS_IN_INCH;
43 }
44};
45}
46#endif
47/* vim:set shiftwidth=2 softtabstop=2 expandtab: */
MSPUBConstants.h
EMUS_IN_INCH
#define EMUS_IN_INCH
Definition MSPUBConstants.h:13
libmspub
Definition Arrow.h:14
libmspub::Coordinate::m_xe
int m_xe
Definition Coordinate.h:27
libmspub::Coordinate::getYIn
double getYIn(double pageHeight) const
Definition Coordinate.h:32
libmspub::Coordinate::getWidthIn
double getWidthIn() const
Definition Coordinate.h:36
libmspub::Coordinate::getXIn
double getXIn(double pageWidth) const
Definition Coordinate.h:28
libmspub::Coordinate::Coordinate
Coordinate()
Definition Coordinate.h:25
libmspub::Coordinate::m_ye
int m_ye
Definition Coordinate.h:27
libmspub::Coordinate::getHeightIn
double getHeightIn() const
Definition Coordinate.h:40
libmspub::Coordinate::m_xs
int m_xs
Definition Coordinate.h:27
libmspub::Coordinate::m_ys
int m_ys
Definition Coordinate.h:27
libmspub::Coordinate::Coordinate
Coordinate(int xs, int ys, int xe, int ye)
Definition Coordinate.cpp:17
libmspub::Coordinate::arrange
void arrange()
Definition Coordinate.cpp:26