本文整理汇总了C#中IPropertySet.GetAllProperties方法的典型用法代码示例。如果您正苦于以下问题:C# IPropertySet.GetAllProperties方法的具体用法?C# IPropertySet.GetAllProperties怎么用?C# IPropertySet.GetAllProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPropertySet
的用法示例。
在下文中一共展示了IPropertySet.GetAllProperties方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetProperties
protected void GetProperties(IPropertySet propset)
{
object[] nameArray = new object[1];
object[] valueArray = new object[1];
propset.GetAllProperties(out nameArray[0], out valueArray[0]);
object[] names = (object[])nameArray[0];
object[] values = (object[])valueArray[0];
System.Text.StringBuilder sb = new StringBuilder();
for (int i = 0; i < names.Length; i++)
{
sb.AppendLine(String.Format("{0}: {1}", names[i], values[i].ToString()));
}
System.Diagnostics.Debug.WriteLine(sb.ToString());
}
示例2: GetProperties
private static Dictionary<string, string> GetProperties(IPropertySet propertySet)
{
var results = new Dictionary<string, string>();
object n;
object v;
propertySet.GetAllProperties(out n, out v);
var names = (object[]) n;
var values = (object[]) v;
for (int i = 0 ; i < names.Length; i++)
results[names[i].ToString()] = values[i].ToString();
return results;
}
示例3: PropertySetToString
public static String PropertySetToString(IPropertySet propertySet)
{
if (propertySet == null)
throw new ArgumentNullException("propertySet");
Int32 propertyCount = propertySet.Count;
object[] nameArray = new object[1];
object[] valueArray = new object[1];
propertySet.GetAllProperties(out nameArray[0], out valueArray[0]);
object[] names = (object[])nameArray[0];
object[] values = (object[])valueArray[0];
// TODO - CONCAT 2 ARRAYS PROPERLY
String connectionProperties = "";
for (int i = 0; i < propertyCount; i++)
{
connectionProperties = String.Format("{0}[{1}]={2};", connectionProperties, names[i], values[i]);
//string nameString = names[i].ToString();
//string valueString = values[i].ToString();
}
return connectionProperties.Trim();
}
示例4: MatchTable
/// <summary>
/// Geocodes a table of addresses
/// </summary>
/// <param name="addressTable">Input address table</param>
/// <param name="addressFieldNames">Fields defined in the table</param>
/// <param name="whereClause">Query filter where clause</param>
/// <param name="outputFeatureClass">Output feature class for matched addresses</param>
/// <param name="outputFieldNames">Output field names</param>
/// <param name="fieldsToCopy"></param>
/// <param name="cancelTracker"></param>
public virtual void MatchTable(ITable addressTable, String addressFieldNames, String whereClause,
IFeatureClass outputFeatureClass, String outputFieldNames, IPropertySet fieldsToCopy, ITrackCancel cancelTracker)
{
_log.Debug("IAddressGeocoding MatchTable");
// Obtain the read and insert cursors
IQueryFilter queryFilter = new QueryFilterClass();
queryFilter.WhereClause = whereClause;
ICursor readCursor = null;
IFeatureCursor insertCursor = null;
IFeatureCursor updateCursor = null;
// m_needToUpdate will be True when a Rematch is being preformed
if (m_needToUpdate)
{
// Create update cursor to update matched records
updateCursor = outputFeatureClass.Update(queryFilter, false);
if (isSameObject(addressTable, outputFeatureClass))
readCursor = updateCursor as ICursor;
else
readCursor = addressTable.Search(queryFilter, true);
}
else
{
// Create insert cursor to add new records
readCursor = addressTable.Search(queryFilter, true);
insertCursor = outputFeatureClass.Insert(true);
}
int count = addressTable.RowCount(queryFilter);
// Progress dialog setup
IStepProgressor progressor = null;
if (cancelTracker != null)
progressor = cancelTracker.Progressor as IStepProgressor;
IProgressStatistics progStats = cancelTracker as IProgressStatistics;
if (progressor != null)
{
progressor.StepValue = 1;
progressor.MaxRange = addressTable.RowCount(null);
}
// Separate the input field names
string[] multilineFields = addressFieldNames.Split(',');
// Read the first row and get the address field
IRow row = readCursor.NextRow();
Dictionary<int, string> addressFieldIndexes = new Dictionary<int, string>();
// Get the index of each valid field
for (int i = 0; i < multilineFields.Length; i++)
{
if (multilineFields[i].Trim().Length > 0)
addressFieldIndexes.Add(row.Fields.FindField(multilineFields[i].Trim()), multilineFields[i].Trim());
}
string address;
IPropertySet addressProperties = new PropertySetClass();
IPropertySet resultSet;
IFeatureBuffer featureBuffer;
object copyTo, copyFrom, key, value;
// Get the name and value of all the properties in the property set
fieldsToCopy.GetAllProperties(out copyTo, out copyFrom);
string[] copyToArray = copyTo as string[];
object[] copyFromArray = copyFrom as object[];
string matchStatus = "U";
// Populate the output feature class
while (row != null)
{
featureBuffer = outputFeatureClass.CreateFeatureBuffer();
foreach (KeyValuePair<int,string> entry in addressFieldIndexes)
{
if (entry.Key != -1)
address = row.get_Value(entry.Key) as string;
else
address = row.get_Value(0) as string;
addressProperties.SetProperty(entry.Value, address);
}
resultSet = MatchAddress(addressProperties);
// Get all of the fields and values of the result
resultSet.GetAllProperties(out key, out value);
string[] names = key as string[];
object[] items = value as object[];
//.........这里部分代码省略.........
示例5: 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)));
}
//.........这里部分代码省略.........
示例6: FindAddressCandidates
/// <summary>
/// This method is called when a query is made to the locator.
/// This must be implemented in such a way that Single and Multi line searches can be preformaed
/// </summary>
/// <param name="address">Review code for the structure of this property set</param>
/// <returns>A single-line array containing a property set. Review code for the structure of this property set</returns>
public override IArray FindAddressCandidates(IPropertySet address)
{
_log.Debug("BNGLocator IAddressCandidates FindAddressCandidates");
IArray addressCandidates = new ArrayClass();
// Get the input from the IPropertySet
object names = null;
object values = null;
address.GetAllProperties(out names, out values);
string[] nameArray = (string[])names;
object[] valueArray = (object[])values;
_log.Debug("Input address columns:" + string.Concat( nameArray));
//make sure there is at least one value
if (nameArray.Length > 0)
{
string addressValue;
if(nameArray.Length == 1)
addressValue = valueArray[0].ToString();
else
addressValue = valueArray[0].ToString() + "," + valueArray[1].ToString();
_log.Debug("Lookup Value:" + addressValue);
Envelope enve = DoMatchLookup(addressValue);
// Get centre point of Envelope for geocode location
// ONLY Point geometries can be returned successfully
Point point = CentrePoint(enve);
if (point != null)
{
// Ensure spatial reference is set on this envelope returned by the search function
(point as IGeometry).SpatialReference = base.m_spatialReference;
// Build the required output array
IPropertySet match = new PropertySetClass();
names = new string[] { "Shape", "Status", "Score", "X", "Y", "XMin", "YMin", "XMax", "YMax", "Match_addr", "Addr_type" };
values = new object[] { point, "M", 100, point.X, point.Y, enve.XMin, enve.YMin, enve.XMax, enve.YMax, addressValue.ToUpper(), "BNG" };
match.SetProperties(names, values);
addressCandidates.Add(match);
}
}
return addressCandidates;
}
示例7: PropertySetToDictionary
public static Dictionary<string, object> PropertySetToDictionary(IPropertySet propertySet)
{
if (propertySet == null)
throw new ArgumentNullException("propertySet");
Int32 propertyCount = propertySet.Count;
Dictionary<string, object> dictionary = new Dictionary<string, object>();
object[] nameArray = new object[1];
object[] valueArray = new object[1];
propertySet.GetAllProperties(out nameArray[0], out valueArray[0]);
object[] names = (object[])nameArray[0];
object[] values = (object[])valueArray[0];
for (int i = 0; i < propertyCount; i++)
{
dictionary.Add(names[i].ToString(), values[i]);
}
return dictionary;
}