Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ISet features = feature.Split(splitLine);
- //let's say the original feature had surrogate id 1,
- //so both split features have surrogate id 1 at the moment
- //let the next available surrogate id be 6
- IFeature splitFeature = (IFeature)(features.Next());
- splitFeature.set_Value(surrogateIdOrdinal, 6);
- splitFeature.Store();
- splitFeature = (IFeature)(features.Next());
- splitFeature.set_Value(surrogateIdOrdinal, 7);
- splitFeature.Store();
- IQueryFilter filter = new QueryFilterClass();
- filter.WhereClause = surrogateIdField + " = " + surrogateId;
- return fClass.FeatureCount(filter) > 0;
- IDataChangesEx changes = workspace.get_EditDataChanges(esriEditDataChangesType.esriEditDataChangesWithinSession);
- IDifferenceCursorEx = changes.ExtractEx("fclass", esriDifferenceType.esriDifferenceTypeInsert);
- IRow sourceRow, differenceRow;
- ILongArray differenceIndices;
- int oid;
- differenceCursor.Next(out oid, out sourceRow, our differenceRow, out differenceIndices);
- //sourceRow has OID 100 and surrogate id 6
- public bool existsBySubsId(int subsId, out bool foundInAllRows)
- {
- foundInAllRows = false;
- IFeatureClass fClass = featureWorkspace.OpenFeatureClass("fclass");
- int subsIdOrd = fClass.FindField("SUBSID");
- IFeatureCursor cursor = fClass.Search(null, true);
- IFeature feat;
- while ((feat = cursor.NextFeature()) != null)
- {
- int foundSubsId = (int)feat.get_Value(subsIdOrd);
- if(foundSubsId == subsId)
- {
- foundInAllRows = true;
- break;
- }
- }
- IQueryFilter filter = new QueryFilterClass();
- queryFilter.WhereClause = "SUBSID = " + subsId;
- return fClass.FeatureCount(filter) > 0;
- }
- //feature has SUBSID = 5
- public ISet SplitFeature(IFeature feature, IPolyLine splitLine)
- {
- ISet splitFeatures;
- bool subsIdExists, subsIdFoundInAllRows;
- subsIdExists = existsBySubsId(5, out subsIdFoundInAllRows);
- //both subsIdExists and subsIdFoundInAllRows are true
- splitFeatures = feature.Split(splitLine);
- subsIdExists = existsBySubsId(5, out subsIdFoundInAllRows);
- //subsIdExists is false, subsIdFoundInAllRows is true
- return splitFeatures;
- }
- IQueryFilter filter = new QueryFilterClass();
- filter.WhereClause = "SUBSID = 1";
- IFeatureCursor cursor = featureClass.Search(filter, true);
- IFeature feat = cursor.NextFeature();
- //feat is not null even though there are no features with SUBSID == 1
- int subsId = (int)feat.get_Value(feat.Fields.FindField("SUBSID"));
- //subsId is 2
Add Comment
Please, Sign In to add comment