[OpenLayers-Users] Center of rotation for vector features

Mike Purvis mike at uwmike.com
Wed May 12 17:23:52 EDT 2010


Related question—

Say that I have multiple objects that I'd like to be able to rotate
independently of each other. It seems like the tool for the job is the
substitution engine found in OpenLayers.Style. Currently, I'm just setting
the symbolizer directly on each of my features, so my question is, is it
possible to take advantage of OpenLayers.Style without having to deal with
the complication and complexity of OpenLayers.StyleMap?

I attempted to wrap my style hashes in the OpenLayers.Style class and then
pass them into the Feature constructor as before, but it didn't display
anything at all.

As an alternative, I could just create a per-Feature clone of the style hash
("symbolizer"), and inject my rotation parameter directly into each one, but
this seem inelegant.

What would be the best course of action?



On Wed, May 12, 2010 at 3:23 AM, Andreas Hocevar <ahocevar at opengeo.org>wrote:

> This sounds like an issue we had in OpenLayers 2.9, but was fixed in 2.9.1.
> Make sure you are using the latest version.
>
> Regards,
> Andreas.
>
> On May 12, 2010, at 02:16 , Mike Purvis wrote:
>
> > Hey,
> >
> > I'm having an issue with specifying rotation for one of my features. It's
> a point feature with a externalGraphic specified, and the center of rotation
> of the feature seems to be initially set to the feature's own Point.
> >
> > However, when I programmatically move the feature, the center of rotation
> doesn't move with it, and the feature's rotation against an external center
> causes it to be way off-position.
> >
> > I've tried implementing the move both by updating the x and y fields
> directly in the Point object itself, and also by using the Feature.move
> function. Neither has the desired effect—using the Web Inspector, I can
> clearly see the SVG element and the rotation is being specified in (angle,
> cx, cy) form.
> >
> > As a last resort, I'm willing to use external JavaScript to find the
> element and manually insert the rotation which I require, but is there some
> way to do it "properly" using OpenLayers' own rotation stylings?
> >
> > Thanks,
> >
> > Mike
> > _______________________________________________
> > Users mailing list
> > Users at openlayers.org
> > http://openlayers.org/mailman/listinfo/users
>
>
>
> --
> Andreas Hocevar
> OpenGeo - http://opengeo.org/
> Expert service straight from the developers.
>
>


-- 
http://uwmike.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100512/996e227d/attachment.html


More information about the Users mailing list