|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.gui.QPolygonF
public class QPolygonF
The QPolygonF
class provides a vector of points using floating point precision. A QPolygonF
is a QVector<QPointF
>. The easiest way to add points to a QPolygonF
is to use its streaming operator, as illustrated below:
QPolygonF polygon = new QPolygonF(); polygon.add(new QPointF(10.4, 20.5)); polygon.add(new QPointF(20.2, 30.2));In addition to the functions provided by QVector,
QPolygonF
provides the boundingRect()
and translate()
functions for geometry operations. Use the QMatrix::map()
function for more general transformations of QPolygonFs. QPolygonF
also provides the isClosed()
function to determine whether a polygon's start and end points are the same, and the toPolygon()
function returning an integer precision copy of this polygon.
The QPolygonF
class is implicitly shared.
QPolygon
, and QLineF
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
QPolygonF()
Constructs a polygon with no points. |
|
QPolygonF(int size)
Constructs a polygon of the given size. |
|
QPolygonF(java.util.List v)
Constructs a polygon containing the specified points. |
|
QPolygonF(QPolygon a)
Constructs a float based polygon from the specified integer based polygon. |
|
QPolygonF(QPolygonF a)
Constructs a copy of the given polygon. |
|
QPolygonF(QRectF r)
Constructs a closed polygon from the specified rectangle. |
Method Summary | |
---|---|
QPolygonF |
add(double x,
double y)
Adds the point (x, y) to the end of this polygon's point list. |
QPolygonF |
add(QPointF pt)
Adds pt to the end of this polygons point list. |
QPolygonF |
add(QPolygonF p)
Appends the points of p to the end of this polygons point list. |
void |
append(QPointF t)
Appends t to this QPolygon. |
QPointF |
at(int i)
Returns the point at positions i. |
QRectF |
boundingRect()
Returns the bounding rectangle of the polygon, or QRectF (0,0,0,0) if the polygon is empty. |
void |
clear()
Removes all points in this QPolygon. |
QPolygonF |
clone()
This method is reimplemented for internal reasons |
boolean |
contains(QPointF t)
Returns true if this polygon contains the point t; otherwise, returns false. |
boolean |
containsPoint(QPointF pt,
Qt.FillRule fillRule)
Returns true if the given point is inside the polygon according to the specified fillRule; otherwise returns false. |
int |
count()
Returns the number of points in this QPolygonF. |
int |
count(QPointF t)
Returns the number of occurrences of t in this polygon. |
boolean |
empty()
Returns true if this polygon contains no points; otherwise, returns false. |
QPointF |
first()
Returns the first point in this polygon. |
static java.util.List |
fromList(java.util.List list)
Creates a polygon with the points in list. |
int |
indexOf(QPointF t)
Returns the index of t in this polygon. |
int |
indexOf(QPointF t,
int from)
Returns the index of t in this polygon. |
QPolygonF |
intersected(QPolygonF r)
Returns a polygon which is the intersection of this polygon and r. |
boolean |
isClosed()
Returns true if the polygon is closed; otherwise returns false. |
boolean |
isEmpty()
Returns true if this polygon contains no points; otherwise, returns false. |
QPointF |
last()
Returns the last point in this polygon. |
int |
lastIndexOf(QPointF t)
Returns the last index of f in this polygon. |
int |
lastIndexOf(QPointF t,
int from)
Returns the last index of f in this polygon. |
void |
pop_back()
Removes the last point in this polygon and returns it. |
void |
pop_front()
Removes the first point in this poligon and returns that point. |
void |
prepend(QPointF t)
Inserts the point t first in the polygon's point list. |
void |
readFrom(QDataStream stream)
|
void |
remove(int i)
Removes the point at index i from the array. |
void |
remove(int i,
int n)
Remove n points from the point at index i in this polygon. |
void |
replace(int i,
QPointF t)
Replaces the item at index position i with t. |
int |
size()
Returns the number of points in this polygon. |
QPolygonF |
subtracted(QPolygonF r)
Returns a polygon which is r subtracted from this polygon. |
java.util.List |
toList()
Returns the points of this polygon in a list.- |
QPolygon |
toPolygon()
Creates and returns a QPolygon by converting each QPointF to a QPoint . |
java.lang.String |
toString()
|
void |
translate(double dx,
double dy)
Translates all points in the polygon by (dx, dy). |
void |
translate(QPointF offset)
Translate all points in the polygon by the given offset. |
QPolygonF |
united(QPolygonF r)
Returns a polygon which is the union of this polygon and r. |
void |
writeTo(QDataStream stream)
|
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QPolygonF()
public QPolygonF(QPolygon a)
toPolygon()
.
public QPolygonF(QPolygonF a)
public QPolygonF(QRectF r)
The polygon contains the four vertices of the rectangle in clockwise order starting and ending with the top-left vertex.
isClosed()
.
public QPolygonF(java.util.List v)
public QPolygonF(int size)
Method Detail |
---|
public final void append(QPointF t)
public final QPointF at(int i)
public final QRectF boundingRect()
QRectF
(0,0,0,0) if the polygon is empty.
public final void clear()
public final boolean contains(QPointF t)
public final boolean containsPoint(QPointF pt, Qt.FillRule fillRule)
public final int count()
public final int count(QPointF t)
public final boolean empty()
public final QPointF first()
public final int indexOf(QPointF t)
public final int indexOf(QPointF t, int from)
public final QPolygonF intersected(QPolygonF r)
public final boolean isClosed()
A polygon is said to be closed if its start point and end point are equal.
public final boolean isEmpty()
public final QPointF last()
public final int lastIndexOf(QPointF t)
public final int lastIndexOf(QPointF t, int from)
public final void writeTo(QDataStream stream)
public final void readFrom(QDataStream stream)
public final void pop_back()
public final void pop_front()
public final void prepend(QPointF t)
public final void remove(int i)
public final void remove(int i, int n)
public final void replace(int i, QPointF t)
i must be a valid index position in the polygon
public final int size()
public final QPolygonF subtracted(QPolygonF r)
public final java.util.List toList()
public final QPolygon toPolygon()
QPolygon
by converting each QPointF
to a QPoint
. QPointF::toPoint()
.
public final void translate(QPointF offset)
public final void translate(double dx, double dy)
public final QPolygonF united(QPolygonF r)
intersected()
, and subtracted()
.
public static java.util.List fromList(java.util.List list)
public final QPolygonF add(double x, double y)
public final QPolygonF add(QPointF pt)
public final QPolygonF add(QPolygonF p)
public java.lang.String toString()
toString
in class java.lang.Object
public QPolygonF clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |