rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Grapher Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions
IlvPolylineLinkImage Class Reference

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

#include <ilviews/grapher/polylink.h>

Inheritance diagram for IlvPolylineLinkImage:
IlvLinkImage IlvSimpleGraphic IlvGraphic

Public Member Functions

 IlvPolylineLinkImage (IlvDisplay *display, IlBoolean oriented, IlUInt count, IlvPoint *points, IlvGraphic *from, IlvGraphic *to, IlvPalette *palette=0)
 Constructor. More...
 
 IlvPolylineLinkImage (IlvDisplay *display, IlBoolean oriented, IlDouble flatness, IlUInt count, IlvPoint *points, IlvGraphic *from, IlvGraphic *to, IlvPalette *palette=0)
 Constructor. More...
 
virtual ~IlvPolylineLinkImage ()
 Destructor. More...
 
void addPoints (IlUInt count, const IlvPoint *points, IlUInt where)
 Adds intermediate points. More...
 
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. More...
 
void drawSpline (IlBoolean b)
 Sets the drawing mode of the link. More...
 
IlDouble getFlatness () const
 Returns the flatness used to draw the link as a spline. More...
 
virtual IlvPointgetLinkPoints (IlUInt &nPoints, const IlvTransformer *t=0) const
 Returns the points defining the shape of the link. More...
 
const IlvPointgetPoint (IlUInt idx) const
 Returns an intermediate point. More...
 
const IlvPointgetPoints (IlUInt &count) const
 Returns the points defining the shape. More...
 
IlUInt getPointsCount () const
 Returns the number of points defining the shape. More...
 
IlBoolean isDrawingSpline () const
 Indicates whether the link is drawn as a spline. More...
 
void movePoint (IlUInt index, IlvPos x, IlvPos y)
 Modifies an intermediate point. More...
 
void removePoints (IlUInt start, IlUInt count)
 Removes a set of intermediate points. More...
 
void setFlatness (IlDouble flatness)
 Sets the flatness used to draw the link as a spline. More...
 
void setPoints (IlUInt count, const IlvPoint *points)
 Sets the points defining the shape of the link. More...
 
- Public Member Functions inherited from IlvLinkImage
 IlvLinkImage (IlvDisplay *display, IlBoolean oriented, IlvGraphic *from, IlvGraphic *to, IlvPalette *palette=0)
 Constructor. More...
 
IlvGraphicgetFrom () const
 Returns the start node. More...
 
IlvGraphicgetTo () const
 Returns the end node. More...
 
IlBoolean isOriented () const
 Indicates whether the link is oriented. More...
 
void setFrom (IlvGraphic *f)
 Sets the start node. More...
 
void setOriented (IlBoolean oriented)
 Changes the oriented mode. More...
 
void setTo (IlvGraphic *t)
 Sets the end node. More...
 
virtual IlBoolean zoomable () const
 Returns the zoomable property of the link. More...
 

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
displayThe display connection that handles the drawing of the object.
orientedA Boolean value indicating whether an arrowhead is to be drawn at the end of the link.
countThe number of points defining the shape of the link.
pointsThe points defining the shape of the link.
fromThe IlvGraphic object representing the start node of the link.
toThe IlvGraphic object representing the end node of the link.
paletteThe 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
displayThe display connection that handles the drawing of the object.
orientedA Boolean indicating whether an arrowhead is to be drawn at the end of the link.
flatnessThe flatness, in the range [0..1], which is used to draw the link as a spline.
countThe number of points defining the shape of the link.
pointsThe points defining the shape of the link.
fromThe IlvGraphic object representing the start node of the link.
toThe IlvGraphic object representing the end node of the link.
paletteThe 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
countThe number of intermediate points to insert.
pointsThe new intermediate points.
whereThe 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
srcThe starting point of the link.
dstThe ending point of the link.
tThe 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
nPointsThe number of points in the returned array.
tThe 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
idxThe 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
indexThe index of the intermediate point to modify.
xthe new x coordinate of the point.
ythe 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
startThe index of the first point to remove.
countThe 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 -

Parameters
flatnessThe 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
countThe number of intermediate points.
pointsThe 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.