Example #1
0
        /// <summary>
        /// Refresh the controls according to the underlying object.
        /// </summary>
        public void RefreshView()
        {
            if (map == null)
            {
                return;
            }
            // general tab
            this.textBoxName.Text      = map.name;
            this.textBoxShapePath.Text = map.shapepath;
            this.textBoxImagepath.Text = map.web.imagepath;
            this.textBoxSymbolset.Text = map.symbolset.filename;
            this.textBoxFontset.Text   = map.fontset.filename;
            // image details tab
            this.colorPickerBackColor.SetColor(map.imagecolor);
            comboBoxImageType.Items.Clear();
            comboBoxImageType.Items.AddRange(new object[] { "png", "jpeg", "gif", "png8", "png24", "pdf", "svg", "cairopng"
                                                            , "GTiff", "kml", "kmz" });

            for (int i = 0; i < map.numoutputformats; i++)
            {
                outputFormatObj format = map.getOutputFormat(i);
                if (!comboBoxImageType.Items.Contains(format.name))
                {
                    comboBoxImageType.Items.Add(format.name);
                }
            }

            //outputFormatObj[] formats = map.outputformatlist;
            //for (int i = 0; i < formats.Length; i++)
            //{
            //    if (!comboBoxImageType.Items.Contains(formats[i].name))
            //        comboBoxImageType.Items.Add(formats[i].name);
            //}
            comboBoxImageType.SelectedItem = map.imagetype;
            this.textBoxResolution.Text    = map.resolution.ToString();

            // setting up the projection information
            this.textBoxProjection.Tag  = map.getProjection();
            this.textBoxProjection.Text = "";
            string key = map.getFirstMetaDataKey();

            while (key != null)
            {
                if (key == "coordsys_name")
                {
                    this.textBoxProjection.Text = map.getMetaData("coordsys_name");
                    break;
                }
                key = map.getNextMetaDataKey(key);
            }
            if (this.textBoxProjection.Text == "")
            {
                string proj4;
                int    epsg;
                this.textBoxProjection.Text = MapUtils.FindProjection(this.textBoxProjection.Tag.ToString(), out proj4, out epsg);
            }

            comboBoxUnits.DataSource   = Enum.GetValues(typeof(MS_UNITS));
            comboBoxUnits.SelectedItem = (MS_UNITS)map.units;

            checkBoxTransparent.Checked = (map.outputformat.transparent == mapscript.MS_TRUE && map.outputformat.imagemode == (int)MS_IMAGEMODE.MS_IMAGEMODE_RGBA);
            checkBoxTransparent.Enabled = (map.outputformat.imagemode == (int)MS_IMAGEMODE.MS_IMAGEMODE_RGB || map.outputformat.imagemode == (int)MS_IMAGEMODE.MS_IMAGEMODE_RGBA);

            // extent tab
            UpdateExtentValues();

            SetDirty(false);
        }