Exemplo n.º 1
0
        private void CreateLabelModifierElement(XmlDocument _doc, LabelSource source, XmlElement lyrElement, string uniqueID)
        {
            LabelModifiers mods = source.Modifiers;

            foreach (LabelModifier lm in mods)
            {
                XmlElement element = _doc.CreateElement("branch");
                element.SetAttribute("branchtype", "", "leaf");
                element.SetAttribute("title", null, lm.Name);
                element.SetAttribute("alias", "", lm.Alias);
                element.SetAttribute("code", "", "nonselectable");
                element.SetAttribute("type", "", "LabelMod");
                element.SetAttribute("img", null, "lcmodifier.bmp");
                element.SetAttribute("uniqueid", "", uniqueID);
                if (lm.Enabled)
                {
                    element.SetAttribute("visible", "true");
                }
                else
                {
                    element.SetAttribute("visible", "false");
                }
                lyrElement.AppendChild(element);
            }
        }
Exemplo n.º 2
0
        private XmlElement CreateLabelLayerElement(XmlDocument _doc, IMapLayer layer, string uniqueID)
        {
            Map map = GetMapObj(_mapAlias);

            XmlElement element = _doc.CreateElement("branch");

            element.SetAttribute("title", "", layer.Name);
            element.SetAttribute("uniqueid", "", uniqueID);
            element.SetAttribute("alias", "", layer.Alias);
            element.SetAttribute("type", "", layer.Type.ToString());
            element.SetAttribute("expanded", null, "true");
            element.SetAttribute("img", null, "lclabel.bmp");
            element.SetAttribute("branchtype", "", "folder");
            if (layer.IsVisible)
            {
                element.SetAttribute("visible", "true");
            }
            else
            {
                element.SetAttribute("visible", "false");
                if (layer.VisibleRangeEnabled && !layer.VisibleRange.Within(map.Zoom))
                {
                    element.SetAttribute("rangevisible", "true");
                }
                else
                {
                    element.SetAttribute("rangevisible", "false");
                }
            }

            foreach (LabelSource source in ((LabelLayer)layer).Sources)
            {
                XmlElement     leafElement   = _doc.CreateElement("branch");
                bool           bHasModifiers = false;
                LabelModifiers mods          = source.Modifiers;
                if (mods.Count > 0)
                {
                    bHasModifiers = true;
                }
                leafElement.SetAttribute("uniqueid", "", uniqueID);
                leafElement.SetAttribute("title", null, source.Name);
                leafElement.SetAttribute("alias", "", source.Alias);
                leafElement.SetAttribute("type", "", layer.Type.ToString());
                if (source.Visible)
                {
                    leafElement.SetAttribute("visible", "true");
                }
                else
                {
                    leafElement.SetAttribute("visible", "false");
                    if (source.VisibleRangeEnabled && !source.VisibleRange.Within(map.Zoom))
                    {
                        leafElement.SetAttribute("rangevisible", "true");
                    }
                    else
                    {
                        leafElement.SetAttribute("rangevisible", "false");
                    }
                }
                if (bHasModifiers)
                {
                    leafElement.SetAttribute("branchtype", "", "folder");
                    leafElement.SetAttribute("expanded", null, "true");
                    leafElement.SetAttribute("code", "", "2");
                }
                else
                {
                    leafElement.SetAttribute("branchtype", "", "leaf");
                    leafElement.SetAttribute("code", "", "nonselectable");
                }
                leafElement.SetAttribute("img", null, "lclabelsource.bmp");
                if (bHasModifiers)
                {
                    CreateLabelModifierElement(_doc, source, leafElement, uniqueID);
                }
                element.AppendChild(leafElement);
            }
            return(element);
        }