本文整理汇总了C#中ESRI.get_Value方法的典型用法代码示例。如果您正苦于以下问题:C# ESRI.get_Value方法的具体用法?C# ESRI.get_Value怎么用?C# ESRI.get_Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ESRI
的用法示例。
在下文中一共展示了ESRI.get_Value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateBasicXMLItemsForSchematicElt
// The following CreateBasicXMLItmesForSchematicElt private procedure is used to create the first expected XML items for a XML NodeFeature or LinkFeature
private void CreateBasicXMLItemsForSchematicElt(ESRI.ArcGIS.Geodatabase.IFeature inFeature,
ref MSXML2.DOMDocument outDOMDoc,
ref MSXML2.IXMLDOMElement outXMLElement,
string inEltTypeName)
{
MSXML2.IXMLDOMElement xmlElt_EltTypeName;
MSXML2.IXMLDOMElement xmlElt_ExternalUID;
MSXML2.IXMLDOMElement xmlElt_DatasourceName;
MSXML2.IXMLDOMElement xmlElt_UCID;
MSXML2.IXMLDOMElement xmlElt_UOID;
// Specifying its FeatureClassName
xmlElt_EltTypeName = outDOMDoc.createElement("FeatureClassName");
outXMLElement.appendChild(xmlElt_EltTypeName);
if (inFeature.Fields.FindField("Feeder") != -1)
{
xmlElt_EltTypeName.nodeTypedValue = inEltTypeName + "sFeeder" + inFeature.get_Value(inFeature.Fields.FindField("Feeder")).ToString();
}
else
{
xmlElt_EltTypeName.nodeTypedValue = inEltTypeName + "s";
}
// Specifying its ExternalUniqueID
xmlElt_ExternalUID = outDOMDoc.createElement("ExternalUniqueID");
outXMLElement.appendChild(xmlElt_ExternalUID);
xmlElt_ExternalUID.nodeTypedValue = inEltTypeName + "-" + inFeature.OID.ToString();
// Specifying its DatasourceName
xmlElt_DatasourceName = outDOMDoc.createElement("DatasourceName");
outXMLElement.appendChild(xmlElt_DatasourceName);
xmlElt_DatasourceName.nodeTypedValue = "XMLDataSource";
// Specifying its UCID
xmlElt_UCID = outDOMDoc.createElement("UCID");
outXMLElement.appendChild(xmlElt_UCID);
xmlElt_UCID.nodeTypedValue = inFeature.Class.ObjectClassID;
// Add UOID to NodeElement
xmlElt_UOID = outDOMDoc.createElement("UOID");
outXMLElement.appendChild(xmlElt_UOID);
xmlElt_UOID.nodeTypedValue = inFeature.OID;
}
示例2: ConfigureCable
/// <summary>
/// Sets the buffer tube and strand counts based on the given configuration. If IPID and/or CABLEID are null, it also
/// takes care of them
/// </summary>
/// <param name="feature">The FiberCable feature to configure</param>
/// <param name="configuration">The tube/strand counts</param>
/// <param name="isExistingOperation">Flag to control whether this method is being called from within an existing
/// edit operation</param>
/// <returns>Success</returns>
protected bool ConfigureCable(ESRI.ArcGIS.Geodatabase.IFeature feature, FiberCableConfiguration configuration, bool isExistingOperation)
{
bool isComplete = false;
bool isOurOperationOpen = false;
// The following assignments are defaults for the case where they are not already populated on the feature
string fiberCableIpid = Guid.NewGuid().ToString("B").ToUpper();
// The following will be set during Validation
ESRI.ArcGIS.Geodatabase.IObjectClass ftClass = null;
ESRI.ArcGIS.Geodatabase.IFields fields = null;
int ipidIdx = -1;
int bufferCountIdx = -1;
int strandCountIdx = -1;
#region Validation
if (null == feature)
{
throw new ArgumentNullException("feature");
}
if (null == configuration)
{
throw new ArgumentNullException("configuration");
}
if (_editor.EditState == ESRI.ArcGIS.Editor.esriEditState.esriStateNotEditing)
{
throw new InvalidOperationException("You must be editing the workspace to perform this operation.");
}
ftClass = feature.Class;
fields = ftClass.Fields;
string missingFieldFormat = "Field {0} is missing.";
ipidIdx = fields.FindField(ConfigUtil.IpidFieldName);
if (-1 == ipidIdx)
{
throw new InvalidOperationException(string.Format(missingFieldFormat, ConfigUtil.IpidFieldName));
}
bufferCountIdx = fields.FindField(ConfigUtil.NumberOfBuffersFieldName);
if (-1 == bufferCountIdx)
{
throw new InvalidOperationException(string.Format(missingFieldFormat, ConfigUtil.NumberOfBuffersFieldName));
}
strandCountIdx = fields.FindField(ConfigUtil.NumberOfFibersFieldName);
if (-1 == strandCountIdx)
{
throw new InvalidOperationException(string.Format(missingFieldFormat, ConfigUtil.NumberOfFibersFieldName));
}
#endregion
ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel = new ESRI.ArcGIS.Display.CancelTrackerClass();
ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog = _hookHelper.CreateProgressDialog(trackCancel, "Preparing to configure cable...", 1, configuration.TotalFiberCount, 1, "Starting edit operation...", "Fiber Configuration");
ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = (ESRI.ArcGIS.esriSystem.IStepProgressor)progressDialog;
progressDialog.ShowDialog();
stepProgressor.Step();
if (!isExistingOperation)
{
_editor.StartOperation();
isOurOperationOpen = true;
}
try
{
if (DBNull.Value == feature.get_Value(ipidIdx))
{
feature.set_Value(ipidIdx, fiberCableIpid);
}
else
{
fiberCableIpid = feature.get_Value(ipidIdx).ToString();
}
feature.set_Value(bufferCountIdx, configuration.BufferCount);
feature.set_Value(strandCountIdx, configuration.TotalFiberCount);
isComplete = GenerateUnits(feature, configuration, progressDialog, trackCancel);
progressDialog.Description = "Completing configuration...";
stepProgressor.Step();
if (isOurOperationOpen)
{
//.........这里部分代码省略.........
示例3: GenerateUnits
/// <summary>
/// Generates a number of buffer tubes and fiber records for a fiber cable, given a configuration.
/// </summary>
/// <param name="feature">IFeature to generate for</param>
/// <param name="configuration">Specification of buffer and fiber counts</param>
/// <param name="progressDialog">Progress dialog for user notification</param>
/// <param name="trackCancel">TrackCancel used in the progress dialog</param>
/// <returns>Success</returns>
private bool GenerateUnits(ESRI.ArcGIS.Geodatabase.IFeature feature, FiberCableConfiguration configuration, ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog, ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel)
{
bool isComplete = false;
bool isCancelled = false;
Guid g;
ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = (ESRI.ArcGIS.esriSystem.IStepProgressor)progressDialog;
ESRI.ArcGIS.Geodatabase.IObjectClass ftClass = feature.Class;
using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
{
ESRI.ArcGIS.Geodatabase.IRelationshipClass cableHasBuffer = GdbUtils.GetRelationshipClass(ftClass, ConfigUtil.FiberCableToBufferRelClassName);
releaser.ManageLifetime(cableHasBuffer);
ESRI.ArcGIS.Geodatabase.IRelationshipClass cableHasFiber = GdbUtils.GetRelationshipClass(ftClass, ConfigUtil.FiberCableToFiberRelClassName);
releaser.ManageLifetime(cableHasFiber);
ESRI.ArcGIS.Geodatabase.IRelationshipClass bufferHasFiber = GdbUtils.GetRelationshipClass(ftClass, ConfigUtil.BufferToFiberRelClassName);
releaser.ManageLifetime(bufferHasFiber);
ESRI.ArcGIS.Geodatabase.ITable bufferTable = cableHasBuffer.DestinationClass as ESRI.ArcGIS.Geodatabase.ITable;
ESRI.ArcGIS.Geodatabase.ITable fiberTable = cableHasFiber.DestinationClass as ESRI.ArcGIS.Geodatabase.ITable;
// Fields to populate on buffer
int bufferIpidIdx = bufferTable.Fields.FindField(ConfigUtil.IpidFieldName);
int fiberCountIdx = bufferTable.Fields.FindField(ConfigUtil.NumberOfFibersFieldName);
int bufferToCableIdx = bufferTable.Fields.FindField(cableHasBuffer.OriginForeignKey);
object bufferToCableValue = feature.get_Value(feature.Fields.FindField(cableHasBuffer.OriginPrimaryKey));
// Fields to populate on fiber
int fiberIpidIdx = fiberTable.Fields.FindField(ConfigUtil.IpidFieldName);
int fiberNumberIdx = fiberTable.Fields.FindField(ConfigUtil.Fiber_NumberFieldName);
int fiberToCableIdx = fiberTable.Fields.FindField(cableHasFiber.OriginForeignKey);
object fiberToCableValue = feature.get_Value(feature.Fields.FindField(cableHasFiber.OriginPrimaryKey));
int fiberToBufferIdx = fiberTable.Fields.FindField(bufferHasFiber.OriginForeignKey);
int fiberToBufferValueIdx = bufferTable.Fields.FindField(bufferHasFiber.OriginPrimaryKey);
// Research using InsertCursor for speed.
int fiberNumber = 0;
for (int bufferIdx = 1; bufferIdx <= configuration.BufferCount; bufferIdx++)
{
g = Guid.NewGuid();
string bufferId = g.ToString("B").ToUpper();
ESRI.ArcGIS.Geodatabase.IRow row = bufferTable.CreateRow();
releaser.ManageLifetime(row);
row.set_Value(bufferIpidIdx, bufferId);
row.set_Value(fiberCountIdx, configuration.FibersPerTube);
row.set_Value(bufferToCableIdx, bufferToCableValue);
row.Store();
object fiberToBufferValue = row.get_Value(fiberToBufferValueIdx);
// Research using InsertCursor for speed.
for (int fiberIdx = 1; fiberIdx <= configuration.FibersPerTube; fiberIdx++)
{
fiberNumber++;
progressDialog.Description = string.Format("Creating fiber {0} of {1}", fiberNumber, configuration.TotalFiberCount);
stepProgressor.Step();
g = Guid.NewGuid();
ESRI.ArcGIS.Geodatabase.IRow fiberRow = fiberTable.CreateRow();
releaser.ManageLifetime(fiberRow);
fiberRow.set_Value(fiberIpidIdx, g.ToString("B").ToUpper());
fiberRow.set_Value(fiberNumberIdx, fiberNumber);
fiberRow.set_Value(fiberToBufferIdx, fiberToBufferValue);
fiberRow.set_Value(fiberToCableIdx, fiberToCableValue);
fiberRow.Store();
if (!trackCancel.Continue())
{
isCancelled = true;
break;
}
}
if (!trackCancel.Continue())
{
isCancelled = true;
break;
}
}
if (!isCancelled)
{
isComplete = true;
}
}
return isComplete;
//.........这里部分代码省略.........
示例4: GetDomainedIntName
/// <summary>
/// Returns a nullable int value for a given field on a feature. If the field uses a coded value domain, the name for
/// the value is returned.
/// </summary>
/// <param name="feature">IFeature</param>
/// <param name="fieldName">Name of the field that holds the value</param>
/// <returns>int?</returns>
public static int? GetDomainedIntName(ESRI.ArcGIS.Geodatabase.IFeature feature, string fieldName)
{
int? result = null;
#region Validation
if (null == feature)
{
throw new ArgumentNullException("feature");
}
int fieldIdx = feature.Fields.FindField(fieldName);
if (-1 == fieldIdx)
{
string message = string.Format("Field {0} does not exist.", fieldName);
throw new ArgumentException(message);
}
#endregion
object objValue = feature.get_Value(fieldIdx);
if (DBNull.Value != objValue)
{
ESRI.ArcGIS.Geodatabase.IField field = feature.Fields.get_Field(fieldIdx);
string valueString = CheckForCodedName(field, objValue);
int parseResult = -1;
if (!int.TryParse(valueString, out parseResult))
{
string message = string.Format("{0} value {1} could not be parsed to int.", fieldName, valueString);
throw new Exception(message);
}
else
{
result = parseResult;
}
}
return result;
}
示例5: GetDomainValueForName
/// <summary>
/// Finds the actual value of a given name of a coded value domain
/// </summary>
/// <param name="domain">CodedValueDomain to check</param>
/// <param name="name">Name of the desired value</param>
/// <returns>The value</returns>
public static object GetDomainValueForName(ESRI.ArcGIS.Geodatabase.ICodedValueDomain domain, string name)
{
object result = null;
if (null == domain)
{
throw new ArgumentNullException("domain");
}
for (int i = 0; i < domain.CodeCount; i++)
{
string testName = domain.get_Name(i);
if (0 == string.Compare(name, testName))
{
result = domain.get_Value(i);
break;
}
}
if (null == result)
{
throw new Exception(string.Format("name {0} not found in the domain {1}", name, ((ESRI.ArcGIS.Geodatabase.IDomain)domain).Name));
}
return result;
}
示例6: GetDomainNameForValue
/// <summary>
/// Finds the display name for a given value in a coded value domain
/// </summary>
/// <param name="domain">CodedValueDomain to check</param>
/// <param name="value">The value</param>
/// <returns>The name, or string.Empty if not found</returns>
public static string GetDomainNameForValue(ESRI.ArcGIS.Geodatabase.ICodedValueDomain domain, object value)
{
string result = string.Empty;
if (null == domain)
{
throw new ArgumentNullException("domain");
}
for (int i = 0; i < domain.CodeCount; i++)
{
object testValue = domain.get_Value(i);
if (testValue.Equals(value))
{
result = domain.get_Name(i);
break;
}
}
if (null == result)
{
throw new Exception(string.Format("value {0} not found in the domain {1}", value, ((ESRI.ArcGIS.Geodatabase.IDomain)domain).Name));
}
return result;
}
示例7: CompleteXMLEltByProperties
// The following CompleteXMLEltByProperties private procedure is used to create all the expected propertyset properties listed in the input PropertiesArray array
private void CompleteXMLEltByProperties(ESRI.ArcGIS.Geodatabase.IFeature inFeature,
ref MSXML2.DOMDocument outDOMDoc,
ref MSXML2.IXMLDOMElement outXMLElement,
string[] propertiesArray)
{
int i = 0;
MSXML2.IXMLDOMElement xmlPropertySet;
MSXML2.IXMLDOMElement xmlPropertyArray;
MSXML2.IXMLDOMElement xmlPropertySetProperty;
MSXML2.IXMLDOMElement xmlProperty_Key;
MSXML2.IXMLDOMElement xmlProperty_Value;
if (propertiesArray.Length > 0)
{
//-------- PropertySet Section START --------
// Creating the PropertySet element for the input outXMLElement
xmlPropertySet = outDOMDoc.createElement("PropertySet");
outXMLElement.appendChild(xmlPropertySet);
// Creating the PropertyArray element
xmlPropertyArray = outDOMDoc.createElement("PropertyArray");
xmlPropertySet.appendChild(xmlPropertyArray);
while (i < propertiesArray.Length)
{
// Creating the i PropertySetProperty
xmlPropertySetProperty = outDOMDoc.createElement("PropertySetProperty");
xmlPropertyArray.appendChild(xmlPropertySetProperty);
// Specifying the key && value field related to that i PropertySetProperty
xmlProperty_Key = outDOMDoc.createElement("Key");
xmlPropertySetProperty.appendChild(xmlProperty_Key);
xmlProperty_Key.nodeTypedValue = propertiesArray[i].ToString();
xmlProperty_Value = outDOMDoc.createElement("Value");
xmlPropertySetProperty.appendChild(xmlProperty_Value);
xmlProperty_Value.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField(propertiesArray[i].ToString()));
i += 1;
}
}
//-------- PropertySet Section END --------
}
示例8: CreateXMLNodeElt
// The following CreateXMLLNodeElt private procedure is used to create all the expected
// XML items for a XML NodeFeature related to a Station or Feeder simple junction feature
private void CreateXMLNodeElt(ESRI.ArcGIS.Geodatabase.IFeature inFeature, ref MSXML2.DOMDocument outDOMDoc, ref MSXML2.IXMLDOMElement outXMLElements, string inNodeTypeName)
{
if (!inFeature.HasOID)
{
MessageBox.Show("No OID");
return;
}
MSXML2.IXMLDOMElement xmlNode;
MSXML2.IXMLDOMElement xmlNode_XCoord;
MSXML2.IXMLDOMElement xmlNode_YCoord;
MSXML2.IXMLDOMElement xmlNode_RelatedContainerID;
bool relatedContainer;
MSXML2.IXMLDOMNodeList xmlNodeList;
MSXML2.IXMLDOMElement xmlDrawing;
MSXML2.IXMLDOMElement xmlDrawing_EltTypeName;
MSXML2.IXMLDOMElement xmlDrawing_ExternalUID;
//-------- Feature Section START related to the "infeature" --------
// Creating the NodeFeature element
xmlNode = outDOMDoc.createElement("NodeFeature");
outXMLElements.appendChild(xmlNode);
// Specifying basic XML items for this NodeFeature
CreateBasicXMLItemsForSchematicElt(inFeature, ref outDOMDoc, ref xmlNode, inNodeTypeName);
// Specifying its X && Y when they exist
if ((inFeature.Fields.FindField("X") > 0) && (inFeature.Fields.FindField("Y") > 0))
{
// Specifying InitialX
xmlNode_XCoord = outDOMDoc.createElement("InitialX");
xmlNode.appendChild(xmlNode_XCoord);
xmlNode_XCoord.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("X"));
// Specifying InitialY
xmlNode_YCoord = outDOMDoc.createElement("InitialY");
xmlNode.appendChild(xmlNode_YCoord);
xmlNode_YCoord.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("Y"));
}
else
{
// Retrieving initial position from Geometry
ESRI.ArcGIS.Geometry.IPoint oPoint = (ESRI.ArcGIS.Geometry.IPoint)inFeature.ShapeCopy;
if (oPoint != null)
{
// Specifying InitialX
xmlNode_XCoord = outDOMDoc.createElement("InitialX");
xmlNode.appendChild(xmlNode_XCoord);
xmlNode_XCoord.nodeTypedValue = oPoint.X;
// Specifying InitialY
xmlNode_YCoord = outDOMDoc.createElement("InitialY");
xmlNode.appendChild(xmlNode_YCoord);
xmlNode_YCoord.nodeTypedValue = oPoint.Y;
}
}
xmlNode_RelatedContainerID = outDOMDoc.createElement("RelatedContainerID");
xmlNode.appendChild(xmlNode_RelatedContainerID);
// Specifying its properties
switch (inFeature.Class.AliasName)
{
case "Station":
{
xmlNode_RelatedContainerID.nodeTypedValue = "Container-" + System.Convert.ToString(inFeature.get_Value(inFeature.Fields.FindField("Feeder")));
// For Station feature, the field contained in the StationsPropertiesArray will be exported
CompleteXMLEltByProperties(inFeature, ref outDOMDoc, ref xmlNode, m_stationsPropertiesArray);
break;
}
case "Feeder":
{
xmlNode_RelatedContainerID.nodeTypedValue = "Container-" + inFeature.OID.ToString();
// For Feeder feature, the field contained in the StationsPropertiesArray will be exported
CompleteXMLEltByProperties(inFeature, ref outDOMDoc, ref xmlNode, m_feedersPropertiesArray);
break;
}
}
//-------- Feature Section END related to the "infeature" --------
// Checking the existence of the related container
xmlNodeList = outXMLElements.selectNodes("NodeFeature/ExternalUniqueID");
relatedContainer = false;
foreach (MSXML2.IXMLDOMNode node in xmlNodeList)
{
if (node.text == xmlNode_RelatedContainerID.nodeTypedValue.ToString())
{
relatedContainer = true;
break;
}
} // pNode
// Creating the related container when it doesn//t already exist
if (!relatedContainer)
{
xmlDrawing = outDOMDoc.createElement("NodeFeature");
outXMLElements.appendChild(xmlDrawing);
// Specifying its FeatureClassName
//.........这里部分代码省略.........
示例9: CreateXMLLinkElt
// The following CreateXMLLinkElt private procedure is used to create all the expected XML items for a XML LinkFeature related to a HV_Line or LV_Line simple edge feature
private void CreateXMLLinkElt(ESRI.ArcGIS.Geodatabase.IFeature inFeature, ref MSXML2.DOMDocument outDOMDoc, ref MSXML2.IXMLDOMElement outXMLElements, string inLinkTypeName)
{
if (!inFeature.HasOID)
{
MessageBox.Show("No OID");
return;
}
MSXML2.IXMLDOMElement xmlLink;
MSXML2.IXMLDOMElement xmlLink_FromNode;
MSXML2.IXMLDOMElement xmlLink_ToNode;
int indexListPoints;
string listPoints;
int nbVertices;
string vertices;
MSXML2.IXMLDOMElement xmlLink_Vertices;
MSXML2.IXMLDOMElement xmlLink_Vertex;
MSXML2.IXMLDOMElement xmlLink_XVertex;
MSXML2.IXMLDOMElement xmlLink_YVertex;
string xValue;
string yValue;
//-------- Feature Section START related to the "infeature" --------
// Creating the LinkFeature Feature
xmlLink = outDOMDoc.createElement("LinkFeature");
outXMLElements.appendChild(xmlLink);
// Specifying basic XML items for this LinkFeature
CreateBasicXMLItemsForSchematicElt(inFeature, ref outDOMDoc, ref xmlLink, inLinkTypeName);
// Specifying its FromNode
xmlLink_FromNode = outDOMDoc.createElement("FromNode");
xmlLink.appendChild(xmlLink_FromNode);
xmlLink_FromNode.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("FromJunctionType")) + "-" + inFeature.get_Value(inFeature.Fields.FindField("FromJunctionOID"));
// Specifying its ToNode
xmlLink_ToNode = outDOMDoc.createElement("ToNode");
xmlLink.appendChild(xmlLink_ToNode);
xmlLink_ToNode.nodeTypedValue = inFeature.get_Value(inFeature.Fields.FindField("ToJunctionType")) + "-" + inFeature.get_Value(inFeature.Fields.FindField("ToJunctionOID"));
//Add Vertices to LinkFeature ---- NEED TO BE COMPLETED
indexListPoints = inFeature.Fields.FindField("ListPoints");
if (indexListPoints > 0)
{
listPoints = "";
listPoints = inFeature.get_Value(indexListPoints).ToString();
if (listPoints != "")
{
int foundChar = listPoints.IndexOf(";", 1);
nbVertices = System.Convert.ToInt32(listPoints.Substring(0, foundChar));
vertices = listPoints.Substring(foundChar + 1);
if (nbVertices > 0)
{
// Specifying its Vertices
xmlLink_Vertices = outDOMDoc.createElement("Vertices");
xmlLink.appendChild(xmlLink_Vertices);
int iLoc;
for (int i = 1; i <= nbVertices; i++)
{
xValue = "";
yValue = "";
iLoc = vertices.IndexOf(";", 1);
if (vertices != "" && (iLoc) > 0)
{
xValue = vertices.Substring(0, iLoc);
}
vertices = vertices.Substring(iLoc + 1);
iLoc = vertices.IndexOf(";", 1);
if (vertices != ";" && (iLoc) > 0)
{
yValue = vertices.Substring(0, iLoc);
}
if (xValue != "" && yValue != "")
{
xmlLink_Vertex = outDOMDoc.createElement("Vertex");
xmlLink_Vertices.appendChild(xmlLink_Vertex);
xmlLink_XVertex = outDOMDoc.createElement("X");
xmlLink_Vertex.appendChild(xmlLink_XVertex);
xmlLink_XVertex.nodeTypedValue = xValue;
xmlLink_YVertex = outDOMDoc.createElement("Y");
xmlLink_Vertex.appendChild(xmlLink_YVertex);
xmlLink_YVertex.nodeTypedValue = yValue;
if (vertices.Length - iLoc > 0)
{
vertices = vertices.Substring(iLoc + 1); //sVertices.Length - iLoc)
}
else
{
break;
}
}
else
{
break;
}
}
}
}
}
//.........这里部分代码省略.........
示例10: GetFiberRecord
/// <summary>
/// Gets the fiber record for a given fiber number on a given cable ft
/// </summary>
/// <param name="cableFeature"></param>
/// <param name="fiberNumber"></param>
/// <returns>IRow</returns>
private ESRI.ArcGIS.Geodatabase.IRow GetFiberRecord(ESRI.ArcGIS.Geodatabase.IFeature cableFeature, int fiberNumber)
{
ESRI.ArcGIS.Geodatabase.IRow result = null;
ESRI.ArcGIS.Geodatabase.IRelationshipClass fiberRelationship = GdbUtils.GetRelationshipClass(cableFeature.Class, ConfigUtil.FiberCableToFiberRelClassName);
if (null != fiberRelationship && null != fiberRelationship.DestinationClass)
{
ESRI.ArcGIS.Geodatabase.ITable fiberTable = fiberRelationship.DestinationClass as ESRI.ArcGIS.Geodatabase.ITable;
if (null != fiberTable)
{
ESRI.ArcGIS.Geodatabase.IQueryFilter filter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
filter.WhereClause = string.Format("{0}='{1}' AND {2}={3}",
fiberRelationship.OriginForeignKey,
cableFeature.get_Value(cableFeature.Fields.FindField(fiberRelationship.OriginPrimaryKey)),
ConfigUtil.Fiber_NumberFieldName,
fiberNumber);
ESRI.ArcGIS.Geodatabase.ICursor cursor = null;
try
{
cursor = fiberTable.Search(filter, false);
result = cursor.NextRow();
}
finally
{
if (null != cursor)
{
ESRI.ArcGIS.ADF.ComReleaser.ReleaseCOMObject(cursor);
}
}
}
}
return result;
}
示例11: TracePath
///// <summary>
///// The active view has refreshed. Redraw our results, if we have any
///// </summary>
///// <param name="Display">Display to draw on</param>
///// <param name="phase"></param>
//private void _arcMapWrapper_ActiveViewAfterDraw(ESRI.ArcGIS.Display.IDisplay Display, ESRI.ArcGIS.Carto.esriViewDrawPhase phase)
//{
// if (phase == ESRI.ArcGIS.Carto.esriViewDrawPhase.esriViewGeoSelection)
// {
// // Draw after the selection
// if (null != _currentResults)
// {
// ESRI.ArcGIS.Display.ILineSymbol lineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbol();
// ESRI.ArcGIS.Display.IRgbColor color = new ESRI.ArcGIS.Display.RgbColorClass();
// color.Red = 255;
// color.Green = 0;
// color.Blue = 0;
// lineSymbol.Color = color;
// lineSymbol.Width = 4;
// ESRI.ArcGIS.Display.ISimpleMarkerSymbol markerSymbol = new ESRI.ArcGIS.Display.SimpleMarkerSymbolClass();
// markerSymbol.Color = color;
// markerSymbol.Style = ESRI.ArcGIS.Display.esriSimpleMarkerStyle.esriSMSCircle;
// markerSymbol.Size = 6;
// for (int i = 0; i < _currentResults.Count; i++)
// {
// ESRI.ArcGIS.Geometry.IGeometry geometry = _currentResults[i];
// if (geometry is ESRI.ArcGIS.Geometry.IPolyline)
// {
// Display.SetSymbol((ESRI.ArcGIS.Display.ISymbol)lineSymbol);
// Display.DrawPolyline((ESRI.ArcGIS.Geometry.IPolyline)geometry);
// }
// else if (geometry is ESRI.ArcGIS.Geometry.IPoint)
// {
// Display.SetSymbol((ESRI.ArcGIS.Display.ISymbol)markerSymbol);
// Display.DrawPoint((ESRI.ArcGIS.Geometry.IPoint)geometry);
// }
// }
// }
// }
//}
private List<ESRI.ArcGIS.Geodatabase.IRow> TracePath(ESRI.ArcGIS.Geodatabase.IFeature cableFeature, int fiberNumber, bool isStartingAtFromEnd)
{
List<ESRI.ArcGIS.Geodatabase.IRow> result = new List<ESRI.ArcGIS.Geodatabase.IRow>();
string ipid = cableFeature.get_Value(cableFeature.Fields.FindField(ConfigUtil.IpidFieldName)).ToString();
ESRI.ArcGIS.Geodatabase.IFeatureClass cableFtClass = (ESRI.ArcGIS.Geodatabase.IFeatureClass)cableFeature.Class;
ESRI.ArcGIS.Geodatabase.IFeatureClass spliceFtClass = _wkspHelper.FindFeatureClass(ConfigUtil.SpliceClosureFtClassName);
ESRI.ArcGIS.Geodatabase.ITable fiberSpliceTable = _wkspHelper.FindTable(ConfigUtil.FiberSpliceTableName);
ESRI.ArcGIS.Geodatabase.IFields spliceFields = fiberSpliceTable.Fields;
string fiberClassName = ConfigUtil.FiberTableName;
ESRI.ArcGIS.Geodatabase.IRelationshipClass fiberRelationship = GdbUtils.GetRelationshipClass(cableFtClass, ConfigUtil.FiberCableToFiberRelClassName);
if (null != fiberRelationship && null != fiberRelationship.DestinationClass)
{
fiberClassName = GdbUtils.ParseTableName(fiberRelationship.DestinationClass as ESRI.ArcGIS.Geodatabase.IDataset);
}
ESRI.ArcGIS.Geodatabase.ITable fiberTable = _wkspHelper.FindTable(fiberClassName);
_aCableIdx = spliceFields.FindField(ConfigUtil.ACableIdFieldName);
_bCableIdx = spliceFields.FindField(ConfigUtil.BCableIdFieldName);
_aFiberNumIdx = spliceFields.FindField(ConfigUtil.AFiberNumberFieldName);
_bFiberNumIdx = spliceFields.FindField(ConfigUtil.BFiberNumberFieldName);
_isAFromIdx = spliceFields.FindField(ConfigUtil.IsAFromEndFieldName);
_isBFromIdx = spliceFields.FindField(ConfigUtil.IsBFromEndFieldName);
_spliceClosureIpidIdx = spliceFields.FindField(ConfigUtil.SpliceClosureIpidFieldName);
ESRI.ArcGIS.Geodatabase.IQueryFilter spliceFilter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
spliceFilter.WhereClause = string.Format("({0}='{1}' AND {2}={3})"
+ " OR ({4}='{1}' AND {5}={3})",
ConfigUtil.ACableIdFieldName,
ipid,
ConfigUtil.AFiberNumberFieldName,
fiberNumber,
ConfigUtil.BCableIdFieldName,
ConfigUtil.BFiberNumberFieldName);
int connections = fiberSpliceTable.RowCount(spliceFilter);
if (2 < connections)
{
// TODO: warning?
System.Windows.Forms.MessageBox.Show("Less than 2 connections were detected: " + fiberNumber, "Telecom Trace", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
}
string spliceClosureIpid = string.Empty;
string nextCableId = string.Empty;
int nextFiberNumber = -1;
bool isNextFromEnd = false;
// {{0}} causes the string.format to
string cableWhereFormat = string.Format("{0}='{{0}}'", ConfigUtil.IpidFieldName);
string spliceWhereFormat = string.Format("{0}='{{0}}'", ConfigUtil.IpidFieldName);
string fiberWhereFormat = string.Format("{0}='{{0}}' AND {1}={{1}}", fiberRelationship.OriginForeignKey, ConfigUtil.Fiber_NumberFieldName);
using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
{
ESRI.ArcGIS.Geodatabase.IQueryFilter filter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
//.........这里部分代码省略.........
示例12: GetConnectedPort
/// <summary>
/// Finds the connected device/port
/// </summary>
/// <param name="siblingFtClass">Any feature class from the workspace</param>
/// <param name="cableId">Cable ID to check connx for</param>
/// <param name="fiberNumber">Fiber Number to check connx for</param>
/// <param name="isFromEnd">Whether to check the cable's from or to end</param>
/// <param name="portRow">(out) result port</param>
/// <param name="deviceFt">(out) result device</param>
/// <returns>True if a connx was found</returns>
private bool GetConnectedPort(ESRI.ArcGIS.Geodatabase.IFeatureClass siblingFtClass, string cableId, int fiberNumber, bool isFromEnd, out ESRI.ArcGIS.Geodatabase.IRow portRow, out ESRI.ArcGIS.Geodatabase.IFeature deviceFt)
{
portRow = null;
deviceFt = null;
bool result = false;
string[] portTableNames = ConfigUtil.PortTableNames;
using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
{
ESRI.ArcGIS.Geodatabase.IQueryFilter filter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
filter.WhereClause = string.Format("{0}='{1}' AND {2}={3} AND {4}='{5}'",
ConfigUtil.ConnectedCableFieldName,
cableId,
ConfigUtil.ConnectedFiberFieldName,
fiberNumber,
ConfigUtil.ConnectedEndFieldName,
isFromEnd ? "T" : "F");
releaser.ManageLifetime(filter);
for (int i = 0; i < portTableNames.Length; i++)
{
string portTableName = portTableNames[i];
ESRI.ArcGIS.Geodatabase.ITable portTable = _wkspHelper.FindTable(portTableName);
ESRI.ArcGIS.Geodatabase.ICursor cursor = portTable.Search(filter, false);
releaser.ManageLifetime(cursor);
portRow = cursor.NextRow();
if (null != portRow)
{
ESRI.ArcGIS.Geodatabase.IRelationshipClass deviceHasPorts = ConfigUtil.GetDeviceRelationship(portTable);
if (null == deviceHasPorts)
{
throw new Exception("Device to port relationship is missing or cannot be opened.");
}
ESRI.ArcGIS.Geodatabase.IFeatureClass deviceClass = deviceHasPorts.OriginClass as ESRI.ArcGIS.Geodatabase.IFeatureClass;
if (null == deviceClass)
{
throw new Exception("Device feature class is missing or cannot be opened.");
}
filter.WhereClause = string.Format("{0}='{1}'",
deviceHasPorts.OriginPrimaryKey,
portRow.get_Value(portTable.FindField(deviceHasPorts.OriginForeignKey)));
ESRI.ArcGIS.Geodatabase.IFeatureCursor deviceCursor = deviceClass.Search(filter, false);
deviceFt = deviceCursor.NextFeature();
result = true;
break;
}
}
}
return result;
}
示例13: GeneratePorts
/// <summary>
/// Generate the ports for a given device
/// </summary>
/// <param name="device">The device feature</param>
/// <returns>True if completed</returns>
private bool GeneratePorts(ESRI.ArcGIS.Geodatabase.IFeature device, int lowInputPort, int inputPortCount, int lowOutputPort, int outputPortCount, ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog, ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel)
{
bool isCancelled = false;
ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = (ESRI.ArcGIS.esriSystem.IStepProgressor)progressDialog;
ESRI.ArcGIS.Geodatabase.IRelationshipClass deviceHasPorts = ConfigUtil.GetPortRelationship((ESRI.ArcGIS.Geodatabase.IFeatureClass)device.Class);
Guid g;
if (null != deviceHasPorts)
{
using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
{
ESRI.ArcGIS.Geodatabase.ITable portTable = (ESRI.ArcGIS.Geodatabase.ITable)deviceHasPorts.DestinationClass;
releaser.ManageLifetime(portTable);
// Fields to populate on port
int portIpidIdx = portTable.Fields.FindField(ConfigUtil.IpidFieldName);
int portNumberIdx = portTable.Fields.FindField(ConfigUtil.PortIdFieldName);
int portTypeIdx = portTable.Fields.FindField(ConfigUtil.PortTypeFieldName);
int fkeyIdx = portTable.Fields.FindField(deviceHasPorts.OriginForeignKey);
object originPrimaryKey = device.get_Value(device.Fields.FindField(deviceHasPorts.OriginPrimaryKey));
for (int portIdx = lowInputPort; portIdx <= inputPortCount; portIdx++)
{
stepProgressor.Message = string.Format("Creating input port {0} of {1}", portIdx, inputPortCount);
stepProgressor.Step();
g = Guid.NewGuid();
string portIpid = g.ToString("B").ToUpper();
ESRI.ArcGIS.Geodatabase.IRow portRow = portTable.CreateRow();
releaser.ManageLifetime(portRow);
portRow.set_Value(portIpidIdx, portIpid);
portRow.set_Value(portTypeIdx, PortType.Input);
portRow.set_Value(portNumberIdx, portIdx);
portRow.set_Value(fkeyIdx, originPrimaryKey);
portRow.Store();
if (!trackCancel.Continue())
{
isCancelled = true;
break;
}
}
if (trackCancel.Continue())
{
for (int portIdx = lowOutputPort; portIdx <= outputPortCount; portIdx++)
{
stepProgressor.Message = string.Format("Creating output port {0} of {1}", portIdx, outputPortCount);
stepProgressor.Step();
g = Guid.NewGuid();
string portIpid = g.ToString("B").ToUpper();
ESRI.ArcGIS.Geodatabase.IRow portRow = portTable.CreateRow();
releaser.ManageLifetime(portRow);
portRow.set_Value(portIpidIdx, portIpid);
portRow.set_Value(portTypeIdx, PortType.Output);
portRow.set_Value(portNumberIdx, portIdx);
portRow.set_Value(fkeyIdx, originPrimaryKey);
portRow.Store();
if (!trackCancel.Continue())
{
isCancelled = true;
break;
}
}
}
}
}
return !isCancelled;
}
示例14: DeletePorts
/// <summary>
/// Delete the ports for a given device
/// </summary>
/// <param name="device">The device feature</param>
/// <returns>True if completed</returns>
private bool DeletePorts(ESRI.ArcGIS.Geodatabase.IFeature device, int highInputPort, int highOutputPort, ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog, ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel)
{
bool isCancelled = false;
ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = (ESRI.ArcGIS.esriSystem.IStepProgressor)progressDialog;
ESRI.ArcGIS.Geodatabase.IRelationshipClass deviceHasPorts = ConfigUtil.GetPortRelationship((ESRI.ArcGIS.Geodatabase.IFeatureClass)device.Class);
if (null != deviceHasPorts)
{
using (ESRI.ArcGIS.ADF.ComReleaser releaser = new ESRI.ArcGIS.ADF.ComReleaser())
{
ESRI.ArcGIS.Geodatabase.ITable portTable = (ESRI.ArcGIS.Geodatabase.ITable)deviceHasPorts.DestinationClass;
releaser.ManageLifetime(portTable);
ESRI.ArcGIS.Geodatabase.IQueryFilter filter = new ESRI.ArcGIS.Geodatabase.QueryFilterClass();
releaser.ManageLifetime(filter);
filter.WhereClause = string.Format("{0}='{1}' AND {2} > {3} AND {4}='{5}'",
deviceHasPorts.OriginForeignKey,
device.get_Value(device.Fields.FindField(deviceHasPorts.OriginPrimaryKey)),
ConfigUtil.PortIdFieldName,
highInputPort,
ConfigUtil.PortTypeFieldName,
1);
stepProgressor.Message = "Deleting higher input ports...";
int deletedPorts = portTable.RowCount(filter);
portTable.DeleteSearchedRows(filter);
for (int i = 0; i < deletedPorts; i++)
{
stepProgressor.Step();
}
filter.WhereClause = string.Format("{0}='{1}' AND {2} > {3} AND {4}='{5}'",
deviceHasPorts.OriginForeignKey,
device.get_Value(device.Fields.FindField(deviceHasPorts.OriginPrimaryKey)),
ConfigUtil.PortIdFieldName,
highOutputPort,
ConfigUtil.PortTypeFieldName,
2);
stepProgressor.Message = "Deleting higher output ports...";
deletedPorts = portTable.RowCount(filter);
portTable.DeleteSearchedRows(filter);
for (int i = 0; i < deletedPorts; i++)
{
stepProgressor.Step();
}
}
}
return !isCancelled;
}
示例15: ConfigureDevice
//.........这里部分代码省略.........
}
#endregion
// Are we RE-configuring?
// int? oldInputPorts = GdbUtils.GetDomainedIntName(feature, ConfigUtil.InputPortsFieldName);
// int? oldOutputPorts = GdbUtils.GetDomainedIntName(feature, ConfigUtil.OutputPortsFieldName);
// int inputPortDifference = oldInputPorts.HasValue ? Math.Abs(inputPorts - oldInputPorts.Value) : inputPorts;
// int outputPortDifference = oldOutputPorts.HasValue ? Math.Abs(outputPorts - oldOutputPorts.Value) : outputPorts;
ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel = new ESRI.ArcGIS.Display.CancelTrackerClass();
ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog = _hookHelper.CreateProgressDialog(trackCancel, "Configuring device...", 1, inputPorts + outputPorts, 1, "Starting edit operation...", "Device Configuration");
// ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog = CreateProgressDialog(trackCancel, "Configuring device...", 1, inputPortDifference + outputPortDifference + 2, 1, "Starting edit operation...", "Device Configuration");
ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = (ESRI.ArcGIS.esriSystem.IStepProgressor)progressDialog;
progressDialog.ShowDialog();
stepProgressor.Step();
if (!isExistingOperation)
{
try
{
_editor.StartOperation();
isOurOperationOpen = true;
}
catch (Exception ex)
{
throw new Exception("Failed to start edit operation.", ex);
}
}
try
{
feature.set_Value(inPortsIdx, inputPorts);
feature.set_Value(outPortsIdx, outputPorts);
if (DBNull.Value == feature.get_Value(ipidIdx))
{
Guid g = Guid.NewGuid();
deviceIpid = g.ToString("B").ToUpper();
feature.set_Value(ipidIdx, deviceIpid);
}
else
{
deviceIpid = feature.get_Value(ipidIdx).ToString();
}
// if (!oldOutputPorts.HasValue && !oldInputPorts.HasValue)
// {
isComplete = GeneratePorts(feature, 1, inputPorts, 1, outputPorts, progressDialog, trackCancel);
// }
// else
// {
// bool additionsComplete = false;
// bool deletionsComplete = false;
//
// additionsComplete = GeneratePorts(feature, oldInputPorts.Value + 1, oldInputPorts.Value + inputPortDifference, oldOutputPorts.Value + 1, oldOutputPorts.Value + outputPortDifference, progressDialog, trackCancel);
// deletionsComplete = DeletePorts(feature, inputPorts, outputPorts, progressDialog, trackCancel);
//
// isComplete = additionsComplete && deletionsComplete;
// }
if (isComplete)
{
stepProgressor.Message = "Finishing configuration...";
stepProgressor.Step();
if (isOurOperationOpen)
{
feature.Store();
_editor.StopOperation("Configure Device");
}
}
else
{
stepProgressor.Message = "Cancelling configuration...";
stepProgressor.Step();
if (isOurOperationOpen)
{
_editor.AbortOperation();
}
}
}
catch
{
if (isOurOperationOpen)
{
_editor.AbortOperation();
}
}
if (null != progressDialog)
{
progressDialog.HideDialog();
}
return isComplete;
}