Esempio n. 1
0
        /// <summary>
        /// Заполнение подписей для объектов
        /// </summary>
        /// <param name="subtypePath">
        /// The subtype Path.
        /// </param>
        /// <param name="subtype">
        /// The subtype.
        /// </param>
        /// <param name="itemDesc">
        /// The item Desc.
        /// </param>
        private void FillLabelsStyles(
            XPathNavigator subtypePath, ClassifierStruct.Subtype subtype, ClassifierStruct.ItemDescription itemDesc)
        {
            XPathNodeIterator labelStylesPaths = subtypePath.Select("./LabelStyle");

            foreach (XPathNavigator labelStylePath in labelStylesPaths)
            {
                var labelStyle = new ClassifierStruct.LabelStyle(
                    labelStylePath.GetAttribute("name", string.Empty),
                    labelStylePath.GetAttribute("storage", string.Empty),
                    labelStylePath.GetAttribute("usage", string.Empty),
                    labelStylePath.GetAttribute("status", string.Empty));
                if (!subtype.LabelStyles.ContainsKey(labelStyle.Name))
                {
                    subtype.LabelStyles.Add(labelStyle.Name, labelStyle);
                }

                XPathNodeIterator symbolDefsPaths = labelStylePath.Select("./StyleDef");
                foreach (XPathNavigator symbolDefPath in symbolDefsPaths)
                {
                    labelStyle.setSymbolDef(
                        symbolDefPath.GetAttribute("platform", string.Empty), symbolDefPath.GetAttribute("definition", string.Empty));

                    XPathNodeIterator labelDataLayerPaths =
                        _navigator.Select("/RNGIS_DataSet/DataStorage/DataLayer[@layer_id='" + labelStyle.Storage + "']");
                    foreach (XPathNavigator labelDataLayerPath in labelDataLayerPaths)
                    {
                        labelStyle.setDataLayer(
                            labelDataLayerPath.GetAttribute("layer_id", string.Empty),
                            labelDataLayerPath.GetAttribute("name", string.Empty),
                            labelDataLayerPath.GetAttribute("table_name", string.Empty),
                            labelDataLayerPath.GetAttribute("description", string.Empty),
                            labelDataLayerPath.GetAttribute("geom_type", string.Empty),
                            labelDataLayerPath.GetAttribute("z_order", string.Empty),
                            labelDataLayerPath.GetAttribute("comment", string.Empty),
                            labelDataLayerPath.GetAttribute("status", string.Empty));
                        AddAttributes(labelDataLayerPath, labelStyle.DataLayer, itemDesc.ItemId);

                        // Устанавливаем дополнительные поля
                        labelStyle.DataLayer.IsLabel = true;
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Заполнение подтипов объекта
        /// </summary>
        /// <param name="representationTemplate">
        /// The representation Template.
        /// </param>
        /// <param name="itemDesc">
        /// The item Desc.
        /// </param>
        /// <returns>
        /// The <see cref="List"/>.
        /// </returns>
        private List <ClassifierStruct.Subtype> FillSubtypes(
            XPathNavigator representationTemplate,
            ClassifierStruct.ItemDescription itemDesc)
        {
            var subtypes = new List <ClassifierStruct.Subtype>();

            XPathNodeIterator subtypesPaths = representationTemplate.Select("./Subtype");

            foreach (XPathNavigator subtypePath in subtypesPaths)
            {
                var subtype = new ClassifierStruct.Subtype(
                    subtypePath.GetAttribute("name", string.Empty),
                    subtypePath.GetAttribute("filter", string.Empty));

                // Установить статус для SymbolStyle
                XPathNodeIterator symbolStylePaths = subtypePath.Select("./SymbolStyle");
                foreach (XPathNavigator symbolStylePath in symbolStylePaths)
                {
                    var symbolStyle = new ClassifierStruct.SymbolStyle();
                    symbolStyle.Status = symbolStylePath.GetAttribute("status", string.Empty);

                    // Данный атрибут содержится только в AutoCAD классификаторе
                    symbolStyle.GeomType = symbolStylePath.GetAttribute("geom_type", string.Empty);

                    // Установить SymbolDef для SymbolStyle
                    XPathNodeIterator symbolDefsPaths = symbolStylePath.Select("./SymbolDef");
                    foreach (XPathNavigator symbolDefPath in symbolDefsPaths)
                    {
                        symbolStyle.SetSymbolDef(
                            symbolDefPath.GetAttribute("platform", string.Empty),
                            symbolDefPath.GetAttribute("definition", string.Empty));
                    }

                    // Установить AnnotationDefAutoCad для SymbolStyle
                    XPathNodeIterator annotationDefAutoCad = symbolStylePath.Select("./Annotation");
                    foreach (XPathNavigator annotationDefAutoCadPath in annotationDefAutoCad)
                    {
                        symbolStyle.SetAnnotationDefAutoCad(
                            annotationDefAutoCadPath.GetAttribute("table_name", string.Empty),
                            annotationDefAutoCadPath.GetAttribute("colorByFeature", string.Empty));
                    }

                    subtype.SymbolStyle.Add(symbolStyle);
                }

                // Установить описание слоя
                XPathNodeIterator dataLayersPaths = representationTemplate.Select("parent::*/parent::*");
                subtype.DataLayer = GetDataLayer(dataLayersPaths, itemDesc.ItemId);

                // Установить описание слоя для камерального варианта
                if (!string.IsNullOrEmpty(itemDesc.CameralDatalayer))
                {
                    XPathNodeIterator datalayersPathsCameral =
                        _navigator.Select("/RNGIS_DataSet/DataStorage/DataLayer[@layer_id='" + itemDesc.CameralDatalayer + "']");
                    subtype.CameralDataLayer = GetDataLayer(datalayersPathsCameral, itemDesc.ItemId);
                }

                // Заполнение подписей и добавление их в подтипы
                FillLabelsStyles(subtypePath, subtype, itemDesc);

                // Добавление подтипа
                subtypes.Add(subtype);
            }

            return(subtypes);
        }