umbrello API Documentation

LinePath Class Reference

#include <linepath.h>

List of all members.

Public Types

enum  Region { TopBottom, LeftRight }
 Enum to tell whether the line docks top/bottom or left/right. More...

Public Slots

void slotLineColorChanged (Uml::IDType viewID)
 Sets the line color used by the line.
void slotLineWidthChanged (Uml::IDType viewID)
 Sets the line width used by the line.

Public Member Functions

 LinePath ()
 Constructor.
 ~LinePath ()
 Deconstructor.
bool operator== (LinePath &rhs)
 equal to (==) operator
LinePathoperator= (LinePath &rhs)
 copy ( = ) operator
void setDockRegion (Region region)
 Tell the line where the line docks.
bool hasPoints ()
void dumpPoints ()
QPoint getPoint (int pointIndex)
 Returns the point at the point index.
bool setPoint (int pointIndex, const QPoint &point)
 Sets the position of an already set point.
bool isPoint (int pointIndex, const QPoint &point, unsigned short delta=0)
 Checks, if we are at an end of the segment or somewhere in the middle.
bool insertPoint (int pointIndex, const QPoint &point)
 Inserts a point at the given index.
bool removePoint (int pointIndex, const QPoint &point, unsigned short delta=0)
 Removes the point on the line given by the index, at the coordinates given by point with a fuzzy of delta.
bool setStartEndPoints (const QPoint &start, const QPoint &end)
 Sets the start and end points.
int count ()
 Returns the amount of POINTS on the line.
int onLinePath (const QPoint &position)
 Returns -1 if the given point is not on the line.
void setCanvas (QCanvas *canvas)
 Sets the canvas to be used.
void setAssocType (Uml::Association_Type type)
 Sets the Association type.
void update ()
 Calls a group of methods to update the line.
void setAssociation (AssociationWidget *association)
 This will setup the class ready to display the line correctly.
AssociationWidgetgetAssociation ()
 Returns the Association this class is linked to.
void setSelected (bool select)
 Sets the status of whether the line is selected or not.
void saveToXMI (QDomDocument &qDoc, QDomElement &qElement)
bool loadFromXMI (QDomElement &qElement)
void activate ()
 Activates the line list.
void cleanup ()
 Removes and item created that are no longer needed.
QPen getPen ()
 Returns the type of pen to use depending on the type of Association.
void setLineColor (const QColor &color)
 Sets the line color used by the line.
void setLineWidth (uint width)
 Sets the line width used by the line.

Protected Member Functions

QCanvas * getCanvas ()
 Returns the canvas being used.
Uml::Association_Type getAssocType ()
 Returns the Association type.
QColor getLineColor ()
 Returns the Line Color to use.
uint getLineWidth ()
 Returns the Line Width to use.
void moveSelected (int pointIndex)
 Moves the selected canvas widgets.
void setupSelected ()
 Sets up the selected canvases needed.
void calculateHead ()
 Calculates the head points.
void createHeadLines ()
 Creates the head lines to display the head.
void growList (LineList &list, int by)
 Create a number of new lines and append them to the given list.
void updateHead ()
 Updates the head lines.
void setupParallelLine ()
 Creates the line objects to display the parallel line.
void calculateParallelLine ()
 Calculates the position of the parallel line.
void updateParallelLine ()
 Updates the parallel line.

Protected Attributes

AssociationWidgetm_pAssociation
 The association we are representing.
LineList m_LineList
 Contains all the lines of the association.
RectList m_RectList
 Selected boxes list.
LineList m_HeadList
 Head lines.
LineList m_ParallelList
 The parallel line.
bool m_bSelected
 Selected status.
QPointArray m_PointArray
 Contains calculated points used to draw the line head.
QPoint m_ArrowPointA
 Contains calculated points used to draw the line head.
QPoint m_ArrowPointB
 Contains calculated points used to draw the line head.
QPoint m_MidPoint
 Contains calculated points used to draw the line head.
QPoint m_EgdePoint
 Contains calculated points used to draw the line head.
QCanvasPolygon * m_pClearPoly
 A polygon object to blank out any lines we don't want to see.
Circlem_pCircle
 The transparent circle required by containment associations.
QPointArray m_ParallelLines
 Contains the calculated points for the parallel line on a collaboration message to use.
Region m_DockRegion
 Region where the line docks.
bool m_bHeadCreated
bool m_bParallelLineCreated

