Пример #1
0
        public static String field_to_description(ESRI.ArcGIS.Geodatabase.IField field)
        {
            return("Geometry");

            /*
             * if (Index % 3 == 0)
             *  m_datasetString = "Point";
             * if (Index % 3 == 1)
             *  m_datasetString = "Polyline";
             * if (Index % 3 == 2)
             *  m_datasetString = "Polygon";
             *
             * if ((Index >= 3 && Index < 6) || Index >= 9)
             *  m_datasetString += "M";
             *
             * if (Index >= 6)
             *  m_datasetString += "Z"
             *
             */
        }
        /// <summary>
        /// Checks the database to see if the splice Type field has a domain; if it does load the choices, otherwise
        /// enable free text editing on the column
        /// </summary>
        /// <param name="helper">Helper class</param>
        private void LoadTypeDropdown(FiberSpliceHelper helper)
        {
            try
            {
                ESRI.ArcGIS.Geodatabase.IFeatureClass ftClass = _wkspHelper.FindFeatureClass(ConfigUtil.FiberCableFtClassName);
//                ESRI.ArcGIS.Geodatabase.IFeatureClass ftClass = helper.FindFeatureClass(ConfigUtil.FiberCableFtClassName);
                ESRI.ArcGIS.Geodatabase.ITable fiberSpliceTable = _wkspHelper.FindTable(ConfigUtil.FiberSpliceTableName);
//                ESRI.ArcGIS.Geodatabase.ITable fiberSpliceTable = GdbUtils.GetTable(ftClass, ConfigUtil.FiberSpliceTableName);
                ESRI.ArcGIS.Geodatabase.IField typeField = fiberSpliceTable.Fields.get_Field(fiberSpliceTable.FindField(ConfigUtil.TypeFieldName));

                ESRI.ArcGIS.Geodatabase.ICodedValueDomain domain = typeField.Domain as ESRI.ArcGIS.Geodatabase.ICodedValueDomain;
                if (null != domain)
                {
                    colType.Items.Clear();
                    colType.Items.Add(string.Empty); // For DBNull

                    for (int codeIdx = 0; codeIdx < domain.CodeCount; codeIdx++)
                    {
                        colType.Items.Add(domain.get_Name(codeIdx));
                    }
                }
                else
                {
                    // Change to a text column
                    System.Windows.Forms.DataGridViewTextBoxColumn colTypeText = new DataGridViewTextBoxColumn();
                    colTypeText.HeaderText = colType.HeaderText;
                    colTypeText.Name       = colType.Name;
                    grdSplices.Columns.Remove(colType);
                    grdSplices.Columns.Add(colTypeText);
                }
            }
            catch (Exception e)
            {
                _logHelper.addLogEntry(DateTime.Now.ToString(), "ERROR", "Splice Connection Window (LoadTypeDropdown): ", e.Message);
            }
        }
