Beispiel #1
0
        private ITextRender GetTextRender(XmlNode node)
        {
            if (node == null)
            {
                return(null);
            }
            ITextRender result           = null;
            string      value            = node.Attributes["Expression"].Value;
            bool        dynamicPlacement = false;
            bool        minimizeOverlap  = false;

            if (node.Attributes["DynamicPlacement"] != null)
            {
                dynamicPlacement = bool.Parse(node.Attributes["DynamicPlacement"].Value);
            }
            if (node.Attributes["MinimizeOverlap"] != null)
            {
                minimizeOverlap = bool.Parse(node.Attributes["MinimizeOverlap"].Value);
            }
            string value2 = node.Attributes["TextRenderType"].Value;

            if (value2 == gviRenderType.gviRenderSimple.ToString())
            {
                XmlNode xmlNode = node.SelectSingleNode("TextSymbol");
                if (xmlNode != null)
                {
                    result = new SimpleTextRenderClass
                    {
                        Symbol           = this.GetTextSymbol(xmlNode),
                        Expression       = value,
                        MinimizeOverlap  = minimizeOverlap,
                        DynamicPlacement = dynamicPlacement
                    };
                }
            }
            else
            {
                XmlNodeList xmlNodeList = node.SelectNodes("ValueMap/TextScheme");
                if (xmlNodeList != null && xmlNodeList.Count > 0)
                {
                    IValueMapTextRender valueMapTextRender = new ValueMapTextRenderClass();
                    foreach (XmlNode xmlNode2 in xmlNodeList)
                    {
                        ITextRenderScheme textRenderScheme = new TextRenderSchemeClass();
                        XmlNode           xmlNode3         = xmlNode2.SelectSingleNode("RenderRule");
                        if (xmlNode3 != null)
                        {
                            string value3 = xmlNode3.Attributes["RuleType"].Value;
                            string value4 = xmlNode3.Attributes["LookUpField"].Value;
                            if (value3 == gviRenderRuleType.gviRenderRuleUniqueValues.ToString())
                            {
                                IUniqueValuesRenderRule uniqueValuesRenderRule = new UniqueValuesRenderRuleClass();
                                string value5 = xmlNode3.Attributes["UniqueValue"].Value;
                                uniqueValuesRenderRule.LookUpField = value4;
                                uniqueValuesRenderRule.AddValue(value5);
                                textRenderScheme.AddRule(uniqueValuesRenderRule);
                            }
                            else
                            {
                                IRangeRenderRule rangeRenderRule = new RangeRenderRuleClass();
                                string           value6          = xmlNode3.Attributes["IncludeMax"].Value;
                                string           value7          = xmlNode3.Attributes["IncludeMin"].Value;
                                string           value8          = xmlNode3.Attributes["MaxValue"].Value;
                                string           value9          = xmlNode3.Attributes["MinValue"].Value;
                                rangeRenderRule.LookUpField = value4;
                                rangeRenderRule.IncludeMax  = (value6.ToLower() == "true");
                                rangeRenderRule.IncludeMin  = (value7.ToLower() == "true");
                                rangeRenderRule.MaxValue    = double.Parse(value8);
                                rangeRenderRule.MinValue    = double.Parse(value9);
                                textRenderScheme.AddRule(rangeRenderRule);
                            }
                        }
                        XmlNode xmlNode4 = xmlNode2.SelectSingleNode("TextSymbol");
                        if (xmlNode4 != null)
                        {
                            textRenderScheme.Symbol = this.GetTextSymbol(xmlNode4);
                        }
                        valueMapTextRender.AddScheme(textRenderScheme);
                    }
                    valueMapTextRender.Expression       = value;
                    valueMapTextRender.MinimizeOverlap  = minimizeOverlap;
                    valueMapTextRender.DynamicPlacement = dynamicPlacement;
                    result = valueMapTextRender;
                }
            }
            return(result);
        }
