@@ -600,7 +600,7 @@ def _linetool_annotate_point(
600
600
self , point : QgsPointXY , idx : int , crs : Optional [QgsCoordinateReferenceSystem ] = None
601
601
) -> QgsAnnotation :
602
602
if not crs :
603
- crs = self . canvas . mapSettings ().destinationCrs ()
603
+ crs = QgsProject . instance ().crs ()
604
604
605
605
annotation = QgsTextAnnotation ()
606
606
@@ -612,8 +612,8 @@ def _linetool_annotate_point(
612
612
613
613
annotation .setFrameSizeMm (QSizeF (8 , 5 ))
614
614
annotation .setFrameOffsetFromReferencePointMm (QPointF (1.3 , 1.3 ))
615
- annotation .setMapPosition (point )
616
615
annotation .setMapPositionCrs (crs )
616
+ annotation .setMapPosition (point )
617
617
618
618
return QgsMapCanvasAnnotationItem (annotation , self .canvas ).annotation ()
619
619
@@ -760,7 +760,9 @@ def _on_movetool_map_release(self, point, idx):
760
760
self ._clear_annotations ()
761
761
else :
762
762
self .routing_fromline_list .takeItem (num )
763
+ self ._reindex_list_items ()
763
764
self .create_rubber_band ()
765
+
764
766
QMessageBox .warning (
765
767
self ,
766
768
"Please use a different point" ,
@@ -838,14 +840,17 @@ def _reindex_list_items(self) -> None:
838
840
self .routing_fromline_list .clear ()
839
841
self ._clear_annotations ()
840
842
crs = QgsCoordinateReferenceSystem (f"EPSG:{ 4326 } " )
843
+ project_crs = self .canvas .mapSettings ().destinationCrs ()
841
844
for idx , x in enumerate (items ):
842
845
coords = x .split (":" )[1 ]
843
846
item = f"Point { idx } :{ coords } "
844
847
x , y = (float (i ) for i in coords .split (", " ))
845
848
point = QgsPointXY (x , y )
846
849
847
850
self .routing_fromline_list .addItem (item )
848
- annotation = self ._linetool_annotate_point (point , idx , crs )
851
+ transform = QgsCoordinateTransform (crs , project_crs , QgsProject .instance ())
852
+ point = transform .transform (point )
853
+ annotation = self ._linetool_annotate_point (point , idx )
849
854
self .annotations .append (annotation )
850
855
self .project .annotationManager ().addAnnotation (annotation )
851
856
self .create_rubber_band ()
0 commit comments