diff options
author | joye <joye> | 2014-05-09 19:21:02 (GMT) |
---|---|---|
committer | joye <joye> | 2014-05-09 19:21:02 (GMT) |
commit | 563ae5d011adf48ad1a991130e2f527871268c18 (patch) | |
tree | 81083ee4929fafcfb403342e8dbce72da02882e5 | |
parent | c6a39554f96cc7c7eefdeec8680d497f3dda41b3 (diff) | |
download | blt-563ae5d011adf48ad1a991130e2f527871268c18.zip blt-563ae5d011adf48ad1a991130e2f527871268c18.tar.gz blt-563ae5d011adf48ad1a991130e2f527871268c18.tar.bz2 |
*** empty log message ***
-rw-r--r-- | src/bltGrElemBar.C | 5 | ||||
-rw-r--r-- | src/bltGraphBar.C | 43 | ||||
-rw-r--r-- | src/bltGraphBar.h | 45 |
3 files changed, 33 insertions, 60 deletions
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C index ef834f1..66ee436 100644 --- a/src/bltGrElemBar.C +++ b/src/bltGrElemBar.C @@ -295,7 +295,10 @@ void BarElement::map() ((BarGraph::BarMode)gops->barMode != BarGraph::INFRONT) && (!gops->stackAxes)) { - BarSetKey key((float)x[ii], ops->xAxis, NULL); + BarSetKey key; + key.value =float(x[ii]); + key.xAxis =ops->xAxis; + key.yAxis =NULL; Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&barGraphPtr_->setTable_, (char *)&key); diff --git a/src/bltGraphBar.C b/src/bltGraphBar.C index b94aaae..18ab9ff 100644 --- a/src/bltGraphBar.C +++ b/src/bltGraphBar.C @@ -60,22 +60,6 @@ BarGroup::BarGroup() index =0; } -// BarSetKey - -BarSetKey::BarSetKey() -{ - value =0; - xAxis =NULL; - yAxis =NULL; -} - -BarSetKey::BarSetKey(float vv, Axis* xx, Axis* yy) -{ - value =vv; - xAxis =xx; - yAxis =yy; -} - // BarGraph static const char* barmodeObjOption[] = @@ -370,7 +354,6 @@ void BarGraph::initBarSets() if ((BarMode)ops->barMode == INFRONT) return; - // cerr << "a" << endl; // Initialize a hash table and fill it with unique abscissas. Keep track // of the frequency of each x-coordinate and how many abscissas have // duplicate mappings. @@ -384,19 +367,19 @@ void BarGraph::initBarSets() if (ops->hide) continue; - // cerr << " b" << endl; nSegs++; if (ops->coords.x) { int nPoints = ops->coords.x->nValues; double *x, *xend; - // cerr << " c" << endl; for (x = ops->coords.x->values, xend = x + nPoints; x < xend; x++) { - BarSetKey key(*x, ops->xAxis, NULL); + BarSetKey key; + key.value =*x; + key.xAxis =ops->xAxis; + key.yAxis =NULL; int isNew; Tcl_HashEntry* hPtr = - Tcl_CreateHashEntry(&setTable, (char *)&key, &isNew); + Tcl_CreateHashEntry(&setTable, (char*)&key, &isNew); - // cerr << " d" << endl; Tcl_HashTable* tablePtr; if (isNew) { tablePtr = (Tcl_HashTable*)malloc(sizeof(Tcl_HashTable)); @@ -421,18 +404,14 @@ void BarGraph::initBarSets() } } - // cerr << "e" << endl; if (setTable.numEntries == 0) return; - //cerr << "f" << endl; int sum =0; int max =0; Tcl_HashSearch iter; for (Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(&setTable, &iter); hPtr; hPtr = Tcl_NextHashEntry(&iter)) { - //cerr << " g" << endl; - BarSetKey* keyPtr = (BarSetKey*)Tcl_GetHashKey(&setTable, hPtr); int isNew; Tcl_HashEntry* hPtr2 = @@ -445,15 +424,12 @@ void BarGraph::initBarSets() } Tcl_DeleteHashTable(&setTable); - // cerr << "h" << endl; if (sum > 0) { - // cerr << " i" << endl; barGroups_ = new BarGroup[sum]; BarGroup* groupPtr = barGroups_; Tcl_HashSearch iter; for (Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(&setTable_, &iter); hPtr; hPtr = Tcl_NextHashEntry(&iter)) { - //cerr << " j" << endl; Tcl_HashTable *tablePtr = (Tcl_HashTable*)Tcl_GetHashValue(hPtr); BarSetKey* keyPtr = (BarSetKey*)Tcl_GetHashKey(&setTable, hPtr); size_t xcount = 0; @@ -461,7 +437,6 @@ void BarGraph::initBarSets() for (Tcl_HashEntry *hPtr2 = Tcl_FirstHashEntry(tablePtr, &iter2); hPtr2; hPtr2 = Tcl_NextHashEntry(&iter2)) { size_t count = (size_t)Tcl_GetHashValue(hPtr2); - //cerr << " k" << endl; groupPtr->nSegments = count; groupPtr->xAxis = keyPtr->xAxis; groupPtr->yAxis = keyPtr->yAxis; @@ -537,10 +512,10 @@ void BarGraph::computeBarStacks() for (x = ops->coords.x->values, y = ops->coords.y->values, xend = x + ops->coords.x->nValues; x < xend; x++, y++) { BarSetKey key; - key.value = *x; - key.xAxis = ops->xAxis; - key.yAxis = NULL; - Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&setTable_, (char *)&key); + key.value =*x; + key.xAxis =ops->xAxis; + key.yAxis =NULL; + Tcl_HashEntry *hPtr = Tcl_FindHashEntry(&setTable_, (char*)&key); if (!hPtr) continue; diff --git a/src/bltGraphBar.h b/src/bltGraphBar.h index 51b0d5f..0176c95 100644 --- a/src/bltGraphBar.h +++ b/src/bltGraphBar.h @@ -35,6 +35,26 @@ #include "bltGraph.h" typedef struct { + float value; + Axis* xAxis; + Axis* yAxis; +} BarSetKey; + +class BarGroup { + public: + int nSegments; + Axis* xAxis; + Axis* yAxis; + float sum; + int count; + float lastY; + size_t index; + + public: + BarGroup(); +}; + +typedef struct { double aspect; Tk_3DBorder normalBg; int borderWidth; @@ -68,31 +88,6 @@ typedef struct { double baseline; } BarGraphOptions; -class BarGroup { - public: - int nSegments; - Axis* xAxis; - Axis* yAxis; - float sum; - int count; - float lastY; - size_t index; - - public: - BarGroup(); -}; - -class BarSetKey { - public: - float value; - Axis* xAxis; - Axis* yAxis; - - public: - BarSetKey(); - BarSetKey(float, Axis*, Axis*); -}; - class BarGraph : public Graph { public: enum BarMode {INFRONT, STACKED, ALIGNED, OVERLAP}; |