Current Page:
NeXtMidas Training
Macros - Part 1 (Basics)
Procedures and Subroutines
Lab 3 - Macro Procedures
Instructions
|
+ Start Here
+ Background
+ Common Midas Concepts
+ Getting Started - Part 1
+ Getting Started - Part 2
+ Working with Files
+ Option Trees
- Macros - Part 1 (Basics)
+ Macro Basics
+ Loops and Control Structures
- Procedures and Subroutines
- PROCEDURE
- SUBROUTINE
- CALL
- Lab 1* - Macro Procedures
- Instructions
- Solution
- Lab 2* - Macro Procedures
- Instructions
- Solution
- Lab 3 - Macro Procedures
- Instructions
- Solution
+ Pipes in a Macro
+ Messages in a Macro
+ Macros - Part 2 (Graphics)
+ Primitives
+ NetBeans - Part 1 (Setup)
+ NetBeans - Part 2 (GUIs)
+ NetBeans - Part 3 (Profiler)
+ Applets & WebStart
+ Maps & Imagery
+ X-Midas Interoperability
+ RMIF & Remoting
+ Installing NeXtMidas
+ Support & Maintenance
|
- Lab 3 - Macro Procedures:
- For this lab you will be writing a macro that takes in two sets of
latitude/longitude points (4 arguments) and computes the distance in
meters between them.
- The equation for this is:
d = ABS(v1 - v2)
where v1 and v2 are points in a CARTESIAN
coordinate system.
- Inside the macro, make a procedure to convert from GEODETIC
to CARTESIAN (The conversion must be done before subtraction).
The nxm.sys.lib.Position class contains a method to perform
the conversion.
- You will need to use the following commands:
NEW -- to create a Position object
INVOKE -- to invoke the method in Position to convert
from GEODETIC to CARTESIAN
CALC -- to compute the distance once the points are
converted to CARTESIAN
- When you are done use UPDATE to add MISS_DISTANCE
to the dictionary and try it out. The output should look similar to
this:
nM> miss_distance 44 33 45 34
Miss distance is 136644.17740578306 meters
- Hints:
- If you want have an output parameter from a procedure, you can
take in the result name and set the value of it like so:
call myProc 10 res1 ! Sets res1 result
call myProc 20 res2 ! Sets res2 result
...
procedure myProc N:in U:myOutputRes
result ^myOutputRes in
return
- You can convert the X,Y and Z values of a Position
object into a Midas
VD using the following
syntax:
nM> result myVector (pos.x,pos,y,pos.z)
where pos is a Position object.
- CALC can subtract vectors.
|