Eneboo - Documentación para desarrolladores
Métodos públicos | Métodos públicos estáticos | Atributos protegidos estáticos | Funciones relacionadas
Referencia de la Clase QPointArray

The QPointArray class provides an array of points. Más...

#include <qpointarray.h>

Diagrama de herencias de QPointArray
QMemArray< QPoint > QMemArray< QPoint > QGArray QGArray QGArray QGArray

Lista de todos los miembros.

Métodos públicos

 QPointArray ()
 ~QPointArray ()
 QPointArray (int size)
 QPointArray (const QPointArray &a)
 QPointArray (const QRect &r, bool closed=FALSE)
 QPointArray (int nPoints, const QCOORD *points)
QPointArrayoperator= (const QPointArray &a)
QPointArray copy () const
void translate (int dx, int dy)
QRect boundingRect () const
void point (uint i, int *x, int *y) const
QPoint point (uint i) const
void setPoint (uint i, int x, int y)
void setPoint (uint i, const QPoint &p)
bool setPoints (int nPoints, const QCOORD *points)
bool setPoints (int nPoints, int firstx, int firsty,...)
bool putPoints (int index, int nPoints, const QCOORD *points)
bool putPoints (int index, int nPoints, int firstx, int firsty,...)
bool putPoints (int index, int nPoints, const QPointArray &from, int fromIndex=0)
void makeArc (int x, int y, int w, int h, int a1, int a2)
void makeEllipse (int x, int y, int w, int h)
void makeArc (int x, int y, int w, int h, int a1, int a2, const QWMatrix &)
QPointArray cubicBezier () const
void * shortPoints (int index=0, int nPoints=-1) const
 QPointArray ()
 ~QPointArray ()
 QPointArray (int size)
 QPointArray (const QPointArray &a)
 QPointArray (const QRect &r, bool closed=FALSE)
 QPointArray (int nPoints, const QCOORD *points)
QPointArrayoperator= (const QPointArray &a)
QPointArray copy () const
void translate (int dx, int dy)
QRect boundingRect () const
void point (uint i, int *x, int *y) const
QPoint point (uint i) const
void setPoint (uint i, int x, int y)
void setPoint (uint i, const QPoint &p)
bool setPoints (int nPoints, const QCOORD *points)
bool setPoints (int nPoints, int firstx, int firsty,...)
bool putPoints (int index, int nPoints, const QCOORD *points)
bool putPoints (int index, int nPoints, int firstx, int firsty,...)
bool putPoints (int index, int nPoints, const QPointArray &from, int fromIndex=0)
void makeArc (int x, int y, int w, int h, int a1, int a2)
void makeEllipse (int x, int y, int w, int h)
void makeArc (int x, int y, int w, int h, int a1, int a2, const QWMatrix &)
QPointArray cubicBezier () const
void * shortPoints (int index=0, int nPoints=-1) const

Métodos públicos estáticos

static void cleanBuffers ()
static void cleanBuffers ()

Atributos protegidos estáticos

static uint splen = 0
static void * sp = 0

Funciones relacionadas

(Observar que estas no son funciones miembro.)

QDataStreamoperator<< (QDataStream &s, const QPointArray &a)
QDataStreamoperator>> (QDataStream &s, QPointArray &a)

Descripción detallada

The QPointArray class provides an array of points.

A QPointArray is an array of QPoint objects. In addition to the functions provided by QMemArray, QPointArray provides some point-specific functions.

For convenient reading and writing of the point data use setPoints(), putPoints(), point(), and setPoint().

For geometry operations use boundingRect() and translate(). There is also the QWMatrix::map() function for more general transformations of QPointArrays. You can also create arcs and ellipses with makeArc() and makeEllipse().

Among others, QPointArray is used by QPainter::drawLineSegments(), QPainter::drawPolyline(), QPainter::drawPolygon() and QPainter::drawCubicBezier().

Note that because this class is a QMemArray, copying an array and modifying the copy modifies the original as well, i.e. a shallow copy. If you need a deep copy use copy() or detach(), for example:

        void drawGiraffe( const QPointArray & r, QPainter * p )
        {
            QPointArray tmp = r;
            tmp.detach();
            // some code that modifies tmp
            p->drawPoints( tmp );
        }

