/// <summary> /// Reprojects layer source, including shapefiles, images and grids. /// </summary> public TestingResult Reproject(ILayerSource layer, out ILayerSource newLayer, ISpatialReference projection, TesterReportForm report) { if (layer.SeekSubstituteFile(projection, out newLayer)) { return(TestingResult.Substituted); } string newFilename = ProjectionHelper.FilenameWithProjectionSuffix(layer.Filename, layer.Projection, projection); newFilename = GetSafeNewName(newFilename); switch (layer.LayerType) { case LayerType.Shapefile: newLayer = Reproject(layer as IFeatureSet, projection, newFilename); break; case LayerType.Grid: newLayer = Reproject(layer as GridSource, projection, newFilename); break; case LayerType.Image: newLayer = Reproject(layer as BitmapSource, projection, newFilename); break; } return(newLayer != null ? TestingResult.Ok : TestingResult.Error); }