Classes

class  Circle
 Draw a (hollow) circle. More...


Detailed Description

Author:
Paul Hensgen Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org

Definition at line 45 of file linepath.h.


Member Enumeration Documentation

enum LinePath::Region
 

Enum to tell whether the line docks top/bottom or left/right.

Definition at line 71 of file linepath.h.


Constructor & Destructor Documentation

LinePath::LinePath  ) 
 

Constructor.

Definition at line 61 of file linepath.cpp.

References m_bSelected, m_DockRegion, m_HeadList, m_LineList, m_ParallelLines, m_ParallelList, m_pAssociation, m_pCircle, m_pClearPoly, m_PointArray, and m_RectList.

LinePath::~LinePath  ) 
 

Deconstructor.

Definition at line 77 of file linepath.cpp.


Member Function Documentation

bool LinePath::operator== LinePath rhs  ) 
 

equal to (==) operator

Definition at line 767 of file linepath.cpp.

References getPoint(), and m_LineList.

LinePath & LinePath::operator= LinePath rhs  ) 
 

copy ( = ) operator

Definition at line 779 of file linepath.cpp.

References count(), insertPoint(), m_HeadList, m_LineList, m_ParallelList, m_RectList, setAssocType(), and setStartEndPoints().

void LinePath::setDockRegion Region  region  ) 
 

Tell the line where the line docks.

Definition at line 855 of file linepath.cpp.

References m_DockRegion.

QPoint LinePath::getPoint int  pointIndex  ) 
 

Returns the point at the point index.

Definition at line 92 of file linepath.cpp.

References count(), and m_LineList.

Referenced by AssociationWidget::calculateEndingPoints(), calculateHead(), AssociationWidget::calculateNameTextSegment(), calculateParallelLine(), AssociationWidget::computeAssocClassLine(), AssociationWidget::constrainTextPos(), AssociationWidget::getAssocLineRectangle(), AssociationWidget::loadFromXMI(), AssociationWidget::mouseDoubleClickEvent(), AssociationWidget::mouseMoveEvent(), AssociationWidget::mouseReleaseEvent(), AssociationWidget::moveMidPointsBy(), operator==(), and AssociationWidget::widgetMoved().

bool LinePath::setPoint int  pointIndex,
const QPoint &  point
 

Sets the position of an already set point.

Definition at line 105 of file linepath.cpp.

References count(), m_LineList, moveSelected(), and update().

Referenced by AssociationWidget::moveMidPointsBy(), setStartEndPoints(), and AssociationWidget::widgetMoved().

bool LinePath::isPoint int  pointIndex,
const QPoint &  point,
unsigned short  delta = 0
 

Checks, if we are at an end of the segment or somewhere in the middle.

We use the delta, because with the mouse it is hard to find the exactly point.

Definition at line 137 of file linepath.cpp.

References count(), and m_LineList.

Referenced by AssociationWidget::mouseDoubleClickEvent().

bool LinePath::insertPoint int  pointIndex,
const QPoint &  point
 

Inserts a point at the given index.

Definition at line 160 of file linepath.cpp.

References count(), getCanvas(), UMLApp::getDocument(), getPen(), UMLDoc::loading(), m_LineList, and setupSelected().

Referenced by AssociationWidget::calculateEndingPoints(), AssociationWidget::mouseDoubleClickEvent(), AssociationWidget::mouseMoveEvent(), and operator=().

bool LinePath::removePoint int  pointIndex,
const QPoint &  point,
unsigned short  delta = 0
 

Removes the point on the line given by the index, at the coordinates given by point with a fuzzy of delta.

Definition at line 211 of file linepath.cpp.

References count(), and m_LineList.

Referenced by AssociationWidget::mouseDoubleClickEvent(), and AssociationWidget::mouseReleaseEvent().

bool LinePath::setStartEndPoints const QPoint &  start,
const QPoint &  end
 

Sets the start and end points.

Definition at line 268 of file linepath.cpp.

References count(), getCanvas(), getPen(), m_LineList, and setPoint().

Referenced by AssociationWidget::calculateEndingPoints(), and operator=().

int LinePath::count  ) 
 

Returns the amount of POINTS on the line.

Includes start and end points.

Definition at line 286 of file linepath.cpp.

References m_LineList.

