LineString Class Reference

A collection of Point objects to describe a line. More...

#include <linestring.h>

Inheritance diagram for LineString:

Curve Geometry

List of all members.

Public Slots

virtual void setVisible (bool visible)
 if visible is true, the layer is made visible

Signals

void geometryClicked (Geometry *geometry, QPoint point)
 This signal is emitted when a Geometry is clicked.
void positionChanged (Geometry *geom)
 A Geometry emits this signal, when its position gets changed.

Public Member Functions

void addPoint (Point *point)
 adds a point at the end of the LineString
virtual QRectF boundingBox ()
 returns the BoundingBox
virtual QList< Geometry * > clickedPoints ()
 returns the clicked Points
bool Equals (Geometry *geom)
virtual bool hasClickedPoints () const
 returns true if the LineString has clicked Points
virtual bool hasPoints () const
 returns true if the LineString has Childs
bool isVisible () const
 returns true if this Geometry is visible
 LineString (QList< Point * > const points, QString name=QString(), QPen *pen=0)
 constructor
QString name () const
 returns the name of this Geometry
int numberOfPoints () const
 returns the number of Points the LineString consists of
GeometryparentGeometry () const
 returns the parent Geometry of this Geometry
QPen * pen () const
 returns the QPen which is used on drawing
QList< Point * > points ()
 returns the points of the LineString
void setName (QString name)
 sets the name of the geometry
void setPoints (QList< Point * > points)
 sets the given list as points of the LineString
QString toString ()
 returns a String representation of this Geometry


Detailed Description

A collection of Point objects to describe a line.

A LineString is a Curve with linear interpolation between Points. Each consecutive pair of Points defines a Line segment.

Author:
Kai Winter <kaiwinter@gmx.de>

Constructor & Destructor Documentation

LineString ( QList< Point * > const   points,
QString  name = QString(),
QPen *  pen = 0 
)

constructor

The constructor of a LineString takes a list of Points to form a line.

Parameters:
points a list of points
name the name of the LineString
pen a QPen can be used to modify the look of the line.
See also:
http://doc.trolltech.com/4.3/qpen.html

References LineString::setPoints().


Member Function Documentation

void addPoint ( Point point  ) 

adds a point at the end of the LineString

Parameters:
point the point which should be added to the LineString

QRectF boundingBox (  )  [virtual]

returns the BoundingBox

The bounding box in world coordinates

Returns:
the BoundingBox

Implements Geometry.

References Point::latitude(), and Point::longitude().

QList< Geometry * > clickedPoints (  )  [virtual]

returns the clicked Points

If a LineString was clicked it could be neccessary to figure out which of its points where clicked. Do do so the methods hasPoints() and clickedPoints() can be used. When a point is added to a LineString the Point becomes its child. It is possible (depending on the zoomfactor) to click more than one Point of a LineString, so this method returns a list.

Returns:
the clicked Points of the LineString

Reimplemented from Geometry.

bool Equals ( Geometry geom  )  [inherited]

returns true if the given Geometry is equal to this Geometry not implemented yet!

Parameters:
geom The Geometry to be tested
Returns:
true if the given Geometry is equal to this

void geometryClicked ( Geometry geometry,
QPoint  point 
) [signal, inherited]

This signal is emitted when a Geometry is clicked.

A Geometry is clickable, if the containing layer is clickable. The objects emits a signal if it gets clicked

Parameters:
geometry The clicked Geometry
point -unused-

Referenced by Point::Touches().

bool hasClickedPoints (  )  const [virtual]

returns true if the LineString has clicked Points

Returns:
true if childs of a LineString were clicked
See also:
clickedPoints()

Reimplemented from Geometry.

bool hasPoints (  )  const [virtual]

returns true if the LineString has Childs

This is equal to: numberOfPoints() > 0

Returns:
true it the LineString has Childs (=Points)
See also:
clickedPoints()

Reimplemented from Geometry.

bool isVisible (  )  const [inherited]

returns true if this Geometry is visible

Returns:
true if this Geometry is visible

Referenced by Point::Touches().

QString name (  )  const [inherited]

returns the name of this Geometry

Returns:
the name of this Geometry

int numberOfPoints (  )  const

returns the number of Points the LineString consists of

Returns:
the number of the LineString´s Points

Geometry * parentGeometry (  )  const [inherited]

returns the parent Geometry of this Geometry

A LineString is a composition of many Points. This methods returns the parent (the LineString) of a Point

Returns:
the parent Geometry of this Geometry

QPen * pen (  )  const [inherited]

returns the QPen which is used on drawing

The pen is set depending on the Geometry. A CirclePoint for example takes one with the constructor.

Returns:
the QPen which is used for drawing

QList< Point * > points (  )  [virtual]

returns the points of the LineString

Returns:
a list with the points of the LineString

Implements Geometry.

void positionChanged ( Geometry geom  )  [signal, inherited]

A Geometry emits this signal, when its position gets changed.

Parameters:
geom the Geometry

void setName ( QString  name  )  [inherited]

sets the name of the geometry

Parameters:
name the new name of the geometry

void setPoints ( QList< Point * >  points  ) 

sets the given list as points of the LineString

Parameters:
points the points which should be set for the LineString

Referenced by LineString::LineString().

void setVisible ( bool  visible  )  [virtual, slot, inherited]

if visible is true, the layer is made visible

Parameters:
visible if the layer should be visible

Reimplemented in Point.

References Geometry::boundingBox().

QString toString (  )  [inherited]

returns a String representation of this Geometry

not implemented yet!

Returns:
a String representation of this Geometry


The documentation for this class was generated from the following files:

Generated on Wed Jul 29 12:38:10 2009 for QMapControl by  doxygen 1.5.9