Method: draw

Returns:
{DOMElement}
436898
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);
        if (this.outsideViewport) {
            this.events.attachToElement(this.div);
            this.events.register("buttonclick", this, this.onButtonClick);
        } else {
            this.map.events.register("buttonclick", this, this.onButtonClick);
        }
        this.addControlsToMap(this.controls);
        return this.div;
    }
1089241
function() {
		var d = 7; // arrow width/2
      var redim = d+3; //we have to make the canvas a little bigger because of arrows
      var margin=[4+redim,4+redim];

      // Get the positions of the terminals
      var p1 = this.terminal1.getXY();
      var p2 = this.terminal2.getXY();

      var distance=Math.sqrt(Math.pow(p1[0]-p2[0],2)+Math.pow(p1[1]-p2[1],2));

      var min=[ Math.min(p1[0],p2[0])-margin[0], Math.min(p1[1],p2[1])-margin[1]];
      var max=[ Math.max(p1[0],p2[0])+margin[0], Math.max(p1[1],p2[1])+margin[1]];

		// Store the min, max positions to display the label later
		this.min = min;
		this.max = max;      

      // Redimensionnement du canvas
      
      var lw=Math.abs(max[0]-min[0])+redim;
      var lh=Math.abs(max[1]-min[1])+redim;

      p1[0]=p1[0]-min[0];
      p1[1]=p1[1]-min[1];
      p2[0]=p2[0]-min[0];
      p2[1]=p2[1]-min[1];

      this.SetCanvasRegion(min[0],min[1],lw,lh);

      var ctxt=this.getContext();
      
      // Draw the border
      ctxt.lineCap=this.bordercap;
      ctxt.strokeStyle=this.bordercolor;
      ctxt.lineWidth=this.width+this.borderwidth*2;
      ctxt.beginPath();
      ctxt.moveTo(p1[0],p1[1]);
      ctxt.lineTo(p2[0],p2[1]);
      ctxt.stroke();

      // Draw the inner bezier curve
      ctxt.lineCap=this.cap;
      ctxt.strokeStyle=this.color;
      ctxt.lineWidth=this.width;
      ctxt.beginPath();
      ctxt.moveTo(p1[0],p1[1]);
      ctxt.lineTo(p2[0],p2[1]);
      ctxt.stroke();

		/* start drawing arrows */
		var t1 = p1;
		var t2 = p2;

		var z = [0,0]; //point on the wire with constant distance (dlug) from terminal2
		var dlug = 20; //arrow length
		var t = (distance === 0) ? 0 : 1-(dlug/distance);
		z[0] = Math.abs( t1[0] +  t*(t2[0]-t1[0]) );
		z[1] = Math.abs( t1[1] + t*(t2[1]-t1[1]) );	

		//line which connects the terminals: y=ax+b
		var a,b;
		var W = t1[0] - t2[0];
		var Wa = t1[1] - t2[1];
		var Wb = t1[0]*t2[1] - t1[1]*t2[0];
		if (W !== 0) {
			a = Wa/W;
			b = Wb/W;
		}
		else {
			a = 0;
		}
		//line perpendicular to the main line: y = aProst*x + b
		var aProst, bProst;
		if (a === 0) {
			aProst = 0;
		}
		else {
			aProst = -1/a;
		}
		bProst = z[1] - aProst*z[0]; //point z lays on this line

		//we have to calculate coordinates of 2 points, which lay on perpendicular line and have the same distance (d) from point z
		var A = 1 + Math.pow(aProst,2);
		var B = 2*aProst*bProst - 2*z[0] - 2*z[1]*aProst;
		var C = -2*z[1]*bProst + Math.pow(z[0],2) + Math.pow(z[1],2) - Math.pow(d,2) + Math.pow(bProst,2);
		var delta = Math.pow(B,2) - 4*A*C;
		if (delta < 0) { return; }

		var x1 = (-B + Math.sqrt(delta)) / (2*A);
		var x2 = (-B - Math.sqrt(delta)) / (2*A);	 
		var y1 = aProst*x1 + bProst;
		var y2 = aProst*x2 + bProst;

		if(t1[1] == t2[1]) {
			var o = (t1[0] > t2[0]) ? 1 : -1;
			x1 = t2[0]+o*dlug;
			x2 = x1;
			y1 -= d;
			y2 += d;
		}

		//triangle fill
		ctxt.fillStyle = this.color;
		ctxt.beginPath();
		ctxt.moveTo(t2[0],t2[1]);
		ctxt.lineTo(x1,y1);
		ctxt.lineTo(x2,y2);
		ctxt.fill();

		//triangle border	
		ctxt.strokeStyle = this.bordercolor;
		ctxt.lineWidth = this.borderwidth;
		ctxt.beginPath();
		ctxt.moveTo(t2[0],t2[1]);
		ctxt.lineTo(x1,y1);
		ctxt.lineTo(x2,y2);
		ctxt.lineTo(t2[0],t2[1]);
		ctxt.stroke();
   }
