ArcObjects VB Code for drawing 2D Earthquake Focal Mechanisms in ArcMap

5381
2
01-07-2011 01:49 AM
OmerSarikaya
New Contributor
Dear ArcObjects users,

In a earlier posted discussion (see link below) a VB code is given to draw 2D focal mechanisms in ArcMap. The code works but the graphics resulted on the screen are temporary and cannot be exported to feature class (with ArcGIS 10) or to pdf or jpg. When I pan or zoom in or out I loose the graphics. Can anybody advise a way to solve this problem. I am using the code in ArcMap 9.3 SP1 and have Arcmap 10 too. Thank you.

http://forums.esri.com/Thread.asp?c=93&f=1730&t=214159
0 Kudos
2 Replies
AlexanderGray
Occasional Contributor III
The solution is to modify the VB code.  I noticed that there is a function called PlotMomentTensor in the code.  This function create a polygons, lines and points and draws them to the display.  To save the geometries as features, you could have three feature classes (one line, point and polygon) already defined that you feed into the function and instead of drawing the geometries on the map, you could create a feature in each feature class and assign the geometry to the feature.

To save the geometries to the mxd, you could create graphic elements (point, polyline and polygon elements), set their geometry and add the elements to the map's graphic container (see IGraphicsContainer.AddElement). 

To keep the elements drawing in the IDisplay, you could implement an event listener on the IActiveView.OnAfterDraw, keep a reference to the geometries you are drawing and add the draw
code in the event listener (I would advise against re-running the code to generate the geometries, in the event listener, just keep a reference to them.)  This won't save the feature but they will stay in the map long enough to export a pdf.
0 Kudos
OmerSarikaya
New Contributor
Dear Alexander,

Thank you for your response. I am self not a GIS software developer, but a GIS analyst. Thats why I am not so handy in software programming 🙂 Could you show where and how to implement the extra codes to the VB code? If it is too much work, no problem. I will then ask it to a GIS software developer to this for us. Thank you.
0 Kudos