Skip to content

Developers Page

mbarto edited this page Jun 7, 2013 · 35 revisions

General Informations

This section provides several useful informations for a developer in order to: manage the MapStore configuration, add and configure additional plugins and develop in general in MapStore.

Configuration

By default MapStore loads configuration from config/mapStoreConfig.js. Passing the parameter config=myconfig in GET request the page will load: config/myconfig.js instead. For more informations about configuration see the configuration page

You can use MapStore as alternative viewer for GeoNetwork. See the integration page for more details.

MapStore provides different levels of localization management. See the localization page for more details.

Plugins

Plugins (MapStore Tools) are used to add additional functionality to MapStore in a modular manner. Plugins may have action and / or specifics outputs. The action refers to a button or a menu item, while the output refers to something visible on the screen as a pop-up window or a panel (form a grid or something like that).

In general the tools configuration isnt maintained in the MapStore state (for example if you save the Viewer context in GeoStore). However MapStore provide the possibility to save the plugin state if needed. So in a plugin configuration you can simply add the property:

saveState: true

If this property is present and set to true enables the possibility to save the state of the plugin. Note that in this case the Plugin must implement the function getState() that calculate and returns its status (for more details about this functionality please click on the Medatada Explorer link below).

Widgets

Windows Installer

Tips and Tricks

Map View in a Tab

MapStore automatically recognize if some parameters are present in the configuration to determine to render the viewer in a tab or not. For example if you use the MetadataExplorer tool you need this kind of visualization. If the cswconfig paramenter is present, the viewer will be automatically rendered in a tab. To force the tab rendering add "tab":true to the MapStore configuration.

Remove View Header

Many times the "View" header is not needed. To change the configuration of that panel, you can write that configuration inside the portalConfig parameter in configuration.

    "portalConfig":{
        "header":false,
    }

Add and customize welcome screen

If you want you can add a welcome sceen during the viewer loading. To do this is very simple by following these steps:

  1. Go to the composer.html/viewer.html and uncomment the relative code to import the relavant script

  2. MapStore provide for you a default welcome sceen. If you want to customize this please edit the relevant CSS inside the mapstore.css file. The welcome sceen CSS names are:

      #loading-mask, #loading, #loading .loading-indicator
    

Enable the Graticule Plugin

In order to enable the graticule plugin please add the followig property to the 'app' definitions inside the composer.html and/or viewer.html:

showGraticule: true,

Follow aconfiguration example:

     app = new GeoExplorer.Composer({
            ...
            sources: sources,
	        showGraticule: true,
            ...
     }, mapIdentifier, authorization, fullScreen); 

Make attention that this Plugin only work if the map projection is EPSG:4326.

Add a new submodule

In MapStore you can add a new submodule in order to integrate external functionalities. To do this is very simple and you can follow the 'csw' module intergration located at:

    you@prompt:~$ cd mapstore/
    you@prompt:~$ cd mapcomposer/app/static/externals/csw

In order to add a new external submodule (you have also the possibility to use a Git submodule) you have to follow these steps:

  1. Copy you submodule at the following path:

     you@prompt:~$ cd mapcomposer/app/static/externals
    
  2. Then link the module dependencies to the 'mapcomposer' editing the 'buildjs.cfg' dependencies file located at:

     you@prompt:~$ cd mapstore/mapcomposer
    

    Following the 'metadataexplorer' example in this file:

        [metadataexplorer.js]
        root = app/static/externals/csw
    
        include =
            src/CSWCatalogChooser.js
            src/CSWGrid.js
            src/CSWHttpProxy.js
            src/CSWPagingToolbar.js
            src/CSWPanel.js
            src/CSWRecord.js
            src/CSWRecordsReader.js
            src/CSWSearchTool.js
            src/eventHandlers.js
            lib/ResourceBundle/Bundle.js
            lib/ResourceBundle/PropertyReader.js
    
  3. Add the new module dependencies to the Ant build script (images, css etc.) located at:

      you@prompt:~$ cd mapstore/
    

    Following the 'metadataexplorer' example in this file:

     <!-- copy metadataexplorer css  -->
     <copy todir="${composerbuild}/${ant.project.name}/WEB-INF/app/static/externals/csw/css">
         <fileset dir="mapcomposer/app/static/externals/csw/css"/>
     </copy>
     <!-- copy metadataexplorer img -->
     <copy todir="${composerbuild}/${ant.project.name}/WEB-INF/app/static/externals/csw/img">
         <fileset dir="mapcomposer/app/static/externals/csw/img"/>
     </copy>
     <!-- copy metadataexplorer i18n -->
     <copy todir="${composerbuild}/${ant.project.name}/WEB-INF/app/static/externals/csw/i18n">
         <fileset dir="mapcomposer/app/static/externals/csw/i18n"/>
     </copy>
    
Clone this wiki locally