Пример #3
0
        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;
        }
        /// <summary>
        /// 字段匹配
        /// </summary>
        /// <param name="sourceFeatClass"></param>
        /// <param name="targetFeatClass"></param>
        /// <param name="FieldPair"></param>
        /// <returns></returns>
        public static ESRI.ArcGIS.Geoprocessing.IGPFieldMapping GetGPFieldMapping(ESRI.ArcGIS.Geodatabase.IFeatureClass sourceFeatClass,
                                                                                  ESRI.ArcGIS.Geodatabase.IFeatureClass targetFeatClass, string FieldPair)
        {
            ESRI.ArcGIS.Geodatabase.IDataset       sourceDataset = sourceFeatClass as ESRI.ArcGIS.Geodatabase.IDataset;
            ESRI.ArcGIS.esriSystem.IName           pName         = sourceDataset.FullName;
            ESRI.ArcGIS.Geoprocessing.IGPUtilities gputilities   = new ESRI.ArcGIS.Geoprocessing.GPUtilitiesClass();
            ESRI.ArcGIS.Geodatabase.IDETable       inputTableA   = (ESRI.ArcGIS.Geodatabase.IDETable)gputilities.MakeDataElementFromNameObject(pName);

            ESRI.ArcGIS.esriSystem.IArray inputtables = new ESRI.ArcGIS.esriSystem.ArrayClass();
            inputtables.Add(inputTableA);

            ESRI.ArcGIS.Geoprocessing.IGPFieldMapping pGPFieldMapping = new ESRI.ArcGIS.Geoprocessing.GPFieldMappingClass();
            pGPFieldMapping.Initialize(inputtables, null);

            string[] sFieldPairs = FieldPair.Split(';');
            if (sFieldPairs == null)
            {
                return(null);
            }

            foreach (string sFieldPair in sFieldPairs)
            {
                try
                {
                    if (string.IsNullOrWhiteSpace(sFieldPair))
                    {
                        continue;
                    }
                    string[] sourceAndtarget = sFieldPair.Split(',');
                    if (sourceAndtarget == null || sourceAndtarget.Length <= 0)
                    {
                        continue;
                    }
                    string targetFieldName = sourceAndtarget[0];
                    string sourceFieldName = sourceAndtarget[1];
                    int    sourceindex     = sourceFeatClass.FindField(sourceFieldName);
                    int    targetindex     = targetFeatClass.FindField(targetFieldName);
                    if (sourceindex < 0 || targetindex < 0)
                    {
                        continue;
                    }

                    ESRI.ArcGIS.Geoprocessing.IGPFieldMap trackid = new ESRI.ArcGIS.Geoprocessing.GPFieldMapClass();
                    trackid.OutputField = targetFeatClass.Fields.get_Field(targetFeatClass.FindField(targetFieldName));
                    trackid.MergeRule   = ESRI.ArcGIS.Geoprocessing.esriGPFieldMapMergeRule.esriGPFieldMapMergeRuleLast;
                    int fieldmap_index = pGPFieldMapping.FindFieldMap(sourceFieldName);
                    ESRI.ArcGIS.Geoprocessing.IGPFieldMap stfid_fieldmap = pGPFieldMapping.GetFieldMap(fieldmap_index);
                    int field_index = stfid_fieldmap.FindInputField(inputTableA, sourceFieldName);
                    ESRI.ArcGIS.Geodatabase.IField inputField = stfid_fieldmap.GetField(field_index);
                    //if (inputField.Name == "STLLZ")
                    //{
                    //    ESRI.ArcGIS.Geodatabase.IField field = targetFeatClass.Fields.get_Field(targetFeatClass.FindField(targetFieldName));
                    //}
                    trackid.AddInputField(inputTableA, inputField, -1, -1);
                    pGPFieldMapping.AddFieldMap(trackid);
                }
                catch (Exception ex)
                {
                }
            }

            return(pGPFieldMapping);
        }