1217295
function draw() {
    const options = {
      start: timeframeStartNode.value,
      end: timeframeEndNode.value,
      latitude: latNode.value,
      longitude: lngNode.value,
      radius: GEO.miles,
      zoom: GEO.zoom
    };

    const end = (options['end']) ? new Date(Date.parse(options['end'])) : new Date();
    const start = (options['start']) ? new Date(Date.parse(options['start'])) : new Date(end.getFullYear(), end.getMonth(), end.getDate() - 14);

    const rad = (options['radius']) ? parseFloat(options['radius']) : false;
    const lat = (options['latitude']) ? parseFloat(options['latitude']) : false;
    const lng = (options['longitude']) ? parseFloat(options['longitude']) : false;

    let geoFilter = [];
    if (lat && lng && rad) {
      geoFilter.push({
        property_name: 'keen.location.coordinates',
        operator: 'within',
        property_value: {
          coordinates: [parseFloat(options['longitude']), parseFloat(options['latitude'])],
          max_distance_miles: parseFloat(options['radius'])
        }
      });
    };

    const baseParams = {
      timeframe: {
        start: start.toISOString(),
        end: end.toISOString()
      },
      filters: geoFilter
    };

    // Fetch events within geo target
    const scoped_events = client.query('select_unique', {
      event_collection: 'user_action',
      target_property: 'keen.location.coordinates',
      timeframe: baseParams.timeframe,
      filters: baseParams.filters
    });
    client.run(scoped_events, (err, res) => {
      activeMapData.clearLayers();
      Keen.utils.each(res.result, coord => {
        const em = L.marker(new L.LatLng(coord[1], coord[0]), {
          icon: L.mapbox.marker.icon({
            'marker-color': '#00bbde'
          })
        }).addTo(activeMapData);;
      });
    });



    // Sample queries
    // groupBy not supported for Geo Filters

    const hearts = client.query('median', {
      event_collection: 'user_action',
      interval: 'daily',
      target_property: 'bio_sensors.heart_rate',
      timeframe: baseParams.timeframe,
      filters: baseParams.filters
    });

    const daily_median_heartrate = new KeenDataviz({
      container: '#chart-01',
      title: 'Daily Median Heart Rate',
      type: 'area',
      colors: ['#fe6672'],
    })

    client
      .run(hearts)
      .then(res => {
        daily_median_heartrate
          .data(res)
          .render()
      });


    const activations = client.query('count', {
      event_collection: 'activations',
      interval: 'daily',
      target_property: 'bio_sensors.heart_rate',
      timeframe: baseParams.timeframe,
      filters: baseParams.filters
    });

    const daily_activations = new KeenDataviz({
      container: '#chart-02',
      title: 'Daily Activations',
      type: 'area',
      colors: ['#fe6672'],
    });

    client
      .run(activations)
      .then(res => {
        daily_activations
          .data(res)
          .render()
      });


    const purchases = client.query('sum', {
      event_collection: 'purchases',
      target_property: 'order_price',
      interval: 'daily',
      timeframe: baseParams.timeframe,
      filters: baseParams.filters
    });

    const daily_purchases = new KeenDataviz({
      container: '#chart-03',
      title: 'Daily Purchases',
      type: 'area',
      colors: ['#eeb058'],
    });

    client
      .run(purchases)
      .then(res => {
        daily_purchases
          .data(res)
          .render()
      });

  }
