private void btnMaxSymbol_Click(object sender, EventArgs e)
        {
            FormSymbol dlg = new FormSymbol(_maxSymbol);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _maxSymbol = dlg.Symbol;
            }
        }
Esempio n. 2
0
        private void btnOutlineSymbol_Click(object sender, EventArgs e)
        {
            if (_renderer.OutlineSymbol == null)
            {
                _renderer.OutlineSymbol = (ILineSymbol)RendererFunctions.CreateStandardSymbol(geometryType.Polyline);
            }
            FormSymbol dlg = new FormSymbol(_renderer.OutlineSymbol);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _renderer.OutlineSymbol = dlg.Symbol as ILineSymbol;
            }
        }
        private void btnChoosePolygonSymbol_Click(object sender, EventArgs e)
        {
            if (_renderer == null)
            {
                return;
            }

            FormSymbol dlg = new FormSymbol(_renderer[geometryType.Polygon]);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _renderer[geometryType.Polygon] = dlg.Symbol;
            }
        }
Esempio n. 4
0
        private void btnLineSymbol_Click(object sender, EventArgs e)
        {
            if (_renderer == null)
            {
                return;
            }

            FormSymbol dlg = new FormSymbol(((DimensionRenderer)_renderer).LineSymbol);

            if (dlg.ShowDialog() == DialogResult.OK &&
                dlg.Symbol is ILineSymbol)
            {
                ((DimensionRenderer)_renderer).LineSymbol = (ILineSymbol)dlg.Symbol;
            }
        }
Esempio n. 5
0
        private void btnChooseSymbol_Click(object sender, System.EventArgs e)
        {
            if (_renderer == null)
            {
                return;
            }

            if (_renderer is IFeatureRenderer2)
            {
                FormSymbol dlg = new FormSymbol(((IFeatureRenderer2)_renderer).Symbol);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    ((IFeatureRenderer2)_renderer).Symbol = dlg.Symbol;
                    UpdateUI();
                }
            }
        }
        private void btnSymbol_Click(object sender, EventArgs e)
        {
            if (!(_renderer.TextSymbol is ISymbol))
            {
                return;
            }

            FormSymbol dlg = new FormSymbol((ISymbol)_renderer.TextSymbol);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                if (dlg.Symbol is ITextSymbol)
                {
                    _renderer.TextSymbol = dlg.Symbol as ITextSymbol;
                    DrawPreview();
                }
            }
        }
        private void btnChooseSwitchOffSymbol_Click(object sender, EventArgs e)
        {
            if (_renderer == null)
            {
                return;
            }

            ISymbol symbol = _renderer[NetworkRenderer.RendererType.SwitchesOff];

            if (symbol != null)
            {
                FormSymbol dlg = new FormSymbol(symbol);
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    _renderer[NetworkRenderer.RendererType.SwitchesOff] = dlg.Symbol;
                }
            }
        }
        private void RendererBox_DoubleClick(object sender, EventArgs e)
        {
            object item = null;

            for (int i = 0; i < RendererBox.Items.Count; i++)
            {
                Rectangle rect = RendererBox.GetItemRectangle(i);
                if (rect.Y <= _mY && (rect.Y + rect.Height) >= _mY)
                {
                    item = RendererBox.Items[i];
                    break;
                }
            }
            if (item == null)
            {
                return;
            }

            if (item is LegendItem)
            {
                if (_mX > 20 && _mX < 50)
                {
                    ISymbol symbol = ((LegendItem)item).Item as ISymbol;
                    if (symbol != null)
                    {
                        FormSymbol dlg = new FormSymbol(symbol);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            int      index = RendererBox.Items.IndexOf(item);
                            RuleItem ritem = RendererBox.Items[index - 1] as RuleItem;
                            if (ritem != null)
                            {
                                ritem.Rule.Symbol       = dlg.Symbol;
                                ((LegendItem)item).Item = dlg.Symbol as ILegendItem;
                            }
                            RendererBox.Refresh();
                        }
                    }
                }
            }
        }
        private void RendererBox_DoubleClick(object sender, EventArgs e)
        {
            object item = null;

            for (int i = 0; i < RendererBox.Items.Count; i++)
            {
                Rectangle rect = RendererBox.GetItemRectangle(i);
                if (rect.Y <= _mY && (rect.Y + rect.Height) >= _mY)
                {
                    item = RendererBox.Items[i];
                    break;
                }
            }
            if (item == null)
            {
                return;
            }

            if (item is LegendItem && _renderer is ILegendGroup)
            {
                if (_mX > 20 && _mX < 50)
                {
                    ISymbol symbol = ((LegendItem)item).Item as ISymbol;
                    if (symbol != null)
                    {
                        FormSymbol dlg = new FormSymbol(symbol);
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            ((ILegendGroup)_renderer).SetSymbol(((LegendItem)item).Item, dlg.Symbol);
                            ((LegendItem)item).Item = dlg.Symbol;
                            RendererBox.Refresh();
                        }
                    }
                }
            }
        }
