Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Page Properties
hiddentrue
idKB
ThemePlugin
Type

Bespoke

Available from 
Page Properties
hiddentrue
idPlugin
SystemiShare GIS
Plugin

Create your own

Available since
Status
subtletrue
colourGreen
title2013

Overview

iShare GIS has a plugin system which allows you to add buttons and dialogues which you can use for custom functionality. This guide describes that system and takes you through the steps for creating a custom plugin.

...

  • An understanding of how to write and debug JavaScript

Overview

The plugin system is already used to add the Standard and Advanced toolbars into iShare GIS, but can be customised to add/remove buttons as required. It accomplishes this by reading a specific XML file for a Map Source, or if one isn't specified, the default one. This XML file describes which plugin to add, each of which is a sub-folder of the folder containing the XML file.

...

The default plugins XML file (/web/plugins/iShareGIS.xml) contains the following:

Code Block
languagexml
titleiShareGIS.xml
<PluginView>
  <Plugin>LayerPanel</Plugin>
  <Plugin>Edit</Plugin>
  <Plugin>Find</Plugin>
  <Plugin>Output</Plugin>
  <Plugin>Layers</Plugin>
  <Plugin>BaseMap</Plugin>
  <Plugin>Profiles</Plugin>
  <Plugin>Select</Plugin>
  <Plugin>View</Plugin>
</PluginView>

...

The plugins folder has the following subfolders:

...

Image Added

As you can see, each plugin name references a sub-folder, and in each sub-folder, there are three files, all named the same as the sub-folder, but with different extensions e.g.

...

In order for iShare GIS to load your custom plugins, you will need to manually add a PluginViews section, pointing to both the default iShareGIS.xml and your CustomPlugins.xml file, to any Map Source where you wish the plugins to be available as shown here.

Code Block
xml
languagexml
<MapSource version="200" guid="012345678-9abc-def0-1234-56789abcdef">
  <LayerGroups>
    ...
  </LayerGroups>
  <PluginViews>
    <PluginView>plugins/iShareGIS</PluginView>
	<PluginView>custom/plugins/CustomPlugins</PluginView>
  </PluginViews>
</MapSource>

...

Anchor
pluginxml
pluginxml
The Plugin XML

Code Block
languagexml
<Plugin>
	<Name>drilldown</Name>
	<Description>Enables Enables interactive selecting of features from pre-defined layers via the map</Description>
	<Category>advanced</Category>
</Plugin>

...

ObjectPropertyDescription
config  JavaScript object which contains configuration properties about the button. Commonly used properties are:
 
Anchor
configname
configname
name:
The name of the button
 type:What type of dialog to display when the button is clicked (or an empty string for no dialog) [ quickdialog | modaldialog ]
 dialog;The name of the dialog to show when the button is clicked e.g. Astun.JS.Plugins.dialogs.mydialog where mydialog is the name of the dialog.
 hideOnEmptyDialog:Should the button be hidden if the dialog is empty  [ true | false ]
 text:The text to go in the button
 tooltip:The tooltip text that is shown when you hover over the button
 tooltipTitle:The title of the tooltip that is shown when you hover over the button
 click:A function which will be called when the button is clicked
category Optional - Usually, this can be ignored, but the as the category is set in the plugin XML file. The default uses standard and advanced for the different tool barstoolbars.
profile Optional - AgainFor future use, this can usually be safely ignored.

...

installDialog(name, config, category, profile);

This adds a dialog to iShare GIS which can be referenced by a button - using the dialog property of the installButton object.

ObjectDescription
Anchor
dialogname
dialogname
name
The name of the dialog so that it can be referenced. A dialog called mydialog would be referenced by Astun.JS.Plugins.dialogs.mydialog
configUsually a function which accepts two parameters which in turn would return a standard JavaScript object which would be used to render the dialog. (See the Examples for more information)
categoryOptional - Usually, this can be ignored, but the as the category is set in the plugin XML file. The default uses standard and advanced for the different toolbars.
profileOptional - AgainFor future use, this can usually be safely ignored.

installPanel(name, config, category, profile);

...

ObjectDescription
nameThe name of the panel so that it can be referenced. A panel called mypanel would be referenced by Astun.JS.Plugins.panels.mypanel.
configUsually a function which accepts three parameters which in turn would return  a standards JavaScript object which would be used to render the dialog. (See the Examples for more information)
categoryOptional - Usually, this can be ignored, but the as the category is set in the plugin XML file. The default uses standard and advanced for the different toolbars.
profileOptional - AgainFor future use, this can usually be safely ignored.

Anchor
examples
examples
Examples

...

This produces the following output in a dialog:

Image RemovedImage Added

CurrentView

This plugin will produce an image of the current view of the map.

...

This produces the following output in a dialog:

Image RemovedImage Added

ViewQuery

The new plugin This Plugin we are going to create is called ViewQuery and will by be a mixture of what was covered in the examples and also new topicsprevious examples as well as a new topic. The plugin will take your current view and output the following:

  • A small map of your current view
  • A list of features shown on the map for each layer

...

This produces the following output in a dialog:

Image RemovedImage Added