Logo Search packages:      
Sourcecode: tcm version File versions  Download package

Line Class Reference

#include <line.h>

Inheritance diagram for Line:

GShape Shape Thing APLine FlashArrow SCDAndLine T1Line TransitionArrow C1Arrow EndC1Arrow StartC1Line T2Line SSDR2Line SSDRCLine T4Line C2R2Line T4TListLine C2R2MListLine

List of all members.

Detailed Description

line shape class.

Definition at line 40 of file line.h.

Public Types

enum  AssocType { SUBJECT, SHAPE, VIEW }
 possible types in the assoclist.

Public Member Functions

void AddPoint (const Point *pt, unsigned int n)
 Add a point after given position n.
virtual void AdjustSize ()
 update size to make the shape fit the text shape strings.
void CalcDirection ()
 Calculate direction arrow.
bool CalcEndPoint (const Point *pt, unsigned which)
 ReCalculate when first or last point of line is moved to pt.
virtual void CalcEndPoints ()
 Calculate begin and end-points (intersections with the shapes).
virtual void CalcPosition ()
 Define a position for the line (the center of the name of the line).
bool CheckReferences ()
 Check also fromShape and toShape shape references.
TextShapeChooseTextShape (int x, int y)
 choose text shape near (x,y).
ShapeClone ()
virtual bool ContainsChild (const GShape *) const
 Returns if gs is contained in the child area of this shape.
bool ContainsPt (int x, int y)
 returns if (x,y) is on one of the segments of line.
void Draw ()
 Draws the shape: shape itself and its text and selection handles.
void DrawOutLine (const Point *)
 empty, because line has no outline.
virtual void DrawTextShapes ()
void DrawWithChildren ()
 draw the shape and all child shapes
TextAlign::Type GetAlignment () const
int GetBottomMost () const
 largest y-coordinate in shape.
int GetClassType () const
 return code of the lowest class.
const stringGetColor () const
unsigned int GetCount () const
 count and order are used to determine whether
LineEnd::Type GetEnd1 ()
LineEnd::Type GetEnd2 ()
XFontGetFont () const
 return font of the textshapes (all textshapes have same font).
GShapeGetFromShape () const
 fromShape and toShape are the connected shapes.
int GetHeight () const
unsigned long GetId ()
int GetLeftMost () const
 refinements of those shape members.
bool GetLine (int x, int y)
 return if segment has (x,y). if so, lineNumber set to segment nr.
List< Point * > * GetLine () const
 'line' is a list of points.
unsigned int GetLineNumber ()
LineStyle::Type GetLineStyle () const
unsigned GetLineWidth () const
TextShapeGetName () const
ReadDirection::Type GetNameDirection () const
const stringGetNameString ()
unsigned int GetOrder () const
 more than one line connect the same pair of shapes.
const PointGetPosition () const
int GetRightMost () const
 largest x-coordinate in shape.
bool GetSegment (int n, DPoint *pt1, DPoint *pt2)
 get line segment n (if it exists).
bool GetSegment (int n, Point *pt1, Point *pt2)
 get line segment n (if it exists).
bool GetSegments (Point pt, Point *pt1, Point *pt2)
 get left and rigth line segments of point pt (if they exist).
SubjectGetSubject () const
const stringGetTextColor () const
const PointGetTopLeft () const
int GetTopMost () const
 smallest y-coordinate in shape.
GShapeGetToShape () const
ShapeViewGetView () const
int GetWidth () const
Point GiveOrthoSnp (Point to) const
 Calc the intersection of an orthogonal line with shape boundary.
Point GiveSnp (Point p, int order, int count, int &code)
 As GiveSnp but takes into account distribution of multiple lines.
Point GiveSnp (Point to) const
 intersection of boundary and line from given point to shape center.
virtual bool HasNameString (const string *s, bool c1, bool c2) const
 return if name text shape contains 's'.
virtual bool HasString (const string *s, bool cI, bool aS, List< TextShape * > *l)
 put all textshapes containing 's' in the list l.
virtual bool HasString (const string *s, bool c1, bool c2) const
 return if some text shape contains 's'.
