Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

RS_Polyline Class Reference

Class for a poly line entity (lots of connected lines and arcs). More...

#include <rs_polyline.h>

Inheritance diagram for RS_Polyline:

RS_EntityContainer RS_Entity RS_Undoable RS_Flags List of all members.

Public Member Functions

 RS_Polyline (RS_EntityContainer *parent=NULL)
 Constructor.
 RS_Polyline (RS_EntityContainer *parent, const RS_PolylineData &d)
 Constructor.
virtual ~RS_Polyline ()
 Destructor.
virtual RS_Entityclone ()
virtual RS2::EntityType rtti () const
RS_PolylineData getData () const
void setStartpoint (RS_Vector &v)
 sets a new start point of the polyline
RS_Vector getStartpoint ()
void setEndpoint (RS_Vector &v)
 sets a new end point of the polyline
RS_Vector getEndpoint ()
double getClosingBulge ()
void updateEndpoints ()
 Sets the polylines start and endpoint to match the first and last vertex.
bool isClosed () const
void setClosed (bool cl)
bool validate ()
 Validates the polyline.
virtual RS_VectorSolutions getRefPoints ()
 Adds a segment to the polyline.
virtual RS_Vector getNearestRef (const RS_Vector &coord, double *dist=NULL)
 Must be overwritten to get the nearest reference point for this entity.
virtual RS_Vector getNearestSelectedRef (const RS_Vector &coord, double *dist=NULL)
 Gets the nearest reference point of this entity if it is selected.
virtual RS_EntityaddVertex (const RS_Vector &v, double bulge=0.0, bool prepend=false)
 Adds a vertex from the endpoint of the last segment or from the startpoint of the first segment to 'v' or sets the startpoint to the point 'v'.
virtual void setNextBulge (double bulge)
virtual void addEntity (RS_Entity *entity)
 Reimplementation of the addEntity method for a normal container.
virtual void removeLastVertex ()
 Removes the last vertex of this polyline.
virtual void endPolyline ()
 Ends polyline and adds the last entity if the polyline is closed.
virtual bool optimizeContours ()
 Overrides the implementation of RS_EntityContainer.
virtual void move (const RS_Vector &offset)
 Implementations must move the entity by the given vector.
virtual void rotate (const RS_Vector &center, double angle)
 Implementations must rotate the entity by the given angle around the given center.
virtual void scale (const RS_Vector &center, const RS_Vector &factor)
 Implementations must scale the entity by the given factors.
virtual void mirror (const RS_Vector &axisPoint1, const RS_Vector &axisPoint2)
 Implementations must mirror the entity by the given axis.
virtual void moveRef (const RS_Vector &ref, const RS_Vector &offset)
 Implementations must drag the reference point(s) of all (sub-)entities that are very close to ref by offset.
virtual void stretch (const RS_Vector &firstCorner, const RS_Vector &secondCorner, const RS_Vector &offset)
 Implementations must stretch the given range of the entity by the given offset.
virtual void draw (RS_Painter *painter, RS_GraphicView *view, double patternOffset=0.0)
 Slightly optimized drawing for polylines.

Protected Member Functions

virtual RS_EntitycreateVertex (const RS_Vector &v, double bulge=0.0, bool prepend=false)
 Creates a vertex from the endpoint of the last element or sets the startpoint to the point 'v'.

Protected Attributes

RS_PolylineData data
RS_EntityclosingEntity
double nextBulge

Detailed Description

Class for a poly line entity (lots of connected lines and arcs).

Author:
Andrew Mustun


Constructor & Destructor Documentation

RS_Polyline::RS_Polyline RS_EntityContainer parent,
const RS_PolylineData d
 

Constructor.

Parameters:
d Polyline data


Member Function Documentation

void RS_Polyline::addEntity RS_Entity entity  )  [virtual]
 

Reimplementation of the addEntity method for a normal container.

This reimplementation deletes the given entity!

To add entities use addVertex() or addSegment() instead.

Reimplemented from RS_EntityContainer.

RS_Entity * RS_Polyline::addVertex const RS_Vector v,
double  bulge = 0.0,
bool  prepend = false
[virtual]
 

Adds a vertex from the endpoint of the last segment or from the startpoint of the first segment to 'v' or sets the startpoint to the point 'v'.

The very first vertex added with this method is the startpoint.

Parameters:
v vertex coordinate to be added
bulge The bulge of the _next_ vertex or 0 for a line segment (see DXF documentation)
prepend true: prepend at start instead of append at end
Returns:
Pointer to the entity that was addded or NULL if this was the first vertex added.

RS_Entity * RS_Polyline::createVertex const RS_Vector v,
double  bulge = 0.0,
bool  prepend = false
[protected, virtual]
 

Creates a vertex from the endpoint of the last element or sets the startpoint to the point 'v'.

The very first vertex added is the starting point.

Parameters:
v vertex coordinate
bulge The bulge of the arc (see DXF documentation)
prepend true: Prepend instead of append at end
Returns:
Pointer to the entity that was created or NULL if this was the first vertex added.

double RS_Polyline::getClosingBulge  ) 
 

Returns:
The bulge of the closing entity.

RS_PolylineData RS_Polyline::getData  )  const [inline]
 

Returns:
Copy of data that defines the polyline.

RS_Vector RS_Polyline::getEndpoint  )  [inline]
 

Returns:
End point of the entity

RS_Vector RS_Polyline::getNearestRef const RS_Vector coord,
double *  dist = NULL
[virtual]
 

Must be overwritten to get the nearest reference point for this entity.

Parameters:
coord Coordinate (typically a mouse coordinate)
dist Pointer to a value which will contain the measured distance between 'coord' and the closest point. The passed pointer can also be NULL in which case the distance will be lost.
Returns:
The closest point with the given distance to the endpoint.

Reimplemented from RS_EntityContainer.

RS_Vector RS_Polyline::getNearestSelectedRef const RS_Vector coord,
double *  dist = NULL
[virtual]
 

Gets the nearest reference point of this entity if it is selected.

Containers re-implement this method to return the nearest reference point of a selected sub entity.

Parameters:
coord Coordinate (typically a mouse coordinate)
dist Pointer to a value which will contain the measured distance between 'coord' and the closest point. The passed pointer can also be NULL in which case the distance will be lost.
Returns:
The closest point with the given distance to the endpoint.

Reimplemented from RS_EntityContainer.

RS_Vector RS_Polyline::getStartpoint  )  [inline]
 

Returns:
Start point of the entity

bool RS_Polyline::isClosed  )  const [inline]
 

Returns:
true if the polyline is closed. false otherwise

bool RS_Polyline::optimizeContours  )  [virtual]
 

Overrides the implementation of RS_EntityContainer.

Does nothing, since polylines are already 'optimized' by definition.

Return values:
true all contours were closed
false at least one contour is not closed

Reimplemented from RS_EntityContainer.

virtual RS2::EntityType RS_Polyline::rtti  )  const [inline, virtual]
 

Returns:
RS2::EntityPolyline

Reimplemented from RS_EntityContainer.

void RS_Polyline::stretch const RS_Vector firstCorner,
const RS_Vector secondCorner,
const RS_Vector offset
[virtual]
 

Implementations must stretch the given range of the entity by the given offset.

This default implementation moves the whole entity if it is completely inside the given range.

Reimplemented from RS_EntityContainer.

bool RS_Polyline::validate  ) 
 

Validates the polyline.

Return values:
true,: Polyline is valid.
false,: Polyline is not valid (entities not connected, ...).


The documentation for this class was generated from the following files:
Generated on Sat Jan 6 13:48:23 2007 for qcadlib by  doxygen 1.4.4