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
        }