[OpenLayers-Users] Z-ordering, Y-ordering, Markers with shadows!
_______________________________________________ Users mailing list Users@... http://openlayers.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@... http://openlayers.org/mailman/listinfo/users
You recreate a layer. You should not do that, you must redraw the same
layer that is already added/draw on your map. (use javascript global
variable)
Please, post your email on the mailing-list only.
Thanks,
Alan
David Calle wrote:
> Yeah, I try it.... check this please
> What's wrong...?
>
> ......
> map.addLayers([ruta22, ruta8, manzanas, paradas8,
> paradas22, recorridos]);
> if (!map.getCenter()) map.zoomToMaxExtent();
>
> redrawLayers(true);
> setTimeout("redrawLayers(true)",10*1000);
> }
>
> function redrawLayers()
> {
> var recorridos = new OpenLayers.Layer.MapServer.Untiled(
> "Unidad()", "../../cgi-bin/mapserv",
> {map:'C:/data/publicacion.map',
> layers: 'recorrido',transparent: "true", map_imagetype:
> 'png'});
>
> recorridos.redraw(true);
> }
>
>
> </script>
> </head>
> <body onLoad="init()">
> <table>
> <tr>
> <td align="left"><div id="map"></div></td>
> </tr>
> </table>
> </body>
> </html>
>
>
> ......
>
>
--
--
Alan Boudreault
Mapgears
http://www.mapgears.com/
Hi!!
I'm making a map, and I need to create polygons on it that don´t change its size when the zoom of the map change. I don´t use a mark because I need to rotate it.
Has someone any idea about how I can do it?
I have another problem: I draw different layers with different units and when it is draw the size of the figure is the same in spite of having different measures unit (Km and inches). The code is:
vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", {style: layer_style});
vectorLayer.units="mi";
map.addLayer(vectorLayer);
vectorLayer2 = new OpenLayers.Layer.Vector("Simple Geometry 2", {style: layer_style});
vectorLayer2.units="km";
map.addLayer(vectorLayer2);
var poligonoTriangulo = OpenLayers.Geometry.Polygon.createRegularPolygon(new OpenLayers.Geometry.Point(-20,40),5,3,0);
var triangulo = new OpenLayers.Feature.Vector(poligonoTriangulo,null,style_triangulo);
vectorLayer.addFeatures(triangulo);
var poligonoTriangulo2 = OpenLayers.Geometry.Polygon.createRegularPolygon(new OpenLayers.Geometry.Point(-0,40),5,3,0);
var triangulo2 = new OpenLayers.Feature.Vector(poligonoTriangulo2,null,style_triangulo);
vectorLayer2.addFeatures(triangulo2);
The units are km and mi, but the size of the figures on the map is the same.
Thanks!!!
_______________________________________________ Users mailing list Users@... http://openlayers.org/mailman/listinfo/users
It worked for me, thanks Arnd. I used this : OpenLayers.Feature.Vector.style['default']['cursor'] = 'crosshair'; Try 'default' instead of 'select' Alexandre Arnd Wippermann wrote: > Instead of "select" try "crosshair". > > I init my cursor for select with > OpenLayers.Feature.Vector.style['select']['cursor'] = 'crosshair';, but it > doesn't work. But when i select and then unselect a feature, then the cursor > will change, when I hover over the feature. > > Perhaps it is bug. When I look in my application at the generated svg in > firebug, there is no attribute "cursor". But after a select the attribute is > added. > > Arnd Wippermann > > > -----Ursprüngliche Nachricht----- > Von: adube@... [mailto:adube@...] > Gesendet: Donnerstag, 31. Juli 2008 15:44 > An: Christopher Schmidt > Cc: Arnd Wippermann; users@... > Betreff: Re: [OpenLayers-Users] wfs stylemap example? > > Christopher Schmidt wrote: > >> Alternatively, set your strokeWidth to a larger number (I always use 3). >> >> > Wow ! Haven't though about that but it's a simple and clever solution > :) Thanks. > >> You can't change the color when hovering, but you can change the cursor: >> set OpenLaeyrs.Feature.Vector['default'].cursor = "select"; and it >> will change the cursor when it is over a feature. >> >> >> > I think it's more like : > OpenLayers.Feature.Vector.style['default'].cursor = "select"; but it's not > working. The value "" of the cursor IS changed to "select", but that does > nothing when my mouse is over a feature. > > In OpenLayers.Features, I have Vector and WFS. I assumed that because my > layer is WFS I had to change my cursor there but it has no style. > > Any ideas ? > >> No real way to do that with the current code. Specifically, the reason >> is becasue the event is determined based on the browser saying "Here >> is the element that was under the mouse when the event triggered." But >> making the feature bigger will help. >> >> >> > I will try to think of something. > > -- > Alexandre Dubé > Mapgears > www.mapgears.com > > -- -- Alexandre Dubé Mapgears www.mapgears.com
On Thu, Jul 31, 2008 at 10:44:51PM +0200, Arnd Wippermann wrote: > Instead of "select" try "crosshair". > > I init my cursor for select with > OpenLayers.Feature.Vector.style['select']['cursor'] = 'crosshair';, but it > doesn't work. But when i select and then unselect a feature, then the cursor > will change, when I hover over the feature. Right, this is why I suggested setting it on 'default', not 'select': setting it on select means that it will only happen after you've selected it. > Perhaps it is bug. When I look in my application at the generated svg in > firebug, there is no attribute "cursor". But after a select the attribute is > added. Yep, it's a bug. Since the default cursor is '', when the code loops through, it sets style properties back to defaults if they evaluate to true, and '' evaluates to false, so it's never overridden. > Arnd Wippermann > > > -----Ursprüngliche Nachricht----- > Von: adube@... [mailto:adube@...] > Gesendet: Donnerstag, 31. Juli 2008 15:44 > An: Christopher Schmidt > Cc: Arnd Wippermann; users@... > Betreff: Re: [OpenLayers-Users] wfs stylemap example? > > Christopher Schmidt wrote: > > > > Alternatively, set your strokeWidth to a larger number (I always use 3). > > > Wow ! Haven't though about that but it's a simple and clever solution > :) Thanks. > > You can't change the color when hovering, but you can change the cursor: > > set OpenLaeyrs.Feature.Vector['default'].cursor = "select"; and it > > will change the cursor when it is over a feature. > > > > > I think it's more like : > OpenLayers.Feature.Vector.style['default'].cursor = "select"; but it's not > working. The value "" of the cursor IS changed to "select", but that does > nothing when my mouse is over a feature. > > In OpenLayers.Features, I have Vector and WFS. I assumed that because my > layer is WFS I had to change my cursor there but it has no style. > > Any ideas ? > > No real way to do that with the current code. Specifically, the reason > > is becasue the event is determined based on the browser saying "Here > > is the element that was under the mouse when the event triggered." But > > making the feature bigger will help. > > > > > I will try to think of something. > > -- > Alexandre Dubé > Mapgears > www.mapgears.com > > _______________________________________________ > Users mailing list > Users@... > http://openlayers.org/mailman/listinfo/users -- -- Christopher Schmidt MetaCarta
On Fri, Aug 01, 2008 at 08:39:54AM +0200, Jose A. C. wrote: > I'm making a map, and I need to create polygons on it that don´t change its > size when the zoom of the map change. I don´t use a mark because I need to > rotate it. Sounds like you want this: http://openlayers.org/dev/examples/graphic-name.html There's a set of constants in OpenLayers.Renderer.symbol in OpenLayers.Renderer.Elements which you could extend. > I have another problem: I draw different layers with different units and > when it is draw the size of the figure is the same in spite of having > different measures unit (Km and inches). The code is: The units of the layer have no control over anything. Your units you are providing are *map* units -- and the *name* you give to those units is irrelevant. What you want to do is change the size of the units. If you want to create something that's a different size, you need to provide the correct size in current map units. (Your map is probably in degrees.) Regards, -- -- Christopher Schmidt MetaCarta
Hi list,
I was wondering something : when we select a feature using a select
or modify control, the feature changes its color... In fact, I saw that
it the renderer that draws a feature ( which draw geometry ) using a
given style.
My question is : does the renderer actually draw a new feature over
the original one or it really changes the color ? The renderer does not
contain any feature, but it can draw features ?
I'm trying to figure out how it works because I am able to "change"
color when my mouse is over a feature without selecting it, but I'm
trying to undo the changes as soon as the mouse isn't over anymore and
it's not working.
Here's a code snippet :
var drawnGeometry = null;
var styleBlue = OpenLayers.Util.extend(
{},
OpenLayers.Feature.Vector.style['default']);
styleBlue.strokeColor = "blue";
styleBlue.strokeWidth = 4;
function changeColorOnOverFeature(e){
// if no feature is selected, then we want to change the color of a
// feature when over it
if (!getSelectedFeature(this)){
if (drawnGeometry != null){
this.renderer.eraseGeometry(drawnGeometry); // I'm pretty
sure this is wrong
drawnGeometry = null;
}
else {
oFeature = this.getFeatureFromEvent(e);
if(oFeature){
this.renderer.drawFeature(oFeature, styleBlue);
drawnGeometry = oFeature.geometry;
}
}
}
}
// inside my init()
oMap.events.register("mousemove", olWFSRoads, changeColorOnOverFeature);
Erasing the geometry makes the feature disappear, but it's still in the
layer features, with no changes of its geometry and all... I'm quite
sure this is not the best way to do it. Any clues ?
--
--
Alexandre Dubé
Mapgears
www.mapgears.com
_______________________________________________ Users mailing list Users@... http://openlayers.org/mailman/listinfo/users
_______________________________________________ Users mailing list Users@... http://openlayers.org/mailman/listinfo/users
On Fri, Aug 1, 2008 at 3:48 PM, Alexandre Dube <adube@...> wrote: > Hi list, > > I was wondering something : when we select a feature using a select > or modify control, the feature changes its color... In fact, I saw that > it the renderer that draws a feature ( which draw geometry ) using a > given style. > > My question is : does the renderer actually draw a new feature over > the original one or it really changes the color ? It changes its color. > The renderer does not > contain any feature, but it can draw features ? Yes. > I'm trying to figure out how it works because I am able to "change" > color when my mouse is over a feature without selecting it, but I'm > trying to undo the changes as soon as the mouse isn't over anymore and > it's not working. > > Here's a code snippet : > > var drawnGeometry = null; > > var styleBlue = OpenLayers.Util.extend( > {}, > OpenLayers.Feature.Vector.style['default']); > styleBlue.strokeColor = "blue"; > styleBlue.strokeWidth = 4; > > function changeColorOnOverFeature(e){ > // if no feature is selected, then we want to change the color of a > // feature when over it > if (!getSelectedFeature(this)){ > if (drawnGeometry != null){ > this.renderer.eraseGeometry(drawnGeometry); // I'm pretty > sure this is wrong > drawnGeometry = null; > } > else { > oFeature = this.getFeatureFromEvent(e); > if(oFeature){ > this.renderer.drawFeature(oFeature, styleBlue); > drawnGeometry = oFeature.geometry; > } > } > } > } > > // inside my init() > oMap.events.register("mousemove", olWFSRoads, changeColorOnOverFeature); > > > Erasing the geometry makes the feature disappear, but it's still in the > layer features, with no changes of its geometry and all... I'm quite > sure this is not the best way to do it. Any clues ? You should use a feature handler (Handler.Feature) to detect mouseover/mouseout on features. Look at the select feature control to understand how to use it. -- Eric
RSS Feed121 | |
|---|---|
167 | |
255 | |
271 | |
213 | |
212 | |
292 | |
251 | |
285 | |
229 | |
327 | |
287 | |
335 | |
306 | |
354 | |
423 | |
303 | |
381 | |
379 | |
317 | |
352 | |
453 | |
345 | |
486 | |
390 | |
322 | |
517 | |
371 | |
397 | |
419 | |
494 | |
354 | |
384 | |
575 | |
508 | |
369 | |
370 | |
509 | |
611 | |
488 | |
413 | |
349 | |
492 | |
564 | |
608 | |
536 | |
456 | |
466 | |
418 | |
499 | |
499 | |
485 | |
588 | |
449 | |
552 | |
605 | |
538 | |
499 | |
402 | |
386 | |
331 | |
450 | |
314 | |
276 | |
414 | |
35 |