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." ) +
61 QStringLiteral(
"\n\n" ) +
62 QObject::tr(
"See the 'Minimum bounding geometry' algorithm for a oriented bounding box calculation which covers the whole layer or grouped subsets of features." );
65QgsOrientedMinimumBoundingBoxAlgorithm *QgsOrientedMinimumBoundingBoxAlgorithm::createInstance()
const
67 return new QgsOrientedMinimumBoundingBoxAlgorithm();
70bool QgsOrientedMinimumBoundingBoxAlgorithm::supportInPlaceEdit(
const QgsMapLayer *l )
const
72 const QgsVectorLayer *layer = qobject_cast< const QgsVectorLayer * >( l );
82QgsFields QgsOrientedMinimumBoundingBoxAlgorithm::outputFields(
const QgsFields &inputFields )
const
85 fields.
append(
QgsField( QStringLiteral(
"width" ), QVariant::Double, QString(), 20, 6 ) );
86 fields.
append(
QgsField( QStringLiteral(
"height" ), QVariant::Double, QString(), 20, 6 ) );
87 fields.
append(
QgsField( QStringLiteral(
"angle" ), QVariant::Double, QString(), 20, 6 ) );
88 fields.
append(
QgsField( QStringLiteral(
"area" ), QVariant::Double, QString(), 20, 6 ) );
89 fields.
append(
QgsField( QStringLiteral(
"perimeter" ), QVariant::Double, QString(), 20, 6 ) );
109 << 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, FieldOrigin origin=OriginProvider, int originIndex=-1)
Appends a field. The field must have unique name, otherwise it is rejected (returns false)
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.
Represents a vector layer which manages a vector based data sets.
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