@@ -554,7 +554,7 @@ def _linetool_annotate_point(
554554 self , point : QgsPointXY , idx : int , crs : Optional [QgsCoordinateReferenceSystem ] = None
555555 ) -> QgsAnnotation :
556556 if not crs :
557- crs = self . canvas . mapSettings ().destinationCrs ()
557+ crs = QgsProject . instance ().crs ()
558558
559559 annotation = QgsTextAnnotation ()
560560
@@ -566,8 +566,8 @@ def _linetool_annotate_point(
566566
567567 annotation .setFrameSizeMm (QSizeF (8 , 5 ))
568568 annotation .setFrameOffsetFromReferencePointMm (QPointF (1.3 , 1.3 ))
569- annotation .setMapPosition (point )
570569 annotation .setMapPositionCrs (crs )
570+ annotation .setMapPosition (point )
571571
572572 return QgsMapCanvasAnnotationItem (annotation , self .canvas ).annotation ()
573573
@@ -714,7 +714,9 @@ def _on_movetool_map_release(self, point, idx):
714714 self ._clear_annotations ()
715715 else :
716716 self .routing_fromline_list .takeItem (num )
717+ self ._reindex_list_items ()
717718 self .create_rubber_band ()
719+
718720 QMessageBox .warning (
719721 self ,
720722 "Please use a different point" ,
@@ -792,14 +794,17 @@ def _reindex_list_items(self) -> None:
792794 self .routing_fromline_list .clear ()
793795 self ._clear_annotations ()
794796 crs = QgsCoordinateReferenceSystem (f"EPSG:{ 4326 } " )
797+ project_crs = self .canvas .mapSettings ().destinationCrs ()
795798 for idx , x in enumerate (items ):
796799 coords = x .split (":" )[1 ]
797800 item = f"Point { idx } :{ coords } "
798801 x , y = (float (i ) for i in coords .split (", " ))
799802 point = QgsPointXY (x , y )
800803
801804 self .routing_fromline_list .addItem (item )
802- annotation = self ._linetool_annotate_point (point , idx , crs )
805+ transform = QgsCoordinateTransform (crs , project_crs , QgsProject .instance ())
806+ point = transform .transform (point )
807+ annotation = self ._linetool_annotate_point (point , idx )
803808 self .annotations .append (annotation )
804809 self .project .annotationManager ().addAnnotation (annotation )
805810 self .create_rubber_band ()
0 commit comments