﻿/// <reference path="MicrosoftAjax.js" />
/// <reference path="Continent.js" />

Type.registerNamespace("fdi");

fdi.Continents = function () {
    this._continents = new Array();
}

fdi.Continents.prototype = {
    Add: function (continent) {
        this._continents.push(continent);
    },
    GetContinentByUrlName: function (urlName) {
        for (var index in this._continents) {
            if (this._continents[index].UrlName == urlName) {
                return this._continents[index];
            }
        }
        return null;
    },
    HideAll: function () {
        for (var index in this._continents) {
            this._continents[index].Hide();
        }
    },
    ShowAll: function () {
        for (var index in this._continents) {
            this._continents[index].Show();
        }
    },
    ShowInArea: function (view) {
        /*for (var index in this._continents) {
            var boundingRectangle = this._continents[index].Layer.GetBoundingRectangle();
            if (fdi.ShapeUtils.DoBoundingBoxesIntersect(view, boundingRectangle)) {
                this._continents[index].Show();
            }
            else {
                this._continents[index].Hide();
            }
        }*/
    }
    ,
    GetInArea: function (view) {
        var continentsInArea = [];
        for (var index in this._continents) {
            var boundingRectangle = this._continents[index].Layer.GetBoundingRectangle();
            if (fdi.ShapeUtils.DoBoundingBoxesIntersect(view, boundingRectangle)) {
                continentsInArea[continentsInArea.length] = this._continents[index];
            }
        }
        return continentsInArea;
    }
}

fdi.Continents.registerClass('fdi.Continents', null, Sys.IDisposable);
