private void btnCreateOrOpenGeodatabase_Click(object sender, RoutedEventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.AddExtension = true; openFileDialog.DefaultExt = ".geodatabase"; openFileDialog.CheckFileExists = false; openFileDialog.Filter = "Runtime Geodatabase (*.geodatabase)|*.geodatabase"; if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { geodatabasePath = openFileDialog.FileName; if (true == System.IO.File.Exists(geodatabasePath)) { if (MosaicDatasetRaster.GetNames(geodatabasePath).Count > 0) { MosaicDatasetCombo.Visibility = Visibility.Visible; selectMD.Visibility = Visibility.Visible; foreach (var name in MosaicDatasetRaster.GetNames(geodatabasePath)) { AddMosaicToCombo(name); } } } else { enterMDName.Visibility = Visibility.Visible; MosaicDatasetNameTextBox.Visibility = Visibility.Visible; } btnCreateOrLoadMD.Visibility = Visibility.Visible; } }
private void btnCreateOrLoadMD_Click(object sender, RoutedEventArgs e) { if (selectedMosaicName == null && MosaicDatasetNameTextBox.Text != "") { debugListBox.Items.Add("Creating new Mosaic Dataset and database"); selectedMosaicName = MosaicDatasetNameTextBox.Text; mdr = MosaicDatasetRaster.Create(geodatabasePath, selectedMosaicName, new SpatialReference(3857)); mdr.Loaded += new EventHandler <EventArgs>(this.OnMosaicLoaded); mdr.LoadAsync(); } else { debugListBox.Items.Add("Loading MosaicDataset " + selectedMosaicName + " from " + geodatabasePath); mdr = new MosaicDatasetRaster(geodatabasePath, selectedMosaicName); mdr.Loaded += new EventHandler <EventArgs>(this.OnMosaicLoaded); mdr.LoadAsync(); } }
private void resetApp_Click(object sender, RoutedEventArgs e) { selectMD.Visibility = Visibility.Collapsed; MosaicDatasetCombo.SelectedItem = null; MosaicDatasetCombo.Visibility = Visibility.Collapsed; enterMDName.Visibility = Visibility.Collapsed; MosaicDatasetNameTextBox.Visibility = Visibility.Collapsed; MosaicDatasetNameTextBox.Text = ""; btnCreateOrLoadMD.IsEnabled = false; btnCreateOrLoadMD.Visibility = Visibility.Collapsed; AddRasterStack.Visibility = Visibility.Collapsed; RasterPathTextBox.Text = ""; debugListBox.Items.Clear(); selectedMosaicName = null; mdr = null; geodatabasePath = null; }
private async void Initialize() { //MyMapView.Map = new Map(Basemap.CreateImagery()); MyMapView.Map = new Map(new SpatialReference(3375)); //MyMapView.InteractionOptions = new MapViewInteractionOptions { IsZoomEnabled = false }; // Open the shapefile ShapefileFeatureTable myShapefile = await ShapefileFeatureTable.OpenAsync(shapeFilePath); // Create a feature layer to display the shapefile FeatureLayer newFeatureLayer = new FeatureLayer(myShapefile); // Add the feature layer to the map MyMapView.Map.OperationalLayers.Add(newFeatureLayer); await myShapefile.LoadAsync(); //Get mosaic dataset names in the SQLite database. var names = MosaicDatasetRaster.GetNames(rasterMapMosaicPath); var rasterName = names[0]; //Create a raster from a mosaic dataset Raster mapRaster = new MosaicDatasetRaster(rasterMapMosaicPath, "RasterMapTable"); // Create a RasterLayer to display the Raster RasterLayer rasterMapLayer = new RasterLayer(mapRaster); MyMapView.Map.OperationalLayers.Add(rasterMapLayer); rasterMapLayer.MinScale = 100000; rasterMapLayer.MaxScale = 2000; await rasterMapLayer.LoadAsync(); MyMapView.Map.MinScale = 3000000; MyMapView.Map.MaxScale = 2000; MyMapView.GraphicsOverlays.Add(graphicsOverlay); // Add a graphic at JFK to serve as the origin. start = new MapPoint(564968.155634, 431946.116905, new SpatialReference(3168)); mapPoints.Add(start); SimpleMarkerSymbol startMarker = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Cross, System.Drawing.Color.Blue, 15); //PictureMarkerSymbol markerSym = new PictureMarkerSymbol(new Uri("C:\\Users\\mfathin.CSYSINT\\Documents\\Visual Studio 2017\\Projects\\ArcGISControl\\ArcGISControl\\Icon\\icons8-man-filled-100.PNG")); // markerSym.Opacity = 0.5; _startLocationGraphic = new Graphic(start, startMarker); // Create the graphic for the destination. _endLocationGraphic = new Graphic { Symbol = startMarker }; // Create the graphic for the path. _pathGraphic = new Graphic { Symbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.Blue, 1) }; graphic1 = new Graphic { Symbol = startMarker }; // Add the graphics to the overlay. graphicsOverlay.Graphics.Add(_startLocationGraphic); graphicsOverlay.Graphics.Add(_endLocationGraphic); graphicsOverlay.Graphics.Add(graphic1); graphicsOverlay.Graphics.Add(_pathGraphic); //// Update end location when the user taps. MyMapView.GeoViewTapped += MyMapViewOnGeoViewTapped; await MyMapView.SetViewpointAsync(new Viewpoint(start, 4000000)); // Update the extent to encompass all of the symbols //SetExtent(); // Add the graphics overlay to the map view //MyMapView.GraphicsOverlays.Add(_overlay); plotButton.Click += (sender, e) => { TryPlot(); }; TrueCalculation(); }