Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions app/mapsketchingcontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "qgsvectorlayerutils.h"
#include "qgslinestring.h"
#include "qgsmultilinestring.h"
#include "qgsvertexid.h"


MapSketchingController::MapSketchingController( QObject *parent )
Expand Down Expand Up @@ -49,10 +50,13 @@ void MapSketchingController::updateHighlight( const QPointF &oldPoint, const QPo
mScreenPoints = QgsGeometry( new QgsLineString( { QgsPointXY( oldPoint.x(), oldPoint.y() ) } ) );
}

// TODO: append instead of insert to zero
mScreenPoints.insertVertex( newPoint.x(), newPoint.y(), 0 );
// Append point to the geometry
const QgsVertexId lastScreenVertex( 0, 0, mScreenPoints.constGet()->vertexCount() );
mScreenPoints.get()->insertVertex( lastScreenVertex, QgsPoint( newPoint.x(), newPoint.y() ) );

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why we don't use insertVertex from QgsGeometry instead of QgsAbstractGeometry?


const QgsPoint p1 = mMapSettings->screenToCoordinate( newPoint );
mHighlight.insertVertex( p1, 0 );
const QgsVertexId lastHighlightVertex( 0, 0, mHighlight.constGet()->vertexCount() );
mHighlight.get()->insertVertex( lastHighlightVertex, p1 );

emit highlightGeometryChanged();
}
Expand Down
6 changes: 3 additions & 3 deletions app/qml/map/MMMapSketchesDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ MMComponents.MMDrawer {
MMComponents.MMColorPicker {
id: colorPicker

colors: root.sketchingController?.availableColors()
activeColor: root.sketchingController?.activeColor
colors: root.sketchingController?.availableColors() ?? []
activeColor: root.sketchingController?.activeColor ?? null

Layout.alignment: Qt.AlignHCenter
Layout.maximumWidth: parent.width

onActiveColorChangeRequested: {
onActiveColorChangeRequested: function( newColor ) {
if ( root.sketchingController )
{
root.sketchingController.activeColor = newColor
Expand Down
Loading