本文整理汇总了C#中IFeatureClass.Select方法的典型用法代码示例。如果您正苦于以下问题:C# IFeatureClass.Select方法的具体用法?C# IFeatureClass.Select怎么用?C# IFeatureClass.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFeatureClass
的用法示例。
在下文中一共展示了IFeatureClass.Select方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SelectedObjects
public SelectedObjects(IFeatureClass pFC)
{
IDataset pDS;
pDS = (IDataset)pFC;
iClassID = pFC.FeatureClassID;
sClassName = pDS.Name;
pSelSet = pFC.Select(null, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionEmpty, pDS.Workspace);
}
示例2: SelectFeaturesFromFeatureClass
private void SelectFeaturesFromFeatureClass(IFeatureClass fc, IWorkspace ws)
{
IQueryFilter qf = new QueryFilterClass();
qf.WhereClause = "";
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
ISelectionSet ss = fc.Select(qf, esriSelectionType.esriSelectionTypeIDSet, esriSelectionOption.esriSelectionOptionNormal, ws);
PrintSelectionSet(ss);
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
示例3: IsPinch
private bool IsPinch(IPoint errorPoint, IPolyline gapLine, IFeatureClass sourceFC, IWorkspace scratch)
{
ISpatialFilter theSF = new SpatialFilterClass();
theSF.Geometry = errorPoint;
theSF.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
ISelectionSet theSelSet = sourceFC.Select(
theSF,
esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionOnlyOne,
scratch);
return theSelSet.Count >= 1;
}
示例4: GetEnvelopByFeatureClass
/// <summary>
/// ��ȡҪ�ؼ���������
/// </summary>
/// <param name="ipFeatureClass">Ҫ�ؼ�</param>
/// <returns>��ȷ����Ҫ�ؼ�������</returns>
private IEnvelope GetEnvelopByFeatureClass(IFeatureClass ipFeatureClass)
{
try
{
IEnvelope ipMaxEnvelop = new EnvelopeClass();
double dMinX = 0.0;
double dMaxX = 0.0;
double dMinY = 0.0;
double dMaxY = 0.0;
ISelectionSet ipSelectionSet =
ipFeatureClass.Select(null, esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal, null);
int nFeatureCount = ipSelectionSet.Count;
if (nFeatureCount < 5000)
{
ICursor ipCursor = null;
ipSelectionSet.Search(null, false, out ipCursor);
IFeatureCursor ipFeatureCursor = (IFeatureCursor) ipCursor;
if (ipFeatureCursor == null)
{
return null;
}
IFeature ipFeature = ipFeatureCursor.NextFeature();
IEnvelope ipEnvelop = ipFeature.Extent;
dMinX = ipEnvelop.XMin;
dMaxX = ipEnvelop.XMax;
dMinY = ipEnvelop.YMin;
dMaxY = ipEnvelop.YMax;
ipFeature = ipFeatureCursor.NextFeature();
double dtMinX = 0.0;
double dtMaxX = 0.0;
double dtMinY = 0.0;
double dtMaxY = 0.0;
while (ipFeature != null)
{
ipEnvelop = ipFeature.Extent;
dtMinX = ipEnvelop.XMin;
dtMaxX = ipEnvelop.XMax;
dtMinY = ipEnvelop.YMin;
dtMaxY = ipEnvelop.YMax;
if (dtMinX < dMinX)
dMinX = dtMinX;
if (dtMaxX > dMaxX)
dMaxX = dtMaxX;
if (dtMinY < dMinY)
dMinY = dtMinY;
if (dtMaxY > dMaxY)
dMaxY = dtMaxY;
ipFeature = ipFeatureCursor.NextFeature();
}
}
else
{
IFeatureLayer ipFeatureLayer = new FeatureLayerClass();
ipFeatureLayer.FeatureClass = ipFeatureClass;
ipMaxEnvelop = ipFeatureLayer.AreaOfInterest;
//���䷶Χ������һ�㣬���ⲻ��Ҫ��ͼ����ѡ����
dMinX = ipMaxEnvelop.XMin;
dMaxX = ipMaxEnvelop.XMax;
dMinY = ipMaxEnvelop.YMin;
dMaxY = ipMaxEnvelop.YMax;
}
double dHeight = (dMaxY - dMinY)/500;
double dWidth = (dMaxX - dMinX)/500;
double dTempTol = dHeight > dWidth ? dWidth : dHeight;
dMinX += dTempTol;
dMaxX -= dTempTol;
dMinY += dTempTol;
dMaxY -= dTempTol;
ipMaxEnvelop.XMin = dMinX;
ipMaxEnvelop.XMax = dMaxX;
ipMaxEnvelop.YMin = dMinY;
ipMaxEnvelop.YMax = dMaxY;
return ipMaxEnvelop;
}
catch (Exception ex)
{
SendMessage(enumMessageType.Exception, ex.ToString());
return null;
}
//.........这里部分代码省略.........
示例5: MatchEdgeCheckPolygon
/// <summary>
/// ��ӱ��
/// </summary>
/// <param name="pMatchEdgeFeatureClass">Ҫ���нӱ���Ҫ��</param>
/// <param name="szSql">���Թ�������</param>
/// <param name="ipGriddingline"></param>
/// <param name="nFieldArray">����ƥ���ֶ������б�</param>
/// <param name="dblTolerance">�ݴ�ֵ</param>
/// <param name="ipErrorFilterEnvelop"></param>
/// <param name="sOIDs">�ӱ��Ķ���OID</param>
/// <param name="sCheckInfos">�ӱ��ÿ����Ϣ</param>
/// <returns></returns>
private bool MatchEdgeCheckPolygon(IFeatureClass pMatchEdgeFeatureClass, string szSql, IPolyline ipGriddingline,
List<int> nFieldArray, double dblTolerance, IEnvelope ipErrorFilterEnvelop,
ref List<string> sOIDs, ref List<string> sCheckInfos)
{
//���Դ���
IPoint ipTestFromPoint = ipGriddingline.FromPoint;
IPoint ipTestToPoint = ipGriddingline.ToPoint;
double dFromTestX = ipTestFromPoint.X;
double dFromTestY = ipTestFromPoint.Y;
double dToTestX = ipTestToPoint.X;
double dToTestY = ipTestToPoint.Y;
try
{
//
//ʹ�������߽��пռ��ѯ
ISpatialFilter ipSpatialFilter = new SpatialFilterClass();
IGeometry ipLineBufGeoInSide, ipLineBufGeoOutSide;
ISelectionSet ipInSideSelectionSet = null;
ISelectionSet ipOutSideSelectionSet = null;
//��ȡ�ڻ�������Ҫ�ؼ�
//IPolygon ipPolygon = LineBuffer(ipGriddingline,dblTolerance);
IPolyline ipPolyline = LineBuffer(ipGriddingline, dblTolerance);
ipLineBufGeoInSide = ipPolyline;
ipSpatialFilter.Geometry = ipLineBufGeoInSide;
ipSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
ipSpatialFilter.WhereClause = szSql;
ipInSideSelectionSet =
pMatchEdgeFeatureClass.Select(ipSpatialFilter, esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal, null);
int lInSideSelectionCount = ipInSideSelectionSet.Count;
//�ڻ�����û�ж�����ô������Ķ���Ҳ���ü��
if (lInSideSelectionCount < 1)
{
return true;
}
//��ȡ��������Ҫ�ؼ�
ipPolyline = LineBuffer(ipGriddingline, -dblTolerance);
ipLineBufGeoOutSide = ipPolyline;
ipSpatialFilter.Geometry = (IGeometry) ipLineBufGeoOutSide;
ipOutSideSelectionSet =
pMatchEdgeFeatureClass.Select(ipSpatialFilter, esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal, null);
int lOutSideSelectionCount = ipOutSideSelectionSet.Count;
IScratchWorkspaceFactory ipSwf = new ScratchWorkspaceFactoryClass();
IWorkspace ipScratchWorkspace = ipSwf.CreateNewScratchWorkspace();
bool bIsInToOut = true; //�ͷ����ڵ���
for (int k = 0; k < 2; k++)
{
ISelectionSet ipSourceSelectionSet = null;
ISelectionSet ipTargetSelectionSet = null;
if (bIsInToOut)
{
ipSourceSelectionSet = ipInSideSelectionSet;
ipTargetSelectionSet = ipOutSideSelectionSet;
}
else
{
ipSourceSelectionSet = ipOutSideSelectionSet;
ipTargetSelectionSet = ipInSideSelectionSet;
}
//����ipSourceSelectionSet�е�Ҫ��(Buffer����)
//Ȼ����ipTargetSelectionSet��ȡ�����ཻ��Ҫ��
ICursor ipSourceCursor;
ipSourceSelectionSet.Search(null, false, out ipSourceCursor);
IRow ipSourceRow = ipSourceCursor.NextRow();
IFields ipMatchEdgeFields = pMatchEdgeFeatureClass.Fields;
IField ipMatchEdgeField;
int nProcessingFeature = 0;
string sProgressMessage;
while (ipSourceRow != null)
//.........这里部分代码省略.........
示例6: MatchEdgeCheckLine
/// <summary>
/// �߽ӱ��
/// </summary>
/// <param name="pMatchEdgeFeatureClass">Ҫ���нӱ���Ҫ��</param>
/// <param name="szSql">���Թ�������</param>
/// <param name="ipGriddingline"></param>
/// <param name="nFieldArray">����ƥ���ֶ������б�</param>
/// <param name="dblTolerance">�ݴ�ֵ</param>
/// <param name="ipErrorFilterEnvelop">�����ڱ߽總����Ҫ��û�нӱ߶���IJ����ڴ���,�����һ�����˵Ķ���</param>
/// <param name="sOIDs">�ӱ��Ķ���OID</param>
/// <param name="sCheckInfos">�ӱ��ÿ����Ϣ</param>
/// <returns></returns>
private bool MatchEdgeCheckLine(IFeatureClass pMatchEdgeFeatureClass,
string szSql,
IPolyline ipGriddingline,
List<int> nFieldArray,
double dblTolerance,
IEnvelope ipErrorFilterEnvelop,
ref List<string> sOIDs,
ref List<string> sCheckInfos)
{
try
{
//ʹ�������߽��пռ��ѯ
IGeometry ipLineBufGeoInSide, ipLineBufGeoOutSide;
//����ipSourceSelectionSet�е�Ҫ��(Buffer����)
//Ȼ����ipTargetSelectionSet��ȡ�����ཻ��Ҫ��
bool bIsInToOut = true; //�ͷ����ڵ���
for (int k = 0; k < 2; k++)
{
//��ȡ�ڻ�������Ҫ�ؼ�
IPolyline ipPolyline = LineBuffer(ipGriddingline, dblTolerance);
ISpatialFilter ipSpatialFilter = new SpatialFilterClass();
ipLineBufGeoInSide = ipPolyline;
ipSpatialFilter.Geometry = ipLineBufGeoInSide;
ipSpatialFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
//ipSpatialFilter.WhereClause = szSql;
ISelectionSet ipInSideSelectionSet = null;
ISelectionSet ipOutSideSelectionSet = null;
try
{
ipInSideSelectionSet =
pMatchEdgeFeatureClass.Select(ipSpatialFilter, esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal, null);
}
catch (Exception ex)
{
SendMessage(enumMessageType.Exception, ex.ToString());
return false;
}
int lInSideSelectionCount = ipInSideSelectionSet.Count;
//�ڻ�����û�ж�����ô������Ķ���Ҳ���ü��
if (lInSideSelectionCount < 1)
{
return true;
}
//��ȡ��������Ҫ�ؼ�
ipPolyline = LineBuffer(ipGriddingline, -dblTolerance);
ipLineBufGeoOutSide = ipPolyline;
ipSpatialFilter.Geometry = ipLineBufGeoOutSide;
try
{
ipOutSideSelectionSet =
pMatchEdgeFeatureClass.Select(ipSpatialFilter, esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal, null);
}
catch (Exception ex)
{
SendMessage(enumMessageType.Exception, ex.ToString());
return false;
}
int lOutSideSelectionCount = ipOutSideSelectionSet.Count;
IGeometry ipGriddinglineBufferGeo = ((ITopologicalOperator) ipGriddingline).Buffer(dblTolerance);
ISelectionSet ipSourceSelectionSet = null;
ISelectionSet ipTargetSelectionSet = null;
ICursor ipSourceCursor = null;
if (bIsInToOut)
{
ipSourceSelectionSet = ipInSideSelectionSet;
ipTargetSelectionSet = ipOutSideSelectionSet;
}
else
{
ipSourceSelectionSet = ipOutSideSelectionSet;
ipTargetSelectionSet = ipInSideSelectionSet;
}
try
{
ipSourceSelectionSet.Search(null, false, out ipSourceCursor);
//.........这里部分代码省略.........