public void Initialize(ref ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature relatedElements) { m_currentIndex = 0; m_listElements = new System.Collections.Generic.List <ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature>(); relatedElements.Reset(); ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature schemElement = relatedElements.Next(); // add all Schematic feature to the list while ((schemElement != null) && (m_listElements.Count < m_maxElements)) { m_listElements.Add(schemElement); schemElement = relatedElements.Next(); } }
public bool SelectReduction(ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureNode node, ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature enumLink, ref ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureLink link) { // if enumLink is empty do nothing if (enumLink == null) { return(false); } if (enumLink.Count == 0) { return(false); } enumLink.Reset(); ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature schemAssociatedLink; schemAssociatedLink = enumLink.Next(); // for each link in enumLink while (schemAssociatedLink != null) { // get cables ESRI.ArcGIS.Geodatabase.IFeature cablesFeature; cablesFeature = schemAssociatedLink.SchematicElement as ESRI.ArcGIS.Geodatabase.IFeature; if (cablesFeature == null) { return(false); } // get cables class ESRI.ArcGIS.Geodatabase.IDataset cablesDataset; cablesDataset = (ESRI.ArcGIS.Geodatabase.IDataset)cablesFeature.Class; // if not the right class do nothing if (cablesDataset.Name.IndexOf("cables") == 0) { return(false); } // get workspace ESRI.ArcGIS.Geodatabase.IFeatureWorkspace cablesWorkspace; cablesWorkspace = (ESRI.ArcGIS.Geodatabase.IFeatureWorkspace)cablesDataset.Workspace; // open table cables_attributes ESRI.ArcGIS.Geodatabase.ITable cablesTable; cablesTable = cablesWorkspace.OpenTable("cables_attributes"); if (cablesTable == null) { return(false); } // get diameter value object cableDiameter = cablesTable.GetRow(cablesFeature.OID).get_Value(1); if (cableDiameter.ToString() != "8") { return(false); //if not 8 do nothing } schemAssociatedLink = enumLink.Next(); } return(true); // if this far }
public ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature SelectElementsToCollapse(ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureNode node, ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeature relatedFeatures) { // get feature ESRI.ArcGIS.Geodatabase.IFeature esriFeature; esriFeature = node as ESRI.ArcGIS.Geodatabase.IFeature; if (esriFeature == null) { return(null); } // get feature class ESRI.ArcGIS.Geodatabase.IFeatureClass esriFeatureClass; esriFeatureClass = esriFeature.Class as ESRI.ArcGIS.Geodatabase.IFeatureClass; // if not the right feature class do nothing if (esriFeatureClass.AliasName != "plants") { return(null); } bool okToCollapse = true; relatedFeatures.Reset(); // Test if you want to collapse related element //ESRI.ArcGIS.Schematic.ISchematicElement schemElement = relatedElements.Next(); //while ((schemElement != null) && okToCollapse) //{ // okToCollapse = CanCollapseElement(schemElement); // schemElement = relatedElements.Next(); //} if (!okToCollapse) { return(null); // if nothing to collapse return nothing } else if (relatedFeatures.Count == 0) { EnumCollapsedElts enumCollapse = new EnumCollapsedElts(); // create a list of feature to collapse // get incident links ESRI.ArcGIS.Schematic.IEnumSchematicInMemoryFeatureLink enumLinks; enumLinks = node.GetIncidentLinks(ESRI.ArcGIS.Schematic.esriSchematicEndPointType.esriSchematicOriginOrExtremityNode); if (enumLinks == null) { return(enumCollapse); } if (enumLinks.Count > 1) { enumLinks.Reset(); ESRI.ArcGIS.Schematic.ISchematicInMemoryFeatureLink schemLink; // for each link schemLink = enumLinks.Next(); if (schemLink != null) { enumCollapse.Add((ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature)node); // Add node to collapse while (schemLink != null) { enumCollapse.Add((ESRI.ArcGIS.Schematic.ISchematicInMemoryFeature)schemLink); // Add link to collapse schemLink = enumLinks.Next(); } } } return(enumCollapse); } else { return(relatedFeatures); } }