private void MenuItem_Activate(object sender, EventArgs e)
        {
            try {
                TreeNode treeNode = this.treeView1.SelectedNode;
                if (treeNode == null)
                {
                    return;
                }
                TreeNodeTable treeNodeTable = treeNode as TreeNodeTable;
                if (treeNodeTable == null)
                {
                    return;
                }
                EsriTable table = treeNodeTable.Table;
                if (table == null)
                {
                    return;
                }

                if (sender == this.menuButtonItemScroll)
                {
                    this._model.ScrollToElement(table);
                }
                else if (sender == this.menuButtonItemFlash)
                {
                    table.Flash();
                }
            }
            catch (Exception ex) {
                ExceptionDialog.HandleException(ex);
            }
        }
        private void TreeView_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            try {
                // Get Double Clicked Node (and Table)
                if (e == null)
                {
                    return;
                }
                TreeNode treeNode = e.Node;
                if (treeNode == null)
                {
                    return;
                }
                TreeNodeTable treeNodeTable = treeNode as TreeNodeTable;
                if (treeNodeTable == null)
                {
                    return;
                }
                EsriTable table = treeNodeTable.Table;
                if (table == null)
                {
                    return;
                }

                // Scroll to Table
                this._model.ScrollToElement(table);
            }
            catch (Exception ex) {
                ExceptionDialog.HandleException(ex);
            }
        }
 private void TreeView_AfterSelect(object sender, TreeViewEventArgs e)
 {
     try {
         if (e.Node is TreeNodeGeodatabase)
         {
             TreeNodeGeodatabase treeNodeGeodatabase = (TreeNodeGeodatabase)e.Node;
             EsriModel           model = treeNodeGeodatabase.Model;
             model.SelectElements(false);
         }
         else if (e.Node is TreeNodeTable)
         {
             TreeNodeTable treeNodeTable = (TreeNodeTable)e.Node;
             EsriTable     table         = treeNodeTable.Table;
             EsriModel     model         = (EsriModel)table.Container;
             model.SelectElements(false);
             table.Selected = true;
         }
         else if (e.Node is TreeNodeGroup)
         {
         }
     }
     catch (Exception ex) {
         ExceptionDialog.HandleException(ex);
     }
 }
        public override void Errors(List <Error> list, EsriTable table)
        {
            // Check if class/subtype exists
            EsriTable table2 = DiagrammerEnvironment.Default.SchemaModel.FindObjectClassOrSubtype(this._classID, this._subtypeCode);

            if (table2 == null)
            {
                string message = string.Format("The junction subtype [{0}::{1}] does not exist", this._classID.ToString(), this._subtypeCode.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }
        }
        public void Validate2(EsriTable table)
        {
            // Clear Errors
            this.m_errors.Clear();

            // Get Errors
            table.Errors(this.m_errors);

            // Refresh Error List
            this.RefreshErrorList();
        }
        public override void Errors(List <Error> list, EsriTable table)
        {
            // TODO Add RasterDef Errors

            // Add Spatial Reference Errors
            if (this._spatialReference == null)
            {
                list.Add(new ErrorObject(this, table, "SpatialReference cannot be null", ErrorType.Error));
            }
            else
            {
                this._spatialReference.Errors(list, table);
            }
        }
Exemple #7
0
        public override void Errors(List <Error> list, EsriTable table)
        {
            // Write Base Errors
            base.Errors(list, table);

            // TODO: If One-One then Origin Cardinality must be 0 or 1
            // TODO: If One-One then Origin Cardinality must be 0 or 1

            // TODO: If One-Many then Origin Cardinality must be 0 or 1
            // TODO: If One-Many then Origin Cardinality must be 0..M

            // TODO: If Many-Many then Origin Cardinality must be 0..M
            // TODO: If Many-Many then Origin Cardinality must be 0..M

            // TODO: Origin Cardinality. Min <= Max
            // TODO: Destination Cardinality. Min <= Max

            // TODO: Origin Cardinality. OK if Min and Max both -1. (Default Cardinatity)
            // TODO: Origin Destination. OK if Min and Max both -1. (Default Cardinatity)
        }
Exemple #8
0
        public override void Errors(List <Error> list, EsriTable table)
        {
            // Key cannot be empty
            if (string.IsNullOrEmpty(this._key))
            {
                list.Add(new ErrorObject(this, table, "Property Key cannot be empty", ErrorType.Error));
            }

            // Type cannot be empty
            if (string.IsNullOrEmpty(this._type))
            {
                list.Add(new ErrorObject(this, table, "Property Type cannot be empty", ErrorType.Error));
            }

            // [Warning]
            if (string.IsNullOrEmpty(this._value))
            {
                list.Add(new ErrorObject(this, table, "Property Value is empty", ErrorType.Warning));
            }
        }
        private void TreeView_KeyDown(object sender, KeyEventArgs e)
        {
            try {
                switch (e.KeyData)
                {
                case Keys.Enter:
                    // Handle Event
                    e.Handled = true;

                    // Get Table
                    TreeNode treeNode = this.treeView1.SelectedNode;
                    if (treeNode == null)
                    {
                        return;
                    }
                    TreeNodeTable treeNodeTable = treeNode as TreeNodeTable;
                    if (treeNodeTable == null)
                    {
                        return;
                    }
                    EsriTable table = treeNodeTable.Table;
                    if (table == null)
                    {
                        return;
                    }

                    // Scroll to Table
                    this._model.ScrollToElement(table);

                    break;

                default:
                    break;
                }
            }
            catch (Exception ex) {
                ExceptionDialog.HandleException(ex);
            }
        }
        public override void Errors(List <Error> list, EsriTable table)
        {
            // Add Spatial Reference Errors
            if (this._spatialReference == null)
            {
                list.Add(new ErrorObject(this, table, "SpatialReference cannot be null", ErrorType.Error));
            }
            else
            {
                this._spatialReference.Errors(list, table);
            }

            // XMin > XMax
            if (this._xMin > this._xMax)
            {
                list.Add(new ErrorObject(this, table, "XMin is larger thatn XMax", ErrorType.Error));
            }

            // YMin < YMax
            if (this._yMin > this._yMax)
            {
                list.Add(new ErrorObject(this, table, "YMin is larger thatn YMax", ErrorType.Error));
            }
        }
        private TreeNode FindNode(TreeNode treeNode, EsriTable table)
        {
            //
            if (treeNode is TreeNodeTable)
            {
                TreeNodeTable treeNodeTable = (TreeNodeTable)treeNode;
                if (treeNodeTable.Table == table)
                {
                    return(treeNodeTable);
                }
            }

            //
            foreach (TreeNode treeNodeChild in treeNode.Nodes)
            {
                TreeNode treeNode2 = this.FindNode(treeNodeChild, table);
                if (treeNode2 != null)
                {
                    return(treeNode2);
                }
            }

            return(null);
        }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO Street Name Fields Errors
 }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO Evaluated Network Attribute Errors
 }
        public override void Errors(List <Error> list, EsriTable table)
        {
            // Export SpatialReference Errors
            if (this._spatialReference != null)
            {
                this._spatialReference.Errors(list, table);
            }

            // AvgNumPoints
            if (this._avgNumPoints < 0)
            {
                // Must be positive
                list.Add(new ErrorObject(this, table, "AvgNumPoints must be positive", ErrorType.Error));
            }

            // Check GridSize Configuration
            if (this._gridSize0 == -1 && this._gridSize1 == -1 && this._gridSize2 == -1)
            {
                // OK
            }
            else if (this._gridSize0 != -1 && this._gridSize1 == -1 && this._gridSize2 == -1)
            {
                // OK
            }
            else if (this._gridSize0 != -1 && this._gridSize1 != -1 && this._gridSize2 == -1)
            {
                // OK
                if (this._gridSize0 > this._gridSize1)
                {
                    list.Add(new ErrorObject(this, table, "GridSize0 cannot be larger than GridSize1", ErrorType.Error));
                }
            }
            else if (this._gridSize0 != -1 && this._gridSize1 != -1 && this._gridSize2 != -1)
            {
                // OK
                if (this._gridSize0 > this._gridSize1)
                {
                    list.Add(new ErrorObject(this, table, "GridSize0 cannot be larger than GridSize1", ErrorType.Error));
                }
                if (this._gridSize1 > this._gridSize2)
                {
                    list.Add(new ErrorObject(this, table, "GridSize1 cannot be larger than GridSize2", ErrorType.Error));
                }
            }
            else
            {
                // Invalid Combination
                string message = string.Format(
                    "Grid configuration '{0}'/'{1}'/'{2}' is invalid",
                    this._gridSize0.ToString(),
                    this._gridSize1.ToString(),
                    this._gridSize2.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // GridSize0
            if (this._gridSize0 != -1)
            {
                if (this._gridSize0 < 0)
                {
                    // Must be greater than zero
                    list.Add(new ErrorObject(this, table, "GridSize0 must be greater than (or equal to) zero", ErrorType.Error));
                }
            }

            // GridSize1
            if (this._gridSize1 != -1)
            {
                if (this._gridSize1 < 0)
                {
                    // Must be positive
                    list.Add(new ErrorObject(this, table, "GridSize1 must be zero or a positive", ErrorType.Error));
                }
            }

            // GridSize2
            if (this._gridSize2 != -1)
            {
                if (this._gridSize2 < 0)
                {
                    // Must be positive
                    list.Add(new ErrorObject(this, table, "GridSize2 must be zero or a positive", ErrorType.Error));
                }
            }
        }
        public override void Errors(List<Error> list, EsriTable table) {
            // Write Base Errors
            base.Errors(list, table);

            // From Class ID and SubtypeCode
            EsriTable table2 = DiagrammerEnvironment.Default.SchemaModel.FindObjectClassOrSubtype(this._fromClassID, this._fromEdgeSubtypeCode);
            if (table2 == null) {
                string message = string.Format("Edge Connectivity Rule [{0}]: Can not identify the from edge [{1}::{0}]", this.RuleId.ToString(), this._fromClassID.ToString(), this._fromEdgeSubtypeCode.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // To Class ID and SubtypeCode
            EsriTable table3 = DiagrammerEnvironment.Default.SchemaModel.FindObjectClassOrSubtype(this._toClassID, this._toEdgeSubtypeCode);
            if (table3 == null) {
                string message = string.Format("Edge Connectivity Rule [{0}]: Can not identify the to edge [{1}::{0}]", this.RuleId.ToString(), this._toClassID.ToString(), this._toEdgeSubtypeCode.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // Default Class ID and SubtypeCode
            EsriTable table4 = DiagrammerEnvironment.Default.SchemaModel.FindObjectClassOrSubtype(this._defaultJunctionID, this._defaultJunctionSubtypeCode);
            if (table4 == null) {
                string message = string.Format("Edge Connectivity Rule [{0}]: Can not identify the default junction [{1}::{0}]", this.RuleId.ToString(), this._defaultJunctionID.ToString(), this._defaultJunctionSubtypeCode.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }
            else {
                bool found = false;
                foreach (JunctionSubtype junctionSubtype in this._junctionSubtypes) {
                    if (junctionSubtype.ClassID == this._defaultJunctionID &&
                        junctionSubtype.SubtypeCode == this._defaultJunctionSubtypeCode) {
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    string message = string.Format("Edge Connectivity Rule [{0}]: The default junction [{1}::{0}] in not contained in the junction list", this.RuleId.ToString(), this._defaultJunctionID.ToString(), this._defaultJunctionSubtypeCode.ToString());
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Junction Subtype
            if (this._junctionSubtypes.Count == 0) {
                string message = string.Format("Edge Connectivity Rule [{0}]: The rule must at least one junction defined", this.RuleId.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }
            foreach (JunctionSubtype junctionSubtype in this._junctionSubtypes) {
                junctionSubtype.Errors(list, table);
            }
        }
        public override void Errors(List<Error> list, EsriTable table) {
            // Write Base Errors
            base.Errors(list, table);

            // TODO: If One-One then Origin Cardinality must be 0 or 1
            // TODO: If One-One then Origin Cardinality must be 0 or 1

            // TODO: If One-Many then Origin Cardinality must be 0 or 1
            // TODO: If One-Many then Origin Cardinality must be 0..M

            // TODO: If Many-Many then Origin Cardinality must be 0..M
            // TODO: If Many-Many then Origin Cardinality must be 0..M

            // TODO: Origin Cardinality. Min <= Max
            // TODO: Destination Cardinality. Min <= Max

            // TODO: Origin Cardinality. OK if Min and Max both -1. (Default Cardinatity)
            // TODO: Origin Destination. OK if Min and Max both -1. (Default Cardinatity)
        }
        private void CreateTabbedDocument(EsriTable table, Type modelType) {
            TabbedDocument tabbedDocument = null;

            if (modelType == typeof(DomainModel)) {
                Domain domain = (Domain)table;
                tabbedDocument = new TabbedDocumentDomain(domain);
            }
            else if (modelType == typeof(GeometricNetworkModel)) {
                GeometricNetwork geometricNetwork = (GeometricNetwork)table;
                tabbedDocument = new TabbedDocumentGeometricNetwork(geometricNetwork);
            }
            else if (modelType == typeof(GeometricNetworkModelEE)) {
                GeometricNetwork geometricNetwork = (GeometricNetwork)table;
                tabbedDocument = new TabbedDocumentGeometricNetworkEE(geometricNetwork);
            }
            else if (modelType == typeof(GeometricNetworkModelEJ)) {
                GeometricNetwork geometricNetwork = (GeometricNetwork)table;
                tabbedDocument = new TabbedDocumentGeometricNetworkEJ(geometricNetwork);
            }
            else if (modelType == typeof(RelationshipModel)) {
                RelationshipClass relationshipClass = (RelationshipClass)table;
                tabbedDocument = new TabbedDocumentRelationship(relationshipClass);
            }
            else if (modelType == typeof(TopologyModel)) {
                Topology topology = (Topology)table;
                tabbedDocument = new TabbedDocumentTopology(topology);
            }
            else if (modelType == typeof(TopologyRuleModel)) {
                Topology topology = (Topology)table;
                tabbedDocument = new TabbedDocumentTopologyRule(topology);
            }
            else if (modelType == typeof(TerrainModel)) {
                Terrain terrain = (Terrain)table;
                tabbedDocument = new TabbedDocumentTerrain(terrain);
            }
            if (tabbedDocument == null) { return; }

            // Add Tabbed Document
            this.AddTabbedDocument(tabbedDocument);
        }
        private TreeNode CreateCatalogNode(TreeNode node, EsriTable table)
        {
            if (table.GetType() == typeof(DomainCodedValue))
            {
                // Get Coded Value Domain
                DomainCodedValue domainCodedValue = (DomainCodedValue)table;

                // Add Coded Value Domain
                TreeNodeTable treeNode = new TreeNodeTable(domainCodedValue);
                treeNode.ImageKey         = Catalog.CODED_VALUE_DOMAIN;
                treeNode.SelectedImageKey = Catalog.CODED_VALUE_DOMAIN;
                treeNode.Text             = domainCodedValue.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(DomainRange))
            {
                // Get Range Domain
                DomainRange domainRange = (DomainRange)table;

                // Add Range Domain
                TreeNodeTable treeNode = new TreeNodeTable(domainRange);
                treeNode.ImageKey         = Catalog.RANGE_DOMAIN;
                treeNode.SelectedImageKey = Catalog.RANGE_DOMAIN;
                treeNode.Text             = domainRange.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(FeatureClass))
            {
                // Get FeatureClass
                FeatureClass featureClass = (FeatureClass)table;

                // Add FeatureClass Node
                string imageKey = null;
                switch (featureClass.FeatureType)
                {
                case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTAnnotation:
                    imageKey = Catalog.ANNOTATION_FEATURE_CLASS;
                    break;

                case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTDimension:
                    imageKey = Catalog.DIMENSION_FEATURE_CLASS;
                    break;

                case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTSimple:
                    switch (featureClass.ShapeType)
                    {
                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint:
                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
                        imageKey = Catalog.POINT_FEATURE_CLASS;
                        break;

                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
                        imageKey = Catalog.POLYGON_FEATURE_CLASS;
                        break;

                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
                        imageKey = Catalog.POLYLINE_FEATURE_CLASS;
                        break;

                    case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch:
                        imageKey = Catalog.MULTIPATCH_FEATURE_CLASS;
                        break;

                    default:
                        imageKey = Catalog.POINT_FEATURE_CLASS;
                        break;
                    }
                    break;

                default:
                    imageKey = POINT_FEATURE_CLASS;
                    break;
                }
                TreeNodeTable treeNode = new TreeNodeTable(featureClass);
                treeNode.ImageKey         = imageKey;
                treeNode.SelectedImageKey = imageKey;
                treeNode.Text             = featureClass.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(FeatureDataset))
            {
                // Get FeatureDataset
                FeatureDataset featureDataset = (FeatureDataset)table;

                // Add FeatureDataset Node
                TreeNodeTable treeNode = new TreeNodeTable(featureDataset);
                treeNode.ImageKey         = Catalog.FEATURE_DATASET;
                treeNode.SelectedImageKey = Catalog.FEATURE_DATASET;
                treeNode.Text             = featureDataset.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(GeometricNetwork))
            {
                // Get GeometricNetwork
                GeometricNetwork geometricNetwork = (GeometricNetwork)table;

                // Add GeometricNetwork Node
                TreeNodeTable treeNode = new TreeNodeTable(geometricNetwork);
                treeNode.ImageKey         = Catalog.GEOMETRIC_NETWORK;
                treeNode.SelectedImageKey = Catalog.GEOMETRIC_NETWORK;
                treeNode.Text             = geometricNetwork.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(Network))
            {
                // Get Network
                Network network = (Network)table;

                // Add Network TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(network);
                treeNode.ImageKey         = Catalog.NETWORK_DATASET;
                treeNode.SelectedImageKey = Catalog.NETWORK_DATASET;
                treeNode.Text             = network.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(ObjectClass))
            {
                // Get ObjectClass
                ObjectClass objectClass = (ObjectClass)table;

                // Add ObjectClass TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(objectClass);
                treeNode.ImageKey         = Catalog.TABLE;
                treeNode.SelectedImageKey = Catalog.TABLE;
                treeNode.Text             = objectClass.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(RasterBand))
            {
                // Get RasterBand
                RasterBand rasterBand = (RasterBand)table;

                // Add RasterBand TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterBand);
                treeNode.ImageKey         = Catalog.RASTER_BAND;
                treeNode.SelectedImageKey = Catalog.RASTER_BAND;
                treeNode.Text             = rasterBand.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(RasterCatalog))
            {
                // Get RasterCatalog
                RasterCatalog rasterCatalog = (RasterCatalog)table;

                // Add RasterCatalog TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterCatalog);
                treeNode.ImageKey         = Catalog.RASTER_CATALOG;
                treeNode.SelectedImageKey = Catalog.RASTER_CATALOG;
                treeNode.Text             = rasterCatalog.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(RasterDataset))
            {
                // Get RasterDataset
                RasterDataset rasterDataset = (RasterDataset)table;

                // Add RasterDataset TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterDataset);
                treeNode.ImageKey         = Catalog.RASTER_DATASET;
                treeNode.SelectedImageKey = Catalog.RASTER_DATASET;
                treeNode.Text             = rasterDataset.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(RelationshipClass))
            {
                // Get RelationshipClass
                RelationshipClass relationshipClass = (RelationshipClass)table;

                // Add RelationshipClass TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(relationshipClass);
                treeNode.ImageKey         = Catalog.RELATIONSHIP_CLASS;
                treeNode.SelectedImageKey = Catalog.RELATIONSHIP_CLASS;
                treeNode.Text             = relationshipClass.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(Subtype))
            {
                // Get Subtype
                Subtype subtype = (Subtype)table;

                // Add Subtype TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(subtype);
                treeNode.ImageKey         = Catalog.SUBTYPE;
                treeNode.SelectedImageKey = Catalog.SUBTYPE;
                treeNode.Text             = subtype.SubtypeName;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(Terrain))
            {
                // Get Terrain
                Terrain terrain = (Terrain)table;

                // Add Terrain TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(terrain);
                treeNode.ImageKey         = Catalog.TERRAIN;
                treeNode.SelectedImageKey = Catalog.TERRAIN;
                treeNode.Text             = terrain.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            if (table.GetType() == typeof(Topology))
            {
                // Get Topology
                Topology topology = (Topology)table;

                // Add Topology TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(topology);
                treeNode.ImageKey         = Catalog.TOPOLOGY;
                treeNode.SelectedImageKey = Catalog.TOPOLOGY;
                treeNode.Text             = topology.Name;
                node.Nodes.Add(treeNode);

                return(treeNode);
            }

            return(null);
        }
 //
 // CONSTRUCTOR
 //
 public TreeNodeTable(EsriTable table) : base()
 {
     this.m_table = table;
 }
 //
 // CONSTRUCTOR
 //
 public TreeNodeTable(EsriTable table) : base() {
     this.m_table = table;
 }
 public ErrorTable(EsriTable table, string description, ErrorType errorType) : base(description, errorType) {
     this.m_table = table;
 }
 public override void Errors(List<Error> list, EsriTable table) {
     // Write Base Errors
     base.Errors(list, table);
 }
        public void Validate2(EsriTable table) {
            // Clear Errors
            this.m_errors.Clear();
            
            // Get Errors
            table.Errors(this.m_errors);

            // Refresh Error List
            this.RefreshErrorList();
        }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO Add Errors
 }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO Turn Feature Source Errors
 }
        private TreeNode FindNode(TreeNode treeNode, EsriTable table) {
            //
            if (treeNode is TreeNodeTable) {
                TreeNodeTable treeNodeTable = (TreeNodeTable)treeNode;
                if (treeNodeTable.Table == table) {
                    return treeNodeTable;
                }
            }

            //
            foreach (TreeNode treeNodeChild in treeNode.Nodes) {
                TreeNode treeNode2 = this.FindNode(treeNodeChild, table);
                if (treeNode2 != null) {
                    return treeNode2;
                }
            }

            return null;
        }
Exemple #27
0
 public override void Errors(List <Error> list, EsriTable table)
 {
     // TODO Edge Feature Source Errors
 }
        private void LoadModel()
        {
            // Store Selected EsriTable (if any)
            EsriTable table = null;

            if (this.treeView1.SelectedNode != null)
            {
                TreeNodeTable treeNodeTable = this.treeView1.SelectedNode as TreeNodeTable;
                if (treeNodeTable != null)
                {
                    if (treeNodeTable.Table != null)
                    {
                        table = treeNodeTable.Table;
                    }
                }
            }

            // Clear TreeView
            this.treeView1.Nodes.Clear();

            // Exit if No Model
            if (this._model == null)
            {
                return;
            }

            // Get Datasets
            List <Dataset> datasets = this._model.GetDatasets();

            // Get Domains
            List <Domain> domains = this._model.GetDomains();

            // Start TreeView Update
            this.treeView1.BeginUpdate();
            this.treeView1.Sorted = false;

            // Add Geodatabase Node
            TreeNodeGeodatabase treeNode = new TreeNodeGeodatabase(this._model);

            treeNode.ImageKey         = Catalog.GEODATABASE;
            treeNode.SelectedImageKey = Catalog.GEODATABASE;
            treeNode.Text             = this._model.Title;
            this.treeView1.Nodes.Add(treeNode);

            if (this.buttonItemCatalog.Checked)
            {
                // Sort Datasets
                datasets.Sort();

                // Loop Throught Datasets
                foreach (Dataset dataset in datasets)
                {
                    if (dataset is FeatureDataset)
                    {
                        // Get FeatureDataset
                        FeatureDataset featureDataset = (FeatureDataset)dataset;

                        // Add FeatureDataset Node
                        TreeNode treeNode2 = this.CreateCatalogNode(treeNode, featureDataset);

                        // Get Child Datasets
                        List <Dataset> datasets2 = featureDataset.GetChildren();
                        datasets2.Sort();

                        foreach (Dataset dataset2 in datasets2)
                        {
                            TreeNode treeNode3 = this.CreateCatalogNode(treeNode2, dataset2);

                            // Add Subtypes if ObjectClass
                            if (dataset2 is ObjectClass)
                            {
                                // Get ObjectClass
                                ObjectClass objectClass = (ObjectClass)dataset2;

                                // Get Subtypes
                                List <Subtype> subtypes = objectClass.GetSubtypes();
                                subtypes.Sort();

                                // Add Subtypes Nodes
                                foreach (Subtype subtype in subtypes)
                                {
                                    TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode3, subtype);
                                }
                            }
                        }
                    }
                }

                // Add Everything Else
                foreach (Dataset dataset in datasets)
                {
                    // Skip FeatureDataset and FeatureDataset Objects
                    if (dataset is FeatureDataset ||
                        dataset is GeometricNetwork ||
                        dataset is Network ||
                        dataset is RasterBand ||
                        dataset is Terrain ||
                        dataset is Topology)
                    {
                        continue;
                    }

                    // Skip Objects that Belong to a FeatureDataset
                    if (dataset is FeatureClass ||
                        dataset is RelationshipClass)
                    {
                        Dataset parent = dataset.GetParent();
                        if (parent != null)
                        {
                            continue;
                        }
                    }

                    // Create Node
                    TreeNode treeNode2 = this.CreateCatalogNode(treeNode, dataset);

                    // Add Subtypes if ObjectClass
                    if (dataset is ObjectClass)
                    {
                        // Get ObjectClass
                        ObjectClass objectClass = (ObjectClass)dataset;

                        // Get Subtypes
                        List <Subtype> subtypes = objectClass.GetSubtypes();
                        subtypes.Sort();

                        // Add Subtypes Nodes
                        foreach (Subtype subtype in subtypes)
                        {
                            TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode2, subtype);
                        }
                    }

                    // Add Raster Bands
                    if (dataset.GetType() == typeof(RasterDataset))
                    {
                        // Get RasterDataset
                        RasterDataset rasterDataset = (RasterDataset)dataset;

                        // Get RasterBands
                        List <Dataset> rasterBands = rasterDataset.GetChildren();

                        // Add RasterBands
                        foreach (Dataset datasetRasterBand in rasterBands)
                        {
                            if (datasetRasterBand.GetType() == typeof(RasterBand))
                            {
                                RasterBand rasterBand         = (RasterBand)datasetRasterBand;
                                TreeNode   treeNodeRasterBand = this.CreateCatalogNode(treeNode2, rasterBand);
                            }
                        }
                    }
                }

                // Sort Domains
                domains.Sort();

                // Add Domains
                foreach (Domain domain in domains)
                {
                    TreeNode treeNodeDomain = this.CreateCatalogNode(treeNode, domain);
                }

                // Expand Geodatabase Node
                treeNode.Expand();
            }
            else if (this.buttonItemCategorized.Checked)
            {
                // Loop for each Dataset
                foreach (Dataset dataset in datasets)
                {
                    // Get Group Node Name
                    string key = string.Empty;
                    if (dataset.GetType() == typeof(FeatureDataset))
                    {
                        key = Resources.TEXT_FEATURE_DATASET;
                    }
                    else if (dataset.GetType() == typeof(FeatureClass))
                    {
                        key = Resources.TEXT_FEATURE_CLASS;
                    }
                    else if (dataset.GetType() == typeof(GeometricNetwork))
                    {
                        key = Resources.TEXT_GEOMETRIC_NETWORK;
                    }
                    else if (dataset.GetType() == typeof(ObjectClass))
                    {
                        key = Resources.TEXT_TABLE;
                    }
                    else if (dataset.GetType() == typeof(RasterBand))
                    {
                        key = Resources.TEXT_RASTER_BAND;
                    }
                    else if (dataset.GetType() == typeof(RasterCatalog))
                    {
                        key = Resources.TEXT_RASTER_CATALOG;
                    }
                    else if (dataset.GetType() == typeof(RasterDataset))
                    {
                        key = Resources.TEXT_RASTER_DATASET;
                    }
                    else if (dataset.GetType() == typeof(RelationshipClass))
                    {
                        key = Resources.TEXT_RELATIONSHIP;
                    }
                    else if (dataset.GetType() == typeof(Terrain))
                    {
                        key = Resources.TEXT_TERRAIN;
                    }
                    else if (dataset.GetType() == typeof(Topology))
                    {
                        key = Resources.TEXT_TOPOLOGY;
                    }
                    if (string.IsNullOrEmpty(key))
                    {
                        continue;
                    }

                    // Get Group Node (create if it does not exist)
                    TreeNodeGroup treeNodeGroup = null;
                    foreach (TreeNodeGroup group in treeNode.Nodes)
                    {
                        if (group.Type == dataset.GetType())
                        {
                            treeNodeGroup = group;
                            break;
                        }
                    }
                    if (treeNodeGroup == null)
                    {
                        treeNodeGroup                  = new TreeNodeGroup(dataset.GetType());
                        treeNodeGroup.ImageKey         = Catalog.FOLDER_CLOSED;
                        treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED;
                        treeNodeGroup.Text             = key;
                        treeNode.Nodes.Add(treeNodeGroup);
                    }

                    // Create New Dataset Node
                    TreeNode treeNodeDataset = this.CreateCatalogNode(treeNodeGroup, dataset);
                }

                // Append Subtypes Nodes
                foreach (Dataset dataset in datasets)
                {
                    // Is ObjectClass?
                    if (dataset is ObjectClass)
                    {
                        // Cast to ObjectClass
                        ObjectClass objectClass = (ObjectClass)dataset;

                        // Get Subtypes
                        List <Subtype> subtypes = objectClass.GetSubtypes();
                        if (subtypes.Count == 0)
                        {
                            continue;
                        }

                        // Find Subtype Group Node
                        TreeNodeGroup treeNodeGroup = null;
                        foreach (TreeNodeGroup group in treeNode.Nodes)
                        {
                            if (group.Type == typeof(Subtype))
                            {
                                treeNodeGroup = group;
                                break;
                            }
                        }
                        if (treeNodeGroup == null)
                        {
                            treeNodeGroup                  = new TreeNodeGroup(typeof(Subtype));
                            treeNodeGroup.ImageKey         = Catalog.FOLDER_CLOSED;
                            treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED;
                            treeNodeGroup.Text             = Resources.TEXT_SUBTYPE;
                            treeNode.Nodes.Add(treeNodeGroup);
                        }

                        // Add Each Subtype
                        foreach (Subtype subtype in subtypes)
                        {
                            TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNodeGroup, subtype);
                        }
                    }
                }

                // Loop for each Domain
                foreach (Domain domain in domains)
                {
                    // Get Group Node Name
                    string key = string.Empty;
                    if (domain.GetType() == typeof(DomainCodedValue))
                    {
                        key = Resources.TEXT_CODED_VALUE;
                    }
                    else if (domain.GetType() == typeof(DomainRange))
                    {
                        key = Resources.TEXT_RANGE_DOMAIN;
                    }
                    if (string.IsNullOrEmpty(key))
                    {
                        continue;
                    }

                    // Get Group Node (create if it does not exist)
                    TreeNodeGroup treeNodeGroup = null;
                    foreach (TreeNodeGroup group in treeNode.Nodes)
                    {
                        if (group.Type == domain.GetType())
                        {
                            treeNodeGroup = group;
                            break;
                        }
                    }
                    if (treeNodeGroup == null)
                    {
                        treeNodeGroup                  = new TreeNodeGroup(domain.GetType());
                        treeNodeGroup.ImageKey         = Catalog.FOLDER_CLOSED;
                        treeNodeGroup.SelectedImageKey = Catalog.FOLDER_CLOSED;
                        treeNodeGroup.Text             = key;
                        treeNode.Nodes.Add(treeNodeGroup);
                    }

                    // Create New Dataset Node
                    TreeNode treeNodeDomain = this.CreateCatalogNode(treeNodeGroup, domain);
                }

                // Expand Geodatabase Node
                treeNode.Expand();

                // Traditional Text Sort
                this.treeView1.Sort();
            }
            else if (this.buttonItemAlphabetical.Checked)
            {
                // Loop for each Dataset
                foreach (Dataset dataset in datasets)
                {
                    // Create New Dataset Node
                    TreeNode treeNodeDataset = this.CreateCatalogNode(treeNode, dataset);

                    if (dataset is ObjectClass)
                    {
                        // Cast to ObjectClass
                        ObjectClass objectClass = (ObjectClass)dataset;

                        // Get and Add Subtypes
                        List <Subtype> subtypes = objectClass.GetSubtypes();
                        foreach (Subtype subtype in subtypes)
                        {
                            TreeNode treeNodeSubtype = this.CreateCatalogNode(treeNode, subtype);
                        }
                    }
                }

                // Loop for each Domain
                foreach (Domain domain in domains)
                {
                    TreeNode treeNodeDomain = this.CreateCatalogNode(treeNode, domain);
                }

                // Expand Geodatabase Node
                treeNode.Expand();

                // Traditional Text Sort
                this.treeView1.Sort();
            }

            // Reselect Previous EsriTable (if any)
            if (table != null)
            {
                if (this.treeView1.Nodes.Count == 1)
                {
                    //TreeNode treeNode = this.treeView1.Nodes[0];
                    TreeNode treeNodeFind = this.FindNode(treeNode, table);
                    if (treeNodeFind != null)
                    {
                        treeNodeFind.EnsureVisible();
                        treeNodeFind.TreeView.SelectedNode = treeNodeFind;
                    }
                }
            }

            // End TreeView Update
            this.treeView1.EndUpdate();
        }
        public override void Errors(List<Error> list, EsriTable table) {
            // Write Base Errors
            base.Errors(list, table);

            // Get Topology
            Topology topology = (Topology)table;

            // Check for duplicate rules
            bool duplicate = false;
            foreach (TopologyRule topologyRule in topology.TopologyRules) {
                if (topologyRule == this) { continue; }
                if (this._allOriginSubtypes == topologyRule.AllOriginSubtypes &&
                    this._originClassId == topologyRule.OriginClassId &&
                    this._originSubtype == topologyRule.OriginSubtype &&
                    this._allDestinationSubtypes == topologyRule.AllDestinationSubtypes &&
                    this._destinationClassId == topologyRule.DestinationClassId &&
                    this._destinationSubtype == topologyRule.DestinationSubtype &&
                    this._topologyRuleType == topologyRule.TopologyRuleType) {
                    duplicate = true;
                    break;
                }
            }
            if (duplicate) {
                string message = string.Format("Duplicate topology rules found");
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // Duplicate Guids
            bool duplicateGuid = false;
            foreach (TopologyRule topologyRule in topology.TopologyRules) {
                if (topologyRule == this) { continue; }
                if (this._guid == topologyRule.Guid) {
                    duplicateGuid = true;
                    break;
                }
            }
            if (duplicateGuid) {
                string message = string.Format("Topology Rule Guid [{0}] is not unique", this._guid);
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // Check if rule conflict with rules using "All Subtypes" - Origin
            if (this._allOriginSubtypes) {
                bool originSubtypeConflict = false;
                foreach (TopologyRule topologyRule in topology.TopologyRules) {
                    if (topologyRule == this) { continue; }
                    if (topologyRule.AllOriginSubtypes == false &&
                        this._originClassId == topologyRule.OriginClassId &&
                        this._allDestinationSubtypes == topologyRule.AllDestinationSubtypes &&
                        this._destinationClassId == topologyRule.DestinationClassId &&
                        this._destinationSubtype == topologyRule.DestinationSubtype &&
                        this._topologyRuleType == topologyRule.TopologyRuleType) {
                        originSubtypeConflict = true;
                        break;
                    }
                }
                if (originSubtypeConflict) {
                    string message = string.Format("The Topology Rule [{0}] with an Origin 'AllSubtypes' setting conflicts another rule", this._guid);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Check if rule conflict with rules using "All Subtypes" - Destination
            if (this._allDestinationSubtypes) {
                bool destinationSubtypeConflict = false;
                foreach (TopologyRule topologyRule in topology.TopologyRules) {
                    if (topologyRule == this) { continue; }
                    if (topologyRule.AllDestinationSubtypes == false &&
                        this._destinationClassId == topologyRule.DestinationClassId &&
                        this._allOriginSubtypes == topologyRule.AllOriginSubtypes &&
                        this._originClassId == topologyRule.OriginClassId &&
                        this._originSubtype == topologyRule.OriginSubtype &&
                        this._topologyRuleType == topologyRule.TopologyRuleType) {
                        destinationSubtypeConflict = true;
                        break;
                    }
                }
                if (destinationSubtypeConflict) {
                    string message = string.Format("The Topology Rule [{0}] with an Destination 'AllSubtypes' setting conflicts another rule", this._guid);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Valid rules for Origin/Destination Shape Types
            DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default;
            SchemaModel schemaModel = diagrammerEnvironment.SchemaModel;

            // Get Origin and Destination FeatureClasses
            ObjectClass objectClassOrig = schemaModel.FindObjectClass(this._originClassId);
            ObjectClass objectClassDest = schemaModel.FindObjectClass(this._destinationClassId);

            // Check if Origin and Destination ObjectClasses Exist
            if (objectClassOrig == null) {
                list.Add(new ErrorObject(this, table, "Origin FeatureClass Does Not Exist", ErrorType.Error));
            }
            if (objectClassDest == null) {
                list.Add(new ErrorObject(this, table, "Destination FeatureClass Does Not Exist", ErrorType.Error));
            }

            // Check if Origin and Destination Subypes Exist
            EsriTable tableOrig = schemaModel.FindObjectClassOrSubtype(this._originClassId, this._originSubtype);
            EsriTable tableDest = schemaModel.FindObjectClassOrSubtype(this._destinationClassId, this._destinationSubtype);
            if (tableOrig == null) {
                list.Add(new ErrorObject(this, table, "Origin FeatureClass and/or Subtype Does Not Exist", ErrorType.Error));
            }
            if (tableDest == null) {
                list.Add(new ErrorObject(this, table, "Destination FeatureClass and/or Subtype Does Not Exist", ErrorType.Error));
            }

            // Get Origin and Destination FeatureClasses
            FeatureClass featureClassOrig = objectClassOrig as FeatureClass;
            FeatureClass featureClassDest = objectClassDest as FeatureClass;

            // These rules MUST have the same origin and destination class/subtype
            if (featureClassOrig != null && featureClassDest != null && tableOrig != null && tableDest != null) {
                switch (this._topologyRuleType) {
                    case esriTopologyRuleType.esriTRTLineNoOverlap:
                    case esriTopologyRuleType.esriTRTLineNoIntersection:
                    case esriTopologyRuleType.esriTRTLineNoDangles:
                    case esriTopologyRuleType.esriTRTLineNoPseudos:
                    case esriTopologyRuleType.esriTRTLineNoSelfOverlap:
                    case esriTopologyRuleType.esriTRTLineNoSelfIntersect:
                    case esriTopologyRuleType.esriTRTLineNoIntersectOrInteriorTouch:
                    case esriTopologyRuleType.esriTRTLineNoMultipart:
                    case esriTopologyRuleType.esriTRTAreaNoGaps:
                    case esriTopologyRuleType.esriTRTAreaNoOverlap:
                        if (this._originClassId != this._destinationClassId ||
                            this._originSubtype != this._destinationSubtype) {
                            list.Add(new ErrorObject(this, table, "This rule must have the same origin and destination FeatureClass and Subtype", ErrorType.Error));
                        }
                        break;
                    default:
                        break;
                }
            }

            // Examine Rule Based on Origin and Destination GeometryType
            bool ok = false;
            if (featureClassOrig != null && featureClassDest != null) {
                switch (featureClassOrig.ShapeType) {
                    case esriGeometryType.esriGeometryPoint:
                        switch (featureClassDest.ShapeType) {
                            case esriGeometryType.esriGeometryPoint:
                                // POINT > POINT
                                switch (this._topologyRuleType) {
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                            case esriGeometryType.esriGeometryPolyline:
                                // POINT > POLYLINE
                                switch (this._topologyRuleType) {
                                    case esriTopologyRuleType.esriTRTPointCoveredByLine:
                                    case esriTopologyRuleType.esriTRTPointCoveredByLineEndpoint:
                                        ok = true;
                                        break;
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                            case esriGeometryType.esriGeometryPolygon:
                                // POINT > POLYGON
                                switch (this._topologyRuleType) {
                                    case esriTopologyRuleType.esriTRTPointCoveredByAreaBoundary:
                                    case esriTopologyRuleType.esriTRTPointProperlyInsideArea:
                                        ok = true;
                                        break;
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                        }
                        break;
                    case esriGeometryType.esriGeometryPolyline:
                        switch (featureClassDest.ShapeType) {
                            case esriGeometryType.esriGeometryPoint:
                                // POLYLINE > POINT
                                switch (this._topologyRuleType) {
                                    case esriTopologyRuleType.esriTRTLineEndpointCoveredByPoint:
                                        ok = true;
                                        break;
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                            case esriGeometryType.esriGeometryPolyline:
                                // POLYLINE > POLYLINE
                                switch (this._topologyRuleType) {
                                    case esriTopologyRuleType.esriTRTLineNoOverlap:
                                    case esriTopologyRuleType.esriTRTLineNoIntersection:
                                    case esriTopologyRuleType.esriTRTLineNoDangles:
                                    case esriTopologyRuleType.esriTRTLineNoPseudos:
                                    case esriTopologyRuleType.esriTRTLineCoveredByLineClass:
                                    case esriTopologyRuleType.esriTRTLineNoOverlapLine:
                                    case esriTopologyRuleType.esriTRTLineNoSelfOverlap:
                                    case esriTopologyRuleType.esriTRTLineNoSelfIntersect:
                                    case esriTopologyRuleType.esriTRTLineNoIntersectOrInteriorTouch:
                                    case esriTopologyRuleType.esriTRTLineNoMultipart:
                                        ok = true;
                                        break;
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                            case esriGeometryType.esriGeometryPolygon:
                                // POLYLINE > POLYGON
                                switch (this._topologyRuleType) {
                                    case esriTopologyRuleType.esriTRTLineCoveredByAreaBoundary:
                                        ok = true;
                                        break;
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                        }
                        break;
                    case esriGeometryType.esriGeometryPolygon:
                        switch (featureClassDest.ShapeType) {
                            case esriGeometryType.esriGeometryPoint:
                                // POLYGON > POINT
                                switch (this._topologyRuleType) {
                                    case esriTopologyRuleType.esriTRTAreaContainPoint:
                                        ok = true;
                                        break;
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                            case esriGeometryType.esriGeometryPolyline:
                                // POLYGON > POLYLINE
                                switch (this._topologyRuleType) {
                                    case esriTopologyRuleType.esriTRTAreaBoundaryCoveredByLine:
                                        ok = true;
                                        break;
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                            case esriGeometryType.esriGeometryPolygon:
                                // POLYGON > POLYGON
                                switch (this._topologyRuleType) {
                                    case esriTopologyRuleType.esriTRTAreaNoGaps:
                                    case esriTopologyRuleType.esriTRTAreaNoOverlap:
                                    case esriTopologyRuleType.esriTRTAreaCoveredByAreaClass:
                                    case esriTopologyRuleType.esriTRTAreaAreaCoverEachOther:
                                    case esriTopologyRuleType.esriTRTAreaCoveredByArea:
                                    case esriTopologyRuleType.esriTRTAreaNoOverlapArea:
                                    case esriTopologyRuleType.esriTRTAreaBoundaryCoveredByAreaBoundary:
                                        ok = true;
                                        break;
                                    default:
                                        ok = false;
                                        break;
                                }
                                break;
                        }
                        break;
                }
            }
            if (!ok) {
                list.Add(new ErrorObject(this, table, "This rule cannot be added between these FeatureClass geometric types", ErrorType.Error));
            }
        }
        private TreeNode CreateCatalogNode(TreeNode node, EsriTable table) {
            if (table.GetType() == typeof(DomainCodedValue)) {
                // Get Coded Value Domain
                DomainCodedValue domainCodedValue = (DomainCodedValue)table;

                // Add Coded Value Domain
                TreeNodeTable treeNode = new TreeNodeTable(domainCodedValue);
                treeNode.ImageKey = Catalog.CODED_VALUE_DOMAIN;
                treeNode.SelectedImageKey = Catalog.CODED_VALUE_DOMAIN;
                treeNode.Text = domainCodedValue.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(DomainRange)) {
                // Get Range Domain
                DomainRange domainRange = (DomainRange)table;

                // Add Range Domain
                TreeNodeTable treeNode = new TreeNodeTable(domainRange);
                treeNode.ImageKey = Catalog.RANGE_DOMAIN;
                treeNode.SelectedImageKey = Catalog.RANGE_DOMAIN;
                treeNode.Text = domainRange.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(FeatureClass)) {
                // Get FeatureClass
                FeatureClass featureClass = (FeatureClass)table;

                // Add FeatureClass Node
                string imageKey = null;
                switch (featureClass.FeatureType) {
                    case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTAnnotation:
                        imageKey = Catalog.ANNOTATION_FEATURE_CLASS;
                        break;
                    case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTDimension:
                        imageKey = Catalog.DIMENSION_FEATURE_CLASS;
                        break;
                    case ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTSimple:
                        switch (featureClass.ShapeType) {
                            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultipoint:
                            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint:
                                imageKey = Catalog.POINT_FEATURE_CLASS;
                                break;
                            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon:
                                imageKey = Catalog.POLYGON_FEATURE_CLASS;
                                break;
                            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline:
                                imageKey = Catalog.POLYLINE_FEATURE_CLASS;
                                break;
                            case ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryMultiPatch:
                                imageKey = Catalog.MULTIPATCH_FEATURE_CLASS;
                                break;
                            default:
                                imageKey = Catalog.POINT_FEATURE_CLASS;
                                break;
                        }
                        break;
                    default:
                        imageKey = POINT_FEATURE_CLASS;
                        break;
                }
                TreeNodeTable treeNode = new TreeNodeTable(featureClass);
                treeNode.ImageKey = imageKey;
                treeNode.SelectedImageKey = imageKey;
                treeNode.Text = featureClass.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(FeatureDataset)) {
                // Get FeatureDataset
                FeatureDataset featureDataset = (FeatureDataset)table;

                // Add FeatureDataset Node
                TreeNodeTable treeNode = new TreeNodeTable(featureDataset);
                treeNode.ImageKey = Catalog.FEATURE_DATASET;
                treeNode.SelectedImageKey = Catalog.FEATURE_DATASET;
                treeNode.Text = featureDataset.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(GeometricNetwork)) {
                // Get GeometricNetwork
                GeometricNetwork geometricNetwork = (GeometricNetwork)table;

                // Add GeometricNetwork Node
                TreeNodeTable treeNode = new TreeNodeTable(geometricNetwork);
                treeNode.ImageKey = Catalog.GEOMETRIC_NETWORK;
                treeNode.SelectedImageKey = Catalog.GEOMETRIC_NETWORK;
                treeNode.Text = geometricNetwork.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(Network)) {
                // Get Network
                Network network = (Network)table;

                // Add Network TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(network);
                treeNode.ImageKey = Catalog.NETWORK_DATASET;
                treeNode.SelectedImageKey = Catalog.NETWORK_DATASET;
                treeNode.Text = network.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(ObjectClass)) {
                // Get ObjectClass
                ObjectClass objectClass = (ObjectClass)table;

                // Add ObjectClass TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(objectClass);
                treeNode.ImageKey = Catalog.TABLE;
                treeNode.SelectedImageKey = Catalog.TABLE;
                treeNode.Text = objectClass.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(RasterBand)) {
                // Get RasterBand
                RasterBand rasterBand = (RasterBand)table;

                // Add RasterBand TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterBand);
                treeNode.ImageKey = Catalog.RASTER_BAND;
                treeNode.SelectedImageKey = Catalog.RASTER_BAND;
                treeNode.Text = rasterBand.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(RasterCatalog)) {
                // Get RasterCatalog
                RasterCatalog rasterCatalog = (RasterCatalog)table;

                // Add RasterCatalog TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterCatalog);
                treeNode.ImageKey = Catalog.RASTER_CATALOG;
                treeNode.SelectedImageKey = Catalog.RASTER_CATALOG;
                treeNode.Text = rasterCatalog.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(RasterDataset)) {
                // Get RasterDataset
                RasterDataset rasterDataset = (RasterDataset)table;

                // Add RasterDataset TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(rasterDataset);
                treeNode.ImageKey = Catalog.RASTER_DATASET;
                treeNode.SelectedImageKey = Catalog.RASTER_DATASET;
                treeNode.Text = rasterDataset.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(RelationshipClass)) {
                // Get RelationshipClass
                RelationshipClass relationshipClass = (RelationshipClass)table;

                // Add RelationshipClass TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(relationshipClass);
                treeNode.ImageKey = Catalog.RELATIONSHIP_CLASS;
                treeNode.SelectedImageKey = Catalog.RELATIONSHIP_CLASS;
                treeNode.Text = relationshipClass.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(Subtype)) {
                // Get Subtype
                Subtype subtype = (Subtype)table;

                // Add Subtype TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(subtype);
                treeNode.ImageKey = Catalog.SUBTYPE;
                treeNode.SelectedImageKey = Catalog.SUBTYPE;
                treeNode.Text = subtype.SubtypeName;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(Terrain)) {
                // Get Terrain
                Terrain terrain = (Terrain)table;

                // Add Terrain TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(terrain);
                treeNode.ImageKey = Catalog.TERRAIN;
                treeNode.SelectedImageKey = Catalog.TERRAIN;
                treeNode.Text = terrain.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            if (table.GetType() == typeof(Topology)) {
                // Get Topology
                Topology topology = (Topology)table;

                // Add Topology TreeNode
                TreeNodeTable treeNode = new TreeNodeTable(topology);
                treeNode.ImageKey = Catalog.TOPOLOGY;
                treeNode.SelectedImageKey = Catalog.TOPOLOGY;
                treeNode.Text = topology.Name;
                node.Nodes.Add(treeNode);

                return treeNode;
            }

            return null;
        }
Exemple #31
0
 public override void Errors(List <Error> list, EsriTable table)
 {
     // TODO Evaluated Network Attribute Errors
 }
        public override void Errors(List<Error> list, EsriTable table) {
            // TODO Add RasterDef Errors

            // Add Spatial Reference Errors
            if (this._spatialReference == null) {
                list.Add(new ErrorObject(this, table, "SpatialReference cannot be null", ErrorType.Error));
            }
            else {
                this._spatialReference.Errors(list, table);
            }
        }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO: Add Topology Controller Membership Errors
 }
 public override void Errors(List <Error> list, EsriTable table)
 {
     // TODO Network Source Direction Errors
 }
 public DiagramEventArgs(EsriTable table, Type type) {
     this.m_table = table;
     this.m_type = type;
 }
 public override void Errors(List <Error> list, EsriTable table)
 {
     // Write Base Errors
     base.Errors(list, table);
 }
 public override void Errors(List<Error> list, EsriTable table) {
     // Check if class/subtype exists
     EsriTable table2 = DiagrammerEnvironment.Default.SchemaModel.FindObjectClassOrSubtype(this._classID, this._subtypeCode);
     if (table2 == null) {
         string message = string.Format("The junction subtype [{0}::{1}] does not exist", this._classID.ToString(), this._subtypeCode.ToString());
         list.Add(new ErrorObject(this, table, message, ErrorType.Error));
     }
 }
Exemple #38
0
        public Field(IXPathNavigable path, EsriTable table) : base(path) {
            //
            this.SuspendEvents = true;

            // Get Navigator
            XPathNavigator navigator = path.CreateNavigator();

            // <Name></Name>
            XPathNavigator navigatorFieldName = navigator.SelectSingleNode("Name");
            if (navigatorFieldName != null) {
                this._name = navigatorFieldName.Value;
            }

            // <Type></Type>
            XPathNavigator navigatorFieldType = navigator.SelectSingleNode("Type");
            if (navigatorFieldType != null) {
                this._fieldType = (esriFieldType)Enum.Parse(typeof(esriFieldType), navigatorFieldType.Value, true);
            }

            // <IsNullable></IsNullable>
            XPathNavigator navigatorFieldIsNullable = navigator.SelectSingleNode("IsNullable");
            if (navigatorFieldIsNullable != null) {
                this._isNullable = navigatorFieldIsNullable.ValueAsBoolean;
            }

            // <Length></Length>
            XPathNavigator navigatorFieldLength = navigator.SelectSingleNode("Length");
            if (navigatorFieldLength != null) {
                this._length = navigatorFieldLength.ValueAsInt;
            }

            // <Precision></Precision>
            XPathNavigator navigatorFieldPrecision = navigator.SelectSingleNode("Precision");
            if (navigatorFieldPrecision != null) {
                this._precision = navigatorFieldPrecision.ValueAsInt;
            }

            // <Scale></Scale>
            XPathNavigator navigatorFieldScale = navigator.SelectSingleNode("Scale");
            if (navigatorFieldScale != null) {
                this._scale = navigatorFieldScale.ValueAsInt;
            }

            // <Required></Required>
            XPathNavigator navigatorFieldRequired = navigator.SelectSingleNode("Required");
            if (navigatorFieldRequired != null) {
                this._required = navigatorFieldRequired.ValueAsBoolean;
            }

            // <Editable></Editable>
            XPathNavigator navigatorFieldEditable = navigator.SelectSingleNode("Editable");
            if (navigatorFieldEditable != null) {
                this._editable = navigatorFieldEditable.ValueAsBoolean;
            }

            // <DomainFixed></DomainFixed>
            XPathNavigator navigatorFieldDomainFixed = navigator.SelectSingleNode("DomainFixed");
            if (navigatorFieldDomainFixed != null) {
                this._domainFixed = navigatorFieldDomainFixed.ValueAsBoolean;
            }

            // <AliasName></AliasName>
            XPathNavigator navigatorFieldAliasName = navigator.SelectSingleNode("AliasName");
            if (navigatorFieldAliasName != null) {
                this._aliasName = navigatorFieldAliasName.Value;
            }

            // <GeometryDef></GeometryDef>
            XPathNavigator navigatorGeometryDef = navigator.SelectSingleNode("GeometryDef");
            if (navigatorGeometryDef != null) {
                this._geometryDef = new GeometryDef(navigatorGeometryDef);
            }

            // <ModelName></ModelName>
            XPathNavigator navigatorFieldModelName = navigator.SelectSingleNode("ModelName");
            if (navigatorFieldModelName != null) {
                this._modelName = navigatorFieldModelName.Value;
            }

            // <DefaultValue></DefaultValue>
            XPathNavigator navigatorFieldDefaultValue = navigator.SelectSingleNode("DefaultValue");
            if (navigatorFieldDefaultValue != null) {
                this._defaultValue = navigatorFieldDefaultValue.Value;
            }

            // <Domain></Domain>
            XPathNavigator navigatorFieldDomain= navigator.SelectSingleNode("Domain/DomainName");
            if (navigatorFieldDomain != null) {
                this._domain = navigatorFieldDomain.Value;
            }

            // <RasterDef></RasterDef>
            XPathNavigator navigatorRasterDef = navigator.SelectSingleNode("RasterDef");
            if (navigatorRasterDef != null) {
                this._rasterDef = new RasterDef(navigatorRasterDef);
            }

            // Initialize Text
            this.UpdateText();

            // Set Element Properties
            this.Image = new Crainiate.ERM4.Image("Resource.publicfield.gif", "Crainiate.ERM4.Component");

            //
            this.SuspendEvents = false;
        }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO Network Attribute Parameter Errors
 }
        public override void Errors(List<Error> list, EsriTable table) {
            // This controller must be assigned to a FeatureClass
            FeatureClass featureClass = table as FeatureClass;
            if (table.GetType() != typeof(FeatureClass)) {
                list.Add(new ErrorObject(this, table, "A geometric network controller is ONLY supported in FeatureClasses", ErrorType.Error));
            }

            // GeometricNetwork Name
            if (string.IsNullOrEmpty(this._geometricNetworkName)) {
                list.Add(new ErrorObject(this, table, "The controller property 'GeometricNetworkName' can not be empty", ErrorType.Error));
            }
            else {
                GeometricNetwork geometricNetwork = DiagrammerEnvironment.Default.SchemaModel.FindGeometricNetwork(this._geometricNetworkName);
                if (geometricNetwork == null) {
                    string message = string.Format("The geometric network [{0}] referenced in the controller does not exist", this._geometricNetworkName);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Enabled Field Cannot be NULL/Empty
            if (string.IsNullOrEmpty(this._enabledFieldName)) {
                list.Add(new ErrorObject(this, table, "The controller property 'EnabledFieldName' can not be empty", ErrorType.Error));
            }
            else {
                if (featureClass != null) {
                    Field field = featureClass.FindField(this._enabledFieldName);
                    if (field == null) {
                        string message = string.Format("The geometric network controller cannot find 'enabled field' [{0}] in the featureclass [{1}]", this._enabledFieldName, featureClass.Name);
                        list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                    }
                    else {
                        if (field.FieldType != esriFieldType.esriFieldTypeSmallInteger) {
                            string message = string.Format("The geometric network controller references an 'enabled field' [{0}] in the featureclass [{1}] that is not a 'Short Integer'", this._enabledFieldName, featureClass.Name);
                            list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                        }
                    }
                }
            }

            // Ancillary Role / Ancillary Role Field
            switch(this._networkClassAncillaryRole){
                case esriNetworkClassAncillaryRole.esriNCARNone:
                    if (!string.IsNullOrEmpty(this._ancillaryRoleFieldName)){
                        string message = string.Format("The ancillary role field name should be empty if the role (in a geometric network controller) is set to none.");
                        list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                    }
                    break;
                case esriNetworkClassAncillaryRole.esriNCARSourceSink:
                    if (string.IsNullOrEmpty(this._ancillaryRoleFieldName)) {
                        string message = string.Format("The ancillary role field name can not be empty for this role in a geometric network controller");
                        list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                    }
                    else {
                        if (featureClass != null) {
                            Field field = featureClass.FindField(this._ancillaryRoleFieldName);
                            if (field == null) {
                                string message = string.Format("The geometric network controller cannot find 'ancillary role field' [{0}] in the featureclass [{1}]", this._ancillaryRoleFieldName, featureClass.Name);
                                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                            }
                            else {
                                if (field.FieldType != esriFieldType.esriFieldTypeSmallInteger) {
                                    string message = string.Format("The geometric network controller references an 'ancillary role field' [{0}] in the featureclass [{1}] that is not a 'Short Integer'", this._ancillaryRoleFieldName, featureClass.Name);
                                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                                }
                            }
                        }
                    }
                    break;
            }
        }
 public TableEventArgs(EsriTable table)
 {
     this._table = table;
 }
        public override void Errors(List <Error> list, EsriTable table)
        {
            // This controller must be assigned to a FeatureClass
            FeatureClass featureClass = table as FeatureClass;

            if (table.GetType() != typeof(FeatureClass))
            {
                list.Add(new ErrorObject(this, table, "A geometric network controller is ONLY supported in FeatureClasses", ErrorType.Error));
            }

            // GeometricNetwork Name
            if (string.IsNullOrEmpty(this._geometricNetworkName))
            {
                list.Add(new ErrorObject(this, table, "The controller property 'GeometricNetworkName' can not be empty", ErrorType.Error));
            }
            else
            {
                GeometricNetwork geometricNetwork = DiagrammerEnvironment.Default.SchemaModel.FindGeometricNetwork(this._geometricNetworkName);
                if (geometricNetwork == null)
                {
                    string message = string.Format("The geometric network [{0}] referenced in the controller does not exist", this._geometricNetworkName);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Enabled Field Cannot be NULL/Empty
            if (string.IsNullOrEmpty(this._enabledFieldName))
            {
                list.Add(new ErrorObject(this, table, "The controller property 'EnabledFieldName' can not be empty", ErrorType.Error));
            }
            else
            {
                if (featureClass != null)
                {
                    Field field = featureClass.FindField(this._enabledFieldName);
                    if (field == null)
                    {
                        string message = string.Format("The geometric network controller cannot find 'enabled field' [{0}] in the featureclass [{1}]", this._enabledFieldName, featureClass.Name);
                        list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                    }
                    else
                    {
                        if (field.FieldType != esriFieldType.esriFieldTypeSmallInteger)
                        {
                            string message = string.Format("The geometric network controller references an 'enabled field' [{0}] in the featureclass [{1}] that is not a 'Short Integer'", this._enabledFieldName, featureClass.Name);
                            list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                        }
                    }
                }
            }

            // Ancillary Role / Ancillary Role Field
            switch (this._networkClassAncillaryRole)
            {
            case esriNetworkClassAncillaryRole.esriNCARNone:
                if (!string.IsNullOrEmpty(this._ancillaryRoleFieldName))
                {
                    string message = string.Format("The ancillary role field name should be empty if the role (in a geometric network controller) is set to none.");
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
                break;

            case esriNetworkClassAncillaryRole.esriNCARSourceSink:
                if (string.IsNullOrEmpty(this._ancillaryRoleFieldName))
                {
                    string message = string.Format("The ancillary role field name can not be empty for this role in a geometric network controller");
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
                else
                {
                    if (featureClass != null)
                    {
                        Field field = featureClass.FindField(this._ancillaryRoleFieldName);
                        if (field == null)
                        {
                            string message = string.Format("The geometric network controller cannot find 'ancillary role field' [{0}] in the featureclass [{1}]", this._ancillaryRoleFieldName, featureClass.Name);
                            list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                        }
                        else
                        {
                            if (field.FieldType != esriFieldType.esriFieldTypeSmallInteger)
                            {
                                string message = string.Format("The geometric network controller references an 'ancillary role field' [{0}] in the featureclass [{1}] that is not a 'Short Integer'", this._ancillaryRoleFieldName, featureClass.Name);
                                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                            }
                        }
                    }
                }
                break;
            }
        }
Exemple #43
0
 public override void Errors(List <Error> list, EsriTable table)
 {
     // TODO: Add Topology Controller Membership Errors
 }
 public TableEventArgs(EsriTable table) {
     this._table = table;
 }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO Terrain Pyramid Errors
 }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO TerrainDataSource Errors
 }
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO Network Source Direction Errors
 }
Exemple #48
0
 public override void Errors(List <Error> list, EsriTable table)
 {
     // TODO Network Attribute Parameter Errors
 }
Exemple #49
0
        public override void Errors(List <Error> list, EsriTable table)
        {
            // Write Base Errors
            base.Errors(list, table);

            // Get Topology
            Topology topology = (Topology)table;

            // Check for duplicate rules
            bool duplicate = false;

            foreach (TopologyRule topologyRule in topology.TopologyRules)
            {
                if (topologyRule == this)
                {
                    continue;
                }
                if (this._allOriginSubtypes == topologyRule.AllOriginSubtypes &&
                    this._originClassId == topologyRule.OriginClassId &&
                    this._originSubtype == topologyRule.OriginSubtype &&
                    this._allDestinationSubtypes == topologyRule.AllDestinationSubtypes &&
                    this._destinationClassId == topologyRule.DestinationClassId &&
                    this._destinationSubtype == topologyRule.DestinationSubtype &&
                    this._topologyRuleType == topologyRule.TopologyRuleType)
                {
                    duplicate = true;
                    break;
                }
            }
            if (duplicate)
            {
                string message = string.Format("Duplicate topology rules found");
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // Duplicate Guids
            bool duplicateGuid = false;

            foreach (TopologyRule topologyRule in topology.TopologyRules)
            {
                if (topologyRule == this)
                {
                    continue;
                }
                if (this._guid == topologyRule.Guid)
                {
                    duplicateGuid = true;
                    break;
                }
            }
            if (duplicateGuid)
            {
                string message = string.Format("Topology Rule Guid [{0}] is not unique", this._guid);
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // Check if rule conflict with rules using "All Subtypes" - Origin
            if (this._allOriginSubtypes)
            {
                bool originSubtypeConflict = false;
                foreach (TopologyRule topologyRule in topology.TopologyRules)
                {
                    if (topologyRule == this)
                    {
                        continue;
                    }
                    if (topologyRule.AllOriginSubtypes == false &&
                        this._originClassId == topologyRule.OriginClassId &&
                        this._allDestinationSubtypes == topologyRule.AllDestinationSubtypes &&
                        this._destinationClassId == topologyRule.DestinationClassId &&
                        this._destinationSubtype == topologyRule.DestinationSubtype &&
                        this._topologyRuleType == topologyRule.TopologyRuleType)
                    {
                        originSubtypeConflict = true;
                        break;
                    }
                }
                if (originSubtypeConflict)
                {
                    string message = string.Format("The Topology Rule [{0}] with an Origin 'AllSubtypes' setting conflicts another rule", this._guid);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Check if rule conflict with rules using "All Subtypes" - Destination
            if (this._allDestinationSubtypes)
            {
                bool destinationSubtypeConflict = false;
                foreach (TopologyRule topologyRule in topology.TopologyRules)
                {
                    if (topologyRule == this)
                    {
                        continue;
                    }
                    if (topologyRule.AllDestinationSubtypes == false &&
                        this._destinationClassId == topologyRule.DestinationClassId &&
                        this._allOriginSubtypes == topologyRule.AllOriginSubtypes &&
                        this._originClassId == topologyRule.OriginClassId &&
                        this._originSubtype == topologyRule.OriginSubtype &&
                        this._topologyRuleType == topologyRule.TopologyRuleType)
                    {
                        destinationSubtypeConflict = true;
                        break;
                    }
                }
                if (destinationSubtypeConflict)
                {
                    string message = string.Format("The Topology Rule [{0}] with an Destination 'AllSubtypes' setting conflicts another rule", this._guid);
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Valid rules for Origin/Destination Shape Types
            DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default;
            SchemaModel           schemaModel           = diagrammerEnvironment.SchemaModel;

            // Get Origin and Destination FeatureClasses
            ObjectClass objectClassOrig = schemaModel.FindObjectClass(this._originClassId);
            ObjectClass objectClassDest = schemaModel.FindObjectClass(this._destinationClassId);

            // Check if Origin and Destination ObjectClasses Exist
            if (objectClassOrig == null)
            {
                list.Add(new ErrorObject(this, table, "Origin FeatureClass Does Not Exist", ErrorType.Error));
            }
            if (objectClassDest == null)
            {
                list.Add(new ErrorObject(this, table, "Destination FeatureClass Does Not Exist", ErrorType.Error));
            }

            // Check if Origin and Destination Subypes Exist
            EsriTable tableOrig = schemaModel.FindObjectClassOrSubtype(this._originClassId, this._originSubtype);
            EsriTable tableDest = schemaModel.FindObjectClassOrSubtype(this._destinationClassId, this._destinationSubtype);

            if (tableOrig == null)
            {
                list.Add(new ErrorObject(this, table, "Origin FeatureClass and/or Subtype Does Not Exist", ErrorType.Error));
            }
            if (tableDest == null)
            {
                list.Add(new ErrorObject(this, table, "Destination FeatureClass and/or Subtype Does Not Exist", ErrorType.Error));
            }

            // Get Origin and Destination FeatureClasses
            FeatureClass featureClassOrig = objectClassOrig as FeatureClass;
            FeatureClass featureClassDest = objectClassDest as FeatureClass;

            // These rules MUST have the same origin and destination class/subtype
            if (featureClassOrig != null && featureClassDest != null && tableOrig != null && tableDest != null)
            {
                switch (this._topologyRuleType)
                {
                case esriTopologyRuleType.esriTRTLineNoOverlap:
                case esriTopologyRuleType.esriTRTLineNoIntersection:
                case esriTopologyRuleType.esriTRTLineNoDangles:
                case esriTopologyRuleType.esriTRTLineNoPseudos:
                case esriTopologyRuleType.esriTRTLineNoSelfOverlap:
                case esriTopologyRuleType.esriTRTLineNoSelfIntersect:
                case esriTopologyRuleType.esriTRTLineNoIntersectOrInteriorTouch:
                case esriTopologyRuleType.esriTRTLineNoMultipart:
                case esriTopologyRuleType.esriTRTAreaNoGaps:
                case esriTopologyRuleType.esriTRTAreaNoOverlap:
                    if (this._originClassId != this._destinationClassId ||
                        this._originSubtype != this._destinationSubtype)
                    {
                        list.Add(new ErrorObject(this, table, "This rule must have the same origin and destination FeatureClass and Subtype", ErrorType.Error));
                    }
                    break;

                default:
                    break;
                }
            }

            // Examine Rule Based on Origin and Destination GeometryType
            bool ok = false;

            if (featureClassOrig != null && featureClassDest != null)
            {
                switch (featureClassOrig.ShapeType)
                {
                case esriGeometryType.esriGeometryPoint:
                    switch (featureClassDest.ShapeType)
                    {
                    case esriGeometryType.esriGeometryPoint:
                        // POINT > POINT
                        switch (this._topologyRuleType)
                        {
                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolyline:
                        // POINT > POLYLINE
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTPointCoveredByLine:
                        case esriTopologyRuleType.esriTRTPointCoveredByLineEndpoint:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolygon:
                        // POINT > POLYGON
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTPointCoveredByAreaBoundary:
                        case esriTopologyRuleType.esriTRTPointProperlyInsideArea:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;
                    }
                    break;

                case esriGeometryType.esriGeometryPolyline:
                    switch (featureClassDest.ShapeType)
                    {
                    case esriGeometryType.esriGeometryPoint:
                        // POLYLINE > POINT
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTLineEndpointCoveredByPoint:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolyline:
                        // POLYLINE > POLYLINE
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTLineNoOverlap:
                        case esriTopologyRuleType.esriTRTLineNoIntersection:
                        case esriTopologyRuleType.esriTRTLineNoDangles:
                        case esriTopologyRuleType.esriTRTLineNoPseudos:
                        case esriTopologyRuleType.esriTRTLineCoveredByLineClass:
                        case esriTopologyRuleType.esriTRTLineNoOverlapLine:
                        case esriTopologyRuleType.esriTRTLineNoSelfOverlap:
                        case esriTopologyRuleType.esriTRTLineNoSelfIntersect:
                        case esriTopologyRuleType.esriTRTLineNoIntersectOrInteriorTouch:
                        case esriTopologyRuleType.esriTRTLineNoMultipart:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolygon:
                        // POLYLINE > POLYGON
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTLineCoveredByAreaBoundary:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;
                    }
                    break;

                case esriGeometryType.esriGeometryPolygon:
                    switch (featureClassDest.ShapeType)
                    {
                    case esriGeometryType.esriGeometryPoint:
                        // POLYGON > POINT
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTAreaContainPoint:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolyline:
                        // POLYGON > POLYLINE
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTAreaBoundaryCoveredByLine:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;

                    case esriGeometryType.esriGeometryPolygon:
                        // POLYGON > POLYGON
                        switch (this._topologyRuleType)
                        {
                        case esriTopologyRuleType.esriTRTAreaNoGaps:
                        case esriTopologyRuleType.esriTRTAreaNoOverlap:
                        case esriTopologyRuleType.esriTRTAreaCoveredByAreaClass:
                        case esriTopologyRuleType.esriTRTAreaAreaCoverEachOther:
                        case esriTopologyRuleType.esriTRTAreaCoveredByArea:
                        case esriTopologyRuleType.esriTRTAreaNoOverlapArea:
                        case esriTopologyRuleType.esriTRTAreaBoundaryCoveredByAreaBoundary:
                            ok = true;
                            break;

                        default:
                            ok = false;
                            break;
                        }
                        break;
                    }
                    break;
                }
            }
            if (!ok)
            {
                list.Add(new ErrorObject(this, table, "This rule cannot be added between these FeatureClass geometric types", ErrorType.Error));
            }
        }
 public EsriTable(EsriTable prototype) : base(prototype)
 {
 }
 public EsriTable(EsriTable prototype) : base(prototype) { }
Exemple #52
0
        public override void Errors(List <Error> list, EsriTable table)
        {
            // Write Base Errors
            base.Errors(list, table);

            // From Class ID and SubtypeCode
            EsriTable table2 = DiagrammerEnvironment.Default.SchemaModel.FindObjectClassOrSubtype(this._fromClassID, this._fromEdgeSubtypeCode);

            if (table2 == null)
            {
                string message = string.Format("Edge Connectivity Rule [{0}]: Can not identify the from edge [{1}::{0}]", this.RuleId.ToString(), this._fromClassID.ToString(), this._fromEdgeSubtypeCode.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // To Class ID and SubtypeCode
            EsriTable table3 = DiagrammerEnvironment.Default.SchemaModel.FindObjectClassOrSubtype(this._toClassID, this._toEdgeSubtypeCode);

            if (table3 == null)
            {
                string message = string.Format("Edge Connectivity Rule [{0}]: Can not identify the to edge [{1}::{0}]", this.RuleId.ToString(), this._toClassID.ToString(), this._toEdgeSubtypeCode.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // Default Class ID and SubtypeCode
            EsriTable table4 = DiagrammerEnvironment.Default.SchemaModel.FindObjectClassOrSubtype(this._defaultJunctionID, this._defaultJunctionSubtypeCode);

            if (table4 == null)
            {
                string message = string.Format("Edge Connectivity Rule [{0}]: Can not identify the default junction [{1}::{0}]", this.RuleId.ToString(), this._defaultJunctionID.ToString(), this._defaultJunctionSubtypeCode.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }
            else
            {
                bool found = false;
                foreach (JunctionSubtype junctionSubtype in this._junctionSubtypes)
                {
                    if (junctionSubtype.ClassID == this._defaultJunctionID &&
                        junctionSubtype.SubtypeCode == this._defaultJunctionSubtypeCode)
                    {
                        found = true;
                        break;
                    }
                }
                if (!found)
                {
                    string message = string.Format("Edge Connectivity Rule [{0}]: The default junction [{1}::{0}] in not contained in the junction list", this.RuleId.ToString(), this._defaultJunctionID.ToString(), this._defaultJunctionSubtypeCode.ToString());
                    list.Add(new ErrorObject(this, table, message, ErrorType.Error));
                }
            }

            // Junction Subtype
            if (this._junctionSubtypes.Count == 0)
            {
                string message = string.Format("Edge Connectivity Rule [{0}]: The rule must at least one junction defined", this.RuleId.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }
            foreach (JunctionSubtype junctionSubtype in this._junctionSubtypes)
            {
                junctionSubtype.Errors(list, table);
            }
        }
Exemple #53
0
 public override void Errors(List<Error> list, EsriTable table) {
     // TODO : HelpString contains invalid characters
     // TODO : Rule Id less than -1
 }
        public override void Errors(List<Error> list, EsriTable table) {
            // Key cannot be empty
            if (string.IsNullOrEmpty(this._key)) {
                list.Add(new ErrorObject(this, table, "Property Key cannot be empty", ErrorType.Error));
            }

            // Type cannot be empty
            if (string.IsNullOrEmpty(this._type)) {
                list.Add(new ErrorObject(this, table, "Property Type cannot be empty", ErrorType.Error));
            }

            // [Warning]
            if (string.IsNullOrEmpty(this._value)) {
                list.Add(new ErrorObject(this, table, "Property Value is empty", ErrorType.Warning));
            }
        }
Exemple #55
0
 public override void Errors(List <Error> list, EsriTable table)
 {
     // TODO : HelpString contains invalid characters
     // TODO : Rule Id less than -1
 }
 public ErrorTable(EsriTable table, string description, ErrorType errorType) : base(description, errorType)
 {
     this.m_table = table;
 }
Exemple #57
0
 public override void Errors(List <Error> list, EsriTable table)
 {
     // TODO Shield Errors
 }
        private void MenuItem_Activate(object sender, EventArgs e)
        {
            try {
                //
                // Error List Context Menu
                //
                if (sender == this.menuButtonItemScroll)
                {
                    // Can only zoom to one item
                    if (this.listViewErrorList.SelectedItems.Count != 1)
                    {
                        return;
                    }

                    // Get EsriTable containing the error
                    ListViewItemError item  = (ListViewItemError)this.listViewErrorList.SelectedItems[0];
                    EsriTable         table = null;
                    if (item.Error is ErrorTable)
                    {
                        ErrorTable errorTable = (ErrorTable)item.Error;
                        table = errorTable.Table;
                    }
                    else if (item.Error is ErrorTableRow)
                    {
                        ErrorTableRow errorTableRow = (ErrorTableRow)item.Error;
                        EsriTableRow  esriTableRow  = (EsriTableRow)errorTableRow.TableRow;
                        table = (EsriTable)esriTableRow.Table;
                    }
                    else if (item.Error is ErrorObject)
                    {
                        ErrorObject errorObject = (ErrorObject)item.Error;
                        table = errorObject.Table;
                    }
                    if (table == null)
                    {
                        return;
                    }

                    // Get Containing Model
                    EsriModel model = (EsriModel)table.Container;

                    // Scroll to Table
                    model.ScrollToElement(table);

                    // Flash Table
                    table.Flash();
                }
                else if (sender == this.menuButtonItemSelect)
                {
                    // Can only zoom to one item
                    if (this.listViewErrorList.SelectedItems.Count == 0)
                    {
                        return;
                    }

                    foreach (ListViewItemError item in this.listViewErrorList.SelectedItems)
                    {
                        EsriModel model = null;
                        if (item.Error is ErrorTable)
                        {
                            ErrorTable errorTable = (ErrorTable)item.Error;
                            EsriTable  table      = errorTable.Table;
                            model = (EsriModel)table.Container;
                        }
                        else if (item.Error is ErrorTableRow)
                        {
                            ErrorTableRow errorTableRow = (ErrorTableRow)item.Error;
                            EsriTableRow  esriTableRow  = (EsriTableRow)errorTableRow.TableRow;
                            EsriTable     table         = (EsriTable)esriTableRow.Table;
                            model = (EsriModel)table.Container;
                        }
                        else if (item.Error is ErrorObject)
                        {
                            ErrorObject errorObject = (ErrorObject)item.Error;
                            EsriTable   table       = errorObject.Table;
                            model = (EsriModel)table.Container;
                        }
                        if (model == null)
                        {
                            continue;
                        }

                        // Clear Model Selection
                        model.SelectElements(false);
                    }
                    //
                    foreach (ListViewItemError item in this.listViewErrorList.SelectedItems)
                    {
                        // Get Table
                        EsriTable table = null;
                        if (item.Error is ErrorTable)
                        {
                            ErrorTable errorTable = (ErrorTable)item.Error;
                            table = errorTable.Table;
                        }
                        else if (item.Error is ErrorTableRow)
                        {
                            ErrorTableRow errorTableRow = (ErrorTableRow)item.Error;
                            EsriTableRow  esriTableRow  = (EsriTableRow)errorTableRow.TableRow;
                            table = (EsriTable)esriTableRow.Table;
                        }
                        else if (item.Error is ErrorObject)
                        {
                            ErrorObject errorObject = (ErrorObject)item.Error;
                            table = errorObject.Table;
                        }
                        if (table == null)
                        {
                            continue;
                        }

                        // Flash Table
                        table.Selected = true;
                    }
                }
                else if (sender == this.menuButtonItemFlashError)
                {
                    // Can only zoom to one item
                    if (this.listViewErrorList.SelectedItems.Count == 0)
                    {
                        return;
                    }

                    //
                    foreach (ListViewItemError item in this.listViewErrorList.SelectedItems)
                    {
                        // Get Table
                        EsriTable table = null;
                        if (item.Error is ErrorTable)
                        {
                            ErrorTable errorTable = (ErrorTable)item.Error;
                            table = errorTable.Table;
                        }
                        else if (item.Error is ErrorTableRow)
                        {
                            ErrorTableRow errorTableRow = (ErrorTableRow)item.Error;
                            EsriTableRow  esriTableRow  = (EsriTableRow)errorTableRow.TableRow;
                            table = (EsriTable)esriTableRow.Table;
                        }
                        else if (item.Error is ErrorObject)
                        {
                            ErrorObject errorObject = (ErrorObject)item.Error;
                            table = errorObject.Table;
                        }
                        if (table == null)
                        {
                            continue;
                        }

                        // Flash Table
                        table.Flash();
                    }
                }
                else if (sender == this.menuButtonItemClearError)
                {
                    // Remove Selected Items
                    foreach (ListViewItemError item in this.listViewErrorList.SelectedItems)
                    {
                        if (this.m_errors.Contains(item.Error))
                        {
                            this.m_errors.Remove(item.Error);
                        }
                    }

                    // Refresh Error List
                    this.RefreshErrorList();
                }
                else if (sender == menuButtonItemClearAllErrors)
                {
                    // Remove All Errors
                    this.m_errors.Clear();

                    // Refresh Error List
                    this.RefreshErrorList();
                }
                //
                // Validator Dropdown Menu
                //
                else if (sender == this.menuButtonItemPGdb)
                {
                    WorkspaceValidator.Default.Validator = new PersonalGeodatabaseValidator();
                }
                else if (sender == this.menuButtonItemFGdb)
                {
                    WorkspaceValidator.Default.Validator = new FileGeodatabaseValidator();
                }
                else if (sender == this.menuButtonItemSelectGeodatabase)
                {
                    // Create GxObjectFilter for GxDialog
                    IGxObjectFilter gxObjectFilter = new GxFilterWorkspacesClass();

                    // Create GxDialog
                    IGxDialog gxDialog = new GxDialogClass();
                    gxDialog.AllowMultiSelect = false;
                    gxDialog.ButtonCaption    = Resources.TEXT_SELECT;
                    gxDialog.ObjectFilter     = gxObjectFilter;
                    gxDialog.RememberLocation = true;
                    gxDialog.Title            = Resources.TEXT_SELECT_EXISTING_GEODATABASE;

                    // Declare Enumerator to hold selected objects
                    IEnumGxObject enumGxObject = null;

                    // Open Dialog
                    if (!gxDialog.DoModalOpen(0, out enumGxObject))
                    {
                        return;
                    }
                    if (enumGxObject == null)
                    {
                        return;
                    }

                    // Get Selected Object (if any)
                    IGxObject gxObject = enumGxObject.Next();
                    if (gxObject == null)
                    {
                        return;
                    }
                    if (!gxObject.IsValid)
                    {
                        return;
                    }

                    // Get GxDatabase
                    if (!(gxObject is IGxDatabase))
                    {
                        return;
                    }
                    IGxDatabase gxDatabase = (IGxDatabase)gxObject;

                    // Get Workspace
                    IWorkspace workspace = gxDatabase.Workspace;
                    if (workspace == null)
                    {
                        return;
                    }

                    // Get Workspace Factory
                    IWorkspaceFactory workspaceFactory = workspace.WorkspaceFactory;
                    if (workspaceFactory == null)
                    {
                        return;
                    }

                    // Get Workspace Factory ID
                    IUID   uid  = workspaceFactory.GetClassID();
                    string guid = uid.Value.ToString().ToUpper();

                    switch (guid)
                    {
                    case EsriRegistry.GEODATABASE_PERSONAL:
                        WorkspaceValidator.Default.Validator = new PersonalGeodatabaseValidator(workspace);
                        break;

                    case EsriRegistry.GEODATABASE_FILE:
                        WorkspaceValidator.Default.Validator = new FileGeodatabaseValidator(workspace);
                        break;

                    case EsriRegistry.GEODATABASE_SDE:
                        WorkspaceValidator.Default.Validator = new SdeValidator(workspace);
                        break;

                    default:
                        break;
                    }
                }
                else if ((sender is MenuButtonItem) && (((MenuButtonItem)sender).Parent == this.menuButtonItemSdeConnection))
                {
                    MenuButtonItem item = (MenuButtonItem)sender;
                    if (item.Tag == null)
                    {
                        return;
                    }
                    WorkspaceValidator.Default.Validator = new SdeValidator(item.Tag.ToString());
                }
            }
            catch (Exception ex) {
                ExceptionDialog.HandleException(ex);
            }
        }
        public override void Errors(List<Error> list, EsriTable table) {
            // Export SpatialReference Errors
            if (this._spatialReference != null) {
                this._spatialReference.Errors(list, table);
            }

            // AvgNumPoints
            if (this._avgNumPoints < 0) {
                // Must be positive
                list.Add(new ErrorObject(this, table, "AvgNumPoints must be positive", ErrorType.Error));
            }

            // Check GridSize Configuration
            if (this._gridSize0 == -1 && this._gridSize1 == -1 && this._gridSize2 == -1) {
                // OK
            }
            else if (this._gridSize0 != -1 && this._gridSize1 == -1 && this._gridSize2 == -1) {
                // OK
            }
            else if (this._gridSize0 != -1 && this._gridSize1 != -1 && this._gridSize2 == -1) {
                // OK
                if (this._gridSize0 > this._gridSize1) {
                    list.Add(new ErrorObject(this, table, "GridSize0 cannot be larger than GridSize1", ErrorType.Error));
                }
            }
            else if (this._gridSize0 != -1 && this._gridSize1 != -1 && this._gridSize2 != -1) {
                // OK
                if (this._gridSize0 > this._gridSize1) {
                    list.Add(new ErrorObject(this, table, "GridSize0 cannot be larger than GridSize1", ErrorType.Error));
                }
                if (this._gridSize1 > this._gridSize2) {
                    list.Add(new ErrorObject(this, table, "GridSize1 cannot be larger than GridSize2", ErrorType.Error));
                }
            }
            else {
                // Invalid Combination
                string message = string.Format(
                    "Grid configuration '{0}'/'{1}'/'{2}' is invalid",
                    this._gridSize0.ToString(),
                    this._gridSize1.ToString(),
                    this._gridSize2.ToString());
                list.Add(new ErrorObject(this, table, message, ErrorType.Error));
            }

            // GridSize0
            if (this._gridSize0 != -1){
                if (this._gridSize0 < 0) {
                    // Must be greater than zero
                    list.Add(new ErrorObject(this, table, "GridSize0 must be greater than (or equal to) zero", ErrorType.Error));
                }
            }

            // GridSize1
            if (this._gridSize1 != -1) {
                if (this._gridSize1 < 0) {
                    // Must be positive
                    list.Add(new ErrorObject(this, table, "GridSize1 must be zero or a positive", ErrorType.Error));
                }
            }

            // GridSize2
            if (this._gridSize2 != -1) {
                if (this._gridSize2 < 0) {
                    // Must be positive
                    list.Add(new ErrorObject(this, table, "GridSize2 must be zero or a positive", ErrorType.Error));
                }
            }
        }
Exemple #60
0
        public override void Errors(List<Error> list, EsriTable table) {
            // Add Spatial Reference Errors
            if (this._spatialReference == null) {
                list.Add(new ErrorObject(this, table, "SpatialReference cannot be null", ErrorType.Error));
            }
            else {
                this._spatialReference.Errors(list, table);
            }

            // XMin > XMax
            if (this._xMin > this._xMax) {
                list.Add(new ErrorObject(this, table, "XMin is larger thatn XMax", ErrorType.Error));
            }

            // YMin < YMax
            if (this._yMin > this._yMax) {
                list.Add(new ErrorObject(this, table, "YMin is larger thatn YMax", ErrorType.Error));
            }
        }