﻿// Draws GeoRSS Feeds
TNRIS.GeoRSSLayer = function(config) {
    TNRIS.GeoRSSLayer.superclass.constructor.call(this, config);
};

Ext.extend(TNRIS.GeoRSSLayer, TNRIS.LayerBase, {
    addToMap: function(id, map, index, mapPanel) {
        this.mapId(id);
        this.map(map);
        this.mapPanel(mapPanel);
        this.shapeLayer = new VEShapeLayer();
        var source = this.georss_url();
        var spec = new VEShapeSourceSpecification(VEDataType.ImportXML, this.georss_url(), this.shapeLayer);
        try {
            var m = map.ImportShapeLayerData(spec, function(layer) {
                var l = layer;
                this.fireEvent('loadmap');
            }, false);
        } catch (e) {
            var t = e;
        }
        return true;
    },
    
    redraw: function() {
        if (this.visible()) {
            this.shapeLayer.Show();
        } else {
            this.shapeLayer.Hide();
        }
    },

    
    removeFromMap: function() {
        this.map().DeleteShapeLayer(this.shapeLayer);
    },
    
    georss_url: function(value) {
        return this.defaultMethod('georss_url', value);
    }
});

if (typeof(Sys) !== "undefined") { Sys.Application.notifyScriptLoaded(); }
