Exemplo n.º 1
0
        public void Simplify()
        {
            if (_renderers == null || _renderers.Count == 0)
            {
                return;
            }

            foreach (IFeatureRenderer renderer in _renderers)
            {
                if (renderer is ISimplify)
                {
                    ((ISimplify)renderer).Simplify();
                }
            }

            #region SimpleRenderer zusammenfassen
            bool allSimpleRenderers = true;
            foreach (IRenderer renderer in _renderers)
            {
                if (!(renderer is SimpleRenderer))
                {
                    allSimpleRenderers = false;
                    break;
                }
            }

            if (allSimpleRenderers)
            {
                IFeatureRenderer renderer = _renderers[0];
                if (_renderers.Count > 1)
                {
                    ISymbolCollection symCol = PlugInManager.Create(new Guid("062AD1EA-A93C-4c3c-8690-830E65DC6D91")) as ISymbolCollection;
                    foreach (IRenderer sRenderer in _renderers)
                    {
                        if (((SimpleRenderer)renderer).Symbol != null)
                        {
                            symCol.AddSymbol(((SimpleRenderer)renderer).Symbol);
                        }
                    }
                    ((SimpleRenderer)renderer).Symbol = (ISymbol)symCol;
                    _renderers.Clear();
                    _renderers.Add(renderer);
                }
            }
            #endregion

            #region Combine Renderers
            for (int i = 0; i < _renderers.Count; i++)
            {
                for (int j = i + 1; j < _renderers.Count; j++)
                {
                    if (_renderers[i].Combine(_renderers[j]))
                    {
                        _renderers.RemoveAt(j);
                        j--;
                    }
                }
            }
            #endregion
        }
Exemplo n.º 2
0
        public bool Combine(IRenderer renderer)
        {
            if (renderer is SimpleRenderer && renderer != this)
            {
                if (_symbol is ISymbolCollection)
                {
                    ((ISymbolCollection)_symbol).AddSymbol(
                        ((SimpleRenderer)renderer).Symbol);
                }
                else
                {
                    ISymbolCollection symCol = PlugInManager.Create(new Guid("062AD1EA-A93C-4c3c-8690-830E65DC6D91")) as ISymbolCollection;
                    symCol.AddSymbol(_symbol);
                    symCol.AddSymbol(((SimpleRenderer)renderer).Symbol);
                    _symbol = (ISymbol)symCol;
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        public void Simplify()
        {
            if (_renderers == null)
            {
                return;
            }

            foreach (IFeatureRenderer renderer in _renderers)
            {
                if (renderer is ISimplify)
                {
                    ((ISimplify)renderer).Simplify();
                }
            }

            #region SimpleRenderer zusammenfassen
            bool allSimpleRenderers = true;
            foreach (IRenderer renderer in _renderers)
            {
                if (!(renderer is ScaleRenderer) && (((ScaleRenderer)renderer).Renderer is SimpleRenderer))
                {
                    allSimpleRenderers = false;
                    break;
                }
            }

            if (allSimpleRenderers && _renderers.Count > 1)
            {
                ScaleRenderer renderer = (ScaleRenderer)_renderers[0];
                if (_renderers.Count > 1)
                {
                    ISymbolCollection symCol = PlugInManager.Create(new Guid("062AD1EA-A93C-4c3c-8690-830E65DC6D91")) as ISymbolCollection;
                    foreach (IRenderer sRenderer in _renderers)
                    {
                        if (((SimpleRenderer)((ScaleRenderer)sRenderer).Renderer).Symbol != null)
                        {
                            symCol.AddSymbol(((SimpleRenderer)((ScaleRenderer)sRenderer).Renderer).Symbol);
                        }
                    }
                    ((SimpleRenderer)((ScaleRenderer)renderer).Renderer).Symbol = (ISymbol)symCol;
                    _renderers.Clear();
                    _renderers.Add(renderer);
                }
            }
            #endregion

            ShrinkScaleRenderes();
        }