Пример #5
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);
        }
        /// <summary>
        /// Get the existing splice ranges between two cables at an existing closure
        /// </summary>
        /// <param name="cableA">One cable</param>
        /// <param name="cableB">Other cable</param>
        /// <param name="splice">Splice Closure</param>
        /// <returns>List of FiberSplice</returns>
        /// <remarks>Currently only checks A/B as passed, does not check the reverse B/A combination</remarks>
        public static List <FiberSplice> GetSplicedRanges(FiberCableWrapper cableA, FiberCableWrapper cableB, SpliceClosureWrapper splice)
        {
            List <FiberSplice> result      = new List <FiberSplice>();
            string             spliceWhere = string.Format("{0}='{1}' AND {2}='{3}' AND {4}='{5}'",
                                                           ConfigUtil.ACableIdFieldName,
                                                           cableA.IPID,
                                                           ConfigUtil.BCableIdFieldName,
                                                           cableB.IPID,
                                                           ConfigUtil.SpliceClosureIpidFieldName,
                                                           splice.IPID);

            using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
            {
                ESRI.ArcGIS.Geodatabase.ITable fiberSpliceTable = TelecomWorkspaceHelper.Instance().FindTable(ConfigUtil.FiberSpliceTableName);
//                ESRI.ArcGIS.Geodatabase.ITable fiberSpliceTable = GdbUtils.GetTable(cableA.Feature.Class, ConfigUtil.FiberSpliceTableName);
                ESRI.ArcGIS.Geodatabase.IQueryFilter filter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
                releaser.ManageLifetime(filter);

                filter.WhereClause = spliceWhere;
                ((ESRI.ArcGIS.Geodatabase.IQueryFilterDefinition)filter).PostfixClause = string.Format("ORDER BY {0}", ConfigUtil.AFiberNumberFieldName);

                int aUnitIdx = fiberSpliceTable.FindField(ConfigUtil.AFiberNumberFieldName);
                int bUnitIdx = fiberSpliceTable.FindField(ConfigUtil.BFiberNumberFieldName);
                int lossIdx  = fiberSpliceTable.FindField(ConfigUtil.LossFieldName);
                int typeIdx  = fiberSpliceTable.FindField(ConfigUtil.TypeFieldName);
                ESRI.ArcGIS.Geodatabase.IField            typeField  = fiberSpliceTable.Fields.get_Field(typeIdx);
                ESRI.ArcGIS.Geodatabase.ICodedValueDomain typeDomain = typeField.Domain as ESRI.ArcGIS.Geodatabase.ICodedValueDomain;

                ESRI.ArcGIS.Geodatabase.ICursor splices = fiberSpliceTable.Search(filter, true);
                releaser.ManageLifetime(splices);

                ESRI.ArcGIS.Geodatabase.IRow spliceRow = splices.NextRow();

                int    lastAUnit = -1;
                int    lastBUnit = -1;
                double?lastLoss  = null;
                object lastType  = Type.Missing;

                int aLow = -1;
                int bLow = -1;

                while (null != spliceRow)
                {
                    // These are not-null columns
                    int aUnit = (int)spliceRow.get_Value(aUnitIdx);
                    int bUnit = (int)spliceRow.get_Value(bUnitIdx);

                    object lossObj = spliceRow.get_Value(lossIdx);
                    double?loss    = null;
                    if (DBNull.Value != lossObj)
                    {
                        loss = (double)lossObj;
                    }

                    object type = spliceRow.get_Value(typeIdx);

                    if (aUnit != (lastAUnit + 1) ||
                        bUnit != (lastBUnit + 1) ||
                        loss != lastLoss ||
                        !type.Equals(lastType))
                    {
                        if (-1 != lastAUnit)
                        {
                            string typeString = string.Empty;
                            if (null != typeString)
                            {
                                if (null != typeDomain)
                                {
                                    typeString = GdbUtils.GetDomainNameForValue(typeDomain, lastType);
                                }
                                else
                                {
                                    typeString = lastType.ToString(); // DBNull.Value will return string.Empty
                                }
                            }

                            result.Add(new FiberSplice(new Range(aLow, lastAUnit), new Range(bLow, lastBUnit), lastLoss, typeString));
                        }

                        aLow = aUnit;
                        bLow = bUnit;
                    }

                    lastAUnit = aUnit;
                    lastBUnit = bUnit;
                    lastLoss  = loss;
                    lastType  = type;

                    ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(spliceRow);
                    spliceRow = splices.NextRow();
                }

                if (-1 < aLow)
                {
                    string typeString = string.Empty;
                    if (null != typeString)
                    {
                        if (null != typeDomain)
                        {
                            typeString = GdbUtils.GetDomainNameForValue(typeDomain, lastType);
                        }
                        else
                        {
                            typeString = lastType.ToString(); // DBNull.Value will return string.Empty
                        }
                    }

                    result.Add(new FiberSplice(new Range(aLow, lastAUnit), new Range(bLow, lastBUnit), lastLoss, typeString));
                }
            }

            return(result);
        }