Referenced by AssociationWidget::calculateEndingPoints(), AssociationWidget::calculateNameTextSegment(), calculateParallelLine(), AssociationWidget::constrainTextPos(), AssociationWidget::getAssocLineRectangle(), getPoint(), insertPoint(), isPoint(), AssociationWidget::mouseDoubleClickEvent(), AssociationWidget::mouseReleaseEvent(), AssociationWidget::moveMidPointsBy(), operator=(), removePoint(), setPoint(), setStartEndPoints(), updateHead(), and AssociationWidget::widgetMoved().

int LinePath::onLinePath const QPoint &  position  ) 
 

Returns -1 if the given point is not on the line.

else returns the line segment the point is on. Use the value to insert points at the point position.

Definition at line 290 of file linepath.cpp.

References getCanvas(), and m_LineList.

Referenced by AssociationWidget::mouseDoubleClickEvent(), AssociationWidget::mouseMoveEvent(), and AssociationWidget::onAssociation().

void LinePath::setCanvas QCanvas *  canvas  ) 
 

Sets the canvas to be used.

Referenced by activate().

void LinePath::setAssocType Uml::Association_Type  type  ) 
 

Sets the Association type.

Definition at line 309 of file linepath.cpp.

References createHeadLines(), getPen(), m_LineList, m_pClearPoly, setupParallelLine(), and update().

Referenced by AssociationWidget::activate(), operator=(), and AssociationWidget::setAssocType().

void LinePath::update  ) 
 

Calls a group of methods to update the line.

Used to save you calling multiple methods.

Definition at line 327 of file linepath.cpp.

References calculateHead(), calculateParallelLine(), createHeadLines(), getAssocType(), setupParallelLine(), updateHead(), and updateParallelLine().

Referenced by AssociationWidget::mouseDoubleClickEvent(), setAssocType(), setPoint(), and setupSelected().

void LinePath::setAssociation AssociationWidget association  ) 
 

This will setup the class ready to display the line correctly.

This MUST be called before you can use this class.

Definition at line 79 of file linepath.cpp.

References cleanup(), createHeadLines(), getAssocType(), m_pAssociation, setupParallelLine(), slotLineColorChanged(), and slotLineWidthChanged().

AssociationWidget* LinePath::getAssociation  )  [inline]
 

Returns the Association this class is linked to.

Definition at line 153 of file linepath.h.

References m_pAssociation.

void LinePath::setSelected bool  select  ) 
 

Sets the status of whether the line is selected or not.

Definition at line 302 of file linepath.cpp.

References m_RectList, and setupSelected().

Referenced by AssociationWidget::mouseDoubleClickEvent(), and AssociationWidget::setSelected().

void LinePath::activate  ) 
 

Activates the line list.

This is needed because the m_pAssociation does not yet exist at the time of the LinePath::loadFromXMI call. However, this means that the points in the m_LineList do not have a parent when they are loaded. They need to be reparented by calling LinePath::activate() once the m_pAssociation exists.

Definition at line 937 of file linepath.cpp.

References getCanvas(), getPen(), m_LineList, and setCanvas().

Referenced by AssociationWidget::activate().

void LinePath::cleanup  ) 
 

Removes and item created that are no longer needed.

Definition at line 831 of file linepath.cpp.

References m_HeadList, m_LineList, m_ParallelList, m_pAssociation, m_pCircle, m_pClearPoly, m_RectList, slotLineColorChanged(), and slotLineWidthChanged().

Referenced by AssociationWidget::cleanup(), and setAssociation().

QPen LinePath::getPen  ) 
 

Returns the type of pen to use depending on the type of Association.

Definition at line 463 of file linepath.cpp.

References getAssocType(), getLineColor(), and getLineWidth().

Referenced by activate(), AssociationWidget::getAssocLineRectangle(), insertPoint(), setAssocType(), and setStartEndPoints().

void LinePath::setLineColor const QColor &  color  ) 
 

Sets the line color used by the line.

Definition at line 350 of file linepath.cpp.

References getAssocType(), m_HeadList, m_LineList, m_ParallelList, m_pCircle, and m_pClearPoly.

Referenced by AssociationWidget::setLineColor(), and slotLineColorChanged().

void LinePath::setLineWidth uint  width  ) 
 

Sets the line width used by the line.

Definition at line 390 of file linepath.cpp.

References m_HeadList, m_LineList, m_ParallelList, and m_pCircle.

Referenced by AssociationWidget::setLineWidth(), and slotLineWidthChanged().

