Filling Polygons: IlvGraphicPath
An
IlvGraphicPath object is a collection of
polypoint objects, that is, each object consists of a series of points. The polypoint objects are drawn differently depending on the value of the draw rule attribute of the object:
IlvStrokeOnly: Polylines.
IlvFillOnly: Filled polygons.
IlvStrokeAndFill: Both of the above, that is, filled polygons with an outline.
The palette defined by the
IlvSimpleGraphic superclass is used to draw the outline of the polygons.
IlvGraphicPath defines a second palette (
backgroundPalette) to fill them.
While the resources (graphic attributes such as color) used to draw the polypoints for both the
IlvGraphicPath and
IlvPolygon functions are the same, the ways in which the shapes affect each other are different. Each polypoint has an influence on the rendering of the other polypoints (not applicable in
IlvStrokeOnly mode). For example, depending on the position of its points, a polypoint may appear either as an ordinary polygon or as a hole in another polygon:
IlvGraphicPath also allows user-specific actions when the polypoints are drawn. This is done by attaching a data structure to the
IlvGraphicPath.
Note that the bounding box of
IlvGraphicPath does not take into consideration the bounding box of the graphic object displayed along the path. The
IlvGraphic is only known to the stepping data structure. However, the
IlvGraphicPath provides a member function which allows you to extend the bounding box of the graphic path by the given value:
void setBBoxExtent(IlUInt extent);
Usually you would do the following:
grpath->setPathDrawingData(new IlvPathDrawingData(step, obj));
grpath->setBBoxExtent(bboxExtension);
where bboxExtension is computed from the geometry of obj and the way it will be displayed (whether rotations are involved or not).
The diagonal of the object’s bounding box is a reasonable value for bboxExtension.
Version 6.1
Copyright © 2016, Rogue Wave Software, Inc. All Rights Reserved.