virtual bool HasTextShape (TextShape *t) const
 return if it has t as one of the text shapes.
int HitHandles (int x, int y)
 returns handle-nr if (x,y) hits a handle, otherwise -1.
virtual TextShapeHitTextShape (int x, int y)
 Returns if (x,y) is in name, and if so returns name.
virtual bool InTextArea (int x, int y)
 returns if (x,y) is in text area (used for edit cursor).
bool IsCurved () const
bool IsDuplicate () const
bool IsFirstSelected () const
bool IsFixedName ()
bool IsLine () const
virtual bool IsNodeShape () const
bool IsSelected () const
bool IsShape () const
virtual bool IsSubject () const
virtual bool IsTextShape () const
virtual bool IsView () const
bool IsVisible () const
 Line (const Line &s)
 Line (ShapeView *v, Grafport *g, GShape *n1, GShape *n2, bool Curved)
 Line (ShapeView *v, Grafport *g, GShape *n1, GShape *n2, List< Point * > *line, bool Curved)
virtual void MoveRaw (const Point *delta)
 move all points and text shapes with delta.
unsigned int NrPoints () const
bool ReadMembers (InputFile *f, double format)
 See shape. Reads/writes also the points.
Point RecalcPositionName (bool useReadDirection)
 just recalculate the position of the name text shape.
void RemovePoint (unsigned int n)
 Remove the point at given position n.
virtual void SetAnchors ()
bool SetAssocSubject (AssocList *)
 Set subject (edge) reference,.
bool SetAssocView (AssocList *)
 update view reference from assocList.
void SetColor (const string *c)
void SetCount (unsigned int i)
void SetDuplicate (bool b)
void SetEnd1 (LineEnd::Type t)
void SetEnd2 (LineEnd::Type t)
virtual void SetFirstSelect (bool s)
void SetFixedName (bool b)
void SetFromBottom ()
 set first point of line to bottom of fromShape.
void SetFromShape (GShape *n)
void SetFromTop ()
 set first point of line to top of fromShape.
virtual void SetGrafport (Grafport *g)
 set grafport of itself and its text shapes.
void SetId (unsigned long val)
void SetLineNumber (unsigned int n)
void SetLineStyle (LineStyle::Type x)
void SetLineWidth (unsigned n)
virtual void SetNameString (const string *s)
void SetOrder (unsigned int i)
void SetPoint (const Point *pt, unsigned int n)
 Update point of given position n.
void SetPosition (const Point *p, bool snap=True)
 empty (line has no independent position).
bool SetReferences (AssocList *)
 Set also fromShape and toShape references.
virtual void SetSelect (bool s)
 select this shape and its text shapes are selected.
void SetSubject (Subject *s)
void SetTextShape ()
 update the strings of text shapes with the subject strings.
void SetToBottom ()
 set last point of line to bottom of toShape.
void SetToShape (GShape *n)
void SetToTop ()
 set last point of line to top of toShape.
virtual void SetView (ShapeView *v)
 set view of itself and its text shapes.
void SetVisible (bool s)
void Undraw ()
 Erases the shape: by redrawing it in XOR mode.
void UndrawDuplicate ()
virtual void UndrawShape ()
virtual void UndrawTextShapes ()
void UndrawWithChildren ()
 undraw the shape and all child shapes
virtual void UpdateAlignment (TextAlign::Type alignment)
 update text alignments and redraw.
virtual void UpdateColor (string *color)
 update color and redraw.
void UpdateCurve (bool b)
void UpdateDuplicate (bool b)
 set whether shape is a duplicate shape.
void UpdateEnd1 (LineEnd::Type t)
void UpdateEnd2 (LineEnd::Type t)
virtual void UpdateFirstSelect (bool s)
 update first selection handles and redraw.
virtual void UpdateFont (XFont *ft)
 update font and redraw.
void UpdateLineStyle (LineStyle::Type x)
void UpdateLineWidth (unsigned n)
virtual void UpdateMove (const Point *delta)
 update movement and redraw.
void UpdateNameDirection (ReadDirection::Type nd)
virtual void UpdateNameString (const string *s)
 update string of name text shape and redraw.
