@@ -848,7 +848,9 @@ bool CMapView::CheckLayerProjection( Layer* layer, int layerHandle )
848848 return false ;
849849 }
850850
851- if (layer->IsShapefile ()) {
851+ if (layer->IsShapefile ())
852+ {
853+ // save reprojected state
852854 return ReprojectLayer (layer, layerHandle);
853855 }
854856
@@ -882,16 +884,12 @@ bool CMapView::ReprojectLayer(Layer* layer, int layerHandle)
882884 // either all shapes have been reprojected OR we are allowing layers with incomplete reprojection;
883885 if (!sfNew || (numShapes != count && !m_globalSettings.allowLayersWithIncompleteReprojection ))
884886 {
887+ // reprojection failed
885888 FireLayerReprojected (layerHandle, VARIANT_FALSE );
886889 if (sfNew) sfNew->Release ();
887890 ErrorMessage (tkFAILED_TO_REPROJECT);
888891 return false ;
889892 }
890- else if (numShapes != count)
891- {
892- // allowing layer with incomplete reprojection, let the world know
893- FireLayerReprojectedIncomplete (layerHandle, count, numShapes);
894- }
895893
896894 // let's substitute original shapefile with the reprojected one
897895 // don't close the original shapefile; use may still want to interact with it
@@ -915,6 +913,13 @@ bool CMapView::ReprojectLayer(Layer* layer, int layerHandle)
915913 }
916914 layer->UpdateExtentsFromDatasource ();
917915
916+ // if not all shapes could be reprojected, let the world know
917+ if (numShapes != count)
918+ {
919+ // in case this was an Ogr layer, event should be fired AFTER new Shapefile was 'injected' into OgrLayerSource
920+ FireLayerReprojectedIncomplete (layerHandle, count, numShapes);
921+ }
922+ // always fire LayerReprojected event
918923 FireLayerReprojected (layerHandle, VARIANT_TRUE );
919924
920925 return true ;
@@ -1323,7 +1328,7 @@ void CMapView::SetLayerMinVisibleZoom(LONG LayerHandle, int newVal)
13231328}
13241329
13251330// ******************************************************************
1326- // LayerMaxVisibleScale
1331+ // LayerMaxVisibleZoom
13271332// ******************************************************************
13281333int CMapView::GetLayerMaxVisibleZoom (LONG LayerHandle)
13291334{
0 commit comments