Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Utility functions. More...
Functions | |
void | IlvComputeArcBBox (const IlvRect &rect, IlFloat start, IlFloat range, IlvRect &bbox) |
Computes the bounding box of a portion of an ellipse. More... | |
void | IlvComputeArrow (const IlvPoint &from, const IlvPoint &to, IlFloat atpos, IlvPoint *points, IlvDim arrowBase=4, IlvDim arrowLength=8) |
Computes the points that define an arrow on a segment. More... | |
IlvPoint * | IlvCreateClosedSpline (IlUInt count, const IlvPoint *p, IlUInt &totalCount) |
Creates an array of points defining a closed Bézier spline. More... | |
IlvPoint * | IlvCreateOpenSpline (IlUInt count, const IlvPoint *points, IlUInt &totalCount) |
Creates an array of points defining an open Bézier spline. More... | |
IlBoolean | IlvIntersectHorizontal (const IlvPoint &point, const IlvPoint &from, const IlvPoint &to, IlInt *dir=0) |
Returns IlTrue if the horizontal line intercepts the segment. More... | |
IlBoolean | IlvLinesIntersect (const IlvPoint &from1, const IlvPoint &to1, const IlvPoint &from2, const IlvPoint &to2, IlvPoint *result=0) |
Returns IlTrue if there is an intersection point between two lines. More... | |
IlBoolean | IlvPointInClosedSpline (const IlvPoint &p, IlUInt count, const IlvPoint *points) |
Returns IlTrue if the point is in a closed spline. More... | |
IlBoolean | IlvPointInFilledSpline (const IlvPoint &p, IlUInt count, const IlvPoint *points, IlBoolean windingRule=IlFalse) |
Returns IlTrue if the point is in a filled spline. More... | |
IlBoolean | IlvPointInLine (const IlvPoint &p, const IlvPoint &from, const IlvPoint &to) |
Returns IlTrue if the point is in a line. More... | |
IlBoolean | IlvPointInPolygon (const IlvPoint &p, IlUInt count, const IlvPoint *poly, IlBoolean windingRule=IlFalse) |
Returns IlTrue if the point is in a polygon. More... | |
IlBoolean | IlvPointInPolyline (const IlvPoint &p, IlUInt count, const IlvPoint *poly) |
Returns IlTrue if the point is in a polyline. More... | |
IlBoolean | IlvPointInSpline (const IlvPoint &p, IlUInt count, const IlvPoint *points) |
Returns IlTrue if the point is in a spline. More... | |
char * | IlvReadString (istream &is, char *buffer=0) |
Reads a string from an input stream. More... | |
istream & | IlvSkipSpaces () |
Skip spaces in a stream. More... | |
istream & | IlvSkipTo (int character) |
Skip to a given character in a stream. More... | |
const char * | IlvSpc () |
Gets a 'space.'. More... | |
void | IlvWriteString (ostream &stream, const char *string) |
Writes a string to an output stream. More... | |
Utility functions.
[library display ilviews/util/util.h]
Computes the bounding box of a portion of an ellipse.
Use this global function to compute the bounding box of an arc.
rect | The rectangle that defines the size of the complete ellipse. |
start | The start angle of the desired arc in degrees. |
range | The angle range, in degrees, of the desired arc. |
bbox | The return value of this function. |
IlvArc
. IlvComputeArrow | ( | const IlvPoint & | from, |
const IlvPoint & | to, | ||
IlFloat | atpos, | ||
IlvPoint * | points, | ||
IlvDim | arrowBase = 4 , |
||
IlvDim | arrowLength = 8 |
||
) |
Computes the points that define an arrow on a segment.
Use this global function to compute the polygon points that define an arrow located on a line segment.
from | The starting point of the line segment. |
to | The ending point of the line segment. |
atpos | The position of the arrow on the segment:
|
points | An array of at least three points that will be set to the computed coordinates that define the arrow. |
arrowBase | Half the size of the arrow base. |
arrowLength | The length of the arrow head. |
IlvArrowLine
. Creates an array of points defining a closed Bézier spline.
This function creates the point arrays defining the edges of a closed shape that closely corresponds to the Bezier curve defined by the count points given in the points array.
count | The number of control points stored in points. |
points | The array of control points. |
totalCount | Is set to the number of output definition points. |
IlPoolOf(IlvPoint)
. IlvClosedSpline
, IlvCreateOpenSpline
, IlvSpline
. Creates an array of points defining an open Bézier spline.
This function creates the point arrays defining the edges of an open shape that closely corresponds to the Bezier curve defined by the count points given in the points array.
count | The number of control points stored in points. |
points | The array of control points. |
totalCount | Is set to the number of output definition points. |
IlPoolOf(IlvPoint)
. IlvClosedSpline
, IlvCreateClosedSpline
, IlvSpline
. IlBoolean IlvIntersectHorizontal | ( | const IlvPoint & | point, |
const IlvPoint & | from, | ||
const IlvPoint & | to, | ||
IlInt * | dir = 0 |
||
) |
Returns IlTrue
if the horizontal line intercepts the segment.
point | A point of the horizontal line. |
from | First point of the segment. |
to | Last point of the segment. |
dir | Indicates how the horizontal line crosses the segment. If the returned value is IlTrue and dir is not null , this function will increment or decrement *dir , whether the segment crosses the horizontal ray from right-to-left (+1) or from left-to-right (-1). If the segment is included in the horizontal ray, *dir is not modified. |
IlBoolean IlvLinesIntersect | ( | const IlvPoint & | from1, |
const IlvPoint & | to1, | ||
const IlvPoint & | from2, | ||
const IlvPoint & | to2, | ||
IlvPoint * | result = 0 |
||
) |
Returns IlTrue
if there is an intersection point between two lines.
from1 | First point of the first line. |
to1 | Last point of the first line. |
from2 | First point of the second line. |
to2 | Last point of the second line. |
result | Contains the coordinates of the intersection point if there is an intersection between the two lines. |
Returns IlTrue
if the point is in a closed spline.
p | The point. |
count | Point count of the closed spline. |
points | The points of the closed spline. |
IlBoolean IlvPointInFilledSpline | ( | const IlvPoint & | p, |
IlUInt | count, | ||
const IlvPoint * | points, | ||
IlBoolean | windingRule = IlFalse |
||
) |
Returns IlTrue
if the point is in a filled spline.
The algorithm of this function considers an infinite horizontal ray starting at the point and determines the intersections of this ray with the spline outline path. The results depend on the spline fill-rule: Odd-Even rule: the point is "in" if there is and odd number of intersections and "out" if it's an even number. Winding rule: the point is "in" if there is an unequal number of intersections from left to right and from right to left, as observed from the point. The point is "out" if these numbers are equal.
p | The point. |
count | Point count of the filled spline. |
points | The points of the filled spline. |
windingRule | If the value is IlTrue , the rule used is Winding, otherwise it is the Odd-Even rule. |
Returns IlTrue
if the point is in a line.
p | The point. |
from | First point of the line. |
to | Last point of the line. |
IlBoolean IlvPointInPolygon | ( | const IlvPoint & | p, |
IlUInt | count, | ||
const IlvPoint * | poly, | ||
IlBoolean | windingRule = IlFalse |
||
) |
Returns IlTrue
if the point is in a polygon.
The algorithm of this function considers an infinite horizontal ray starting at the point and determines the intersections of this ray with the polygon outline path. The results depend on the polygon fill-rule : Odd-Even rule: the point is "in" if there is and odd number of intersections and "out" if it's an even number. Winding rule: the point is "in" if there is an unequal number of intersections from left to right and from right to left, as observed from the point. The point is "out" if these numbers are equal.
p | The point. |
count | Point count of the polygon. |
poly | The points of the polygon. |
windingRule | If the value is IlTrue , the rule used is Winding, otherwise it is the Odd-Even rule. |
Returns IlTrue
if the point is in a polyline.
p | The point. |
count | Point count of the polyline. |
poly | The points of the polyline. |
Returns IlTrue
if the point is in a spline.
p | The point. |
count | Point count of the spline. |
points | The points of the spline. |
char* IlvReadString | ( | istream & | is, |
char * | buffer = 0 |
||
) |
Reads a string from an input stream.
Reads a complete description of a string from the input stream designated by stream and returns a pointer to the read character array.
You can specify a buffer where the returned string is stored. It must be large enough to hold the incoming data.
When reading a string, IlvReadString
expects an opening double quote character to start loading the data. It will convert C character escape sequences to regular characters, and will return when the closing double quote is reached.
stream | The input steam. |
buffer | If not 0 , this designates the buffer where the string is stored. If buffer is 0 , an internal buffer is allocated. |
0
), this buffer may be overwritten by another call in the library. It uses an IlPoolOf(Char)
. If you need to keep this buffer, lock the data (see IlPoolOf(NAME)
) or copy this string before you call another function of Rogue Wave Views. You must never try to delete this array. IlvWriteString
, IlvSkipSpaces
, IlvSkipTo
, ostream::operator>>
. istream& IlvSkipSpaces | ( | ) |
Skip spaces in a stream.
This function actually is manipulator that is, a class that acts like a function in a stream context.
Use it to skip unwanted space characters when reading from istreams.
This function moves the current read pointer of the stream to the character located after any space character. A character is considered to be a space character if it has one of the ASCII codes: 32 (space), 10 (line feed), 13 (carriage return) or 7 (tab). The stream is in an eof
state on return if the function cannot locate any space character in this input stream.
A common usage is to skip space areas before checking an incoming value:
IlvSpc
, IlvSkipTo
, IlvReadString
. istream& IlvSkipTo | ( | int | character | ) |
Skip to a given character in a stream.
This function actually is manipulator that is, a class that acts like a function in a stream context.
It moves the current read pointer of the stream to the character located just after the next character character. The stream is in eof
state on return if the given character cannot be located in this input stream.
A common use is to skip the closing delimiter of a block descriptor:
character | The character after which to move the read pointer. |
const char* IlvSpc | ( | ) |
Gets a 'space.'.
This global function returns a static string that contains only a white space, followed by the ending 0
. This is used internally to save static data space.
A common usage is to output spaces in output streams:
You must not modify nor delete the returned string.
IlvWriteString
, IlvSkipTo
, IlvSkipSpaces
. void IlvWriteString | ( | ostream & | stream, |
const char * | string | ||
) |
Writes a string to an output stream.
This function writes a complete description of the string
parameter into the indicated output stream. The output is made of an opening double quote character ("
) followed by the string contents, where each special character is replaced by its C
escape sequence. A closing double quote is added at the end of the output.
stream | The output stream. |
string | The string to be saved. |
IlvReadString
, IlvSpc
, ostream::operator<<
. © 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.