QGIS API Documentation  2.11.0-Master
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
pal::FeaturePart Class Reference

Main class to handle feature. More...

#include <feature.h>

Inheritance diagram for pal::FeaturePart:
Inheritance graph
[legend]

Public Member Functions

 FeaturePart (Feature *feat, const GEOSGeometry *geom)
 Creates a new generic feature. More...
 
virtual ~FeaturePart ()
 Delete the feature. More...
 
void addSizePenalty (int nbp, LabelPosition **lPos, double bbx[4], double bby[4])
 
LabelPositioncurvedPlacementAtOffset (PointSet *path_positions, double *path_distances, int orientation, int index, double distance)
 
bool getAlwaysShow ()
 
FeaturegetFeature ()
 Returns the parent feature. More...
 
bool getFixedPosition ()
 
bool getFixedRotation ()
 
double getLabelAngle ()
 
double getLabelDistance () const
 
double getLabelHeight () const
 
double getLabelWidth () const
 
int getNumSelfObstacles () const
 
FeaturePartgetSelfObstacle (int i)
 
QString getUID () const
 Returns the unique ID of the feature. More...
 
PalGeometrygetUserGeometry ()
 
bool isConnected (FeaturePart *p2)
 Check whether this part is connected with some other part. More...
 
Layerlayer ()
 Returns the layer that feature belongs to. More...
 
bool mergeWithFeaturePart (FeaturePart *other)
 Merge other (connected) part with this one and save the result in this part (other is unchanged). More...
 
void setLabelDistance (double dist)
 
void setLabelInfo (LabelInfo *info)
 
void setLabelSize (double lx, double ly)
 
int setPosition (LabelPosition ***lPos, double bbox_min[2], double bbox_max[2], PointSet *mapShape, RTree< LabelPosition *, double, 2, double > *candidates)
 Generic method to generate candidates. More...
 
int setPositionForLine (LabelPosition ***lPos, PointSet *mapShape)
 Generate candidates for line feature. More...
 
int setPositionForLineCurved (LabelPosition ***lPos, PointSet *mapShape)
 Generate curved candidates for line features. More...
 
int setPositionForPoint (double x, double y, LabelPosition ***lPos, double angle, PointSet *mapShape=0)
 Generate candidates for point feature, located around a specified point. More...
 
int setPositionForPolygon (LabelPosition ***lPos, PointSet *mapShape)
 Generate candidates for polygon features. More...
 
int setPositionOverPoint (double x, double y, LabelPosition ***lPos, double angle, PointSet *mapShape=0)
 Generate one candidate over or offset the specified point. More...
 
- Public Member Functions inherited from pal::PointSet
 PointSet ()
 
 PointSet (int nbPoints, double *x, double *y)
 
virtual ~PointSet ()
 
CHullBoxcompute_chull_bbox ()
 
bool containsLabelCandidate (double x, double y, double width, double height, double alpha=0) const
 Tests whether a possible label candidate will fit completely within the shape. More...
 
bool containsPoint (double x, double y) const
 Tests whether point set contains a specified point. More...
 
PointSetextractShape (int nbPtSh, int imin, int imax, int fps, int fpe, double fptx, double fpty)
 
const GEOSGeometry * geos () const
 Returns the point set's GEOS geometry. More...
 
void getBoundingBox (double min[2], double max[2]) const
 
void getCentroid (double &px, double &py, bool forceInside=false) const
 
int getGeosType () const
 
PointSetgetHoleOf ()
 Returns NULL if this isn't a hole. More...
 
int getNumPoints () const
 
void getPointByDistance (double distance, double *px, double *py) const
 Get a point a set distance along a line geometry. More...
 
double length () const
 Returns length of line geometry. More...
 
double minDistanceToPoint (double px, double py, double *rx=0, double *ry=0) const
 Returns the squared minimum distance between the point set geometry and the point (px,py) Optionally, the nearest point is stored in (rx,ry). More...
 

Protected Member Functions

void extractCoords (const GEOSGeometry *geom)
 read coordinates from a GEOS geom More...
 
- Protected Member Functions inherited from pal::PointSet
 PointSet (double x, double y)
 
 PointSet (const PointSet &ps)
 
void createGeosGeom () const
 
void deleteCoords ()
 
void invalidateGeos ()
 
const GEOSPreparedGeometry * preparedGeom () const
 

Protected Attributes

FeaturemFeature
 
QList< FeaturePart * > mHoles
 
- Protected Attributes inherited from pal::PointSet
int * cHull
 
int cHullSize
 
PointSetholeOf
 
GEOSGeometry * mGeos
 
bool mOwnsGeom
 
int nbPoints
 
PointSetparent
 
int type
 
double * x
 
double xmax
 
double xmin
 
double * y
 
double ymax
 
double ymin
 

Additional Inherited Members

- Static Public Member Functions inherited from pal::PointSet
static void splitPolygons (QLinkedList< PointSet * > &shapes_toProcess, QLinkedList< PointSet * > &shapes_final, double xrm, double yrm, const QString &uid)
 Split a concave shape into several convex shapes. More...
 

Detailed Description

Main class to handle feature.

Definition at line 203 of file feature.h.

Constructor & Destructor Documentation

pal::FeaturePart::FeaturePart ( Feature feat,
const GEOSGeometry *  geom 
)

Creates a new generic feature.

Parameters
feata pointer for a feature which contains the spatial entites
geoma pointer to a GEOS geometry

Definition at line 97 of file feature.cpp.

pal::FeaturePart::~FeaturePart ( )
virtual

Delete the feature.

Definition at line 114 of file feature.cpp.

Member Function Documentation