464427
function drawBars() {
            let bars;

            if (isAnimated) {
                bars = svg.select('.chart-group').selectAll('.bar')
                    .data(dataZeroed);

                if (isHorizontal) {
                    drawHorizontalBars(bars);
                } else {
                    drawVerticalBars(bars);
                }

                bars = svg.select('.chart-group').selectAll('.bar')
                    .data(data);

                if (isHorizontal) {
                    drawAnimatedHorizontalBars(bars);
                } else {
                    drawAnimatedVerticalBars(bars);
                }

                // Exit
                bars.exit()
                    .transition()
                    .style('opacity', 0)
                    .remove();
            } else {
                bars = svg.select('.chart-group').selectAll('.bar')
                    .data(data);

                if (isHorizontal) {
                    drawHorizontalBars(bars);
                } else {
                    drawVerticalBars(bars);
                }

                // Exit
                bars.exit()
                    .remove();
            }

        }
415866
function drawLinearTitle(context, options) {
    if (!options.title) return ;

    let {isVertical, width, length, baseX, baseY, titleMargin} =
        context.barDimensions;
    let textHeight = options.fontTitleSize * width / 200;
    //noinspection JSUnresolvedFunction
    let textX = round(baseX + (isVertical ? width : length) / 2);
    //noinspection JSUnresolvedFunction
    let textY = round(baseY + titleMargin / 2 -
        (isVertical ? textHeight : textHeight / 2) -
        0.025 * (isVertical ? length : width));

    context.save();
    context.textAlign = 'center';
    context.fillStyle = options.colorTitle;
    context.font = drawings.font(options, 'Title', width / 200);
    context.lineWidth = 0;
    context.fillText(options.title, textX, textY, isVertical ? width : length);
}
820671
function Canvas(htmlElement) {
	/*
	 * initialization
	 */
	this.id = htmlElement.id;
	this.htmlElement = htmlElement;
	this.blocks = new Array();
	this.connectors = new Array();
	this.offsetLeft = calculateOffsetLeft(this.htmlElement);
	this.offsetTop = calculateOffsetTop(this.htmlElement);	
	
	this.width;
	this.height;

	// create the inner div element
	this.innerDiv = document.createElement ("div");
	
	this.initCanvas = function() {
		// setup the inner div
		var children = this.htmlElement.childNodes;
		var el;
		var n = children.length;
		for(var i = 0; i < n; i++) {
			el = children[0];
			this.htmlElement.removeChild(el);
			this.innerDiv.appendChild(el);
			if(el.style)
				el.style.zIndex = "2";
		}
		this.htmlElement.appendChild(this.innerDiv);

		this.htmlElement.style.overflow = "auto";
		this.htmlElement.style.position = "relative";
		this.innerDiv.id = this.id + "_innerDiv";
		this.innerDiv.style.border = "none";
		this.innerDiv.style.padding = "0px";
		this.innerDiv.style.margin = "0px";
		this.innerDiv.style.position = "absolute";
		this.innerDiv.style.top = "0px";
		this.innerDiv.style.left = "0px";
		this.width = 0;
		this.height = 0;
		this.offsetLeft = calculateOffsetLeft(this.innerDiv);
		this.offsetTop = calculateOffsetTop(this.innerDiv);

		// inspect canvas children to identify first level blocks
		new DocumentScanner(this, true).scan(this.htmlElement);
		
		// now this.width and this.height are populated with minimum values needed for the inner
		// blocks to fit, add 2 to avoid border overlap;
		this.height += 2;
		this.width += 2;
		
		var visibleWidth = this.htmlElement.offsetWidth - 2; // - 2 is to avoid border overlap
		var visibleHeight = this.htmlElement.offsetHeight - 2; // - 2 is to avoid border overlap
		
		// consider the scrollbars width calculating the inner div size
		if(this.height > visibleHeight)
			visibleWidth -= SCROLLBARS_WIDTH;
		if(this.width > visibleWidth)
			visibleHeight -= SCROLLBARS_WIDTH;
			
		this.height = Math.max(this.height, visibleHeight);
		this.width = Math.max(this.width, visibleWidth);
		
		this.innerDiv.style.width = this.width + "px";
		this.innerDiv.style.height = this.height + "px";
		
		// init connectors
		for(i = 0; i < this.connectors.length; i++) {
			this.connectors[i].initConnector();
		}
	}
	
	this.visit = function(element) {
		if (element == this.htmlElement)
			return true;
	
		// check the element dimensions against the acutal size of the canvas
		this.width = Math.max(this.width, calculateOffsetLeft(element) - this.offsetLeft + element.offsetWidth);
		this.height = Math.max(this.height, calculateOffsetTop(element) - this.offsetTop + element.offsetHeight);
		
		if(isBlock(element)) {
			// block found initialize it
			var newBlock = new Block(element, this);
			newBlock.initBlock();
			this.blocks.push(newBlock);
			return false;
		} else if(isConnector(element)) {
			// connector found, just create it, source or destination blocks may not 
			// have been initialized yet
			var newConnector = new Connector(element, this);
			this.connectors.push(newConnector);
			return false;
		} else {
			// continue searching nested elements
			return true;
		}
	}
	
	/*
	 * methods
	 */	
	this.print = function()
	{
		var output = '<ul><legend>canvas: ' + this.id + '</legend>';
		var i;
		for(i = 0; i < this.blocks.length; i++)
		{
			output += '<li>';
			output += this.blocks[i].print();
			output += '</li>';
		}
		output += '</ul>';
		return output;
	}
	
	this.alignBlocks = function() {
		var i;
		var roof = 0;
		// TODO: implement proper layout
		for (i = 0; i < this.blocks.length ; i++) {
			var b = this.blocks[i]; //.findBlock(blockId);
			b.onMove();
			b.htmlElement.style.top =roof;
			roof += b.htmlElement.style.height+20;
			// TODO: alert ("align "+b);
		}
		for (i = 0; i < this.connectors.length; i++) {
			this.connectors[i].repaint();
			console.log( this.connectors[i]);
		}
	}

	this.fitBlocks = function() {
		for (var i = 0; i < this.blocks.length ; i++) {
			var b = this.blocks[i]; //.findBlock(blockId);
			this.blocks[i].fit ();
		}
	}
	/*
	 * This function searches for a nested block with a given id
	 */
	this.findBlock = function(blockId) {
		var result;
		for(var i = 0; i < this.blocks.length && !result; i++)
			result = this.blocks[i].findBlock(blockId);
		return result;
	}
	
	this.toString = function() {
		return 'canvas: ' + this.id;		
	}
}
667585
function drawImage(canvas, rect, image) {
        if (image && image.content) {
            try {
                eval(image.content);
            } catch (err) {
                console.log(err);
            }
        }
    }
