//public static FiberDeviceConnectionHelper Instance(HookHelperExt hookHelper, ESRI.ArcGIS.Editor.IEditor editor)
        //{
        //    if(_instance != null)
        //    {
        //        return _instance;
        //    }
        //    else
        //    {
        //        _instance = new FiberDeviceConnectionHelper(hookHelper, editor);
        //        return _instance;
        //    }
        //}


        /// <summary>
        /// Returns cables which have an endpoint coincident with the device point
        /// </summary>
        /// <param name="deviceWrapper">Device to check</param>
        /// <returns>List of ConnectableCableWrapper</returns>
        public List <ConnectableCableWrapper> GetCoincidentCables(DeviceWrapper deviceWrapper)
        {
            List <ConnectableCableWrapper> result = new List <ConnectableCableWrapper>();

            if (null == deviceWrapper)
            {
                throw new ArgumentNullException("deviceWrapper");
            }

            ESRI.ArcGIS.Geometry.IPoint devicePoint = deviceWrapper.Feature.Shape as ESRI.ArcGIS.Geometry.IPoint;

            ESRI.ArcGIS.Carto.IFeatureLayer       cableLayer   = _hookHelper.FindFeatureLayer(ConfigUtil.FiberCableFtClassName);
            ESRI.ArcGIS.Geodatabase.IFeatureClass cableFtClass = cableLayer.FeatureClass;
            int displayIdx = cableFtClass.FindField(cableLayer.DisplayField);

            double buffer = _hookHelper.ConvertPixelsToMapUnits(1);
            List <ESRI.ArcGIS.Geodatabase.IFeature> coincidentCables = GdbUtils.GetLinearsWithCoincidentEndpoints(devicePoint, cableFtClass, buffer);

            for (int i = 0; i < coincidentCables.Count; i++)
            {
                ESRI.ArcGIS.Geodatabase.IFeature         ft          = coincidentCables[i];
                ESRI.ArcGIS.Geometry.IPolyline           line        = ft.Shape as ESRI.ArcGIS.Geometry.IPolyline;
                ESRI.ArcGIS.Geometry.IRelationalOperator lineToPoint = line.ToPoint as ESRI.ArcGIS.Geometry.IRelationalOperator;

                bool isFromEnd = true;
                if (lineToPoint.Equals(devicePoint))
                {
                    isFromEnd = false;
                }

                result.Add(new ConnectableCableWrapper(ft, isFromEnd, displayIdx));
            }

            return(result);
        }
        /// <summary>
        /// Update the dropdowns of features on the UI
        /// </summary>
        /// <param name="helper">Helper class</param>
        private void PopulateDropDowns(FiberDeviceConnectionHelper helper)
        {
            // Clear the existing choices
            cboFrom.Items.Clear();
            cboTo.Items.Clear();
            lblAvailableFrom.Text = "";
            lblAvailableTo.Text   = "";

            // Get the features and the display index for use when creating the wrapper
            ESRI.ArcGIS.Carto.IFeatureLayer ftLayer = _hookHelper.FindFeatureLayer(ConfigUtil.FiberCableFtClassName);
            int displayIdx = ftLayer.FeatureClass.FindField(ftLayer.DisplayField);

            // Get the selected features
            List <ESRI.ArcGIS.Geodatabase.IFeature> selectedFts = _hookHelper.GetSelectedFeatures(ftLayer);

            // Add each of the fiber features to the drop down
            for (int ftIdx = 0; ftIdx < selectedFts.Count; ftIdx++)
            {
                FiberCableWrapper w = new FiberCableWrapper(selectedFts[ftIdx], displayIdx);
                cboFrom.Items.Add(w);
            }

            // Now do that same thing for each of the device feature classes
            string[] deviceClassNames = ConfigUtil.DeviceFeatureClassNames;
            for (int deviceClassIdx = 0; deviceClassIdx < deviceClassNames.Length; deviceClassIdx++)
            {
                string ftClassName = deviceClassNames[deviceClassIdx];

                // Get the features and the display index for use when creating the wrapper
                ftLayer = _hookHelper.FindFeatureLayer(ftClassName);
                if (ftLayer != null) // what if layer removed from map
                {
                    selectedFts = _hookHelper.GetSelectedFeatures(ftLayer);

                    displayIdx = ftLayer.FeatureClass.FindField(ftLayer.DisplayField);

                    for (int ftIdx = 0; ftIdx < selectedFts.Count; ftIdx++)
                    {
                        DeviceWrapper w = new DeviceWrapper(selectedFts[ftIdx], displayIdx);
                        cboFrom.Items.Add(w);
                    }
                }
            }

            // Preselect the first choice
            if (0 < cboFrom.Items.Count)
            {
                cboFrom.SelectedItem = cboFrom.Items[0];
            }
        }
