1

I have an application where each element has an angle. I can use "Angle" function in "style" but not individual. Is there any way to apply angle individually? enter image description here

function DesenhaPonto(Id, Estilo, Longitude, Latitude, Source, Angulo) {
            try {

                var coordinates = [Longitude, Latitude];
                var feat = new ol.Feature(new ol.geom.Point(coordinates));
                feat.setStyle(Estilo);
               // feat.angle(Angulo); <---- We need set individual Angle here.
                feat.name = Id;
                Source.addFeature(feat);
            } catch (e) {
                TrataErro(e);
            }
        }

1 Answer 1

0

I presume your Estilo contains a regular shape image which can have an angle property, but to avoid run time errors that should be tested, then you can set it in the style. You should also clone the style if one style might be used by features with different angles.

 if (Estilo.getImage() && Estilo.getImage().setAngle) {
   Estilo.getImage().setAngle(Angulo);
 }
 feat.setStyle(Estilo.clone());

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.