QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
23 QString QgsProjectPointCartesianAlgorithm::name()
const
25 return QStringLiteral(
"projectpointcartesian" );
28 QString QgsProjectPointCartesianAlgorithm::displayName()
const
30 return QObject::tr(
"Project points (Cartesian)" );
33 QStringList QgsProjectPointCartesianAlgorithm::tags()
const
35 return QObject::tr(
"bearing,azimuth,distance,angle" ).split(
',' );
38 QString QgsProjectPointCartesianAlgorithm::group()
const
40 return QObject::tr(
"Vector geometry" );
43 QString QgsProjectPointCartesianAlgorithm::groupId()
const
45 return QStringLiteral(
"vectorgeometry" );
48 QString QgsProjectPointCartesianAlgorithm::outputName()
const
50 return QObject::tr(
"Projected" );
53 QString QgsProjectPointCartesianAlgorithm::shortHelpString()
const
55 return QObject::tr(
"This algorithm projects point geometries by a specified distance and bearing (azimuth), creating a new point layer with the projected points.\n\n"
56 "The distance is specified in layer units, and the bearing in degrees clockwise from North." );
59 QList<int> QgsProjectPointCartesianAlgorithm::inputLayerTypes()
const
69 QgsProjectPointCartesianAlgorithm *QgsProjectPointCartesianAlgorithm::createInstance()
const
71 return new QgsProjectPointCartesianAlgorithm();
74 void QgsProjectPointCartesianAlgorithm::initParameters(
const QVariantMap & )
76 std::unique_ptr< QgsProcessingParameterNumber > bearing = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral(
"BEARING" ), QObject::tr(
"Bearing (degrees from North)" ),
QgsProcessingParameterNumber::Double, 0,
false );
77 bearing->setIsDynamic(
true );
79 bearing->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
80 addParameter( bearing.release() );
82 std::unique_ptr< QgsProcessingParameterDistance > distance = std::make_unique< QgsProcessingParameterDistance >( QStringLiteral(
"DISTANCE" ), QObject::tr(
"Distance" ), 1, QStringLiteral(
"INPUT" ),
false );
83 distance->setIsDynamic(
true );
85 distance->setDynamicLayerParameterName( QStringLiteral(
"INPUT" ) );
86 addParameter( distance.release() );
96 mBearing = parameterAsDouble( parameters, QStringLiteral(
"BEARING" ), context );
98 if ( mDynamicBearing )
99 mBearingProperty = parameters.value( QStringLiteral(
"BEARING" ) ).value<
QgsProperty >();
101 mDistance = parameterAsDouble( parameters, QStringLiteral(
"DISTANCE" ), context );
103 if ( mDynamicDistance )
104 mDistanceProperty = parameters.value( QStringLiteral(
"DISTANCE" ) ).value<
QgsProperty >();
114 double distance = mDistance;
115 if ( mDynamicDistance )
117 double bearing = mBearing;
118 if ( mDynamicBearing )
119 bearing = mBearingProperty.valueAsDouble( context.
expressionContext(), bearing );
125 std::unique_ptr< QgsMultiPoint > result = std::make_unique< QgsMultiPoint >();
130 result->addGeometry( p->
project( distance, bearing ).
clone() );
@ Double
Double/float values.
A store for object properties.
static bool isDynamic(const QVariantMap ¶meters, const QString &name)
Returns true if the parameter with matching name is a dynamic parameter, and must be evaluated once f...
Point geometry type, with support for z-dimension and m-values.
Base class for providing feedback from a processing algorithm.
@ Double
Double value (including negative values)
@ FlagSkipGeometryValidityChecks
Invalid geometry checks should always be skipped. This flag can be useful for algorithms which always...
@ TypeVectorPoint
Vector point layers.
QgsPoint project(double distance, double azimuth, double inclination=90.0) const SIP_HOLDGIL
Returns a new point which corresponds to this point projected by a specified distance with specified ...
int numGeometries() const SIP_HOLDGIL
Returns the number of geometries within the collection.
QgsPoint * clone() const override
Clones the geometry by performing a deep copy.
void setGeometry(const QgsGeometry &geometry)
Set the feature's geometry.
Contains information about the context in which a processing algorithm is executed.
QList< QgsFeature > QgsFeatureList
Definition for a property.
const QgsAbstractGeometry * constGet() const SIP_HOLDGIL
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Multi point geometry collection.
QgsPoint * pointN(int index)
Returns the point with the specified index.
Flag
Flags controlling how QgsProcessingFeatureSource fetches features.
A geometry is the spatial representation of a feature.
bool hasGeometry() const
Returns true if the feature has an associated geometry.
QgsExpressionContext & expressionContext()
Returns the expression context.
double valueAsDouble(const QgsExpressionContext &context, double defaultValue=0.0, bool *ok=nullptr) const
Calculates the current value of the property and interprets it as a double.
static GeometryType geometryType(Type type) SIP_HOLDGIL
Returns the geometry type for a WKB type, e.g., both MultiPolygon and CurvePolygon would have a Polyg...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
static bool isMultiType(Type type) SIP_HOLDGIL
Returns true if the WKB type is a multi type.
SourceType
Data source types enum.
QgsWkbTypes::Type wkbType() const SIP_HOLDGIL
Returns type of the geometry as a WKB type (point / linestring / polygon etc.)