Exemple #3
0
 public static ESRI.ArcGIS.Carto.IFeatureRenderer GetRendererFromLayer(
     ESRI.ArcGIS.Carto.IFeatureLayer pLayer, esriSymbologyStyleClass _SymbologyStyleClass)
 {
     if (pLayer == null)
     {
         return(CreateUVRenderer(_SymbologyStyleClass));
     }
     ESRI.ArcGIS.Carto.IGeoFeatureLayer pGeoLayer = pLayer as ESRI.ArcGIS.Carto.IGeoFeatureLayer;
     if (pGeoLayer == null || pGeoLayer.Renderer == null)
     {
         return(CreateUVRenderer(_SymbologyStyleClass));
     }
     return(pGeoLayer.Renderer);
 }
        /// <summary>
        /// Returns devices at the endpoints of the given cable
        /// </summary>
        /// <param name="deviceWrapper">Cable to check</param>
        /// <returns>List of ConnectableDeviceWrapper</returns>
        public List <ConnectableDeviceWrapper> GetCoincidentDevices(FiberCableWrapper fiberCableWrapper)
        {
            List <ConnectableDeviceWrapper> result = new List <ConnectableDeviceWrapper>();

            if (null == fiberCableWrapper)
            {
                throw new ArgumentNullException("fiberCableWrapper");
            }

            ESRI.ArcGIS.Geometry.IPolyline cableGeometry = (ESRI.ArcGIS.Geometry.IPolyline)fiberCableWrapper.Feature.Shape;
            string[] deviceFtClassNames = ConfigUtil.DeviceFeatureClassNames;

            double buffer = _hookHelper.ConvertPixelsToMapUnits(1);

            for (int i = 0; i < deviceFtClassNames.Length; i++)
            {
                string ftClassName = deviceFtClassNames[i];

                ESRI.ArcGIS.Carto.IFeatureLayer ftLayer = _hookHelper.FindFeatureLayer(ftClassName);
                if (ftLayer == null)
                {
                    // Layer might not be in the map so just skip if not found.
                    continue;
                }
                ESRI.ArcGIS.Geodatabase.IFeatureClass ftClass = ftLayer.FeatureClass;
                int displayIdx = ftClass.FindField(ftLayer.DisplayField);

                List <ESRI.ArcGIS.Geodatabase.IFeature> fromFts = GdbUtils.GetFeaturesWithCoincidentVertices(cableGeometry.FromPoint, ftClass, false, buffer);
                for (int fromIdx = 0; fromIdx < fromFts.Count; fromIdx++)
                {
                    result.Add(new ConnectableDeviceWrapper(fromFts[fromIdx], true, displayIdx));
                }

                List <ESRI.ArcGIS.Geodatabase.IFeature> toFts = GdbUtils.GetFeaturesWithCoincidentVertices(cableGeometry.ToPoint, ftClass, false, buffer);
                for (int toIdx = 0; toIdx < toFts.Count; toIdx++)
                {
                    result.Add(new ConnectableDeviceWrapper(toFts[toIdx], false, displayIdx));
                }
            }

            return(result);
        }
