Project

General

Profile

1
/*
2
Author:       Cameron Shorter cameronATshorter.net
3
License:      LGPL as per: http://www.gnu.org/copyleft/lesser.html
4

    
5
$Id$
6
*/
7

    
8
// Ensure this object's dependancies are loaded.
9
mapbuilder.loadScript(baseDir+"/model/Proj.js");
10
mapbuilder.loadScript(baseDir+"/widget/MapContainerBase.js");
11

    
12
/**
13
 * Render GML into the WKT defined in the OGC .
14
 * Calls GmlCoordinates2Coord.xsl to convert GML to a simpler form.
15
 * Calls GmlRendererWKT.xsl to convert GML to WKT format.
16
 * this.targetModel references the context model with
17
 * width/height attributes.
18
 * @constructor
19
 * @base MapContainerBase
20
 * @param widgetNode  The widget's XML object node from the configuration document.
21
 * @param model       The model object that this widget belongs to.
22
 */
23
function GmlRendererWKT(widgetNode, model) {
24
  var base = new MapContainerBase(this,widgetNode,model);
25

    
26
  /** Output of XSL will be javascript which will be executed when painting.*/
27
  this.paintMethod="xsl2js";
28

    
29
  /** Xsl to convert GML Coordinates to Coords. */
30
  this.coordXsl=new XslProcessor(baseDir+"/widget/GmlCooordinates2Coord.xsl");
31

    
32
  /**
33
   * Set up XSL params and convert Gml Coordinate nodes to Gml Coords so
34
   * that they are easier to process by XSL.
35
   * @param objRef Pointer to this object.
36
   */
37
  this.prePaint = function(objRef) {
38
    objRef.model.setParam("modelStatus","preparing coordinates");
39
    objRef.stylesheet.setParameter("targetElement", objRef.containerModel.getWindowWidth() );
40
    objRef.resultDoc = objRef.coordXsl.transformNodeToObject(objRef.resultDoc);
41

    
42
  }
43

    
44
  /**
45
   * Called when the context's hidden attribute changes.
46
   * @param objRef This object.
47
   * @param layerName  The name of the layer that was toggled.
48
   */
49
  this.hiddenListener=function(objRef, layerName){
50
    var vis="visible";
51
    if(objRef.model.getHidden(layerName)) {
52
      vis="hidden";
53
    }
54
    var outputNode = document.getElementById(objRef.outputNodeId)
55
    for (var i=0; i< outputNode.childNodes.length; ++i) {
56
      outputNode.childNodes[i].style.visibility=vis;
57
    }
58
  }
59
  this.model.addListener("hidden",this.hiddenListener,this);
60

    
61
}
(54-54/145)