COPASI API  4.16.103
Public Member Functions | Private Attributes | List of all members
CGraphCurve Class Reference

#include <CGraphCurve.h>

Inheritance diagram for CGraphCurve:
Inheritance graph
[legend]
Collaboration diagram for CGraphCurve:
Collaboration graph
[legend]

Public Member Functions

 CGraphCurve ()
 
 CGraphCurve (const CLCurve &c)
 
 CGraphCurve (const CGraphCurve &c)
 
CArrow getArrow ()
 
CLMetabReferenceGlyph::Role getRole ()
 
bool hasArrowP ()
 
void invertOrderOfPoints ()
 
void scale (const double &scaleFactor)
 
void setArrow (CArrow ar)
 
void setArrowP (bool b)
 
void setRole (CLMetabReferenceGlyph::Role r)
 
- Public Member Functions inherited from CLCurve
void addCurveSegment (const CLLineSegment &ls)
 
void addCurveSegment (const CLLineSegment *pLs)
 
CLBoundingBox calculateBoundingBox () const
 
 CLCurve ()
 
 CLCurve (const CLCurve &c)
 
 CLCurve (const Curve &sbmlcurve)
 
void clear ()
 
void exportToSBML (Curve *c, const std::map< const CCopasiObject *, SBase * > &copasimodelmap) const
 
const std::vector
< CLLineSegment > & 
getCurveSegments () const
 
std::vector< CLPointgetListOfPoints () const
 
size_t getNumCurveSegments () const
 
const CLLineSegmentgetSegmentAt (size_t i) const
 
CLLineSegmentgetSegmentAt (size_t i)
 
bool isContinuous () const
 
virtual void moveBy (const CLPoint &p)
 
bool operator== (const CLCurve &rhs) const
 
void scale (const double &scaleFactor)
 
 ~CLCurve ()
 
- Public Member Functions inherited from CLBase
 CLBase ()
 
 CLBase (const CLBase &b)
 
 CLBase (const SBase &)
 
const std::string & getTag () const
 
bool hasTag () const
 
void setTag (const std::string &tag)
 
virtual ~CLBase ()
 

Private Attributes

CArrow mArrow
 
bool mHasArrow
 
CLMetabReferenceGlyph::Role mRole
 

Additional Inherited Members

- Protected Attributes inherited from CLCurve
std::vector< CLLineSegmentmvCurveSegments
 
- Protected Attributes inherited from CLBase
std::string mTag
 

Detailed Description

Definition at line 31 of file CGraphCurve.h.

Constructor & Destructor Documentation

CGraphCurve::CGraphCurve ( )

Definition at line 29 of file CGraphCurve.cpp.

References mHasArrow.

30  : CLCurve()
31 {
32  mHasArrow = false;
33 }
CLCurve()
Definition: CLCurve.h:139
bool mHasArrow
Definition: CGraphCurve.h:35
CGraphCurve::CGraphCurve ( const CLCurve c)

Definition at line 35 of file CGraphCurve.cpp.

References mHasArrow.

36  : CLCurve(c)
37 {
38  mHasArrow = false;
39 }
CLCurve()
Definition: CLCurve.h:139
bool mHasArrow
Definition: CGraphCurve.h:35
CGraphCurve::CGraphCurve ( const CGraphCurve c)

copy constructor (should make deep copy)

Definition at line 41 of file CGraphCurve.cpp.

References mArrow, mHasArrow, and mRole.

42  : CLCurve(c)
43 {
44  mHasArrow = c.mHasArrow;
45  mArrow = c.mArrow;
46  mRole = c.mRole;
47 }
CLCurve()
Definition: CLCurve.h:139
CArrow mArrow
Definition: CGraphCurve.h:34
CLMetabReferenceGlyph::Role mRole
Definition: CGraphCurve.h:36
bool mHasArrow
Definition: CGraphCurve.h:35

Member Function Documentation

CArrow CGraphCurve::getArrow ( )
inline

Definition at line 54 of file CGraphCurve.h.

References mArrow.

Referenced by CQGLNetworkPainter::drawEdge().

54 {return mArrow;}
CArrow mArrow
Definition: CGraphCurve.h:34
CLMetabReferenceGlyph::Role CGraphCurve::getRole ( )
inline

Definition at line 53 of file CGraphCurve.h.

References mRole.

Referenced by CQGLNetworkPainter::drawEdge().

53 {return mRole;}
CLMetabReferenceGlyph::Role mRole
Definition: CGraphCurve.h:36
bool CGraphCurve::hasArrowP ( )
inline

Definition at line 49 of file CGraphCurve.h.

References mHasArrow.

Referenced by CQGLNetworkPainter::drawEdge(), and CQGLNetworkPainter::setNodeSize().

49 {return mHasArrow;}
bool mHasArrow
Definition: CGraphCurve.h:35
void CGraphCurve::invertOrderOfPoints ( )

Definition at line 62 of file CGraphCurve.cpp.

References BezierCurve::curvePts(), CLLineSegment::getBase1(), CLLineSegment::getBase2(), CLLineSegment::getEnd(), CLLineSegment::getStart(), CLPoint::getX(), CLPoint::getY(), CLLineSegment::isBezier(), mArrow, mHasArrow, CLCurve::mvCurveSegments, CArrow::setLine(), and CArrow::setPoint().

Referenced by CQGLNetworkPainter::checkCurve().