virtual void UpdateParent (Node *parent)
 update subject's parent and redraw.
void UpdatePosition ()
 recalculates position and redraws the line.
void UpdatePosition (const Point *p, bool snap=True)
 empty (line has no independent position).
virtual void UpdateSelect (bool s)
 update selection handles and redraw.
virtual void UpdateSize (int w, int h)
 update size and redraw.
void UpdateTextColor (const string *c)
void Write (OutputFile *ofile)
 write thing to file ofile.
void WriteMembers (OutputFile *f)
 See shape. Reads/writes also the points.

Static Public Attributes

static const int HANDLE_WIDTH = 6
 size of selection handle.
static const int MIN_HEIGHT = 20
 minimal height of a shape.
static const int MIN_WIDTH = 20
 minimal width of a shape.

Protected Member Functions

bool AboveLine (int x, int y, Point *from, Point *to)
 return if (x,y) is above line from->to.
bool BelowLine (int x, int y, Point *from, Point *to)
 return if (x,y) is down to line from->to.
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.
void DrawDirection ()
void DrawShape ()
 draws a line.
void ForcePosition (const Point *position)
GrafportGetGrafport () const
DiagramViewerGetViewer () const
void NotifyTextMove (TextShape *t)
 react on movement of some text shape.
void PositiveCoord ()
 change position so that shape has only positive coordinates.
bool ReadGraphicsPart (InputFile *ifile, double format)
 read line width and style from file.
bool ReadTextPart (InputFile *ifile, double format)
 read and parse font and alignment from file.
virtual void SetAlignment (TextAlign::Type a)
 set alignments of text shapes.
virtual void SetDrawAttributes ()
 set attributes of grafport before drawing.
virtual void SetFont (XFont *ft)
 set fonts of text shapes.
void SetHeight (int h)
void SetNameDirection (ReadDirection::Type nd)
void SetNrHandles (int n)
void SetOutlineAttributes ()
 set attributes of grafport for drawing outlines.
virtual void SetPositionHandles ()
 set all handle rectangles.
virtual void SetSize (int w, int h)
 set the size of the shape (with a minimum).
virtual void SetTextColor (const string *c)
 set color of text shapes.
void SetTopLeft (const Point *topLeft)
 set the top-left and position (take into account width and height).
void SetWidth (int w)
virtual void SnapPosition ()
 snap at position and text shapes are moved with.
virtual void SnapTopleft ()
 snap at topleft and text shapes are moved with.
void UndrawDirection ()
virtual void UndrawGraySelect ()
virtual void UndrawSelect ()
void WriteGraphicsPart (OutputFile *ofile)
 write line width and style to file.
void WriteTextPart (OutputFile *ofile)
 write font and alignment to file.

Protected Attributes

Rectangle handles [8]
 the position and size of the selection handles.

Static Protected Attributes

static const int CL_DISTX = 14
 default x distance between textshapes to line.
static const int CL_DISTY = 10
 default y distance between textshapes to line.
static const int MIN_HANDLES = 4
 minimal nr. of handles.

Private Member Functions

virtual void DrawBezier (const DPoint *ep1, const DPoint *ep2)
 Draws a bezier curve through line's points.
void DrawDuplicate ()
 at the moment. lines cannot be duplicated.
void DrawGraySelect ()
 draws gray handles.
virtual void DrawLine (const DPoint *ep1, const DPoint *ep2, int b, int e)
void DrawSelect ()
 draws black handles at each point of line.
void Move (const Point *delta)
 moves all points of line.
void SetHandles (int)
 not relevant for a line.

Private Attributes

unsigned int count
 how many lines exist between fromShape and toShape.
bool curved
 Is the line curved?
LineEnd end1
LineEnd end2
 The first connected shape.
List< Point * > * line
 The points of the line (aka handles).
unsigned int lineNumber
 The segment where the name text shape is located.
ReadDirection::Type nameDirection
 possible read direction of name label.
unsigned int order
 the order in the case of multiple lines.
int orientation
 0=free, 1=horizontal, 2=vertical.
 The other connected shape.

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

Generated by  Doxygen 1.6.0   Back to index