﻿/********************************************************************
 *
 * Manages Sensors RSS 
 * Author: TTI, Gabriel Torres
 * Date:   January 25, 2008
 *
 *******************************************************************/

var veLayerSensors  = null; //layer is not loaded by default
var bLayerSensors   = false;
var kSensorsSSFile  = "RSS/Sensors.xml?";

// Configure sensor icons
// Created: Gabriel, 5/15/07
function ConfigureSensorIcons(layer)
{
    var iShapes = layer.GetShapeCount();
    for(var i=0; i < iShapes; ++i) {
        var shape = layer.GetShapeByIndex(i);
        shape.SetCustomIcon("<img src='../Images/mvds1.gif' height='12px' width='12px' />");               
    }
}

// Load Sensors layer
// Created: Gabriel, 5/15/07
function LoadSensors(go)
{   
    showProgressIndicator("Loading sensors");
    if (!go)
        setTimeout(function() { LoadSensors(1); }, iAsyncDelay);
    else {
        if (!bLayerSensors) {
            veLayerSensors = new VEShapeLayer();
            var veShapeSpec = new VEShapeSourceSpecification(VEDataType.GeoRSS, 
                              kSensorsSSFile + GetRan(), veLayerSensors);
            map.ImportShapeLayerData(veShapeSpec, ConfigureSensorIcons, false);
            bLayerSensors = true;
        }
        else veLayerSensors.Show();
        hideProgressIndicator();
    }
}

