summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjoye <joye>2014-05-09 18:46:18 (GMT)
committerjoye <joye>2014-05-09 18:46:18 (GMT)
commitc6a39554f96cc7c7eefdeec8680d497f3dda41b3 (patch)
treeca490380da5842620bc6ffb10c86d5bdd5a0d4ac
parent85dddc1d5127b24132fc3561081c9024e1eb8c52 (diff)
downloadblt-c6a39554f96cc7c7eefdeec8680d497f3dda41b3.zip
blt-c6a39554f96cc7c7eefdeec8680d497f3dda41b3.tar.gz
blt-c6a39554f96cc7c7eefdeec8680d497f3dda41b3.tar.bz2
*** empty log message ***
-rw-r--r--src/bltGrElemBar.C34
-rw-r--r--src/bltGrElemBar.h2
-rw-r--r--src/bltGraph.C4
-rw-r--r--src/bltGraphBar.C39
-rw-r--r--src/bltGraphBar.h4
5 files changed, 49 insertions, 34 deletions
diff --git a/src/bltGrElemBar.C b/src/bltGrElemBar.C
index 75a01d9..ef834f1 100644
--- a/src/bltGrElemBar.C
+++ b/src/bltGrElemBar.C
@@ -245,6 +245,7 @@ int BarElement::configure()
void BarElement::map()
{
+ cerr << "BarElement::map()" << endl;
BarGraph* barGraphPtr_ = (BarGraph*)graphPtr_;
BarElementOptions* ops = (BarElementOptions*)ops_;
BarGraphOptions* gops = (BarGraphOptions*)graphPtr_->ops_;
@@ -272,18 +273,19 @@ void BarElement::map()
double* y = ops->coords.y->values;
int count = 0;
- int i;
+ int ii;
XRectangle *rp;
- for (rp = bars, i = 0; i < nPoints; i++) {
- Point2d c1, c2; /* Two opposite corners of the rectangle
- * in graph coordinates. */
- if (((x[i] - barWidth) > ops->xAxis->axisRange_.max) ||
- ((x[i] + barWidth) < ops->xAxis->axisRange_.min)) {
- continue; /* Abscissa is out of range of the
- * x-axis */
- }
- c1.x = x[i] - barOffset;
- c1.y = y[i];
+ for (rp=bars, ii=0; ii<nPoints; ii++) {
+ // Two opposite corners of the rectangle in graph coordinates
+ Point2d c1, c2;
+
+ // check Abscissa is out of range of the x-axis
+ if (((x[ii] - barWidth) > ops->xAxis->axisRange_.max) ||
+ ((x[ii] + barWidth) < ops->xAxis->axisRange_.min))
+ continue;
+
+ c1.x = x[ii] - barOffset;
+ c1.y = y[ii];
c2.x = c1.x + barWidth;
c2.y = baseline;
@@ -293,14 +295,14 @@ void BarElement::map()
((BarGraph::BarMode)gops->barMode != BarGraph::INFRONT) &&
(!gops->stackAxes)) {
- BarSetKey key((float)x[i], ops->xAxis, NULL);
+ BarSetKey key((float)x[ii], ops->xAxis, NULL);
Tcl_HashEntry *hPtr =
Tcl_FindHashEntry(&barGraphPtr_->setTable_, (char *)&key);
if (hPtr) {
+ cerr << " found " << ii << endl;
Tcl_HashTable *tablePtr = (Tcl_HashTable*)Tcl_GetHashValue(hPtr);
- const char *name = (ops->groupName) ?
- ops->groupName : ops->yAxis->name_;
+ const char *name = (ops->groupName) ? ops->groupName:ops->yAxis->name_;
hPtr = Tcl_FindHashEntry(tablePtr, name);
if (hPtr) {
BarGroup* groupPtr = (BarGroup*)Tcl_GetHashValue(hPtr);
@@ -427,7 +429,7 @@ void BarElement::map()
rp->height = 1;
// Save the data index corresponding to the rectangle
- barToData[count] = i;
+ barToData[count] = ii;
count++;
rp++;
}
@@ -670,7 +672,7 @@ void BarElement::draw(Drawable drawable)
for (Blt_ChainLink link = Blt_Chain_FirstLink(ops->stylePalette); link;
link = Blt_Chain_NextLink(link)) {
- BarStyle *stylePtr = (BarStyle*)Blt_Chain_GetValue(link);
+ BarStyle* stylePtr = (BarStyle*)Blt_Chain_GetValue(link);
BarPen* penPtr = (BarPen*)stylePtr->penPtr;
BarPenOptions* pops = (BarPenOptions*)penPtr->ops();
diff --git a/src/bltGrElemBar.h b/src/bltGrElemBar.h
index 001fb12..92ff66b 100644
--- a/src/bltGrElemBar.h
+++ b/src/bltGrElemBar.h
@@ -48,7 +48,7 @@ typedef struct {
typedef struct {
Weight weight;
BarPen* penPtr;
- XRectangle *bars;
+ XRectangle* bars;
int nBars;
GraphSegments xeb;
GraphSegments yeb;
diff --git a/src/bltGraph.C b/src/bltGraph.C
index 3a3a740..72a7d34 100644
--- a/src/bltGraph.C
+++ b/src/bltGraph.C
@@ -218,7 +218,7 @@ void Graph::configure()
void Graph::map()
{
- // cerr << "Graph::map()" << endl;
+ cerr << "Graph::map()" << endl;
if (flags & RESET_AXES)
resetAxes();
@@ -239,7 +239,7 @@ void Graph::map()
void Graph::draw()
{
- // cerr << "Graph::draw()" << endl;
+ cerr << "Graph::draw()" << endl;
GraphOptions* ops = (GraphOptions*)ops_;
flags &= ~REDRAW_PENDING;
diff --git a/src/bltGraphBar.C b/src/bltGraphBar.C
index 3992191..b94aaae 100644
--- a/src/bltGraphBar.C
+++ b/src/bltGraphBar.C
@@ -338,7 +338,7 @@ void BarGraph::mapElements()
{
BarGraphOptions* ops = (BarGraphOptions*)ops_;
if ((BarMode)ops->barMode != INFRONT)
- resetBarGroups();
+ resetBarSets();
Graph::mapElements();
}
@@ -352,16 +352,16 @@ void BarGraph::resetAxes()
* indicate that the element display list has changed.
* Needs to be done before the axis limits are set.
*/
- initBarSetTable();
+ initBarSets();
if (((BarMode)ops->barMode == STACKED) && (nBarGroups_ > 0))
computeBarStacks();
Graph::resetAxes();
}
-void BarGraph::initBarSetTable()
+void BarGraph::initBarSets()
{
- // cerr << "BarGraph::initBarSetTable()" << endl;
+ cerr << "BarGraph::initBarSets()" << endl;
BarGraphOptions* ops = (BarGraphOptions*)ops_;
// Free resources associated with a previous frequency table. This includes
@@ -369,8 +369,8 @@ void BarGraph::initBarSetTable()
destroyBarSets();
if ((BarMode)ops->barMode == INFRONT)
return;
- Tcl_InitHashTable(&setTable_, sizeof(BarSetKey) / sizeof(int));
+ // 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,16 +384,19 @@ void BarGraph::initBarSetTable()
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);
int isNew;
Tcl_HashEntry* hPtr =
Tcl_CreateHashEntry(&setTable, (char *)&key, &isNew);
+ // cerr << " d" << endl;
Tcl_HashTable* tablePtr;
if (isNew) {
tablePtr = (Tcl_HashTable*)malloc(sizeof(Tcl_HashTable));
@@ -418,15 +421,19 @@ void BarGraph::initBarSetTable()
}
}
- if (setTable.numEntries == 0)
- return;
+ // cerr << "e" << endl;
+ if (setTable.numEntries == 0)
+ return;
+ //cerr << "f" << endl;
int sum =0;
- int max = 0;
+ int max =0;
Tcl_HashSearch iter;
for (Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(&setTable, &iter); hPtr;
hPtr = Tcl_NextHashEntry(&iter)) {
- BarSetKey *keyPtr = (BarSetKey*)Tcl_GetHashKey(&setTable, hPtr);
+ //cerr << " g" << endl;
+
+ BarSetKey* keyPtr = (BarSetKey*)Tcl_GetHashKey(&setTable, hPtr);
int isNew;
Tcl_HashEntry* hPtr2 =
Tcl_CreateHashEntry(&setTable_, (char*)keyPtr, &isNew);
@@ -438,12 +445,15 @@ void BarGraph::initBarSetTable()
}
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;
@@ -451,6 +461,7 @@ void BarGraph::initBarSetTable()
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;
@@ -463,10 +474,12 @@ void BarGraph::initBarSetTable()
maxBarSetSize_ = max;
nBarGroups_ = sum;
+ cerr<< "max=" << max << " nBarGroups=" << sum << endl;
}
void BarGraph::destroyBarSets()
{
+ cerr << "BarGraph::destroyBarSets()" << endl;
if (barGroups_) {
delete [] barGroups_;
barGroups_ = NULL;
@@ -474,7 +487,7 @@ void BarGraph::destroyBarSets()
nBarGroups_ = 0;
Tcl_HashSearch iter;
- for (Tcl_HashEntry *hPtr = Tcl_FirstHashEntry(&setTable_, &iter);
+ for (Tcl_HashEntry* hPtr = Tcl_FirstHashEntry(&setTable_, &iter);
hPtr; hPtr = Tcl_NextHashEntry(&iter)) {
Tcl_HashTable* tablePtr = (Tcl_HashTable*)Tcl_GetHashValue(hPtr);
Tcl_DeleteHashTable(tablePtr);
@@ -485,9 +498,9 @@ void BarGraph::destroyBarSets()
Tcl_InitHashTable(&setTable_, sizeof(BarSetKey) / sizeof(int));
}
-void BarGraph::resetBarGroups()
+void BarGraph::resetBarSets()
{
- // cerr << "BarGraph::resetBarGroups()" << endl;
+ cerr << "BarGraph::resetBarSets()" << endl;
BarGroup *gp, *gend;
for (gp = barGroups_, gend = gp + nBarGroups_; gp < gend; gp++) {
gp->lastY = 0.0;
@@ -497,7 +510,7 @@ void BarGraph::resetBarGroups()
void BarGraph::computeBarStacks()
{
- // cerr << "BarGraph::computsBarStacks()" << endl;
+ cerr << "BarGraph::computsBarStacks()" << endl;
BarGraphOptions* ops = (BarGraphOptions*)ops_;
Blt_ChainLink link;
diff --git a/src/bltGraphBar.h b/src/bltGraphBar.h
index a096b57..51b0d5f 100644
--- a/src/bltGraphBar.h
+++ b/src/bltGraphBar.h
@@ -106,9 +106,9 @@ class BarGraph : public Graph {
protected:
void resetAxes();
void mapElements();
- void initBarSetTable();
+ void initBarSets();
void destroyBarSets();
- void resetBarGroups();
+ void resetBarSets();
void computeBarStacks();
public: