22 QString QgsOrientedMinimumBoundingBoxAlgorithm::name()
const 24 return QStringLiteral(
"orientedminimumboundingbox" );
27 QString QgsOrientedMinimumBoundingBoxAlgorithm::displayName()
const 29 return QObject::tr(
"Oriented minimum bounding box" );
32 QStringList QgsOrientedMinimumBoundingBoxAlgorithm::tags()
const 34 return QObject::tr(
"bounding,boxes,envelope,rectangle,extent,oriented,angle" ).split(
',' );
37 QString QgsOrientedMinimumBoundingBoxAlgorithm::group()
const 39 return QObject::tr(
"Vector geometry" );
42 QString QgsOrientedMinimumBoundingBoxAlgorithm::groupId()
const 44 return QStringLiteral(
"vectorgeometry" );
47 QString QgsOrientedMinimumBoundingBoxAlgorithm::outputName()
const 49 return QObject::tr(
"Bounding boxes" );
57 QString QgsOrientedMinimumBoundingBoxAlgorithm::shortHelpString()
const 59 return QObject::tr(
"This algorithm calculates the minimum area rotated rectangle which covers each feature in an input layer." ) +
60 QStringLiteral(
"\n\n" ) +
61 QObject::tr(
"See the 'Minimum bounding geometry' algorithm for a oriented bounding box calculation which covers the whole layer or grouped subsets of features." );
64 QgsOrientedMinimumBoundingBoxAlgorithm *QgsOrientedMinimumBoundingBoxAlgorithm::createInstance()
const 66 return new QgsOrientedMinimumBoundingBoxAlgorithm();
69 QgsFields QgsOrientedMinimumBoundingBoxAlgorithm::outputFields(
const QgsFields &inputFields )
const 72 fields.
append(
QgsField( QStringLiteral(
"width" ), QVariant::Double, QString(), 20, 6 ) );
73 fields.
append(
QgsField( QStringLiteral(
"height" ), QVariant::Double, QString(), 20, 6 ) );
74 fields.
append(
QgsField( QStringLiteral(
"angle" ), QVariant::Double, QString(), 20, 6 ) );
75 fields.
append(
QgsField( QStringLiteral(
"area" ), QVariant::Double, QString(), 20, 6 ) );
76 fields.
append(
QgsField( QStringLiteral(
"perimeter" ), QVariant::Double, QString(), 20, 6 ) );
96 << 2 * width + 2 * height;
Base class for providing feedback from a processing algorithm.
QList< QgsFeature > QgsFeatureList
Container of fields for a vector layer.
A geometry is the spatial representation of a feature.
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
bool hasGeometry() const
Returns true if the feature has an associated geometry.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
Type
The WKB type describes the number of dimensions a geometry has.
bool append(const QgsField &field, FieldOrigin origin=OriginProvider, int originIndex=-1)
Append a field. The field must have unique name, otherwise it is rejected (returns false) ...
Encapsulate a field in an attribute table or data source.
QgsGeometry geometry() const
Returns the geometry associated with this feature.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
QgsGeometry orientedMinimumBoundingBox(double &area, double &angle, double &width, double &height) const
Returns the oriented minimum bounding box for the geometry, which is the smallest (by area) rotated r...
Contains information about the context in which a processing algorithm is executed.