Example #1
0
 private void buttonSymbolStyleDialog_Click(object sender, System.EventArgs e)
 {
     if (_symbolStyleDlg == null)
     {
         _symbolStyleDlg = new SymbolStyleDlg();
         _symbolStyleDlg.SymbolStyle = _vectorSymbol;
     }
     if (_symbolStyleDlg.ShowDialog() == DialogResult.OK)
     {
         MapInfo.Styles.BasePointStyle sym = _symbolStyleDlg.SymbolStyle;
         if (sym is MapInfo.Styles.BitmapPointStyle)
         {
             _bitmapSymbol = sym as MapInfo.Styles.BitmapPointStyle;
             SetBitmapSymbolSample();
         }
         else if (sym is MapInfo.Styles.FontPointStyle)
         {
             _fontSymbol = sym as MapInfo.Styles.FontPointStyle;
             SetFontSymbolSample();
         }
         else
         {
             _vectorSymbol = sym as MapInfo.Styles.SimpleVectorPointStyle;
             SetVectorSymbolSample();
         }
     }
 }
Example #2
0
        /// <summary>
        /// �Ƿ�ӵ��
        /// </summary>
        /// <param name="IsBusy">True Ϊӵ�£�False Ϊ��ӵ��</param>
        /// <param name="iType">վ����</param>
        /// <returns></returns>
        private CompositeStyle GetCompositeStyleByIsBusy(bool IsBusy, int iType)
        {
            CompositeStyle cs = new CompositeStyle();
            BitmapPointStyle BitmapPoint = null;

            ////vs = new SimpleVectorPointStyle(34, System.Drawing.Color.Red, PointSize);

            ////��ȡ��վ��ʾЧ��
            //vs = GetSimpleVectorPointStyleByiType(iType);

            //SimpleLineStyle ls = new SimpleLineStyle(new LineWidth(1, LineWidthUnit.Pixel), 1, System.Drawing.Color.Red);
            //SimpleInterior si = new SimpleInterior(1, System.Drawing.Color.Red, System.Drawing.Color.Red);
            //AreaStyle a = new AreaStyle(ls, si);
            //CompositeStyle cs = new CompositeStyle(a, null, null, vs);
            if (IsBusy)
            {
                BitmapPoint = new BitmapPointStyle("BUSY.BMP");
            }
            else
            {
                switch (iType)
                {
                    case 0: BitmapPoint = new BitmapPointStyle("TA-0.bmp"); break;
                    case 1: BitmapPoint = new BitmapPointStyle("TA-1.bmp"); break;
                    case 2: BitmapPoint = new BitmapPointStyle("TA-2.bmp"); break;
                    case 3: BitmapPoint = new BitmapPointStyle("TA-3.bmp"); break;
                    case 4: BitmapPoint = new BitmapPointStyle("TA-4.bmp"); break;
                    case 5: BitmapPoint = new BitmapPointStyle("TA-5.bmp"); break;
                    default: BitmapPoint = new BitmapPointStyle("TA-0.bmp"); break;
                }
            }
            BitmapPoint.PointSize = PointSize;
            BitmapPoint.ApplyColor = false;
            BitmapPoint.ShowWhiteBackground = false;
            BitmapPoint.Color = System.Drawing.Color.AliceBlue;
            cs.SymbolStyle = BitmapPoint;
            return cs;
        }
