QGIS API Documentation
2.14.0-Essen
|
Main class to handle feature. More...
#include <feature.h>
Public Member Functions | |
FeaturePart (QgsLabelFeature *lf, const GEOSGeometry *geom) | |
Creates a new generic feature. More... | |
FeaturePart (const FeaturePart &other) | |
virtual | ~FeaturePart () |
Delete the feature. More... | |
void | addSizePenalty (int nbp, QList< LabelPosition * > &lPos, double bbx[4], double bby[4]) |
double | calculatePriority () const |
Calculates the priority for the feature. More... | |
int | createCandidates (QList< LabelPosition * > &lPos, double bboxMin[2], double bboxMax[2], PointSet *mapShape, RTree< LabelPosition *, double, 2, double > *candidates) |
Generic method to generate label candidates for the feature. More... | |
int | createCandidatesAlongLine (QList< LabelPosition * > &lPos, PointSet *mapShape) |
Generate candidates for line feature. More... | |
int | createCandidatesAroundPoint (double x, double y, QList< LabelPosition * > &lPos, double angle, PointSet *mapShape=nullptr) |
Generate candidates for point feature, located around a specified point. More... | |
int | createCandidatesAtOrderedPositionsOverPoint (double x, double y, QList< LabelPosition * > &lPos, double angle) |
Generates candidates following a prioritised list of predefined positions around a point. More... | |
int | createCandidatesForPolygon (QList< LabelPosition * > &lPos, PointSet *mapShape) |
Generate candidates for polygon features. More... | |
int | createCandidatesOverPoint (double x, double y, QList< LabelPosition * > &lPos, double angle, PointSet *mapShape=nullptr) |
Generate one candidate over or offset the specified point. More... | |
int | createCurvedCandidatesAlongLine (QList< LabelPosition * > &lPos, PointSet *mapShape) |
Generate curved candidates for line features. More... | |
LabelPosition * | curvedPlacementAtOffset (PointSet *path_positions, double *path_distances, int orientation, int index, double distance) |
QgsLabelFeature * | feature () |
Returns the parent feature. More... | |
QgsFeatureId | featureId () const |
Returns the unique ID of the feature. More... | |
bool | getAlwaysShow () |
bool | getFixedPosition () |
bool | getFixedRotation () |
double | getLabelAngle () |
double | getLabelDistance () const |
double | getLabelHeight () const |
double | getLabelWidth () const |
int | getNumSelfObstacles () const |
Get number of holes (inner rings) - they are considered as obstacles. More... | |
FeaturePart * | getSelfObstacle (int i) |
Get hole (inner ring) - considered as obstacle. More... | |
bool | hasSameLabelFeatureAs (FeaturePart *part) const |
Tests whether this feature part belongs to the same QgsLabelFeature as another feature part. More... | |
bool | isConnected (FeaturePart *p2) |
Check whether this part is connected with some other part. More... | |
bool | isObstacle () |
Layer * | layer () |
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... | |
double | obstacleFactor () |
double | repeatDistance () |
Public Member Functions inherited from pal::PointSet | |
PointSet () | |
PointSet (int nbPoints, double *x, double *y) | |
virtual | ~PointSet () |
CHullBox * | compute_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... | |
PointSet * | extractShape (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 |
PointSet * | getHoleOf () |
Returns NULL if this isn't a hole. More... | |
int | getNumPoints () const |
void | getPointByDistance (double *d, double *ad, double dl, double *px, double *py) |
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=nullptr, double *ry=nullptr) 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 | |
QList< FeaturePart * > | mHoles |
QgsLabelFeature * | mLF |
Protected Attributes inherited from pal::PointSet | |
int * | cHull |
int | cHullSize |
PointSet * | holeOf |
GEOSGeometry * | mGeos |
bool | mOwnsGeom |
int | nbPoints |
PointSet * | parent |
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) |
Split a concave shape into several convex shapes. More... | |
Main class to handle feature.
FeaturePart::FeaturePart | ( | QgsLabelFeature * | lf, |
const GEOSGeometry * | geom | ||
) |
Creates a new generic feature.
lf | a pointer for a feature which contains the spatial entites |
geom | a pointer to a GEOS geometry |
Definition at line 52 of file feature.cpp.
FeaturePart::FeaturePart | ( | const FeaturePart & | other | ) |
Definition at line 69 of file feature.cpp.
|
virtual |
Delete the feature.
Definition at line 80 of file feature.cpp.
void FeaturePart::addSizePenalty | ( | int | nbp, |
QList< LabelPosition * > & | lPos, | ||
double | bbx[4], | ||
double | bby[4] | ||
) |
Definition at line 1373 of file feature.cpp.
double FeaturePart::calculatePriority | ( | ) | const |
Calculates the priority for the feature.
This will be the feature's priority if set, otherwise the layer's default priority.
Definition at line 1488 of file feature.cpp.
int FeaturePart::createCandidates | ( | QList< LabelPosition * > & | lPos, |
double | bboxMin[2], | ||
double | bboxMax[2], | ||
PointSet * | mapShape, | ||
RTree< LabelPosition *, double, 2, double > * | candidates | ||
) |
Generic method to generate label candidates for the feature.
lPos | pointer to an array of candidates, will be filled by generated candidates |
bboxMin | min values of the map extent |
bboxMax | max values of the map extent |
mapShape | generate candidates for this spatial entity |
candidates | index for candidates |
Definition at line 1289 of file feature.cpp.
int FeaturePart::createCandidatesAlongLine | ( | QList< LabelPosition * > & | lPos, |
PointSet * | mapShape | ||
) |
Generate candidates for line feature.
lPos | pointer to an array of candidates, will be filled by generated candidates |
mapShape | a pointer to the line |
Definition at line 587 of file feature.cpp.
int FeaturePart::createCandidatesAroundPoint | ( | double | x, |
double | y, | ||
QList< LabelPosition * > & | lPos, | ||
double | angle, | ||
PointSet * | mapShape = nullptr |
||
) |
Generate candidates for point feature, located around a specified point.
x | x coordinate of the point |
y | y coordinate of the point |
lPos | pointer to an array of candidates, will be filled by generated candidates |
angle | orientation of the label |
mapShape | optional geometry of source polygon |
Definition at line 433 of file feature.cpp.
int FeaturePart::createCandidatesAtOrderedPositionsOverPoint | ( | double | x, |
double | y, | ||
QList< LabelPosition * > & | lPos, | ||
double | angle | ||
) |
Generates candidates following a prioritised list of predefined positions around a point.
x | x coordinate of the point |
y | y coordinate of the point |
lPos | pointer to an array of candidates, will be filled by generated candidate |
angle | orientation of the label |
Definition at line 309 of file feature.cpp.
int FeaturePart::createCandidatesForPolygon | ( | QList< LabelPosition * > & | lPos, |
PointSet * | mapShape | ||
) |
Generate candidates for polygon features.
lPos | pointer to an array of candidates, will be filled by generated candidates |
mapShape | a pointer to the polygon |
Definition at line 1083 of file feature.cpp.
int FeaturePart::createCandidatesOverPoint | ( | double | x, |
double | y, | ||
QList< LabelPosition * > & | lPos, | ||
double | angle, | ||
PointSet * | mapShape = nullptr |
||
) |
Generate one candidate over or offset the specified point.
x | x coordinate of the point |
y | y coordinate of the point |
lPos | pointer to an array of candidates, will be filled by generated candidate |
angle | orientation of the label |
mapShape | optional geometry of source polygon |
Definition at line 230 of file feature.cpp.
int FeaturePart::createCurvedCandidatesAlongLine | ( | QList< LabelPosition * > & | lPos, |
PointSet * | mapShape | ||
) |
Generate curved candidates for line features.
lPos | pointer to an array of candidates, will be filled by generated candidates |
mapShape | a pointer to the line |
Definition at line 948 of file feature.cpp.
LabelPosition * FeaturePart::curvedPlacementAtOffset | ( | PointSet * | path_positions, |
double * | path_distances, | ||
int | orientation, | ||
int | index, | ||
double | distance | ||
) |
Definition at line 747 of file feature.cpp.
|
protected |
read coordinates from a GEOS geom
Definition at line 88 of file feature.cpp.
|
inline |
QgsFeatureId FeaturePart::featureId | ( | ) | const |
Returns the unique ID of the feature.
Definition at line 154 of file feature.cpp.
|
inline |
|
inline |
|
inline |
bool FeaturePart::hasSameLabelFeatureAs | ( | FeaturePart * | part | ) | const |
Tests whether this feature part belongs to the same QgsLabelFeature as another feature part.
part | part to compare to |
Definition at line 159 of file feature.cpp.
bool FeaturePart::isConnected | ( | FeaturePart * | p2 | ) |
Check whether this part is connected with some other part.
Definition at line 1430 of file feature.cpp.
Layer * FeaturePart::layer | ( | ) |
Returns the layer that feature belongs to.
Definition at line 149 of file feature.cpp.
bool 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 1446 of file feature.cpp.
|
protected |
|
protected |