23QString QgsOrientedMinimumBoundingBoxAlgorithm::name()
const
25 return QStringLiteral(
"orientedminimumboundingbox" );
28QString QgsOrientedMinimumBoundingBoxAlgorithm::displayName()
const
30 return QObject::tr(
"Oriented minimum bounding box" );
33QStringList QgsOrientedMinimumBoundingBoxAlgorithm::tags()
const
35 return QObject::tr(
"bounding,boxes,envelope,rectangle,extent,oriented,angle" ).split(
',' );
38QString QgsOrientedMinimumBoundingBoxAlgorithm::group()
const
40 return QObject::tr(
"Vector geometry" );
43QString QgsOrientedMinimumBoundingBoxAlgorithm::groupId()
const
45 return QStringLiteral(
"vectorgeometry" );
48QString QgsOrientedMinimumBoundingBoxAlgorithm::outputName()
const
50 return QObject::tr(
"Bounding boxes" );
58QString QgsOrientedMinimumBoundingBoxAlgorithm::shortHelpString()
const
60 return QObject::tr(
"This algorithm calculates the minimum area rotated rectangle which covers each feature in an input layer." ) + QStringLiteral(
"\n\n" ) + QObject::tr(
"See the 'Minimum bounding geometry' algorithm for a oriented bounding box calculation which covers the whole layer or grouped subsets of features." );
63QString QgsOrientedMinimumBoundingBoxAlgorithm::shortDescription()
const
65 return QObject::tr(
"Calculates the minimum area rotated rectangle which covers each feature in an input layer." );
68QgsOrientedMinimumBoundingBoxAlgorithm *QgsOrientedMinimumBoundingBoxAlgorithm::createInstance()
const
70 return new QgsOrientedMinimumBoundingBoxAlgorithm();
73bool QgsOrientedMinimumBoundingBoxAlgorithm::supportInPlaceEdit(
const QgsMapLayer *l )
const
75 const QgsVectorLayer *layer = qobject_cast<const QgsVectorLayer *>( l );
85QgsFields QgsOrientedMinimumBoundingBoxAlgorithm::outputFields(
const QgsFields &inputFields )
const
88 newFields.
append(
QgsField( QStringLiteral(
"width" ), QMetaType::Type::Double, QString(), 20, 6 ) );
89 newFields.
append(
QgsField( QStringLiteral(
"height" ), QMetaType::Type::Double, QString(), 20, 6 ) );
90 newFields.
append(
QgsField( QStringLiteral(
"angle" ), QMetaType::Type::Double, QString(), 20, 6 ) );
91 newFields.
append(
QgsField( QStringLiteral(
"area" ), QMetaType::Type::Double, QString(), 20, 6 ) );
92 newFields.
append(
QgsField( QStringLiteral(
"perimeter" ), QMetaType::Type::Double, QString(), 20, 6 ) );
112 << 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