This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ESRI.ArcGIS.Snippets > Snippets > Move Force Element Snippet (ArcObjects .NET 10.4 SDK) |
Performs the operations necessary to move a MOLE Force Element.
///<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); }
'''<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