コード例 #1
0
        public void ClassChanged()
        {
            if (_view.SelectedClass != null)
            {
                var cls = _walker.GetClassDefinition(_view.SelectedSchema, _view.SelectedClass.ClassName);
                this.SelectedClass = cls;
                List <string> p = new List <string>();
                foreach (PropertyDefinition pd in cls.Properties)
                {
                    if (pd.PropertyType == PropertyType.PropertyType_DataProperty || pd.PropertyType == PropertyType.PropertyType_GeometricProperty)
                    {
                        p.Add(pd.Name);
                    }
                    else if (pd.PropertyType == PropertyType.PropertyType_ObjectProperty)
                    {
                        String szPrefix = pd.Name;
                        ObjectPropertyDefinition pdo = (ObjectPropertyDefinition)pd;

                        // TODO: make this an iterative loop
                        // only processing one sub-set for now
                        foreach (PropertyDefinition pdSub in pdo.Class.Properties)
                        {
                            if (pdSub.PropertyType == PropertyType.PropertyType_DataProperty || pd.PropertyType == PropertyType.PropertyType_GeometricProperty)
                            {
                                p.Add(szPrefix + "." + pdSub.Name);
                            }

                            // TODO: process objects and associations
                        }
                    }
                    else if (pd.PropertyType == PropertyType.PropertyType_AssociationProperty)
                    {
                        String szPrefix = pd.Name;
                        AssociationPropertyDefinition pda = (AssociationPropertyDefinition)pd;

                        // TODO: make this an iterative loop
                        // only processing one sub-set for now
                        foreach (PropertyDefinition pdSub in pda.AssociatedClass.Properties)
                        {
                            if (pdSub.PropertyType == PropertyType.PropertyType_DataProperty || pd.PropertyType == PropertyType.PropertyType_GeometricProperty)
                            {
                                p.Add(szPrefix + "." + pdSub.Name);
                            }

                            // TODO: process objects and associations
                        }
                    }
                }
                _view.PropertyList = p;
                _view.FireMapPreviewStateChanged(cls.ClassType == ClassType.ClassType_FeatureClass);
            }
        }