summaryrefslogtreecommitdiffstats
path: root/src/bltGraphSup.C
diff options
context:
space:
mode:
authorjoye <joye>2014-05-13 18:48:01 (GMT)
committerjoye <joye>2014-05-13 18:48:01 (GMT)
commit30be691f5613c6b4e122cf76e20fa3e941661061 (patch)
tree7fafbd122968c9763afdb5df42203a7ccedb6f7a /src/bltGraphSup.C
parent59ef8a1dd8a00a30daaad77422d99bce631c9051 (diff)
downloadblt-30be691f5613c6b4e122cf76e20fa3e941661061.zip
blt-30be691f5613c6b4e122cf76e20fa3e941661061.tar.gz
blt-30be691f5613c6b4e122cf76e20fa3e941661061.tar.bz2
*** empty log message ***
Diffstat (limited to 'src/bltGraphSup.C')
-rw-r--r--src/bltGraphSup.C103
1 files changed, 2 insertions, 101 deletions
diff --git a/src/bltGraphSup.C b/src/bltGraphSup.C
index 34bc4ad..9ea0df7 100644
--- a/src/bltGraphSup.C
+++ b/src/bltGraphSup.C
@@ -426,7 +426,7 @@ int Graph::getMarginGeometry(Margin *marginPtr)
if (!ops->hide && axisPtr->use_) {
nVisible++;
if (flags & GET_AXIS_GEOMETRY)
- getAxisGeometry(axisPtr);
+ axisPtr->getGeometry();
if (isHoriz) {
if (h < axisPtr->height_)
@@ -452,7 +452,7 @@ int Graph::getMarginGeometry(Margin *marginPtr)
if (!ops->hide && axisPtr->use_) {
nVisible++;
if (flags & GET_AXIS_GEOMETRY)
- getAxisGeometry(axisPtr);
+ axisPtr->getGeometry();
if ((ops->titleAlternate) && (l < axisPtr->titleWidth_))
l = axisPtr->titleWidth_;
@@ -485,105 +485,6 @@ int Graph::getMarginGeometry(Margin *marginPtr)
return marginPtr->axesOffset;
}
-void Graph::getAxisGeometry(Axis *axisPtr)
-{
- GraphOptions* ops = (GraphOptions*)ops_;
- AxisOptions* aops = (AxisOptions*)axisPtr->ops();
- axisPtr->freeTickLabels();
-
- // Leave room for axis baseline and padding
- unsigned int y =0;
- if (aops->exterior && (ops->plotRelief != TK_RELIEF_SOLID))
- y += aops->lineWidth + 2;
-
- axisPtr->maxTickHeight_ = axisPtr->maxTickWidth_ = 0;
-
- if (axisPtr->t1Ptr_)
- free(axisPtr->t1Ptr_);
- axisPtr->t1Ptr_ = axisPtr->generateTicks(&axisPtr->majorSweep_);
- if (axisPtr->t2Ptr_)
- free(axisPtr->t2Ptr_);
- axisPtr->t2Ptr_ = axisPtr->generateTicks(&axisPtr->minorSweep_);
-
- if (aops->showTicks) {
- Ticks* t1Ptr = aops->t1UPtr ? aops->t1UPtr : axisPtr->t1Ptr_;
-
- int nTicks =0;
- if (t1Ptr)
- nTicks = t1Ptr->nTicks;
-
- unsigned int nLabels =0;
- for (int ii=0; ii<nTicks; ii++) {
- double x = t1Ptr->values[ii];
- double x2 = t1Ptr->values[ii];
- if (aops->labelOffset)
- x2 += axisPtr->majorSweep_.step * 0.5;
-
- if (!axisPtr->inRange(x2, &axisPtr->axisRange_))
- continue;
-
- TickLabel* labelPtr = axisPtr->makeLabel(x);
- Blt_Chain_Append(axisPtr->tickLabels_, labelPtr);
- nLabels++;
-
- // Get the dimensions of each tick label. Remember tick labels
- // can be multi-lined and/or rotated.
- int lw, lh;
- getTextExtents(aops->tickFont, labelPtr->string, -1, &lw, &lh);
- labelPtr->width = lw;
- labelPtr->height = lh;
-
- if (aops->tickAngle != 0.0f) {
- // Rotated label width and height
- double rlw, rlh;
- getBoundingBox(lw, lh, aops->tickAngle, &rlw, &rlh, NULL);
- lw = rlw;
- lh = rlh;
- }
- if (axisPtr->maxTickWidth_ < int(lw))
- axisPtr->maxTickWidth_ = lw;
-
- if (axisPtr->maxTickHeight_ < int(lh))
- axisPtr->maxTickHeight_ = lh;
- }
-
- unsigned int pad =0;
- if (aops->exterior) {
- // Because the axis cap style is "CapProjecting", we need to
- // account for an extra 1.5 linewidth at the end of each line
- pad = ((aops->lineWidth * 12) / 8);
- }
- if (axisPtr->isHorizontal())
- y += axisPtr->maxTickHeight_ + pad;
- else {
- y += axisPtr->maxTickWidth_ + pad;
- if (axisPtr->maxTickWidth_ > 0)
- // Pad either size of label.
- y += 5;
- }
- y += 2 * AXIS_PAD_TITLE;
- if ((aops->lineWidth > 0) && aops->exterior)
- // Distance from axis line to tick label.
- y += aops->tickLength;
-
- } // showTicks
-
- if (aops->title) {
- if (aops->titleAlternate) {
- if (y < axisPtr->titleHeight_)
- y = axisPtr->titleHeight_;
- }
- else
- y += axisPtr->titleHeight_ + AXIS_PAD_TITLE;
- }
-
- // Correct for orientation of the axis
- if (axisPtr->isHorizontal())
- axisPtr->height_ = y;
- else
- axisPtr->width_ = y;
-}
-
void Graph::getTextExtents(Tk_Font font, const char *text, int textLen,
int* ww, int* hh)
{