You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
286 lines
16 KiB
286 lines
16 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
4 months ago
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/tqpointarray.cpp:47 -->
|
||
13 years ago
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>TQPointArray Class</title>
|
||
|
<style type="text/css"><!--
|
||
|
fn { margin-left: 1cm; text-indent: -1cm; }
|
||
|
a:link { color: #004faf; text-decoration: none }
|
||
|
a:visited { color: #672967; text-decoration: none }
|
||
|
body { background: #ffffff; color: black; }
|
||
|
--></style>
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
||
|
<tr bgcolor="#E5E5E5">
|
||
|
<td valign=center>
|
||
|
<a href="index.html">
|
||
|
<font color="#004faf">Home</font></a>
|
||
|
| <a href="classes.html">
|
||
|
<font color="#004faf">All Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped Classes</font></a>
|
||
|
| <a href="functions.html">
|
||
|
<font color="#004faf">Functions</font></a>
|
||
|
</td>
|
||
|
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>TQPointArray Class Reference</h1>
|
||
|
|
||
|
<p>The TQPointArray class provides an array of points.
|
||
|
<a href="#details">More...</a>
|
||
4 months ago
|
<p><tt>#include <<a href="tqpointarray-h.html">tqpointarray.h</a>></tt>
|
||
5 months ago
|
<p>Inherits <a href="tqmemarray.html">TQMemArray</a><TQPoint>.
|
||
4 months ago
|
<p><a href="tqpointarray-members.html">List of all member functions.</a>
|
||
13 years ago
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQPointArray"><b>TQPointArray</b></a> ()</li>
|
||
|
<li class=fn><a href="#~TQPointArray"><b>~TQPointArray</b></a> ()</li>
|
||
|
<li class=fn><a href="#TQPointArray-2"><b>TQPointArray</b></a> ( int size )</li>
|
||
|
<li class=fn><a href="#TQPointArray-3"><b>TQPointArray</b></a> ( const TQPointArray & a )</li>
|
||
|
<li class=fn><a href="#TQPointArray-4"><b>TQPointArray</b></a> ( const TQRect & r, bool closed = FALSE )</li>
|
||
|
<li class=fn>TQPointArray & <a href="#operator-eq"><b>operator=</b></a> ( const TQPointArray & a )</li>
|
||
|
<li class=fn>TQPointArray <a href="#copy"><b>copy</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#translate"><b>translate</b></a> ( int dx, int dy )</li>
|
||
|
<li class=fn>TQRect <a href="#boundingRect"><b>boundingRect</b></a> () const</li>
|
||
|
<li class=fn>void <a href="#point"><b>point</b></a> ( uint index, int * x, int * y ) const</li>
|
||
|
<li class=fn>TQPoint <a href="#point-2"><b>point</b></a> ( uint index ) const</li>
|
||
|
<li class=fn>void <a href="#setPoint"><b>setPoint</b></a> ( uint index, int x, int y )</li>
|
||
|
<li class=fn>void <a href="#setPoint-2"><b>setPoint</b></a> ( uint i, const TQPoint & p )</li>
|
||
|
<li class=fn>bool <a href="#putPoints"><b>putPoints</b></a> ( int index, int nPoints, int firstx, int firsty, ... )</li>
|
||
|
<li class=fn>bool <a href="#putPoints-3"><b>putPoints</b></a> ( int index, int nPoints, const TQPointArray & from, int fromIndex = 0 )</li>
|
||
|
<li class=fn>void <a href="#makeArc"><b>makeArc</b></a> ( int x, int y, int w, int h, int a1, int a2 )</li>
|
||
|
<li class=fn>void <a href="#makeEllipse"><b>makeEllipse</b></a> ( int x, int y, int w, int h )</li>
|
||
|
<li class=fn>void <a href="#makeArc-2"><b>makeArc</b></a> ( int x, int y, int w, int h, int a1, int a2, const TQWMatrix & xf )</li>
|
||
|
<li class=fn>TQPointArray <a href="#cubicBezier"><b>cubicBezier</b></a> () const</li>
|
||
|
</ul>
|
||
|
<h2>Related Functions</h2>
|
||
|
<ul>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQPointArray & a )</li>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQPointArray & a )</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The TQPointArray class provides an array of points.
|
||
|
<p>
|
||
|
|
||
|
|
||
4 months ago
|
<p> A TQPointArray is an array of <a href="tqpoint.html">TQPoint</a> objects. In addition to the
|
||
5 months ago
|
functions provided by <a href="tqmemarray.html">TQMemArray</a>, TQPointArray provides some
|
||
13 years ago
|
point-specific functions.
|
||
|
<p> For convenient reading and writing of the point data use
|
||
|
setPoints(), <a href="#putPoints">putPoints</a>(), <a href="#point">point</a>(), and <a href="#setPoint">setPoint</a>().
|
||
|
<p> For geometry operations use <a href="#boundingRect">boundingRect</a>() and <a href="#translate">translate</a>(). There
|
||
4 months ago
|
is also the <a href="tqwmatrix.html#map">TQWMatrix::map</a>() function for more general
|
||
13 years ago
|
transformations of TQPointArrays. You can also create arcs and
|
||
|
ellipses with <a href="#makeArc">makeArc</a>() and <a href="#makeEllipse">makeEllipse</a>().
|
||
5 months ago
|
<p> Among others, TQPointArray is used by <a href="tqpainter.html#drawLineSegments">TQPainter::drawLineSegments</a>(),
|
||
|
<a href="tqpainter.html#drawPolyline">TQPainter::drawPolyline</a>(), <a href="tqpainter.html#drawPolygon">TQPainter::drawPolygon</a>() and
|
||
|
<a href="tqpainter.html#drawCubicBezier">TQPainter::drawCubicBezier</a>().
|
||
13 years ago
|
<p> Note that because this class is a TQMemArray, copying an array and
|
||
5 months ago
|
modifying the copy modifies the original as well, i.e. a <a href="shclass.html#shallow-copy">shallow copy</a>. If you need a <a href="shclass.html#deep-copy">deep copy</a> use <a href="#copy">copy</a>() or <a href="tqmemarray.html#detach">detach</a>(), for example:
|
||
13 years ago
|
<p> <pre>
|
||
|
void drawGiraffe( const TQPointArray & r, TQPainter * p )
|
||
|
{
|
||
|
TQPointArray tmp = r;
|
||
5 months ago
|
tmp.<a href="tqmemarray.html#detach">detach</a>();
|
||
13 years ago
|
// some code that modifies tmp
|
||
|
p->drawPoints( tmp );
|
||
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p> If you forget the tmp.detach(), the const array will be modified.
|
||
4 months ago
|
<p> <p>See also <a href="tqpainter.html">TQPainter</a>, <a href="tqwmatrix.html">TQWMatrix</a>, <a href="tqmemarray.html">TQMemArray</a>, <a href="graphics.html">Graphics Classes</a>, <a href="images.html">Image Processing Classes</a>, and <a href="shared.html">Implicitly and Explicitly Shared Classes</a>.
|
||
13 years ago
|
|
||
|
<hr><h2>Member Function Documentation</h2>
|
||
|
<h3 class=fn><a name="TQPointArray"></a>TQPointArray::TQPointArray ()
|
||
|
</h3>
|
||
|
|
||
|
<p> Constructs a null point array.
|
||
5 months ago
|
<p> <p>See also <a href="tqmemarray.html#isNull">isNull</a>().
|
||
13 years ago
|
|
||
|
<h3 class=fn><a name="TQPointArray-2"></a>TQPointArray::TQPointArray ( int size )
|
||
|
</h3>
|
||
|
|
||
|
<p> Constructs a point array with room for <em>size</em> points. Makes a
|
||
|
null array if <em>size</em> == 0.
|
||
5 months ago
|
<p> <p>See also <a href="tqmemarray.html#resize">resize</a>() and <a href="tqmemarray.html#isNull">isNull</a>().
|
||
13 years ago
|
|
||
4 months ago
|
<h3 class=fn><a name="TQPointArray-3"></a>TQPointArray::TQPointArray ( const <a href="tqpointarray.html">TQPointArray</a> & a )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Constructs a <a href="shclass.html#shallow-copy">shallow copy</a> of the point array <em>a</em>.
|
||
5 months ago
|
<p> <p>See also <a href="#copy">copy</a>() and <a href="tqmemarray.html#detach">detach</a>().
|
||
13 years ago
|
|
||
4 months ago
|
<h3 class=fn><a name="TQPointArray-4"></a>TQPointArray::TQPointArray ( const <a href="tqrect.html">TQRect</a> & r, bool closed = FALSE )
|
||
13 years ago
|
</h3>
|
||
|
Constructs a point array from the rectangle <em>r</em>.
|
||
|
<p> If <em>closed</em> is FALSE, then the point array just contains the
|
||
|
following four points in the listed order: r.topLeft(),
|
||
|
r.topRight(), r.bottomRight() and r.bottomLeft().
|
||
|
<p> If <em>closed</em> is TRUE, then a fifth point is set to r.topLeft().
|
||
|
|
||
|
<h3 class=fn><a name="~TQPointArray"></a>TQPointArray::~TQPointArray ()
|
||
|
</h3>
|
||
|
|
||
|
<p> Destroys the point array.
|
||
|
|
||
4 months ago
|
<h3 class=fn><a href="tqrect.html">TQRect</a> <a name="boundingRect"></a>TQPointArray::boundingRect () const
|
||
13 years ago
|
</h3>
|
||
|
Returns the bounding rectangle of the points in the array, or
|
||
4 months ago
|
<a href="tqrect.html">TQRect</a>(0,0,0,0) if the array is empty.
|
||
13 years ago
|
|
||
4 months ago
|
<h3 class=fn><a href="tqpointarray.html">TQPointArray</a> <a name="copy"></a>TQPointArray::copy () const
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Creates a <a href="shclass.html#deep-copy">deep copy</a> of the array.
|
||
5 months ago
|
<p> <p>See also <a href="tqmemarray.html#detach">detach</a>().
|
||
13 years ago
|
|
||
4 months ago
|
<h3 class=fn><a href="tqpointarray.html">TQPointArray</a> <a name="cubicBezier"></a>TQPointArray::cubicBezier () const
|
||
13 years ago
|
</h3>
|
||
|
Returns the Bezier points for the four control points in this
|
||
|
array.
|
||
|
|
||
|
<h3 class=fn>void <a name="makeArc"></a>TQPointArray::makeArc ( int x, int y, int w, int h, int a1, int a2 )
|
||
|
</h3>
|
||
|
Sets the points of the array to those describing an arc of an
|
||
|
ellipse with size, width <em>w</em> by height <em>h</em>, and position (<em>x</em>,
|
||
|
<em>y</em>), starting from angle <em>a1</em> and spanning by angle <em>a2</em>. The
|
||
|
resulting array has sufficient resolution for pixel accuracy (see
|
||
4 months ago
|
the overloaded function which takes an additional <a href="tqwmatrix.html">TQWMatrix</a>
|
||
13 years ago
|
parameter).
|
||
|
<p> Angles are specified in 16ths of a degree, i.e. a full circle
|
||
|
equals 5760 (16*360). Positive values mean counter-clockwise,
|
||
|
whereas negative values mean the clockwise direction. Zero degrees
|
||
|
is at the 3 o'clock position.
|
||
6 months ago
|
<p> See the <a href="tqcanvasellipse.html#anglediagram">angle diagram</a>.
|
||
13 years ago
|
|
||
4 months ago
|
<h3 class=fn>void <a name="makeArc-2"></a>TQPointArray::makeArc ( int x, int y, int w, int h, int a1, int a2, const <a href="tqwmatrix.html">TQWMatrix</a> & xf )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the points of the array to those describing an arc of an
|
||
|
ellipse with width <em>w</em> and height <em>h</em> and position (<em>x</em>, <em>y</em>),
|
||
|
starting from angle <em>a1</em>, and spanning angle by <em>a2</em>, and
|
||
|
transformed by the matrix <em>xf</em>. The resulting array has
|
||
|
sufficient resolution for pixel accuracy.
|
||
|
<p> Angles are specified in 16ths of a degree, i.e. a full circle
|
||
|
equals 5760 (16*360). Positive values mean counter-clockwise,
|
||
|
whereas negative values mean the clockwise direction. Zero degrees
|
||
|
is at the 3 o'clock position.
|
||
6 months ago
|
<p> See the <a href="tqcanvasellipse.html#anglediagram">angle diagram</a>.
|
||
13 years ago
|
|
||
|
<h3 class=fn>void <a name="makeEllipse"></a>TQPointArray::makeEllipse ( int x, int y, int w, int h )
|
||
|
</h3>
|
||
|
Sets the points of the array to those describing an ellipse with
|
||
|
size, width <em>w</em> by height <em>h</em>, and position (<em>x</em>, <em>y</em>).
|
||
|
<p> The returned array has sufficient resolution for use as pixels.
|
||
|
|
||
4 months ago
|
<h3 class=fn><a href="tqpointarray.html">TQPointArray</a> & <a name="operator-eq"></a>TQPointArray::operator= ( const <a href="tqpointarray.html">TQPointArray</a> & a )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Assigns a <a href="shclass.html#shallow-copy">shallow copy</a> of <em>a</em> to this point array and returns a
|
||
|
reference to this point array.
|
||
5 months ago
|
<p> Equivalent to <a href="tqmemarray.html#assign">assign</a>(a).
|
||
|
<p> <p>See also <a href="#copy">copy</a>() and <a href="tqmemarray.html#detach">detach</a>().
|
||
13 years ago
|
|
||
|
<h3 class=fn>void <a name="point"></a>TQPointArray::point ( uint index, int * x, int * y ) const
|
||
|
</h3>
|
||
|
Reads the coordinates of the point at position <em>index</em> within the
|
||
|
array and writes them into <em>*x</em> and <em>*y</em>.
|
||
|
|
||
4 months ago
|
<h3 class=fn><a href="tqpoint.html">TQPoint</a> <a name="point-2"></a>TQPointArray::point ( uint index ) const
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Returns the point at position <em>index</em> within the array.
|
||
|
|
||
|
<h3 class=fn>bool <a name="putPoints"></a>TQPointArray::putPoints ( int index, int nPoints, int firstx, int firsty, ... )
|
||
|
</h3>
|
||
|
Copies <em>nPoints</em> points from the variable argument list into this
|
||
|
point array from position <em>index</em>, and resizes the point array if
|
||
|
<tt>index+nPoints</tt> exceeds the size of the array.
|
||
|
<p> Returns TRUE if successful, or FALSE if the array could not be
|
||
|
resized (typically due to lack of memory).
|
||
|
<p> The example code creates an array with three points (4,5), (6,7)
|
||
|
and (8,9), by expanding the array from 1 to 3 points:
|
||
|
<p> <pre>
|
||
|
TQPointArray a( 1 );
|
||
|
a[0] = TQPoint( 4, 5 );
|
||
|
a.<a href="#putPoints">putPoints</a>( 1, 2, 6,7, 8,9 ); // index == 1, points == 2
|
||
|
</pre>
|
||
|
|
||
|
<p> This has the same result, but here putPoints overwrites rather
|
||
|
than extends:
|
||
|
<pre>
|
||
|
TQPointArray a( 3 );
|
||
|
a.<a href="#putPoints">putPoints</a>( 0, 3, 4,5, 0,0, 8,9 );
|
||
|
a.<a href="#putPoints">putPoints</a>( 1, 1, 6,7 );
|
||
|
</pre>
|
||
|
|
||
|
<p> The points are given as a sequence of integers, starting with <em>firstx</em> then <em>firsty</em>, and so on.
|
||
5 months ago
|
<p> <p>See also <a href="tqmemarray.html#resize">resize</a>().
|
||
13 years ago
|
|
||
4 months ago
|
<h3 class=fn>bool <a name="putPoints-3"></a>TQPointArray::putPoints ( int index, int nPoints, const <a href="tqpointarray.html">TQPointArray</a> & from, int fromIndex = 0 )
|
||
13 years ago
|
</h3>
|
||
|
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> This version of the function copies <em>nPoints</em> from <em>from</em> into
|
||
|
this array, starting at <em>index</em> in this array and <em>fromIndex</em> in
|
||
|
<em>from</em>. <em>fromIndex</em> is 0 by default.
|
||
|
<p> <pre>
|
||
|
TQPointArray a;
|
||
|
a.<a href="#putPoints">putPoints</a>( 0, 3, 1,2, 0,0, 5,6 );
|
||
|
// a is now the three-point array ( 1,2, 0,0, 5,6 );
|
||
|
TQPointArray b;
|
||
|
b.<a href="#putPoints">putPoints</a>( 0, 3, 4,4, 5,5, 6,6 );
|
||
|
// b is now ( 4,4, 5,5, 6,6 );
|
||
|
a.<a href="#putPoints">putPoints</a>( 2, 3, b );
|
||
|
// a is now ( 1,2, 0,0, 4,4, 5,5, 6,6 );
|
||
|
</pre>
|
||
|
|
||
|
|
||
|
<h3 class=fn>void <a name="setPoint"></a>TQPointArray::setPoint ( uint index, int x, int y )
|
||
|
</h3>
|
||
|
Sets the point at position <em>index</em> in the array to <em>(x, y)</em>.
|
||
|
|
||
|
<p>Example: <a href="themes-example.html#x231">themes/wood.cpp</a>.
|
||
4 months ago
|
<h3 class=fn>void <a name="setPoint-2"></a>TQPointArray::setPoint ( uint i, const <a href="tqpoint.html">TQPoint</a> & p )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
|
||
|
<p> Sets the point at array index <em>i</em> to <em>p</em>.
|
||
|
|
||
|
<h3 class=fn>void <a name="translate"></a>TQPointArray::translate ( int dx, int dy )
|
||
|
</h3>
|
||
|
Translates all points in the array by <em>(dx, dy)</em>.
|
||
|
|
||
|
<hr><h2>Related Functions</h2>
|
||
4 months ago
|
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="tqdatastream.html">TQDataStream</a> & s, const <a href="tqpointarray.html">TQPointArray</a> & a )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Writes the point array, <em>a</em> to the stream <em>s</em> and returns a
|
||
|
reference to the stream.
|
||
|
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
||
|
|
||
4 months ago
|
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="tqdatastream.html">TQDataStream</a> & s, <a href="tqpointarray.html">TQPointArray</a> & a )
|
||
13 years ago
|
</h3>
|
||
|
|
||
|
<p> Reads a point array, <em>a</em> from the stream <em>s</em> and returns a
|
||
|
reference to the stream.
|
||
|
<p> <p>See also <a href="datastreamformat.html">Format of the TQDataStream operators</a>.
|
||
|
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
||
|
Copyright © 1995-2007
|
||
|
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
|
||
|
<table width=100% cellspacing=0 border=0><tr>
|
||
|
<td>Copyright © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|