Example #1
0
        private void ComputeMinMaxEvery()
        {
            double min, max, every;

            Raster rst = Layers[comboBoxLayerList.SelectedIndex].DataSet as Raster;

            Contour.ContourType contType = GetSelectedType();

            Contour.CreateMinMaxEvery(rst, contType, out min, out max, out every);

            numericUpDownMin.Value = (decimal)min;
            numericUpDownMax.Value = (decimal)max;

            numericUpDownEvery.Value = (decimal)every;

            tomPaletteEditor1.ClearItems();

            if (contType == Contour.ContourType.Line)
            {
                tomPaletteEditor1.AddItem(min, System.Drawing.Color.Chartreuse);
                tomPaletteEditor1.AddItem(max, System.Drawing.Color.Magenta);
            }

            if (contType == Contour.ContourType.Polygon)
            {
                tomPaletteEditor1.AddItem(min + (every / 2), System.Drawing.Color.Chartreuse);
                tomPaletteEditor1.AddItem(max - (every / 2), System.Drawing.Color.Magenta);
            }

            tomPaletteEditor1.Invalidate();
        }
Example #2
0
        private Contour.ContourType GetSelectedType()
        {
            Contour.ContourType ContType = new Contour.ContourType();

            if (comboBoxType.SelectedIndex == 0)
                ContType = Contour.ContourType.Line;
            else
                ContType = Contour.ContourType.Polygon;

            return ContType;
        }
Example #3
0
        private Contour.ContourType GetSelectedType()
        {
            Contour.ContourType ContType = new Contour.ContourType();

            if (comboBoxType.SelectedIndex == 0)
            {
                ContType = Contour.ContourType.Line;
            }
            else
            {
                ContType = Contour.ContourType.Polygon;
            }

            return(ContType);
        }
Example #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            LayerName = comboBoxLayerList.Text;

            max = (double)numericUpDownMax.Value;
            min = (double)numericUpDownMin.Value;
            eve = (double)numericUpDownEvery.Value;

            contourtype = GetSelectedType();

            lev = Contour.CreateLevels(min, max, eve);

            Contours            = Contour.Execute(layers[comboBoxLayerList.SelectedIndex].DataSet as DotSpatial.Data.Raster, contourtype, "Value", lev);
            Contours.Projection = layers[comboBoxLayerList.SelectedIndex].Projection;

            int NumLev = lev.GetLength(0);

            switch (contourtype)
            {
            case (Contour.ContourType.Line):
            {
                color = new Color[NumLev];
                for (int i = 0; i < NumLev; i++)
                {
                    color[i] = tomPaletteEditor1.GetColor(lev[i]);
                }
            }
            break;

            case (Contour.ContourType.Polygon):
            {
                color = new Color[NumLev - 1];
                for (int i = 0; i < NumLev - 1; i++)
                {
                    color[i] = tomPaletteEditor1.GetColor(lev[i] + (eve / 2));
                }
            }
            break;
            }
            this.DialogResult = DialogResult.OK;

            this.Close();
        }
Example #5
0
        private void ComputeMinMaxEvery()
        {
            double min, max, every;

            DotSpatial.Data.Raster rst = layers[comboBoxLayerList.SelectedIndex].DataSet as DotSpatial.Data.Raster;

            Contour.ContourType ContType = new Contour.ContourType();

            if (comboBoxType.SelectedIndex == 0)
            {
                ContType = Contour.ContourType.Line;
            }
            else
            {
                ContType = Contour.ContourType.Polygon;
            }

            Contour.CreateMinMaxEvery(rst, ContType, out min, out max, out every);;

            numericUpDownMin.Value = (decimal)min;
            numericUpDownMax.Value = (decimal)max;

            numericUpDownEvery.Value = (decimal)every;

            tomPaletteEditor1.ClearItems();

            if (ContType == Contour.ContourType.Line)
            {
                tomPaletteEditor1.AddItem(min, Color.Chartreuse);
                tomPaletteEditor1.AddItem(max, Color.Magenta);
                //tomPaletteEditor1.AddItem((max + min) / 2, Color.Yellow);
            }

            if (ContType == Contour.ContourType.Polygon)
            {
                tomPaletteEditor1.AddItem(min + every / 2, Color.Chartreuse);
                tomPaletteEditor1.AddItem(max - every / 2, Color.Magenta);
                //tomPaletteEditor1.AddItem((max + min) / 2, Color.Yellow);
            }

            tomPaletteEditor1.Invalidate();
        }
