summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-07-07 19:55:41 (GMT)
committerjoye <joye>2014-07-07 19:55:41 (GMT)
commite7bbaae2886273957dee0ed6aa8af4571791a772 (patch)
treeffe0bb1a1a7b85f0f9dcbcfdba6ed5312ce56f64 /src
parentbb2ce35d03eeec373740bc66fdd07bc727dc65be (diff)
downloadblt-e7bbaae2886273957dee0ed6aa8af4571791a772.zip
blt-e7bbaae2886273957dee0ed6aa8af4571791a772.tar.gz
blt-e7bbaae2886273957dee0ed6aa8af4571791a772.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElem.C4
-rw-r--r--src/bltGrElem.h7
-rw-r--r--src/bltGrElemBar.C48
-rw-r--r--src/bltGrElemLine.C48
-rw-r--r--src/bltGrElemOption.C4
-rw-r--r--src/bltGraphBar.C4
6 files changed, 58 insertions, 57 deletions
diff --git a/src/bltGrElem.C b/src/bltGrElem.C
index 9981d4b..783002b 100644
--- a/src/bltGrElem.C
+++ b/src/bltGrElem.C
@@ -214,7 +214,7 @@ double Element::FindElemValuesMinimum(ElemValues* valuesPtr, double minLimit)
if (!valuesPtr)
return min;
- for (int ii=0; ii<valuesPtr->nValues_; ii++) {
+ for (int ii=0; ii<valuesPtr->nValues(); ii++) {
double x = valuesPtr->values_[ii];
// What do you do about negative values when using log
// scale values seems like a grey area. Mirror.
@@ -234,7 +234,7 @@ PenStyle** Element::StyleMap()
ElementOptions* ops = (ElementOptions*)ops_;
int nPoints = NUMBEROFPOINTS(ops);
- int nWeights = MIN(ops->w ? ops->w->nValues_ : 0, nPoints);
+ int nWeights = MIN(ops->w ? ops->w->nValues() : 0, nPoints);
double* w = ops->w ? ops->w->values_ : NULL;
Blt_ChainLink link = Blt_Chain_FirstLink(ops->stylePalette);
PenStyle* stylePtr = (PenStyle*)Blt_Chain_GetValue(link);
diff --git a/src/bltGrElem.h b/src/bltGrElem.h
index 00567de..3263000 100644
--- a/src/bltGrElem.h
+++ b/src/bltGrElem.h
@@ -47,8 +47,8 @@ extern "C" {
#define SHOW_BOTH 3
#define MIN(a,b) (((a)<(b))?(a):(b))
-#define NUMBEROFPOINTS(e) MIN( (e)->coords.x ? (e)->coords.x->nValues_ : 0, \
- (e)->coords.y ? (e)->coords.y->nValues_ : 0 )
+#define NUMBEROFPOINTS(e) MIN( (e)->coords.x ? (e)->coords.x->nValues() : 0, \
+ (e)->coords.y ? (e)->coords.y->nValues() : 0 )
#define NORMALPEN(e) ((((e)->normalPenPtr == NULL) ? \
(e)->builtinPenPtr : (e)->normalPenPtr))
@@ -62,16 +62,17 @@ namespace Blt {
protected:
double min_;
double max_;
+ int nValues_;
public:
double* values_;
- int nValues_;
public:
ElemValues();
virtual ~ElemValues();
void reset();
+ int nValues() {return nValues_;}
double min() {return min_;}
double max() {return max_;}
};
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index 33d9e86..2e28ed7 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -255,7 +255,7 @@ void BarElement::map()
reset();
if (!ops->coords.x || !ops->coords.y ||
- !ops->coords.x->nValues_ || !ops->coords.y->nValues_)
+ !ops->coords.x->nValues() || !ops->coords.y->nValues())
return;
int nPoints = NUMBEROFPOINTS(ops);
@@ -456,12 +456,12 @@ void BarElement::map()
}
BarStyle** dataToStyle = (BarStyle**)StyleMap();
- if (((ops->yHigh && ops->yHigh->nValues_ > 0) &&
- (ops->yLow && ops->yLow->nValues_ > 0)) ||
- ((ops->xHigh && ops->xHigh->nValues_ > 0) &&
- (ops->xLow && ops->xLow->nValues_ > 0)) ||
- (ops->xError && ops->xError->nValues_ > 0) ||
- (ops->yError && ops->yError->nValues_ > 0)) {
+ if (((ops->yHigh && ops->yHigh->nValues() > 0) &&
+ (ops->yLow && ops->yLow->nValues() > 0)) ||
+ ((ops->xHigh && ops->xHigh->nValues() > 0) &&
+ (ops->xLow && ops->xLow->nValues() > 0)) ||
+ (ops->xError && ops->xError->nValues() > 0) ||
+ (ops->yError && ops->yError->nValues() > 0)) {
mapErrorBars(dataToStyle);
}
@@ -479,7 +479,7 @@ void BarElement::extents(Region2d *regPtr)
regPtr->bottom = regPtr->right = -DBL_MAX;
if (!ops->coords.x || !ops->coords.y ||
- !ops->coords.x->nValues_ || !ops->coords.y->nValues_)
+ !ops->coords.x->nValues() || !ops->coords.y->nValues())
return;
int nPoints = NUMBEROFPOINTS(ops);
@@ -520,8 +520,8 @@ void BarElement::extents(Region2d *regPtr)
}
// Correct the extents for error bars if they exist
- if (ops->xError && (ops->xError->nValues_ > 0)) {
- nPoints = MIN(ops->xError->nValues_, nPoints);
+ if (ops->xError && (ops->xError->nValues() > 0)) {
+ nPoints = MIN(ops->xError->nValues(), nPoints);
for (int ii=0; ii<nPoints; ii++) {
double x = ops->coords.x->values_[ii] + ops->xError->values_[ii];
if (x > regPtr->right)
@@ -543,11 +543,11 @@ void BarElement::extents(Region2d *regPtr)
}
else {
if ((ops->xHigh) &&
- (ops->xHigh->nValues_ > 0) &&
+ (ops->xHigh->nValues() > 0) &&
(ops->xHigh->max() > regPtr->right))
regPtr->right = ops->xHigh->max();
- if (ops->xLow && (ops->xLow->nValues_ > 0)) {
+ if (ops->xLow && (ops->xLow->nValues() > 0)) {
double left;
if ((ops->xLow->min() <= 0.0) && (axisxops->logScale))
left = FindElemValuesMinimum(ops->xLow, DBL_MIN);
@@ -559,8 +559,8 @@ void BarElement::extents(Region2d *regPtr)
}
}
- if (ops->yError && (ops->yError->nValues_ > 0)) {
- nPoints = MIN(ops->yError->nValues_, nPoints);
+ if (ops->yError && (ops->yError->nValues() > 0)) {
+ nPoints = MIN(ops->yError->nValues(), nPoints);
for (int ii=0; ii<nPoints; ii++) {
double y = ops->coords.y->values_[ii] + ops->yError->values_[ii];
@@ -583,11 +583,11 @@ void BarElement::extents(Region2d *regPtr)
}
else {
if ((ops->yHigh) &&
- (ops->yHigh->nValues_ > 0) &&
+ (ops->yHigh->nValues() > 0) &&
(ops->yHigh->max() > regPtr->bottom))
regPtr->bottom = ops->yHigh->max();
- if (ops->yLow && ops->yLow->nValues_ > 0) {
+ if (ops->yLow && ops->yLow->nValues() > 0) {
double top;
if ((ops->yLow->min() <= 0.0) &&
(axisyops->logScale))
@@ -1050,11 +1050,11 @@ void BarElement::mapErrorBars(BarStyle **dataToStyle)
int nPoints = NUMBEROFPOINTS(ops);
int nn =0;
if (ops->coords.x && ops->coords.y) {
- if (ops->xError && (ops->xError->nValues_ > 0))
- nn = MIN(ops->xError->nValues_, nPoints);
+ if (ops->xError && (ops->xError->nValues() > 0))
+ nn = MIN(ops->xError->nValues(), nPoints);
else
if (ops->xHigh && ops->xLow)
- nn = MIN3(ops->xHigh->nValues_, ops->xLow->nValues_, nPoints);
+ nn = MIN3(ops->xHigh->nValues(), ops->xLow->nValues(), nPoints);
}
if (nn) {
@@ -1070,7 +1070,7 @@ void BarElement::mapErrorBars(BarStyle **dataToStyle)
if ((isfinite(x)) && (isfinite(y))) {
double high, low;
- if (ops->xError->nValues_ > 0) {
+ if (ops->xError->nValues() > 0) {
high = x + ops->xError->values_[ii];
low = x - ops->xError->values_[ii];
}
@@ -1115,11 +1115,11 @@ void BarElement::mapErrorBars(BarStyle **dataToStyle)
nn =0;
if (ops->coords.x && ops->coords.y) {
- if (ops->yError && (ops->yError->nValues_ > 0))
- nn = MIN(ops->yError->nValues_, nPoints);
+ if (ops->yError && (ops->yError->nValues() > 0))
+ nn = MIN(ops->yError->nValues(), nPoints);
else
if (ops->yHigh && ops->yLow)
- nn = MIN3(ops->yHigh->nValues_, ops->yLow->nValues_, nPoints);
+ nn = MIN3(ops->yHigh->nValues(), ops->yLow->nValues(), nPoints);
}
if (nn) {
@@ -1135,7 +1135,7 @@ void BarElement::mapErrorBars(BarStyle **dataToStyle)
if ((isfinite(x)) && (isfinite(y))) {
double high, low;
- if (ops->yError->nValues_ > 0) {
+ if (ops->yError->nValues() > 0) {
high = y + ops->yError->values_[ii];
low = y - ops->yError->values_[ii];
}
diff --git a/src/bltGrElemLine.C b/src/bltGrElemLine.C
index 0610adb..d62b45a 100644
--- a/src/bltGrElemLine.C
+++ b/src/bltGrElemLine.C
@@ -308,7 +308,7 @@ void LineElement::map()
reset();
if (!ops->coords.x || !ops->coords.y ||
- !ops->coords.x->nValues_ || !ops->coords.y->nValues_)
+ !ops->coords.x->nValues() || !ops->coords.y->nValues())
return;
int np = NUMBEROFPOINTS(ops);
@@ -373,12 +373,12 @@ void LineElement::map()
}
LineStyle** styleMap = (LineStyle**)StyleMap();
- if (((ops->yHigh && ops->yHigh->nValues_ > 0) &&
- (ops->yLow && ops->yLow->nValues_ > 0)) ||
- ((ops->xHigh && ops->xHigh->nValues_ > 0) &&
- (ops->xLow && ops->xLow->nValues_ > 0)) ||
- (ops->xError && ops->xError->nValues_ > 0) ||
- (ops->yError && ops->yError->nValues_ > 0)) {
+ if (((ops->yHigh && ops->yHigh->nValues() > 0) &&
+ (ops->yLow && ops->yLow->nValues() > 0)) ||
+ ((ops->xHigh && ops->xHigh->nValues() > 0) &&
+ (ops->xLow && ops->xLow->nValues() > 0)) ||
+ (ops->xError && ops->xError->nValues() > 0) ||
+ (ops->yError && ops->yError->nValues() > 0)) {
mapErrorBars(styleMap);
}
@@ -394,7 +394,7 @@ void LineElement::extents(Region2d *extsPtr)
extsPtr->bottom = extsPtr->right = -DBL_MAX;
if (!ops->coords.x || !ops->coords.y ||
- !ops->coords.x->nValues_ || !ops->coords.y->nValues_)
+ !ops->coords.x->nValues() || !ops->coords.y->nValues())
return;
int np = NUMBEROFPOINTS(ops);
@@ -413,8 +413,8 @@ void LineElement::extents(Region2d *extsPtr)
extsPtr->top = ops->coords.y->min();
// Correct the data limits for error bars
- if (ops->xError && ops->xError->nValues_ > 0) {
- np = MIN(ops->xError->nValues_, np);
+ if (ops->xError && ops->xError->nValues() > 0) {
+ np = MIN(ops->xError->nValues(), np);
for (int ii=0; ii<np; ii++) {
double x = ops->coords.x->values_[ii] + ops->xError->values_[ii];
if (x > extsPtr->right)
@@ -435,11 +435,11 @@ void LineElement::extents(Region2d *extsPtr)
}
else {
if (ops->xHigh &&
- (ops->xHigh->nValues_ > 0) &&
+ (ops->xHigh->nValues() > 0) &&
(ops->xHigh->max() > extsPtr->right)) {
extsPtr->right = ops->xHigh->max();
}
- if (ops->xLow && ops->xLow->nValues_ > 0) {
+ if (ops->xLow && ops->xLow->nValues() > 0) {
double left;
if ((ops->xLow->min() <= 0.0) && (axisxops->logScale))
left = FindElemValuesMinimum(ops->xLow, DBL_MIN);
@@ -451,8 +451,8 @@ void LineElement::extents(Region2d *extsPtr)
}
}
- if (ops->yError && ops->yError->nValues_ > 0) {
- np = MIN(ops->yError->nValues_, np);
+ if (ops->yError && ops->yError->nValues() > 0) {
+ np = MIN(ops->yError->nValues(), np);
for (int ii=0; ii<np; ii++) {
double y = ops->coords.y->values_[ii] + ops->yError->values_[ii];
if (y > extsPtr->bottom)
@@ -472,11 +472,11 @@ void LineElement::extents(Region2d *extsPtr)
}
}
else {
- if (ops->yHigh && (ops->yHigh->nValues_ > 0) &&
+ if (ops->yHigh && (ops->yHigh->nValues() > 0) &&
(ops->yHigh->max() > extsPtr->bottom))
extsPtr->bottom = ops->yHigh->max();
- if (ops->yLow && ops->yLow->nValues_ > 0) {
+ if (ops->yLow && ops->yLow->nValues() > 0) {
double top;
if ((ops->yLow->min() <= 0.0) && (axisyops->logScale))
top = FindElemValuesMinimum(ops->yLow, DBL_MIN);
@@ -1738,11 +1738,11 @@ void LineElement::mapErrorBars(LineStyle **styleMap)
int nn =0;
int np = NUMBEROFPOINTS(ops);
if (ops->coords.x && ops->coords.y) {
- if (ops->xError && (ops->xError->nValues_ > 0))
- nn = MIN(ops->xError->nValues_, np);
+ if (ops->xError && (ops->xError->nValues() > 0))
+ nn = MIN(ops->xError->nValues(), np);
else
if (ops->xHigh && ops->xLow)
- nn = MIN3(ops->xHigh->nValues_, ops->xLow->nValues_, np);
+ nn = MIN3(ops->xHigh->nValues(), ops->xLow->nValues(), np);
}
if (nn) {
@@ -1759,7 +1759,7 @@ void LineElement::mapErrorBars(LineStyle **styleMap)
if ((isfinite(x)) && (isfinite(y))) {
double high;
double low;
- if (ops->xError->nValues_ > 0) {
+ if (ops->xError->nValues() > 0) {
high = x + ops->xError->values_[ii];
low = x - ops->xError->values_[ii];
}
@@ -1805,11 +1805,11 @@ void LineElement::mapErrorBars(LineStyle **styleMap)
nn =0;
if (ops->coords.x && ops->coords.y) {
- if (ops->yError && (ops->yError->nValues_ > 0))
- nn = MIN(ops->yError->nValues_, np);
+ if (ops->yError && (ops->yError->nValues() > 0))
+ nn = MIN(ops->yError->nValues(), np);
else
if (ops->yHigh && ops->yLow)
- nn = MIN3(ops->yHigh->nValues_, ops->yLow->nValues_, np);
+ nn = MIN3(ops->yHigh->nValues(), ops->yLow->nValues(), np);
}
if (nn) {
@@ -1826,7 +1826,7 @@ void LineElement::mapErrorBars(LineStyle **styleMap)
if ((isfinite(x)) && (isfinite(y))) {
double high;
double low;
- if (ops->yError->nValues_ > 0) {
+ if (ops->yError->nValues() > 0) {
high = y + ops->yError->values_[ii];
low = y - ops->yError->values_[ii];
}
diff --git a/src/bltGrElemOption.C b/src/bltGrElemOption.C
index 73a6a44..f5bf8b1 100644
--- a/src/bltGrElemOption.C
+++ b/src/bltGrElemOption.C
@@ -280,7 +280,7 @@ Tcl_Obj* StyleGetProc(ClientData clientData, Tk_Window tkwin,
if (!cnt)
return Tcl_NewListObj(0, (Tcl_Obj**)NULL);
- Tcl_Obj** ll = (Tcl_Obj**)calloc(3*cnt, sizeof(Tcl_Obj*));
+ Tcl_Obj** ll = new Tcl_Obj*[3*cnt];
int ii=0;
for (Blt_ChainLink link = Blt_Chain_FirstLink(stylePalette); !link;
link = Blt_Chain_NextLink(link)) {
@@ -290,7 +290,7 @@ Tcl_Obj* StyleGetProc(ClientData clientData, Tk_Window tkwin,
ll[ii++] = Tcl_NewDoubleObj(stylePtr->weight.max);
}
Tcl_Obj *listObjPtr = Tcl_NewListObj(3*cnt,ll);
- free(ll);
+ delete [] ll;
return listObjPtr;
}
diff --git a/src/bltGraphBar.C b/src/bltGraphBar.C
index ab1121c..f1ab5cb 100644
--- a/src/bltGraphBar.C
+++ b/src/bltGraphBar.C
@@ -334,7 +334,7 @@ void BarGraph::initBarSets()
nSegs++;
if (ops->coords.x) {
- int nPoints = ops->coords.x->nValues_;
+ int nPoints = ops->coords.x->nValues();
double *x, *xend;
for (x = ops->coords.x->values_, xend = x + nPoints; x < xend; x++) {
BarSetKey key;
@@ -472,7 +472,7 @@ void BarGraph::computeBarStacks()
if (ops->coords.x && ops->coords.y) {
double *x, *y, *xend;
for (x = ops->coords.x->values_, y = ops->coords.y->values_,
- xend = x + ops->coords.x->nValues_; x < xend; x++, y++) {
+ xend = x + ops->coords.x->nValues(); x < xend; x++, y++) {
BarSetKey key;
key.value =*x;
key.xAxis =ops->xAxis;