本文整理汇总了C#中System.Collections.Set.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# Set.Reset方法的具体用法?C# Set.Reset怎么用?C# Set.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Collections.Set
的用法示例。
在下文中一共展示了Set.Reset方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FindCurves
public void FindCurves(string whereClause = null)
{
IMap pMap = ArcMap.Document.ActiveView.FocusMap;
if (hasOpenJob())
return;
IRelationshipClass relationshipClass = null;
ISelectionSet relatedSelectionSet = null;
myAOProgressor progressor = new myAOProgressor();
try
{
Finished = false;
progressor.setStepProgressorProperties(1, "Initializing");
ICadastralFabricLayer CFLayer = GetFabricLayer(pMap);
IFeatureLayer CFLineLayer = CFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRLines);
IFeatureLayer CFParcelLayer = CFLayer.get_CadastralSubLayer(esriCadastralFabricRenderer.esriCFRParcels);
//for each CF line feature class
IFeatureSelection CFLineFeatureSelection = (IFeatureSelection)CFLineLayer;
IFeatureSelection CFParcelFeatureSelection = (IFeatureSelection)CFParcelLayer;
ISelectionSet selectionSet = null;
if (CFParcelFeatureSelection.SelectionSet.Count > 0)
{
//parcels selected
//Create memory relationship class to help with the mapping
IMemoryRelationshipClassFactory MemoryRCF = new MemoryRelationshipClassFactoryClass();
relationshipClass = MemoryRCF.Open("Parcel_Layer_Rel", CFParcelLayer.FeatureClass, "ObjectID", CFLineLayer.FeatureClass, "ParcelID", "forward", "backward", esriRelCardinality.esriRelCardinalityOneToMany);
//convert selection set to ISet of rows
ISet polySet = new Set();
ICursor cursor;
CFParcelFeatureSelection.SelectionSet.Search(null, false, out cursor);
IRow row = null;
while((row = cursor.NextRow()) != null)
polySet.Add(row);
polySet.Reset();
//use the relationship class to find related rows
ISet lineSet = relationshipClass.GetObjectsRelatedToObjectSet(polySet);
//convert set back to selection set
lineSet.Reset();
//create an empty selection set (there should be a better way to do this....
//will only evaluate the lines related to the parcels that are selected
//selectionSet = CFLineLayer.FeatureClass.Select(new QueryFilter() { WhereClause = "1=0" }, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, null);
//will union the current line selection and the parcel selection
relatedSelectionSet = CFLineFeatureSelection.SelectionSet.Select(null, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, null);
while ((row = (IRow)lineSet.Next()) != null)
{
relatedSelectionSet.Add(row.OID);
Marshal.ReleaseComObject(row);
}
Marshal.ReleaseComObject(lineSet);
polySet.Reset();
while ((row = (IRow)polySet.Next()) != null)
Marshal.ReleaseComObject(row);
Marshal.ReleaseComObject(polySet);
selectionSet = relatedSelectionSet;
}
else if (CFLineFeatureSelection.SelectionSet.Count > 0)
{
//lines selected
selectionSet = CFLineFeatureSelection.SelectionSet;
}
else
{
if (DialogResult.OK != messageBox.Show("You are about to run the add-in on the entire feature class, this could take a long time. Proceeed?", "Long Operation", MessageBoxButtons.OKCancel))
return;
}
FindCurves(CFLineLayer.Name, CFLineLayer.FeatureClass, selectionSet, whereClause, progressor);
if (Curves.Count == 0)
{
messageBox.Show("No inferred curved lines found.");
return;
}
}
catch (Exception Exx)
{
messageBox.Show(Exx.Message);
if (relationshipClass != null)
Marshal.ReleaseComObject(relationshipClass);
if (relatedSelectionSet != null)
Marshal.ReleaseComObject(relatedSelectionSet);
}
finally
//.........这里部分代码省略.........