private void UpdateSettings(object sender, EventArgs e) { SlopeType type = SlopeType.None; switch (_slopeTypePicker.SelectedSegment) { case 0: type = SlopeType.Degree; break; case 1: type = SlopeType.PercentRise; break; case 2: type = SlopeType.Scaled; break; } HillshadeRenderer renderer = new HillshadeRenderer( altitude: _altitudeSlider.Value, azimuth: _azimuthSlider.Value, zfactor: 1, slopeType: type, pixelSizeFactor: 1, pixelSizePower: 1, nbits: 8); _rasterLayer.Renderer = renderer; }
private void ApplyHillshadeButton_Click(object sender, EventArgs e) { // Get the current parameter values double altitude = AltitudeSlider.Value; double azimuth = AzimuthSlider.Value; SlopeType typeOfSlope = _slopeTypeValues[SlopeTypePicker.SelectedItem.ToString()]; // Create a hillshade renderer that uses the values selected by the user HillshadeRenderer hillshadeRenderer = new HillshadeRenderer(altitude, azimuth, ZFactor, typeOfSlope, PixelSizeFactor, PixelSizePower, PixelBitDepth); // Apply the new renderer to the raster layer _rasterLayer.Renderer = hillshadeRenderer; }
private void ApplyHillshadeButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e) { // Get the current parameter values double altitude = AltitudeSlider.Value; double azimuth = AzimuthSlider.Value; SlopeType typeOfSlope = Enum.Parse <SlopeType>(SlopeTypeCombo.SelectedItem as string); // Create a hillshade renderer that uses the values selected by the user HillshadeRenderer hillshadeRenderer = new HillshadeRenderer(altitude, azimuth, ZFactor, typeOfSlope, PixelSizeFactor, PixelSizePower, PixelBitDepth); // Apply the new renderer to the raster layer _rasterLayer.Renderer = hillshadeRenderer; }
private void ApplyHillshadeButton_Click(object sender, EventArgs e) { // Get the current azimuth and altitude parameter values int altitude = 0; int azimuth = 0; int.TryParse(_altitudeTextView.Text, out altitude); int.TryParse(_azimuthTextView.Text, out azimuth); // Create a hillshade renderer that uses the values selected by the user HillshadeRenderer hillshadeRenderer = new HillshadeRenderer(altitude, azimuth, ZFactor, _slopeType, PixelSizeFactor, PixelSizePower, PixelBitDepth); // Apply the new renderer to the raster layer _rasterLayer.Renderer = hillshadeRenderer; }
private void ApplyHillshade_Click(object sender, EventArgs e) { if (_applyHillshadeRendererUi != null) { return; } // Create a view to show map item info entry controls over the map view. CGRect ovBounds = new CGRect(0, 60, View.Bounds.Width, View.Bounds.Height); _applyHillshadeRendererUi = new ApplyHillshadeRendererDialogOverlay(ovBounds, 0.9f, UIColor.White); // Handle the OnHillshadeInputsEntered event to get the new renderer defined by the user. _applyHillshadeRendererUi.OnHillshadeInputsEntered += (s, hillshadeArgs) => { // Get the new hillshade renderer. HillshadeRenderer newHillshadeRenderer = hillshadeArgs.HillshadeRasterRenderer; // If it's not null, apply the new renderer to the layer. if (newHillshadeRenderer != null) { _rasterLayer.Renderer = newHillshadeRenderer; } // Remove the parameters input UI. _applyHillshadeRendererUi.Hide(); _applyHillshadeRendererUi = null; }; // Handle the cancel event when the user closes the dialog without entering hillshade parameters. _applyHillshadeRendererUi.OnCanceled += (s, args) => { // Remove the parameters input UI. _applyHillshadeRendererUi.Hide(); _applyHillshadeRendererUi = null; }; // Add the input UI view (will display semi-transparent over the map view). View.Add(_applyHillshadeRendererUi); }
private void InputHillshadeParamsButton_Click(object sender, EventArgs e) { // Fire the OnHillshadeInputsEntered event and provide the hillshade renderer. if (OnHillshadeInputsEntered != null) { // Read the inputs provided by the user. // - Altitude and azimuth. double altitude = _altitudeSlider.Value; double azimuth = _azimuthSlider.Value; // - Get the model from the slope type picker and read the selected type. nint selected = _slopeTypePicker.SelectedSegment; SlopeType selectedSlopeType = ((SlopeType[])Enum.GetValues(typeof(SlopeType)))[selected]; // Create a new HillshadeRenderer using the input values and constants. HillshadeRenderer hillshade = new HillshadeRenderer(altitude, azimuth, ZFactor, selectedSlopeType, PixelSizeFactor, PixelSizePower, PixelBitDepth); // Create a new HillshadeParametersEventArgs and provide the new renderer. HillshadeParametersEventArgs inputParamsEventArgs = new HillshadeParametersEventArgs(hillshade); // Raise the event with the custom arguments. OnHillshadeInputsEntered(sender, inputParamsEventArgs); } }
// Store the hillshade renderer passed into the constructor. public HillshadeParametersEventArgs(HillshadeRenderer renderer) { HillshadeRasterRenderer = renderer; }