Example #3
0
        private void MapForm1_Load(object sender, System.EventArgs e)
        {
            //replace default Map created by mapcontrol with FeatureRenderer
            CoordSys csys = Session.Current.CoordSysFactory.CreateCoordSys(CoordSysType.NonEarth, null, DistanceUnit.Meter, 0, 0, 0, 0, 0, 0, 0, 0, 0, new MapInfo.Geometry.DRect(0, 0, mapControl1.Map.Size.Width, mapControl1.Map.Size.Height), null);
            FeatureRenderer fr = Session.Current.MapFactory.CreateFeatureRenderer("stylesample", "stylesample", mapControl1.Map.Handle, mapControl1.Map.Size, csys);
            mapControl1.Map = fr;

            fr.SetView(csys.Bounds, csys);

            radioBlackFillStyle.Checked = true;

            // used as storage for line tab
            _lineStyle = new SimpleLineStyle();

            // set updown limits for line tab
            numericUpDownPixelWidth.Minimum = (decimal)LineWidth.MinPixel;
            numericUpDownPixelWidth.Maximum = (decimal)LineWidth.MaxPixel;
            numericUpDownPixelWidth.Value = (decimal)LineWidth.MinPixel;
            numericUpDownPointWidth.Minimum = (decimal)LineWidth.MinPoint;
            numericUpDownPointWidth.Maximum = (decimal)LineWidth.MaxPoint;
            numericUpDownPointWidth.Value = (decimal)LineWidth.MinPoint;
            if (_lineStyle.Width.Unit == LineWidthUnit.Pixel)
            {
                numericUpDownPixelWidth.Value = (decimal)_lineStyle.Width.Value;
                radioPixelWidth.Checked = true;
            }
            else
            {
                numericUpDownPointWidth.Value = (decimal)_lineStyle.Width.Value;
                radioPointWidth.Checked = true;
            }

            numericUpDownLinePattern.Minimum = SimpleLineStyle.MinLinePattern;
            numericUpDownLinePattern.Maximum = SimpleLineStyle.MaxLinePattern;
            numericUpDownLinePattern.Value = _lineStyle.Pattern;

            // for fill tab
            _fillStyle = new SimpleInterior();
            numericUpDownFillPattern.Minimum = SimpleInterior.MinFillPattern;
            numericUpDownFillPattern.Maximum = SimpleInterior.MaxFillPattern;
            numericUpDownLinePattern.Value = _fillStyle.Pattern;

            // vector symbols
            _vectorSymbol = new SimpleVectorPointStyle();
            numericUpDownVectorPointSize.Minimum = BasePointStyle.MinPointSize;
            numericUpDownVectorPointSize.Maximum = BasePointStyle.MaxPointSize;
            numericUpDownVectorPointSize.Value = (decimal)_vectorSymbol.PointSize;

            // mapinfo.fnt valid values
            numericUpDownVectorCode.Minimum = 31;
            numericUpDownVectorCode.Maximum = 67;

            // bitmap symbol
            _bitmapSymbol = new BitmapPointStyle();
            foreach (BitmapPointStyle b in Session.Current.StyleRepository.BitmapPointStyleRepository)
            {
                listBoxBitmapNames.Items.Add(b.Name);
            }
            checkBoxBitmapShowBackground.Checked = _bitmapSymbol.ShowWhiteBackground;
            checkBoxBitmapApplyColor.Checked = _bitmapSymbol.ApplyColor;
            numericUpDownBitmapPointSize.Minimum = BasePointStyle.MinPointSize;
            numericUpDownBitmapPointSize.Maximum = BasePointStyle.MaxPointSize;
            numericUpDownBitmapPointSize.Value = (decimal)_bitmapSymbol.PointSize;
            // font symbol
            _fontSymbol = new FontPointStyle();
            numericUpDownFontPointSize.Minimum = BasePointStyle.MinPointSize;
            numericUpDownFontPointSize.Maximum = BasePointStyle.MaxPointSize;
            numericUpDownFontPointSize.Value = (decimal)_fontSymbol.PointSize;
            numericUpDownFontCode.Minimum = BasePointStyle.MinCode;
            numericUpDownFontCode.Maximum = BasePointStyle.MaxCode;
            numericUpDownFontCode.Value = _fontSymbol.Code;

            // text
            _textStyle = new TextStyle();
              _textAngle = 0.0;
            numericUpDownTextSize.Minimum = 1;
            numericUpDownTextSize.Maximum = 96;
              numericUpDownTextSize.Value = (decimal)_fontSymbol.PointSize;
              numericUpDownTextAngle.Minimum = -360;
              numericUpDownTextAngle.Maximum = 360;

            Graphics g = CreateGraphics();
            FontFamily[] families = FontFamily.GetFamilies(g);
            // Draw text using each of the font families.
            foreach (FontFamily family in families)
            {
                comboBoxFontFamilies.Items.Add(family.Name);
                comboBoxTextFontFamily.Items.Add(family.Name);
            }
            g.Dispose();

            // select first fontname in each list (note that _fontSymbol and _textStyle
            // have to be constructed first since this causes a SelectedIndexChanged event).
            comboBoxFontFamilies.SelectedIndex = 0;
            comboBoxTextFontFamily.SelectedIndex = 0;

            foreach (Alignment alignment in Enum.GetValues(typeof(Alignment))) {
              comboBoxTextAlignment.Items.Add(alignment);
            }
              comboBoxTextAlignment.SelectedIndex = 0;

            foreach (Spacing spacing in Enum.GetValues(typeof(Spacing))) {
              comboBoxTextSpacing.Items.Add(spacing);
            }
            comboBoxTextSpacing.SelectedIndex = 0;

            // force first sample to be drawn
            tabControl1.SelectedIndex = 0;
            tabControl1_SelectedIndexChanged(this, null);
        }