If you forget the tmp.detach(), the const array will be modified.

Ver también:
QPainter QWMatrix QMemArray

Documentación del constructor y destructor

QPointArray::QPointArray ( ) [inline]

Constructs a null point array.

Ver también:
isNull()
QPointArray::~QPointArray ( ) [inline]

Destroys the point array.

QPointArray::QPointArray ( int  size) [inline]

Constructs a point array with room for size points. Makes a null array if size == 0.

Ver también:
resize(), isNull()
QPointArray::QPointArray ( const QPointArray a) [inline]

Constructs a shallow copy of the point array a.

Ver también:
copy() detach()
QPointArray::QPointArray ( const QRect r,
bool  closed = FALSE 
)

Constructs a point array from the rectangle r.

If closed 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().

If closed is TRUE, then a fifth point is set to r.topLeft().

QPointArray::QPointArray ( int  nPoints,
const QCOORD points 
)
QPointArray::QPointArray ( ) [inline]
QPointArray::~QPointArray ( ) [inline]
QPointArray::QPointArray ( int  size) [inline]
QPointArray::QPointArray ( const QPointArray a) [inline]
QPointArray::QPointArray ( const QRect r,
bool  closed = FALSE 
)
QPointArray::QPointArray ( int  nPoints,
const QCOORD points 
)

Documentación de las funciones miembro

QRect QPointArray::boundingRect ( ) const

Returns the bounding rectangle of the points in the array, or QRect(0,0,0,0) if the array is empty.

QRect QPointArray::boundingRect ( ) const
static void QPointArray::cleanBuffers ( ) [static]
void QPointArray::cleanBuffers ( ) [static]
QPointArray QPointArray::copy ( ) const [inline]

Creates a deep copy of the array.

Ver también:
detach()

Reimplementado de QMemArray< QPoint >.

QPointArray QPointArray::copy ( ) const [inline]

Reimplementado de QMemArray< QPoint >.

QPointArray QPointArray::cubicBezier ( ) const
QPointArray QPointArray::cubicBezier ( ) const

Returns the Bezier points for the four control points in this array.

