How to set a src manually in OpenLayer 3?

المشرف العام

Administrator
طاقم الإدارة
I'd like to know how to set manually a src for add one or more icon.

I've been finding a method in OpenLayer 3 to set it but, without sucess.

For example, time ago I wrote the following code to set the color manually. It works.

var sectoresVector = new ol.layer.Vector({ style: (function() { var style = new ol.style.Style({ stroke: new ol.style.Stroke({ color: '#FFFFFF', width: 3 }), fill: new ol.style.Fill({ //color: [0, 0, 130, 0.2] }), }); var styles = [style]; return function(feature, resolution) { var colorChoosed = settingColorToSector(feature); //The following code line I set the color like I want to. style.getFill().setColor(colorChoosed); return styles; }; })(), }); Do you have any idea? Thank!



أكثر...
 
أعلى