Initializing a world file with rotation
The following code example sets up a world file for a given IExport passed in as docExport. It assumes that a HookHelper object has been set up to obtain the active view. Note, the mapWorldFileSettings.OutputWorldFile parameter must be set to true for a world file to be output.
[Java]
static void initWorldFile(IExport docExport)throws Exception{
//Use the new IWorldFileSettings2 interface to write the rotation to the worldfile
if (docExport instanceof IExportImage && hookHelper.getActiveView()instanceof
IMap){
//cast these two worldfilesettings variables to docExport.
IWorldFileSettings mapWorldFileSettings = (IWorldFileSettings)docExport;
IWorldFileSettings2 mapWorldFileSettings2 = (IWorldFileSettings2)docExport;
//mapWorldFileSettings.OutputWorldFile is set by the dialog.
mapWorldFileSettings.setMapExtent(graphicsExtentEnv);
mapWorldFileSettings.setOutputWorldFile(true);
//mapWorldFileSettings2.MapRotation must be copied in order for world file to properly reflect rotation.
mapWorldFileSettings2.setMapRotation(activeView.getScreenDisplay()
.getDisplayTransformation().getRotation());
}
}
Development licensing | Deployment licensing |
---|---|
ArcView | ArcView |
ArcEditor | ArcEditor |
ArcInfo | ArcInfo |
Engine Developer Kit | Engine Runtime |