COPASI API  4.16.103
Public Member Functions | Protected Attributes | Friends | List of all members
CLLineSegment Class Reference

#include <CLCurve.h>

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

Public Member Functions

 CLLineSegment ()
 
 CLLineSegment (const CLPoint &s, const CLPoint &e)
 
 CLLineSegment (const CLPoint &s, const CLPoint &e, const CLPoint &b1, const CLPoint &b2)
 
 CLLineSegment (const LineSegment &ls)
 
void exportToSBMLBezier (CubicBezier *c, const std::map< const CCopasiObject *, SBase * > &copasimodelmap) const
 
void exportToSBMLLineSegment (LineSegment *l, const std::map< const CCopasiObject *, SBase * > &copasimodelmap) const
 
const CLPointgetBase1 () const
 
CLPointgetBase1 ()
 
const CLPointgetBase2 () const
 
CLPointgetBase2 ()
 
const CLPointgetEnd () const
 
CLPointgetEnd ()
 
const CLPointgetStart () const
 
CLPointgetStart ()
 
bool isBezier () const
 
bool operator< (const CLLineSegment &rhs) const
 
bool operator== (const CLLineSegment &rhs) const
 
void scale (const double &scaleFactor)
 
void setBase1 (const CLPoint &p)
 
void setBase2 (const CLPoint &p)
 
void setEnd (const CLPoint &p)
 
void setIsBezier (bool b)
 
void setStart (const CLPoint &p)
 
- Public Member Functions inherited from CLBase
 CLBase ()
 
 CLBase (const CLBase &b)
 
 CLBase (const SBase &)
 
const std::string & getTag () const
 
bool hasTag () const
 
virtual void moveBy (const CLPoint &)
 
void setTag (const std::string &tag)
 
virtual ~CLBase ()
 

Protected Attributes

CLPoint mBase1
 
CLPoint mBase2
 
CLPoint mEnd
 
bool mIsBezier
 
CLPoint mStart
 
- Protected Attributes inherited from CLBase
std::string mTag
 

Friends

std::ostream & operator<< (std::ostream &os, const CLLineSegment &ls)
 

Detailed Description

This class describes a line segment.

Definition at line 33 of file CLCurve.h.

Constructor & Destructor Documentation

CLLineSegment::CLLineSegment ( )
inline

Definition at line 47 of file CLCurve.h.

48  : mStart(), mEnd(),
49  mBase1(), mBase2(),
50  mIsBezier(false) {};
CLPoint mEnd
Definition: CLCurve.h:38
bool mIsBezier
Definition: CLCurve.h:43
CLPoint mBase1
Definition: CLCurve.h:40
CLPoint mBase2
Definition: CLCurve.h:41
CLPoint mStart
Definition: CLCurve.h:37
CLLineSegment::CLLineSegment ( const CLPoint s,
const CLPoint e 
)
inline

Constructor for a straight line segment

Definition at line 55 of file CLCurve.h.

56  : mStart(s), mEnd(e),
57  mBase1(), mBase2(),
58  mIsBezier(false) {};
CLPoint mEnd
Definition: CLCurve.h:38
bool mIsBezier
Definition: CLCurve.h:43
CLPoint mBase1
Definition: CLCurve.h:40
CLPoint mBase2
Definition: CLCurve.h:41
CLPoint mStart
Definition: CLCurve.h:37
CLLineSegment::CLLineSegment ( const CLPoint s,
const CLPoint e,
const CLPoint b1,
const CLPoint b2 
)
inline

Constructor for a bezier segment

Definition at line 63 of file CLCurve.h.

65  : mStart(s), mEnd(e),
66  mBase1(b1), mBase2(b2),
67  mIsBezier(true) {};
CLPoint mEnd
Definition: CLCurve.h:38
bool mIsBezier
Definition: CLCurve.h:43
CLPoint mBase1
Definition: CLCurve.h:40
CLPoint mBase2
Definition: CLCurve.h:41
CLPoint mStart
Definition: CLCurve.h:37
CLLineSegment::CLLineSegment ( const LineSegment &  ls)

constructor from libsbml object

Definition at line 22 of file CLCurve.cpp.

References mBase1, mBase2, and mIsBezier.

