本文整理汇总了C#中IFeature.get_Value方法的典型用法代码示例。如果您正苦于以下问题:C# IFeature.get_Value方法的具体用法?C# IFeature.get_Value怎么用?C# IFeature.get_Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IFeature
的用法示例。
在下文中一共展示了IFeature.get_Value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetFeatureAttr
/// <summary>
/// 获取选中要素的DataTable
/// </summary>
/// <param name="pSelection">IFeature</param>
/// <returns>DataTable</returns>
public static DataTable GetFeatureAttr(IFeature pFeature)
{
DataTable dt = new DataTable();
dt.Columns.Add("name", System.Type.GetType("System.String")); //名称
dt.Columns.Add("value", System.Type.GetType("System.String")); //值
try
{
if (pFeature == null)
{
return dt;
}
ITable table = pFeature.Table;
IFields fields = table.Fields;
for (int i = 0; i < fields.FieldCount; i++)
{
//获取数据
IField field = fields.get_Field(i);
string aliasName = field.AliasName;
//string name = GISConfig.ConvertFieldName(aliasName);
if (aliasName != "XZQMC")
{
continue;
}
string value = Convert.ToString(pFeature.get_Value(i));
//写入数据
DataRow dr = dt.NewRow();
dr["name"] = aliasName;
dr["value"] = value;
dt.Rows.Add(dr);
}
}
catch { }
return dt;
}
示例2: extractAttributes
private Hashtable extractAttributes(IFeature feat)
{
Hashtable attributes = new Hashtable();
int fieldCount = feat.Fields.FieldCount;
for (int i = 0; i < fieldCount; i++)
{
IField field = feat.Fields.get_Field(i);
attributes.Add(field.Name, feat.get_Value(i));
}
return attributes;
}
示例3: GetCity
private City GetCity(IFeature city, IFeatureClass cityClass)
{
IPoint capitalShape = city.Shape as IPoint;
int areaNameIndex = cityClass.FindField(CityConst.AREA_NAME);
return new City()
{
AreaName = city.get_Value(areaNameIndex) as string,
X = capitalShape.X,
Y = capitalShape.Y
};
}
示例4: setupFilter
public static IQueryFilter setupFilter(IFeature srcFeature, string[] keys)
{
string where = null;
bool non_null = false;
for(int i=0;i<keys.Length;i++)
{
int index = srcFeature.Fields.FindField(keys[i]);
if( index != -1)
{
string v = encodeField(srcFeature.get_Value(index), srcFeature.Fields.get_Field(index));
string cond = null;
if (v == null || "".Equals(v))
{
cond = keys[i] + " IS NULL ";
}
else
{
non_null = true;
cond = keys[i] + " = " + v;
}
if(where == null)
{
// first time
where = cond;
}
else
{
where = where + " AND "+cond;
}
}
else
{
Logger.Write("Field not found: "+keys[i]+" for "+((IFeatureClass)srcFeature.Table).AliasName);
}
}
Logger.Write("WHERE "+where);
if (!non_null)
{
// there isn't a filter which should be used
return null;
}
IQueryFilter f = new QueryFilterClass();
f.WhereClause = where;
return f;
}
示例5: GHYT
public GHYT(IFeatureClass pFeatureClass, IFeature pFeatrue)
{
this.BSM = pFeatrue.get_Value(pFeatureClass.Fields.FindField(this.BSM)).ToString();
this.YSDM = pFeatrue.get_Value(pFeatureClass.Fields.FindField(this.YSDM)).ToString();
this.XZQHDM = pFeatrue.get_Value(pFeatureClass.Fields.FindField(this.XZQHDM)).ToString();
this.GNFQLXDM = pFeatrue.get_Value(pFeatureClass.Fields.FindField(this.GNFQLXDM)).ToString();
this.TDLYGNFQBH = pFeatrue.get_Value(pFeatureClass.Fields.FindField(this.TDLYGNFQBH)).ToString();
this.GNFQMJ = pFeatrue.get_Value(pFeatureClass.Fields.FindField(this.GNFQMJ)).ToString();
}
示例6: GetValves
//��÷��ŵ������ֶκ���Ϣ
private void GetValves(IFeature pFeature, out string var1, out string var2, out string var3)
{
IFields pFields = pFeature.Fields;
ISubtypes pWaterPtSubtypes = pFeatLayerValves.FeatureClass as ISubtypes;
var1=pFeature.get_Value(pFields.FindField("WATER_ID")).ToString();
var2=pFeature.get_Value(pFields.FindField("PWV_TYPE")).ToString();
var3=pFeature.get_Value(pFields.FindField("PWSHEETNO")).ToString();
IRowSubtypes pRowSubtypes = pFeature as IRowSubtypes;
if(pRowSubtypes!=null)
{
IDomain pDomain=pWaterPtSubtypes.get_Domain(pRowSubtypes.SubtypeCode, "PWV_TYPE");
if(pDomain!=null)
{
ICodedValueDomain pCodedValDomain = pDomain as ICodedValueDomain;
for(int i=0;i<=pCodedValDomain.CodeCount-1;i++)
{
if(pCodedValDomain.get_Value(i).ToString()==var2)
{
var2=pCodedValDomain.get_Name(i).ToString();
}
}
}
}
}
示例7: FeatureAttribute
public FeatureAttribute(IFeature pFeature)
{
InitializeComponent();
m_pFeature = pFeature;
dgvBasicProperties.BackgroundColor = System.Drawing.Color.White;
dgvBasicProperties.ColumnHeadersDefaultCellStyle.ForeColor = System.Drawing.Color.Black;
dgvBasicProperties.ColumnHeadersDefaultCellStyle.BackColor = System.Drawing.Color.White;
dgvBasicProperties.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font(dgvBasicProperties.Font, System.Drawing.FontStyle.Bold);
dgvBasicProperties.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Sunken;
dgvBasicProperties.GridColor = System.Drawing.Color.Black;
dgvBasicProperties.RowHeadersVisible = false;
dgvBasicProperties.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
dgvBasicProperties.MultiSelect = false;
dgvBasicProperties.AllowUserToAddRows = false;
//dgvBasicProperties.ReadOnly = true;
dgvBasicProperties.RowCount = pFeature.Fields.FieldCount;
dgvBasicProperties.ColumnCount = 2;
dgvBasicProperties.Columns[0].HeaderText = "字段";
dgvBasicProperties.Columns[0].ReadOnly = true;
dgvBasicProperties.Columns[1].HeaderText = "字段值";
dgvBasicProperties.Columns[1].AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
for (int j = 0; j < pFeature.Fields.FieldCount; j++)
{
if (pFeature.Fields.get_Field(j).Type == esriFieldType.esriFieldTypeGeometry)
{
dgvBasicProperties[0, j].Value = "要素类型";
dgvBasicProperties[1, j].Value = "Shape";
}
else
{
dgvBasicProperties[0, j].Value = pFeature.Fields.get_Field(j).AliasName;
dgvBasicProperties[1, j].Value = pFeature.get_Value(j);
}
}
//panel1.Visible = false;
tabControl1.TabPages.RemoveAt(1);
}
示例8: CreateNode
private void CreateNode(IFeature fSource,TreeListNode nodeParent)
{
string strShapeFieldName=null, strOidFieldName=null;
IField fieldArea=null,fieldLength=null;
if (!(fSource is ITopologyFeature) && fSource.Class is IFeatureClass)
{
IFeatureClass fClass=fSource.Class as IFeatureClass;
strOidFieldName=fClass.OIDFieldName;
strShapeFieldName=fClass.ShapeFieldName;
fieldArea=fClass.AreaField;
fieldLength=fClass.LengthField;
}
IFields fields = fSource.Fields;
int count = fields.FieldCount;
for (int i = 0; i < count; i++)
{
IField curField = fields.get_Field(i);
if (curField.Name == strShapeFieldName || curField==fieldArea || curField==fieldLength)// || curField.Name == strOidFieldName)
continue;
treeListAttribute.AppendNode(new object[] { curField.AliasName, fSource.get_Value(i) },nodeParent);
}
}
示例9: GetStateDetails
private StateDetails GetStateDetails(IFeature state, IFeatureClass statesClass)
{
int areaIdx = statesClass.FindField(StateConst.AREA);
int stateNameIdx = statesClass.FindField(StateConst.STATE_NAME);
int subRegionIdx = statesClass.FindField(StateConst.SUB_REGION);
int stateAbbrIdx = statesClass.FindField(StateConst.STATE_ABBR);
int pop2000Idx = statesClass.FindField(StateConst.POP2000);
int pop00_sqmiIdx = statesClass.FindField(StateConst.POP00_SQMI);
return new StateDetails
{
Area = (double)state.get_Value(areaIdx),
StateName = state.get_Value(stateNameIdx) as string,
SubRegion = state.get_Value(subRegionIdx) as string,
StateAbbr = state.get_Value(stateAbbrIdx) as string,
Pop2000 = (int)state.get_Value(pop2000Idx),
Pop00_SQMI = (int)state.get_Value(pop00_sqmiIdx)
};
}
示例10: LoadFeatureToViewer
private static string LoadFeatureToViewer(IFeature pFeat)
{
if (pFeat == null)
return "";
// Dim pFCurs As IFeatureCursor = Nothing
IFeatureClass pFC = null;
string strPrjName = "";
string strFld = "";
ISubtypes pSubType = null;
bool bSubType = false;
// Dim pSFilt As ISpatialFilter = Nothing
try
{
int pSubValue = 0;
pFC = (IFeatureClass)pFeat.Class;
pSubType = (ISubtypes)pFC;
bSubType = pSubType.HasSubtype;
//If the layer has subtypes, load the subtype value first
if (bSubType)
{
pSubValue = (int)pFeat.get_Value(pSubType.SubtypeFieldIndex);
//Loop through each control in the tab control
foreach (Control pCntrl in s_tbCntlDisplay.Controls)
{
//If the control is a tabpage
if (pCntrl is TabPage)
{
//Loop through each ocntrol on the tab oage
foreach (Control cCntrl in pCntrl.Controls)
{
//If the control is a combo box(used for domains)
if (cCntrl is Panel)
{
foreach (Control cCntrlPnl in cCntrl.Controls)
{
if (cCntrlPnl is ComboBox)
{
//Get the field
strFld = ((ComboBox)cCntrlPnl).Tag.ToString();
//Make sure no link is specified
if (strFld.IndexOf("|") > 0)
{
strFld = strFld.Substring(0, strFld.IndexOf("|")).Trim();
}
//If the field is the subtype field
if (pSubType.SubtypeFieldName == strFld)
{
//Set the value
if (!object.ReferenceEquals(pFeat.get_Value(pFeat.Fields.FindField(strFld)), DBNull.Value))
{
((ComboBox)cCntrlPnl).SelectedValue = pFeat.get_Value(pFeat.Fields.FindField(strFld));
}
else
{
((ComboBox)cCntrlPnl).SelectedIndex = 0;
}
//Raise the subtype change event, this loads all the proper domains based on the subtype value
cmbSubTypChange_Click((ComboBox)cCntrlPnl, null);
break; // TODO: might not be correct. Was : Exit For
}
}
}
}
}
}
}
}
//Loop through all the controls and set their value
foreach (Control pCntrl in s_tbCntlDisplay.Controls)
{
if (pCntrl is TabPage)
{
foreach (Control cCntrl in pCntrl.Controls)
{
//If the control is a 2 value domain(Checkboxs)
if (cCntrl is Panel)
{
foreach (Control cCntrlPnl in cCntrl.Controls)
{
if (cCntrlPnl is CustomPanel)
{
//Get the Field
strFld = ((CustomPanel)cCntrlPnl).Tag.ToString();
if (strFld.IndexOf("|") > 0)
{
strFld = strFld.Substring(0, strFld.IndexOf("|")).Trim();
}
//Get the target value
//.........这里部分代码省略.........
示例11: add
public void add(int ClassID, string ClassName, ESRI.ArcGIS.Geometry.IGeometry Geo, int OID, int EID,IFeature pFeat)
{
FeatureDetails pFD = new FeatureDetails();
FieldPairs[] fps = new FieldPairs[pFeat.Fields.FieldCount - 1];
int fldIdx = 0;
for (int i = 0; i < pFeat.Fields.FieldCount ; i++)
{
if (pFeat.Fields.get_Field(i).Type == esriFieldType.esriFieldTypeGeometry)
{ }
else
{
FieldPairs fp = new FieldPairs();
fp.FieldAlias = pFeat.Fields.get_Field(i).AliasName;
fp.FieldName = pFeat.Fields.get_Field(i).Name;
if (pFeat.get_Value(i) == null)
{
fp.FieldValue = "";
}
else
{
fp.FieldValue = pFeat.get_Value(i).ToString();
}
fps[fldIdx] = fp;
fldIdx++;
}
}
pFD.Fields = fps;
pFD.Geo = Geo;
pFD.OID = OID;
pFD.EID = EID;
TraceResultsClass trRes = TraceResultClassItem(ClassID);
if (trRes == null)
{
trRes = new TraceResultsClass();
trRes.ClassID = ClassID;
trRes.ClassName = ClassName;
if (trRes.Features == null)
{
trRes.Features = new ArrayList();
}
trRes.Features.Add(pFD);
m_TraceResultItems.Add(trRes);
}
else
{
if (trRes.Features == null)
{
trRes.Features = new ArrayList();
}
trRes.Features.Add(pFD);
}
}
示例12: ConvertFeatureToOSMWay
private way ConvertFeatureToOSMWay(IFeature currentFeature, IWorkspace featureWorkspace, IFeatureClass pointFeatureClass, int osmIDPointFieldIndex, int tagsFieldIndex, int osmIDFieldIndex, int changesetIDFieldIndex, int osmVersionFieldIndex, int userIDFieldIndex, int userNameFieldIndex, int timeStampFieldIndex, int visibleFieldIndex, int extensionVersion)
{
if (currentFeature == null)
throw new ArgumentNullException("currentFeature");
way osmWay = new way();
object featureValue = DBNull.Value;
List<nd> vertexIDs = new List<nd>();
if (currentFeature.Shape.IsEmpty == false)
{
IPointCollection pointCollection = currentFeature.Shape as IPointCollection;
if (currentFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolygon)
{
for (int pointIndex = 0; pointIndex < pointCollection.PointCount - 1; pointIndex++)
{
nd vertex = new nd();
[email protected] = OSMToolHelper.retrieveNodeID(pointFeatureClass, osmIDPointFieldIndex, extensionVersion, pointCollection.get_Point(pointIndex));
vertexIDs.Add(vertex);
}
// the last node is the first one again even though it doesn't have an internal ID
nd lastVertex = new nd();
[email protected] = OSMToolHelper.retrieveNodeID(pointFeatureClass, osmIDPointFieldIndex, extensionVersion, pointCollection.get_Point(0));
vertexIDs.Add(lastVertex);
}
else
{
for (int pointIndex = 0; pointIndex < pointCollection.PointCount; pointIndex++)
{
nd vertex = new nd();
[email protected] = OSMToolHelper.retrieveNodeID(pointFeatureClass, osmIDPointFieldIndex, extensionVersion, pointCollection.get_Point(pointIndex));
vertexIDs.Add(vertex);
}
}
osmWay.nd = vertexIDs.ToArray();
}
if (osmIDFieldIndex != -1)
{
osmWay.id = Convert.ToString(currentFeature.get_Value(osmIDFieldIndex));
}
if (changesetIDFieldIndex != -1)
{
featureValue = currentFeature.get_Value(changesetIDFieldIndex);
if (featureValue != DBNull.Value)
{
osmWay.changeset = Convert.ToString(currentFeature.get_Value(changesetIDFieldIndex));
}
}
if (osmVersionFieldIndex != -1)
{
featureValue = currentFeature.get_Value(osmVersionFieldIndex);
if (featureValue != DBNull.Value)
{
osmWay.version = Convert.ToString(featureValue);
}
}
if (userIDFieldIndex != -1)
{
featureValue = currentFeature.get_Value(userIDFieldIndex);
if (featureValue != DBNull.Value)
{
osmWay.uid = Convert.ToString(featureValue);
}
}
if (userNameFieldIndex != -1)
{
featureValue = currentFeature.get_Value(userNameFieldIndex);
if (featureValue != DBNull.Value)
{
osmWay.user = Convert.ToString(featureValue);
}
}
if (timeStampFieldIndex != -1)
{
featureValue = currentFeature.get_Value(timeStampFieldIndex);
if (featureValue != DBNull.Value)
{
osmWay.timestamp = Convert.ToDateTime(featureValue).ToUniversalTime().ToString("u");
}
}
if (visibleFieldIndex != -1)
{
//.........这里部分代码省略.........
示例13: same
private bool same(Conflict conflict, IFeature conflictFeature, string[] keys)
{
// check type, values
// create conflict ...
int index = -1;
for(int i=0;i<keys.Length;i++)
{
index = conflictFeature.Fields.FindField(keys[i]);
if(index>-1)
{
object o = conflictFeature.get_Value(index);
if( (conflict.PrimaryKeyValues[i] == null && o != null) ||
(conflict.PrimaryKeyValues[i] != null && o == null))
{
return false;
}
if(conflict.PrimaryKeyValues[i] != null && o != null &&
!conflict.PrimaryKeyValues[i].Equals(o.ToString()))
{
return false;
}
}
else
{
if(conflict.PrimaryKeyValues[i] != null)
return false;
}
}
index = conflictFeature.Fields.FindField(CONFLICT_TYPE);
if(index>-1)
{
string t = (string)conflictFeature.get_Value(index);
switch(t)
{
case CONFLICT_TYPE_DU:
if (conflict.Type != ConflictType.Delete_Update)
return false;
break;
case CONFLICT_TYPE_II:
if (conflict.Type != ConflictType.Insert_Insert)
return false;
break;
case CONFLICT_TYPE_IU:
if (conflict.Type != ConflictType.Insert_Update)
return false;
break;
case CONFLICT_TYPE_UD:
if (conflict.Type != ConflictType.Update_Delete)
return false;
break;
case CONFLICT_TYPE_UI:
if (conflict.Type != ConflictType.Update_Insert)
return false;
break;
case CONFLICT_TYPE_UU:
if (conflict.Type != ConflictType.Update_Update)
return false;
break;
}
}
else
{
return false;
}
return true;
}
示例14: ConvertFeaturetoElement
private void ConvertFeaturetoElement(iFormBuilderAPI.Page page, IFeature feature)
{
try
{
//Create a New Record from this feature
iFormBuilderAPI.RecordsCreator recC = new iFormBuilderAPI.RecordsCreator();
iFormBuilderAPI.Record rec = new iFormBuilderAPI.Record();
rec.PARENT_PAGE_ID = page.ID;
rec.FIELDS = new List<iFormBuilderAPI.Field>();
iFormBuilderAPI.Field field = new iFormBuilderAPI.Field();
bool addfield = true;
long recordid;
foreach (iFormBuilderAPI.Element ele in page.Elements)
{
//Check to see if this an element to ignore
if (ele.IgnoreElement)
continue;
//Does this field exist
//TODO: Need further field validation steps
//Does a Domain Field Have a Value
//All required fields entered
if (feature.Fields.FindField(ele.NAME) != -1)
{
field = new iFormBuilderAPI.Field();
field.ELEMENT_ID = ele.ID;
field.VALUE = feature.get_Value(feature.Fields.FindField(ele.NAME)).ToString();
addfield = true;
if (ele.WidgetType == iFormBuilderAPI.Element.Widget.Image)
{
//Only add this element if the picture is properly formated
if (feature.get_Value(feature.Fields.FindField(ele.NAME)).ToString().Length == 0 || !feature.get_Value(feature.Fields.FindField(ele.NAME)).ToString().Contains(".jpg"))
addfield = false;
else
field.EXT = "JPG";
}
if (addfield)
rec.FIELDS.Add(field);
}
}
recC.RECORDS.Add(rec);
recordid = api.CreateRecord(page.ID, recC);
if (recordid != -1)
{
//TODO: Apply the record ID to this record to allow linkage to iFormBuilder
/*IDataset dataset = feature.Table as IDataset;
if(m_editor.EditState != esriEditState.esriStateEditing)
m_editor.StartEditing(dataset.Workspace);
m_editor.StartOperation();
ICursor update;
QueryFilter qf = new QueryFilter();
qf.WhereClause = string.Format("OBJECTID={0}",feature.OID);
update = feature.Table.Update(qf, true);
IRow row = update.NextRow();
row.set_Value(feature.Fields.FindField("ID"), recordid);
m_editor.StopOperation("Stop");
//if (m_editor.EditState != esriEditState.esriStateEditing)
// m_editor.stop(dataset.Workspace);*/
}
}
catch
{
}
}
示例15: SetDynamicValues
//.........这里部分代码省略.........
_currentDatasetNameItems = _currentDataset.Name.Split('.');
tableName = _currentDatasetNameItems[_currentDatasetNameItems.GetLength(0) - 1];
stepProgressor.Message = "Checking rules for edited feature: " + inObject.Class.AliasName;
progressDialog.Description = "Checking rules for edited feature: " + inObject.Class.AliasName;
AAState.WriteLine("***********************************************************");
AAState.WriteLine("############ " + DateTime.Now + " ################");
AAState.WriteLine("");
AAState.WriteLine(" Setting sort order: Field - RUNORDER");
if (AAState._dv.Table.Columns.Contains("RUN_WEIGHT"))
AAState._dv.Sort = "RUN_WEIGHT DESC";
AAState.WriteLine(" Querying table for Last Value for layer: " + inObject.Class.AliasName);
AAState.WriteLine(" Query Used: (TABLENAME = '*' OR TABLENAME = '" + tableName + "' OR TABLENAME like '" + tableName + "|*' OR TABLENAME like '" + tableName + "|%') AND VALUEMETHOD = 'Last_Value'");
AAState._dv.RowFilter = "(TABLENAME = '*' OR TABLENAME = '" + tableName + "' OR TABLENAME like '" + tableName + "|*' OR TABLENAME like '" + tableName + "|%') AND VALUEMETHOD = 'Last_Value'";
AAState.WriteLine(" Number of results: " + AAState._dv.Count.ToString());
if (AAState._dv.Count > 0)
{
IRowChanges pRowChLast = inObject as IRowChanges;
for (int retRows = 0; retRows < AAState._dv.Count; retRows++)
{
DataRowView drv = AAState._dv[retRows];
AAState.WriteLine(" Looking for " + drv["FIELDNAME"].ToString());
int fldLoc = inObject.Fields.FindField(drv["FIELDNAME"].ToString());
if (fldLoc > 0)
{
AAState.WriteLine(" " + drv["FIELDNAME"].ToString() + " field found at position: " + fldLoc);
if (pRowChLast.get_ValueChanged(fldLoc))
{
AAState.WriteLine(" " + drv["FIELDNAME"].ToString() + " Has Changed");
try
{
if (inObject.get_Value(fldLoc) != null)
{
if (inObject.get_Value(fldLoc) != DBNull.Value)
{
if (AAState.lastValueProperties.GetProperty(drv["FIELDNAME"].ToString()) != null)
{
AAState.WriteLine(" Setting Last Value");
AAState.WriteLine(" " + drv["FIELDNAME"].ToString() + ": " + inObject.get_Value(fldLoc).ToString());
AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), inObject.get_Value(fldLoc));
}
else
{
AAState.WriteLine(" Setting Last Value");
AAState.WriteLine(" " + drv["FIELDNAME"].ToString() + ": " + inObject.get_Value(fldLoc));
AAState.lastValueProperties.SetProperty(drv["FIELDNAME"].ToString(), inObject.get_Value(fldLoc));
}
}
else
{
if (mode == "ON_CREATE")
{
AAState.WriteLine(" Skipping null on create");
}
else