private void toolStripButton6_Click(object sender, EventArgs e) { double searchRadius = 1; int power = 1; if (map.LayerControl.SelectedLayer != null && map.LayerControl.SelectedLayer is VectorLayer && map.LayerControl.SelectedLayer.Visible) { VectorLayer vectorLayer = (VectorLayer)map.LayerControl.SelectedLayer; GridGeometry gridGeometry = null; GridInterpolationModalForm interpolationForm = new GridInterpolationModalForm(); interpolationForm.InitializeForm(map.LayerControl.VectorLayers, ref vectorLayer, ref gridGeometry, ref searchRadius, ref power); if (interpolationForm.DialogResult == DialogResult.OK) { GridLayer gridLayer = new GridLayer(gridGeometry, map); foreach (var layer in map.Layers) { if (layer.Name == gridLayer.Name) { gridLayer.Name = Interaction.InputBox("Grid для данного слоя уже существует. Введите уникальное название для нового слоя.", "Название слоя", vectorLayer.Name) + ".grd"; } else { gridLayer.Name = vectorLayer.Name + ".grd"; } } map.AddLayer(gridLayer); List <GeoPoint> points = new List <GeoPoint>(); gridLayer.ColorMin = MinStripButton.BackColor; gridLayer.ColorMax = MaxStripButton.BackColor; points = GetPoints(vectorLayer); if (points.Count == 0) { MessageBox.Show("Количество точек равно 0"); } else { selectedLayer = gridLayer; gridLayer.DoInterpolation(points, searchRadius, power); ShowColors(); } } else { } map.Refresh(); } else { MessageBox.Show("Необходимо выбрать векторный слой !"); } }
private void UpdateGeometry(object sender, EventArgs e) { GridGeometry geom = selectedGeometry; selectedX = geom.CountX; selectedY = geom.CountY; double dx = geom.XMax - geom.XMin; double dy = geom.YMax - geom.YMin; selectedSearchRadius = Math.Sqrt(dx * dx + dy * dy); }
protected internal override void OnMouseMove(object sender, MouseMoveEventArgs e) { if (_manipulationScope == null) { return; } var documentCoords = _documentControl.GetDocumentCoordsAt(e.MouseState.Position); GridGeometry.ForEachCellInLine(_previousDrawPosition, documentCoords, DrawGlyph); _previousDrawPosition = documentCoords; }
private void GetDefaultGeometry() { GridGeometry geom = selectedGeometry; double dx = geom.XMax - geom.XMin; double dy = geom.YMax - geom.YMin; if (dx >= dy) { selectedCell = dx / 100; } else { selectedCell = dy / 100; } }
public void InitializeForm(List <VectorLayer> vectorLayers, ref VectorLayer selectedLayer, ref GridGeometry gridGeometry, ref double searchRadius, ref int power) { TypeGeometryComboBox.SelectedIndexChanged -= UpdateGeometry; VectorLayersListComboBox.SelectedIndexChanged -= UpdateGeometry; numericUpDownGridStep.ValueChanged -= UpdateGeometry; numericUpDownX.ValueChanged -= UpdateXStepGeometry; numericUpDownY.ValueChanged -= UpdateYStepGeometry; rangeOfVectorLayers = new List <VectorLayer>(vectorLayers); VectorLayersListComboBox.DataSource = null; VectorLayersListComboBox.Items.Clear(); VectorLayersListComboBox.DataSource = vectorLayers; VectorLayersListComboBox.DisplayMember = "Name"; VectorLayersListComboBox.ValueMember = "Name"; selectedSearchRadius = searchRadius; selectedPower = power; SelectedLayer = selectedLayer; //selectedGeometry = gridGeometry; GetDefaultGeometry(); UpdateGeometry(new object(), new EventArgs()); TypeGeometryComboBox.SelectedIndexChanged += UpdateGeometry; VectorLayersListComboBox.SelectedIndexChanged += UpdateGeometry; numericUpDownGridStep.ValueChanged += UpdateGeometry; numericUpDownX.ValueChanged += UpdateXStepGeometry; numericUpDownY.ValueChanged += UpdateYStepGeometry; //if (ShowDialog() == DialogResult.Cancel) //{ // return false; //} ShowDialog(); power = selectedPower; searchRadius = selectedSearchRadius; gridGeometry = selectedGeometry; this.Close(); //return true; }
private void UpdateYStepGeometry(object sender, EventArgs e) { TypeGeometryComboBox.SelectedIndexChanged -= UpdateGeometry; VectorLayersListComboBox.SelectedIndexChanged -= UpdateGeometry; numericUpDownGridStep.ValueChanged -= UpdateGeometry; numericUpDownX.ValueChanged -= UpdateXStepGeometry; GridGeometry geom = new GridGeometry(); geom.CountY = selectedY; selectedCell = dy / (geom.CountY - 1); geom.Cell = selectedCell; selectedX = (int)(dx / (geom.Cell) + 1); geom.CountX = selectedX; selectedGeometry = geom; TypeGeometryComboBox.SelectedIndexChanged += UpdateGeometry; VectorLayersListComboBox.SelectedIndexChanged += UpdateGeometry; numericUpDownGridStep.ValueChanged += UpdateGeometry; numericUpDownX.ValueChanged += UpdateXStepGeometry; }