Update of /cvsroot/thplot/thplot/src/Draw
In directory usw-pr-cvs1:/tmp/cvs-serv23792/src/Draw
Modified Files:
Axis.cpp Axis.h
Log Message:
Improved placement of titles and tick marks, code cleanup.
Index: Axis.cpp
===================================================================
RCS file: /cvsroot/thplot/thplot/src/Draw/Axis.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Axis.cpp 2 Jul 2002 17:20:42 -0000 1.3
--- Axis.cpp 3 Jul 2002 13:23:40 -0000 1.4
***************
*** 55,58 ****
--- 55,59 ----
tickFont = new OGLFT::Grayscale( fontfile.c_str(), 9 );
titleFont->setForegroundColor(0,0,0);
+ titleFont->setHorizontalJustification(OGLFT::Face::CENTER);
tickFont->setForegroundColor(0,0,0);
if( !titleFont->isValid() ) {
***************
*** 133,138 ****
value = min;
for(i=0;i<=length;i+=20) {
! snprintf(tmp,80,"%5.2f",value);
! drawStringWCentered(tmp,parent->getX()+i,parent->getY()-7);
value += 2*delta;
}
--- 134,143 ----
value = min;
for(i=0;i<=length;i+=20) {
! snprintf(tmp,80,"%g",value);
! tickFont->setHorizontalJustification(OGLFT::Face::CENTER);
! tickFont->setVerticalJustification(OGLFT::Face::TOP);
! tickFont->draw( parent->getX()+i,
! parent->getY()-hashLength-2,
! tmp );
value += 2*delta;
}
***************
*** 140,145 ****
value = min;
for(i=0;i<=length;i+=20) {
! snprintf(tmp,80,"%5.2f",value);
! drawStringHCentered(tmp,parent->getX()-15,parent->getY()+i);
value += 2*delta;
}
--- 145,154 ----
value = min;
for(i=0;i<=length;i+=20) {
! snprintf(tmp,80,"%g",value);
! tickFont->setVerticalJustification(OGLFT::Face::MIDDLE);
! tickFont->setHorizontalJustification(OGLFT::Face::RIGHT);
! tickFont->draw( parent->getX()-hashLength-5,
! parent->getY()+i,
! tmp );
value += 2*delta;
}
***************
*** 163,172 ****
titleFont->setStringRotation(-90);
#endif
! titleFont->draw(float(parent->getX())-20,float(parent->getY()+length/2),
! tmps.c_str() );
titleFont->setStringRotation(0);
} else {
! titleFont->draw(float(parent->getX()+length/2),float(parent->getY()-15),
! tmps.c_str() );
}
--- 172,183 ----
titleFont->setStringRotation(-90);
#endif
! titleFont->draw(float(parent->getX())-20,
! float(parent->getY()+length/2),
! tmps.c_str() );
titleFont->setStringRotation(0);
} else {
! titleFont->draw(float(parent->getX()+length/2),
! float(parent->getY()-15),
! tmps.c_str() );
}
***************
*** 174,188 ****
return true;
}
!
!
! void Axis::drawStringWCentered(string msg, float x, float y) {
! tickFont->setHorizontalJustification(OGLFT::Face::CENTER);
! tickFont->draw( x,y,msg.c_str() );
! }
!
! void Axis::drawStringHCentered(string msg, float x, float y) {
! tickFont->setVerticalJustification(OGLFT::Face::MIDDLE);
! tickFont->draw( x,y,msg.c_str() );
! }
!
!
--- 185,187 ----
return true;
}
!
Index: Axis.h
===================================================================
RCS file: /cvsroot/thplot/thplot/src/Draw/Axis.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** Axis.h 2 Jul 2002 17:20:42 -0000 1.3
--- Axis.h 3 Jul 2002 13:23:40 -0000 1.4
***************
*** 72,78 ****
int fntPointSize;
- void drawStringWCentered(string msg, float x, float y);
- void drawStringHCentered(string msg, float x, float y);
-
};
--- 72,75 ----
|