<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<STYLE type=text/css>DIV {
        MARGIN: 0px
}
</STYLE>
<META name=GENERATOR content="MSHTML 8.00.6001.19019"></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011>Hi,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011>look at the OpenLayers examples</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011><A
href="http://dev.openlayers.org/releases/OpenLayers-2.10/examples/styles-unique.html">http://dev.openlayers.org/releases/OpenLayers-2.10/examples/styles-unique.html</A><BR><A
href="http://dev.openlayers.org/releases/OpenLayers-2.10/examples/style-rules.html">http://dev.openlayers.org/releases/OpenLayers-2.10/examples/style-rules.html</A></SPAN></FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011>Below some code how I do things.</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011>Arnd</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2 face=Arial><SPAN
class=031585721-06042011></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT color=#0000ff size=2
face=Arial>/*<BR> * OpenLayers.Filter.Comparison.EQUAL_TO =
"==";<BR> * OpenLayers.Filter.Comparison.NOT_EQUAL_TO =
"!=";<BR> * OpenLayers.Filter.Comparison.LESS_THAN =
"<";<BR> * OpenLayers.Filter.Comparison.GREATER_THAN =
">";<BR> *
OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO =
"<=";<BR> *
OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO =
">=";<BR> * OpenLayers.Filter.Comparison.BETWEEN =
"..";<BR> * OpenLayers.Filter.Comparison.LIKE =
"~";</FONT></DIV>
<DIV> </DIV><FONT color=#0000ff size=2 face=Arial>
<DIV dir=ltr align=left><BR> * OpenLayers.Filter.Logical.AND =
"&&";<BR> * OpenLayers.Filter.Logical.OR =
"||";<BR> * OpenLayers.Filter.Logical.NOT = "!";<BR>*/</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>function createRule(theField, theValue, theType,
theGeom, theSymbolizer, theElseFilter, theRuleName)<BR>{<BR>
var filter = new
OpenLayers.Filter.Comparison({<BR>
type: theType,<BR> property:
theField,<BR> value:
theValue<BR> });</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> var rule = new
OpenLayers.Rule({<BR> name :
theRuleName,<BR> filter:
filter,<BR>
elseFilter:theElseFilter<BR> });</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left> rule.symbolizer[ theGeom /* "Point"
or "Line" or "Polygon" */] = theSymbolizer;<BR>
return(rule);<BR>}</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>var styleMapTest;</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>var Symbolizers = {<BR> Turm:
{<BR> strokeColor:
"#0000FF",<BR> strokeOpacity:
1,<BR> strokeWidth:
3,<BR> fillColor:
"#00AAFF",<BR> fillOpacity:
1,<BR> pointRadius:
5<BR> },<BR> Kirche:
{<BR> strokeColor:
"#FF00FF",<BR> strokeOpacity:
1,<BR> strokeWidth:
3,<BR> fillColor:
"#00AAFF",<BR> fillOpacity:
1,<BR> pointRadius:
5<BR> },<BR> Denkmal:
{<BR> strokeColor:
"#00FF00",<BR> strokeOpacity:
1,<BR> strokeWidth:
3,<BR> fillColor:
"#00AAFF",<BR> fillOpacity:
1,<BR> pointRadius:
5<BR> },<BR> Else:
{<BR> strokeColor:
"#FF0000",<BR> strokeOpacity:
1,<BR> strokeWidth:
3,<BR> fillColor:
"#00AAFF",<BR> fillOpacity:
1,<BR>
graphicName:"star",<BR> pointRadius:
5<BR> },<BR> Line :
{<BR> strokeColor:
"#00FF00",<BR> strokeOpacity:
1,<BR> strokeWidth:
3,<BR> pointRadius:
5<BR> },<BR> Polygon:
{<BR> strokeColor:
"#FF0000",<BR> strokeOpacity:
1,<BR> strokeWidth:
3,<BR> fillColor:
"#FFAA00",<BR> fillOpacity:
1,<BR> pointRadius:
5<BR> },<BR> Text:
{<BR> label :
"${name}",<BR> labelXOffset:
"10",<BR> labelYOffset:
"-10",<BR> fontColor:
"red",<BR> fontSize:
"12px",<BR> fontFamily:
"Arial",<BR> fontWeight:
"bold",<BR>
display:"${getVisibility}",<BR>
labelAlign: "lt"<BR> }<BR>};</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>styleMapTest = new OpenLayers.StyleMap();</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>var rules = [];<BR>rules.push(createRule("kategorie",
"TURM", OpenLayers.Filter.Comparison.EQUAL_TO, "Point",
Symbolizers["Turm"], false, "TURM"));<BR>rules.push(createRule("kategorie",
"KIRCHE", OpenLayers.Filter.Comparison.EQUAL_TO, "Point",
Symbolizers["Kirche"], false, "KIRCHE"));<BR>rules.push(createRule("kategorie",
"DENKMAL", OpenLayers.Filter.Comparison.EQUAL_TO, "Point",
Symbolizers["Denkmal"], false,
"DENKMAL"));<BR>rules.push(createRule("kategorie", "DENKMAL",
OpenLayers.Filter.Comparison.NOT_EQUAL_TO, "Text", Symbolizers["Text"], true,
"ELSE"));</DIV>
<DIV> </DIV>
<DIV dir=ltr align=left>styleMapTest.styles["default"].addRules(rules);</DIV>
<DIV> </DIV>
<DIV dir=ltr
align=left>map.layers[map.aktLayer]["styleMap"]=styleMapTest;<BR>map.layers[map.aktLayer].redraw();<BR></DIV>
<DIV dir=ltr align=left> </DIV></FONT><BR>
<DIV dir=ltr lang=de class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>Von:</B> openlayers-users-bounces@lists.osgeo.org
[mailto:openlayers-users-bounces@lists.osgeo.org] <B>Im Auftrag von </B>Robert
Buckley<BR><B>Gesendet:</B> Mittwoch, 6. April 2011 22:17<BR><B>An:</B>
users@openlayers.org<BR><B>Betreff:</B> [OpenLayers-Users] vector polygon
styling with rules<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV
style="FONT-FAMILY: arial,helvetica,sans-serif; COLOR: #40007f; FONT-SIZE: 10pt">Hi,<BR><BR>I´m
having a bad time trying to set styles to vector features,<BR><BR>I have made
this...<BR><BR><BR>
<DIV>var style_solar = new OpenLayers.StyleMap({<BR>
"default": new
OpenLayers.Style(OpenLayers.Util.applyDefaults({<BR>
fillOpacity: 0.6, <BR>
fillColor: '#000000'<BR>
},
OpenLayers.Feature.Vector.style["default"])),<BR>
"select": new
OpenLayers.Style(OpenLayers.Util.applyDefaults({<BR>
fillOpacity: 0.6, <BR>
fillColor:
'#FF0000'<BR>
},
OpenLayers.Feature.Vector.style["select"]))<BR>
});<BR><BR><BR>which works ok...but I really need to add rules according to the
wfs property "solar_kopf"<BR><BR>How can I apply rules to the stylemap?<BR><BR>I
have tried numerous times but they all fail.<BR><BR>Could anyone provide me with
a couple of examples?<BR><BR>yours,<BR><BR>Robert<BR></DIV></DIV></BODY></HTML>