Exemple #5
0
        private void FrmZhzzt_Load(object sender, EventArgs e)
        {
            axMapControlZZT.LoadMxFile(Application.StartupPath + @"\综合柱状图.mxd");
            pLayer = DataEditCommon.GetLayerByName(axMapControlZZT.Map, LayerNames.LAYER_ALIAS_MR_Zhuzhuang);
            ESRI.ArcGIS.Carto.IFeatureLayer pFeatureLayer = (ESRI.ArcGIS.Carto.IFeatureLayer)pLayer;
            pFeatureClass = pFeatureLayer.FeatureClass;
            if (pFeatureLayer == null)
            {
                MessageBox.Show("柱状图图层缺失!");
                this.Close();
                return;
            }
            if (pFeatureClass == null)
            {
                MessageBox.Show("柱状图图层缺失!");
                this.Close();
                return;
            }
            if (BID == "" || pGeometry == null)
            {
                return;
            }
            List <IGeometry> listgeo = new List <IGeometry>();
            IQueryFilter     pFilter = new QueryFilterClass();

            pFilter.WhereClause = "BID='" + BID + "'";
            IFeatureCursor pCursor  = pFeatureClass.Search(pFilter, false);
            IFeature       pFeature = pCursor.NextFeature();

            while (pFeature != null)
            {
                listgeo.Add(pFeature.Shape);
                pFeature = pCursor.NextFeature();
            }
            pGeometry = setgeo(MyMapHelp.GetGeoFromGeos(listgeo));
            axMapControlZZT.Extent   = pGeometry.Envelope;
            axMapControlZZT.MapScale = blc;
            axMapControlZZT.ActiveView.Refresh();
        }
        internal void SetMap(string filePath)
        {
            // open the map document
            ESRI.ArcGIS.Carto.IMapDocument mapDocument = new ESRI.ArcGIS.Carto.MapDocumentClass();
            mapDocument.Open(filePath, null);
            // get first map (data frame)
            ESRI.ArcGIS.Carto.IMap map = mapDocument.get_Map(0);
            // track whether we need to save properties
            string[] tTmp = new string[m_ExtractionLayerProperties.Keys.Count];
            m_ExtractionLayerProperties.Keys.CopyTo(tTmp, 0);
            // we will remove items from this previously configured list and anything left we know is no longer in map, so remove
            // from saved properties
            List <string> tPreviouslyConfiguredLayers = tTmp.ToList <string>();

            // get raster layers
            ESRI.ArcGIS.esriSystem.UID rasterLayerId = new ESRI.ArcGIS.esriSystem.UIDClass();
            // GUID for a raster layer
            rasterLayerId.Value = "{D02371C7-35F7-11D2-B1F2-00C04F8EDEFF}";
            ESRI.ArcGIS.Carto.IEnumLayer rasterEnumLayer = map.get_Layers(rasterLayerId, true);

            int dirSelectedIndex = 0;
            int accSelectedIndex = 0;

            // set a default value of none
            // if either box is left at none then the SOE will know not to
            // expose the watershed operation
            ComboFlowDir.Items.Add("NONE");
            ComboFlowAcc.Items.Add("NONE");
            ESRI.ArcGIS.Carto.IRasterLayer rasterLayer = null;
            while ((rasterLayer = rasterEnumLayer.Next() as ESRI.ArcGIS.Carto.IRasterLayer) !=
                   null)
            {
                ESRI.ArcGIS.DataSourcesRaster.IRasterProps tRasterProps =
                    rasterLayer.Raster as ESRI.ArcGIS.DataSourcesRaster.IRasterProps;
                ESRI.ArcGIS.Geodatabase.rstPixelType tPixelType = tRasterProps.PixelType;
                // flow dir can only be an integer raster of short or long types
                if (tPixelType == ESRI.ArcGIS.Geodatabase.rstPixelType.PT_UCHAR ||
                    tPixelType == ESRI.ArcGIS.Geodatabase.rstPixelType.PT_SHORT ||
                    tPixelType == ESRI.ArcGIS.Geodatabase.rstPixelType.PT_ULONG ||
                    tPixelType == ESRI.ArcGIS.Geodatabase.rstPixelType.PT_LONG)
                {
                    ComboFlowDir.Items.Add(rasterLayer.Name);
                    ComboFlowAcc.Items.Add(rasterLayer.Name);
                }
                // flow acc can theoretically be floating point as far as i can see
                // albeit it won't normally be
                else if (tPixelType == ESRI.ArcGIS.Geodatabase.rstPixelType.PT_FLOAT ||
                         tPixelType == ESRI.ArcGIS.Geodatabase.rstPixelType.PT_DOUBLE)
                {
                    ComboFlowAcc.Items.Add(rasterLayer.Name);
                }
                if (rasterLayer.Name == m_FlowAccLayerName)
                {
                    accSelectedIndex = ComboFlowAcc.Items.Count - 1;
                }
                else if (rasterLayer.Name == m_FlowDirLayerName)
                {
                    dirSelectedIndex = ComboFlowDir.Items.Count - 1;
                }
                string tRasterType = "ContinuousRaster";
                if (tRasterProps.IsInteger)
                {
                    tRasterType = "CategoricalRaster";
                }

                ExtractionLayerProperties tLayerInMap = new ExtractionLayerProperties(rasterLayer.Name, false, rasterLayer.Name.Substring(0, 6),
                                                                                      tRasterType, "NONE", "NONE", "NONE", null, null, null);
                ExtractionLayerProperties tCurrentConfigForLayer;
                bool alreadyconfigured = m_ExtractionLayerProperties.TryGetValue(rasterLayer.Name, out tCurrentConfigForLayer);
                if (alreadyconfigured)
                {
                    tLayerInMap.Enabled   = tCurrentConfigForLayer.Enabled;
                    tLayerInMap.ParamName = tCurrentConfigForLayer.ParamName;
                    // that's all that needs doing for a raster raster
                }
                m_ExtractionLayerProperties[rasterLayer.Name] = tLayerInMap;
                tPreviouslyConfiguredLayers.Remove(rasterLayer.Name);
            }
            int extSelectedIndex = 0;

            ESRI.ArcGIS.esriSystem.UID featlyrId = new ESRI.ArcGIS.esriSystem.UIDClass();
            featlyrId.Value = "{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}";
            ESRI.ArcGIS.Carto.IEnumLayer    featureEnumLayer = map.get_Layers(featlyrId, true);
            ESRI.ArcGIS.Carto.IFeatureLayer featureLayer     = null;
            while ((featureLayer = featureEnumLayer.Next() as ESRI.ArcGIS.Carto.IFeatureLayer) !=
                   null)
            {
                if (featureLayer.FeatureClass.ShapeType == ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolygon &&
                    featureLayer.FeatureClass.FeatureType == ESRI.ArcGIS.Geodatabase.esriFeatureType.esriFTSimple)
                {
                    ComboExtentFeatures.Items.Add(featureLayer.Name);
                }
                if (featureLayer.Name == m_ExtentFeatureLayerName)
                {
                    extSelectedIndex = ComboExtentFeatures.Items.Count - 1;
                }
                // now stuff for the extraction layer configuration
                List <string> catfields  = new List <string>();
                List <string> valfields  = new List <string>();
                List <string> measfields = new List <string>();
                catfields.Add("NONE");
                valfields.Add("NONE");
                measfields.Add("NONE");
                ESRI.ArcGIS.Geodatabase.IFields tFLFields = featureLayer.FeatureClass.Fields;

                for (int i = 0; i < tFLFields.FieldCount; i++)
                {
                    ESRI.ArcGIS.Geodatabase.IField        tField     = featureLayer.FeatureClass.Fields.get_Field(i);
                    ESRI.ArcGIS.Geodatabase.esriFieldType tFieldType = tField.Type;
                    switch (tFieldType)
                    {
                    case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeDouble:
                    case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeSingle:
                        valfields.Add(tField.Name);
                        measfields.Add(tField.Name);
                        break;

                    case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeInteger:
                    case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeSmallInteger:
                        valfields.Add(tField.Name);
                        catfields.Add(tField.Name);
                        measfields.Add(tField.Name);
                        break;

                    case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeString:
                    case ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeDate:
                        catfields.Add(tField.Name);
                        break;
                    }
                }
                ExtractionLayerProperties tLayerInMap = new ExtractionLayerProperties(featureLayer.Name, false, featureLayer.Name.Substring(0, 6),
                                                                                      "FeatureLayer", "NONE", "NONE", "NONE", catfields, valfields, measfields);
                ExtractionLayerProperties tCurrentConfigForLayer;
                bool alreadyconfigured = m_ExtractionLayerProperties.TryGetValue(featureLayer.Name, out tCurrentConfigForLayer);
                if (alreadyconfigured)
                {
                    // it is already there - loaded from properties - we will make a new object anyway but will copy over the configured
                    // parameter name, enabled, and selected fields.
                    tLayerInMap.Enabled   = tCurrentConfigForLayer.Enabled;
                    tLayerInMap.ParamName = tCurrentConfigForLayer.ParamName;
                    if (tCurrentConfigForLayer.CategoryFieldName != "NONE" &&
                        featureLayer.FeatureClass.FindField(tCurrentConfigForLayer.CategoryFieldName) != -1)
                    {
                        tLayerInMap.CategoryFieldName = tCurrentConfigForLayer.CategoryFieldName;
                    }
                    if (tCurrentConfigForLayer.ValueFieldName != "NONE" &&
                        featureLayer.FeatureClass.FindField(tCurrentConfigForLayer.ValueFieldName) != -1)
                    {
                        tLayerInMap.ValueFieldName = tCurrentConfigForLayer.ValueFieldName;
                    }
                    if (tCurrentConfigForLayer.MeasureFieldName != "NONE" &&
                        featureLayer.FeatureClass.FindField(tCurrentConfigForLayer.ValueFieldName) != -1)
                    {
                        tLayerInMap.MeasureFieldName = tCurrentConfigForLayer.MeasureFieldName;
                    }
                }
                m_ExtractionLayerProperties[featureLayer.Name] = tLayerInMap;
                // now we need to delete from m_ExtractionLayerProperties any configs that haven't been found in the map
                tPreviouslyConfiguredLayers.Remove(featureLayer.Name);
            }
            foreach (string invalidLayerName in tPreviouslyConfiguredLayers)
            {
                m_ExtractionLayerProperties.Remove(invalidLayerName);
            }
            // now, m_extractionlayerproperties is a dictionary of extractionlayerproperties objects
            // where the objects contain the values from the previously saved lot if they were there
            foreach (ExtractionLayerProperties rowdetails in m_ExtractionLayerProperties.Values)
            {
                //  string[] rowParams = new string[]{
                //      rowdetails.LayerName,rowdetails.Enabled.ToString(),rowdetails.ParamName,rowdetails.CategoryFieldName,rowdetails.ValueFieldName
                //     };
                dataGridView1.Rows.Add();
                int             newRowIdx = dataGridView1.Rows.Count - 1;
                DataGridViewRow tRow      = dataGridView1.Rows[newRowIdx];
                tRow.Cells["LayerName"].Value  = rowdetails.LayerName;
                tRow.Cells["LayerAvail"].Value = rowdetails.Enabled.ToString();
                tRow.Cells["LayerParam"].Value = rowdetails.ParamName;
                if (rowdetails.ExtractionType == "FeatureLayer")
                {
                    DataGridViewComboBoxCell cfcell = (DataGridViewComboBoxCell)tRow.Cells["CatField"];

                    foreach (object itemToAdd in rowdetails.PossibleCategoryFields)
                    {
                        cfcell.Items.Add(itemToAdd);
                    }
                    cfcell.Value = rowdetails.CategoryFieldName;
                    DataGridViewComboBoxCell valcell = (DataGridViewComboBoxCell)tRow.Cells["ValField"];
                    foreach (object itemToAdd in rowdetails.PossibleValueFields)
                    {
                        valcell.Items.Add(itemToAdd);
                    }
                    valcell.Value = rowdetails.ValueFieldName;
                    DataGridViewComboBoxCell meascell = (DataGridViewComboBoxCell)tRow.Cells["MeasField"];
                    foreach (object itemToAdd in rowdetails.PossibleMeasureFields)
                    {
                        meascell.Items.Add(itemToAdd);
                    }
                    meascell.Value = rowdetails.MeasureFieldName;
                    tRow.Cells["MeasField"].Value = rowdetails.MeasureFieldName;
                }
                else
                {
                    tRow.Cells["CatField"].Value     = rowdetails.CategoryFieldName;
                    tRow.Cells["ValField"].Value     = rowdetails.ValueFieldName;
                    tRow.Cells["MeasField"].Value    = rowdetails.MeasureFieldName;
                    tRow.Cells["CatField"].ReadOnly  = true;
                    tRow.Cells["ValField"].ReadOnly  = true;
                    tRow.Cells["MeasField"].ReadOnly = true;
                }
                int rowIdx = dataGridView1.Rows.Add(tRow);
            }
            mapDocument.Close();
            mapDocument = null;
            map         = null;
            ComboFlowAcc.SelectedIndex        = accSelectedIndex;
            ComboFlowDir.SelectedIndex        = dirSelectedIndex;
            ComboExtentFeatures.SelectedIndex = extSelectedIndex;
            m_initAcc = true;
            m_initDir = true;
            m_initExt = true;
            m_GridIsInSyncWithProperties = true;
            radioReadMap.Checked         = m_GetLayersFromMap;
            dataGridView1.Enabled        = radioReadMap.Checked;
        }
