<html>
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<meta name=Generator content="Microsoft Word 10 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
p
        {margin-right:0cm;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.StyleCourrierlectronique19
        {font-family:Arial;
        color:navy;}
@page Section1
        {size:595.3pt 841.9pt;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=FR link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Hi,</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>1)</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt'>I guess you should either disable the labelcache for
this layer (layerObj.labelcache = mapscript.MS_OFF ) or call layerObj.drawlabelcache
explicitly right after drawing the shapes.<br>
<br>
</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>It’s ok for the
label with (</span></font><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>layerObj.labelcache = mapscript.MS_OFF),
drawlabelcache does not exist on layerObj but on mapObj.</span></font></p>
<p class=MsoNormal><font size=3 face="Times New Roman"><span lang=EN-GB
style='font-size:12.0pt'> </span></font></p>
<p class=MsoNormal style='margin-left:70.8pt;text-indent:35.4pt'><font size=2
face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>lobj.labelcache
= <font color=teal><span style='color:teal'>mapscript</span></font>.MS_OFF;</span></font></p>
<p style='margin-left:70.8pt;text-indent:35.4pt'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>lobj.draw(_lobj.map,
iobj);</span></font></p>
<p style='margin-left:35.4pt'><font size=3 face="Times New Roman"><span
lang=EN-GB style='font-size:12.0pt'>or</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>
lobj.draw(_lobj.map, iobj);</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> lobj.map.</span></font><span
lang=EN-GB>drawlabelcache(iobj);</span></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>2)</span></font></p>
<p><font size=3 face="Times New Roman"><span lang=EN-GB style='font-size:12.0pt'>Here
is a function extracted from my previous project for drawing the legend image,
hopefully it applies to your intents fairly enough.<br>
<br>
private Image CreateLegendImage(layerObj layer, int classindex, int width, int
height, int keysizex, int keysizey)<br>
{<br>
using (classObj def_class
= new classObj(null)) // for drawing legend images<br>
{<br>
using
(imageObj image = def_class.createLegendIcon(map, layer, width, height))<br>
{<br>
classObj layerclass = layer.getClass(classindex);<br>
layerclass.drawLegendIcon(layer.map, layer, keysizex, keysizey,
image, <br>
(width - keysizex) / 2, (height - keysizey)
/ 2);<br>
byte[] img = image.getBytes();<br>
using (MemoryStream ms = new MemoryStream(img)) <br>
{<br>
return Image.FromStream(ms);<br>
}<br>
}<br>
}<br>
}<br>
<br>
</span></font></p>
<p><font size=2 color=navy face=Arial><span lang=EN-GB style='font-size:10.0pt;
font-family:Arial;color:navy'>Your function work but for one class only and
without label, I’m looking for a function which give me the same result
of mapObj.drawLegend with only on layer activate.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Thanks,</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'>Regards.</span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial;color:navy'> </span></font></p>
<div>
<table class=MsoNormalTable border=0 cellpadding=0 width=246 style='width:184.5pt'>
<tr>
<td width=197 style='width:147.75pt;padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal><b><font size=1 color="#eebb22" face=Arial><span
style='font-size:9.0pt;font-family:Arial;color:#EEBB22;font-weight:bold'><a
href="mailto:jmp@geosys.com"><font color="#eebb22"><span style='color:#EEBB22'>Jean-michel
PIERRET</span></font></a> - Poste 376</span></font></b></p>
</td>
</tr>
<tr>
<td width=197 style='width:147.75pt;padding:.75pt .75pt .75pt .75pt'>
<p class=MsoNormal><b><font size=1 color="#999999" face=Arial><span
style='font-size:9.0pt;font-family:Arial;color:#999999;font-weight:bold'>Tel
: +33 (0)5 62 47 80 76</span></font></b><font size=1 color="#999999"
face=Arial><span style='font-size:9.0pt;font-family:Arial;color:#999999'><br>
<b><span style='font-weight:bold'>Mail</span></b> : <a
href="mailto:jmp@geosys.com"><font color="#336699"><span style='color:#336699'>jmp@geosys.com</span></font></a><br>
</span></font><b><font size=1 color="#336699" face=Arial><span
style='font-size:9.0pt;font-family:Arial;color:#336699;font-weight:bold'>GEOSYS
SA</span></font></b></p>
</td>
</tr>
</table>
<p class=MsoNormal><font size=3 color=navy face="Times New Roman"><span
style='font-size:12.0pt;color:navy'> </span></font></p>
</div>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'> </span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=2 face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma'>-----Message d'origine-----<br>
<b><span style='font-weight:bold'>De :</span></b> UMN MapServer Developers
List [mailto:MAPSERVER-DEV@LISTS.UMN.EDU] <b><span style='font-weight:bold'>De
la part de</span></b> Tamas Szekeres<br>
<b><span style='font-weight:bold'>Envoyé :</span></b> vendredi 20 avril
2007 21:15<br>
<b><span style='font-weight:bold'>À :</span></b>
MAPSERVER-DEV@LISTS.UMN.EDU<br>
<b><span style='font-weight:bold'>Objet :</span></b> Re:
[UMN_MAPSERVER-DEV] C# layerObj.draw && layerObj.drawLegend</span></font></p>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:12.0pt;margin-left:
35.4pt'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p>
<div>
<p class=MsoNormal style='margin-left:35.4pt'><span class=gmailquote><font
size=3 face="Times New Roman"><span style='font-size:12.0pt'>2007/4/20, Jean
Michel PIERRET <<a href="mailto:jmp@geosys.com">jmp@geosys.com</a>>:</span></font></span></p>
<div link=blue vlink=purple>
<div>
<p style='margin-left:35.4pt'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'>Hi,</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face=Arial><span style='font-size:
10.0pt;font-family:Arial'> </span></font></p>
<p style='margin-left:35.4pt'><font size=2 face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial'>I'm using mapserver with c# bindings
and i have two questions.</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial'> </span></font></p>
<p style='margin-left:35.4pt'><font size=2 face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial'>1)</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face=Arial><span lang=EN-GB
style='font-size:10.0pt;font-family:Arial'>
</span></font><font size=2 color=teal face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New";color:teal'>layerObj</span></font><font
size=2 face="Courier New"><span lang=EN-GB style='font-size:10.0pt;font-family:
"Courier New"'> lobj = <font color=blue><span style='color:blue'>null</span></font>;</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> </span></font></p>
<p style='margin-left:70.8pt;text-indent:35.4pt'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'>...</span></font></p>
<p style='margin-left:70.8pt;text-indent:35.4pt'><font size=2 face="Courier New"><span
lang=EN-GB style='font-size:10.0pt;font-family:"Courier New"'> </span></font></p>
<p style='margin-left:35.4pt'><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>
<font color=teal><span style='color:teal'>imageObj</span></font> iobj = <font
color=blue><span style='color:blue'>null</span></font>;</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> </span></font></p>
<p style='margin-left:35.4pt'><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>
iobj = lobj.map.prepareImage();</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'>
lobj.draw(_lobj.map, iobj);</span></font></p>
<p style='margin-left:35.4pt'><font size=2 face="Courier New"><span lang=EN-GB
style='font-size:10.0pt;font-family:"Courier New"'> </span></font></p>
<p style='margin-left:35.4pt'><font size=3 face="Times New Roman"><span
lang=EN-GB style='font-size:12.0pt'>In the drawn image, the labels don't
appear, whereas with the method mapObj.draw they are there. It is normal ?.</span></font></p>
</div>
</div>
<div>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
I guess you should either disable the labelcache for this layer
(layerObj.labelcache = mapscript.MS_OFF ) or call layerObj.drawlabelcache
explicitly right after drawing the shapes.<br>
</span></font></p>
</div>
<blockquote style='border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;
margin-left:4.8pt;margin-right:0cm'>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p>
<div link=blue vlink=purple>
<div>
<p style='margin-left:35.4pt'><font size=3 face="Times New Roman"><span
lang=EN-GB style='font-size:12.0pt'>2)</span></font></p>
<p style='margin-left:35.4pt'><font size=3 face="Times New Roman"><span
lang=EN-GB style='font-size:12.0pt'> </span></font></p>
<p style='margin-left:35.4pt'><font size=3 face="Times New Roman"><span
lang=EN-GB style='font-size:12.0pt'>Exist there a method to draw legend for one
layer only and not for all the map. </span></font></p>
</div>
</div>
</blockquote>
<div>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'><br>
Here is a function extracted from my previous project for drawing the legend
image, hopefully it applies to your intents fairly enough.<br>
<br>
private Image CreateLegendImage(layerObj layer, int classindex, int width, int
height, int keysizex, int keysizey)<br>
{<br>
using (classObj
def_class = new classObj(null)) // for drawing legend images<br>
{<br>
using (imageObj image = def_class.createLegendIcon(map, layer, width, height))<br>
{<br>
classObj layerclass = layer.getClass(classindex);<br>
layerclass.drawLegendIcon(layer.map, layer, keysizex,
keysizey, image, <br>
(width - keysizex) / 2, (height -
keysizey) / 2);<br>
byte[] img = image.getBytes();<br>
using (MemoryStream ms = new MemoryStream(img)) <br>
{<br>
return Image.FromStream(ms);<br>
}<br>
}<br>
}<br>
}<br>
</span></font></p>
</div>
<p class=MsoNormal style='margin-right:0cm;margin-bottom:12.0pt;margin-left:
35.4pt'><font size=3 face="Times New Roman"><span style='font-size:12.0pt'><br>
Best regards,<br>
<br>
Tamas</span></font></p>
</div>
<p class=MsoNormal style='margin-left:35.4pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'> </span></font></p>
</div>
</body>
</html>