Skip to content
Permalink
Browse files

Nyall's review

  • Loading branch information
lbartoletti committed Nov 13, 2018
1 parent abcf2aa commit a8f865917eea6fcea66200b108a2ccd18b494873
@@ -217,7 +217,7 @@ Project the point on a segment



static int leftOfLine( double x, double y, double x1, double y1, double x2, double y2 );
static int leftOfLine( const double x, const double y, const double x1, const double y1, const double x2, const double y2 );
%Docstring
Returns a value < 0 if the point (``x``, ``y``) is left of the line from (``x1``, ``y1``) -> ( ``x2``, ``y2``).
A positive return value indicates the point is to the right of the line.
@@ -226,7 +226,7 @@ If the return value is 0, then the test was unsuccessful (e.g. due to testing a
on the line, or exactly in line with the segment) and the result is undefined.
%End

static int leftOfLine( QgsPoint point, QgsPoint p1, QgsPoint p2 );
static int leftOfLine( const QgsPoint point, const QgsPoint p1, const QgsPoint p2 );
%Docstring
Returns a value < 0 if the point ``point`` is left of the line from ``p1`` -> ``p2``.
A positive return value indicates the point is to the right of the line.
@@ -2122,7 +2122,7 @@ void QgisApp::createActions()
connect( mActionSnappingOptions, &QAction::triggered, this, &QgisApp::snappingOptions );
connect( mActionOffsetCurve, &QAction::triggered, this, &QgisApp::offsetCurve );
connect( mActionReverseLine, &QAction::triggered, this, &QgisApp::reverseLine );
connect( mActionTrimExtendFeature, &QAction::triggered, this, &QgisApp::trimExtendFeature );
connect( mActionTrimExtendFeature, &QAction::triggered, this, [ = ] { mMapCanvas->setMapTool( mMapTools.mTrimExtendFeature ); } );

// View Menu Items
connect( mActionPan, &QAction::triggered, this, &QgisApp::pan );
@@ -7864,11 +7864,6 @@ void QgisApp::reverseLine()
mMapCanvas->setMapTool( mMapTools.mReverseLine );
}

void QgisApp::trimExtendFeature()
{
mMapCanvas->setMapTool( mMapTools.mTrimExtendFeature );
}

QgsGeometry QgisApp::unionGeometries( const QgsVectorLayer *vl, QgsFeatureList &featureList, bool &canceled )
{
canceled = false;
@@ -1432,8 +1432,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
void offsetPointSymbol();
//! activates the reverse line tool
void reverseLine();
//! activates the trim/extend feature tool
void trimExtendFeature();
//! activates the tool
void setMapTool( QgsMapTool *tool, bool clean = false );

@@ -35,16 +35,16 @@ class FeatureFilter : public QgsPointLocator::MatchFilter

bool acceptMatch( const QgsPointLocator::Match &match ) override
{
if ( layer )
return match.layer() == layer && match.hasEdge();
if ( mLayer )
return match.layer() == mLayer && match.hasEdge();

return match.hasEdge();
}
// We only want to modify the current layer. When geometries are overlapped, this makes it possible to snap onto the current layer.
void setLayer( QgsVectorLayer *vlayer ) { layer = vlayer; }
void setLayer( QgsVectorLayer *vlayer ) { mLayer = vlayer; }

private:
const QgsVectorLayer *layer = nullptr;
const QgsVectorLayer *mLayer = nullptr;
};

QgsMapToolTrimExtendFeature::QgsMapToolTrimExtendFeature( QgsMapCanvas *canvas )
@@ -62,7 +62,7 @@ static void getPoints( const QgsPointLocator::Match &match, QgsPoint &p1, QgsPoi
const QgsFeatureId fid = match.featureId();
const int vertex = match.vertexIndex();

const QgsGeometry geom = match.layer()->getFeature( fid ).geometry();
const QgsGeometry geom = match.layer()->getGeometry( fid );

if ( !( geom.isNull() || geom.isEmpty() ) )
{
@@ -137,9 +137,7 @@ void QgsMapToolTrimExtendFeature::canvasMoveEvent( QgsMapMouseEvent *e )
if ( is3DLayer && QgsWkbTypes::hasZ( match.layer()->wkbType() ) )
{
/* Z Interpolation */
QgsLineString line( QVector<QgsPoint>()
<< pLimit1
<< pLimit2 );
QgsLineString line( pLimit1, pLimit2 );

intersection = QgsGeometryUtils::closestPoint( line, QgsPoint( intersection ) );
}
@@ -529,12 +529,12 @@ QVector<QgsGeometryUtils::SelfIntersection> QgsGeometryUtils::selfIntersections(
return intersections;
}

int QgsGeometryUtils::leftOfLine( QgsPoint point, QgsPoint p1, QgsPoint p2 )
int QgsGeometryUtils::leftOfLine( const QgsPoint point, const QgsPoint p1, const QgsPoint p2 )
{
return leftOfLine( point.x(), point.y(), p1.x(), p1.y(), p2.x(), p2.y() );
}

int QgsGeometryUtils::leftOfLine( double x, double y, double x1, double y1, double x2, double y2 )
int QgsGeometryUtils::leftOfLine( const double x, const double y, const double x1, const double y1, const double x2, const double y2 )
{
double f1 = x - x1;
double f2 = y2 - y1;
@@ -244,7 +244,7 @@ class CORE_EXPORT QgsGeometryUtils
* If the return value is 0, then the test was unsuccessful (e.g. due to testing a point exactly
* on the line, or exactly in line with the segment) and the result is undefined.
*/
static int leftOfLine( double x, double y, double x1, double y1, double x2, double y2 );
static int leftOfLine( const double x, const double y, const double x1, const double y1, const double x2, const double y2 );

/**
* Returns a value < 0 if the point \a point is left of the line from \a p1 -> \a p2.
@@ -255,7 +255,7 @@ class CORE_EXPORT QgsGeometryUtils
*
* \since QGIS 3.6
*/
static int leftOfLine( QgsPoint point, QgsPoint p1, QgsPoint p2 );
static int leftOfLine( const QgsPoint point, const QgsPoint p1, const QgsPoint p2 );

/**
* Returns a point a specified \a distance toward a second point.

0 comments on commit a8f8659

Please sign in to comment.
You can’t perform that action at this time.