Coordinate.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /*
00003  * This file is part of the libmspub project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  */
00009 
00010 #ifndef __COORDINATE_H__
00011 #define __COORDINATE_H__
00012 #include "MSPUBConstants.h"
00013 namespace libmspub
00014 {
00015 struct Coordinate
00016 {
00017   Coordinate(int xs, int ys, int xe, int ye) : m_xs(xs), m_ys(ys), m_xe(xe), m_ye(ye) { }
00018   Coordinate() : m_xs(0), m_ys(0), m_xe(0), m_ye(0) { }
00019   int m_xs, m_ys, m_xe, m_ye;
00020   double getXIn(double pageWidth) const
00021   {
00022     return pageWidth / 2 + double(m_xs) / EMUS_IN_INCH;
00023   }
00024   double getYIn(double pageHeight) const
00025   {
00026     return pageHeight / 2 + double(m_ys) / EMUS_IN_INCH;
00027   }
00028   double getWidthIn() const
00029   {
00030     return double(m_xe - m_xs) / EMUS_IN_INCH;
00031   }
00032   double getHeightIn() const
00033   {
00034     return double(m_ye - m_ys) / EMUS_IN_INCH;
00035   }
00036 };
00037 }
00038 #endif
00039 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */