我在api 1.0中有这个样式
var s = new YMaps.Style();
s.iconStyle = new YMaps.IconStyle();
s.iconStyle.offset = new YMaps.Point(-1, -30);
s.iconStyle.href = "http:www.example.com/images/1.png";
s.iconStyle.size = new YMaps.Point(29, 28);
s.iconStyle.shadow = new YMaps.IconShadowStyle();
s.iconStyle.shadow.offset = new YMaps.Point(2, -12);
s.iconStyle.shadow.href = "http:www.example.com/images/2.png";
s.iconStyle.shadow.size = new YMaps.Point(29, 7);
这里我将这些样式添加到地标
var placemark = new YMaps.Placemark(new YMaps.GeoPoint(lat, long),
{hasBalloon: false,
style: s
});
placemark.setHintContent(mystring);
placemark.enableHint();
map.addOverlay(placemark);
如何在api 2.0中创建这个样式?
答案 0 :(得分:0)
我这样解决:
placemark.options.set('iconImageHref', 'http:www.example.com/images/1.png');
placemark.options.set('iconImageOffset', [-1, -30]);
placemark.options.set('iconImageSize', [28,29]);
placemark.options.set('iconShadowImageHref', 'http:www.example.com/images/2.png');
placemark.options.set('iconShadowImageOffset', [2, -12]);
placemark.options.set('iconShadowImageSize', [29, 7]);