geometry.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 libpagemaker 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 __LIBPAGEMAKER_GEOMETRY_H__
00011 #define __LIBPAGEMAKER_GEOMETRY_H__
00012 
00013 #include <vector>
00014 #include "Units.h"
00015 #include "constants.h"
00016 #include <librevenge/librevenge.h>
00017 #include <PMDTypes.h>
00018 #include "libpagemaker_utils.h"
00019 
00020 namespace libpagemaker
00021 {
00022 template <typename Unit> struct Point
00023 {
00024   Unit m_x;
00025   Unit m_y;
00026 
00027   Point(Unit x, Unit y) : m_x(x), m_y(y)
00028   { }
00029 };
00030 
00031 typedef Point<PMDShapeUnit> PMDShapePoint;
00032 typedef Point<double> InchPoint;
00033 
00034 struct PMDXForm
00035 {
00036   uint32_t m_rotationDegree;
00037   uint32_t m_skewDegree;
00038   PMDShapePoint m_xformTopLeft;
00039   PMDShapePoint m_xformBotRight;
00040   PMDShapePoint m_rotatingPoint;
00041   uint32_t m_xformId;
00042 
00043   PMDXForm(const uint32_t rotationDegree, const uint32_t skewDegree, const PMDShapePoint xformTopLeft, const PMDShapePoint xformBotRight, const PMDShapePoint rotatingPoint, const uint32_t xformId)
00044     : m_rotationDegree(rotationDegree), m_skewDegree(skewDegree), m_xformTopLeft(xformTopLeft), m_xformBotRight(xformBotRight), m_rotatingPoint(rotatingPoint), m_xformId(xformId)
00045   { }
00046 };
00047 
00048 class PMDLineSet
00049 {
00050 public:
00051   virtual std::vector<PMDShapePoint> getPoints() const = 0;
00052   virtual bool getIsClosed() const = 0;
00053   virtual double getRotation() const = 0;
00054   virtual double getSkew() const = 0;
00055   virtual PMDShapePoint getRotatingPoint() const = 0;
00056   virtual PMDShapePoint getXformTopLeft() const = 0;
00057   virtual PMDShapePoint getXformBotRight() const = 0;
00058   virtual uint8_t shapeType() const = 0;
00059   virtual PMDShapePoint getBboxTopLeft() const = 0;
00060   virtual PMDShapePoint getBboxBotRight() const = 0;
00061   virtual PMDFillProperties getFillProperties() const = 0;
00062   virtual PMDStrokeProperties getStrokeProperties() const = 0;
00063   virtual std::string getText() const = 0;
00064   virtual std::vector<PMDCharProperties> getCharProperties() const = 0;
00065   virtual std::vector<PMDParaProperties> getParaProperties() const = 0;
00066   virtual librevenge::RVNGBinaryData getBitmap() const = 0;
00067 
00068 
00069   virtual ~PMDLineSet()
00070   {
00071   }
00072 };
00073 
00074 class PMDLine : public PMDLineSet
00075 {
00076   PMDShapePoint m_bboxTopLeft;
00077   PMDShapePoint m_bboxBotRight;
00078   bool m_mirrored;
00079   PMDStrokeProperties m_strokeProps;
00080 
00081 public:
00082   PMDLine(const PMDShapePoint &bboxTopLeft, const PMDShapePoint &bboxBotRight, const bool mirrored, const PMDStrokeProperties strokeProps)
00083     : m_bboxTopLeft(bboxTopLeft), m_bboxBotRight(bboxBotRight), m_mirrored(mirrored), m_strokeProps(strokeProps)
00084   { }
00085 
00086   virtual double getRotation() const
00087   {
00088     return 0;
00089   }
00090 
00091   virtual double getSkew() const
00092   {
00093     return 0;
00094   }
00095 
00096   virtual PMDShapePoint getXformTopLeft() const
00097   {
00098     return PMDShapePoint(0,0);
00099   }
00100 
00101   virtual PMDShapePoint getXformBotRight() const
00102   {
00103     return PMDShapePoint(0,0);
00104   }
00105 
00106   virtual PMDShapePoint getRotatingPoint() const
00107   {
00108     return PMDShapePoint(0,0);
00109   }
00110 
00111   virtual bool getIsClosed() const
00112   {
00113     return false;
00114   }
00115 
00116   virtual PMDShapePoint getBboxTopLeft() const
00117   {
00118     return m_bboxTopLeft;
00119   }
00120 
00121   virtual PMDShapePoint getBboxBotRight() const
00122   {
00123     return m_bboxBotRight;
00124   }
00125 
00126   virtual std::vector<PMDShapePoint> getPoints() const
00127   {
00128     std::vector<PMDShapePoint> points;
00129 
00130     if (m_mirrored)
00131     {
00132       points.push_back(PMDShapePoint(m_bboxBotRight.m_x,m_bboxTopLeft.m_y));
00133       points.push_back(PMDShapePoint(m_bboxTopLeft.m_x,m_bboxBotRight.m_y));
00134     }
00135     else
00136     {
00137       points.push_back(m_bboxTopLeft);
00138       points.push_back(m_bboxBotRight);
00139     }
00140     return points;
00141   }
00142 
00143   virtual uint8_t shapeType() const
00144   {
00145     return SHAPE_TYPE_LINE;
00146   }
00147 
00148   virtual PMDFillProperties getFillProperties() const
00149   {
00150     return PMDFillProperties(FILL_SOLID,0,0,0);
00151   }
00152 
00153   virtual PMDStrokeProperties getStrokeProperties() const
00154   {
00155     return m_strokeProps;
00156   }
00157 
00158   virtual std::string getText() const
00159   {
00160     return "";
00161   }
00162 
00163   virtual std::vector<PMDCharProperties> getCharProperties() const
00164   {
00165     std::vector<PMDCharProperties> temp;
00166     temp.push_back(PMDCharProperties(0,0,0,0,0,0,0,0,0,0,0));
00167     return temp;
00168   }
00169 
00170   virtual std::vector<PMDParaProperties> getParaProperties() const
00171   {
00172     std::vector<PMDParaProperties> temp;
00173     temp.push_back(PMDParaProperties(0,0,0,0,0,0,0));
00174     return temp;
00175   }
00176 
00177   virtual librevenge::RVNGBinaryData getBitmap() const
00178   {
00179     librevenge::RVNGBinaryData temp;
00180     return temp;
00181   }
00182 
00183   virtual ~PMDLine()
00184   {
00185   }
00186 };
00187 
00188 
00189 class PMDPolygon : public PMDLineSet
00190 {
00191   std::vector<PMDShapePoint> m_points;
00192   bool m_isClosed;
00193   PMDShapePoint m_bboxTopLeft;
00194   PMDShapePoint m_bboxBotRight;
00195   PMDXForm m_xFormContainer;
00196   PMDFillProperties m_fillProps;
00197   PMDStrokeProperties m_strokeProps;
00198 
00199 public:
00200   PMDPolygon(std::vector<PMDShapePoint> points, bool isClosed, const PMDShapePoint &bboxTopLeft, const PMDShapePoint &bboxBotRight, const PMDXForm &xFormContainer, const PMDFillProperties fillProps, const PMDStrokeProperties strokeProps)
00201     : m_points(points), m_isClosed(isClosed), m_bboxTopLeft(bboxTopLeft), m_bboxBotRight(bboxBotRight), m_xFormContainer(xFormContainer), m_fillProps(fillProps), m_strokeProps(strokeProps)
00202   { }
00203 
00204   virtual double getRotation() const
00205   {
00206     int32_t temp = (int32_t)m_xFormContainer.m_rotationDegree;
00207     return (-1 * (double)temp/1000 * (M_PI/180));
00208   }
00209 
00210   virtual double getSkew() const
00211   {
00212     int32_t temp = (int32_t)m_xFormContainer.m_skewDegree;
00213     return (-1 * (double)temp/1000 * (M_PI/180));
00214   }
00215 
00216   virtual PMDShapePoint getXformTopLeft() const
00217   {
00218     return m_xFormContainer.m_xformTopLeft;
00219   }
00220 
00221   virtual PMDShapePoint getXformBotRight() const
00222   {
00223     return m_xFormContainer.m_xformBotRight;
00224   }
00225 
00226   virtual PMDShapePoint getRotatingPoint() const
00227   {
00228     return m_xFormContainer.m_rotatingPoint;
00229   }
00230 
00231   virtual PMDShapePoint getBboxTopLeft() const
00232   {
00233     return m_bboxTopLeft;
00234   }
00235 
00236   virtual PMDShapePoint getBboxBotRight() const
00237   {
00238     return m_bboxBotRight;
00239   }
00240 
00241   virtual bool getIsClosed() const
00242   {
00243     return m_isClosed;
00244   }
00245 
00246   virtual std::vector<PMDShapePoint> getPoints() const
00247   {
00248     return m_points;
00249   }
00250 
00251   virtual uint8_t shapeType() const
00252   {
00253     return SHAPE_TYPE_POLY;
00254   }
00255 
00256   virtual PMDFillProperties getFillProperties() const
00257   {
00258     return m_fillProps;
00259   }
00260 
00261   virtual PMDStrokeProperties getStrokeProperties() const
00262   {
00263     return m_strokeProps;
00264   }
00265 
00266   virtual std::string getText() const
00267   {
00268     return "";
00269   }
00270 
00271   virtual std::vector<PMDCharProperties> getCharProperties() const
00272   {
00273     std::vector<PMDCharProperties> temp;
00274     temp.push_back(PMDCharProperties(0,0,0,0,0,0,0,0,0,0,0));
00275     return temp;
00276   }
00277 
00278   virtual std::vector<PMDParaProperties> getParaProperties() const
00279   {
00280     std::vector<PMDParaProperties> temp;
00281     temp.push_back(PMDParaProperties(0,0,0,0,0,0,0));
00282     return temp;
00283   }
00284 
00285   virtual librevenge::RVNGBinaryData getBitmap() const
00286   {
00287     librevenge::RVNGBinaryData temp;
00288     return temp;
00289   }
00290 
00291   virtual ~PMDPolygon()
00292   {
00293   }
00294 };
00295 
00296 class PMDTextBox : public PMDLineSet
00297 {
00298   PMDShapePoint m_bboxTopLeft;
00299   PMDShapePoint m_bboxBotRight;
00300   PMDXForm m_xFormContainer;
00301   std::string m_text;
00302   std::vector<PMDCharProperties> m_charProps;
00303   std::vector<PMDParaProperties> m_paraProps;
00304 
00305 public:
00306   PMDTextBox(const PMDShapePoint &bboxTopLeft, const PMDShapePoint &bboxBotRight, const PMDXForm &xFormContainer, const std::string text, const std::vector<PMDCharProperties> charProps, const std::vector<PMDParaProperties> paraProps)
00307     : m_bboxTopLeft(bboxTopLeft), m_bboxBotRight(bboxBotRight),m_xFormContainer(xFormContainer), m_text(text), m_charProps(charProps), m_paraProps(paraProps)
00308   { }
00309 
00310   virtual double getRotation() const
00311   {
00312     int32_t temp = (int32_t)m_xFormContainer.m_rotationDegree;
00313     return (-1 * (double)temp/1000 * (M_PI/180));
00314   }
00315 
00316   virtual double getSkew() const
00317   {
00318     int32_t temp = (int32_t)m_xFormContainer.m_skewDegree;
00319     return (-1 * (double)temp/1000 * (M_PI/180));
00320   }
00321 
00322   virtual PMDShapePoint getXformTopLeft() const
00323   {
00324     return m_xFormContainer.m_xformTopLeft;
00325   }
00326 
00327   virtual PMDShapePoint getXformBotRight() const
00328   {
00329     return m_xFormContainer.m_xformBotRight;
00330   }
00331 
00332   virtual PMDShapePoint getRotatingPoint() const
00333   {
00334     return m_xFormContainer.m_rotatingPoint;
00335   }
00336 
00337   virtual PMDShapePoint getBboxTopLeft() const
00338   {
00339     return m_bboxTopLeft;
00340   }
00341 
00342   virtual PMDShapePoint getBboxBotRight() const
00343   {
00344     return m_bboxBotRight;
00345   }
00346 
00347   virtual bool getIsClosed() const
00348   {
00349     return true;
00350   }
00351 
00352   virtual std::vector<PMDShapePoint> getPoints() const
00353   {
00354     std::vector<PMDShapePoint> points;
00355 
00356     points.push_back(m_bboxTopLeft);
00357 
00358     return points;
00359   }
00360 
00361   virtual uint8_t shapeType() const
00362   {
00363     return SHAPE_TYPE_TEXTBOX;
00364   }
00365 
00366   virtual PMDFillProperties getFillProperties() const
00367   {
00368     return PMDFillProperties(0,0,0,0);
00369   }
00370 
00371   virtual PMDStrokeProperties getStrokeProperties() const
00372   {
00373     return PMDStrokeProperties(0,0,0,0,0);
00374   }
00375 
00376   virtual std::string getText() const
00377   {
00378     return m_text;
00379   }
00380 
00381   virtual std::vector<PMDCharProperties> getCharProperties() const
00382   {
00383     return m_charProps;
00384   }
00385 
00386   virtual std::vector<PMDParaProperties> getParaProperties() const
00387   {
00388     return m_paraProps;
00389   }
00390 
00391   virtual librevenge::RVNGBinaryData getBitmap() const
00392   {
00393     librevenge::RVNGBinaryData temp;
00394     return temp;
00395   }
00396 
00397   virtual ~PMDTextBox()
00398   {
00399   }
00400 };
00401 
00402 class PMDRectangle : public PMDLineSet
00403 {
00404   PMDShapePoint m_bboxTopLeft;
00405   PMDShapePoint m_bboxBotRight;
00406   PMDXForm m_xFormContainer;
00407   PMDFillProperties m_fillProps;
00408   PMDStrokeProperties m_strokeProps;
00409 
00410 public:
00411   PMDRectangle(const PMDShapePoint &bboxTopLeft, const PMDShapePoint &bboxBotRight, const PMDXForm &xFormContainer, const PMDFillProperties fillProps, const PMDStrokeProperties strokeProps)
00412     : m_bboxTopLeft(bboxTopLeft), m_bboxBotRight(bboxBotRight),m_xFormContainer(xFormContainer), m_fillProps(fillProps), m_strokeProps(strokeProps)
00413   { }
00414 
00415   virtual double getRotation() const
00416   {
00417     int32_t temp = (int32_t)m_xFormContainer.m_rotationDegree;
00418     return (-1 * (double)temp/1000 * (M_PI/180));
00419   }
00420 
00421   virtual double getSkew() const
00422   {
00423     int32_t temp = (int32_t)m_xFormContainer.m_skewDegree;
00424     return (-1 * (double)temp/1000 * (M_PI/180));
00425   }
00426 
00427   virtual PMDShapePoint getXformTopLeft() const
00428   {
00429     return m_xFormContainer.m_xformTopLeft;
00430   }
00431 
00432   virtual PMDShapePoint getXformBotRight() const
00433   {
00434     return m_xFormContainer.m_xformBotRight;
00435   }
00436 
00437   virtual PMDShapePoint getRotatingPoint() const
00438   {
00439     return m_xFormContainer.m_rotatingPoint;
00440   }
00441 
00442   virtual PMDShapePoint getBboxTopLeft() const
00443   {
00444     return m_bboxTopLeft;
00445   }
00446 
00447   virtual PMDShapePoint getBboxBotRight() const
00448   {
00449     return m_bboxBotRight;
00450   }
00451 
00452   virtual bool getIsClosed() const
00453   {
00454     return true;
00455   }
00456 
00457   virtual std::vector<PMDShapePoint> getPoints() const
00458   {
00459     std::vector<PMDShapePoint> points;
00460 
00461     points.push_back(m_bboxTopLeft);
00462     points.push_back(PMDShapePoint(m_bboxBotRight.m_x, m_bboxTopLeft.m_y));
00463     points.push_back(m_bboxBotRight);
00464     points.push_back(PMDShapePoint(m_bboxTopLeft.m_x, m_bboxBotRight.m_y));
00465 
00466     return points;
00467   }
00468 
00469   virtual uint8_t shapeType() const
00470   {
00471     return SHAPE_TYPE_RECT;
00472   }
00473 
00474   virtual PMDFillProperties getFillProperties() const
00475   {
00476     return m_fillProps;
00477   }
00478 
00479   virtual PMDStrokeProperties getStrokeProperties() const
00480   {
00481     return m_strokeProps;
00482   }
00483 
00484   virtual std::string getText() const
00485   {
00486     return "";
00487   }
00488 
00489   virtual std::vector<PMDCharProperties> getCharProperties() const
00490   {
00491     std::vector<PMDCharProperties> temp;
00492     temp.push_back(PMDCharProperties(0,0,0,0,0,0,0,0,0,0,0));
00493     return temp;
00494   }
00495 
00496   virtual std::vector<PMDParaProperties> getParaProperties() const
00497   {
00498     std::vector<PMDParaProperties> temp;
00499     temp.push_back(PMDParaProperties(0,0,0,0,0,0,0));
00500     return temp;
00501   }
00502 
00503   virtual librevenge::RVNGBinaryData getBitmap() const
00504   {
00505     librevenge::RVNGBinaryData temp;
00506     return temp;
00507   }
00508 
00509   virtual ~PMDRectangle()
00510   {
00511   }
00512 };
00513 
00514 class PMDEllipse : public PMDLineSet
00515 {
00516   PMDShapePoint m_bboxTopLeft;
00517   PMDShapePoint m_bboxBotRight;
00518   PMDXForm m_xFormContainer;
00519   PMDFillProperties m_fillProps;
00520   PMDStrokeProperties m_strokeProps;
00521 
00522 public:
00523   PMDEllipse(const PMDShapePoint &bboxTopLeft, const PMDShapePoint &bboxBotRight, const PMDXForm &xFormContainer, const PMDFillProperties fillProps, const PMDStrokeProperties strokeProps)
00524     : m_bboxTopLeft(bboxTopLeft), m_bboxBotRight(bboxBotRight), m_xFormContainer(xFormContainer), m_fillProps(fillProps), m_strokeProps(strokeProps)
00525   { }
00526 
00527   virtual double getRotation() const
00528   {
00529     int32_t temp = (int32_t)m_xFormContainer.m_rotationDegree;
00530     return (-1 * (double)temp/1000 * (M_PI/180));
00531   }
00532 
00533   virtual double getSkew() const
00534   {
00535     int32_t temp = (int32_t)m_xFormContainer.m_skewDegree;
00536     return (-1 * (double)temp/1000 * (M_PI/180));
00537   }
00538 
00539   virtual PMDShapePoint getXformTopLeft() const
00540   {
00541     return m_xFormContainer.m_xformTopLeft;
00542   }
00543 
00544   virtual PMDShapePoint getXformBotRight() const
00545   {
00546     return m_xFormContainer.m_xformBotRight;
00547   }
00548 
00549   virtual PMDShapePoint getRotatingPoint() const
00550   {
00551     return m_xFormContainer.m_rotatingPoint;
00552   }
00553 
00554   virtual bool getIsClosed() const
00555   {
00556     return true;
00557   }
00558 
00559   virtual std::vector<PMDShapePoint> getPoints() const
00560   {
00561     std::vector<PMDShapePoint> points;
00562 
00563     points.push_back(m_bboxTopLeft);
00564     points.push_back(m_bboxBotRight);
00565 
00566     return points;
00567   }
00568 
00569   virtual PMDShapePoint getBboxTopLeft() const
00570   {
00571     return m_bboxTopLeft;
00572   }
00573 
00574   virtual PMDShapePoint getBboxBotRight() const
00575   {
00576     return m_bboxBotRight;
00577   }
00578 
00579   virtual uint8_t shapeType() const
00580   {
00581     return SHAPE_TYPE_ELLIPSE;
00582   }
00583 
00584   virtual PMDFillProperties getFillProperties() const
00585   {
00586     return m_fillProps;
00587   }
00588 
00589   virtual PMDStrokeProperties getStrokeProperties() const
00590   {
00591     return m_strokeProps;
00592   }
00593 
00594   virtual std::string getText() const
00595   {
00596     return "";
00597   }
00598 
00599   virtual std::vector<PMDCharProperties> getCharProperties() const
00600   {
00601     std::vector<PMDCharProperties> temp;
00602     temp.push_back(PMDCharProperties(0,0,0,0,0,0,0,0,0,0,0));
00603     return temp;
00604   }
00605 
00606   virtual std::vector<PMDParaProperties> getParaProperties() const
00607   {
00608     std::vector<PMDParaProperties> temp;
00609     temp.push_back(PMDParaProperties(0,0,0,0,0,0,0));
00610     return temp;
00611   }
00612 
00613   virtual librevenge::RVNGBinaryData getBitmap() const
00614   {
00615     librevenge::RVNGBinaryData temp;
00616     return temp;
00617   }
00618 
00619   virtual ~PMDEllipse()
00620   {
00621   }
00622 };
00623 
00624 class PMDBitmap : public PMDLineSet
00625 {
00626   PMDShapePoint m_bboxTopLeft;
00627   PMDShapePoint m_bboxBotRight;
00628   PMDXForm m_xFormContainer;
00629   librevenge::RVNGBinaryData m_bitmap;
00630 
00631 public:
00632   PMDBitmap(const PMDShapePoint &bboxTopLeft, const PMDShapePoint &bboxBotRight, const PMDXForm &xFormContainer, const librevenge::RVNGBinaryData &bitmap)
00633     : m_bboxTopLeft(bboxTopLeft), m_bboxBotRight(bboxBotRight), m_xFormContainer(xFormContainer),m_bitmap(bitmap)
00634   { }
00635 
00636   virtual double getRotation() const
00637   {
00638     int32_t temp = (int32_t)m_xFormContainer.m_rotationDegree;
00639     return (-1 * (double)temp/1000 * (M_PI/180));
00640   }
00641 
00642   virtual double getSkew() const
00643   {
00644     int32_t temp = (int32_t)m_xFormContainer.m_skewDegree;
00645     return (-1 * (double)temp/1000 * (M_PI/180));
00646   }
00647 
00648   virtual PMDShapePoint getXformTopLeft() const
00649   {
00650     return m_xFormContainer.m_xformTopLeft;
00651   }
00652 
00653   virtual PMDShapePoint getXformBotRight() const
00654   {
00655     return m_xFormContainer.m_xformBotRight;
00656   }
00657 
00658   virtual PMDShapePoint getRotatingPoint() const
00659   {
00660     return m_xFormContainer.m_rotatingPoint;
00661   }
00662 
00663   virtual PMDShapePoint getBboxTopLeft() const
00664   {
00665     return m_bboxTopLeft;
00666   }
00667 
00668   virtual PMDShapePoint getBboxBotRight() const
00669   {
00670     return m_bboxBotRight;
00671   }
00672 
00673   virtual bool getIsClosed() const
00674   {
00675     return true;
00676   }
00677 
00678   virtual std::vector<PMDShapePoint> getPoints() const
00679   {
00680     std::vector<PMDShapePoint> points;
00681 
00682     points.push_back(m_bboxTopLeft);
00683     points.push_back(PMDShapePoint(m_bboxBotRight.m_x, m_bboxTopLeft.m_y));
00684     points.push_back(m_bboxBotRight);
00685     points.push_back(PMDShapePoint(m_bboxTopLeft.m_x, m_bboxBotRight.m_y));
00686 
00687     return points;
00688   }
00689 
00690   virtual uint8_t shapeType() const
00691   {
00692     return SHAPE_TYPE_BITMAP;
00693   }
00694 
00695   virtual PMDFillProperties getFillProperties() const
00696   {
00697     return PMDFillProperties(0,0,0,0);
00698   }
00699 
00700   virtual PMDStrokeProperties getStrokeProperties() const
00701   {
00702     return PMDStrokeProperties(0,0,0,0,0);
00703   }
00704 
00705   virtual std::string getText() const
00706   {
00707     return "";
00708   }
00709 
00710   virtual std::vector<PMDCharProperties> getCharProperties() const
00711   {
00712     std::vector<PMDCharProperties> temp;
00713     temp.push_back(PMDCharProperties(0,0,0,0,0,0,0,0,0,0,0));
00714     return temp;
00715   }
00716 
00717   virtual std::vector<PMDParaProperties> getParaProperties() const
00718   {
00719     std::vector<PMDParaProperties> temp;
00720     temp.push_back(PMDParaProperties(0,0,0,0,0,0,0));
00721     return temp;
00722   }
00723 
00724   virtual librevenge::RVNGBinaryData getBitmap() const
00725   {
00726     return m_bitmap;
00727   }
00728 
00729   virtual ~PMDBitmap()
00730   {
00731   }
00732 };
00733 
00734 class TransformationMatrix
00735 {
00736   double m_tl, m_tr, m_bl, m_br;
00737 
00738 public:
00739   TransformationMatrix(double bboxTopLeft, double topRight, double bottomLeft, double bottomRight)
00740     : m_tl(bboxTopLeft), m_tr(topRight), m_bl(bottomLeft), m_br(bottomRight)
00741   { }
00742 
00743   template <typename Unit> InchPoint transform(const Point<Unit> &point) const
00744   {
00745     double xInches = point.m_x.toInches(),
00746            yInches = point.m_y.toInches();
00747     double newX = m_tl * xInches + m_tr * yInches,
00748            newY = m_bl * xInches + m_br * yInches;
00749     return InchPoint(newX, newY);
00750   }
00751 };
00752 std::pair<InchPoint, InchPoint>
00753 getBoundingBox(const PMDLineSet &lineSet, const TransformationMatrix &matrix);
00754 }
00755 
00756 #endif /* __LIBPAGEMAKER_GEOMETRY_H__ */
00757 
00758 /* vim:set shiftwidth=2 softtabstop=2 expandtab: */