23  : CLBase(ls),
24  mStart(*ls.getStart()),
25  mEnd(*ls.getEnd()),
26  mBase1(),
27  mBase2(),
28  mIsBezier(false)
29 {
30  //handle bezier
31  const CubicBezier * cb = dynamic_cast<const CubicBezier *>(&ls);
32 
33  if (cb)
34  {
35  mIsBezier = true;
36  mBase1 = CLPoint(*cb->getBasePoint1());
37  mBase2 = CLPoint(*cb->getBasePoint2());
38  }
39 }
CLBase()
Definition: CLBase.h:36
CLPoint mEnd
Definition: CLCurve.h:38
bool mIsBezier
Definition: CLCurve.h:43
CLPoint mBase1
Definition: CLCurve.h:40
Definition: CLBase.h:54
CLPoint mBase2
Definition: CLCurve.h:41
CLPoint mStart
Definition: CLCurve.h:37

Member Function Documentation

void CLLineSegment::exportToSBMLBezier ( CubicBezier *  c,
const std::map< const CCopasiObject *, SBase * > &  copasimodelmap 
) const

This method writes the information of the copasi layout object into the corresponding sbml object. This is only guaranteed to work if isBezier() is true.

Definition at line 41 of file CLCurve.cpp.

References exportToSBMLLineSegment(), getBase1(), and getBase2().

42 {
43  if (!c) return;
44 
45  //first the part that is inherited from line segment
46  exportToSBMLLineSegment(c, copasimodelmap);
47 
48  //now the rest
49  c->setBasePoint1(this->getBase1().getX(), this->getBase1().getY());
50  c->setBasePoint2(this->getBase2().getX(), this->getBase2().getY());
51 }
void exportToSBMLLineSegment(LineSegment *l, const std::map< const CCopasiObject *, SBase * > &copasimodelmap) const
Definition: CLCurve.cpp:53
const CLPoint & getBase1() const
Definition: CLCurve.h:82
const CLPoint & getBase2() const
Definition: CLCurve.h:83
void CLLineSegment::exportToSBMLLineSegment ( LineSegment *  l,
const std::map< const CCopasiObject *, SBase * > &  copasimodelmap 
) const

This method writes the information of the copasi layout object into the corresponding sbml object. This is only guaranteed to work if isBezier() is false.

Definition at line 53 of file CLCurve.cpp.

References getEnd(), and getStart().

Referenced by exportToSBMLBezier().

55 {
56  if (!l) return;
57 
58  l->setStart(this->getStart().getX(), this->getStart().getY());
59  l->setEnd(this->getEnd().getX(), this->getEnd().getY());
60 }
const CLPoint & getEnd() const
Definition: CLCurve.h:75
const CLPoint & getStart() const
Definition: CLCurve.h:74
const CLPoint& CLLineSegment::getBase1 ( ) const
inline
CLPoint& CLLineSegment::getBase1 ( )
inline

Definition at line 84 of file CLCurve.h.

References mBase1.

84 {return mBase1;};
CLPoint mBase1
Definition: CLCurve.h:40
const CLPoint& CLLineSegment::getBase2 ( ) const
inline
CLPoint& CLLineSegment::getBase2 ( )
inline

Definition at line 85 of file CLCurve.h.

References mBase2.

85 {return mBase2;};
CLPoint mBase2
Definition: CLCurve.h:41
const CLPoint& CLLineSegment::getEnd ( ) const
inline
CLPoint& CLLineSegment::getEnd ( )
inline

Definition at line 77 of file CLCurve.h.

References mEnd.

77 {return mEnd;};
CLPoint mEnd
Definition: CLCurve.h:38
const CLPoint& CLLineSegment::getStart ( ) const
inline
CLPoint& CLLineSegment::getStart ( )
inline

Definition at line 76 of file CLCurve.h.

References mStart.

76 {return mStart;};
CLPoint mStart
Definition: CLCurve.h:37
bool CLLineSegment::isBezier ( ) const
inline
bool CLLineSegment::operator< ( const CLLineSegment rhs) const
inline

Definition at line 101 of file CLCurve.h.

References mStart.

102  {return (mStart < rhs.mStart);};
CLPoint mStart
Definition: CLCurve.h:37
bool CLLineSegment::operator== ( const CLLineSegment rhs) const
inline

Definition at line 94 of file CLCurve.h.

