Home

Release Notes

Download

Plugins

Support

Translators

SVN

SourceForge

Plugins

Plugins are a method of adding additional functionality to Punt. Listed below is information about Plugins that will work with Punt.

Authors of Plugins written for World Wind need to modify their plugins to work with Punt, however, the modifications are relatively minor. Examples of changes required to convert Plugins to work with Punt are provided in  the Plugin Coversion section.

 

Plugins Conversion

 

Plugins are a method of adding additional functionality to Punt. Plugins are C#, VB.net, or JScript.net source code, or binary .Net assemblies, that are loaded and run within Punt. The Plugin Engine used in Punt (and in World Wind) was written by Bjørn Reppen, one of the originators of the Punt project. His website has over 20 Sample Plugins that "have been written to demonstrate some of the capabilities and hopefully inspire others into developing more useful plug-ins".

Authors of Plugins written for World Wind will need to modify their plugins to work with Punt. In most cases, the modifications are relatively minor. The information below should help plugin authors convert their "World Wind format" plugins for use with Punt.

 

Converting the Sky and Fog plugin to work in Punt

 

Patrick Murris wrote a "Sky and Fog" plugin for World Wind. Outlined below are the steps that were required to convert his Sky and Fog plugin to work with Punt. The converted Sky and Fog plugin is available for download from the Punt Sourceforge page.

 

 

The first errors

 

The World Wind-format Sky and Fog plugin ZIP file was downloaded, and then unzipped into the Punt Plugins directory. In Punt, the Plugin Load/Unload dialog lists both Fog and Sky as available plugins. Selecting the Sky plugin, and using the Load button gives the following error messages:

 

Sky and Fog plugin conversion screenshot 1

 

These are caused because there is no "WorldWind" namespace in Punt, so any lines in Sky.cs that reference the WorldWind namespace need to be changed. Change these lines:

          using WorldWind.Renderable;
          using WorldWind.Camera;
          using WorldWind;
          public class Sky : WorldWind.PluginEngine.Plugin
        

to this:

          using Punt.Renderable;
          using Punt.Camera;
          using Punt;
          public class Sky : Punt.PluginEngine.Plugin

        

An error and a warning

 

Having made those changes, again selecting the Sky plugin, and using the Load button gives more messages:

 

Sky and Fog plugin conversion screenshot 2

 

The error is caused because Skylayer is a RenderableObject, and RenderableObject no longer has an abstract method Initialize() to be overridden. Change these lines in Sky.cs:

          /// RenderableObject abstract member (needed)
          /// OBS: Worker thread (don't update UI directly from this thread)
          /// </summary>
          public override void Initialize(DrawArgs drawArgs)
        

to this:

          /// OBS: Worker thread (don't update UI directly from this thread)
          /// </summary>
          public void Initialize(DrawArgs drawArgs)
        

The warning, although not displayed, was also there when the plugin was used with World Wind. To remove it, change this line:

          public void OnPropertiesClick(object sender, EventArgs e)
        

to this:

          public new void OnPropertiesClick(object sender, EventArgs e)

        

More errors, more warnings

 

Having made those changes, again selecting the Sky plugin, and using the Load button gives more messages:

 

Sky and Fog plugin conversion screenshot 3

 

In World Wind the World class had a property of type RenderableObjectList called RenderableObjects, which in Punt is called Layers. To fix the first two errors, change these lines:

          ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.ChildObjects.Insert(0,layer);
          ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.Remove(LayerName);
        

to this:

          ParentApplication.WorldWindow.CurrentWorld.Layers.ChildObjects.Insert(0,layer);
          ParentApplication.WorldWindow.CurrentWorld.Layers.Remove(LayerName);
        

The two warnings can be ignored, or the two uses of (Exception caught) can be removed. The two errors referring to Punt.Distance are because in the Camera class the Altitude property is now of type Distance (a new class in Punt) rather than double. One way to fix these two errors is to change these two lines:

          if(camera.Altitude > 100e3) return;
          double distToCenterOfPlanet = (camera.Altitude + camera.WorldRadius);
        

to this (note the spelling of Metres):

          if((double)camera.Altitude.Metres > 100e3) return;
          double distToCenterOfPlanet = ((double)camera.Altitude.Metres + camera.WorldRadius);
        

To fix the error on line 191, change isOn = false; to IsOn = false;

 

 

Sky now works in Punt, almost

 

Having made those changes, again selecting the Sky plugin, and using the Load button, the Sky plugin now loads in Punt. However, even if you zoom in, and tilt the view to show the sky, there is no apparent effect from the Sky plugin, even though it shows as enabled in the Layer Manager. If you disable, then enable, the Sky layer in Layer Manager, then it works.

This is caused because in Punt only layers that are "on" are rendered, and because the Sky layer isn't "on", it's Render() method isn't being called. To fix this, set the layer to be "on" in the plugin's Load() method:

          SkyLayer layer = new SkyLayer(LayerName, PluginDirectory, ParentApplication.WorldWindow);
          layer.IsOn = true;
          ParentApplication.WorldWindow.CurrentWorld.Layers.ChildObjects.Insert(0,layer);

        

Now for some Fog

 

Selecting the Fog plugin in the Punt Plugin Load/Unload dialog, and using the Load button gives essentially the same error messages as for the Sky plugin, and the required fixes are the same.

 

The Sky and Fog plugin in use in Punt

 

Sky and Fog plugin conversion screenshot 4

 

SourceForge.net Logo Support This Project