## class Line : public GShape

> line shape class.

## Inheritance:

### Public Methods

  | Line (ShapeView *v, Grafport *g, GShape *n1, GShape *n2, List<Point *> *line, bool Curved)
  | Line (ShapeView *v, Grafport *g, GShape *n1, GShape *n2, bool Curved)
  | Line (const Line &s)
  Shape* | Clone ()
  virtual | ~Line ()
  bool | IsCurved () const
  void | UpdateCurve (bool b)
  void | UpdatePosition (const Point *p, bool snap=True) empty (line has no independent position).
  void | SetPosition (const Point *p, bool snap=True) empty (line has no independent position).
  void | DrawOutLine (const Point *) empty, because line has no outline.
  bool | ContainsPt (int x, int y) returns if (x,y) is on one of the segments of line.
  int | HitHandles (int x, int y) returns handle-nr if (x,y) hits a handle, otherwise -1.
  bool | IsLine () const yep.
  unsigned int | GetCount () const count and order are used to determine whether
  unsigned int | GetOrder () const more than one line connect the same pair of shapes.
  void | SetOrder (unsigned int i)
  void | SetCount (unsigned int i)
  GShape* | GetFromShape () const fromShape and toShape are the connected shapes.
  GShape* | GetToShape () const
  void | SetFromShape (GShape *n)
  void | SetToShape (GShape *n)
  unsigned int | NrPoints () const
  List <Point *> * | GetLine () const 'line' is a list of points.
  bool | GetSegments (Point pt, Point *pt1, Point *pt2) get left and rigth line segments of point pt (if they exist).
  bool | GetSegment (int n, Point *pt1, Point *pt2) get line segment n (if it exists).
  virtual bool | InTextArea (int x, int y) returns if (x,y) is in text area (used for edit cursor).
  void | SetEnd1 (LineEnd::Type t)
  void | SetEnd2 (LineEnd::Type t)
  void | UpdateEnd1 (LineEnd::Type t)
  void | UpdateEnd2 (LineEnd::Type t)
  LineEnd::Type | GetEnd1 ()
  LineEnd::Type | GetEnd2 ()
  int | GetLeftMost () const
  int | GetTopMost () const
  int | GetRightMost () const
  int | GetBottomMost () const
  void | SetToTop () set last point of line to top of toShape.
  void | SetFromTop () set first point of line to top of fromShape.
  void | SetToBottom () set last point of line to bottom of toShape.
  void | SetFromBottom () set first point of line to bottom of fromShape.
  void | UpdatePosition () recalculates position and redraws the line.
  virtual void | CalcPosition () Define a position for the line (the center of the name of the line).
  virtual void | CalcEndPoints () Calculate begin and end-points (intersections with the shapes).
  void | CalcDirection () Calculate direction arrow
  bool | CalcEndPoint (const Point *pt, unsigned which) ReCalculate when first or last point of line is moved to pt.
  void | SetPoint (const Point *pt, unsigned int n) Update point of given position n.
  void | AddPoint (const Point *pt, unsigned int n) Add a point after given position n.
  void | RemovePoint (unsigned int n) Remove the point at given position n.
  int | GetClassType () const
  void | WriteMembers (OutputFile *f) See shape. Reads/writes also the points.
  bool | ReadMembers (InputFile *f, double format) See shape. Reads/writes also the points.
  bool | SetAssocSubject (AssocList *) Set subject (edge) reference,
  bool | SetReferences (AssocList *) Set also fromShape and toShape references.
  bool | CheckReferences () Check also fromShape and toShape shape references.
  void | SetTextShape ()
  bool | GetLine (int x, int y) return if segment has (x,y). if so, lineNumber set to segment nr.
  unsigned int | GetLineNumber ()
  void | SetLineNumber (unsigned int n)
  TextShape* | ChooseTextShape (int x, int y) choose text shape near (x,y).
  virtual void | MoveRaw (const Point *delta) move all points and text shapes with delta.
  Point | GiveOrthoSnp (Point to) const
  Point | GiveSnp (Point to) const
  Point | GiveSnp (Point p, int order, int count, int &code)
  void | UpdateNameDirection (ReadDirection::Type nd)
  ReadDirection::Type | GetNameDirection () const

### Protected Fields

  static const int | LINE_DIST max distance (x,y) where point belongs to line.
  static const int | CL_DISTX default x distance between textshapes to line.
  static const int | CL_DISTY default y distance between textshapes to line.