Example #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            LayerName = comboBoxLayerList.Text;

            max = (double)numericUpDownMax.Value;
            min = (double)numericUpDownMin.Value;
            eve = (double)numericUpDownEvery.Value;

            contourtype = GetSelectedType();

            lev = Contour.CreateLevels(min, max, eve);

            Contours = Contour.Execute(layers[comboBoxLayerList.SelectedIndex].DataSet as DotSpatial.Data.Raster, contourtype, "Value", lev);
            Contours.Projection = layers[comboBoxLayerList.SelectedIndex].Projection;

            int NumLev = lev.GetLength(0);

            switch (contourtype)
            {
                case (Contour.ContourType.Line):
                    {
                        color = new Color[NumLev];
                        for (int i = 0; i < NumLev; i++)
                        {
                            color[i] = tomPaletteEditor1.GetColor(lev[i]);
                        }
                    }
                    break;
                case (Contour.ContourType.Polygon):
                    {
                        color = new Color[NumLev - 1];
                        for (int i = 0; i < NumLev - 1; i++)
                        {
                            color[i] = tomPaletteEditor1.GetColor(lev[i] + (eve / 2));
                        }
                    }
                    break;
            }
            this.DialogResult = DialogResult.OK;

            this.Close();
        }
Example #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            LayerName = comboBoxLayerList.Text;

            Max = (double)numericUpDownMax.Value;
            Min = (double)numericUpDownMin.Value;
            Eve = (double)numericUpDownEvery.Value;

            Contourtype = GetSelectedType();

            Lev = Contour.CreateLevels(Min, Max, Eve);

            Contours            = Contour.Execute(Layers[comboBoxLayerList.SelectedIndex].DataSet as Raster, Contourtype, "Value", Lev);
            Contours.Projection = Layers[comboBoxLayerList.SelectedIndex].Projection;

            int numLev = Lev.GetLength(0);

            switch (Contourtype)
            {
            case (Contour.ContourType.Line):
            {
                Color = new Color[numLev];
                for (int i = 0; i < numLev; i++)
                {
                    Color[i] = tomPaletteEditor1.GetColor(Lev[i]);
                }
            }
            break;

            case (Contour.ContourType.Polygon):
            {
                Color = new Color[numLev - 1];
                for (int i = 0; i < numLev - 1; i++)
                {
                    Color[i] = tomPaletteEditor1.GetColor(Lev[i] + (Eve / 2));
                }
            }
            break;
            }
            DialogResult = DialogResult.OK;
            Close();
        }
Example #8
0
        private void ComputeMinMaxEvery()
        {
            double min, max, every;

            DotSpatial.Data.Raster rst = layers[comboBoxLayerList.SelectedIndex].DataSet as DotSpatial.Data.Raster;

            Contour.ContourType ContType = new Contour.ContourType();

            if (comboBoxType.SelectedIndex == 0)
                ContType = Contour.ContourType.Line;
            else
                ContType = Contour.ContourType.Polygon;

            Contour.CreateMinMaxEvery(rst, ContType, out min, out  max, out every); ;

            numericUpDownMin.Value = (decimal)min;
            numericUpDownMax.Value = (decimal)max;

            numericUpDownEvery.Value = (decimal)every;

            tomPaletteEditor1.ClearItems();

            if (ContType == Contour.ContourType.Line)
            {
                tomPaletteEditor1.AddItem(min, Color.Chartreuse);
                tomPaletteEditor1.AddItem(max, Color.Magenta);
                //tomPaletteEditor1.AddItem((max + min) / 2, Color.Yellow);
            }

            if (ContType == Contour.ContourType.Polygon)
            {
                tomPaletteEditor1.AddItem(min + every / 2, Color.Chartreuse);
                tomPaletteEditor1.AddItem(max - every / 2, Color.Magenta);
                //tomPaletteEditor1.AddItem((max + min) / 2, Color.Yellow);
            }

            tomPaletteEditor1.Invalidate();
        }