private void MenuItem_Activate(object sender, EventArgs e) { try { // Exit if no Context Element if (this._elementContext == null) { return; } // Get Diagrammer Environment DiagrammerEnvironment diagrammerEnvironment = DiagrammerEnvironment.Default; if (sender == this.menuItemDomainCodedValue_AddCodedValue) { DomainCodedValue domainCodedValue = (DomainCodedValue)this._elementContext; domainCodedValue.AddCodedValue(new DomainCodedValueRow()); } else if (sender == this.menuItemDomainCodedValue_OpenDiagram) { DomainCodedValue domainCodedValue = (DomainCodedValue)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(domainCodedValue, typeof(DomainModel))); } else if (sender == this.menuItemDomainCodedValue_Validate) { DomainCodedValue domainCodedValue = (DomainCodedValue)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(domainCodedValue)); } else if (sender == this.menuItemDomainCodedValueItem_Delete) { DomainCodedValue domainCodedValue = (DomainCodedValue)this._elementContext; DomainCodedValueRow domainCodedValueRow = domainCodedValue.SelectedCodedValue; if (domainCodedValueRow == null) { return; } domainCodedValue.RemoveCodedValue(domainCodedValueRow); } else if (sender == this.menuItemDomainRange_OpenDiagram) { DomainRange domainRange = (DomainRange)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(domainRange, typeof(DomainModel))); } else if (sender == this.menuItemDomainRange_Validate) { DomainRange domainRange = (DomainRange)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(domainRange)); } else if (sender == this.menuItemFeatureClass_AddField) { FeatureClass featureClass = (FeatureClass)this._elementContext; featureClass.AddField(new Field()); } else if (sender == this.menuItemFeatureClass_AddIndex) { FeatureClass featureClass = (FeatureClass)this._elementContext; featureClass.AddIndex(new Index()); } else if (sender == this.menuItemFeatureClass_Validate) { FeatureClass featureClass = (FeatureClass)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(featureClass)); } else if (sender == this.menuItemFeatureClass_ViewMetadata) { FeatureClass featureClass = (FeatureClass)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(featureClass)); } else if (sender == this.menuItemFeatureDataset_Validate) { FeatureDataset featureDataset = (FeatureDataset)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(featureDataset)); } else if (sender == this.menuItemFeatureDataset_ViewMetadata) { FeatureDataset featureDataset = (FeatureDataset)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(featureDataset)); } else if (sender == this.menuItemField_AddToIndexes) { if (this._elementContext is ObjectClass) { // Get Selected Field ObjectClass objectClass = (ObjectClass)this._elementContext; Field field = objectClass.SelectedField; // Create New IndexField IndexField indexField = new IndexField(); indexField.Name = field.Name; // Create New Index Index index = new Index(); index.AddIndexField(indexField); // Add Index objectClass.AddIndex(index); } else if (this._elementContext is RasterBand) { // Get Selected Field RasterBand rasterBand = (RasterBand)this._elementContext; Field field = rasterBand.SelectedField; // Create New IndexField IndexField indexField = new IndexField(); indexField.Name = field.Name; // Create New Index Index index = new Index(); index.AddIndexField(indexField); // Add Index rasterBand.AddIndex(index); } } else if (sender == this.menuItemField_Delete) { if (this._elementContext is ObjectClass) { // Get Selected Field ObjectClass objectClass = (ObjectClass)this._elementContext; Field field = objectClass.SelectedField; // Remove Field objectClass.RemoveField(field); } else if (this._elementContext is RasterBand) { // Get Selected Field RasterBand rasterBand = (RasterBand)this._elementContext; Field field = rasterBand.SelectedField; // Remove Field rasterBand.RemoveField(field); } } else if (sender == this.menuItemGeometricNetwork_OpenDiagram) { GeometricNetwork geometricNetwork = (GeometricNetwork)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(geometricNetwork, typeof(GeometricNetworkModel))); } else if (sender == this.menuItemGeometricNetwork_OpenEdgeEdgeDiagram) { GeometricNetwork geometricNetwork = (GeometricNetwork)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(geometricNetwork, typeof(GeometricNetworkModelEE))); } else if (sender == this.menuItemGeometricNetwork_OpenEdgeJunctionDiagram) { GeometricNetwork geometricNetwork = (GeometricNetwork)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(geometricNetwork, typeof(GeometricNetworkModelEJ))); } else if (sender == this.menuItemGeometricNetwork_ViewMetadata) { GeometricNetwork geometricNetwork = (GeometricNetwork)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(geometricNetwork)); } else if (sender == this.menuItemIndex_AddField) { if (this._elementContext is ObjectClass) { // Get Selected Index ObjectClass objectClass = (ObjectClass)this._elementContext; Index index = objectClass.SelectedIndex; // Add Index Field index.AddIndexField(new IndexField()); } else if (this._elementContext is RasterBand) { // Get Selected Index RasterBand rasterBand = (RasterBand)this._elementContext; Index index = rasterBand.SelectedIndex; // Add Index Field index.AddIndexField(new IndexField()); } } else if (sender == this.menuItemIndex_Delete) { if (this._elementContext is ObjectClass) { // Get Selected Index ObjectClass objectClass = (ObjectClass)this._elementContext; Index index = objectClass.SelectedIndex; // Remove Index objectClass.RemoveIndex(index); } else if (this._elementContext is RasterBand) { // Get Selected Index RasterBand rasterBand = (RasterBand)this._elementContext; Index index = rasterBand.SelectedIndex; // Remove Index rasterBand.RemoveIndex(index); } } else if (sender == this.menuItemIndexField_Delete) { if (this._elementContext is ObjectClass) { // Get Selected Index Field ObjectClass objectClass = (ObjectClass)this._elementContext; IndexField indexField = objectClass.SelectedIndexField; // Get Parent Index Index index = indexField.Parent as Index; if (index == null) { return; } // Remove Index Field index.RemoveIndexField(indexField); } else if (this._elementContext is RasterBand) { // Get Selected Index Field ObjectClass rasterBand = (ObjectClass)this._elementContext; IndexField indexField = rasterBand.SelectedIndexField; // Get Parent Index Index index = indexField.Parent as Index; if (index == null) { return; } // Remove Index Field index.RemoveIndexField(indexField); } } else if (sender == this.menuItemObjectClass_AddField) { ObjectClass objectClass = (ObjectClass)this._elementContext; objectClass.AddField(new Field()); } else if (sender == this.menuItemObjectClass_AddIndex) { ObjectClass objectClass = (ObjectClass)this._elementContext; objectClass.AddIndex(new Index()); } else if (sender == this.menuItemObjectClass_Validate) { ObjectClass objectClass = (ObjectClass)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(objectClass)); } else if (sender == this.menuItemObjectClass_ViewMetadata) { ObjectClass objectClass = (ObjectClass)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(objectClass)); } else if (sender == this.menuItemRasterBand_AddField) { RasterBand rasterBand = (RasterBand)this._elementContext; rasterBand.AddField(new Field()); } else if (sender == this.menuItemRasterBand_AddIndex) { RasterBand rasterBand = (RasterBand)this._elementContext; rasterBand.AddIndex(new Index()); } else if (sender == this.menuItemRasterBand_Validate) { RasterBand rasterBand = (RasterBand)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(rasterBand)); } else if (sender == this.menuItemRasterBand_ViewMetadata) { RasterBand rasterBand = (RasterBand)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(rasterBand)); } else if (sender == this.menuItemRasterCatalog_AddField) { RasterCatalog rasterCatalog = (RasterCatalog)this._elementContext; rasterCatalog.AddField(new Field()); } else if (sender == this.menuItemRasterCatalog_AddIndex) { RasterCatalog rasterCatalog = (RasterCatalog)this._elementContext; rasterCatalog.AddIndex(new Index()); } else if (sender == this.menuItemRasterCatalog_Validate) { RasterCatalog rasterCatalog = (RasterCatalog)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(rasterCatalog)); } else if (sender == this.menuItemRasterCatalog_ViewMetadata) { RasterCatalog rasterCatalog = (RasterCatalog)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(rasterCatalog)); } else if (sender == this.menuItemRasterDataset_Validate) { RasterDataset rasterDataset = (RasterDataset)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(rasterDataset)); } else if (sender == this.menuItemRasterDataset_ViewMetadata) { RasterDataset rasterDataset = (RasterDataset)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(rasterDataset)); } else if (sender == this.menuItemRelationship_AddField) { RelationshipClass relationshipClass = (RelationshipClass)this._elementContext; relationshipClass.AddField(new Field()); } else if (sender == this.menuItemRelationship_AddIndex) { RelationshipClass relationshipClass = (RelationshipClass)this._elementContext; relationshipClass.AddIndex(new Index()); } else if (sender == this.menuItemRelationship_OpenDiagram) { RelationshipClass relationshipClass = (RelationshipClass)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(relationshipClass, typeof(RelationshipModel))); } else if (sender == this.menuItemRelationship_Validate) { RelationshipClass relationshipClass = (RelationshipClass)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(relationshipClass)); } else if (sender == this.menuItemRelationship_ViewMetadata) { RelationshipClass relationshipClass = (RelationshipClass)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(relationshipClass)); } else if (sender == this.menuItemSubtype_AddField) { Subtype subtype = (Subtype)this._elementContext; subtype.AddSubtypeField(new SubtypeField()); } else if (sender == this.menuItemSubtype_SetAsDefault) { Subtype subtype = (Subtype)this._elementContext; subtype.Default = !subtype.Default; if (subtype.Default) { ObjectClass objectClass = subtype.GetParent(); if (objectClass == null) { return; } foreach (Subtype subtype2 in objectClass.GetSubtypes()) { if (subtype2 == subtype) { continue; } if (subtype2.Default) { subtype2.Default = false; } } } } else if (sender == this.menuItemSubtype_Validate) { Subtype subtype = (Subtype)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(subtype)); } else if (sender == this.menuItemSubtypeField_Delete) { Subtype subtype = (Subtype)this._elementContext; SubtypeField subtypeField = subtype.SelectedSubtypeField; subtype.RemoveSubtypeField(subtypeField); } else if (sender == this.menuItemTopology_OpenDiagram) { Topology topology = (Topology)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(topology, typeof(TopologyModel))); } else if (sender == this.menuItemTopology_OpenRuleDiagram) { Topology topology = (Topology)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(topology, typeof(TopologyRuleModel))); } else if (sender == this.menuItemTopology_Validate) { Topology topology = (Topology)this._elementContext; diagrammerEnvironment.OnTableValidationRequest(new TableEventArgs(topology)); } else if (sender == this.menuItemTopology_ViewMetadata) { Topology topology = (Topology)this._elementContext; diagrammerEnvironment.OnMetadataViewerRequest(new DatasetEventArgs(topology)); } else if (sender == this.menuItemTerrain_OpenDiagram) { Terrain terrain = (Terrain)this._elementContext; this.OnDiagramRequest(new DiagramEventArgs(terrain, typeof(TerrainModel))); } } catch (Exception ex) { ExceptionDialog.HandleException(ex); } }
public Index(Index prototype) : base(prototype) { this._name = prototype.Name; this._isUnique = prototype.IsUnique; this._isAscending = prototype.IsAscending; this.UpdateText(); }
public void RemoveIndex(Index index) { // Get Index Grouo TableGroup groupIndex = (TableGroup)this.Groups[1]; // Get Index int i = groupIndex.Groups.IndexOf(index); if (i == -1) { return; } // Remove Index groupIndex.Groups.RemoveAt(i); // Select Next Index if (groupIndex.Groups.Count == 0) { this.SelectedItem = groupIndex; } else { if (i != groupIndex.Groups.Count) { this.SelectedItem = groupIndex.Groups[i]; } else { this.SelectedItem = groupIndex.Groups[groupIndex.Groups.Count - 1]; } } }
public void AddIndex(Index index) { TableGroup groupIndex = (TableGroup)this.Groups[1]; groupIndex.Groups.Add(index); this.SelectedItem = index; }
// // CONSTRUCTOR // public ObjectClass(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <OIDFieldName></OIDFieldName> XPathNavigator navigatorOIDFieldName = navigator.SelectSingleNode("OIDFieldName"); if (navigatorOIDFieldName != null) { this._oidFieldName = navigatorOIDFieldName.Value; } // <CLSID></CLSID> XPathNavigator navigatorCLSID = navigator.SelectSingleNode("CLSID"); if (navigatorCLSID != null) { if (!string.IsNullOrEmpty(navigatorCLSID.Value)) { this._clsid = navigatorCLSID.Value; } } // <EXTCLSID></EXTCLSID> XPathNavigator navigatorEXTCLSID = navigator.SelectSingleNode("EXTCLSID"); if (navigatorEXTCLSID != null) { if (!string.IsNullOrEmpty(navigatorEXTCLSID.Value)) { this._extClsid = navigatorEXTCLSID.Value; } } // <AliasName></AliasName> XPathNavigator navigatorAliasName = navigator.SelectSingleNode("AliasName"); if (navigatorAliasName != null) { this._aliasName = navigatorAliasName.Value; } // <ModelName></ModelName> XPathNavigator navigatorModelName = navigator.SelectSingleNode("ModelName"); if (navigatorModelName != null) { this._modelName = navigatorModelName.Value; } // <GlobalIDFieldName></GlobalIDFieldName> XPathNavigator navigatorGlobalIDFieldName = navigator.SelectSingleNode("GlobalIDFieldName"); if (navigatorGlobalIDFieldName != null) { this._globalIDFieldName = navigatorGlobalIDFieldName.Value; } // <RasterFieldName></RasterFieldName> XPathNavigator navigatorRasterFieldName = navigator.SelectSingleNode("RasterFieldName"); if (navigatorRasterFieldName != null) { this._rasterFieldName = navigatorRasterFieldName.Value; } // <PropertySetProperty></PropertySetProperty> this._extensionProperties = new List<Property>(); XPathNodeIterator interatorPropertySetProperty = navigator.Select("ExtensionProperties/PropertyArray/PropertySetProperty"); while (interatorPropertySetProperty.MoveNext()) { // Get Property Note XPathNavigator navigatorPropertySetProperty = interatorPropertySetProperty.Current; // Create Property Object Property property = new Property(navigatorPropertySetProperty); // Store Property Object in List this._extensionProperties.Add(property); } // <SubtypeFieldName></SubtypeFieldName> XPathNavigator navigatorSubtypeFieldName = navigator.SelectSingleNode("SubtypeFieldName"); if (navigatorSubtypeFieldName != null) { this._subtypeFieldName = navigatorSubtypeFieldName.Value; } // Create ESRI Namespace Manager XmlNamespaceManager namespaceManager = new XmlNamespaceManager(navigator.NameTable); namespaceManager.AddNamespace(Xml._XSI, Xml.XMLSCHEMAINSTANCE); // <ControllerMemberships><ControllerMembership></ControllerMembership></ControllerMemberships> this._controllerMemberships = new List<ControllerMembership>(); XPathNodeIterator interatorControllerMembership = navigator.Select("ControllerMemberships/ControllerMembership"); while (interatorControllerMembership.MoveNext()) { // Get ControllerMembership XPathNavigator navigatorControllerMembership = interatorControllerMembership.Current; // Get Type XPathNavigator type = navigatorControllerMembership.SelectSingleNode(Xml._XSITYPE, namespaceManager); switch (type.Value) { case Xml._GEOMETRICNETWORKMEMBERSHIP: GeometricNetworkControllerMembership geometricNetworkControllerMembership = new GeometricNetworkControllerMembership(navigatorControllerMembership); this._controllerMemberships.Add(geometricNetworkControllerMembership); break; case Xml._TOPOLOGYMEMBERSHIP: TopologyControllerMembership topologyControllerMembership = new TopologyControllerMembership(navigatorControllerMembership); this._controllerMemberships.Add(topologyControllerMembership); break; case Xml._TERRAINMEMBERSHIP: break; case Xml._NETWORKDATASETMEMBERSHIP: NetworkControllerMembership networkControllerMembership = new NetworkControllerMembership(navigatorControllerMembership); this._controllerMemberships.Add(networkControllerMembership); break; } } // Create Fields Group TableGroup tableGroupFields = new TableGroup(); tableGroupFields.Expanded = true; tableGroupFields.Text = "Fields"; this.Groups.Add(tableGroupFields); XPathNodeIterator interatorField = navigator.Select("Fields/FieldArray/Field"); while (interatorField.MoveNext()) { // Create Field XPathNavigator navigatorField = interatorField.Current; Field field = new Field(navigatorField, this); // Add Field To Group tableGroupFields.Rows.Add(field); } // Create Indexes Group TableGroup tableGroupIndexes = new TableGroup(); tableGroupIndexes.Expanded = true; tableGroupIndexes.Text = "Indexes"; this.Groups.Add(tableGroupIndexes); XPathNodeIterator interatorIndex = navigator.Select("Indexes/IndexArray/Index"); while (interatorIndex.MoveNext()) { // Add Index XPathNavigator navigatorIndex = interatorIndex.Current; Index index = new Index(navigatorIndex); tableGroupIndexes.Groups.Add(index); // Add Field Index XPathNodeIterator interatorIndexField = navigatorIndex.Select("Fields/FieldArray/Field"); while (interatorIndexField.MoveNext()) { XPathNavigator navigatorIndexField = interatorIndexField.Current; IndexField indexField = new IndexField(navigatorIndexField); index.Rows.Add(indexField); } } }
// // CONSTRUCTOR // public RasterBand(IXPathNavigable path) : base(path) { // Get Navigator XPathNavigator navigator = path.CreateNavigator(); // <OIDFieldName> XPathNavigator navigatorOIDFieldName = navigator.SelectSingleNode("OIDFieldName"); if (navigatorOIDFieldName != null) { this._oidFieldName = navigatorOIDFieldName.Value; } // Create Fields Group TableGroup tableGroupFields = new TableGroup(); tableGroupFields.Expanded = true; tableGroupFields.Text = "Fields"; this.Groups.Add(tableGroupFields); XPathNodeIterator interatorField = navigator.Select("Fields/FieldArray/Field"); while (interatorField.MoveNext()) { // Create Field XPathNavigator navigatorField = interatorField.Current; Field field = new Field(navigatorField, this); // Add Field To Group tableGroupFields.Rows.Add(field); } // Create Indexes Group TableGroup tableGroupIndexes = new TableGroup(); tableGroupIndexes.Expanded = true; tableGroupIndexes.Text = "Indexes"; this.Groups.Add(tableGroupIndexes); XPathNodeIterator interatorIndex = navigator.Select("Indexes/IndexArray/Index"); while (interatorIndex.MoveNext()) { // Add Index XPathNavigator navigatorIndex = interatorIndex.Current; Index index = new Index(navigatorIndex); tableGroupIndexes.Groups.Add(index); // Add Field Index XPathNodeIterator interatorIndexField = navigatorIndex.Select("Fields/FieldArray/Field"); while (interatorIndexField.MoveNext()) { XPathNavigator navigatorIndexField = interatorIndexField.Current; IndexField indexField = new IndexField(navigatorIndexField); index.Rows.Add(indexField); } } // <IsInteger> XPathNavigator navigatorIsInteger = navigator.SelectSingleNode("IsInteger"); if (navigatorIsInteger != null) { this._isInteger = navigatorIsInteger.ValueAsBoolean; } // <MeanCellHeight> XPathNavigator navigatorMeanCellHeight = navigator.SelectSingleNode("MeanCellHeight"); if (navigatorMeanCellHeight != null) { this._meanCellHeight = navigatorMeanCellHeight.ValueAsDouble; } // <MeanCellWidth> XPathNavigator navigatorMeanCellWidth = navigator.SelectSingleNode("MeanCellWidth"); if (navigatorMeanCellWidth != null) { this._meanCellWidth = navigatorMeanCellWidth.ValueAsDouble; } // <Height> XPathNavigator navigatorHeight = navigator.SelectSingleNode("Height"); if (navigatorHeight != null) { this._height = navigatorHeight.ValueAsInt; } // <Width> XPathNavigator navigatorWidth = navigator.SelectSingleNode("Width"); if (navigatorWidth != null) { this._width = navigatorWidth.ValueAsInt; } // <PixelType> XPathNavigator navigatorPixelType = navigator.SelectSingleNode("PixelType"); if (navigatorPixelType != null) { this._pixelType = GeodatabaseUtility.GetPixelType(navigatorPixelType.Value); } // <PrimaryField> XPathNavigator navigatorPrimaryField = navigator.SelectSingleNode("PrimaryField"); if (navigatorPrimaryField != null) { this._primaryField = navigatorPrimaryField.ValueAsInt; } // <TableType> XPathNavigator navigatorTableType = navigator.SelectSingleNode("TableType"); if (navigatorTableType != null) { this._tableType = (esriRasterTableTypeEnum)Enum.Parse(typeof(esriRasterTableTypeEnum), navigatorTableType.Value, true); } // <Extent> XPathNavigator navigatorExtent = navigator.SelectSingleNode("Extent"); if (navigatorExtent != null) { this._extent = new Extent(navigatorExtent); } else { this._extent = new Extent(); } // <SpatialReference> XPathNavigator navigatorSpatialReference = navigator.SelectSingleNode("SpatialReference"); if (navigatorSpatialReference != null) { this._spatialReference = new SpatialReference(navigatorSpatialReference); } else { this._spatialReference = new SpatialReference(); } }