Many of the ArcGIS Military Analyst and MOLE extension application programming interface (API) objects you have used in the past have equivalent or near equivalent objects in the ArcGIS 10 ArcObjects API. These new objects should now be used and do not require a Military Analyst extension or MOLE extension license. See Migrating from Military Analyst and MOLE for information on how to accomplish tasks in ArcGIS 10 that previously required the Military Analyst and MOLE APIs.
Instructions:
- Import the defensesolutions package.
- Copy and paste the function code into your project.
- Call the function from your code.
public static void calcRhumblineDist(){
try{
// Define the spatial reference of the rhumb line.
ISpatialReferenceFactory2 spatRefFact = new SpatialReferenceEnvironment();
ISpatialReference spatRef = spatRefFact.createSpatialReference
(esriSRGeoCSType.esriSRGeoCS_WGS1984);
// Define the points to be used as the start and end points of the rhumb line.
IPoint start = new Point();
IPoint end = new Point();
start.putCoords( - 116, 33);
end.putCoords(25, 61);
// These properties include the line type, which is a rhumb line in this case, and the
// spatial reference of the line.
IMeasurementTool mTool = new MeasurementTool();
mTool.setSpecialGeolineType(cjmtkSGType.cjmtkSGTRhumbLine);
mTool.setSpecialSpatialReferenceByRef(spatRef);
// Determine the distance and azimuth of the rhumb line based on the
// start and end point coordinates.
mTool.constructByPoints(start, end);
System.out.println("Distance = " + mTool.getDistance() + " meters");
System.out.println("Azimuth = " + mTool.getAngle() + " degrees");
}
catch (Exception ex){
ex.printStackTrace();
}
}
See Also:
Development licensing | Deployment licensing |
---|---|
Engine Developer Kit: Military Analyst | Engine Runtime: Military Analyst |