[OpenLayers-Users] Problems displaying points with rule basedstyle

David Alda Fernandez de Lezea dalda at ikt.es
Tue May 31 04:15:23 EDT 2011


 
Sorry for the double posting, it was a mistake.

-----Mensaje original-----
De: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] En nombre de David Alda Fernandez de Lezea
Enviado el: martes, 31 de mayo de 2011 9:24
Para: users at openlayers.org
Asunto: RV: [OpenLayers-Users] Problems displaying points with rule basedstyle

Any ideas? 

I think I'm using OpenLayers 2.9 and this behaviour is happening in IE8.
 
 
Un saludo,
 
··················································································

David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
 
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)

··················································································
Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
··················································································
email: dalda at ikt.es                                web: www.ikt.es
··················································································

-----Mensaje original-----
De: openlayers-users-bounces at lists.osgeo.org [mailto:openlayers-users-bounces at lists.osgeo.org] En nombre de David Alda Fernandez de Lezea Enviado el: lunes, 11 de abril de 2011 13:27
Para: openlayers-users at lists.osgeo.org
Asunto: [OpenLayers-Users] Problems displaying points with rule based style


Hi list,

I'm trying to display some points in a Vector Layer that has a style map defined. My layer's style map is:

var styles = new OpenLayers.StyleMap({
                "default": new OpenLayers.Style(null, {
                    rules: [
                        new OpenLayers.Rule({
                            symbolizer: {
                                "Point": {
                                    pointRadius: 5,
                                    graphicName: "circle",
                                    fillColor: "#FFA500",
                                    fillOpacity: 0.25,
                                    strokeWidth: 1,
                                    strokeOpacity: 1,
                                    strokeColor: "#FFA500"
                                },
                                "Line": {
                                    strokeWidth: 3,
                                    strokeOpacity: 1,
                                    strokeColor: "#FFA500"
                                },
                                "Polygon": {
                                    strokeWidth: 2,
                                    strokeOpacity: 1,
                                    strokeColor: "#FFA500",
                                    fillColor: "#FFA500"
                                }
                            }
                        })
                    ]
                }),
                "select": new OpenLayers.Style({
                    strokeColor: "#00ccff",
                    strokeWidth: 4,
					strokeDashstyle: "solid"
                }),
                "temporary": new OpenLayers.Style(null, {
                    rules: [
                        new OpenLayers.Rule({
                            symbolizer: {
                                "Point": {
                                    pointRadius: 5,
                                    graphicName: "square",
                                    fillColor: "white",
                                    fillOpacity: 0.25,
                                    strokeWidth: 1,
                                    strokeOpacity: 1,
                                    strokeColor: "#333333"
                                },
                                "Line": {
                                    strokeWidth: 3,
                                    strokeOpacity: 1,
                                    strokeColor: "#00ccff"
                                },
                                "Polygon": {
                                    strokeWidth: 2,
                                    strokeOpacity: 1,
                                    strokeColor: "#0000ff",
                                    fillColor: "#0000ff"
                                }

                            }
                        })
                    ]
                })
            });

And I add my points doing:

var coords = pto.getCoords().split(",");
					
var pointStyle ={
	pointRadius: pto.getGrosor(),
	fillOpacity: 1, 
	strokeOpacity: 1, 
	strokeColor: "black",
	label: pto.getLabelText(),
	labelAlign: "rt",
	strokeWidth: 1, 
	fillColor: "#" + pto.getColor(), 
	graphicName: pto.getTipo(), 
	fontColor: "#" + pto.getLabelColor(),
	fontSize: pto.getLabelSize(),
	fontWeight: "bold"
};

var feat = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(coords[0],coords[1]));

feat.attributes["id"] = pto.getID();
feat.fid = "punto." + pto.getCoords();
feat.state = OpenLayers.State.INSERT;
//feat.renderIntent = "default";

var rule = new OpenLayers.Rule({
	filter: new OpenLayers.Filter.Comparison({
		type: OpenLayers.Filter.Comparison.EQUAL_TO,
		property: "id",
		value: pto.getID()
	}),
	symbolizer: pointStyle
});
pila.styleMap.styles["default"].addRules([rule, new OpenLayers.Rule({elseFilter: true})]);

vectorLayer.addFeatures([feat]);

It's strange because they appear just for one second and suddenly they disappear from the layer!! Has anyone noticed something like this??
 
Thanks.

Regards,
 
Un saludo,
 
··················································································

David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
 
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)

··················································································
Tlfnos.: 945-00-32-95                         Fax: 945-00.32.90
··················································································
email: dalda at ikt.es                                web: www.ikt.es
··················································································
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


More information about the Users mailing list