Esempio n. 10
0
        private void list_MouseDown(object sender, MouseEventArgs e)
        {
            ListViewItem item = list.GetItemAt(4, e.Y);

            if (!(item is SymbolListViewItem))
            {
                return;
            }

            if (e.X < imageList1.ImageSize.Width)
            {
                ISymbol symbol = ((SymbolListViewItem)item).Symbol;
                if (OnSymbolClicked != null)
                {
                    OnSymbolClicked(symbol);

                    Image image = imageList1.Images[item.ImageIndex];
                    using (System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image))
                    {
                        SymbolPreview.Draw(gr, new Rectangle(0, 0, image.Width, image.Height), symbol, true);
                        imageList1.Images[item.ImageIndex] = image;
                    }
                    list.Refresh();
                }
                else
                {
                    ISymbol    s   = (symbol is INullSymbol) ? RendererFunctions.CreateStandardSymbol(((INullSymbol)symbol).GeomtryType) : (ISymbol)symbol.Clone();
                    FormSymbol dlg = new FormSymbol(s);

                    if (dlg.ShowDialog() == DialogResult.OK)
                    {
                        Image image = imageList1.Images[item.ImageIndex];
                        using (System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(image))
                        {
                            SymbolPreview.Draw(gr, new Rectangle(0, 0, image.Width, image.Height), dlg.Symbol, true);
                            imageList1.Images[item.ImageIndex] = image;

                            if (OnSymbolChanged != null)
                            {
                                OnSymbolChanged(item.Text, dlg.Symbol);
                            }
                        }
                        ((SymbolListViewItem)item).Symbol = dlg.Symbol;
                    }
                }

                if (_box.Visible)
                {
                    HideBox();
                }
            }
            else
            {
                int  w       = 0;
                bool showBox = false;
                foreach (ColumnHeader col in list.Columns)
                {
                    w += col.Width;
                    if (e.X < w)
                    {
                        if (col.Index == 0 && OnKeyChanged == null)
                        {
                            break;
                        }
                        if (col.Index > 0 && OnLabelChanged == null)
                        {
                            break;
                        }

                        Rectangle rect = item.Bounds;
                        rect.X      = 3 + w - col.Width + ((col.Index == 0) ? imageList1.ImageSize.Width : 0);
                        rect.Y      = 3 + rect.Top + rect.Height / 2 - _box.Height / 2;
                        rect.Width  = col.Width - ((col.Index == 0) ? imageList1.ImageSize.Width : 0);
                        rect.Height = _box.Height;

                        if (_box.Visible == true)
                        {
                            HideBox();
                        }

                        _box.Bounds  = rect;
                        _box.Text    = item.SubItems[col.Index].Text;
                        _box.Visible = true;
                        _box.Focus();
                        _labelEditItem  = (SymbolListViewItem)item;
                        _labelEditIndex = col.Index;
                        showBox         = true;
                        break;
                    }
                }
                if (showBox == false && _box.Visible == true)
                {
                    HideBox();
                    _labelEditIndex = 0;
                }
            }
        }