Error: Failed to load processor TOC
No macro or processor named 'TOC' found

Plugins that enable dynamic data from client actions

Drawing

Description

It gives user the availability to draw printable shapes over the map, like on the following image.

drawing plugin image

How to use

Configuration

Enable the plugin by adding a line in config_XXXXX.xml file:

<pmapper>
    <ini>
        <pmapper>
....
            <plugins>drawing</plugins>
....
        </pmapper>
	</ini>
</pmapper>

Add the drawing tool button to the interface in /config/XXXXX/js_config.php file:

PM.buttonsDefault = {
.....
    buttons: [
.....
        {tool:'drawing',		name:'Drawing'},
.....
    ]
}

Set default plugin configuration by adding a line in config_XXXXX.xml file:

<pmapper>
   <ini>
....
      <pluginsConfig>
....        
         <drawing>
            <!-- common parameters -->

            <!-- dialog type to use -->
            <dlgType>dynwin</dlgType>
            <!-- default drawing color -->
            <default_color>#FF0000</default_color>
            <!-- default drawing outline color -->
            <default_outlineColor>#00FF00</default_outlineColor>


            <!-- point drawing parameters -->
            <point>
               <draw>
                  <defaultSymbol>circle</defaultSymbol>
                  <defaultThickness>10</defaultThickness>
               </draw>
               <label>
                  <defaultFont>FreeSans</defaultFont>
                  <defaultTextSize>10</defaultTextSize>
               </label>
            </point>

            <!-- line drawing parameters -->
            <line>
               <draw>
                  <defaultSymbol>circle</defaultSymbol>
                  <defaultThickness>10</defaultThickness>
               </draw>	
               <label>
                  <defaultFont>FreeSans</defaultFont>
                  <defaultTextSize>10</defaultTextSize>
               </label>
            </line>

            <!-- polygon drawing parameters -->
            <polygon>
               <draw>
                  <defaultSymbol>square</defaultSymbol>
                  <defaultThickness>10</defaultThickness>
               </draw>	
               <label>
                  <defaultFont>FreeSans</defaultFont>
                  <defaultTextSize>10</defaultTextSize>
               </label>
            </polygon>

            <!-- circle drawing parameters -->
            <circle>
               <draw>
                  <defaultSymbol>circle-not-filled</defaultSymbol>
                  <defaultThickness>10</defaultThickness>
               </draw>	
               <label>
                  <defaultFont>FreeSans</defaultFont>
                  <defaultTextSize>10</defaultTextSize>
               </label>
            </circle>

            <!-- rectangle drawing parameters -->
            <rectangle>
               <draw>
                  <defaultSymbol>square</defaultSymbol>
                  <defaultThickness>10</defaultThickness>
               </draw>	
               <label>
                  <defaultFont>FreeSans</defaultFont>
                  <defaultTextSize>10</defaultTextSize>
               </label>
            </rectangle>
         </drawing>
....
      </pluginsConfig>
   </ini>
</pmapper>  

Integration

Add the appropriate icon from plugins/drawing/install/drawing_off.gif to images/buttons/default (or the corresponding theme directory)

Each symbol used in your your configuration file (<defaultSymbol>XXXXX</defaultSymbol>) have to be defined in your mapfile and in the template mapfile (by default config/common/template.map). Examples are provided in plugins/drawing/install/symbol-part.map. It could be a good thing top add them in the '# Symbols used in p.mapper' part...

Add the appropriate layers from plugins/drawing/install/template-part.map to your template.map (by default config/common/template.map). Be careful to respect the correct mapfile syntax / nesting.

Add default translation from plugins/drawing/install/language_en-part.php to incphp/locale/language_en.php. You can add translations for other language (French is provided) by doing the same.

Files

This plugin uses geometry.js (see file /javascript/src/pm.geometry.js) and jsGraphics (see file /javascript/src/wz_jsgraphics.js) libraries.

It contains:

  • config.inc: include the other files in pmapper
  • drawing.css: styles for HTML table
  • drawing.js: plugin code
  • install subdirectory: files needed for installation / configuration

Dependancies:

  • plugins/drawing_base/drawing_base.js: use some functions from drawing_base parent class .
  • plugins/common/common.js: some common functions (colors, ...)
  • plugins/common/jquery.SevenColorPicker?.js: a modified jQuery color picker plugin
  • javascript/src/pm.geometry.js: geometry library for measurements and digitizing.
  • javascript/src/xt.wz_jsgraphics.js: provides some functions to draw shapes dynamically into a webpage.
  • plugins/clientdynamiclayers/*: dynamic layers functionality
  • config/common/template.map: template mapfile that contains layers definition to add dynamically

Measure2

Description

This plugin provide the availability to measure lines lengths and polygons areas. Measurements are printable contrary to the default measurement functionality.

Measure2 plugin image

How to use

Configuration

Enable the plugin by adding a line in config_XXXXX.xml file:

<pmapper>
   <ini>
      <pmapper>
....
         <plugins>measure2</plugins>
....
      </pmapper>
   </ini>
</pmapper>

Set default plugin configuration by adding a line in config_XXXXX.xml file:

<pmapper>
   <ini>
....
      <pluginsConfig>
....        
         <measure2>
            <!-- dialog type to use -->
            <dlgType>dynwin</dlgType>
            <!-- Default measurement color (in hexadecimal) -->
            <measure_color>#FF0000</measure_color>
            <!-- create or not inputs measure to show dynamically measurements values when user's mouse move -->
            <createMeasureInput>true</createMeasureInput>
         </measure2>
....
      <pluginsConfig>
   </ini>
</pmapper> 

Add the measure2 tool button to the interface in /config/XXXXX/js_config.php file:

PM.buttonsDefault = {
.....
    buttons: [
.....
        {tool:'measure2',		name:'Measure2'},
.....
    ]
}

Integration

Add the appropriate icon from plugins/measure2/install/measure2_off.gif to images/buttons/default (or the corresponding theme directory)

Add the appropriate layers from plugins/measure2/install/template-part.map to your template.map (by default config/common/template.map). Be careful to respect the correct mapfile syntax / nesting.

Each symbol used in your your template mapfile (by default config/common/template.map) have to be defined in it and your mapfile. By default, lines are drawn using circle symbol and areas are drawn using square symbol. The square symbol is defined in the default mapfile, but not in the template mapfile. Just add the following definition in your template mapfile. It could be a good thing top add them in the '# Symbols used in p.mapper' part...

  SYMBOL
    NAME 'square'
    TYPE VECTOR
    FILLED TRUE
    POINTS
      0 1
      0 0
      1 0
      1 1
      0 1
    END
  END

An other solution is to use circle symbol (that is defined in both files by default) to drawn areas...

Add default translation from plugins/measure2/install/language_en-part.php to incphp/locale/language_en.php. You can add translations for other language (French is provided) by doing the same.

Files

It uses the geometry.js library.

It contains:

  • config.inc: include the other files in pmapper
  • measure2.css: styles for HTML table
  • measure2.js: plugin code
  • images subdirectory
  • install subdirectory: files needed for installation / configuration

Dependencies:

  • plugins/drawing_base/drawing_base.js: drawing_base parent class
  • plugins/common/common.js: some common functions (colors, ...)
  • plugins/common/jquery.SevenColorPicker?.js: a modified jQuery color picker plugin
  • plugins/clientdynamiclayers/*: dynamic layers functionality
  • config/common/template.map: template mapfile that contains layers definition to add dynamically

Attachments