Изменение свойств объекта.
my_map.geoObjects.each(function(ob){
if( ob.properties.get("ob_type") == "Point" ){
ob.options.set({iconColor: "#EAA6A5"});
ob.properties.set({active: false});
if( ob.properties.get("iconContent") == ptid ){
om_point = ob;
ob.options.set({iconColor: "#f15a22"});
ob.properties.set({active: true});
}
} else if( ob.properties.get("ob_type") == "LineString" ){
ob.options.set({strokeColor: "#EAA6A5"});
ob.properties.set({active: false});
if( ob.properties.get("description") == ptid ){
om_line = ob;
ob.options.set({strokeColor: "#f15a22"});
ob.properties.set({active: true});
}
}
});
Обработка событий:
var new_mark = new ymaps.Placemark( coord,
{
iconCaption: icon_caption,
iconContent: icon_content,
ob_type: "Point",
active: true
}, {
iconColor: color_default,
preset: 'islands#redDotIcon'
});
new_mark.events.add("click", function(e){
var ptid = parseInt( e.get('target').properties.get("iconContent") );
Show_Addr( ptid );
});
new_mark.events.add("mouseenter", function(e){
if( e.get('target').properties.get("active") === false ){
e.get('target').options.set({iconColor: color_mouseenter});
}
});
var new_line = new ymaps.GeoObject({
geometry: {
type: "LineString",
coordinates: coords,
description: descr,
},
properties:{
// hintContent: "",
description: descr,
ob_type: "LineString",
active: true
}},
{
//draggable: true,
strokeColor: "#ed4543",
strokeWidth: 6
});
new_line.events.add("click", function(e){
var ptid = parseInt( e.get('target').properties.get("description") );
Show_Addr( ptid );
});