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
5 changes: 5 additions & 0 deletions app/map/inputmapsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ void InputMapSettings::setExtent( const QgsRectangle &extent )
if ( mMapSettings.extent() == extent )
return;

const bool scaleDidChange = !qgsDoubleNear( mMapSettings.extent().width(), extent.width() );

mMapSettings.setExtent( extent );
emit extentChanged();

if ( scaleDidChange )
emit scaleChanged();
}

QgsPoint InputMapSettings::center() const
Expand Down
3 changes: 3 additions & 0 deletions app/map/inputmapsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ class InputMapSettings : public QObject
//! \copydoc InputMapSettings::extent
void extentChanged();

//! Fired after extentChanged() if the new extent is on a different map scale
void scaleChanged();

//! \copydoc InputMapSettings::destinationCrs
void destinationCrsChanged();

Expand Down
3 changes: 2 additions & 1 deletion app/maptools/recordingmaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,8 @@ QgsPoint RecordingMapTool::handlePoint( QgsPoint p1, QgsPoint p2 )
return QgsPoint();
}

double h = 15 * mapSettings()->mapUnitsPerPixel();
constexpr int HANDLE_PIXEL_OFFSET = 42;
double h = HANDLE_PIXEL_OFFSET * mapSettings()->mapUnitsPerPixel();
double factor = QgsUnitTypes::fromUnitToUnitFactor( mapSettings()->destinationCrs().mapUnits(), mActiveLayer->crs().mapUnits() );
QgsDistanceArea da;
da.setEllipsoid( QStringLiteral( "WGS84" ) );
Expand Down
10 changes: 6 additions & 4 deletions app/maptools/recordingmaptool.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,19 @@ class RecordingMapTool : public AbstractMapTool
public slots:
void onPositionChanged();

private slots:
void prepareEditing();
void onFeatureAdded( QgsFeatureId newFeatureId );

/**
* Creates nodes index. Extracts existing geometry vertices and generates virtual
* vertices representing midpoints (for lines and polygons) and start/end points
* (for lines).
* This is also called whenever the map scale changes so that start/end point positions
* can have a stable pixel offset. Also to skip midpoints for segments below a size threshold.
*/
void collectVertices();

private slots:
void prepareEditing();
void onFeatureAdded( QgsFeatureId newFeatureId );

/**
* Creates geometries represeinting existing nodes, midpoints (for lines and polygons),
* start/end points and "handles" (for lines) from the nodes index.
Expand Down
4 changes: 4 additions & 0 deletions app/qml/map/MMHighlight.qml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,10 @@ Item {
id: shape
anchors.fill: parent

// The newer CurveRenderer is used for dashed lines to avoid a bug causing off-screen lines to be generated as empty
// see https://github.com/MerginMaps/mobile/issues/2280
preferredRendererType: highlight.lineStrokeStyle === ShapePath.DashLine ? Shape.CurveRenderer : Shape.UnknownRenderer

transform: Matrix4x4 {
// the formula for x coordinate for map to screen coordinates conversion goes like this:
// x_screen = (x_map + offset_x) * scale / ddp
Expand Down
10 changes: 10 additions & 0 deletions app/qml/map/MMMapController.qml
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,16 @@ Item {
}
}


Connections {
target: mapCanvas.mapSettings
function onScaleChanged() {
if ( recordingToolsLoader.active ) {
recordingToolsLoader.item.recordingMapTool.collectVertices()
}
}
}

Connections {
target: __activeProject

Expand Down
Loading