QGIS API Documentation  2.6.0-Brighton
 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)
 create a new generic feature
virtual ~FeaturePart ()
 Delete the feature.
int setPositionForPoint (double x, double y, double scale, LabelPosition ***lPos, double delta_width, double angle)
 generate candidates for point feature Generate candidates for point features
int setPositionOverPoint (double x, double y, double scale, LabelPosition ***lPos, double delta_width, double angle)
 generate one candidate over specified point
int setPositionForLine (double scale, LabelPosition ***lPos, PointSet *mapShape, double delta_width)
 generate candidates for line feature Generate candidates for line features
LabelPosition * curvedPlacementAtOffset (PointSet *path_positions, double *path_distances, int orientation, int index, double distance)
int setPositionForLineCurved (LabelPosition ***lPos, PointSet *mapShape)
 Generate curved candidates for line features.
int setPositionForPolygon (double scale, LabelPosition ***lPos, PointSet *mapShape, double delta_width)
 generate candidates for point feature Generate candidates for point features
Feature * getFeature ()
 return the feature
const GEOSGeometry * getGeometry () const
 return the geometry
Layer * getLayer ()
 return the layer that feature belongs to
int setPosition (double scale, 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
const char * getUID ()
 get the unique id of the feature
void print ()
 Print feature information Print feature unique id, geometry type, points, and holes on screen.
PalGeometry * getUserGeometry ()
void setLabelSize (double lx, double ly)
double getLabelWidth () const
double getLabelHeight () const
void setLabelDistance (double dist)
double getLabelDistance () const
void setLabelInfo (LabelInfo *info)
bool getFixedRotation ()
double getLabelAngle ()
bool getFixedPosition ()
bool getAlwaysShow ()
int getNumSelfObstacles () const
PointSet * getSelfObstacle (int i)
bool isConnected (FeaturePart *p2)
 check whether this part is connected with some other part
bool mergeWithFeaturePart (FeaturePart *other)
 merge other (connected) part with this one and save the result in this part (other is unchanged).
void addSizePenalty (int nbp, LabelPosition **lPos, double bbx[4], double bby[4])
- Public Member Functions inherited from pal::PointSet
 PointSet ()
 PointSet (int nbPoints, double *x, double *y)
virtual ~PointSet ()
PointSet * extractShape (int nbPtSh, int imin, int imax, int fps, int fpe, double fptx, double fpty)
PointSet * createProblemSpecificPointSet (double bbmin[2], double bbmax[2], bool *inside)
CHullBox * compute_chull_bbox ()
double getDist (double px, double py, double *rx, double *ry)
 return the minimum distance bw this and the point (px,py)
void getCentroid (double &px, double &py, bool forceInside=false)
int getGeosType () const
void getBoundingBox (double min[2], double max[2]) const
PointSet * getHoleOf ()
 returns NULL if this isn't a hole.
int getNumPoints () const
void getPoint (double *d, double *ad, double dl, double *px, double *py)

Protected Member Functions

void extractCoords (const GEOSGeometry *geom)
 read coordinates from a GEOS geom
void removeDuplicatePoints ()
 find duplicate (or nearly duplicate points) and remove them.
- Protected Member Functions inherited from pal::PointSet
 PointSet (double x, double y)
 PointSet (PointSet &ps)
void deleteCoords ()

Protected Attributes

Feature * f
int nbHoles
PointSet ** holes
GEOSGeometry * the_geom
bool ownsGeom
- Protected Attributes inherited from pal::PointSet
int nbPoints
double * x
double * y
int * cHull
int cHullSize
int type
PointSet * holeOf
PointSet * parent
double xmin
double xmax
double ymin
double ymax

Additional Inherited Members

- Static Public Member Functions inherited from pal::PointSet
static void splitPolygons (LinkedList< PointSet * > *shapes_toProcess, LinkedList< PointSet * > *shapes_final, double xrm, double yrm, char *uid)

Detailed Description

Main class to handle feature.

Constructor & Destructor Documentation

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

create a new generic feature

Parameters
feata pointer for a Feat which contains the spatial entites
geoma pointer to a GEOS geometry
pal::FeaturePart::~FeaturePart ( )
virtual

Delete the feature.

Member Function Documentation

void pal::FeaturePart::addSizePenalty ( int  nbp,
LabelPosition **  lPos,
double  bbx[4],
double  bby[4] 
)
LabelPosition * pal::FeaturePart::curvedPlacementAtOffset ( PointSet *  path_positions,
double *  path_distances,
int  orientation,
int  index,
double  distance 
)
void pal::FeaturePart::extractCoords ( const GEOSGeometry *  geom)
protected

read coordinates from a GEOS geom

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

return the feature

Returns
the feature
bool pal::FeaturePart::getFixedPosition ( )
inline
bool pal::FeaturePart::getFixedRotation ( )
inline
const GEOSGeometry* pal::FeaturePart::getGeometry ( ) const
inline

return the geometry

Returns
the geometry
double pal::FeaturePart::getLabelAngle ( )
inline
double pal::FeaturePart::getLabelDistance ( ) const
inline
double pal::FeaturePart::getLabelHeight ( ) const
inline
double pal::FeaturePart::getLabelWidth ( ) const
inline
Layer * pal::FeaturePart::getLayer ( )

return the layer that feature belongs to

Returns
the layer of the feature
int pal::FeaturePart::getNumSelfObstacles ( ) const
inline
PointSet* pal::FeaturePart::getSelfObstacle ( int  i)
inline
const char * pal::FeaturePart::getUID ( )

get the unique id of the feature

Returns
the feature unique identifier
PalGeometry* pal::FeaturePart::getUserGeometry ( )
inline
bool pal::FeaturePart::isConnected ( FeaturePart *  p2)

check whether this part is connected with some other part

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

void pal::FeaturePart::print ( )

Print feature information Print feature unique id, geometry type, points, and holes on screen.

void pal::FeaturePart::removeDuplicatePoints ( )
protected

find duplicate (or nearly duplicate points) and remove them.

Probably to avoid numerical errors in geometry algorithms.

void pal::FeaturePart::setLabelDistance ( double  dist)
inline
void pal::FeaturePart::setLabelInfo ( LabelInfo *  info)
inline
void pal::FeaturePart::setLabelSize ( double  lx,
double  ly 
)
inline
int pal::FeaturePart::setPosition ( double  scale,
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
scalethe map scale is 1:scale
lPospointer to candidates array in which candidates will be put
bbox_minmin values of the map extent
bbox_maxmax values of the map extent
mapShapegenerate candidates for this spatial entites
candidatesindex for candidates
Returns
the number of candidates in *lPos
int pal::FeaturePart::setPositionForLine ( double  scale,
LabelPosition ***  lPos,
PointSet *  mapShape,
double  delta_width 
)

generate candidates for line feature Generate candidates for line features

Parameters
scalemap scale is 1:scale
lPospointer to an array of candidates, will be filled by generated candidates
mapShapea pointer to the line
delta_widthdelta width
Returns
the number of generated cadidates
int pal::FeaturePart::setPositionForLineCurved ( LabelPosition ***  lPos,
PointSet *  mapShape 
)

Generate curved candidates for line features.

int pal::FeaturePart::setPositionForPoint ( double  x,
double  y,
double  scale,
LabelPosition ***  lPos,
double  delta_width,
double  angle 
)

generate candidates for point feature Generate candidates for point features

Parameters
xx coordinates of the point
yy coordinates of the point
scalemap scale is 1:scale
lPospointer to an array of candidates, will be filled by generated candidates
delta_widthdelta width
angleorientation of the label
Returns
the number of generated cadidates
int pal::FeaturePart::setPositionForPolygon ( double  scale,
LabelPosition ***  lPos,
PointSet *  mapShape,
double  delta_width 
)

generate candidates for point feature Generate candidates for point features

Parameters
scalemap scale is 1:scale
lPospointer to an array of candidates, will be filled by generated candidates
mapShapea pointer to the polygon
delta_widthdelta width
Returns
the number of generated cadidates
int pal::FeaturePart::setPositionOverPoint ( double  x,
double  y,
double  scale,
LabelPosition ***  lPos,
double  delta_width,
double  angle 
)

generate one candidate over specified point

Member Data Documentation

Feature* pal::FeaturePart::f
protected
PointSet** pal::FeaturePart::holes
protected
int pal::FeaturePart::nbHoles
protected
bool pal::FeaturePart::ownsGeom
protected
GEOSGeometry* pal::FeaturePart::the_geom
protected

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