Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Implementation of links with an arbitrary shape. More...
#include <ilviews/grapher/polylink.h>
Public Member Functions | |
IlvPolylineLinkImage (IlvDisplay *display, IlBoolean oriented, IlDouble flatness, IlUInt count, IlvPoint *points, IlvGraphic *from, IlvGraphic *to, IlvPalette *palette=0) | |
Constructor. | |
IlvPolylineLinkImage (IlvDisplay *display, IlBoolean oriented, IlUInt count, IlvPoint *points, IlvGraphic *from, IlvGraphic *to, IlvPalette *palette=0) | |
Constructor. | |
virtual | ~IlvPolylineLinkImage () |
Destructor. | |
void | addPoints (IlUInt count, const IlvPoint *points, IlUInt where) |
Adds intermediate points. | |
virtual void | computePoints (IlvPoint &src, IlvPoint &dst, const IlvTransformer *t=0) const |
Computes the endpoints of the link when it is drawn as a straight line. | |
void | drawSpline (IlBoolean b) |
Sets the drawing mode of the link. | |
IlDouble | getFlatness () const |
Returns the flatness used to draw the link as a spline. | |
virtual IlvPoint * | getLinkPoints (IlUInt &nPoints, const IlvTransformer *t=0) const |
Returns the points defining the shape of the link. | |
const IlvPoint * | getPoint (IlUInt idx) const |
Returns an intermediate point. | |
const IlvPoint * | getPoints (IlUInt &count) const |
Returns the points defining the shape. | |
IlUInt | getPointsCount () const |
Returns the number of points defining the shape. | |
IlBoolean | isDrawingSpline () const |
Indicates whether the link is drawn as a spline. | |
void | movePoint (IlUInt index, IlvPos x, IlvPos y) |
Modifies an intermediate point. | |
void | removePoints (IlUInt start, IlUInt count) |
Removes a set of intermediate points. | |
void | setFlatness (IlDouble flatness) |
Sets the flatness used to draw the link as a spline. | |
void | setPoints (IlUInt count, const IlvPoint *points) |
Sets the points defining the shape of the link. |
Implementation of links with an arbitrary shape.
Library: ilvgrapher
An IlvPolylineLinkImage
object appears as a polyline or a spline between two nodes. The shape of the link can be specified by giving an arbitrary number of points. When this number is 0
, the link is drawn as a straight line between its two nodes.
IlvPolylineLinkImage::IlvPolylineLinkImage | ( | IlvDisplay * | display, | |
IlBoolean | oriented, | |||
IlUInt | count, | |||
IlvPoint * | points, | |||
IlvGraphic * | from, | |||
IlvGraphic * | to, | |||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of IlvPolylineLinkImage
and specifies its shape by making a copy of the array points.
display | The display connection that handles the drawing of the object. | |
oriented | A Boolean value indicating whether an arrowhead is to be drawn at the end of the link. | |
count | The number of points defining the shape of the link. | |
points | The points defining the shape of the link. | |
from | The IlvGraphic object representing the start node of the link. | |
to | The IlvGraphic object representing the end node of the link. | |
palette | The palette used to draw the link. |
IlvPolylineLinkImage::IlvPolylineLinkImage | ( | IlvDisplay * | display, | |
IlBoolean | oriented, | |||
IlDouble | flatness, | |||
IlUInt | count, | |||
IlvPoint * | points, | |||
IlvGraphic * | from, | |||
IlvGraphic * | to, | |||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of IlvPolylineLinkImage
and specifies its shape by making a copy of the array points. The created link will be drawn as a spline using the flatness flatness.
display | The display connection that handles the drawing of the object. | |
oriented | A Boolean indicating whether an arrowhead is to be drawn at the end of the link. | |
flatness | The flatness, in the range [0..1] , which is used to draw the link as a spline. | |
count | The number of points defining the shape of the link. | |
points | The points defining the shape of the link. | |
from | The IlvGraphic object representing the start node of the link. | |
to | The IlvGraphic object representing the end node of the link. | |
palette | The palette used to draw the link. |
drawSpline
. virtual IlvPolylineLinkImage::~IlvPolylineLinkImage | ( | ) | [virtual] |
Destructor.
The destructor destroys the array of points held internally by the link.
Adds intermediate points.
Inserts a copy of points in the array of the intermediate points at the position where .
count | The number of intermediate points to insert. | |
points | The new intermediate points. | |
where | The insertion index. |
virtual void IlvPolylineLinkImage::computePoints | ( | IlvPoint & | src, | |
IlvPoint & | dst, | |||
const IlvTransformer * | t = 0 | |||
) | const [virtual] |
Computes the endpoints of the link when it is drawn as a straight line.
The default implementation computes the endpoints from the bounding boxes of the starting and ending nodes:
This method is called by the default implementation of the IlvLinkImage::getLinkPoints
method.
src | The starting point of the link. | |
dst | The ending point of the link. | |
t | The transformer applied to the link. |
Reimplemented from IlvLinkImage.
void IlvPolylineLinkImage::drawSpline | ( | IlBoolean | b | ) |
Sets the drawing mode of the link.
If b is equal to IlTrue
, the link is drawn as a spline. Otherwise, it is drawn as a polyline.
param b A Boolean value indicating whether the link is drawn as a spline.
isDrawingSpline
, setFlatness
. IlDouble IlvPolylineLinkImage::getFlatness | ( | ) | const |
Returns the flatness used to draw the link as a spline.
setFlatness
. virtual IlvPoint* IlvPolylineLinkImage::getLinkPoints | ( | IlUInt & | nPoints, | |
const IlvTransformer * | t = 0 | |||
) | const [virtual] |
Returns the points defining the shape of the link.
Returns an array of points defining the shape of the link when it is drawn with the transformer t. The size of the resulting array of points is returned in the nPoints parameter. The array is stored in an IlPoolOf(IlvPoint)
and should not be deleted or modified.
This method is internally used by the methods draw
, contains
, and boundingBox
. It is meant to replace various methods defined in subclasses in previous releases of Rogue Wave Views; like the obsolete IlvOneLinkImage::getPoints
.
This function is overloaded by subclasses defining a specific shape for links. The default implementation returns an array of two points computed with the IlvLinkImage::computePoints
method.
nPoints | The number of points in the returned array. | |
t | The transformer applied to the link. |
Reimplemented from IlvLinkImage.
Returns an intermediate point.
Returns the intermediate point at index idx, or 0
if idx if not a valid index.
idx | The index of the point (it must be in the range [0...getPointsCount()-1] . |
0
if idx if not a valid index. getPointsCount
. Returns the points defining the shape.
getPointsCount
. IlUInt IlvPolylineLinkImage::getPointsCount | ( | ) | const |
Returns the number of points defining the shape.
Note: The actual number of points used to draw the link (as returned by the getLinkPoints
method) is equal to getPointsCount() +2
.
IlBoolean IlvPolylineLinkImage::isDrawingSpline | ( | ) | const |
Indicates whether the link is drawn as a spline.
IlTrue
if the link is drawn as a spline and IlFalse
if it is drawn as a polyline. drawSpline
, setFlatness
. Modifies an intermediate point.
index | The index of the intermediate point to modify. | |
x | the new x coordinate of the point. | |
y | the new y coordinate of the point. |
Removes a set of intermediate points.
Removes the number count of intermediate points starting at index start.
start | The index of the first point to remove. | |
count | The number of points to remove. |
void IlvPolylineLinkImage::setFlatness | ( | IlDouble | flatness | ) |
Sets the flatness used to draw the link as a spline.
The flatness parameter must take a value in the range [0..1]
. It determines the shape of the spline from the points defining the link. A value of 1
means that the spline is drawn with straight segments, as shown in the following figure:
- A link drawn with several flatness values -
flatness | The new flatness. |
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.