QCanvas * LinePath::getCanvas  )  [protected]
 

Returns the canvas being used.

Will return zero if the Association hasn't been set.

This class doesn't hold this information but is a wrapper method to stop calls to undefined variable like m_pAssociation.

Definition at line 799 of file linepath.cpp.

References WidgetBase::getUMLView(), and m_pAssociation.

Referenced by activate(), createHeadLines(), growList(), insertPoint(), onLinePath(), and setStartEndPoints().

Uml::Association_Type LinePath::getAssocType  )  [protected]
 

Returns the Association type.

Returns Uml::at_Association if association hasn't been set.

This class doesn't hold this information but is a wrapper method to stop calls to undefined variable like m_pAssociation.

Definition at line 806 of file linepath.cpp.

References m_pAssociation.

Referenced by calculateHead(), createHeadLines(), getPen(), setAssociation(), setLineColor(), update(), and updateHead().

QColor LinePath::getLineColor  )  [protected]
 

Returns the Line Color to use.

Returns black if association not set.

This class doesn't hold this information but is a wrapper method to stop calls to undefined variable like m_pAssociation.

Definition at line 812 of file linepath.cpp.

References m_pAssociation.

Referenced by createHeadLines(), getPen(), and growList().

uint LinePath::getLineWidth  )  [protected]
 

Returns the Line Width to use.

Returns 0 if association not set.

This class doesn't hold this information but is a wrapper method to stop calls to undefined variable like m_pAssociation.

Definition at line 818 of file linepath.cpp.

References m_pAssociation.

Referenced by createHeadLines(), getPen(), and growList().

void LinePath::moveSelected int  pointIndex  )  [protected]
 

Moves the selected canvas widgets.

Definition at line 418 of file linepath.cpp.

References m_bSelected, m_LineList, m_RectList, and setupSelected().

Referenced by setPoint().

void LinePath::setupSelected  )  [protected]
 

Sets up the selected canvases needed.

Definition at line 445 of file linepath.cpp.

References m_LineList, m_RectList, and update().

Referenced by insertPoint(), moveSelected(), and setSelected().

void LinePath::calculateHead  )  [protected]
 

Calculates the head points.

Definition at line 470 of file linepath.cpp.

References getAssocType(), getPoint(), m_ArrowPointA, m_ArrowPointB, m_EgdePoint, m_LineList, m_MidPoint, m_PointArray, LinePath::Circle::setX(), and LinePath::Circle::setY().

Referenced by update().

void LinePath::createHeadLines  )  [protected]
 

Creates the head lines to display the head.

Definition at line 648 of file linepath.cpp.

References getAssocType(), getCanvas(), getLineColor(), getLineWidth(), growList(), m_HeadList, m_pCircle, and m_pClearPoly.

Referenced by setAssociation(), setAssocType(), and update().

void LinePath::growList LineList &  list,
int  by
[protected]
 

Create a number of new lines and append them to the given list.

Parameters:
list The list into which to append lines.
by The number of lines to insert into the given list.

Definition at line 637 of file linepath.cpp.

References getCanvas(), getLineColor(), and getLineWidth().

Referenced by createHeadLines(), and setupParallelLine().

void LinePath::updateHead  )  [protected]
 

Updates the head lines.

Call after calculating the new points.

Definition at line 552 of file linepath.cpp.

References count(), getAssocType(), m_ArrowPointA, m_ArrowPointB, m_DockRegion, m_EgdePoint, m_HeadList, m_MidPoint, m_pCircle, m_pClearPoly, and m_PointArray.

Referenced by update().

void LinePath::setupParallelLine  )  [protected]
 

Creates the line objects to display the parallel line.

Definition at line 743 of file linepath.cpp.

References growList(), and m_ParallelList.

Referenced by setAssociation(), setAssocType(), and update().

void LinePath::calculateParallelLine  )  [protected]
 

Calculates the position of the parallel line.

Definition at line 695 of file linepath.cpp.

References count(), getPoint(), and m_ParallelLines.

Referenced by update().

void LinePath::updateParallelLine  )  [protected]
 

Updates the parallel line.

Call after calculating the new position.

Definition at line 749 of file linepath.cpp.

References m_ParallelLines, and m_ParallelList.

Referenced by update().

void LinePath::slotLineColorChanged Uml::IDType  viewID  )  [slot]
 

Sets the line color used by the line.

