<br><br><div><span class="gmail_quote">2007/4/20, Jean Michel PIERRET <<a href="mailto:jmp@geosys.com">jmp@geosys.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="FR">
<div>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;">Hi,</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">I'm using mapserver with c# bindings and i have
two questions.</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB">1)</span></font></p>
<p><font face="Arial" size="2"><span style="font-size: 10pt; font-family: Arial;" lang="EN-GB"> </span></font><font color="teal" face="Courier New" size="2"><span style="font-size: 10pt; color: teal;" lang="EN-GB">
layerObj</span></font><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB">
lobj = <font color="blue"><span style="color: blue;">null</span></font>;</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB"> </span></font></p>
<p style="margin-left: 35.4pt; text-indent: 35.4pt;"><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB">...</span></font></p>
<p style="margin-left: 35.4pt; text-indent: 35.4pt;"><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB"> </span></font></p>
<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB">
<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=""><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB"> </span></font></p>
<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB">
iobj = lobj.map.prepareImage();</span></font></p>
<p style=""><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB">
lobj.draw(_lobj.map, iobj);</span></font></p>
<p><font face="Courier New" size="2"><span style="font-size: 10pt;" lang="EN-GB"> </span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB">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></blockquote><div><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> </div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div link="blue" vlink="purple" lang="FR">
<div><p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB">2)</span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB"> </span></font></p>
<p><font face="Times New Roman" size="3"><span style="font-size: 12pt;" lang="EN-GB">Exist there a method to draw legend for one layer only
and not for all the map. </span></font></p></div></div></blockquote><div><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> </div><br>Best regards,<br><br>Tamas<br><br></div><br>