void pal::FeaturePart::addSizePenalty ( int  nbp,
LabelPosition **  lPos,
double  bbx[4],
double  bby[4] 
)

Definition at line 1313 of file feature.cpp.

LabelPosition * pal::FeaturePart::curvedPlacementAtOffset ( PointSet path_positions,
double *  path_distances,
int  orientation,
int  index,
double  distance 
)

Definition at line 647 of file feature.cpp.

void pal::FeaturePart::extractCoords ( const GEOSGeometry *  geom)
protected

read coordinates from a GEOS geom

Definition at line 123 of file feature.cpp.

bool pal::FeaturePart::getAlwaysShow ( )
inline

Definition at line 306 of file feature.h.

Feature* pal::FeaturePart::getFeature ( )
inline

Returns the parent feature.

Definition at line 264 of file feature.h.

bool pal::FeaturePart::getFixedPosition ( )
inline

Definition at line 305 of file feature.h.

bool pal::FeaturePart::getFixedRotation ( )
inline

Definition at line 303 of file feature.h.

double pal::FeaturePart::getLabelAngle ( )
inline

Definition at line 304 of file feature.h.

double pal::FeaturePart::getLabelDistance ( ) const
inline

Definition at line 300 of file feature.h.

double pal::FeaturePart::getLabelHeight ( ) const
inline

Definition at line 298 of file feature.h.

double pal::FeaturePart::getLabelWidth ( ) const
inline

Definition at line 297 of file feature.h.

int pal::FeaturePart::getNumSelfObstacles ( ) const
inline

Definition at line 308 of file feature.h.

FeaturePart* pal::FeaturePart::getSelfObstacle ( int  i)
inline

Definition at line 309 of file feature.h.

QString pal::FeaturePart::getUID ( ) const

Returns the unique ID of the feature.

Definition at line 188 of file feature.cpp.

PalGeometry* pal::FeaturePart::getUserGeometry ( )
inline

Definition at line 294 of file feature.h.

bool pal::FeaturePart::isConnected ( FeaturePart p2)

Check whether this part is connected with some other part.

Definition at line 1356 of file feature.cpp.

Layer * pal::FeaturePart::layer ( )

Returns the layer that feature belongs to.

Definition at line 183 of file feature.cpp.

bool pal::FeaturePart::mergeWithFeaturePart ( FeaturePart other)

Merge other (connected) part with this one and save the result in this part (other is unchanged).

Return true on success, false if the feature wasn't modified

Definition at line 1364 of file feature.cpp.

void pal::FeaturePart::setLabelDistance ( double  dist)
inline

Definition at line 299 of file feature.h.

void pal::FeaturePart::setLabelInfo ( LabelInfo info)
inline

Definition at line 301 of file feature.h.

void pal::FeaturePart::setLabelSize ( double  lx,
double  ly 
)
inline

Definition at line 296 of file feature.h.

int pal::FeaturePart::setPosition ( LabelPosition ***  lPos,
double  bbox_min[2],
double  bbox_max[2],
PointSet mapShape,
RTree< LabelPosition *, double, 2, double > *  candidates 
)

Generic method to generate candidates.

This method will call either setPositionFromPoint(), setPositionFromLine or setPositionFromPolygon

Parameters
lPospointer to an array of candidates, will be filled by generated candidates
bbox_minmin values of the map extent
bbox_maxmax values of the map extent
mapShapegenerate candidates for this spatial entity
candidatesindex for candidates
Returns
the number of candidates in *lPos

Definition at line 1222 of file feature.cpp.

int pal::FeaturePart::setPositionForLine ( LabelPosition ***  lPos,
PointSet mapShape 
)

Generate candidates for line feature.

Parameters
lPospointer to an array of candidates, will be filled by generated candidates
mapShapea pointer to the line
Returns
the number of generated candidates

Definition at line 494 of file feature.cpp.

int pal::FeaturePart::setPositionForLineCurved ( LabelPosition ***  lPos,
PointSet mapShape 
)

Generate curved candidates for line features.

Parameters
lPospointer to an array of candidates, will be filled by generated candidates
mapShapea pointer to the line
Returns
the number of generated candidates

Definition at line 851 of file feature.cpp.

int pal::FeaturePart::setPositionForPoint ( double  x,
double  y,
LabelPosition ***  lPos,
double  angle,
PointSet mapShape = 0 
)

Generate candidates for point feature, located around a specified point.

Parameters
xx coordinate of the point
yy coordinate of the point
lPospointer to an array of candidates, will be filled by generated candidates
angleorientation of the label
mapShapeoptional geometry of source polygon
Returns
the number of generated candidates

Definition at line 327 of file feature.cpp.

int pal::FeaturePart::setPositionForPolygon ( LabelPosition ***  lPos,
PointSet mapShape 
)

Generate candidates for polygon features.

Parameters
lPospointer to an array of candidates, will be filled by generated candidates
mapShapea pointer to the polygon
Returns
the number of generated candidates

Definition at line 967 of file feature.cpp.

int pal::FeaturePart::setPositionOverPoint ( double  x,
double  y,
LabelPosition ***  lPos,
double  angle,
PointSet mapShape = 0 
)

Generate one candidate over or offset the specified point.

Parameters
xx coordinate of the point
yy coordinate of the point
lPospointer to an array of candidates, will be filled by generated candidate
angleorientation of the label
mapShapeoptional geometry of source polygon
Returns
the number of generated candidates (always 1)

Definition at line 242 of file feature.cpp.

Member Data Documentation

Feature* pal::FeaturePart::mFeature
protected

Definition at line 322 of file feature.h.

QList<FeaturePart*> pal::FeaturePart::mHoles
protected

Definition at line 323 of file feature.h.


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