Parameters:
viewID The id of the object behind the widget.

Definition at line 342 of file linepath.cpp.

References UMLView::getID(), UMLView::getLineColor(), WidgetBase::getUMLView(), m_pAssociation, and setLineColor().

Referenced by cleanup(), and setAssociation().

void LinePath::slotLineWidthChanged Uml::IDType  viewID  )  [slot]
 

Sets the line width used by the line.

Parameters:
viewID The id of the object behind the widget.

Definition at line 383 of file linepath.cpp.

References UMLView::getID(), UMLView::getLineWidth(), WidgetBase::getUMLView(), m_pAssociation, and setLineWidth().

Referenced by cleanup(), and setAssociation().


Member Data Documentation

AssociationWidget* LinePath::m_pAssociation [protected]
 

The association we are representing.

Definition at line 305 of file linepath.h.

Referenced by cleanup(), getAssociation(), getAssocType(), getCanvas(), getLineColor(), getLineWidth(), LinePath(), setAssociation(), slotLineColorChanged(), and slotLineWidthChanged().

LineList LinePath::m_LineList [protected]
 

Contains all the lines of the association.

Definition at line 310 of file linepath.h.

Referenced by activate(), calculateHead(), cleanup(), count(), getPoint(), insertPoint(), isPoint(), LinePath(), moveSelected(), onLinePath(), operator=(), operator==(), removePoint(), setAssocType(), setLineColor(), setLineWidth(), setPoint(), setStartEndPoints(), and setupSelected().

RectList LinePath::m_RectList [protected]
 

Selected boxes list.

Definition at line 315 of file linepath.h.

Referenced by cleanup(), LinePath(), moveSelected(), operator=(), setSelected(), and setupSelected().

LineList LinePath::m_HeadList [protected]
 

Head lines.

Definition at line 320 of file linepath.h.

Referenced by cleanup(), createHeadLines(), LinePath(), operator=(), setLineColor(), setLineWidth(), and updateHead().

LineList LinePath::m_ParallelList [protected]
 

The parallel line.

Definition at line 325 of file linepath.h.

Referenced by cleanup(), LinePath(), operator=(), setLineColor(), setLineWidth(), setupParallelLine(), and updateParallelLine().

bool LinePath::m_bSelected [protected]
 

Selected status.

Definition at line 330 of file linepath.h.

Referenced by LinePath(), and moveSelected().

QPointArray LinePath::m_PointArray [protected]
 

Contains calculated points used to draw the line head.

Definition at line 335 of file linepath.h.

Referenced by calculateHead(), LinePath(), and updateHead().

QPoint LinePath::m_ArrowPointA [protected]
 

Contains calculated points used to draw the line head.

Definition at line 340 of file linepath.h.

Referenced by calculateHead(), and updateHead().

QPoint LinePath::m_ArrowPointB [protected]
 

Contains calculated points used to draw the line head.

Definition at line 340 of file linepath.h.

Referenced by calculateHead(), and updateHead().

QPoint LinePath::m_MidPoint [protected]
 

Contains calculated points used to draw the line head.

Definition at line 340 of file linepath.h.

Referenced by calculateHead(), and updateHead().

QPoint LinePath::m_EgdePoint [protected]
 

Contains calculated points used to draw the line head.

Definition at line 340 of file linepath.h.

Referenced by calculateHead(), and updateHead().

QCanvasPolygon* LinePath::m_pClearPoly [protected]
 

A polygon object to blank out any lines we don't want to see.

Definition at line 345 of file linepath.h.

Referenced by cleanup(), createHeadLines(), LinePath(), setAssocType(), setLineColor(), and updateHead().

Circle* LinePath::m_pCircle [protected]
 

The transparent circle required by containment associations.

Definition at line 350 of file linepath.h.

Referenced by cleanup(), createHeadLines(), LinePath(), setLineColor(), setLineWidth(), and updateHead().

QPointArray LinePath::m_ParallelLines [protected]
 

Contains the calculated points for the parallel line on a collaboration message to use.

Definition at line 356 of file linepath.h.

Referenced by calculateParallelLine(), LinePath(), and updateParallelLine().

Region LinePath::m_DockRegion [protected]
 

Region where the line docks.

Definition at line 361 of file linepath.h.

Referenced by LinePath(), setDockRegion(), and updateHead().


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for umbrello Version 3.1.0.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Tue Jun 26 08:08:05 2007 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003