[OpenLayers-Dev] [OpenLayers-Trac] [OpenLayers] #736: external graphic as style for vector points

Andreas Hocevar andreas.hocevar at gmail.com
Thu Jun 7 04:47:56 EDT 2007


Hi,

On 6/7/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Wed, Jun 06, 2007 at 11:35:17PM -0400, Stephen Woodbridge wrote:
> > I find the pointRadius to be a little counter intuitive for seting the
> > the image width, but I live with that.

Ok, you do not have to live with that, because you have more options now.

> I kind of liked 'image' until I realized it could actually be an svg
> file, at which point graphicWidth/graphicHeight seemed to make more
> sense.
> > If one is set then the other
> > is computed based on the apsect ratio, if both are set then the image is
> > stretched to fit.

That is exactly what I implemented now.

> I'm not sure that this is possible, but it does seem like the best
> possibility. Andreas, can you comment on the technical feasability of
> this? I assume like an <img /> tag that the graphic will scale to fit if
> it's marked with a size in one direction.

Ok, what I do now is to look if both width and height are set. If so,
I want the aspect ratio of the image to be ignored. This can be set by
an attribute. In SVG, you have to set it if you want the aspect ratio
to be ignored, in VML it has to be set if the aspect ratio is to be
kept.

> > Or you could add an additional attribute like
> > keepAspectRatio: true/false
> I don't like this is we can avoid it.

No need to have that.

I committed the new code to the camptocamp sandbox, coming to a live
demo near you soon:
http://dev.openlayers.org/sandbox/camptocamp/externalGraphics/examples/vector-features.html

Regards,
Andreas



More information about the Dev mailing list