private void SaveSelectedFeaturesToTempFile() { string tempDir = Path.Combine(GisEditor.InfrastructureManager.TemporaryPath, TempPath); if (!Directory.Exists(tempDir)) { Directory.CreateDirectory(tempDir); } tempFilePath = Path.Combine(tempDir, "SplitTemp.shp"); var selectedFeatures = HighlightFeatureLayer.InternalFeatures.Where(f => f.Tag == SelectedLayerToSplit); string projectionInWKT = Proj4Projection.ConvertProj4ToPrj(GisEditor.ActiveMap.DisplayProjectionParameters); FileExportInfo info = new FileExportInfo(selectedFeatures, ColumnsInSelectedLayer, tempFilePath, projectionInWKT); ShapeFileExporter exporter = new ShapeFileExporter(); exporter.ExportToFile(info); }
private void SaveClippingLayer() { string tempDir = Path.Combine(GisEditor.InfrastructureManager.TemporaryPath, TempPath); if (!Directory.Exists(tempDir)) { Directory.CreateDirectory(tempDir); } clippingLayerTempPath = Path.Combine(tempDir, "ClippingTemp.shp"); Collection <Feature> clippingFeatures = null; var clipLayers = this.ClippingLayers.Where(l => l.IsSelected).Select(l => l.FeatureLayer); if (this.IsUseSelectedFeatures) { Collection <Feature> selectedFeatures = new Collection <Feature>(); var selectionOverlay = GisEditor.SelectionManager.GetSelectionOverlay(); if (selectionOverlay != null) { var selectedFeaturesInThisLayer = selectionOverlay.HighlightFeatureLayer.InternalFeatures.Where(tmpFeature => clipLayers.Contains(tmpFeature.Tag)); foreach (var feature in selectedFeaturesInThisLayer) { selectedFeatures.Add(feature); } } if (selectedFeatures.Count > 0) { clippingFeatures = selectedFeatures; } } //we don't need columns from the clipping layers string projectionInWKT = Proj4Projection.ConvertProj4ToPrj(GisEditor.ActiveMap.DisplayProjectionParameters); FileExportInfo info = new FileExportInfo(clippingFeatures, new FeatureSourceColumn[] { new FeatureSourceColumn("None", "String", 10) }, clippingLayerTempPath, projectionInWKT); ShapeFileExporter exporter = new ShapeFileExporter(); exporter.ExportToFile(info); }
private void SaveSelectedFeaturesToTempFile() { string tempDir = Path.Combine(GisEditor.InfrastructureManager.TemporaryPath, TempPath); if (!Directory.Exists(tempDir)) { Directory.CreateDirectory(tempDir); } tempFilePath = Path.Combine(tempDir, "MergeTemp.shp"); var selectionOverlay = GisEditor.SelectionManager.GetSelectionOverlay(); if (selectionOverlay != null) { var selectedFeatures = selectionOverlay.HighlightFeatureLayer.InternalFeatures .Where(tmpFeature => SelectedLayers.Contains((Layer)tmpFeature.Tag)); string projectionInWKT = Proj4Projection.ConvertProj4ToPrj(GisEditor.ActiveMap.DisplayProjectionParameters); FileExportInfo info = new FileExportInfo(selectedFeatures, GetColumnsOfSelectedLayers(), tempFilePath, projectionInWKT); ShapeFileExporter exporter = new ShapeFileExporter(); exporter.ExportToFile(info); } }