HOW TO
When you animate point features in ArcView using Avenue, a trail of symbols may be left along the path. This document discusses how to animate point feature without leaving a trail and without the need to refresh the entire screen; only the area where the point is moving gets refreshed.
The example scripts below assume you have an editab;le point theme with only one feature in a view titled View1. The point theme must be the first active theme in the view.
Code:
'-- Sample Script #1 "Sscript1"
'
'-- Get the view, display, theme, editable FTab, and shape field
theView = av.FindDoc("View1")
theDisplay = theView.GetDisplay
theTheme = theView.getactivethemes.Get(0)
theFTab = theTheme.GetFTab
theFTab.SetEditable(true)
shpFld = theFTab.FindField("Shape")
'
'-- Get the current point location
pt = theFTab.ReturnValue(shpFld,0)
'
'-- Make a rectangle that surrounds the current point's marker symbol
'-- You may need to adjust these numbers
origExt = Rect.Make((pt.GetX - 2) @ (pt.GetY - 2), 4@4)
'
'-- Increment the location of the poiont.
'-- In this case the point is moved 1.4 coverage units to the Northeast
pt = pt + (1@1) '1 unit north, 1 unit east = 1.4 units northeast
'
'-- Give the theme's FTab this new point location
theFTab.SetValue(shpFld,0,pt)
'
'-- Stop editing the FTab and write it to disk
theFTab.SetEditable(false)
theFTab.Flush
'
'-- Make a rectangle that surrounds the new point's marker symbol
'-- You may need to adjust these numbers
newExt = Rect.Make((pt.GetX - 2) @ (pt.GetY - 2), 4@4)
'
'-- Calculate the portion of the view you want to re-draw
'-- Do a union of the original point's symbol extent with the new point's symbol
invRect = origExt.UnionWith(newRect)
'
'-- Re-draw the view only within the re-draw area
theDisplay.InvalidateRect(invExt)
'
'-- Wait 2 seconds and run Script2
av.delayedrun("Script2",nil,2)
'
'-- End of Script1
Code:
'-- Sample Script #2 "Sscript2"
'
'-- Run Script1
av.Run("Script1",nil)
'
'-- End of Script2
Article ID:000003523
Get help from ArcGIS experts
Download the Esri Support App