References mBase1, mBase2, mEnd, mIsBezier, and mStart.

95  {
96  if (mIsBezier) return((mStart == rhs.mStart) && (mEnd == rhs.mEnd) && (mBase1 == rhs.mBase1) && (mBase2 == rhs.mBase2));
97  else return ((mStart == rhs.mStart) && (mEnd == rhs.mEnd));
98  };
CLPoint mEnd
Definition: CLCurve.h:38
bool mIsBezier
Definition: CLCurve.h:43
CLPoint mBase1
Definition: CLCurve.h:40
CLPoint mBase2
Definition: CLCurve.h:41
CLPoint mStart
Definition: CLCurve.h:37
void CLLineSegment::scale ( const double &  scaleFactor)
inline

Definition at line 104 of file CLCurve.h.

References mBase1, mBase2, mEnd, mIsBezier, mStart, and CLPoint::scale().

Referenced by CArrow::scalePosition().

105  {
106  mStart.scale(scaleFactor); mEnd.scale(scaleFactor);
107 
108  if (mIsBezier) {mBase1.scale(scaleFactor); mBase2.scale(scaleFactor);}
109  }
CLPoint mEnd
Definition: CLCurve.h:38
bool mIsBezier
Definition: CLCurve.h:43
CLPoint mBase1
Definition: CLCurve.h:40
CLPoint mBase2
Definition: CLCurve.h:41
void scale(const double &scaleFactor)
Definition: CLBase.h:95
CLPoint mStart
Definition: CLCurve.h:37
void CLLineSegment::setBase1 ( const CLPoint p)
inline

Definition at line 87 of file CLCurve.h.

References mBase1.

Referenced by CLLayoutRenderer::revert_curve(), and CCopasiXMLParser::CurveElement::start().

87 {mBase1 = p;};
CLPoint mBase1
Definition: CLCurve.h:40
void CLLineSegment::setBase2 ( const CLPoint p)
inline

Definition at line 88 of file CLCurve.h.

References mBase2.

Referenced by CLLayoutRenderer::revert_curve(), and CCopasiXMLParser::CurveElement::start().

88 {mBase2 = p;};
CLPoint mBase2
Definition: CLCurve.h:41
void CLLineSegment::setEnd ( const CLPoint p)
inline
void CLLineSegment::setIsBezier ( bool  b)
inline
void CLLineSegment::setStart ( const CLPoint p)
inline

Definition at line 79 of file CLCurve.h.

References mStart.

Referenced by CCopasiXMLParser::CurveElement::start().

79 {mStart = p;};
CLPoint mStart
Definition: CLCurve.h:37

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const CLLineSegment ls 
)
friend

insert operator

Definition at line 62 of file CLCurve.cpp.

63 {
64  os << "[" << ls.mStart << "->" << ls.mEnd << "]";
65 
66  if (ls.mIsBezier)
67  os << " " << ls.mBase1 << ", " << ls.mBase2;
68 
69  return os;
70 }
CLPoint mEnd
Definition: CLCurve.h:38
bool mIsBezier
Definition: CLCurve.h:43
CLPoint mBase1
Definition: CLCurve.h:40
CLPoint mBase2
Definition: CLCurve.h:41
CLPoint mStart
Definition: CLCurve.h:37

Member Data Documentation

CLPoint CLLineSegment::mBase1
protected

Definition at line 40 of file CLCurve.h.

Referenced by CLLineSegment(), getBase1(), operator<<(), operator==(), scale(), and setBase1().

CLPoint CLLineSegment::mBase2
protected

Definition at line 41 of file CLCurve.h.

Referenced by CLLineSegment(), getBase2(), operator<<(), operator==(), scale(), and setBase2().

CLPoint CLLineSegment::mEnd
protected

Definition at line 38 of file CLCurve.h.

Referenced by getEnd(), operator<<(), operator==(), scale(), and setEnd().

bool CLLineSegment::mIsBezier
protected

Definition at line 43 of file CLCurve.h.

Referenced by CLLineSegment(), isBezier(), operator<<(), operator==(), scale(), and setIsBezier().

CLPoint CLLineSegment::mStart
protected

Definition at line 37 of file CLCurve.h.

Referenced by getStart(), operator<(), operator<<(), operator==(), scale(), and setStart().


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