// ---------------------------------------------------------
// VRoute class
// Маршрут.
// ---------------------------------------------------------

/** extends VMapObject */
VRoute.prototype = new VMapObject();

/** Дистанция. */
VRoute.prototype._distance = null;

/**
 *  @public
 *  Устанавливает дистанцию по маршруту.
 *  @param {float} distance расстояние.
 */
VRoute.prototype.distance = function(distance) {
    if (arguments.length == 0) return this._distance;
    this._distance = distance;

    return this;
}

/**
 *  @category = Routes
 *  @class
 *  Маршрут.
 *  @param {VEdge[]} edges массив участков.
 *  @constructor
 */
function VRoute(edges) {
    VMapObject.call(this); // extends

    if (edges != null) this.edges(edges);
    this._type = "route";

    return this;
}

/**
 *  @public
 *  Возвращает массив участков.
 *  @param {VEdge[]} edges массив участков.
 *  @returns {VEdge[]} массив учатсков.
 */
VRoute.prototype.edges = function(edges) {
    if (arguments.length == 0) return this._childs;
    this._childs = edges;

    return this;
};


// ---------------------------------------------------------
// VEdge class
// Участок маршрута.
// ---------------------------------------------------------

/** extends VLine */
VEdge.prototype = new VLine();

/** Наименование участка. */
VEdge.prototype._name = null;

/** Дистанция. */
VEdge.prototype._distance = null;

/**
 *  @category = Routes
 *  @class
 *  Участок маршрута.
 *  @param {Object} [coords] массив координат.
 *  @constructor
 */
function VEdge(coords) {
    VLine.call(this, coords); // extends

    return this;
}

/**
 *  @public
 *  Устанавливает название участка.
 *  @param {String} name расстояние.
 */
VEdge.prototype.name = function(name) {
    if (arguments.length == 0) return this._name;
    this._name = name;

    return this;
}

/**
 *  @public
 *  Устанавливает дистанцию по маршруту.
 *  @param {float} distance расстояние.
 */
VEdge.prototype.distance = function(distance) {
    if (arguments.length == 0) return this._distance;
    this._distance = distance;

    return this;
}

VMapObject.prototypes["route"] = VRoute.prototype;
VMapObject.prototypes["edge"] = VEdge.prototype;