Клуб API Карт

Не получается изменить цвет маршрута и иконки маркеров

Пост в архиве.

Привет.

Использую этот пример http://dimik.github.io/ymaps/examples/routes-menu/, само решение подходит полностью, но реализация сложноватая, примеры в песочнице, документация не помогли. Куда там влезть в код, чтобы изменить цвет маршрута и иконки маркеров, и цвет дополнительного маршрута. 

Я добавил в код multiRoute: true

    _getRoute: function (coords, callback) {
        ymaps.route(coords, {
          mapStateAutoApply: true,
          multiRoute: true
        }).then(callback);
    }

Все способы предпринимал в этом отрезке кода

//route-selector-map-view.js

function RouteSelectorMapView(map) {
    this._map = map;
    this._routes = new ListCollection();
    this._activeItem = null;
}

RouteSelectorMapView.prototype = {
    constructor: RouteSelectorMapView,
    render: function (data) {
        this._routes.properties.set('items', data);
        this._map.geoObjects.add(this._routes);		

        return this;
    },
    clear: function () {
        this._routes.removeAll();
        this._map.geoObjects.remove(this._routes);
        this._routes.properties.unset('items');

        return this;
    },
    setActiveItem: function (index) {
        var route = this._routes.get(index);

        if(route) {
            (this._activeItem = route)
               .options.set('visible', true);				       
               this._map.setBounds(route.properties.get('boundedBy'));
        }
        else {
            var self = this,
                coords = this._routes.properties.get('items')[index].path;

            this._getRoute(coords, function (route) {
                self._routes.add(
                    self._activeItem = route,
                    index
                );
            });
        }

        return this;
    },
    unsetActiveItem: function () {
        if(this._activeItem) {
            this._activeItem.options.set('visible', false);
            this._activeItem = null;
        }

        return this;
    },
    _getRoute: function (coords, callback) {
        ymaps.route(coords, {
            mapStateAutoApply: true,
			multiRoute: true
        }).then(callback);
    }	
	
};

Надеюсь на помощь. Спасибо.

3 комментария
Все опции настройки внешнего вида меток и нитки маршрута описаны в документации
В песочнице есть пример их использования
Ничего общего с решением, которое здесь http://dimik.github.io/ymaps/examples/routes-menu/ с примерами в песочнице и точно в документации ((( Какой-то уж очень умный сделал этот пример, в сумме кода очень много, я запутался.


Вот в песочнице 48 строка:


boundsAutoApply: true



В нашем случае это прописывается тут:


_getRoute: function (coords, callback) {
ymaps.route(coords, {
mapStateAutoApply: true,
multiRoute: true
}).then(callback);
}


Логически значит пишем:


_getRoute: function (coords, callback) {
ymaps.route(coords, {
mapStateAutoApply: true,
multiRoute: true,


routeStrokeWidth: 2,
routeStrokeColor: "#000088",
routeActiveStrokeWidth: 6,
routeActiveStrokeColor: "#E63E92"


}).then(callback);
}


Но увы, не работает.
С. З. В.,
надо возвращать MultiRoute вместо вызова ymaps.route, немного переписать код.


Не можете разобраться как и что заменить в уже готовом решении? напишите свое, простое, без ООП и пр. всё-всё-всё в одном файле внутри одной функции ymaps.ready


Я могу помочь поправить этот, если выложите его на jsfiddle и опубликуете тут ссылку