avenue to arcgiscedra.com/casepres/av2arcgis.pdf · conversion concerns #1 - syntax of code. avenue...
TRANSCRIPT
![Page 1: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/1.jpg)
Is there an efficient process for converting Avenue scripts to ArcGIS?
AvenueWraps
Constantine N. Tonias, P.E.And
Elias C. Tonias, P.E.
The CEDRA PressRochester, New York
Avenue
into VB/VBA CodeAvenue scripts
for convertingA guide
ArcObjects™for
WrapArounds
ArcMap™ ArcView®8.x
ArcView®3.x
Avenue to Avenue to ArcGISArcGIS
![Page 2: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/2.jpg)
Avenue to Avenue to ArcGISArcGIS
Avenue Wraps is a library of
“wraparound” VB / VBA procedures
that provide a
one to one correspondence to Avenue
requests
![Page 3: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/3.jpg)
Avenue to Avenue to ArcGISArcGIS
Avenue ArcGIS
Like mostnew
explorations
The pioneerscatch the
first arrows
![Page 4: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/4.jpg)
Avenue to Avenue to ArcGISArcGIS
Conversion ofover 500,000 lines of Avenue scripts
CEDRA-AVcadGeneral CAD
CEDRA-AVcogoComprehensive COGO
CEDRA-AVparcelParcel maintenance
CEDRA-AVlandRoad & Site Design
CEDRA-AVsandStorm & Waste Water
CEDRA-AVwaterWater Distribution
![Page 5: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/5.jpg)
Avenue to Avenue to ArcGISArcGIS
Development of the Application
•Visual Basic / Visual Basic for Applications•Visual C++•Others
C++ ------------------------ Avenue ------ VB / VBAfurther away closest
![Page 6: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/6.jpg)
Avenue to Avenue to ArcGISArcGIS
Development of the Application
Develop &Test Within
Other COM Languages
ArcViewAvenue
ArcMapVBA
DevelopCompile
Create DLLTest Good?
OKYes
No
![Page 7: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/7.jpg)
Avenue to Avenue to ArcGISArcGIS
?? Syntax of CodeSyntax of Code?? Declaration of VariablesDeclaration of Variables?? Use of Use of ArcObjectsArcObjects instead of Avenue Requestsinstead of Avenue Requests
Conversion Concerns
![Page 8: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/8.jpg)
Avenue to Avenue to ArcGISArcGIS
Things to be done first:Things to be done first:1.1. Statement structure (if...then...end,Statement structure (if...then...end,
for each...end, etc.)for each...end, etc.)2.2. Intrinsic function names (Intrinsic function names (sqrtsqrt vs. vs. SqrSqr, etc.), etc.)
and position of the nameand position of the name3.3. Manipulation of strings (count vs. Manipulation of strings (count vs. lenlen, etc.), etc.)4.4. Concatenation statementsConcatenation statements5.5. Lists vs. CollectionsLists vs. Collections
Conversion Concerns #1 - Syntax of Code
![Page 9: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/9.jpg)
Avenue to Avenue to ArcGISArcGIS
?? Declare as you convert the code, then move to Declare as you convert the code, then move to the top in the order of encounter.the top in the order of encounter.
?? May declare more than one variable with one May declare more than one variable with one Dim statement, butDim statement, but
?? Declare each variable individuallyDeclare each variable individually
Conversion Concerns #2 –Variable Declaration
Avenue
NoVB / VBA, C++, etc.
Yes
![Page 10: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/10.jpg)
Avenue to Avenue to ArcGISArcGIS
Conversion Concerns #3 - Requests to ArcObjects
AvenueRequests ArcObjectsAvenue
Wraps
av.GetActiveDoc avGetActiveDoc Application.Document
![Page 11: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/11.jpg)
Avenue to Avenue to ArcGISArcGIS
Avenue
Msg = "OK to continue ?"Title = "A command"Default = Trueians = MsgBox.YesNoCancel(Msg,Title,Default)if (ians = Nil) then
....do somethingelse
....do another thingend
![Page 12: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/12.jpg)
Avenue Wraps
Dim Msg As Variant, Title As VariantDim Deflt As Boolean, ians As IntegerMsg = "OK to continue ?"Title = "A command"Deflt = TrueCall avMsgBoxYesNoCancel(Msg, Title, Deflt, ians)If (ians = vbCancel) then
....do somethingElseIf (ians = vbNo) then
....do somethingElseIf (ians = vbYes) then
....do another thingEnd If
![Page 13: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/13.jpg)
Concatenated if...then...end StatementsConcatenated if...then...end Statements
Avenueif (a.NE.b) then x = y endif (c.GT.b) then x = z end
Recommended VB / VBAIf (a <> b) then
x = yEnd IfIf (c > b) then
x = zEnd If
![Page 14: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/14.jpg)
Iterative StatementsIterative Statements
Avenue
for each i in 1..55...........if (c.GT.b) then
Breakend...........
End
VB / VBA
For i = 1 to 55...........if (c > b) then
Exit ForEnd If...........
Next
![Page 15: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/15.jpg)
Error TrappingError Trapping
Public Sub ShowErrorTrapping()...... Declaration Statements ......On Error GoTo ErrorHandlerCall avGetActiveDoc(pMxApp, pmxDoc, _
pActiveView, pMap....do some things
Exit SubErrorHandler:MsgBox "Error " & Err.Number & " " - " & _
Err.Description & Chr(13) & "Subroutine: _ShowErrorTrapping"
End Sub
![Page 16: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/16.jpg)
Application Application -- Document Avenue WrapsDocument Avenue Wraps
AvenuetheView = av.GetActiveDocvThemeList = theView.GetVisibleThemes
Avenue WrapsDim pMxApp As IMxApplicationDim pmxDoc As IMxDocumentDim pActiveView As IActiveViewDim pMap As IMapDim vThemesList As New CollectionCall avGetActiveDoc(pMxApp, pmxDoc, _
pActiveView, pMap)Call avGetVisibleThemes(pmxDoc, vThemesList)
![Page 17: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/17.jpg)
Avenue to Avenue to ArcGISArcGIS
Indexing of Lists and Collections
AvenuefirstVTheme = vThemesList.Get(0)
VB / VBAfirstVTheme = vThemesList.Item(1)
![Page 18: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/18.jpg)
Avenue to Avenue to ArcGISArcGIS
File I/O Avenue Wraps
AvenueaLineFile = LineFile.Make (aFileName, _
#FILE_PERM_WRITE)
Avenue WrapsDim aFileName As StringDim aLineFileSet aLineFile = avLineFileMake _
(aFileName, "WRITE")
![Page 19: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/19.jpg)
Avenue to Avenue to ArcGISArcGIS
Theme & Table Avenue Wraps
In Avenue, you Operate on an:FTab or VTab (SetValue and ReturnValue)
With the Avenue Wraps, you use:IFeature, when dealing with an FTab, andIRow interface, when dealing with a VTabwith the Value property, you do not useIFields to store/extract attribute values !!
![Page 20: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/20.jpg)
Avenue to Avenue to ArcGISArcGIS
Write the value 24 in record 12 (Avenue)
theView = av.GetActiveDoctheTheme = theView.FindTheme("L_0ln")theFTab = theTheme.GetFTabcol = theFTab.FindField("MAP")rec = 12theFTab.SetEditable(true)theFTab.SetValue(col, rec, 24)theFTab.SetEditable(false)
![Page 21: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/21.jpg)
Dim pMxApp As IMxApplication, pmxDoc As IMxDocumentDim pActiveView As IActiveView, pMap As IMapDim theFTab As IFields, pFeatCls As IFeatureClassDim pLayer As IFeatureLayerDim col As Long, rec As LongCall avGetActiveDoc(pMxApp, pmxDoc, pActiveView, pMap)Call avGetFTab(pmxDoc, "L_0ln", theFTab, pFeatCls, pLayer)col = theFTab.FindField("MAP")rec = 12Call avSetEditable(pmxDoc, "L_0ln", true)Call avSetValue(pmxDoc, "L_0ln", col, rec, 24)Call avSetEditable(pmxDoc, "L_0ln", false)
Write the value 24 in record 12 (Avenue Wraps)
![Page 22: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/22.jpg)
AvenueaShape = Polyline.Make({{20000.0, 20000.0, 30000.0, 25000.0}})col = theFTab.FindField("SHAPE")theFTab.SetEditable(true)theFTab.SetValue(col, 12, aShape)theFTab.SetEditable(false)
Avenue WrapsDim aShape As IPolyline, col As LongSet aShape = avPolyline2Pt(20000#, 20000#, 30000#, 25000#)col = theFTab.FindField("SHAPE")Call avSetEditable(pmxDoc, "L_0ln", true)Call avSetValueG(pmxDoc, "L_0ln", col, 12, aShape)Call avSetEditable(pmxDoc, "L_0ln", false)
Store a 2 point line (shape) in record 12
![Page 23: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/23.jpg)
Avenue to Avenue to ArcGISArcGIS
Undo / Redo ability with ArcObjects
avSetEditable flushes theme’s buffered writes.
Use avStartOperation and avStopOperationto begin and terminate operations which are addedthe Editor’s operation stack thereby providingUndo and Redo capabilities.
Use avStopEditing to terminate the Editor savingall edits that may have been made.
![Page 24: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/24.jpg)
Avenue to Avenue to ArcGISArcGISFeature Selection in Avenue
theView = av.GetActiveDoctheTheme = theView.FindTheme("L_0ln")theFTab = theTheme.GetFTabcol = theFTab.FindField("Deposits")sel = theFTab.GetSelectiontotal = 0.0for each rec in sel
deposit = theFTab.ReturnValue(col, rec)total = total + deposit
end
![Page 25: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/25.jpg)
Feature Selection with Feature Selection with Avenue WrapsAvenue Wraps
...... (declaration statements) ......Call avGetActiveDoc(pMxApp, pmxDoc, pActiveView, pMap)Call avGetFTab(pmxDoc, "L_0ln", theFTab, pFeatCls, pLayer)col = theFTab.FindField("Deposits")Call avGetSelection(pmxDoc, "L_0ln", sel)Call avGetSelectionIDs(sel, selList)total = 0#For iRec = 1 to selList.Count
rec = selList.Item(iRec)Set pFeat = pFeatCls.GetFeature(rec)deposit = pFeat.Value(col)total = total + deposit
Next
![Page 26: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/26.jpg)
Avenue to Avenue to ArcGISArcGIS
Mesage and Menu Boxes with Avenue Wraps
AvenueMsgBox.Info("A sample message string.",
"MsgBox Test")
Avenue WrapsCall avMsgBoxInfo("A sample message string.", _
"MsgBox Test")
![Page 27: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/27.jpg)
Avenue to Avenue to ArcGISArcGIS
Sample dialog box with 2 data lines and1 combo box field using VDBbuild
![Page 28: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/28.jpg)
Avenue to Avenue to ArcGISArcGIS
Sample multi-column & multi-row dialog box withdata lines and combo box fields using HDBbuild
![Page 29: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/29.jpg)
Avenue to Avenue to ArcGISArcGIS
Geometry Avenue Wraps
Creating a point in AvenueaPoint = 5000.0 @ 5000.0
Creating a point with Avenue WrapsDim aPoint As IPointSet aPoint = avPointMake(5000#, 5000#)
![Page 30: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/30.jpg)
Create a Create a polylinepolyline
AvenuemyLine = PolyLine.Make
({{aPt1, aPt2, aPt3, aPt4}})
![Page 31: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/31.jpg)
Create a Create a polylinepolyline with with Avenue WrapsAvenue Wraps
Dim shapeList As New Collection, partList As New CollectionDim aPt1 As IPoint, aPt2 As IPoint, aPt3 As IPointDim aPt4 As IPointDim myLine As IPolylineCall CreateList(shapeList)Call CreateList(partList)partList.Add aPt1partList.Add aPt2partList.Add aPt3partList.Add aPt4shapeList.Add partListSet myLine = avPolylineMake(shapeList)
![Page 32: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/32.jpg)
Create a 2Create a 2--point line with point line with Avenue WrapsAvenue Wraps
For 2-point lines, use avPolyline2Pt passing coordinates rather than Point objects
Dim myLine As IPolylineSet myLine = avPolyline2Pt(xPt1, yPt1, _
xPt2, yPt2)
![Page 33: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/33.jpg)
Avenue to Avenue to ArcGISArcGIS
User Document Interaction
Unfortunately there is no correspondence in the creation of menu items and tools between the Avenue and VB / VBA environments.
Hence, the developer is basically starting from scratch using native VB / VBA functionality to create the GUI.
![Page 34: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/34.jpg)
User Document InteractionUser Document Interaction
In Avenue, there were the:ReturnUserPoint,ReturnUserPolyLine, ReturnUserPolygon,etc. requests
which were applied to a Display object.
In VB / VBA, we need to write code for the type of "event" that is desired (MouseDown, MouseMove, MouseUp, etc).
![Page 35: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/35.jpg)
User Document InteractionUser Document Interaction
Every tool has a certain set of events, for which the programmer can write code, if so desired.
The developer does not have to write code for every event that is supported by a tool.
Depending upon the operation of the tool, one or many events can be coded.
![Page 36: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/36.jpg)
User Document InteractionUser Document Interaction
Since VB / VBA provides a far more robust environment for dealing with user-application interaction, this is an area where the developer can truly enhance the Avenueapplication in the VB / VBA environment.
![Page 37: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/37.jpg)
Avenue to Avenue to ArcGISArcGIS
Graphics and Symbols
The "wraparounds" that operate on graphic elements correspond to the requests used in the Introduction to Avenue training book.
One difference between the Avenuerequests and the "wraparounds" is that the "wraparounds" require the developer to specify the type of graphic that is being processed.
![Page 38: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/38.jpg)
To Create a Point Graphic ElementTo Create a Point Graphic Element
AvenueaShape = Point.Make(5000.0, 5000.0)theShape = GraphicShape.Make(aShape)
Avenue WrapsDim aShape As IGeometryDim theShape As IElementSet aShape = avPointMake(5000#, 5000#)Set theShape = avGraphicShapeMake _
("MARKER", aShape)
![Page 39: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/39.jpg)
To Create a Point Graphic ElementTo Create a Point Graphic Element
The first argument in avGraphicShapeMakedenotes the graphic element type to be created, such as PEN, MARKER or FILL.In Avenue all graphics were added to the view's graphic list.In ArcGIS, a graphic is stored in an annotation target layer. This provides greater flexibility in managing graphic elements.
![Page 40: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/40.jpg)
Avenue to Avenue to ArcGISArcGIS
Classifications and Legends
The terminology between Avenue and ArcObjects is so completely different. It is difficult to correlate Avenue requests to ArcObjects (Legend vs. Renderer)
The classification "wraparounds" such asavInterval, avUnique, etc. operate on the theme name rather than on a Legend object.
![Page 41: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/41.jpg)
Classifications and LegendsClassifications and Legends
In Avenue the code below assigns a single symbol classification to a theme:
thmName = "SomeName"aTheme = theView.FindTheme(thmName)aLegend = aTheme.GetLegendaLegend.SingleSymbol
![Page 42: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/42.jpg)
Classifications and LegendsClassifications and Legends
Avenue WrapsDim pMxApp As IMxApplication, pmxDoc As IMxDocumentDim pActiveView As IActiveView, pMap As IMapDim thmName As StringDim aDesc As String, aLabel As StringDim pSym As ISymbolCall avGetActiveDoc(pMxApp, pmxDoc, pActiveView, pMap)thmName = "SomeName"Call avSingleSymbol(pmxDoc, thmName, aDesc, _
aLabel, pSym)
![Page 43: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/43.jpg)
Classifications and LegendsClassifications and Legends
In the statementCall avSingleSymbol(pmxDoc, thmName, _
aDesc, aLabel, pSym)The last three arguments allow the user to control:• the name of the renderer,• the TOC classification name, and• the symbol used in displaying the features.Should default values be used, the statement would appear as:
Call avSingleSymbol(pmxDoc, thmName, _NULL, NULL, NOTHING)
![Page 44: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/44.jpg)
Avenue to Avenue to ArcGISArcGIS
Utility Macros
Avenue WrapsExportVBAcode and LoadVBAcode
ArcView ProjectSourceCode
ArcMap DocumentSourceCode
VBAo n ly
N o so urceco d e in VB
![Page 45: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/45.jpg)
Avenue to Avenue to ArcGISArcGIS
Custom Form Creation
In Avenue, we could use the Dialog Designer.In VB / VBA, we use the Form Designer.
Forms created in VBA will need to be recreated in VB.
In addition, some VB form controls contain different properties than their VBAcounterparts.
![Page 46: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/46.jpg)
Application Deployment MethodsApplication Deployment Methods
Application
Testing VBAcode DLLappl.mxd module1.bas
module2.basform1.frmform1.frx
Module1.clsModule2.cls
form1.frmform1.frxappl.vbpappl.vbwappl.dll
appl.expappl.lib
![Page 47: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/47.jpg)
Avenue to Avenue to ArcGISArcGIS
In Summary
? A direct translator from Avenue to ArcObjects does not exist.
? With Avenue Wraps, large blocks of code do not have to be rewritten.
? Developers used to programming in Avenue can develop new code for ArcGISusing the same Avenue approach they are accustomed with.
![Page 48: Avenue to ArcGIScedra.com/casepres/Av2ArcGIS.pdf · Conversion Concerns #1 - Syntax of Code. Avenue to ArcGIS?Declare as you convert the code, then move to the top in the order of](https://reader034.vdocuments.net/reader034/viewer/2022051901/5ff02f2afac5691cf73b0d93/html5/thumbnails/48.jpg)
Avenue to Avenue to ArcGISArcGIS
In the Avenue Wraps book there are several examples on the use of Avenue Wraps.
Additional examples can be found on the web at:
www.cedra.comOn the left side of the page, click the Avenue Wraps button, then click the Avenue Wraps Samples link.