[OpenLayers-Users] animated markers

Vito Tafuni vitotafuni at gmail.com
Wed Jun 16 06:26:28 EDT 2010


hi Carlo

i'm working on vector layer because it seems to be the right solution.
at the moment i'm drawing a custom (vector) marker and the next step will be
to find a way to animate it (and to show the popup window inside it).

this is the initial code i've wrote to draw a shape on a map
                    var point = e.xy;

                    var markerTemplate = [
                        point,
                        point.offset(new OpenLayers.Pixel(100,0)),
                        point.offset(new OpenLayers.Pixel(100,100)),
                        point
                    ];

                    for(i=0; i<markerTemplate.length; i++){
                        markerTemplate[i] =
map.getLonLatFromViewPortPx(markerTemplate[i]);
                        markerTemplate[i] = new
OpenLayers.Geometry.Point(markerTemplate[i].lon,markerTemplate[i].lat);
                    }

                    var style_mark = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']);
                    style_mark.graphicWidth = 24;
                    style_mark.graphicHeight = 20;
                    style_mark.graphicXOffset = 10; // default is
-(style_mark.graphicWidth/2);
                    style_mark.graphicYOffset = -style_mark.graphicHeight;
                    // graphicTitle only works in Firefox and Internet
Explorer
                    style_mark.graphicTitle = "this is a test tooltip";


                    var feature = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.Polygon(new
OpenLayers.Geometry.LinearRing(markerTemplate)),null,style_mark);

but i've changed it with this
                   OpenLayers.Renderer.symbol.marker = [0,0, 0,-100,
100,-100, 0,0];
                   var style_mark = OpenLayers.Util.extend({},
OpenLayers.Feature.Vector.style['default']);
                   style_mark.graphicName='marker';
                   style_mark.pointRadius=10;

                   var point = map.getLonLatFromViewPortPx(e.xy);
                   var feature = new OpenLayers.Feature.Vector(new
OpenLayers.Geometry.Point(point.lon,point.lat),null,style_mark);

because i wanted a fixed size marker  respect to the zoom level of the map


if someone know how to animate the mark (i've seen a Tween class but i had
no time to experiment!) please write down a link or a sample code!!

Vito



--
-----------
Tafuni Vito
vito at vitotafuni.com
---------------------------------------------
"Verba volant, scripta manent... data corrupted"


2010/6/15 Carlo Sassani <carlo at sarmoung.it>

    Vito Tafuni <vitotafuni at ...> writes:

    > hi to all I would like to make a marker like the "image markers" on
    london2012http://www.london2012.com/map.php
    > click on "Olimpic Park"so i would like to have a "zooming" animation
on a
    marker instead of the info bubble popup
    > do you suggest me to work on markers layout (extending the Marker
class) or
    > with the vector layout (and vector shapes)??thanks Vito
    > _______________________________________________
    > Users mailing list
    > Users at ...
    > http://openlayers.org/mailman/listinfo/users


    I've a similar problem!
    Did you find any solution?




    _______________________________________________
    Users mailing list
    Users at openlayers.org
    http://openlayers.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100616/129b97b1/attachment.html


More information about the Users mailing list