24QString QgsOrientedMinimumBoundingBoxAlgorithm::name()
const
26 return QStringLiteral(
"orientedminimumboundingbox" );
29QString QgsOrientedMinimumBoundingBoxAlgorithm::displayName()
const
31 return QObject::tr(
"Oriented minimum bounding box" );
34QStringList QgsOrientedMinimumBoundingBoxAlgorithm::tags()
const
36 return QObject::tr(
"bounding,boxes,envelope,rectangle,extent,oriented,angle" ).split(
',' );
39QString QgsOrientedMinimumBoundingBoxAlgorithm::group()
const
41 return QObject::tr(
"Vector geometry" );
44QString QgsOrientedMinimumBoundingBoxAlgorithm::groupId()
const
46 return QStringLiteral(
"vectorgeometry" );
49QString QgsOrientedMinimumBoundingBoxAlgorithm::outputName()
const
51 return QObject::tr(
"Bounding boxes" );
59QString QgsOrientedMinimumBoundingBoxAlgorithm::shortHelpString()
const
61 return QObject::tr(
"This algorithm calculates the minimum area rotated rectangle which covers each feature in an input layer." ) + QStringLiteral(
"\n\n" ) + QObject::tr(
"For singlepart point features, the output corresponds to the bounding box of the geometry." ) + QStringLiteral(
"\n\n" ) + QObject::tr(
"See the 'Minimum bounding geometry' algorithm for an oriented bounding box calculation which covers the whole layer or grouped subsets of features." );
64QString QgsOrientedMinimumBoundingBoxAlgorithm::shortDescription()
const
66 return QObject::tr(
"Calculates the minimum area rotated rectangle which covers each feature in an input layer." );
69QgsOrientedMinimumBoundingBoxAlgorithm *QgsOrientedMinimumBoundingBoxAlgorithm::createInstance()
const
71 return new QgsOrientedMinimumBoundingBoxAlgorithm();
74bool QgsOrientedMinimumBoundingBoxAlgorithm::supportInPlaceEdit(
const QgsMapLayer *l )
const
76 const QgsVectorLayer *layer = qobject_cast<const QgsVectorLayer *>( l );
86QgsFields QgsOrientedMinimumBoundingBoxAlgorithm::outputFields(
const QgsFields &inputFields )
const
89 newFields.
append(
QgsField( QStringLiteral(
"width" ), QMetaType::Type::Double, QString(), 20, 6 ) );
90 newFields.
append(
QgsField( QStringLiteral(
"height" ), QMetaType::Type::Double, QString(), 20, 6 ) );
91 newFields.
append(
QgsField( QStringLiteral(
"angle" ), QMetaType::Type::Double, QString(), 20, 6 ) );
92 newFields.
append(
QgsField( QStringLiteral(
"area" ), QMetaType::Type::Double, QString(), 20, 6 ) );
93 newFields.
append(
QgsField( QStringLiteral(
"perimeter" ), QMetaType::Type::Double, QString(), 20, 6 ) );
113 << 2 * width + 2 * height;
WkbType
The WKB type describes the number of dimensions a geometry has.
@ MultiPolygon
MultiPolygon.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
void setAttributes(const QgsAttributes &attrs)
Sets the feature's attributes.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
Encapsulate a field in an attribute table or data source.
Container of fields for a vector layer.
bool append(const QgsField &field, Qgis::FieldOrigin origin=Qgis::FieldOrigin::Provider, int originIndex=-1)
Appends a field.
A geometry is the spatial representation of a feature.
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...
Base class for all map layer types.
Contains information about the context in which a processing algorithm is executed.
bool supportInPlaceEdit(const QgsMapLayer *layer) const override
Checks whether this algorithm supports in-place editing on the given layer Default implementation for...
Base class for providing feedback from a processing algorithm.
static QgsFields combineFields(const QgsFields &fieldsA, const QgsFields &fieldsB, const QString &fieldsBPrefix=QString())
Combines two field lists, avoiding duplicate field names (in a case-insensitive manner).
Represents a vector layer which manages a vector based dataset.
Q_INVOKABLE Qgis::WkbType wkbType() const final
Returns the WKBType or WKBUnknown in case of error.
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).
QList< QgsFeature > QgsFeatureList