QgsLine Class Reference
[Core]

#include <qgsline.h>

Collaboration diagram for QgsLine:

Collaboration graph
[legend]
List of all members.

Detailed Description

A simple line object composed of a begin and end point.

Comparisons (==, !=) honor the direction of the line. This means that flipped lines with the same coordinates are not considered to be equal.

For example, (1,1 2,2) != (2,2 1,1)

Definition at line 34 of file qgsline.h.

Public Member Functions

 QgsLine ()
 Default constructor.
 QgsLine (QgsPoint &p1, QgsPoint &p2)
 ~QgsLine ()
 Destructor.
void setBegin (QgsPoint &p1)
 Sets the begin point of the line.
void setEnd (QgsPoint &p2)
 Sets the end point of the line.
QgsPoint begin () const
 Get the begin point of the line.
QgsPoint end () const
 Get the end point of the line.
QString toString () const
 String representation of the line.
QString toString (int thePrecision) const
 As above but with precision for string representation of a line.
QString wellKnownText ()
bool operator== (const QgsLine &other)
 Equality operator.
bool operator!= (const QgsLine &other)
 Inequality operator.
QgsLineoperator= (const QgsLine &other)
 Assignment.

Private Attributes

QgsPoint mBegin
 Begin point.
QgsPoint mEnd
 End point.


Constructor & Destructor Documentation

QgsLine::QgsLine (  ) 

Default constructor.

Definition at line 22 of file qgsline.cpp.

QgsLine::QgsLine ( QgsPoint p1,
QgsPoint p2 
)

Create a line from two points

Parameters:
p1 begin point
p2 end point

Definition at line 27 of file qgsline.cpp.

QgsLine::~QgsLine (  ) 

Destructor.

Definition at line 33 of file qgsline.cpp.


Member Function Documentation

void QgsLine::setBegin ( QgsPoint p1  ) 

Sets the begin point of the line.

Sets the begin point of the line

Parameters:
p1 Beginning point of the line

Definition at line 38 of file qgsline.cpp.

References mBegin.

void QgsLine::setEnd ( QgsPoint p2  ) 

Sets the end point of the line.

Sets the end point of the line

Parameters:
p1 End point of the line

Definition at line 43 of file qgsline.cpp.

References mEnd.

QgsPoint QgsLine::begin (  )  const

Get the begin point of the line.

Get the begin point of the line

Returns:
Begin point of the line

Definition at line 49 of file qgsline.cpp.

References mBegin.

Referenced by operator!=(), operator=(), and operator==().

QgsPoint QgsLine::end (  )  const

Get the end point of the line.

Get the end point of the line

Returns:
End point of the line

Definition at line 55 of file qgsline.cpp.

References mEnd.

Referenced by operator!=(), operator=(), and operator==().

QString QgsLine::toString (  )  const

String representation of the line.

Definition at line 61 of file qgsline.cpp.

Referenced by operator<<().

QString QgsLine::toString ( int  thePrecision  )  const

As above but with precision for string representation of a line.

Definition at line 67 of file qgsline.cpp.

QString QgsLine::wellKnownText (  ) 

Return the well known text representation for the line. The wkt is created without an SRID.

Returns:
Well known text

Definition at line 76 of file qgsline.cpp.

bool QgsLine::operator== ( const QgsLine other  ) 

Equality operator.

bool QgsLine::operator!= ( const QgsLine other  ) 

Inequality operator.

Definition at line 83 of file qgsline.cpp.

References begin(), end(), mBegin, and mEnd.

QgsLine & QgsLine::operator= ( const QgsLine other  ) 

Assignment.

Definition at line 98 of file qgsline.cpp.

References begin(), end(), mBegin, and mEnd.


Member Data Documentation

QgsPoint QgsLine::mBegin [private]

Begin point.

Definition at line 93 of file qgsline.h.

Referenced by begin(), operator!=(), operator=(), and setBegin().

QgsPoint QgsLine::mEnd [private]

End point.

Definition at line 96 of file qgsline.h.

Referenced by end(), operator!=(), operator=(), and setEnd().


The documentation for this class was generated from the following files:
Generated on Wed Dec 17 01:51:24 2008 for Quantum GIS API Documentation by  doxygen 1.5.1