<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE>@font-face {
        font-family: Calibri;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
LI.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
DIV.MsoNormal {
        FONT-SIZE: 11pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Calibri","sans-serif"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        COLOR: windowtext; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-compose
}
.MsoChpDefault {
        mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=815370222-12042010>Hi Jeff,</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=815370222-12042010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=815370222-12042010>that's the styleMap I use to get the effect.
Still in IE the labels with the font-size = 0px will drawn in
very small letters?!</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=815370222-12042010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=815370222-12042010>Labels are a function of the zoomlevel (context) and
the features are a function of the attribute popClass
(UniqueValueRules).</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=815370222-12042010></SPAN></FONT> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>var
styleMapCapitols;</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>function
setStyleMapCapitols()<BR>{<BR> var context =
{<BR> getFontSize :
function(ft){</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2> var
diffZ = map.getZoom() -
4;<BR> var
popclass = parseInt(ft.attributes.popclass);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2>
if(popclass > 10 && map.getZoom() >
1)<BR>
return(map.getZoom() + 7 +
"px");<BR>
else if(diffZ > 0 &&
popclass>9)<BR>
return (10 + 1*diffZ
+"px")<BR>
else if(diffZ >
0)<BR>
return (8 + 1*diffZ
+"px")<BR>
else<BR>
return("0px");<BR>
},<BR> getName : function
(ft){<BR>
return ft.attributes.name;<BR>
}<BR> };<BR> var template =
{<BR> strokeColor:
"#0000FF",<BR> strokeOpacity:
1,<BR> strokeWidth:
3,<BR> fillColor:
"#00AAFF",<BR> fillOpacity:
1,<BR> pointRadius:
5,<BR> pointerEvents:
"visiblePainted",</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2> label :
"${getName}",</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2> labelOffsetX:
"10",<BR> labelOffsetY:
"-10",<BR> fontColor:
"red",<BR> fontSize:
"${getFontSize}",<BR> fontFamily:
"Arial",<BR> fontWeight:
"bold",<BR> labelAlign:
"lt"<BR> };<BR> styleMapCapitols = new
OpenLayers.StyleMap(new OpenLayers.Style(template, {context:context})
);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>
var tata = {fillColor: '#FFAADD', pointRadius: 5, label :
"${getName}",labelOffsetX: "10",labelOffsetY: "20",fontColor: "yellow",fontSize:
"${getFontSize}",fontFamily: "Arial",fontWeight: "bold",labelAlign:
"lt"}</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>
var popArrO = [0.5 ,
0.5 , 0.5 ,
0.5 , 0.5 ,
0.5 , 0.5 ,
0.5 , 0.75 ,
0.75 , 0.75];<BR> var popArrW =
[1 ,
1 , 1 ,
1 ,
1 ,
1 ,
2 ,
2 ,
2 ,
2 , 2 ];<BR> var
popArrR = [2 ,
2 , 3 ,
3 ,
4 ,
4 ,
5 ,
5 ,
6 ,
7 , 10];<BR> var
popArrC = ['#FFFF00', '#00FF00', '#AA00FF', '#0000FF', '#FF8800', '#FF0000',
'#FFAAAA', '#AAFFAA', '#AAAAFF', '#FF00FF', '#FF00AA'];</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>
var lookup = {}; //popclass beginnt mit 1!<BR> for(var
i=0;i<11;i++)<BR>
lookup[i+1] = new OpenLayers.Util.applyDefaults({pointRadius:
popArrR[i], fillColor: popArrC[i], fillOpacity: popArrO[i], strokeWidth:
popArrW[i], strokeColor: popArrC[i]}, tata);</FONT></DIV>
<DIV> </DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2>
styleMapCapitols.addUniqueValueRules("default", "popclass",
lookup);<BR>}<BR>setStyleMapCapitols();<BR></FONT></DIV>
<DIV dir=ltr align=left><SPAN class=815370222-12042010><FONT face=Arial
color=#0000ff size=2>an example:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><A
href="http://gis.ibbeck.de/OLClient/OLClient.asp?KARTE=k10000">http://gis.ibbeck.de/OLClient/OLClient.asp?KARTE=k10000</A></FONT></DIV>
<DIV> </DIV>
<DIV><SPAN class=815370222-12042010></SPAN><U><FONT face=Arial><FONT
color=#0000ff><FONT size=2>A<SPAN
class=815370222-12042010>rnd</SPAN></FONT></FONT></FONT></U><BR></DIV>
<DIV class=OutlookMessageHeader lang=de dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>Von:</B> users-bounces@openlayers.org
[mailto:users-bounces@openlayers.org] <B>Im Auftrag von </B>Jeff
Dege<BR><B>Gesendet:</B> Montag, 12. April 2010 22:19<BR><B>An:</B>
users@openlayers.org<BR><B>Betreff:</B> [OpenLayers-Users] Vector labels at
different zoom levels<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV class=Section1>
<P class=MsoNormal>I'm adding some attributes to the GML data I'm using to draw
a vector layer, and have set the label member of the style object to display
those attributes.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>It works fine, except that it looks lousy when I zoom
out. The labels are still drawn the same, even though the features may be
nearly invisible.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>How do I turn off the rendering of labels, when the scale
exceeds some threshold? (Note - I still want to draw the features, I
simply don't want the labels.)<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal>I've tried adding a listener to map.movestart, that changes
the value of layer.styleMap.styles['default'.defaultStyle.label, but that only
affects future renderings of the map, it has no effect on the current
zoom.<o:p></o:p></P>
<P class=MsoNormal><o:p> </o:p></P></DIV></BODY></HTML>