63 {
64  unsigned int i; // invert order of points in each segment
65  CLPoint h; // puffer variable
66 
67  for (i = 0; i < mvCurveSegments.size(); i++)
68  {
69  h = mvCurveSegments[i].getStart();
70  mvCurveSegments[i].setStart(mvCurveSegments[i].getEnd());
71  mvCurveSegments[i].setEnd(h);
72 
73  if (mvCurveSegments[i].isBezier())
74  {
75  h = mvCurveSegments[i].getBase1();
76  mvCurveSegments[i].setBase1(mvCurveSegments[i].getBase2());
77  mvCurveSegments[i].setBase2(h);
78  }
79  }
80 
81  // now invert order of segments
82  std::reverse(mvCurveSegments.begin(), mvCurveSegments.end());
83 
84  if (mHasArrow)
85  {// exchange line segment and end point
86  CLLineSegment lastSeg = mvCurveSegments[mvCurveSegments.size() - 1];
87  CLPoint p = lastSeg.getEnd();
88 
89  if (lastSeg.isBezier())
90  {
91  BezierCurve *bezier = new BezierCurve();
92  std::vector<CLPoint> pts = std::vector<CLPoint>();
93  pts.push_back(lastSeg.getStart());
94  pts.push_back(lastSeg.getBase1());
95  pts.push_back(lastSeg.getBase2());
96  pts.push_back(lastSeg.getEnd());
97  std::vector<CLPoint> bezierPts = bezier->curvePts(pts);
98  size_t num = bezierPts.size();
99  CLLineSegment segForArrow = CLLineSegment(bezierPts[num - 2], bezierPts[num - 1]);
100  mArrow.setLine(segForArrow);
101  mArrow.setPoint(CLPoint(bezierPts[num - 1].getX(), bezierPts[num - 1].getY()));
102  //ar = new CArrow(segForArrow, bezierPts[num - 1].getX(), bezierPts[num - 1].getY(), this->currentZoom);
103  }
104  else
105  {
106  mArrow.setLine(lastSeg);
107  mArrow.setPoint(CLPoint(p.getX(), p.getY()));
108  }
109 
110  //ar = new CArrow(lastSeg, p.getX(), p.getY(), this->currentZoom);
111  }
112 }
const CLPoint & getBase1() const
Definition: CLCurve.h:82
const CLPoint & getBase2() const
Definition: CLCurve.h:83
const CLPoint & getEnd() const
Definition: CLCurve.h:75
const C_FLOAT64 & getX() const
Definition: CLBase.h:83
Definition: CLBase.h:54
CArrow mArrow
Definition: CGraphCurve.h:34
const C_FLOAT64 & getY() const
Definition: CLBase.h:84
bool isBezier() const
Definition: CLCurve.h:90
std::vector< CLPoint > curvePts(const std::vector< CLPoint > &pts)
Definition: BezierCurve.cpp:49
void setPoint(CLPoint p)
Definition: CArrow.h:45
bool mHasArrow
Definition: CGraphCurve.h:35
void setLine(CLLineSegment l)
Definition: CArrow.h:43
const CLPoint & getStart() const
Definition: CLCurve.h:74
std::vector< CLLineSegment > mvCurveSegments
Definition: CLCurve.h:135
void CGraphCurve::scale ( const double &  scaleFactor)

Definition at line 49 of file CGraphCurve.cpp.

References mArrow, mHasArrow, CLCurve::mvCurveSegments, and CArrow::scale().

50 {
51  unsigned int i; // scale all segments
52 
53  for (i = 0; i < mvCurveSegments.size(); i++)
54  {
55  mvCurveSegments[i].scale(scaleFactor);
56  }
57 
58  if (mHasArrow)
59  mArrow.scale(scaleFactor);
60 }
void scale(C_FLOAT64 zoomFactor)
Definition: CArrow.cpp:36
CArrow mArrow
Definition: CGraphCurve.h:34
bool mHasArrow
Definition: CGraphCurve.h:35
std::vector< CLLineSegment > mvCurveSegments
Definition: CLCurve.h:135
void CGraphCurve::setArrow ( CArrow  ar)
inline

Definition at line 51 of file CGraphCurve.h.

References mArrow.

Referenced by CQGLNetworkPainter::createGraph(), and CQGLNetworkPainter::setNodeSize().

51 {mArrow = ar;}
CArrow mArrow
Definition: CGraphCurve.h:34
void CGraphCurve::setArrowP ( bool  b)
inline

Definition at line 50 of file CGraphCurve.h.

References mHasArrow.

Referenced by CQGLNetworkPainter::createGraph().

50 {mHasArrow = b;}
bool mHasArrow
Definition: CGraphCurve.h:35
void CGraphCurve::setRole ( CLMetabReferenceGlyph::Role  r)
inline

Definition at line 52 of file CGraphCurve.h.

References mRole.

Referenced by CQGLNetworkPainter::createGraph().

52 {mRole = r;}
CLMetabReferenceGlyph::Role mRole
Definition: CGraphCurve.h:36

Member Data Documentation

CArrow CGraphCurve::mArrow
private

Definition at line 34 of file CGraphCurve.h.

Referenced by CGraphCurve(), getArrow(), invertOrderOfPoints(), scale(), and setArrow().

bool CGraphCurve::mHasArrow
private

Definition at line 35 of file CGraphCurve.h.

Referenced by CGraphCurve(), hasArrowP(), invertOrderOfPoints(), scale(), and setArrowP().

CLMetabReferenceGlyph::Role CGraphCurve::mRole
private

Definition at line 36 of file CGraphCurve.h.

Referenced by CGraphCurve(), getRole(), and setRole().


The documentation for this class was generated from the following files: