示例#1
0
        public Renderer(Map map)
        {
            GeometryServiceProvider.Instance = new NtsGeometryServices();
            //LineStyles = new Dictionary<string, Style>(StringComparer.OrdinalIgnoreCase);
            Context = new ExpressionContext(this);
            Context.Variables.DefineVariable(FEATURE_VAR, typeof(Feature));
            Context.Options.ParseCulture = System.Globalization.CultureInfo.InvariantCulture;
            Context.Imports.AddType(typeof(Math), "math");
            Context.Imports.AddType(typeof(Drawing), "color");

            FeatureVarResolver = new FeatureVariableResolver();
            FeatureVarResolver.BindContext(Context);

            Map = map;

            map.Renderer = _mapRenderer = new MapRenderer(this, map);
            map.Changed += new EventHandler(map_Changed);

            _window = new Envelope();
        }
示例#2
0
        public object PropertyPanel(IFeatureRenderer renderer, IFeatureLayer layer)
        {
            _renderer = renderer as IGroupRenderer;
            _layer    = layer;

            if (_renderer == null || _layer == null)
            {
                return(null);
            }

            if (_renderer is ScaleDependentRenderer)
            {
                panelScale.Visible = true;
            }

            BuildList();

            panel1.Dock = DockStyle.Fill;
            return(panel1);
        }
示例#3
0
        private IRenderer SimplifyRenderer(IRenderer renderer)
        {
            if (renderer is ISimplify)
            {
                ((ISimplify)renderer).Simplify();
            }

            if (renderer is IGroupRenderer)
            {
                IGroupRenderer gRenderer = (IGroupRenderer)renderer;
                if (gRenderer.Renderers.Count == 1)
                {
                    if (gRenderer.Renderers[0] is IScaledependent)
                    {
                    }
                    else
                    {
                        renderer = gRenderer.Renderers[0];
                    }
                }
            }
            return(renderer);
            //if (renderer is IGroupRenderer)
            //{
            //    IGroupRenderer gRenderer = (IGroupRenderer)renderer;
            //    if (gRenderer.Renderers.Count == 0)
            //        return renderer;

            //    bool allSimpleRenderers = true;
            //    foreach (IRenderer cRenderer in gRenderer.Renderers)
            //    {
            //        if (!(cRenderer is SimpleRenderer))
            //        {
            //            allSimpleRenderers = false;
            //            break;
            //        }
            //    }
            //    if (allSimpleRenderers)
            //    {
            //        renderer = gRenderer.Renderers[0];
            //        if (gRenderer.Renderers.Count > 1)
            //        {
            //            ISymbolCollection symCol=PlugInManager.Create(new Guid("062AD1EA-A93C-4c3c-8690-830E65DC6D91")) as ISymbolCollection;
            //            foreach (IRenderer cRenderer in gRenderer.Renderers)
            //            {
            //                if (((SimpleRenderer)cRenderer).Symbol != null)
            //                    symCol.AddSymbol(((SimpleRenderer)cRenderer).Symbol);
            //            }
            //        }
            //        return renderer;
            //    }

            //    for(int i=0;i<gRenderer.Renderers.Count;i++)
            //    {
            //        if (gRenderer.Renderers[i] is IGroupRenderer)
            //        {
            //            IFeatureRenderer s = SimplifyRenderer(gRenderer.Renderers[i]) as IFeatureRenderer;
            //            if (s != gRenderer.Renderers[i])
            //            {
            //                gRenderer.Renderers.RemoveAt(i);
            //                gRenderer.Renderers.Insert(i, s);
            //            }
            //        }
            //    }
            //}

            //return renderer;
        }