Exemple #7
0
        public static List <FieldInfo> GetFieldsFromLayer(ESRI.ArcGIS.Carto.IFeatureLayer pLayer, bool IsNumricField)
        {
            //FieldInfo[] fields = new FieldInfo[10];
            //for (int i = 0; i < 10; i++)
            //{
            //    if (i == 0)
            //    {
            //        fields[i] = new FieldInfo();
            //        fields[i].FieldName = "<NONE>";
            //        fields[i].FieldDesc = "<NONE>";
            //        fields[i].FieldType = "<NONE>";
            //    }
            //    else
            //    {
            //        fields[i] = new FieldInfo();
            //        fields[i].FieldName = "Field" + i.ToString();
            //        fields[i].FieldDesc = "Field" + i.ToString();
            //        fields[i].FieldType = "Field" + i.ToString();
            //    }
            //}
            //return fields;

            ESRI.ArcGIS.Geodatabase.IFeatureClass pClass = pLayer.FeatureClass;
            List <FieldInfo> fields    = new List <FieldInfo>();
            FieldInfo        noneField = new FieldInfo();

            noneField.FieldName = "<NONE>";
            noneField.FieldDesc = "<NONE>";
            noneField.FieldType = ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeDate;
            fields.Add(noneField);

            for (int i = 0; i < pClass.Fields.FieldCount; i++)
            {
                FieldInfo field = new FieldInfo();
                ESRI.ArcGIS.Geodatabase.IField pField = pClass.Fields.get_Field(i);
                if (IsNumricField)
                {
                    //if (pField.VarType > 1 && pField.VarType < 6 && pField.Type != ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeOID)
                    if ((int)pField.Type < 4)
                    {
                        field.FieldName = pField.Name;
                        field.FieldDesc = pField.AliasName;
                        field.FieldType = pField.Type;
                        fields.Add(field);
                    }
                }
                else
                {
                    //if ((pField.VarType > 1 && pField.VarType < 6 && pField.Type != ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeOID)
                    //    || pField.Type == ESRI.ArcGIS.Geodatabase.esriFieldType.esriFieldTypeString)
                    if ((int)pField.Type < 5)
                    {
                        field.FieldName = pField.Name;
                        field.FieldDesc = pField.AliasName;
                        field.FieldType = pField.Type;
                        fields.Add(field);
                    }
                }
            }
            return(fields);
        }