### Protected Methods

  void | DrawShape () draws a line.
  void | CalcPositionName () recalculate the position of the name text shape.
  bool | ContainsPtLine (int x, int y, const Point *from, const Point *to, int &cx, int &cy) const returns (x,y) is near line from-to, cx and cy are points on line.
  bool | BelowLine (int x, int y, Point *from, Point *to) return if (x,y) is down to line from->to.
  bool | AboveLine (int x, int y, Point *from, Point *to) return if (x,y) is above line from->to.
  void | SetNameDirection (ReadDirection::Type nd)
  void | UndrawDirection ()
  void | DrawDirection ()
  void | NotifyTextMove (TextShape *t)

### Inherited from GShape:

### Public Methods

void Draw()
void Undraw()
virtual void UndrawShape()
virtual void DrawTextShapes()
virtual void UndrawTextShapes()
virtual void UpdateNameString(const string *s)
void SetNameString(const string *s)
const string* GetNameString()
TextShape* GetName() const
virtual void SetSelect(bool s)
unsigned GetLineWidth() const
void SetLineWidth(unsigned n)
void UpdateLineWidth(unsigned n)
LineStyle::Type GetLineStyle() const
void SetLineStyle(LineStyle::Type x)
void UpdateLineStyle(LineStyle::Type x)
const string* GetTextColor() const
void UpdateTextColor(const string *c)
virtual TextShape* HitTextShape(int x, int y)
bool HasTextShape(TextShape *t) const
bool IsFixedName()
void SetFixedName(bool b)
void SetGrafport(Grafport *g)
void SetView(ShapeView *v)
virtual void UpdateFont(XFont *ft)
virtual void UpdateAlignment(TextAlign::Type alignment)
XFont* GetFont() const
TextAlign::Type GetAlignment() const
bool HasNameString(const string *s, bool c1, bool c2) const
bool HasString(const string *s, bool c1, bool c2) const
bool HasString(const string *s, bool cI, bool aS, List<TextShape *> *l)

### Protected Methods

virtual void SetFont(XFont *ft)
virtual void SetTextColor(const string *c)
void WriteGraphicsPart(OutputFile *ofile)
bool ReadGraphicsPart(InputFile *ifile, double format)
void WriteTextPart(OutputFile *ofile)
bool ReadTextPart(InputFile *ifile, double format)
void SetDrawAttributes()
virtual void SetAlignment(TextAlign::Type a)
void SnapPosition()
void SnapTopleft()

### Inherited from Shape:

### Public Fields

static const int MIN_HEIGHT
static const int MIN_WIDTH
static const int HANDLE_WIDTH

### Public Methods

bool IsShape() const
virtual bool IsTextShape() const
virtual void UpdateSize(int w, int h)
virtual void UpdateMove(const Point *delta)
virtual void UpdateSelect(bool s)
virtual void UpdateFirstSelect(bool s)
virtual void UpdateColor(string *color)
virtual void SetFirstSelect(bool s)
bool IsFirstSelected() const
void SetVisible(bool s)
void SetSubject(Subject *s)
Subject* GetSubject() const
ShapeView* GetView() const
void SetColor(const string *c)
const string* GetColor() const
virtual void Move(const Point *delta)
virtual void AdjustSize()
void SetHandles(int n)
const Point* GetPosition() const
const Point* GetTopLeft() const
bool IsSelected() const
bool IsVisible() const
bool IsDuplicate() const
int GetWidth() const
int GetHeight() const
virtual void DrawDuplicate()
void UndrawDuplicate()
void SetDuplicate(bool b)
void UpdateDuplicate(bool b)
bool SetAssocView(AssocList *)

### Protected Fields

static const int MIN_HANDLES

### Protected Methods

Grafport* GetGrafport() const
void SetOutlineAttributes()
virtual void SetSize(int w, int h)
void SetWidth(int w)
void SetHeight(int h)
void SetNrHandles(int n)
DiagramViewer* GetViewer() const
void PositiveCoord(const Point*)
virtual void DrawSelect()
virtual void DrawGraySelect()
virtual void UndrawSelect()
virtual void UndrawGraySelect()
void SetTopLeft(const Point *topLeft)
virtual void SetPositionHandles()
void ForcePosition(const Point *position)

### Inherited from Thing:

### Public Classes

enum AssocType

### Public Methods

unsigned long GetId()
void SetId(unsigned long val)
virtual bool IsSubject() const
virtual bool IsView() const
void Write(OutputFile *ofile)

## Documentation

> line shape class.

`Line(ShapeView *v, Grafport *g, GShape *n1, GShape *n2, List<Point *> *line, bool Curved)`

`Line(ShapeView *v, Grafport *g, GShape *n1, GShape *n2, bool Curved)`

`Line(const Line &s)`

`Shape* Clone()`

`virtual ~Line()`

`bool IsCurved() const`

`void UpdateCurve(bool b)`

`void UpdatePosition(const Point *p, bool snap=True)`
  empty (line has no independent position).

`void SetPosition(const Point *p, bool snap=True)`
  empty (line has no independent position).

