OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimFont.cpp
Go to the documentation of this file.
1 //*******************************************************************
2 //
3 // License: See top level LICENSE.txt file.
4 //
5 // Author: Garrett Potts (gpotts@imagelinks.com)
6 // Description:
7 //
8 //********************************************************************
9 // $Id: ossimFont.cpp 9963 2006-11-28 21:11:01Z gpotts $
10 #include <ossim/font/ossimFont.h>
11 #include "math.h"
12 #include <iostream>
13 using namespace std;
14 
15 #include <ossim/matrix/newmatio.h>
16 
18 
19 void ossimFont::setRotation(double rotationInDegrees)
20 {
21  theRotation = rotationInDegrees;
22 
23  computeMatrix();
24 }
25 
26 void ossimFont::setScale(double horizontal,
27  double vertical)
28 {
29  theHorizontalScale = horizontal;
30  theVerticalScale = vertical;
31 
32  computeMatrix();
33 }
34 
36 {
37  NEWMAT::Matrix r(2,2);
38  NEWMAT::Matrix s(2,2);
39 
40  double radRotation = theRotation*M_PI/180.0;
41 
42  r << cos(radRotation) << -sin(radRotation)
43  << sin(radRotation) << cos(radRotation);
44 
45  s << theHorizontalScale << theVerticalShear
46  << theHorizontalShear << theVerticalScale;
47 
48  theAffineTransform = s*r;
49 
50 }
51 
53 {
54  getBoundingBox(clippedBox);
55 
56  if(!theClippingBox.hasNans()&&
57  (theClippingBox.width()>1)&&(theClippingBox.height()>1) )
58  {
59  clippedBox = clippedBox.clipToRect(theClippingBox);
60  }
61 }
62 
64 {
65  ossimIrect clipBox;
66  getBoundingClipBox(clipBox);
67 
68  return clipBox;
69 }
virtual ossimIrect getBoundingClipBox()
Definition: ossimFont.cpp:63
void computeMatrix()
Definition: ossimFont.cpp:35
#define M_PI
ossimIrect clipToRect(const ossimIrect &rect) const
Definition: ossimIrect.cpp:501
virtual void setScale(double horizontal, double vertical)
Definition: ossimFont.cpp:26
virtual void setRotation(double rotationInDegrees)
Definition: ossimFont.cpp:19
RTTI_DEF2(ossimFont, "ossimFont", ossimObject, ossimErrorStatusInterface)