Beispiel #2
0
        private IGeometryRender GetGeoRender(XmlNode node)
        {
            if (node == null)
            {
                return(null);
            }
            IGeometryRender result       = null;
            double          heightOffset = 0.0;
            string          value        = node.Attributes["HeightStyle"].Value;
            object          obj          = node.Attributes["HeightOffset"];

            if (obj != null)
            {
                heightOffset = double.Parse(node.Attributes["HeightOffset"].Value);
            }
            string value2 = node.Attributes["GroupField"].Value;
            string value3 = node.Attributes["RenderType"].Value;

            if (value3 == gviRenderType.gviRenderSimple.ToString())
            {
                ISimpleGeometryRender simpleGeometryRender = new SimpleGeometryRenderClass();
                XmlNode xmlNode = node.SelectSingleNode("GeometrySymbol");
                if (xmlNode != null)
                {
                    string value4 = xmlNode.Attributes["GeometryType"].Value;
                    simpleGeometryRender.Symbol = this.GetGeometrySymbol(value4, xmlNode);
                }
                if (value == gviHeightStyle.gviHeightAbsolute.ToString())
                {
                    simpleGeometryRender.HeightStyle = gviHeightStyle.gviHeightAbsolute;
                }
                else
                {
                    simpleGeometryRender.HeightStyle = gviHeightStyle.gviHeightOnTerrain;
                }
                simpleGeometryRender.HeightOffset     = heightOffset;
                simpleGeometryRender.RenderGroupField = value2;
                result = simpleGeometryRender;
            }
            else
            {
                XmlNodeList xmlNodeList = node.SelectNodes("ValueMap/RenderScheme");
                if (xmlNodeList != null && xmlNodeList.Count > 0)
                {
                    IValueMapGeometryRender valueMapGeometryRender = new ValueMapGeometryRenderClass();
                    foreach (XmlNode xmlNode2 in xmlNodeList)
                    {
                        IGeometryRenderScheme geometryRenderScheme = new GeometryRenderSchemeClass();
                        XmlNode xmlNode3 = xmlNode2.SelectSingleNode("RenderRule");
                        if (xmlNode3 != null)
                        {
                            string value5 = xmlNode3.Attributes["RuleType"].Value;
                            string value6 = xmlNode3.Attributes["LookUpField"].Value;
                            if (value5 == gviRenderRuleType.gviRenderRuleUniqueValues.ToString())
                            {
                                IUniqueValuesRenderRule uniqueValuesRenderRule = new UniqueValuesRenderRuleClass();
                                uniqueValuesRenderRule.LookUpField = value6;
                                if (xmlNode3.Attributes["UniqueValue"] != null)
                                {
                                    string value7 = xmlNode3.Attributes["UniqueValue"].Value;
                                    uniqueValuesRenderRule.AddValue(value7);
                                }
                                geometryRenderScheme.AddRule(uniqueValuesRenderRule);
                            }
                            else
                            {
                                IRangeRenderRule rangeRenderRule = new RangeRenderRuleClass();
                                string           value8          = xmlNode3.Attributes["IncludeMax"].Value;
                                string           value9          = xmlNode3.Attributes["IncludeMin"].Value;
                                string           value10         = xmlNode3.Attributes["MaxValue"].Value;
                                string           value11         = xmlNode3.Attributes["MinValue"].Value;
                                rangeRenderRule.LookUpField = value6;
                                rangeRenderRule.IncludeMax  = (value8.ToLower() == "true");
                                rangeRenderRule.IncludeMin  = (value9.ToLower() == "true");
                                rangeRenderRule.MaxValue    = double.Parse(value10);
                                rangeRenderRule.MinValue    = double.Parse(value11);
                                geometryRenderScheme.AddRule(rangeRenderRule);
                            }
                        }
                        XmlNode xmlNode4 = xmlNode2.SelectSingleNode("GeometrySymbol");
                        if (xmlNode4 != null)
                        {
                            string          value12        = xmlNode4.Attributes["GeometryType"].Value;
                            IGeometrySymbol geometrySymbol = this.GetGeometrySymbol(value12, xmlNode4);
                            geometryRenderScheme.Symbol = geometrySymbol;
                        }
                        if (value == gviHeightStyle.gviHeightAbsolute.ToString())
                        {
                            valueMapGeometryRender.HeightStyle = gviHeightStyle.gviHeightAbsolute;
                        }
                        else
                        {
                            valueMapGeometryRender.HeightStyle = gviHeightStyle.gviHeightOnTerrain;
                        }
                        valueMapGeometryRender.HeightOffset     = heightOffset;
                        valueMapGeometryRender.RenderGroupField = value2;
                        valueMapGeometryRender.AddScheme(geometryRenderScheme);
                    }
                    result = valueMapGeometryRender;
                }
            }
            return(result);
        }