`void DrawOutLine(const Point *)`
  empty, because line has no outline.

`bool ContainsPt(int x, int y)`
  returns if (x,y) is on one of the segments of line.

`int HitHandles(int x, int y)`
  returns handle-nr if (x,y) hits a handle, otherwise -1.

`bool IsLine() const`
  yep.

`unsigned int GetCount() const`
  count and order are used to determine whether

`unsigned int GetOrder() const`
  more than one line connect the same pair of shapes.

`void SetOrder(unsigned int i)`

`void SetCount(unsigned int i)`

`GShape* GetFromShape() const`
  fromShape and toShape are the connected shapes.

`GShape* GetToShape() const`

`void SetFromShape(GShape *n)`

`void SetToShape(GShape *n)`

`unsigned int NrPoints() const`

`List <Point *> * GetLine() const`
  'line' is a list of points.

`bool GetSegments(Point pt, Point *pt1, Point *pt2)`
  get left and rigth line segments of point pt (if they exist).

`bool GetSegment(int n, Point *pt1, Point *pt2)`
  get line segment n (if it exists).

`virtual bool InTextArea(int x, int y)`
  returns if (x,y) is in text area (used for edit cursor).

`void SetEnd1(LineEnd::Type t)`

`void SetEnd2(LineEnd::Type t)`

`void UpdateEnd1(LineEnd::Type t)`

`void UpdateEnd2(LineEnd::Type t)`

`LineEnd::Type GetEnd1()`

`LineEnd::Type GetEnd2()`

`int GetLeftMost() const`

`int GetTopMost() const`

`int GetRightMost() const`

`int GetBottomMost() const`

`void SetToTop()`
  set last point of line to top of toShape.

`void SetFromTop()`
  set first point of line to top of fromShape.

`void SetToBottom()`
  set last point of line to bottom of toShape.

`void SetFromBottom()`
  set first point of line to bottom of fromShape.

`void UpdatePosition()`
  recalculates position and redraws the line.

`virtual void CalcPosition()`
  Define a position for the line (the center of the name of the line).

`virtual void CalcEndPoints()`
  Calculate begin and end-points (intersections with the shapes).

`void CalcDirection()`
  Calculate direction arrow

`bool CalcEndPoint(const Point *pt, unsigned which)`
  ReCalculate when first or last point of line is moved to pt.

`void SetPoint(const Point *pt, unsigned int n)`
  Update point of given position n.

`void AddPoint(const Point *pt, unsigned int n)`
  Add a point after given position n.

`void RemovePoint(unsigned int n)`
  Remove the point at given position n.

`int GetClassType() const`

`void WriteMembers(OutputFile *f)`
  See shape. Reads/writes also the points.

`bool ReadMembers(InputFile *f, double format)`
  See shape. Reads/writes also the points.

`bool SetAssocSubject(AssocList *)`
  Set subject (edge) reference,

`bool SetReferences(AssocList *)`
  Set also fromShape and toShape references.

`bool CheckReferences()`
  Check also fromShape and toShape shape references.

`void SetTextShape()`

`bool GetLine(int x, int y)`
  return if segment has (x,y). if so, lineNumber set to segment nr.

`unsigned int GetLineNumber()`

`void SetLineNumber(unsigned int n)`

`TextShape* ChooseTextShape(int x, int y)`
  choose text shape near (x,y).

`virtual void MoveRaw(const Point *delta)`
  move all points and text shapes with delta.

`Point GiveOrthoSnp(Point to) const`

`Point GiveSnp(Point to) const`

`Point GiveSnp(Point p, int order, int count, int &code)`

`void UpdateNameDirection(ReadDirection::Type nd)`

`ReadDirection::Type GetNameDirection() const`

`void DrawShape()`
  draws a line.

`void CalcPositionName()`
  recalculate the position of the name text shape.

`static const int LINE_DIST`
  max distance (x,y) where point belongs to line.

`static const int CL_DISTX`
  default x distance between textshapes to line.

`static const int CL_DISTY`
  default y distance between textshapes to line.

`bool ContainsPtLine(int x, int y, const Point *from, const Point *to, int &cx, int &cy) const`
  returns (x,y) is near line from-to, cx and cy are points on line.

`bool BelowLine(int x, int y, Point *from, Point *to)`
  return if (x,y) is down to line from->to.

`bool AboveLine(int x, int y, Point *from, Point *to)`
  return if (x,y) is above line from->to.

`void SetNameDirection(ReadDirection::Type nd)`

`void UndrawDirection()`

`void DrawDirection()`

`void NotifyTextMove(TextShape *t)`

Direct child classes:
  TransitionArrow
  T1Line
  FlashArrow

alphabetic index hierarchy of classes

this page has been generated automatically by doc++

(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de