示例#1
0
        public static DGObjectsDefinition LoadDefinition(XElement root)
        {
            DGObjectsDefinition def = new DGObjectsDefinition();
            XAttribute attr;

            def.Type = root.Name.ToString();

            attr = root.Attribute("Name");
            if (attr != null)
                def.Name = (string)attr;
            attr = root.Attribute("HasGeometry");
            if (attr != null)
                def.HasGeometry = (bool)attr;
            attr = root.Attribute("GISLayerName");
            if (attr != null)
                def.GISLayerName = (string)attr;
            attr = root.Attribute("TableNameSQL");
            if (attr != null)
                def.TableNameSQL = (string)attr;
            attr = root.Attribute("DefNamesSQL");
            if (attr != null)
                def.DefNamesSQL = (string)attr;
            attr = root.Attribute("ConditionSQL");
            if (attr != null)
                def.ConditionSQL = (string)attr;
            attr = root.Attribute("OrderSQL");
            if (attr != null)
                def.OrderSQL = (string)attr;

            return def;
        }
示例#2
0
        // Summary:
        //     Load objects from database
        public bool loadObjects(string objDefName, DbContext dbContext)
        {
            if (parent == null)
            {
                return(false);
            }

            DGObjectsDefinition def = objsDefinitions[objDefName];

            if (def == null)
            {
                return(false);
            }

            DGObjects objs    = new DGObjects(def);
            bool      success = objs.load(dbContext);

            objs.parent = this;

            // Old objs will be replaced recently loaded objects.
            if (success)
            {
                objsContainer[def.Name] = objs;
            }

            return(success);
        }
        public static DGObjectsDefinition LoadDefinition(XElement root)
        {
            DGObjectsDefinition def = new DGObjectsDefinition();
            XAttribute          attr;

            def.Type = root.Name.ToString();

            attr = root.Attribute("Name");
            if (attr != null)
            {
                def.Name = (string)attr;
            }
            attr = root.Attribute("HasGeometry");
            if (attr != null)
            {
                def.HasGeometry = (bool)attr;
            }
            attr = root.Attribute("GISLayerName");
            if (attr != null)
            {
                def.GISLayerName = (string)attr;
            }

            attr = root.Attribute("Has3D");
            if (attr != null)
            {
                def.Has3D = (bool)attr;
            }

            attr = root.Attribute("Layer3DName");
            if (attr != null)
            {
                def.Layer3DName = (string)attr;
            }


            attr = root.Attribute("TableNameSQL");
            if (attr != null)
            {
                def.TableNameSQL = (string)attr;
            }
            attr = root.Attribute("DefNamesSQL");
            if (attr != null)
            {
                def.DefNamesSQL = (string)attr;
            }
            attr = root.Attribute("ConditionSQL");
            if (attr != null)
            {
                def.ConditionSQL = (string)attr;
            }
            attr = root.Attribute("OrderSQL");
            if (attr != null)
            {
                def.OrderSQL = (string)attr;
            }

            return(def);
        }
示例#4
0
        // Summary:
        //     Load a Domain from XML element
        public static Domain loadDefinition(XElement root)
        {
            string     name       = root.Attribute("Name").Value;
            string     type       = root.Attribute("Type").Value;
            DomainType domainType = (DomainType)Enum.Parse(typeof(DomainType), type);

            Domain domain = new Domain(name, domainType);

            // Load tree definition
            //
            XElement treeDefNode = root.Element("TreeDefinition");

            if (treeDefNode != null)
            {
                // only first node is loaded, other nodes are ignored.
                IEnumerable <XElement> nodes = treeDefNode.Elements();
                if (nodes.Count() > 0)
                {
                    XElement node = nodes.First();
                    domain.root = Tree.Element2Tree(node);
                }
            }

            // Load DGObjects definition
            //
            XElement objsDefNode = root.Element("ObjsDefinition");

            if (objsDefNode != null)
            {
                IEnumerable <XElement> nodes = objsDefNode.Elements();
                foreach (XElement node in nodes)
                {
                    DGObjectsDefinition def = DGObjectsDefinition.LoadDefinition(node);
                    domain.objsDefinitions.Add(def.Name, def);
                }
            }

            return(domain);
        }
示例#5
0
        public static DGObjects NewObjsInAnalysisDomain(string Type, string Name, 
            bool HasGeometry = false, string GISLayerName = "")
        {
            DGObjectsDefinition eDef = new DGObjectsDefinition();
            eDef.Type = Type;
            eDef.Name = Name;
            eDef.HasGeometry = HasGeometry;
            string layerName = "";
            if (HasGeometry)
                layerName = "e" + GISLayerName;
            eDef.GISLayerName = layerName;
            DGObjects dgObjects = new DGObjects(eDef);

            Domain analysisDomain = GetAnalysisDomain();
            dgObjects.parent = analysisDomain;
            analysisDomain.objsDefinitions[eDef.Name] = eDef;
            analysisDomain.objsContainer[eDef.Name] = dgObjects;

            return dgObjects;
        }
        // Summary:
        //     Constructors
        public DGObjects(DGObjectsDefinition def)
        {
            _objs = new Dictionary <string, DGObject>();

            definition = def;
        }
示例#7
0
        // Summary:
        //     Constructors
        public DGObjects(DGObjectsDefinition def)
        {
            _objs = new Dictionary<string, DGObject>();

            definition = def;
        }