Exemple #8
0
        /// <summary>
        /// Gets all cables that are considered splicable to another cable at a given splice closure.
        /// </summary>
        /// <param name="cable">Cable to splice with</param>
        /// <param name="spliceClosure">Splice Closure to splice at</param>
        /// <returns>List of SpliceableCableWrapper</returns>
        public List <SpliceableCableWrapper> GetSpliceableCables(FiberCableWrapper cable, SpliceClosureWrapper spliceClosure)
        {
            // At the time of this comment, splicable means they are connected in the geometric network
            List <SpliceableCableWrapper> result = new List <SpliceableCableWrapper>();

            if (null == cable)
            {
                throw new ArgumentNullException("cable");
            }
            if (null == spliceClosure)
            {
                throw new ArgumentNullException("spliceClosure");
            }

            int searchOid = cable.Feature.OID;

            ESRI.ArcGIS.Geodatabase.IEdgeFeature cableFt = cable.Feature as ESRI.ArcGIS.Geodatabase.IEdgeFeature;
            ESRI.ArcGIS.Carto.IFeatureLayer      ftLayer = _hookHelper.FindFeatureLayer(ConfigUtil.FiberCableFtClassName);
            int displayIdx = ftLayer.FeatureClass.FindField(ftLayer.DisplayField);

            if (null != cableFt)
            {
                // We assume it is simple. Complex junctions are not supported for splicing cables
                ESRI.ArcGIS.Geodatabase.ISimpleJunctionFeature junction = spliceClosure.Feature as ESRI.ArcGIS.Geodatabase.ISimpleJunctionFeature;

                if (null != junction)
                {
                    bool isAFromEnd = false; // would be in the case that junction.EID == cableFt.ToJunctionEID
                    if (junction.EID == cableFt.FromJunctionEID)
                    {
                        isAFromEnd = true;
                    }
                    else if (junction.EID != cableFt.ToJunctionEID)
                    {
                        // It isn't the from or the two? It shouldn't have been passed in as if it was coincident with the cable
                        return(result);
//                        throw new InvalidOperationException("Given splice closure is not the junction for the given cable.");
                    }

                    int edgeCount = junction.EdgeFeatureCount;
                    for (int i = 0; i < edgeCount; i++)
                    {
                        ESRI.ArcGIS.Geodatabase.IEdgeFeature connectedEdge = junction.get_EdgeFeature(i);
                        ESRI.ArcGIS.Geodatabase.IFeature     feature       = (ESRI.ArcGIS.Geodatabase.IFeature)connectedEdge;
                        ESRI.ArcGIS.Geodatabase.IDataset     dataset       = feature.Class as ESRI.ArcGIS.Geodatabase.IDataset;
                        string featureClassName = GdbUtils.ParseTableName(dataset);

                        if (0 == string.Compare(featureClassName, ConfigUtil.FiberCableFtClassName) &&
                            feature.OID != searchOid)
                        {
                            if (junction.EID == connectedEdge.FromJunctionEID)
                            {
                                result.Add(new SpliceableCableWrapper(feature, true, isAFromEnd, displayIdx));
                            }
                            else if (junction.EID == connectedEdge.ToJunctionEID)
                            {
                                result.Add(new SpliceableCableWrapper(feature, false, isAFromEnd, displayIdx));
                            }
                        }
                    }
                }
            }

            return(result);
        }