Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LineSymbolDialog"/> class.
        /// </summary>
        /// <param name="symbolizer">The line symbolizer.</param>
        public LineSymbolDialog(ILineSymbolizer symbolizer)
        {
            InitializeComponent();

            _original   = symbolizer;
            _symbolizer = symbolizer.Copy();
            Configure();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Launches a form for editing the line symbolizer
 /// </summary>
 /// <param name="context"></param>
 /// <param name="provider"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     _original = context.Instance as ILineSymbolizer;
     IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     _editCopy = _original.Copy();
     DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(_editCopy);
     dialog.ChangesApplied += DialogChangesApplied;
     if (_original != null)
         return dialogProvider.ShowDialog(dialog) != DialogResult.OK ? _original.Strokes : _editCopy.Strokes;
     return null;
 }
 /// <summary>
 /// Launches a form for editing the line symbolizer
 /// </summary>
 /// <param name="context"></param>
 /// <param name="provider"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     _original = value as ILineSymbolizer;
     if (_original == null) return value;
     _copy = _original.Copy();
     IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(_copy);
     dialog.ChangesApplied += new EventHandler(dialog_ChangesApplied);
     if(dialogProvider.ShowDialog(dialog) != DialogResult.OK)return _original;
     _original.CopyProperties(_copy);
     return value;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LineCategory"/> class based on a symbolizer.
        /// This uses the same symbolizer, but with a fill and border color of light cyan for the selection symbolizer.
        /// </summary>
        /// <param name="lineSymbolizer">The symbolizer to use in order to create a category.</param>
        public LineCategory(ILineSymbolizer lineSymbolizer)
        {
            Symbolizer = lineSymbolizer;
            ILineSymbolizer select = lineSymbolizer.Copy();

            SelectionSymbolizer = select;
            if (select.Strokes != null && select.Strokes.Count > 0)
            {
                if (select.Strokes[select.Strokes.Count - 1] is ISimpleStroke ss)
                {
                    ss.Color = Color.Cyan;
                }
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes the control by updating the symbolizer
 /// </summary>
 /// <param name="original"></param>
 public void Initialize(ILineSymbolizer original)
 {
     _original            = original;
     _symbolizer          = original.Copy();
     ccStrokes.Strokes    = _symbolizer.Strokes;
     chkSmoothing.Checked = _symbolizer.Smoothing;
     ccStrokes.RefreshList();
     if (_symbolizer.Strokes.Count > 0)
     {
         ccStrokes.SelectedStroke = _symbolizer.Strokes[0];
     }
     UpdatePreview();
     UpdateStrokeControls();
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Launches a form for editing the line symbolizer
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            _original = context.Instance as ILineSymbolizer;
            IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            _editCopy = _original.Copy();
            DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(_editCopy);

            dialog.ChangesApplied += DialogChangesApplied;
            if (_original != null)
            {
                return(dialogProvider.ShowDialog(dialog) != DialogResult.OK ? _original.Strokes : _editCopy.Strokes);
            }
            return(null);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Launches a form for editing the line symbolizer
 /// </summary>
 /// <param name="context"></param>
 /// <param name="provider"></param>
 /// <param name="value"></param>
 /// <returns></returns>
 public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     original = context.Instance as ILineSymbolizer;
     IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
     editCopy = original.Copy();
     DetailedLineSymbolDialog dialog = new DetailedLineSymbolDialog(editCopy);
     dialog.ChangesApplied += new EventHandler(dialog_ChangesApplied);
     if (dialogProvider.ShowDialog(dialog) != System.Windows.Forms.DialogResult.OK)
     {
         return original.Strokes;
     }
     else
     {
         return editCopy.Strokes;
     }
 }
Ejemplo n.º 8
0
        /// <summary>
        /// Launches a form for editing the line symbolizer
        /// </summary>
        /// <param name="context"></param>
        /// <param name="provider"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            _original = value as ILineSymbolizer;
            if (_original == null)
            {
                return(value);
            }
            _copy = _original.Copy();
            IWindowsFormsEditorService dialogProvider = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            DetailedLineSymbolDialog   dialog         = new DetailedLineSymbolDialog(_copy);

            dialog.ChangesApplied += DialogChangesApplied;
            if (dialogProvider.ShowDialog(dialog) != DialogResult.OK)
            {
                return(_original);
            }
            _original.CopyProperties(_copy);
            return(value);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Handles the inter-connectivity of the various controls and updates
        /// them all to match the latest value.
        /// </summary>
        public void UpdateControls()
        {
            if (_ignore)
            {
                return;
            }
            _ignore = true;

            if (_sizeRange == null)
            {
                _ignore = false;
                return;
            }
            chkSizeRange.Checked = _sizeRange.UseSizeRange;
            trkStart.Value       = (int)_sizeRange.Start;
            trkEnd.Value         = (int)_sizeRange.End;
            IPointSymbolizer ps = _sizeRange.Symbolizer as IPointSymbolizer;

            if (ps != null)
            {
                Color color = ps.GetFillColor();
                if (_scheme != null && _scheme.EditorSettings.UseColorRange)
                {
                    color = _scheme.EditorSettings.StartColor;
                }
                if (chkSizeRange.Checked)
                {
                    psvStart.Symbolizer = _sizeRange.GetSymbolizer(_sizeRange.Start, color) as IPointSymbolizer;
                }
                else
                {
                    IPointSymbolizer sm = ps.Copy();
                    sm.SetFillColor(color);
                    psvStart.Symbolizer = sm;
                }
                if (_scheme != null && _scheme.EditorSettings.UseColorRange)
                {
                    color = _scheme.EditorSettings.EndColor;
                }
                if (chkSizeRange.Checked)
                {
                    psvEnd.Symbolizer = _sizeRange.GetSymbolizer(_sizeRange.End, color) as IPointSymbolizer;
                }
                else
                {
                    IPointSymbolizer sm = ps.Copy();
                    sm.SetFillColor(color);
                    psvEnd.Symbolizer = sm;
                }
            }

            ILineSymbolizer ls = _sizeRange.Symbolizer as ILineSymbolizer;

            if (ls != null)
            {
                Color color = ls.GetFillColor();
                if (_scheme != null && _scheme.EditorSettings.UseColorRange)
                {
                    color = _scheme.EditorSettings.StartColor;
                }
                if (chkSizeRange.Checked)
                {
                    lsvStart.Symbolizer = _sizeRange.GetSymbolizer(_sizeRange.Start, color) as ILineSymbolizer;
                }
                else
                {
                    ILineSymbolizer sm = ls.Copy();
                    sm.SetFillColor(color);
                    lsvStart.Symbolizer = sm;
                }
                if (_scheme != null && _scheme.EditorSettings.UseColorRange)
                {
                    color = _scheme.EditorSettings.EndColor;
                }
                if (chkSizeRange.Checked)
                {
                    lsvEnd.Symbolizer = _sizeRange.GetSymbolizer(_sizeRange.End, color) as ILineSymbolizer;
                }
                else
                {
                    ILineSymbolizer sm = ls.Copy();
                    sm.SetFillColor(color);
                    lsvEnd.Symbolizer = sm;
                }
            }

            nudStart.Value = (decimal)_sizeRange.Start;
            nudEnd.Value   = (decimal)_sizeRange.End;

            _ignore = false;

            OnSizeRangeChanged();
        }
Ejemplo n.º 10
0
 /// <summary>
 /// Creates a new category based on a symbolizer, and uses the same symbolizer, but with a fill and border color of light cyan
 /// for the selection symbolizer
 /// </summary>
 /// <param name="lineSymbolizer">The symbolizer to use in order to create a category</param>
 public LineCategory(ILineSymbolizer lineSymbolizer)
 {
     Symbolizer = lineSymbolizer;
     ILineSymbolizer select = lineSymbolizer.Copy();
     SelectionSymbolizer = select;
     if (select.Strokes != null && select.Strokes.Count > 0)
     {
         ISimpleStroke ss = select.Strokes[select.Strokes.Count - 1] as ISimpleStroke;
         if (ss != null) ss.Color = Color.Cyan;
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DetailedLineSymbolControl"/> class that displays a copy of the original,
 /// and when apply changes is pressed, will copy properties to the original.
 /// </summary>
 /// <param name="original">The current symbolizer being viewed on the map.</param>
 public DetailedLineSymbolControl(ILineSymbolizer original)
 {
     _original   = original;
     _symbolizer = original.Copy();
     Configure();
 }
 /// <summary>
 /// Creates a new Detailed Line Symbol Dialog that displays a copy of the original,
 /// and when apply changes is pressed, will copy properties to the original.
 /// </summary>
 /// <param name="original">The current symbolizer being viewed on the map</param>
 public DetailedLineSymbolControl(ILineSymbolizer original)
 {
     _original = original;
     _symbolizer = original.Copy();
     Configure();
 }
 /// <summary>
 /// Initializes the control by updating the symbolizer
 /// </summary>
 /// <param name="original"></param>
 public void Initialize(ILineSymbolizer original)
 {
     _original = original;
     _symbolizer = original.Copy();
     ccStrokes.Strokes = _symbolizer.Strokes;
     chkSmoothing.Checked = _symbolizer.Smoothing;
     ccStrokes.RefreshList();
     if (_symbolizer.Strokes.Count > 0)
     {
         ccStrokes.SelectedStroke = _symbolizer.Strokes[0];
     }
     UpdatePreview();
     UpdateStrokeControls();
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Creates a new Detailed Line Symbol Dialog
        /// </summary>
        /// <param name="symbolizer"></param>
        public LineSymbolDialog(ILineSymbolizer symbolizer)
        {
            InitializeComponent();

            _original = symbolizer;
            _symbolizer = symbolizer.Copy();
            Configure();
        }