void QPointArray::makeArc ( int  x,
int  y,
int  w,
int  h,
int  a1,
int  a2,
const QWMatrix xf 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the points of the array to those describing an arc of an ellipse with width w and height h and position (x, y), starting from angle a1, and spanning angle by a2, and transformed by the matrix xf. The resulting array has sufficient resolution for pixel accuracy.

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.

See the angle diagram.

void QPointArray::makeArc ( int  x,
int  y,
int  w,
int  h,
int  a1,
int  a2 
)
void QPointArray::makeArc ( int  x,
int  y,
int  w,
int  h,
int  a1,
int  a2,
const QWMatrix  
)
void QPointArray::makeArc ( int  x,
int  y,
int  w,
int  h,
int  a1,
int  a2 
)

Sets the points of the array to those describing an arc of an ellipse with size, width w by height h, and position (x, y), starting from angle a1 and spanning by angle a2. The resulting array has sufficient resolution for pixel accuracy (see the overloaded function which takes an additional QWMatrix parameter).

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.

See the angle diagram.

void QPointArray::makeEllipse ( int  x,
int  y,
int  w,
int  h 
)
void QPointArray::makeEllipse ( int  x,
int  y,
int  w,
int  h 
)

Sets the points of the array to those describing an ellipse with size, width w by height h, and position (x, y).

The returned array has sufficient resolution for use as pixels.

QPointArray & QPointArray::operator= ( const QPointArray a) [inline]

Assigns a shallow copy of a to this point array and returns a reference to this point array.

Equivalent to assign(a).

Ver también:
copy() detach()
QPointArray& QPointArray::operator= ( const QPointArray a) [inline]
void QPointArray::point ( uint  index,
int x,
int y 
) const

Reads the coordinates of the point at position index within the array and writes them into *x and *y.

void QPointArray::point ( uint  i,
int x,
int y 
) const
QPoint QPointArray::point ( uint  i) const
QPoint QPointArray::point ( uint  index) const

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Returns the point at position index within the array.

bool QPointArray::putPoints ( int  index,
int  nPoints,
int  firstx,
int  firsty,
  ... 
)
bool QPointArray::putPoints ( int  index,
int  nPoints,
const QPointArray from,
int  fromIndex = 0 
)
bool QPointArray::putPoints ( int  index,
int  nPoints,
const QCOORD points 
)
bool QPointArray::putPoints ( int  index,
int  nPoints,
const QCOORD points 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta.

bool QPointArray::putPoints ( int  index,
int  nPoints,
int  firstx,
int  firsty,
  ... 
)

Copies nPoints points from the variable argument list into this point array from position index, and resizes the point array if {index+nPoints} exceeds the size of the array.

Returns TRUE if successful, or FALSE if the array could not be resized (typically due to lack of memory).

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:

        QPointArray a( 1 );
        a[0] = QPoint( 4, 5 );
        a.putPoints( 1, 2, 6,7, 8,9 ); // index == 1, points == 2

This has the same result, but here putPoints overwrites rather than extends:

        QPointArray a( 3 );
        a.putPoints( 0, 3, 4,5, 0,0, 8,9 );
        a.putPoints( 1, 1, 6,7 );

The points are given as a sequence of integers, starting with firstx then firsty, and so on.

Ver también:
resize()
bool QPointArray::putPoints ( int  index,
int  nPoints,
const QPointArray from,
int  fromIndex = 0 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. This version of the function copies nPoints from from into this array, starting at index in this array and fromIndex in from. fromIndex is 0 by default.

        QPointArray a;
        a.putPoints( 0, 3, 1,2, 0,0, 5,6 );
        // a is now the three-point array ( 1,2, 0,0, 5,6 );
        QPointArray b;
        b.putPoints( 0, 3, 4,4, 5,5, 6,6 );
        // b is now ( 4,4, 5,5, 6,6 );
        a.putPoints( 2, 3, b );
        // a is now ( 1,2, 0,0, 4,4, 5,5, 6,6 );
void QPointArray::setPoint ( uint  i,
const QPoint p 
)
void QPointArray::setPoint ( uint  i,
const QPoint p 
) [inline]

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Sets the point at array index i to p.

void QPointArray::setPoint ( uint  i,
int  x,
int  y 
)
void QPointArray::setPoint ( uint  index,
int  x,
int  y 
)

Sets the point at position index in the array to (x, y).

bool QPointArray::setPoints ( int  nPoints,
int  firstx,
int  firsty,
  ... 
)

Esta es una función miembro sobrecargada que se suministra por conveniencia. Difiere de la anterior función solamente en los argumentos que acepta. Resizes the array to nPoints and sets the points in the array to the values taken from the variable argument list.

Returns TRUE if successful, or FALSE if the array could not be resized (typically due to lack of memory).

The example code creates an array with two points (1,2) and (3,4):

        QPointArray a;
        a.setPoints( 2, 1,2, 3,4 );

The points are given as a sequence of integers, starting with firstx then firsty, and so on.

Ver también:
resize(), putPoints()
bool QPointArray::setPoints ( int  nPoints,
const QCOORD points 
)
bool QPointArray::setPoints ( int  nPoints,
int  firstx,
int  firsty,
  ... 
)
bool QPointArray::setPoints ( int  nPoints,
const QCOORD points 
)
void * QPointArray::shortPoints ( int  index = 0,
int  nPoints = -1 
) const
void* QPointArray::shortPoints ( int  index = 0,
int  nPoints = -1 
) const
void QPointArray::translate ( int  dx,
int  dy 
)
void QPointArray::translate ( int  dx,
int  dy 
)

Translates all points in the array by (dx, dy).


Documentación de las funciones relacionadas y clases amigas

QDataStream & operator<< ( QDataStream s,
const QPointArray a 
) [related]

Writes the point array, a to the stream s and returns a reference to the stream.

Ver también:
Format of the QDataStream operators
QDataStream & operator>> ( QDataStream s,
QPointArray a 
) [related]

Reads a point array, a from the stream s and returns a reference to the stream.

Ver también:
Format of the QDataStream operators

Documentación de los datos miembro

static void * QPointArray::sp = 0 [static, protected]
static uint QPointArray::splen = 0 [static, protected]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'