// $Revision: 1.12 $ //------------------------------------------------------------------------------ // // Copyright (C) 1994, 1995 Taligent, Inc. All rights reserved. // // Project: StockBrowser // File: StandardGraph.h // Build/Version: 1.0.0 // // Description: TStandardGraph is an MGraphic that draws 2-D graphs. // It allows the client to have the graph be of any physical // size on the screen with the axes having as many or few values // as necessary. // //------------------------------------------------------------------------------ #ifndef TaligentSamples_STANDARDGRAPH #define TaligentSamples_STANDARDGRAPH class TStandardGraph; #ifndef Taligent_COREPRIMITIVECLASSES #include #endif #ifndef Taligent_GRAPHICS #include #endif #ifndef TaligentSamples_GRAPHDRAWER #include "GraphDrawer.h" #endif #ifndef TaligentSamples_GRAPHRANGE #include "GraphRange.h" #endif //============================================================================== // TStandardGraph class TStandardGraph : public MGraphic { public: TaligentTypeExtensionDeclarationsMacro(TStandardGraph) public: TStandardGraph(); TStandardGraph(const TGraphRange& xRange, const TGraphRange& yRange, const TGPoint& axisLengths = kDefaultAxisLengths); TStandardGraph(const TStandardGraph& source); virtual ~TStandardGraph(); TStandardGraph& operator=(const TStandardGraph& source); virtual TStream& operator>>=(TStream& toStream) const; virtual TStream& operator<<=(TStream& fromStream); virtual const TGPoint& GetAxisLengths() const; virtual const TGraphRange& GetXRange() const; virtual const TGraphRange& GetYRange() const; virtual void GetRanges(TGraphRange& xRange, TGraphRange& yRange) const; virtual void SetAxisLengths(const TGPoint& axisLengths, bool prepareDrawers = false); virtual void SetXRange(const TGraphRange& range, bool prepareDrawers = false); virtual void SetYRange(const TGraphRange& range, bool prepareDrawers = false); virtual void SetRanges(const TGraphRange& xRange, const TGraphRange& yRange, bool prepareDrawers = false); virtual TGPoint MapValuesToPoint(GraphValue xValue, GraphValue yValue) const; virtual TGPoint MapValuesToPoint(const TGPoint& valuesToBeConverted) const; virtual void AdoptDrawer(TGraphDrawer* drawer); virtual TGraphDrawer* OrphanDrawer(const TGraphDrawer& drawer); virtual void DeleteAllDrawers(); virtual void PrepareAllDrawers() const; TIteratorOver* CreateDrawerIterator() const; //.......................................................................... // MGraphic overrides virtual void Draw(TGrafPort& port) const; virtual TGRect GetGeometricBounds() const; virtual void TransformBy(const TGrafMatrix& matrix); protected: const TGrafMatrix& GetMatrix() const; private: static const TGPoint& kDefaultAxisLengths; static const TGraphRange& kDefaultXAxisRange; static const TGraphRange& kDefaultYAxisRange; void CopyDrawers(const TCollectionOf& source); enum {kOriginalVersion}; TGraphRange fXAxisRange; TGraphRange fYAxisRange; TGPoint fAxisLengths; TGrafMatrix fMatrix; TDequeOf fDrawers; }; #endif