[OpenLayers-Users] Keep Feature.Vector visible near the maps border

Arnd Wippermann arnd.wippermann at web.de
Wed Feb 17 16:27:06 EST 2010


Hi,

I use externalGraphic as Image layer and had the same problem. The image
vanished, when the point lie outside the view. 

I have patched for this purpose the drawFeature function of renderer.js (as
Andreas suggest). I add an attribute render="drawAlways" to my feature(s)
and in the patched function I test for the attribute.

It works perfect.

    drawFeature: function(feature, style) {
        if(style == null) {
            style = feature.style;
        }
        if (feature.geometry) {
            var bounds = feature.geometry.getBounds();
            if(bounds) {
                if(!bounds.intersectsBounds(this.extent) &&
(feature.attributes.render == "undefined" || feature.attributes.render !=
"drawAlways"))
                    {style={display:"none"};
                }
                /*
                if (!bounds.intersectsBounds(this.extent)) {
                    style = {display: "none"};
                }
                */
                var rendered = this.drawGeometry(feature.geometry, style,
feature.id);
                if(style.display != "none" && style.label && rendered !==
false) {
                    this.drawText(feature.id, style,
feature.geometry.getCentroid());
                } else {
                    this.removeText(feature.id);
                }
                return rendered;
            }
        }
    },

http://gis.ibbeck.de/ginfo/apps/OLExamples/OL27/examples/ExternalGraphicOver
lay/ExternalGraphicOverlay.asp
The examples shows the use of externalGraphic as Image layer with the
possibility to rotate an image.

Arnd



-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von J.Schumann
Gesendet: Mittwoch, 17. Februar 2010 17:24
An: users at openlayers.org
Betreff: [OpenLayers-Users] Keep Feature.Vector visible near the maps border


Hi!

I'm using OpenLayers.Feature.Vector with OpenLayers.Geometry.Point and a
StyleMap using an externalGraphic. This works good except the fact that the
features dissappear to early near the map border, when the Point leaves the
viewport. But I need the externalGraphic to stay visible for some more
pixels even when the graphics center / the Geometry.Point leaves the map. Is
there any threshold I can set for this purpose?

Best regards,
J.Schumann
--
View this message in context:
http://n2.nabble.com/Keep-Feature-Vector-visible-near-the-maps-border-tp4586
959p4586959.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list