Performs the operations necessary to move a MOLE Force Element.
[C#]
///<summary>Performs the operations necessary to move a MOLE Force Element.</summary>
///
///<param name="display">An IDisplay interface</param>
///<param name="cachedGraphic">An ICachedGraphic interface</param>
///<param name="point">An IPoint interface</param>
///
///<remarks>Pass the ICachedGraphic to move and the Point to move graphic. An IDisplay (preferably ActiveView.ScreenDisplay) is also required for redrawing.</remarks>
public void MoveForceElement(ESRI.ArcGIS.Display.IDisplay display, ESRI.ArcGIS.DefenseSolutions.ICachedGraphic cachedGraphic, ESRI.ArcGIS.Geometry.IPoint point)
{
ESRI.ArcGIS.DefenseSolutions.IFEGraphic feGraphic = cachedGraphic as ESRI.ArcGIS.DefenseSolutions.IFEGraphic; // Dynamic Cast
if (feGraphic == null)
{
System.Diagnostics.Trace.WriteLine("ICachedGraphic is not an IFEGraphic. Aborting.");
return;
}
ESRI.ArcGIS.DefenseSolutions.IForceElement forceElement = feGraphic.ForceElement;
if (forceElement == null)
{
System.Diagnostics.Trace.WriteLine("IForceElement is null. Aborting.");
return;
}
forceElement.Shape = point;
// Currently must call refresh to get the position to update
cachedGraphic.Refresh(display);
}
[Visual Basic .NET]
'''<summary>Performs the operations necessary to move a MOLE Force Element.</summary>
'''
'''<param name="display">An IDisplay interface</param>
'''<param name="cachedGraphic">An ICachedGraphic interface</param>
'''<param name="point">An IPoint interface</param>
'''
'''<remarks>Pass the ICachedGraphic to move and the Point to move graphic. An IDisplay (preferably ActiveView.ScreenDisplay) is also required for redrawing.</remarks>
Public Sub MoveForceElement(ByVal display As ESRI.ArcGIS.Display.IDisplay, ByVal cachedGraphic As ESRI.ArcGIS.DefenseSolutions.ICachedGraphic, ByVal point As ESRI.ArcGIS.Geometry.IPoint)
Dim feGraphic As ESRI.ArcGIS.DefenseSolutions.IFEGraphic = CType(cachedGraphic, ESRI.ArcGIS.DefenseSolutions.IFEGraphic) ' Explicit Cast
If feGraphic Is Nothing Then
System.Diagnostics.Trace.WriteLine("ICachedGraphic is not an IFEGraphic. Aborting.")
Return
End If
Dim forceElement As ESRI.ArcGIS.DefenseSolutions.IForceElement = feGraphic.ForceElement
If forceElement Is Nothing Then
System.Diagnostics.Trace.WriteLine("IForceElement is Nothing. Aborting.")
Return
End If
forceElement.Shape = point
' Currently must call refresh to get the position to update
cachedGraphic.Refresh(display)
End Sub