1009070
public void draw()
	{
		m_rootItem.updateColSpans();

		String nbRows = String.valueOf( m_rows.size() );
		int nbHeaders = m_rowHeaders.size();

		for( int i = 0; i < nbHeaders; i++ )
			m_rowHeaders.get( i ).m_td.setAttribute( "rowspan", nbRows );
	}

	public class RowHdrImpl
	{
		Element m_tr;
		Element m_td;

		public void setText( String text )
		{
			m_td.setInnerText( text );
		}
	}

	public RowHdrImpl addRowHeader()
	{
		RowHdrImpl item = new RowHdrImpl();
		m_rowHeaders.add( item );

		if( m_rows.isEmpty() )
		{
			Element tr = DOM.createTR();
			m_rows.add( tr );
			m_thead.appendChild( tr );
		}

		item.m_tr = m_rows.get( 0 );

		item.m_td = DOM.createTH();
		item.m_tr.appendChild( item.m_td );

		return item;
	}

	public class ItemImpl
	{
		int m_level = -2;
		int m_nbLeaves = -1;

		ItemImpl m_parent;
		ArrayList<ItemImpl> m_childs = new ArrayList<ItemImpl>();

		Element m_tr = null;
		Element m_td = null;

		ItemImpl( ItemImpl parent )
		{
			m_parent = parent;
			if( m_parent != null )
				m_parent.m_childs.add( this );
		}

		public void setText( String text )
		{
			m_td.setInnerText( text );
		}

		public void setWidget( Widget w )
		{
			setText( "" );
			add( w, m_td );
		}

		void updateColSpans()
		{
			for( ItemImpl c : m_childs )
			{
				int nbLeaf = c.getNbLeaves();
				c.m_td.setAttribute( "colspan", String.valueOf( nbLeaf ) );
				c.updateColSpans();
			}
		}

		int getNbLeaves()
		{
			if( m_nbLeaves == -1 )
			{
				if( m_childs.isEmpty() )
					m_nbLeaves = 1;
				else
				{
					int nb = 0;
					for( ItemImpl c : m_childs )
						nb += c.getNbLeaves();
					m_nbLeaves = nb;
				}
			}

			return m_nbLeaves;
		}

		int getLevel()
		{
			if( m_level == -2 )
			{
				if( m_parent == null )
					m_level = -1;
				else
					m_level = 1 + m_parent.getLevel();
			}

			return m_level;
		}

		ItemImpl getPreviousAtSameLevel()
		{
			return getPreviousAtLevel( getLevel() );
		}

		ItemImpl getLastDescendant( int level )
		{
			int myLevel = getLevel();
			if( level > myLevel )
				return null;
			if( myLevel == level )
				return this;

			int i = m_childs.size() - 1;
			while( i >= 0 )
			{
				ItemImpl t = getLastDescendant( level );
				if( t != null )
					return t;
				i--;
			}

			return null;
		}

		ItemImpl getPreviousAtLevel( int level )
		{
			if( m_parent == null )
				return null;

			ItemImpl position = this;
			ItemImpl ancestor = m_parent;
			while( ancestor != null )
			{
				int prevIdx = ancestor.m_childs.indexOf( position ) - 1;
				while( prevIdx >= 0 )
				{
					// test getLastDescendant( level )
					ItemImpl t = ancestor.m_childs.get( prevIdx ).getLastDescendant( level );
					if( t != null )
						return t;
					prevIdx--;
				}

				// did not find, so go to superior parent
				position = ancestor;
				ancestor = ancestor.m_parent;
			}

			// did not find, so return null
			return null;
		}
	}

	public ItemImpl addItem( ItemImpl parentItem )
	{
		ItemImpl item = new ItemImpl( parentItem == null ? m_rootItem : parentItem );
		int level = item.getLevel();

		while( m_rows.size() < level + 1 )
		{
			Element tr = DOM.createTR();
			m_thead.appendChild( tr );
			m_rows.add( tr );
		}

		item.m_tr = m_rows.get( level );

		// th is inserted after the last child of our parent
		item.m_td = DOM.createTH();
		ItemImpl previousItem = item.getPreviousAtSameLevel();
		if( previousItem != null )
			item.m_tr.insertAfter( item.m_td, previousItem.m_td );
		else
			item.m_tr.appendChild( item.m_td );

		return item;
	}
}
428168
function drawSteps(){
            let steps = svg.select('.chart-group').selectAll('.step').data(data);

            // Enter
            steps.enter()
              .append('rect')
                .classed('step', true)
                .attr('x', chartWidth) // Initially drawing the steps at the end of Y axis
                .attr('y', ({value}) => yScale(value))
                .attr('width', xScale.bandwidth())
                .attr('height', (d) => (chartHeight - yScale(d.value)))
                .on('mouseover', function(d) {
                    handleMouseOver(this, d, chartWidth, chartHeight);
                })
                .on('mousemove', function(d) {
                    handleMouseMove(this, d, chartWidth, chartHeight);
                })
                .on('mouseout', function(d) {
                    handleMouseOut(this, d, chartWidth, chartHeight);
                })
              .merge(steps)
                .transition()
                .ease(ease)
                .attr('x', ({key}) => xScale(key))
                .attr('y', function(d) {
                    return yScale(d.value);
                })
                .attr('width', xScale.bandwidth())
                .attr('height', function(d) {
                    return chartHeight - yScale(d.value);
                });

            // Exit
            steps.exit()
                .transition()
                .style('opacity', 0)
                .remove();
        }
