summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorjoye <joye>2014-03-31 19:11:42 (GMT)
committerjoye <joye>2014-03-31 19:11:42 (GMT)
commit8150f1b6d516c20ed7bef75513d08a32a0c79eb0 (patch)
tree0bb11e253ae99cb3ed78393bd9a35df95f4ee0a4 /src
parent009dc90739fa4380c5429231ef90d3c48947f12e (diff)
downloadblt-8150f1b6d516c20ed7bef75513d08a32a0c79eb0.zip
blt-8150f1b6d516c20ed7bef75513d08a32a0c79eb0.tar.gz
blt-8150f1b6d516c20ed7bef75513d08a32a0c79eb0.tar.bz2
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/bltGrElem.C89
-rw-r--r--src/bltGrElem.h25
-rw-r--r--src/bltGrElemOp.C82
-rw-r--r--src/bltGrElemOp.h23
-rw-r--r--src/bltGrMarkerOp.C5
5 files changed, 113 insertions, 111 deletions
diff --git a/src/bltGrElem.C b/src/bltGrElem.C
index d798d38..82fc411 100644
--- a/src/bltGrElem.C
+++ b/src/bltGrElem.C
@@ -27,3 +27,92 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+extern "C" {
+#include "bltInt.h"
+#include "bltGraph.h"
+#include "bltOp.h"
+};
+
+#include "bltGrElemOp.h"
+#include "bltGrElem.h"
+
+PenStyle** Blt_StyleMap(Element* elemPtr)
+{
+ int i;
+ int nWeights; /* Number of weights to be examined.
+ * If there are more data points than
+ * weights, they will default to the
+ * normal pen. */
+ Blt_ChainLink link;
+ double *w; /* Weight vector */
+ int nPoints;
+
+ nPoints = NUMBEROFPOINTS(elemPtr);
+ nWeights = MIN(elemPtr->w ? elemPtr->w->nValues : 0, nPoints);
+ w = elemPtr->w ? elemPtr->w->values : NULL;
+ link = Blt_Chain_FirstLink(elemPtr->stylePalette);
+ PenStyle *stylePtr = (PenStyle*)Blt_Chain_GetValue(link);
+
+ /*
+ * Create a style mapping array (data point index to style),
+ * initialized to the default style.
+ */
+ PenStyle **dataToStyle = (PenStyle**)malloc(nPoints * sizeof(PenStyle *));
+ for (i = 0; i < nPoints; i++)
+ dataToStyle[i] = stylePtr;
+
+ for (i = 0; i < nWeights; i++) {
+ for (link = Blt_Chain_LastLink(elemPtr->stylePalette); link != NULL;
+ link = Blt_Chain_PrevLink(link)) {
+ stylePtr = (PenStyle*)Blt_Chain_GetValue(link);
+
+ if (stylePtr->weight.range > 0.0) {
+ double norm;
+
+ norm = (w[i] - stylePtr->weight.min) / stylePtr->weight.range;
+ if (((norm - 1.0) <= DBL_EPSILON) &&
+ (((1.0 - norm) - 1.0) <= DBL_EPSILON)) {
+ dataToStyle[i] = stylePtr;
+ break; /* Done: found range that matches. */
+ }
+ }
+ }
+ }
+ return dataToStyle;
+}
+
+void Blt_FreeStylePalette(Blt_Chain stylePalette)
+{
+ // Skip the first slot. It contains the built-in "normal" pen of the element
+ Blt_ChainLink link = Blt_Chain_FirstLink(stylePalette);
+ if (link) {
+ Blt_ChainLink next;
+ for (link = Blt_Chain_NextLink(link); link != NULL; link = next) {
+ next = Blt_Chain_NextLink(link);
+ PenStyle *stylePtr = (PenStyle*)Blt_Chain_GetValue(link);
+ Blt_FreePen(stylePtr->penPtr);
+ Blt_Chain_DeleteLink(stylePalette, link);
+ }
+ }
+}
+
+double Blt_FindElemValuesMinimum(ElemValues* valuesPtr, double minLimit)
+{
+ double min = DBL_MAX;
+ if (!valuesPtr)
+ return min;
+
+ 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.
+ if (x < 0.0)
+ x = -x;
+ if ((x > minLimit) && (min > x))
+ min = x;
+ }
+ if (min == DBL_MAX)
+ min = minLimit;
+
+ return min;
+}
diff --git a/src/bltGrElem.h b/src/bltGrElem.h
index 05f0e73..5ceccc9 100644
--- a/src/bltGrElem.h
+++ b/src/bltGrElem.h
@@ -37,7 +37,24 @@
#include <iomanip>
using namespace std;
-struct _Element {
+typedef struct _Element Element;
+
+typedef struct {
+ int type;
+ Element* elemPtr;
+ VectorDataSource vectorSource;
+ double *values;
+ int nValues;
+ int arraySize;
+ double min, max;
+} ElemValues;
+
+typedef struct {
+ ElemValues* x;
+ ElemValues* y;
+} ElemCoords;
+
+typedef struct _Element {
GraphObj obj;
unsigned int flags;
int hide;
@@ -64,6 +81,10 @@ struct _Element {
double yRange;
int state;
Blt_ChainLink link;
-};
+} Element;
+
+extern double Blt_FindElemValuesMinimum(ElemValues *vecPtr, double minLimit);
+extern void Blt_FreeStylePalette (Blt_Chain stylePalette);
+extern PenStyle** Blt_StyleMap (Element* elemPtr);
#endif
diff --git a/src/bltGrElemOp.C b/src/bltGrElemOp.C
index bd1a262..8625fd8 100644
--- a/src/bltGrElemOp.C
+++ b/src/bltGrElemOp.C
@@ -1140,88 +1140,6 @@ static void FindRange(ElemValues* valuesPtr)
valuesPtr->max = max;
}
-double Blt_FindElemValuesMinimum(ElemValues* valuesPtr, double minLimit)
-{
- double min = DBL_MAX;
- if (!valuesPtr)
- return min;
-
- 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.
- if (x < 0.0)
- x = -x;
- if ((x > minLimit) && (min > x))
- min = x;
- }
- if (min == DBL_MAX)
- min = minLimit;
-
- return min;
-}
-
-void Blt_FreeStylePalette(Blt_Chain stylePalette)
-{
- // Skip the first slot. It contains the built-in "normal" pen of the element
- Blt_ChainLink link = Blt_Chain_FirstLink(stylePalette);
- if (link) {
- Blt_ChainLink next;
- for (link = Blt_Chain_NextLink(link); link != NULL; link = next) {
- next = Blt_Chain_NextLink(link);
- PenStyle *stylePtr = (PenStyle*)Blt_Chain_GetValue(link);
- Blt_FreePen(stylePtr->penPtr);
- Blt_Chain_DeleteLink(stylePalette, link);
- }
- }
-}
-
-PenStyle** Blt_StyleMap(Element* elemPtr)
-{
- int i;
- int nWeights; /* Number of weights to be examined.
- * If there are more data points than
- * weights, they will default to the
- * normal pen. */
- Blt_ChainLink link;
- double *w; /* Weight vector */
- int nPoints;
-
- nPoints = NUMBEROFPOINTS(elemPtr);
- nWeights = MIN(elemPtr->w ? elemPtr->w->nValues : 0, nPoints);
- w = elemPtr->w ? elemPtr->w->values : NULL;
- link = Blt_Chain_FirstLink(elemPtr->stylePalette);
- PenStyle *stylePtr = (PenStyle*)Blt_Chain_GetValue(link);
-
- /*
- * Create a style mapping array (data point index to style),
- * initialized to the default style.
- */
- PenStyle **dataToStyle = (PenStyle**)malloc(nPoints * sizeof(PenStyle *));
- for (i = 0; i < nPoints; i++)
- dataToStyle[i] = stylePtr;
-
- for (i = 0; i < nWeights; i++) {
- for (link = Blt_Chain_LastLink(elemPtr->stylePalette); link != NULL;
- link = Blt_Chain_PrevLink(link)) {
- stylePtr = (PenStyle*)Blt_Chain_GetValue(link);
-
- if (stylePtr->weight.range > 0.0) {
- double norm;
-
- norm = (w[i] - stylePtr->weight.min) / stylePtr->weight.range;
- if (((norm - 1.0) <= DBL_EPSILON) &&
- (((1.0 - norm) - 1.0) <= DBL_EPSILON)) {
- dataToStyle[i] = stylePtr;
- break; /* Done: found range that matches. */
- }
- }
- }
- }
- return dataToStyle;
-}
-
-
static int GetIndex(Tcl_Interp* interp, Element* elemPtr,
Tcl_Obj *objPtr, int *indexPtr)
{
diff --git a/src/bltGrElemOp.h b/src/bltGrElemOp.h
index 740b2b9..3e6ef3b 100644
--- a/src/bltGrElemOp.h
+++ b/src/bltGrElemOp.h
@@ -132,21 +132,6 @@ typedef struct {
} VectorDataSource;
typedef struct {
- int type;
- Element* elemPtr;
- VectorDataSource vectorSource;
- double *values;
- int nValues;
- int arraySize;
- double min, max;
-} ElemValues;
-
-typedef struct {
- ElemValues* x;
- ElemValues* y;
-} ElemCoords;
-
-typedef struct {
Weight weight;
Pen* penPtr;
} PenStyle;
@@ -157,14 +142,6 @@ extern Tk_CustomOptionGetProc StyleGetProc;
extern Tk_CustomOptionRestoreProc StyleRestoreProc;
extern Tk_CustomOptionFreeProc StyleFreeProc;
-extern double Blt_FindElemValuesMinimum(ElemValues *vecPtr, double minLimit);
-extern void Blt_ResizeStatusArray(Element* elemPtr, int nPoints);
-extern void Blt_FreeStylePalette (Blt_Chain stylePalette);
-extern PenStyle** Blt_StyleMap (Element* elemPtr);
-extern void Blt_MapErrorBars(Graph *graphPtr, Element* elemPtr,
- PenStyle **dataToStyle);
-extern void Blt_FreeDataValues(ElemValues *evPtr);
extern int Blt_GetElement(Tcl_Interp* interp, Graph *graphPtr,
Tcl_Obj *objPtr, Element **elemPtrPtr);
-
#endif
diff --git a/src/bltGrMarkerOp.C b/src/bltGrMarkerOp.C
index a8875d7..66a0dc3 100644
--- a/src/bltGrMarkerOp.C
+++ b/src/bltGrMarkerOp.C
@@ -27,16 +27,13 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
-#include "bltC.h"
-
extern "C" {
#include "bltGraph.h"
#include "bltOp.h"
};
+#include "bltGrElem.h"
#include "bltGrMarkerOp.h"
-#include "bltConfig.h"
-#include "bltGrElem.h"
#include "bltGrMarker.h"
#include "bltGrMarkerBitmap.h"
#include "bltGrMarkerLine.h"