Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.trolltech.qt.gui
Class QPolygonF

    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.gui.QPolygonF

All Implemented Interfaces:
  QtJambiInterface, java.lang.Cloneable

    public class QPolygonF

extends QtJambiObject
implements java.lang.Cloneable

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.

See also:
  QVector, `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)` Reads a QPolygonF
`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()` Returns a string representation of the `this QPolygonF`.
`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)` Writes thisQPolygonF

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

### QPolygonF

    public QPolygonF()

  Constructs a polygon with no points.

See also:
  QVector::isEmpty().

### QPolygonF

    public QPolygonF(QPolygon a)

  Constructs a float based polygon from the specified integer based `polygon`.

See also:
  `toPolygon()`.

### QPolygonF

    public QPolygonF(QPolygonF a)

  Constructs a copy of the given `polygon`.

### QPolygonF

    public QPolygonF(QRectF r)

  Constructs a closed polygon from the specified `rectangle`.

  The polygon contains the four vertices of the rectangle in clockwise order starting and ending with the top-left vertex.

See also:
  `isClosed()`.

### QPolygonF

    public QPolygonF(java.util.List v)

  Constructs a polygon containing the specified `points`.

### QPolygonF

    public QPolygonF(int size)

  Constructs a polygon of the given `size`. Creates an empty polygon if `size` == 0.

See also:
  QVector::isEmpty().

Method Detail

### append

    public final void append(QPointF t)

  Appends `t` to this QPolygon.

### at

    public final QPointF at(int i)

  Returns the point at positions `i`.

### boundingRect

    public final QRectF boundingRect()

  Returns the bounding rectangle of the polygon, or `QRectF`(0,0,0,0) if the polygon is empty.

See also:
  QVector::isEmpty().

### clear

    public final void clear()

  Removes all points in this QPolygon.

### contains

    public final boolean contains(QPointF t)

  Returns true if this polygon contains the point `t`; otherwise, returns false.

### containsPoint

    public final 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.

### count

    public final int count()

  Returns the number of points in this QPolygonF.

### count

    public final int count(QPointF t)

  Returns the number of occurrences of `t` in this polygon.

### empty

    public final boolean empty()

  Returns true if this polygon contains no points; otherwise, returns false.

### first

    public final QPointF first()

  Returns the first point in this polygon.

### indexOf

    public final int indexOf(QPointF t)

  Returns the index of `t` in this polygon.

### indexOf

    public final int indexOf(QPointF t,
                             int from)

  Returns the index of `t` in this polygon.

### intersected

    public final QPolygonF intersected(QPolygonF r)

  Returns a polygon which is the intersection of this polygon and `r`.

### isClosed

    public final boolean isClosed()

  Returns true if the polygon is closed; otherwise returns false.

  A polygon is said to be closed if its start point and end point are equal.

See also:
  QVector::first(), and QVector::last().

### isEmpty

    public final boolean isEmpty()

  Returns true if this polygon contains no points; otherwise, returns false.

### last

    public final QPointF last()

  Returns the last point in this polygon.

### lastIndexOf

    public final int lastIndexOf(QPointF t)

  Returns the last index of `f` in this polygon.

### lastIndexOf

    public final int lastIndexOf(QPointF t,
                                 int from)

  Returns the last index of `f` in this polygon.

### writeTo

    public final void writeTo(QDataStream stream)

  Writes thisQPolygonF

### readFrom

    public final void readFrom(QDataStream stream)

  Reads a QPolygonF

### pop_back

    public final void pop_back()

  Removes the last point in this polygon and returns it.

### pop_front

    public final void pop_front()

  Removes the first point in this poligon and returns that point.

### prepend

    public final void prepend(QPointF t)

  Inserts the point `t` first in the polygon's point list.

### remove

    public final void remove(int i)

  Removes the point at index `i` from the array.

### remove

    public final void remove(int i,
                             int n)

  Remove `n` points from the point at index `i` in this polygon.

### replace

    public final void replace(int i,
                              QPointF t)

  Replaces the item at index position `i` with `t`.

  `i` must be a valid index position in the polygon

### size

    public final int size()

  Returns the number of points in this polygon.

### subtracted

    public final QPolygonF subtracted(QPolygonF r)

  Returns a polygon which is `r` subtracted from this polygon.

### toList

    public final java.util.List toList()

  Returns the points of this polygon in a list.-

### toPolygon

    public final QPolygon toPolygon()

  Creates and returns a `QPolygon` by converting each `QPointF` to a `QPoint`.

See also:
  `QPointF::toPoint()`.

### translate

    public final void translate(QPointF offset)

  Translate all points in the polygon by the given `offset`.

### translate

    public final void translate(double dx,
                                double dy)

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

### united

    public final QPolygonF united(QPolygonF r)

  Returns a polygon which is the union of this polygon and `r`.

See also:
  `intersected()`, and `subtracted()`.

### fromList

    public static java.util.List fromList(java.util.List list)

  Creates a polygon with the points in `list`.

### add

    public final QPolygonF add(double x,
                               double y)

  Adds the point (`x`, `y`) to the end of this polygon's point list.

### add

    public final QPolygonF add(QPointF pt)

  Adds `pt` to the end of this polygons point list.

### add

    public final QPolygonF add(QPolygonF p)

  Appends the points of `p` to the end of this polygons point list.

### toString

    public java.lang.String toString()

  Returns a string representation of the `this QPolygonF`.

  Overrides:
    `toString` in class `java.lang.Object`

### clone

    public QPolygonF clone()

  This method is reimplemented for internal reasons

  Overrides:
    `clone` in class `java.lang.Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD