Beispiel #1
0
        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("Необходимо выбрать векторный слой !");
            }
        }