Beispiel #1
0
        //end of operation function

        private void miGetRenderInfo_Click(object sender, EventArgs e)
        {
            DataOperator dataOperator = new DataOperator(axMapControl1.Map);
            ILayer       layer        = axMapControl1.Map.get_Layer(0);

            MessageBox.Show(MapComposer.GetRendererTypeByLayer(layer));
        }
Beispiel #2
0
        /* Usage: Simply render the layer - main function
         * Author: Ding
         * Time: 2019/03/22
         */
        private void mainRenderSimply(String LayerName)
        {
            DataOperator dataOperator = new DataOperator(axMapControl1.Map);

            if (LayerName == "")
            {
                MessageBox.Show("ERROR: 没有可显示的图层!");
                return;
            }
            ILayer layer = dataOperator.GetLayerByName(LayerName);

            //Set the color of symbol from ColorDialog
            // -- I don't want to rewrite the colordialog class, so let it show in the middle of window
            ColorDialog colorDialog1  = new ColorDialog();
            Color       selectedColor = Color.FromArgb(0, 255, 0, 0); //selectedColor is the color selected for the symbol, default color is red

            if (colorDialog1.ShowDialog() == DialogResult.OK)
            {
                selectedColor = colorDialog1.Color;
            }
            //set color
            if (selectedColor.A == 0)
            {
                return;
            }
            IRgbColor rgbColor = new RgbColorClass();

            rgbColor.Red = selectedColor.R; rgbColor.Green = selectedColor.G; rgbColor.Blue = selectedColor.B;



            ISymbol symbol = MapComposer.GetSymbolFromLayer(layer);
            IColor  color  = rgbColor as IColor;

            bool bRes = MapComposer.RenderSimply(layer, color);

            if (bRes)
            {
                axTOCControl1.ActiveView.ContentsChanged();
                axMapControl1.ActiveView.Refresh();
                //miRenderSimply.Enabled = false;
            }
            else
            {
                MessageBox.Show("简单渲染图层失败!");
            }
        }