[QGIS-Developer] Suggestion of a different perpendicularSegment geometry method
Tobias Schmetzer
tschmetzer at gmx.de
Wed Oct 21 13:42:52 PDT 2020
Dear developer colleagues,
I'm new to QGIS development and my cpp and git experience is a long
while ago. Yet I want to make the effort to contribute to this project
in return for using it for months.
During my python scripting I was missing a function that I created
for myself in python which I would need to split a polyline using
QgsGeometry.splitGeometry().
The function I want to contribute will create a perpendicular segment to
a given segment with it's center at a given point (the already available
function QgsGeometryUtils.perpendicularSegment doesn't fullfill that need)
I would suggest to add to the cpp code of QgsGeometryUtils. A good old
friend of mine and cpp expert will do the first code review once it's
finished before I do the PR.
I am already working on that function and its test. The header looks
like this:
/**
* \brief Create a perpendicular line segment to a given segment
* [segmentPoint1, segmentPoint2] with its center at centerPoint
* May be used to split geometries
* \param centerPoint Point where the center of the perpendicular should
* be located
* \param segmentPoint1 The segment's start point
* \param segmentPoint2 The segment's end point
* \returns A line (segment) centered in point p and perpendicular to
* segment [segmentPoint1, segmentPoint2]
*/
static QgsLineString perpendicularCenterSegment( const QgsPoint &point,
const QgsPoint &segmentPoint1, const QgsPoint &segmentPoint2 ) SIP_HOLDGIL;
Any comments or did I even miss an already available
function for what I am suggesting?
Kind regards, Tobias
More information about the QGIS-Developer
mailing list