diff options
author | joye <joye> | 2014-06-27 19:01:46 (GMT) |
---|---|---|
committer | joye <joye> | 2014-06-27 19:01:46 (GMT) |
commit | 5f8633fddb87a394d12f3af120a3668a44f8eafa (patch) | |
tree | a61d211c83c1fd5dee367fd2b36d3aa3597797aa | |
parent | 8f75a9e3b01a1659d13e733d0b48f8ee38fd5a88 (diff) | |
download | blt-5f8633fddb87a394d12f3af120a3668a44f8eafa.zip blt-5f8633fddb87a394d12f3af120a3668a44f8eafa.tar.gz blt-5f8633fddb87a394d12f3af120a3668a44f8eafa.tar.bz2 |
*** empty log message ***
-rw-r--r-- | src/bltGrElem.h | 225 | ||||
-rw-r--r-- | src/bltGrElemBar.h | 161 | ||||
-rw-r--r-- | src/bltGrElemLine.h | 273 | ||||
-rw-r--r-- | src/bltGrElemOp.h | 2 | ||||
-rw-r--r-- | src/bltGrLegd.h | 37 | ||||
-rw-r--r-- | src/bltGraph.h | 6 |
6 files changed, 356 insertions, 348 deletions
diff --git a/src/bltGrElem.h b/src/bltGrElem.h index 4105232..8f5a645 100644 --- a/src/bltGrElem.h +++ b/src/bltGrElem.h @@ -37,14 +37,6 @@ extern "C" { #include "bltChain.h" }; -class Element; - -namespace Blt { - class Axis; - class Pen; - class Postscript; -}; - #include "bltGrMisc.h" #include "bltGrPen.h" #include "bltGrPSOutput.h" @@ -60,111 +52,118 @@ namespace Blt { #define NORMALPEN(e) ((((e)->normalPenPtr == NULL) ? \ (e)->builtinPenPtr : (e)->normalPenPtr)) -typedef struct { - Segment2d *segments; - int length; - int *map; -} GraphSegments; - -typedef struct { - Blt_VectorId vector; -} VectorDataSource; - -typedef struct { - int type; - Element* elemPtr; - VectorDataSource vectorSource; - double *values; - int nValues; - double min; - double max; -} ElemValues; - -typedef struct { - ElemValues* x; - ElemValues* y; -} ElemCoords; - -typedef struct { - double min; - double max; - double range; -} Weight; - -typedef struct { - Weight weight; - Blt::Pen* penPtr; -} PenStyle; - -typedef struct { - Element* elemPtr; - const char* label; - const char** tags; - Blt::Axis* xAxis; - Blt::Axis* yAxis; - ElemCoords coords; - ElemValues* w; - ElemValues* xError; - ElemValues* yError; - ElemValues* xHigh; - ElemValues* xLow; - ElemValues* yHigh; - ElemValues* yLow; - int hide; - int legendRelief; - Blt_Chain stylePalette; - Blt::Pen* builtinPenPtr; - Blt::Pen* activePenPtr; - Blt::Pen* normalPenPtr; - Blt::PenOptions builtinPen; -} ElementOptions; - -class Element { - protected: - Tk_OptionTable optionTable_; - void* ops_; - - double xRange_; - double yRange_; - - public: - Graph* graphPtr_; - const char* name_; - Tcl_HashEntry* hashPtr_; - unsigned short row_; - unsigned short col_; - int nActiveIndices_; - int* activeIndices_; - int active_; - int labelActive_; - - Blt_ChainLink link; - - protected: - double FindElemValuesMinimum(ElemValues*, double); - PenStyle** StyleMap(); - - public: - Element(Graph*, const char*, Tcl_HashEntry*); - virtual ~Element(); - - virtual int configure() =0; - virtual void map() =0; - virtual void extents(Region2d*) =0; - virtual void draw(Drawable) =0; - virtual void drawActive(Drawable) =0; - virtual void drawSymbol(Drawable, int, int, int) =0; - virtual void closest() =0; - virtual void print(Blt::PSOutput*) =0; - virtual void printActive(Blt::PSOutput*) =0; - virtual void printSymbol(Blt::PSOutput*, double, double, int) =0; - - virtual ClassId classId() =0; - virtual const char* className() =0; - virtual const char* typeName() =0; - - Tk_OptionTable optionTable() {return optionTable_;} - void* ops() {return ops_;} +namespace Blt { + class Axis; + class Element; + class Pen; + class Postscript; + + typedef struct { + Segment2d *segments; + int length; + int *map; + } GraphSegments; + + typedef struct { + Blt_VectorId vector; + } VectorDataSource; + + typedef struct { + int type; + Element* elemPtr; + VectorDataSource vectorSource; + double *values; + int nValues; + double min; + double max; + } ElemValues; + + typedef struct { + ElemValues* x; + ElemValues* y; + } ElemCoords; + + typedef struct { + double min; + double max; + double range; + } Weight; + + typedef struct { + Weight weight; + Pen* penPtr; + } PenStyle; + + typedef struct { + Element* elemPtr; + const char* label; + const char** tags; + Axis* xAxis; + Axis* yAxis; + ElemCoords coords; + ElemValues* w; + ElemValues* xError; + ElemValues* yError; + ElemValues* xHigh; + ElemValues* xLow; + ElemValues* yHigh; + ElemValues* yLow; + int hide; + int legendRelief; + Blt_Chain stylePalette; + Pen* builtinPenPtr; + Pen* activePenPtr; + Pen* normalPenPtr; + PenOptions builtinPen; + } ElementOptions; + + class Element { + protected: + Tk_OptionTable optionTable_; + void* ops_; + + double xRange_; + double yRange_; + + public: + Graph* graphPtr_; + const char* name_; + Tcl_HashEntry* hashPtr_; + unsigned short row_; + unsigned short col_; + int nActiveIndices_; + int* activeIndices_; + int active_; + int labelActive_; + + Blt_ChainLink link; + + protected: + double FindElemValuesMinimum(ElemValues*, double); + PenStyle** StyleMap(); + + public: + Element(Graph*, const char*, Tcl_HashEntry*); + virtual ~Element(); + + virtual int configure() =0; + virtual void map() =0; + virtual void extents(Region2d*) =0; + virtual void draw(Drawable) =0; + virtual void drawActive(Drawable) =0; + virtual void drawSymbol(Drawable, int, int, int) =0; + virtual void closest() =0; + virtual void print(PSOutput*) =0; + virtual void printActive(PSOutput*) =0; + virtual void printSymbol(PSOutput*, double, double, int) =0; + + virtual ClassId classId() =0; + virtual const char* className() =0; + virtual const char* typeName() =0; + + Tk_OptionTable optionTable() {return optionTable_;} + void* ops() {return ops_;} + }; }; extern void Blt_FreeStylePalette (Blt_Chain stylePalette); diff --git a/src/bltGrElemBar.h b/src/bltGrElemBar.h index edd61fd..0a1743b 100644 --- a/src/bltGrElemBar.h +++ b/src/bltGrElemBar.h @@ -38,93 +38,96 @@ #include "bltGrElem.h" #include "bltGrPenBar.h" -typedef struct { - float x1; - float y1; - float x2; - float y2; -} BarRegion; +namespace Blt { -typedef struct { - Weight weight; - Blt::BarPen* penPtr; - XRectangle* bars; - int nBars; - GraphSegments xeb; - GraphSegments yeb; - int symbolSize; - int errorBarCapWidth; -} BarStyle; + typedef struct { + float x1; + float y1; + float x2; + float y2; + } BarRegion; -typedef struct { - Element* elemPtr; - const char *label; - char** tags; - Blt::Axis* xAxis; - Blt::Axis* yAxis; - ElemCoords coords; - ElemValues* w; - ElemValues* xError; - ElemValues* yError; - ElemValues* xHigh; - ElemValues* xLow; - ElemValues* yHigh; - ElemValues* yLow; - int hide; - int legendRelief; - Blt_Chain stylePalette; - Blt::BarPen* builtinPenPtr; - Blt::BarPen* activePenPtr; - Blt::BarPen* normalPenPtr; - Blt::BarPenOptions builtinPen; + typedef struct { + Weight weight; + BarPen* penPtr; + XRectangle* bars; + int nBars; + GraphSegments xeb; + GraphSegments yeb; + int symbolSize; + int errorBarCapWidth; + } BarStyle; - // derived - double barWidth; - const char *groupName; -} BarElementOptions; + typedef struct { + Element* elemPtr; + const char *label; + char** tags; + Axis* xAxis; + Axis* yAxis; + ElemCoords coords; + ElemValues* w; + ElemValues* xError; + ElemValues* yError; + ElemValues* xHigh; + ElemValues* xLow; + ElemValues* yHigh; + ElemValues* yLow; + int hide; + int legendRelief; + Blt_Chain stylePalette; + BarPen* builtinPenPtr; + BarPen* activePenPtr; + BarPen* normalPenPtr; + BarPenOptions builtinPen; -class BarElement : public Element { - protected: - Blt::BarPen* builtinPenPtr; - int* barToData_; - XRectangle* bars_; - int* activeToData_; - XRectangle* activeRects_; - int nBars_; - int nActive_; - GraphSegments xeb_; - GraphSegments yeb_; + // derived + double barWidth; + const char *groupName; + } BarElementOptions; - protected: - void ResetStylePalette(Blt_Chain); - void checkStacks(Blt::Axis*, Blt::Axis*, double*, double*); - void mergePens(BarStyle**); - void mapActive(); - void reset(); - void mapErrorBars(BarStyle**); - void drawSegments(Drawable, Blt::BarPen*, XRectangle*, int); - void drawValues(Drawable, Blt::BarPen*, XRectangle*, int, int*); - void printSegments(Blt::PSOutput*, Blt::BarPen*, XRectangle*, int); - void printValues(Blt::PSOutput*, Blt::BarPen*, XRectangle*, int, int*); + class BarElement : public Element { + protected: + BarPen* builtinPenPtr; + int* barToData_; + XRectangle* bars_; + int* activeToData_; + XRectangle* activeRects_; + int nBars_; + int nActive_; + GraphSegments xeb_; + GraphSegments yeb_; - public: - BarElement(Graph*, const char*, Tcl_HashEntry*); - virtual ~BarElement(); + protected: + void ResetStylePalette(Blt_Chain); + void checkStacks(Axis*, Axis*, double*, double*); + void mergePens(BarStyle**); + void mapActive(); + void reset(); + void mapErrorBars(BarStyle**); + void drawSegments(Drawable, BarPen*, XRectangle*, int); + void drawValues(Drawable, BarPen*, XRectangle*, int, int*); + void printSegments(PSOutput*, BarPen*, XRectangle*, int); + void printValues(PSOutput*, BarPen*, XRectangle*, int, int*); - ClassId classId() {return CID_ELEM_BAR;} - const char* className() {return "BarElement";} - const char* typeName() {return "bar";} + public: + BarElement(Graph*, const char*, Tcl_HashEntry*); + virtual ~BarElement(); - int configure(); - void map(); - void extents(Region2d*); - void closest(); - void draw(Drawable); - void drawActive(Drawable); - void drawSymbol(Drawable, int, int, int); - void print(Blt::PSOutput*); - void printActive(Blt::PSOutput*); - void printSymbol(Blt::PSOutput*, double, double, int); + ClassId classId() {return CID_ELEM_BAR;} + const char* className() {return "BarElement";} + const char* typeName() {return "bar";} + + int configure(); + void map(); + void extents(Region2d*); + void closest(); + void draw(Drawable); + void drawActive(Drawable); + void drawSymbol(Drawable, int, int, int); + void print(PSOutput*); + void printActive(PSOutput*); + void printSymbol(PSOutput*, double, double, int); + }; }; #endif diff --git a/src/bltGrElemLine.h b/src/bltGrElemLine.h index 4e6dc8a..3cdd24f 100644 --- a/src/bltGrElemLine.h +++ b/src/bltGrElemLine.h @@ -35,141 +35,144 @@ #include "bltGrElem.h" #include "bltGrPenLine.h" -typedef struct { - Point2d *screenPts; - int nScreenPts; - int *styleMap; - int *map; -} MapInfo; - -typedef struct { - Point2d *points; - int length; - int *map; -} GraphPoints; - -typedef struct { - int start; - GraphPoints screenPts; -} bltTrace; - -typedef struct { - Weight weight; - Blt::LinePen* penPtr; - GraphPoints symbolPts; - GraphSegments xeb; - GraphSegments yeb; - int symbolSize; - int errorBarCapWidth; -} LineStyle; - -typedef struct { - Element* elemPtr; - const char* label; - char** tags; - Blt::Axis* xAxis; - Blt::Axis* yAxis; - ElemCoords coords; - ElemValues* w; - ElemValues* xError; - ElemValues* yError; - ElemValues* xHigh; - ElemValues* xLow; - ElemValues* yHigh; - ElemValues* yLow; - int hide; - int legendRelief; - Blt_Chain stylePalette; - Blt::LinePen *builtinPenPtr; - Blt::LinePen *activePenPtr; - Blt::LinePen *normalPenPtr; - Blt::LinePenOptions builtinPen; - - // derived - Tk_3DBorder fillBg; - int reqMaxSymbols; - double rTolerance; - int scaleSymbols; - int reqSmooth; - int penDir; -} LineElementOptions; - -class LineElement : public Element { - public: - enum PenDirection {INCREASING, DECREASING, BOTH_DIRECTIONS}; - enum Smoothing {LINEAR, STEP, CUBIC, QUADRATIC, CATROM}; - - protected: - Blt::LinePen* builtinPenPtr; - Smoothing smooth_; - Point2d *fillPts_; - int nFillPts_; - GraphPoints symbolPts_; - GraphPoints activePts_; - GraphSegments xeb_; - GraphSegments yeb_; - int symbolInterval_; - int symbolCounter_; - Blt_Chain traces_; - - void drawCircle(Display*, Drawable, Blt::LinePen*, int, Point2d*, int); - void drawSquare(Display*, Drawable, Blt::LinePen*, int, Point2d*, int); - void drawSCross(Display*, Drawable, Blt::LinePen*, int, Point2d*, int); - void drawCross(Display*, Drawable, Blt::LinePen*, int, Point2d*, int); - void drawDiamond(Display*, Drawable, Blt::LinePen*, int, Point2d*, int); - void drawArrow(Display*, Drawable, Blt::LinePen*, int, Point2d*, int); - - protected: - int scaleSymbol(int); - void getScreenPoints(MapInfo*); - void reducePoints(MapInfo*, double); - void generateSteps(MapInfo*); - void generateSpline(MapInfo*); - void generateParametricSpline(MapInfo*); - void mapSymbols(MapInfo*); - void mapActiveSymbols(); - void mergePens(LineStyle**); - int outCode(Region2d*, Point2d*); - int clipSegment(Region2d*, int, int, Point2d*, Point2d*); - void saveTrace(int, int, MapInfo*); - void freeTraces(); - void mapTraces(MapInfo*); - void mapFillArea(MapInfo*); - void mapErrorBars(LineStyle**); - void resetLine(); - int closestTrace(); - void closestPoint(ClosestSearch*); - void drawSymbols(Drawable, Blt::LinePen*, int, int, Point2d*); - void drawTraces(Drawable, Blt::LinePen*); - void drawValues(Drawable, Blt::LinePen*, int, Point2d*, int*); - void setLineAttributes(Blt::PSOutput*, Blt::LinePen*); - void printTraces(Blt::PSOutput*, Blt::LinePen*); - void printValues(Blt::PSOutput*, Blt::LinePen*, int, Point2d*, int*); - void printSymbols(Blt::PSOutput*, Blt::LinePen*, int, int, Point2d*); - double distanceToLine(int, int, Point2d*, Point2d*, Point2d*); - double distanceToX(int, int, Point2d*, Point2d*, Point2d*); - double distanceToY(int, int, Point2d*, Point2d*, Point2d*); - int simplify(Point2d*, int, int, double, int*); - double findSplit(Point2d*, int, int, int*); - - public: - LineElement(Graph*, const char*, Tcl_HashEntry*); - virtual ~LineElement(); - - ClassId classId() {return CID_ELEM_LINE;} - const char* className() {return "LineElement";} - const char* typeName() {return "line";} - - int configure(); - void map(); - void extents(Region2d*); - void closest(); - void draw(Drawable); - void drawActive(Drawable); - void drawSymbol(Drawable, int, int, int); - void print(Blt::PSOutput*); - void printActive(Blt::PSOutput*); - void printSymbol(Blt::PSOutput*, double, double, int); +namespace Blt { + + typedef struct { + Point2d *screenPts; + int nScreenPts; + int *styleMap; + int *map; + } MapInfo; + + typedef struct { + Point2d *points; + int length; + int *map; + } GraphPoints; + + typedef struct { + int start; + GraphPoints screenPts; + } bltTrace; + + typedef struct { + Weight weight; + LinePen* penPtr; + GraphPoints symbolPts; + GraphSegments xeb; + GraphSegments yeb; + int symbolSize; + int errorBarCapWidth; + } LineStyle; + + typedef struct { + Element* elemPtr; + const char* label; + char** tags; + Axis* xAxis; + Axis* yAxis; + ElemCoords coords; + ElemValues* w; + ElemValues* xError; + ElemValues* yError; + ElemValues* xHigh; + ElemValues* xLow; + ElemValues* yHigh; + ElemValues* yLow; + int hide; + int legendRelief; + Blt_Chain stylePalette; + LinePen *builtinPenPtr; + LinePen *activePenPtr; + LinePen *normalPenPtr; + LinePenOptions builtinPen; + + // derived + Tk_3DBorder fillBg; + int reqMaxSymbols; + double rTolerance; + int scaleSymbols; + int reqSmooth; + int penDir; + } LineElementOptions; + + class LineElement : public Element { + public: + enum PenDirection {INCREASING, DECREASING, BOTH_DIRECTIONS}; + enum Smoothing {LINEAR, STEP, CUBIC, QUADRATIC, CATROM}; + + protected: + LinePen* builtinPenPtr; + Smoothing smooth_; + Point2d *fillPts_; + int nFillPts_; + GraphPoints symbolPts_; + GraphPoints activePts_; + GraphSegments xeb_; + GraphSegments yeb_; + int symbolInterval_; + int symbolCounter_; + Blt_Chain traces_; + + void drawCircle(Display*, Drawable, LinePen*, int, Point2d*, int); + void drawSquare(Display*, Drawable, LinePen*, int, Point2d*, int); + void drawSCross(Display*, Drawable, LinePen*, int, Point2d*, int); + void drawCross(Display*, Drawable, LinePen*, int, Point2d*, int); + void drawDiamond(Display*, Drawable, LinePen*, int, Point2d*, int); + void drawArrow(Display*, Drawable, LinePen*, int, Point2d*, int); + + protected: + int scaleSymbol(int); + void getScreenPoints(MapInfo*); + void reducePoints(MapInfo*, double); + void generateSteps(MapInfo*); + void generateSpline(MapInfo*); + void generateParametricSpline(MapInfo*); + void mapSymbols(MapInfo*); + void mapActiveSymbols(); + void mergePens(LineStyle**); + int outCode(Region2d*, Point2d*); + int clipSegment(Region2d*, int, int, Point2d*, Point2d*); + void saveTrace(int, int, MapInfo*); + void freeTraces(); + void mapTraces(MapInfo*); + void mapFillArea(MapInfo*); + void mapErrorBars(LineStyle**); + void resetLine(); + int closestTrace(); + void closestPoint(ClosestSearch*); + void drawSymbols(Drawable, LinePen*, int, int, Point2d*); + void drawTraces(Drawable, LinePen*); + void drawValues(Drawable, LinePen*, int, Point2d*, int*); + void setLineAttributes(PSOutput*, LinePen*); + void printTraces(PSOutput*, LinePen*); + void printValues(PSOutput*, LinePen*, int, Point2d*, int*); + void printSymbols(PSOutput*, LinePen*, int, int, Point2d*); + double distanceToLine(int, int, Point2d*, Point2d*, Point2d*); + double distanceToX(int, int, Point2d*, Point2d*, Point2d*); + double distanceToY(int, int, Point2d*, Point2d*, Point2d*); + int simplify(Point2d*, int, int, double, int*); + double findSplit(Point2d*, int, int, int*); + + public: + LineElement(Graph*, const char*, Tcl_HashEntry*); + virtual ~LineElement(); + + ClassId classId() {return CID_ELEM_LINE;} + const char* className() {return "LineElement";} + const char* typeName() {return "line";} + + int configure(); + void map(); + void extents(Region2d*); + void closest(); + void draw(Drawable); + void drawActive(Drawable); + void drawSymbol(Drawable, int, int, int); + void print(PSOutput*); + void printActive(PSOutput*); + void printSymbol(PSOutput*, double, double, int); + }; }; #endif diff --git a/src/bltGrElemOp.h b/src/bltGrElemOp.h index 24cd4d5..0c8116c 100644 --- a/src/bltGrElemOp.h +++ b/src/bltGrElemOp.h @@ -34,6 +34,6 @@ extern const Ensemble elementEnsemble[]; -extern int ElementObjConfigure(Element* elemPtr, Tcl_Interp* interp, +extern int ElementObjConfigure(Blt::Element* elemPtr, Tcl_Interp* interp, int objc, Tcl_Obj* const objv[]); #endif diff --git a/src/bltGrLegd.h b/src/bltGrLegd.h index 030df17..a951d53 100644 --- a/src/bltGrLegd.h +++ b/src/bltGrLegd.h @@ -40,7 +40,10 @@ class Graph; class Pick; -class Element; + +namespace Blt { + class Element; +}; /* * Selection related flags: @@ -127,21 +130,21 @@ class Legend : public Pick { int entryWidth_; int entryHeight_; Blt::BindTable* bindTable_; - Element* focusPtr_; - Element* selAnchorPtr_; - Element* selMarkPtr_; + Blt::Element* focusPtr_; + Blt::Element* selAnchorPtr_; + Blt::Element* selMarkPtr_; Blt_Chain selected_; int titleWidth_; int titleHeight_; protected: void setOrigin(); - Element* getNextRow(Element*); - Element* getNextColumn(Element*); - Element* getPreviousRow(Element*); - Element* getPreviousColumn(Element*); - Element* getFirstElement(); - Element* getLastElement(); + Blt::Element* getNextRow(Blt::Element*); + Blt::Element* getNextColumn(Blt::Element*); + Blt::Element* getPreviousRow(Blt::Element*); + Blt::Element* getPreviousColumn(Blt::Element*); + Blt::Element* getFirstElement(); + Blt::Element* getLastElement(); public: Legend(Graph*); @@ -153,15 +156,15 @@ class Legend : public Pick { void print(Blt::PSOutput* ps); void eventuallyInvokeSelectCmd(); - void removeElement(Element*); - int getElementFromObj(Tcl_Obj*, Element**); + void removeElement(Blt::Element*); + int getElementFromObj(Tcl_Obj*, Blt::Element**); - void selectEntry(Element*); - void selectElement(Element*); - void deselectElement(Element*); - int selectRange(Element*, Element*); + void selectEntry(Blt::Element*); + void selectElement(Blt::Element*); + void deselectElement(Blt::Element*); + int selectRange(Blt::Element*, Blt::Element*); void clearSelection(); - int entryIsSelected(Element*); + int entryIsSelected(Blt::Element*); void* ops() {return ops_;} Tk_OptionTable optionTable() {return optionTable_;} diff --git a/src/bltGraph.h b/src/bltGraph.h index ae72b07..bdc69b8 100644 --- a/src/bltGraph.h +++ b/src/bltGraph.h @@ -40,7 +40,6 @@ extern "C" { #include "bltGrText.h" class Graph; -class Element; class Legend; class Pick { @@ -52,6 +51,7 @@ namespace Blt { class Axis; class BindTable; class Crosshairs; + class Element; class Marker; class Pen; class Postscript; @@ -71,7 +71,7 @@ typedef struct { int y; int along; - Element* elemPtr; + Blt::Element* elemPtr; Point2d point; int index; double dist; @@ -237,7 +237,7 @@ class Graph : public Pick { int isElementHidden(Blt::Marker*); virtual int createElement(int, Tcl_Obj* const []) =0; - int getElement(Tcl_Obj*, Element**); + int getElement(Tcl_Obj*, Blt::Element**); ClientData elementTag(const char*); virtual int createPen(const char*, int, Tcl_Obj* const []) =0; |