1061471
def draw(self):
        
        devs = normal(size=self._sig.shape[1])
        p = inner(self._sig, devs) + self._mu
        self._set_stochastics(p)
1055247
def draw(self, painter, options, widget):
        
        self.declaration.draw(painter, options, widget)
1224270
function() {
      var ctxt=this.getContext();
      
      // Canvas Region
      var canvasRegion = Dom.getRegion(this.element);
      var canvasWidth = canvasRegion.right-canvasRegion.left-4;
      var canvasHeight = canvasRegion.bottom-canvasRegion.top-4;
      
      // Clear Rect
      ctxt.clearRect(0,0, canvasWidth, canvasHeight);
      
      // Calculate ratio
      var layerWidth = this.layer.el.scrollWidth;
      var layerHeight = this.layer.el.scrollHeight;
      var hRatio = Math.floor(100*canvasWidth/layerWidth)/100;
      var vRatio = Math.floor(100*canvasHeight/layerHeight)/100;

      // Draw the viewport
      var region = Dom.getRegion(this.layer.el);
      var viewportWidth = region.right-region.left;
      var viewportHeight = region.bottom-region.top;
      var viewportX = this.layer.el.scrollLeft;
      var viewportY = this.layer.el.scrollTop;
      ctxt.strokeStyle= "rgb(200, 50, 50)";
      ctxt.lineWidth=1;
      ctxt.strokeRect(viewportX*hRatio, viewportY*vRatio, viewportWidth*hRatio, viewportHeight*vRatio);
   
      // Draw containers and wires
      ctxt.fillStyle = this.style;
      ctxt.strokeStyle= this.style;
      ctxt.lineWidth=this.lineWidth;
      this.drawContainers(ctxt, hRatio, vRatio);
      this.drawWires(ctxt, hRatio, vRatio);
   }
