rwlogo
Rogue Wave Views 5.5.1

Rogue Wave Views
Grapher Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvPolylineLinkImage Class Reference

Implementation of links with an arbitrary shape. More...

#include <ilviews/grapher/polylink.h>

Inheritance diagram for IlvPolylineLinkImage:
IlvLinkImage IlvSimpleGraphic IlvGraphic

List of all members.

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 IlvPointgetLinkPoints (IlUInt &nPoints, const IlvTransformer *t=0) const
 Returns the points defining the shape of the link.
const IlvPointgetPoint (IlUInt idx) const
 Returns an intermediate point.
const IlvPointgetPoints (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.

Detailed Description

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.


Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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.
See also:
drawSpline.
virtual IlvPolylineLinkImage::~IlvPolylineLinkImage (  )  [virtual]

Destructor.

The destructor destroys the array of points held internally by the link.


Member Function Documentation

void IlvPolylineLinkImage::addPoints ( IlUInt  count,
const IlvPoint points,
IlUInt  where 
)

Adds intermediate points.

Inserts a copy of points in the array of the intermediate points at the position where .

Parameters:
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:

  • If these rectangles do not intersect, the points are the middle of the sides of the rectangles to be joined.
  • If the bounding boxes intersect, the method returns the center of each box.

This method is called by the default implementation of the IlvLinkImage::getLinkPoints method.

Parameters:
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.

See also:
isDrawingSpline, setFlatness.
IlDouble IlvPolylineLinkImage::getFlatness (  )  const

Returns the flatness used to draw the link as a spline.

Returns:
The flatness used to draw the link as a spline.
See also:
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.

Parameters:
nPoints The number of points in the returned array.
t The transformer applied to the link.
Returns:
The points defining the shape of the link.

Reimplemented from IlvLinkImage.

const IlvPoint* IlvPolylineLinkImage::getPoint ( IlUInt  idx  )  const

Returns an intermediate point.

Returns the intermediate point at index idx, or 0 if idx if not a valid index.

Parameters:
idx The index of the point (it must be in the range [0...getPointsCount()-1].
Returns:
The point at index idx , or 0 if idx if not a valid index.
See also:
getPointsCount.
const IlvPoint* IlvPolylineLinkImage::getPoints ( IlUInt count  )  const

Returns the points defining the shape.

Returns:
The points defining the shape.
See also:
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.

Returns:
The number of points defining the shape.
IlBoolean IlvPolylineLinkImage::isDrawingSpline (  )  const

Indicates whether the link is drawn as a spline.

Returns:
IlTrue if the link is drawn as a spline and IlFalse if it is drawn as a polyline.
See also:
drawSpline, setFlatness.
void IlvPolylineLinkImage::movePoint ( IlUInt  index,
IlvPos  x,
IlvPos  y 
)

Modifies an intermediate point.

Parameters:
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.
void IlvPolylineLinkImage::removePoints ( IlUInt  start,
IlUInt  count 
)

Removes a set of intermediate points.

Removes the number count of intermediate points starting at index start.

Parameters:
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:

IlvPolylineLink.gif

- A link drawn with several flatness values -

Parameters:
flatness The new flatness.
void IlvPolylineLinkImage::setPoints ( IlUInt  count,
const IlvPoint points 
)

Sets the points defining the shape of the link.

Resets the intermediate points with a copy of points.

Parameters:
count The number of intermediate points.
points The intermediate points.

© 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.