本文整理汇总了C#中ICursor.NextRow方法的典型用法代码示例。如果您正苦于以下问题:C# ICursor.NextRow方法的具体用法?C# ICursor.NextRow怎么用?C# ICursor.NextRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICursor
的用法示例。
在下文中一共展示了ICursor.NextRow方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetDynamicValues
//.........这里部分代码省略.........
}
else
{
AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14k"));
}
}
else
{
ITable pTable = Globals.FindTable(AAState._editor.Map, targetLayerName);
if (pTable != null)
{
int fldValToCopyIdx = Globals.GetFieldIndex(pTable.Fields, targetFieldName);
int fldIDTargetIdx = Globals.GetFieldIndex(pTable.Fields, targetIDFieldName);
if (fldIDTargetIdx > -1 && fldValToCopyIdx > -1)
{
IQueryFilter pQFilt = Globals.createQueryFilter();
if (pTable.Fields.get_Field(fldIDTargetIdx).Type == esriFieldType.esriFieldTypeString)
{
pQFilt.WhereClause = "" + pTable.Fields.get_Field(fldIDTargetIdx).Name + "" + " = '" + inObject.get_Value(fldIDSourecIdx).ToString() + "'";
}
else
{
pQFilt.WhereClause = pTable.Fields.get_Field(fldIDTargetIdx).Name + " = " + inObject.get_Value(fldIDSourecIdx);
}
ICursor pCurs;
pCurs = pTable.Search(pQFilt, true);
IRow pRow;
bool valSet = false;
pRow = pCurs.NextRow();
while (pRow != null)
{
AAState.WriteLine(" " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cf"));
try
{
inObject.set_Value(intFldIdxs[0], pRow.get_Value(fldValToCopyIdx));
AAState.WriteLine(" " + pRow.get_Value(fldValToCopyIdx).ToString() + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ch"));
valSet = true;
break;
}
catch
{
AAState.WriteLine(A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14a") + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorError_14aw") + inObject.get_Value(fldValToCopyIdx) + " to field: " + strFldNames[0]);
}
pRow = pCurs.NextRow();
}
pRow = null;
if (valSet)
AAState.WriteLine(" " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14cd"));
else
AAState.WriteLine(" " + A4LGSharedFunctions.Localizer.GetString("AttributeAssistantEditorMess_14ce"));
if (pCurs != null)
Marshal.ReleaseComObject(pCurs);
pCurs = null;
}
else
开发者ID:rlwarford,项目名称:local-government-desktop-addins,代码行数:67,代码来源:AttributeAssistantEditorExtension.cs
示例2: ChangeDatesOnTable
public bool ChangeDatesOnTable(ICursor pCursor, string FieldName, string sDate, bool Unversioned,
IStepProgressor m_pStepProgressor, ITrackCancel m_pTrackCancel)
{
bool bWriteNull = (sDate.Trim() == "");
object dbNull = DBNull.Value;
int FldIdx = pCursor.FindField(FieldName);
int iSysEndDate = pCursor.FindField("systemenddate");
int iHistorical = pCursor.FindField("historical");
bool bIsSysEndDate = (FieldName.ToLower() == "systemenddate");
bool bIsHistorical = (FieldName.ToLower() == "historical");
bool bHasSysEndDateFld = (iSysEndDate > -1);
bool bHasHistoricFld = (iHistorical > -1);
bool bCont = true;
bool m_bShowProgressor = (m_pStepProgressor != null);
if (bWriteNull)
{
IField pfld = pCursor.Fields.get_Field(FldIdx);
if (!pfld.IsNullable)
return false;
}
DateTime localNow = DateTime.Now;
IRow pRow = pCursor.NextRow();
while (pRow != null)
{
//Check if the cancel button was pressed. If so, stop process
if (m_bShowProgressor)
{
bCont = m_pTrackCancel.Continue();
if (!bCont)
break;
}
if (bWriteNull)
{
if (bIsHistorical) //if writing null to Historical field, use 0 instead
pRow.set_Value(FldIdx, 0);
else
pRow.set_Value(FldIdx, dbNull);
if (bIsHistorical && bHasSysEndDateFld) // if writing null to Historical field
pRow.set_Value(iSysEndDate, dbNull); // then also Null system end date
if (bIsSysEndDate && bHasHistoricFld) // if writing null to SystemEndDate field
pRow.set_Value(iHistorical, 0); //then set the Historical flag to false = 0
}
else
{
pRow.set_Value(FldIdx, sDate);
if (bIsSysEndDate && bHasHistoricFld) // if writing date to SystemEndDate field
pRow.set_Value(iHistorical, 1); //then set the Historical flag to true = 1
}
if (Unversioned)
pCursor.UpdateRow(pRow);
else
pRow.Store();
Marshal.ReleaseComObject(pRow);
pRow = pCursor.NextRow();
if (m_bShowProgressor)
{
if (m_pStepProgressor.Position < m_pStepProgressor.MaxRange)
m_pStepProgressor.Step();
}
}
Marshal.ReleaseComObject(pCursor);
if (!bCont)
return false;
return true;
}
示例3: MatchRecordSet
/// <summary>
/// Uses MatchAddress to geocode a cursor of addresses to a RecordSet
/// This is called by ArcGIS Server Geocode Addresses
/// </summary>
/// <param name="addressCursor">Cursor containing address to be geocoded</param>
/// <param name="addressFieldNames">The address fields that make up a record in the cursor</param>
/// <param name="outputRecordSet">The output record set</param>
/// <param name="outputFieldNames">The output field names</param>
/// <param name="fieldsToCopy"></param>
/// <param name="cancelTracker"></param>
public void MatchRecordSet(ICursor addressCursor, string addressFieldNames, IRecordSetInit outputRecordSet,
string outputFieldNames, IPropertySet fieldsToCopy, ITrackCancel cancelTracker)
{
_log.Debug("IBatchGeocoding MatchRecordSet");
_log.Debug("MatchRecordSet addressFieldNames:" + addressFieldNames);
_log.Debug("MatchRecordSet outputFieldNames:" + outputFieldNames);
ICursor resultCursor = outputRecordSet.Insert();
IRow row = addressCursor.NextRow();
IRowBuffer rowBuffer = null;
IFields fields = row.Fields;
IFields bufferFields = null;
String[] fieldNames = addressFieldNames.Split(',');
String[] outputFields = outputFieldNames.Split(',');
int addressFieldsSize = fieldNames.Length;
int outputFieldsSize = outputFields.Length;
int copyFieldsSize = 0;
String addressValue = "";
IPropertySet addressProperty;
IPropertySet results;
object value, values, names;
String[] nameArray;
object[] valueArray;
Dictionary<string, int> addressFieldInds = new Dictionary<string,int>();
Dictionary<string, int> outputFieldInds = new Dictionary<string, int>();
string fieldName;
string outFieldName;
// Get all address field indexes
for (int i = 0; i < addressFieldsSize; i++)
{
fieldName = fieldNames[i].Trim();
if(!addressFieldInds.ContainsKey(fieldName))
addressFieldInds.Add(fieldName, fields.FindField(fieldName));
}
//loop through each record
while (row != null)
{
addressProperty = new PropertySetClass();
rowBuffer = outputRecordSet.CreateRowBuffer();
bufferFields = rowBuffer.Fields;
//populate a property set of search values
for (int i = 0; i < addressFieldsSize; i++)
{
fieldName = fieldNames[i].Trim();
addressValue = row.get_Value(addressFieldInds[fieldName]) as String;
if(!string.IsNullOrEmpty(addressValue))
addressProperty.SetProperty(fieldName, addressValue);
}
// Geocode the Address
results = MatchAddress(addressProperty);
// Get all output field indexes, only do this once to save processing
if (outputFieldInds.Count == 0)
{
for (int i = 0; i < outputFieldsSize; i++)
{
outFieldName = outputFields[i].Trim();
outputFieldInds.Add(outFieldName, bufferFields.FindField(outFieldName));
}
}
//add the result to the recordset
for (int i = 0; i < outputFieldsSize; i++)
{
outFieldName = outputFields[i].Trim();
value = results.GetProperty(outFieldName);
_log.Debug("MatchRecordSet outputFields[i]:" + outFieldName);
rowBuffer.set_Value(outputFieldInds[outFieldName], value);
}
//copy extra fields
fieldsToCopy.GetAllProperties(out names, out values);
nameArray = names as String[];
valueArray = values as object[];
copyFieldsSize = nameArray.Length;
for (int i = 0; i < copyFieldsSize; i++)
{
string fieldToCopy = nameArray[i];
if(fieldToCopy == "ResultID")
rowBuffer.set_Value(bufferFields.FindField(fieldToCopy), row.OID);
else
rowBuffer.set_Value(bufferFields.FindField(fieldToCopy), row.get_Value(fields.FindField(fieldToCopy)));
}
//.........这里部分代码省略.........
示例4: SetDynamicValues
//.........这里部分代码省略.........
}
else
{
AAState.WriteLine(" ERROR: ID or Field to populate was not found");
}
}
else
{
ITable pTable = Globals.FindTable(AAState._editor.Map, targetLayerName);
if (pTable != null)
{
int fldValToCopyIdx = pTable.Fields.FindField(targetFieldName);
int fldIDTargetIdx = pTable.Fields.FindField(targetIDFieldName);
if (fldIDTargetIdx > -1 && fldValToCopyIdx > -1)
{
IQueryFilter pQFilt = Globals.createQueryFilter();
if (pTable.Fields.get_Field(fldIDTargetIdx).Type == esriFieldType.esriFieldTypeString)
{
pQFilt.WhereClause = "" + pTable.Fields.get_Field(fldIDTargetIdx).Name + "" + " = '" + inObject.get_Value(fldIDSourecIdx).ToString() + "'";
}
else
{
pQFilt.WhereClause = pTable.Fields.get_Field(fldIDTargetIdx).Name + " = " + inObject.get_Value(fldIDSourecIdx);
}
ICursor pCurs;
pCurs = pTable.Search(pQFilt, true);
IRow pRow;
while ((pRow = pCurs.NextRow()) != null)
{
AAState.WriteLine(" Trying to Copy Value from Record");
try
{
inObject.set_Value(intFldIdxs[0], pRow.get_Value(fldValToCopyIdx));
break;
}
catch
{
AAState.WriteLine(" ERROR: Could not Copy: " + inObject.get_Value(fldValToCopyIdx) + " to field: " + strFldNames[0]);
}
pRow = null;
}
pRow = null;
AAState.WriteLine(" Value successfully copied");
if (pCurs != null)
Marshal.ReleaseComObject(pCurs);
pCurs = null;
}
else
{
AAState.WriteLine(" ERROR: ID or Field to populate was not found");
}
}
else
{
AAState.WriteLine(" ERROR: Table to populate not found: " + sourceLayerName);
示例5: ChangeDatesOnTableMulti
public bool ChangeDatesOnTableMulti(ICursor pCursor, List<bool> HistorySettings, List<string> sDate, bool Unversioned,
Dictionary<int, string> ParcelToHistory_DICT,IStepProgressor m_pStepProgressor, ITrackCancel m_pTrackCancel)
{
bool bSystemEndDate_Clear = HistorySettings[0];
bool bLegalStDate_Clear = HistorySettings[1];
bool bLegalEndDate_Clear = HistorySettings[2];
bool bSystemEndDate_Set = HistorySettings[3];
bool bLegalStDate_Set = HistorySettings[4];
bool bLegalEndDate_Set = HistorySettings[5];
object dbNull = DBNull.Value;
int FldIdxSystemEnd = pCursor.FindField("systemenddate");
int iHistorical = pCursor.FindField("historical");
int FldIdxLegalSt =pCursor.FindField("legalstartdate");
int FldIdxLegalEnd = pCursor.FindField("legalenddate");
bool bHasSysEndDateFld = (FldIdxSystemEnd > -1);
bool bHasHistoricFld = (iHistorical > -1);
bool bCont = true;
bool m_bShowProgressor = (m_pStepProgressor!=null);
IRow pRow = pCursor.NextRow();
while (pRow != null)
{
//Check if the cancel button was pressed. If so, stop process
if (m_bShowProgressor)
{
bCont = m_pTrackCancel.Continue();
if (!bCont)
break;
}
string sHistoryInfo = "";
string[] sUpdateDictionaryDates = null;
bool bTryGetTrue = false;
if (ParcelToHistory_DICT.TryGetValue(pRow.OID, out sHistoryInfo))
{
//update the strings in the dictionary
sUpdateDictionaryDates = sHistoryInfo.Split(',');
bTryGetTrue = true;
}
if (bSystemEndDate_Set && bTryGetTrue)
{
pRow.set_Value(FldIdxSystemEnd, sDate[0]);
if (bHasHistoricFld) // if writing date to SystemEndDate field
pRow.set_Value(iHistorical, 1); //then set the Historical flag to true = 1
//update the dictionary
//find the location of the System End Date
string x= ParcelToHistory_DICT[pRow.OID];
int i1 = x.IndexOf(",", 0);
int i2 = x.IndexOf(",", i1+1);
string s1= x.Remove(i1 + 1, i2 - i1);
string s2=s1.Insert(i1 + 1, sDate[0] + ",");
ParcelToHistory_DICT[pRow.OID] = s2;
}
if (bSystemEndDate_Clear && bTryGetTrue)
{
pRow.set_Value(FldIdxSystemEnd, dbNull);
if (bHasHistoricFld) // if writing date to SystemEndDate field
pRow.set_Value(iHistorical, 0); //then set the Historical flag to true = 1
//update the dictionary
//find the location of the System End Date
string x = ParcelToHistory_DICT[pRow.OID];
int i1 = x.IndexOf(",", 0);
int i2 = x.IndexOf(",", i1 + 1);
string s1 = x.Remove(i1 + 1, i2 - i1);
string s2 = s1.Insert(i1 + 1, ",");
ParcelToHistory_DICT[pRow.OID] = s2;
}
if (bLegalStDate_Set && bTryGetTrue)
{
pRow.set_Value(FldIdxLegalSt, sDate[1]);
//update the dictionary
//find the location of the System End Date
string x = ParcelToHistory_DICT[pRow.OID];
int i1 = x.IndexOf(",", 0);
int i2 = x.IndexOf(",", i1 + 1);
int i3 = x.IndexOf(",", i2 + 1);
string s1 = x.Remove(i2 + 1, i3 - i2);
string s2 = s1.Insert(i2 + 1,sDate[1] + ",");
ParcelToHistory_DICT[pRow.OID] = s2;
}
if (bLegalStDate_Clear && bTryGetTrue)
{
pRow.set_Value(FldIdxLegalSt, dbNull);
//update the dictionary
//find the location of the System End Date
string x = ParcelToHistory_DICT[pRow.OID];
int i1 = x.IndexOf(",", 0);
int i2 = x.IndexOf(",", i1 + 1);
int i3 = x.IndexOf(",", i2 + 1);
string s1 = x.Remove(i2 + 1, i3 - i2);
string s2 = s1.Insert(i2 + 1, ",");
ParcelToHistory_DICT[pRow.OID] = s2;
}
//.........这里部分代码省略.........
示例6: GetResult
private List<Error> GetResult(ICursor pCursor)
{
IRow ipRow;
ipRow = pCursor.NextRow();
if (ipRow == null)
{
return null;
}
// �ж��Ƿ���OID��
bool bHasOID;
bHasOID = ipRow.HasOID;
if (!bHasOID)
{
return null;
}
string strErrInfo = ConstructErrorInfo();
List<Error> pResAttr = new List<Error>();
IFields pFields = ipRow.Fields;
int nIndex = pFields.FindField("BSM");
while (ipRow != null)
{
// ��ҽ����¼
Error pResInfo = new Error();
pResInfo.DefectLevel = this.m_DefectLevel;
pResInfo.RuleID = this.InstanceID;
pResInfo.OID = ipRow.OID;
if (nIndex >= 0)
{
pResInfo.BSM = ipRow.get_Value(nIndex).ToString();
}
pResInfo.LayerName = m_structInvalidPara.strFtName;
// ������Ϣ
if (m_structInvalidPara.strScript.Trim()!=""&& m_structInvalidPara.strScript != null)
{
pResInfo.Description = m_structInvalidPara.strScript;
}
else
{
pResInfo.Description = strErrInfo;
}
pResAttr.Add(pResInfo);
ipRow = pCursor.NextRow();
}
return pResAttr;
}
示例7: WhereClauseFromCursor
public static string WhereClauseFromCursor(int oidOrdinalCursor, string oidColumnAlias, ICursor cursor)
{
StringBuilder sbIDs = new StringBuilder();
StringBuilder sbBetween = new StringBuilder();
string betweenTemplate = " OR (" + oidColumnAlias + " BETWEEN {0} AND {1})";
int currOid = -1;
int nextOid = -1;
int countContinuous = 0;
IRow row = cursor.NextRow();
while (row != null)
{
currOid = (int)row.get_Value(oidOrdinalCursor);
nextOid = currOid;
countContinuous = 1;
do
{
row = cursor.NextRow();
if (row != null)
{
nextOid = (int)row.get_Value(oidOrdinalCursor);
if (nextOid != currOid + countContinuous)
break;
else
countContinuous++;
}
else
{
break;
}
}
while (true);
switch (countContinuous)
{
case 1:
sbIDs.Append(",").Append(currOid);
break;
case 2:
sbIDs.Append(",").Append(currOid);
if (nextOid != currOid) sbIDs.Append(",").Append(nextOid);
break;
default:
sbBetween.Append(String.Format(betweenTemplate, currOid, currOid + countContinuous - 1));
break;
}
}
if (sbIDs.Length > 1) sbIDs.Remove(0, 1).Insert(0, oidColumnAlias + " IN (").Append(")");
return sbIDs.Append(sbBetween).ToString();
}
示例8: GetResult
private List<Error> GetResult(ICursor pCursor)
{
IRow ipRow;
ipRow = pCursor.NextRow();
if (ipRow == null)
{
return new List<Error>();
}
// �ж��Ƿ���OID��
bool bHasOID;
bHasOID = ipRow.HasOID;
if (!bHasOID)
{
SendMessage(enumMessageType.RuleError, "��ǰ���Ķ���û��OID�ֶΣ������м��");
return null;
}
string strErrMsg;
if (m_structBlankPara.iType == 0)
{
strErrMsg = "Ŀ���ֶ�ֵ��Ϊ��";
}
else
{
strErrMsg = "����Ŀ���ֶ�ֵΪ��";
}
string strErrInfo = ConstructErrorInfo();
List<Error> pResAttr = new List<Error>();
IFields pFields = ipRow.Fields;
int nIndex = pFields.FindField("BSM");
while (ipRow != null)
{
// ��ҽ����¼
Error pResInfo = new Error();
pResInfo.DefectLevel = this.m_DefectLevel;
pResInfo.RuleID = this.InstanceID;
int OID;
OID = ipRow.OID;
pResInfo.OID = OID;
if (nIndex >= 0)
{
pResInfo.BSM = ipRow.get_Value(nIndex).ToString();
}
pResInfo.LayerName = m_structBlankPara.strFtName;
// ������Ϣ
if (m_structBlankPara.strScript.Trim() != "" && m_structBlankPara.strScript != null)
{
pResInfo.Description = m_structBlankPara.strScript;
}
else
{
pResInfo.Description = strErrInfo;
}
pResAttr.Add(pResInfo);
ipRow = pCursor.NextRow();
}
return pResAttr;
}
示例9: GetResult
private List<Error> GetResult(ICursor pCursor)
{
IRow ipRow;
ipRow = pCursor.NextRow();
if (ipRow == null)
{
return new List<Error>();
}
// �ж��Ƿ���OID��
bool bHasOID;
bHasOID = ipRow.HasOID;
if (!bHasOID)
{
SendMessage(enumMessageType.RuleError, "��ǰ���Ķ�������Ҫ���ࣨû��OID���������м��");
return null;
}
IFields pFields = ipRow.Fields;
int nIndex = pFields.FindField("BSM");
int nIndexShapeLength = pFields.FindField("Shape_Length");
//string strErrInfo = ConstructErrorInfo();
List<Error> pResAttr = new List<Error>();
while (ipRow != null)
{
// ��ҽ����¼
Error pResInfo = new Error();
pResInfo.DefectLevel = this.m_DefectLevel;
pResInfo.RuleID = this.InstanceID;
int OID = ipRow.OID;
if (nIndex >= 0)
{
pResInfo.BSM = ipRow.get_Value(nIndex).ToString();
if (nIndexShapeLength > 0)
{
double dLength = Convert.ToDouble(ipRow.get_Value(nIndexShapeLength));
pResInfo.Description = string.Format("'{0}'���ڱ�ʶ��Ϊ'{1}'������Ϊ'{2}'����״���������ߡ���������С��ͼ����({3})��Ҫ��", m_structLengthPara.strFtName, pResInfo.BSM, dLength.ToString("f2"), COMMONCONST.dLengthThread);
}
else
{
pResInfo.Description = string.Format("'{0}'���ڱ�ʶ��Ϊ'{1}'����״���������ߡ���������С��ͼ����({2})��Ҫ��", m_structLengthPara.strFtName, pResInfo.BSM, COMMONCONST.dLengthThread);
}
}
else
{
pResInfo.Description = m_structLengthPara.strScript; // ������Ϣ
}
pResInfo.OID = OID;
pResInfo.LayerName = m_structLengthPara.strFtName;
pResAttr.Add(pResInfo);
ipRow = pCursor.NextRow();
}
return pResAttr;
}
示例10: GetResult
private List<Error> GetResult(ICursor pCursor)
{
IRow ipRow;
ipRow = pCursor.NextRow();
if (ipRow == null)
{
return new List<Error>();
}
// �ж��Ƿ���OID��
bool bHasOID;
bHasOID = ipRow.HasOID;
if (!bHasOID)
{
SendMessage(enumMessageType.RuleError, "��ǰ���Ķ�������Ҫ���ࣨû��OID���������м��");
return null;
}
IFields pFields = ipRow.Fields;
int nIndex = pFields.FindField("BSM");
int nIndexShapeArea = pFields.FindField("Shape_area");
List<Error> errorList = new List<Error>();
while (ipRow != null)
{
// ��ҽ����¼
Error error = new Error();
error.DefectLevel = this.m_DefectLevel;
error.RuleID = this.InstanceID;
error.OID = ipRow.OID;
if (nIndex >= 0)
{
error.BSM = ipRow.get_Value(nIndex).ToString();
double dArea = Convert.ToDouble(ipRow.get_Value(nIndexShapeArea));
error.Description = string.Format("'{0}'�ڱ�ʶ��Ϊ'{1}'�����Ϊ{2}��ͼ������Ƭ����Ρ�������ͼ����С��ͼ���({3})��Ҫ��", m_structAreaPara.strFtName, error.BSM, dArea.ToString("f2"), COMMONCONST.dAreaThread);
}
else
{
// ������Ϣ
error.Description = m_structAreaPara.strScript;
}
error.LayerName = m_structAreaPara.strFtName;
errorList.Add(error);
ipRow = pCursor.NextRow();
}
return errorList;
}
示例11: JointFromToPoints
/// <summary>
/// ��㡢�յ����Ҫ�ӱ߶���
/// </summary>
/// <param name="bIsFromOver"></param>
/// <param name="bIsToOver"></param>
/// <param name="ipToSpatialFilter"></param>
/// <param name="ipFromSpatialFilter"></param>
/// <param name="ipSourceRow"></param>
/// <param name="ipSourceCursor"></param>
/// <param name="ipTargetSelectionSet"></param>
/// <param name="sMatchEdgeWhereClause"></param>
/// <param name="lSourceRowOID"></param>
/// <param name="sSourceRowOID"></param>
/// <param name="sOIDs"></param>
/// <param name="sCheckInfos"></param>
/// <returns></returns>
private bool JointFromToPoints(bool bIsFromOver, bool bIsToOver, ISpatialFilter ipToSpatialFilter,
ISpatialFilter ipFromSpatialFilter,
ref IRow ipSourceRow, ICursor ipSourceCursor, ISelectionSet ipTargetSelectionSet,
string sMatchEdgeWhereClause, int lSourceRowOID, string sSourceRowOID,
ref List<string> sOIDs, ref List<string> sCheckInfos)
{
try
{
int lFromSelectionCount, lToSelectionCount;
ISelectionSet ipFromSelectionSet = null;
ISelectionSet ipToSelectionSet = null;
if (bIsFromOver == false)
{
try
{
ipFromSelectionSet = ipTargetSelectionSet.Select(ipFromSpatialFilter,
esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal,
null);
}
catch (Exception ex)
{
SendMessage(enumMessageType.Exception, ex.ToString());
Marshal.ReleaseComObject(ipSourceRow);
ipSourceRow = ipSourceCursor.NextRow();
return false;
}
lFromSelectionCount = ipFromSelectionSet.Count;
}
else
{
lFromSelectionCount = 0;
}
if (bIsToOver == false)
{
try
{
ipToSelectionSet =
ipTargetSelectionSet.Select(ipToSpatialFilter,
esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal,
null);
}
catch (Exception ex)
{
SendMessage(enumMessageType.Exception, ex.ToString());
Marshal.ReleaseComObject(ipSourceRow);
ipSourceRow = ipSourceCursor.NextRow();
return false;
}
lToSelectionCount = ipToSelectionSet.Count;
}
else
{
lToSelectionCount = 0;
}
if (lFromSelectionCount > 0 && lToSelectionCount > 0)
{
//�������յ��ͼ��ͼ�νӱ�
ipFromSpatialFilter.WhereClause = sMatchEdgeWhereClause;
ipToSpatialFilter.WhereClause = sMatchEdgeWhereClause;
ISelectionSet ipFromAttrSelectionSet, ipToAttrSelectionSet;
ipFromAttrSelectionSet =
ipFromSelectionSet.Select(ipFromSpatialFilter,
esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal, null);
ipToAttrSelectionSet =
ipToSelectionSet.Select(ipToSpatialFilter,
esriSelectionType.esriSelectionTypeHybrid,
esriSelectionOption.esriSelectionOptionNormal, null);
int lFromAttrSelectionCount, lToAttrSelectionCount;
lFromAttrSelectionCount = ipFromAttrSelectionSet.Count;
lToAttrSelectionCount = ipToAttrSelectionSet.Count;
if (lFromAttrSelectionCount > 0 && lToAttrSelectionCount > 0)
{
//�����յ������Խӱ�
//�ж������յ�Ľӱ߶����Ƿ����һ��
ICursor ipFromAttrCursor, ipToAttrCursor;
//.........这里部分代码省略.........
示例12: GetResult
// ��ȡ�����
private List<Error> GetResult(ICursor pCursor)
{
IRow ipRow;
ipRow = pCursor.NextRow();
if (ipRow == null)
{
return null;
}
// �ж��Ƿ���OID��
bool bHasOID;
bHasOID = ipRow.HasOID;
if (!bHasOID)
{
return null;
}
IFields pFields = ipRow.Fields;
int nIndex = pFields.FindField("BSM");
int nIndexJSMJ = pFields.FindField(strField1);
int nIndexJSMJDIST = pFields.FindField(strField2);
//string strErrInfo = ConstructErrorInfo();
List<Error> pResAttr = new List<Error>();
while (ipRow != null)
{
int OID;
OID = ipRow.OID;
Error err = new Error();
err.DefectLevel = this.m_DefectLevel;
err.RuleID = this.InstanceID;
err.OID = OID;
err.LayerName = m_structSqlPara.strFtName; // Ŀ��ͼ��
if (nIndex >= 0)
{
err.BSM =ipRow.get_Value(nIndex).ToString();
}
// ������Ϣ
if (m_structSqlPara.strScript.Contains("����������㲻��ȷ"))
{
double dJSMJ = Convert.ToDouble(ipRow.get_Value(nIndexJSMJ));
double dJSMJDIST = Convert.ToDouble(ipRow.get_Value(nIndexJSMJDIST));
double dPlus = Math.Abs(dJSMJ-dJSMJDIST);
//pResInfo.strErrInfo = "���ݿ��������Ϊ"+dJSMJ.ToString("f2")+"ƽ���ף��ʼ���������������Ϊ"+dJSMJDIST.ToString("f2")+"ƽ���ף��������"+dPlus.ToString("f2")+"ƽ����";
//pResInfo.strErrInfo = string.Format(Helper.ErrMsgFormat.ERR_4401, m_structSqlPara.strFtName, pResInfo.BSM, "���ݿ��������", dJSMJ.ToString("f2") + "ƽ����", dJSMJDIST.ToString("f2") + "ƽ����", dPlus.ToString("f2") + "ƽ����");
err.Description = string.Format("���ݿ���'{0}'���б�ʶ��Ϊ'{1}'��{2}({3}ƽ����)�������������({4}ƽ����)��һ�£����߲�ֵΪ{5}ƽ����",
m_structSqlPara.strFtName, err.BSM, "���ݿ��������", dJSMJ.ToString("f2"), dJSMJDIST.ToString("f2"), dPlus.ToString("f2"));
}
else
{
err.Description = m_structSqlPara.strScript;
//pResInfo.strErrInfo = string.Format("'{0}'ͼ���ʶ��Ϊ'{1}'��ͼ�ߵ��������ֵ����ȷ��Ӧ����0", pResInfo.strTargetLayer, pResInfo.BSM);
}
pResAttr.Add(err);
ipRow = pCursor.NextRow();
}
return pResAttr;
}