1197066
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);
        
        this.map.events.on({
            'changebaselayer': this.updateAttribution,
            'changelayer': this.updateAttribution,
            'addlayer': this.updateAttribution,
            'removelayer': this.updateAttribution,
            scope: this
        });
        this.updateAttribution();
        
        return this.div;    
    }
283555
def draw(svg, coords, options={})
      # svg.polygon wants a long string of coords. 
      points_value = "0,#{height} #{stringify_coords(coords).join(' ')} #{width},#{height}"

      # Experimental, for later user.
      # This was supposed to add some fun filters, 3d effects and whatnot.
      # Neither ImageMagick nor Mozilla SVG render this well (at all).  Maybe a future thing.
      #
      # svg.defs {
      #   svg.filter(:id => 'MyFilter', :filterUnits => 'userSpaceOnUse', :x => 0, :y => 0, :width => 200, :height => '120') {
      #     svg.feGaussianBlur(:in => 'SourceAlpha', :stdDeviation => 4, :result => 'blur')
      #     svg.feOffset(:in => 'blur', :dx => 4, :dy => 4, :result => 'offsetBlur')
      #     svg.feSpecularLighting( :in => 'blur', :surfaceScale => 5, :specularConstant => '.75',
      #                             :specularExponent => 20, 'lighting-color' => '#bbbbbb',
      #                             :result => 'specOut') {
      #       svg.fePointLight(:x => '-5000', :y => '-10000', :z => '20000')
      #     }
      #     
      #     svg.feComposite(:in => 'specOut', :in2 => 'SourceAlpha', :operator => 'in', :result => 'specOut')
      #     svg.feComposite(:in => 'sourceGraphic', :in2 => 'specOut', :operator => 'arithmetic',
      #                     :k1 => 0, :k2 => 1, :k3 => 1, :k4 => 0, :result => 'litPaint')
      #                     
      #     svg.feMerge {
      #       svg.feMergeNode(:in => 'offsetBlur')
      #       svg.feMergeNode(:in => 'litPaint')
      #     }
      #   }
      # }
      svg.g(:transform => "translate(0, -#{relative(2)})") {
        svg.polygon(:points => points_value, :style => "fill: black; stroke: black; fill-opacity: 0.06; stroke-opacity: 0.06;")
      }

      svg.polygon(:points => points_value, :fill => color.to_s, :stroke => color.to_s, 'style' => "opacity: #{opacity}")
    end
954807
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);
        if (!this.eTop) {
            // stick in the top bar
            this.eTop = document.createElement("div");
            this.eTop.className = this.displayClass + "Top";
            var theLen = this.topInUnits.length;
            this.div.appendChild(this.eTop);
            if((this.topOutUnits == "") || (this.topInUnits == "")) {
                this.eTop.style.visibility = "hidden";
            } else {
                this.eTop.style.visibility = "visible";
            }

            // and the bottom bar
            this.eBottom = document.createElement("div");
            this.eBottom.className = this.displayClass + "Bottom";
            this.div.appendChild(this.eBottom);
            if((this.bottomOutUnits == "") || (this.bottomInUnits == "")) {
                this.eBottom.style.visibility = "hidden";
            } else {
                this.eBottom.style.visibility = "visible";
            }
        }
        this.map.events.register('moveend', this, this.update);
        this.update();
        return this.div;
    }
198159
function drawSelection(cm) {
    var display = cm.display, doc = cm.doc, result = {};
    var curFragment = result.cursors = document.createDocumentFragment();
    var selFragment = result.selection = document.createDocumentFragment();

    for (var i = 0; i < doc.sel.ranges.length; i++) {
      var range = doc.sel.ranges[i];
      var collapsed = range.empty();
      if (collapsed || cm.options.showCursorWhenSelecting)
        drawSelectionCursor(cm, range, curFragment);
      if (!collapsed)
        drawSelectionRange(cm, range, selFragment);
    }

    // Move the hidden textarea near the cursor to prevent scrolling artifacts
    if (cm.options.moveInputWithCursor) {
      var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
      var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
      result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
                                          headPos.top + lineOff.top - wrapOff.top));
      result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
                                           headPos.left + lineOff.left - wrapOff.left));
    }

    return result;
  }
397420
function() {
        OpenLayers.Control.prototype.draw.apply(this, arguments);
        if (!this.gratLayer) {
            var gratStyle = new OpenLayers.Style({},{
                rules: [new OpenLayers.Rule({'symbolizer':
                    {"Point":this.labelSymbolizer,
                     "Line":this.lineSymbolizer}
                })]
            });
            this.gratLayer = new OpenLayers.Layer.Vector(this.layerName, {
                styleMap: new OpenLayers.StyleMap({'default':gratStyle}),
                visibility: this.visible,
                displayInLayerSwitcher: this.displayInLayerSwitcher
            });
        }
        return this.div;
    }