R: [mapserver-dev] Writing text to image after map rendering
GMail
itacasoft at gmail.com
Sun Oct 30 04:39:09 EDT 2011
Hi Tamas,
the second way is what I used to do before, when I got a map in BMP format. But now I’m using PNG, so I think there is a performance penalty loading the PNG into a .NET image object, drawing and then reconverting it again to PNG.
So (correct me if I’m wrong), I suppose the first method is better from a performance point of view because it avoids PNG->BMP->PNG. I tried it, but I’m probably missing something. This is what I do before the map.Draw():
layerObj layer = new layerObj(userSesson.oGIS);
layer.name = "COPYRIGHT_LAYER";
layer.type = MS_LAYER_TYPE.MS_LAYER_POLYGON;
layer.setMetaData("type", Convert.ToString((int)MS_LAYER_TYPE.MS_LAYER_ANNOTATION));
layer.status = mapscript.MS_ON;
shapeObj polygon = new shapeObj((int)MS_SHAPE_TYPE.MS_SHAPE_POLYGON);
lineObj polyLine = new lineObj();
polyLine.add(new pointObj(12,42, 0, 0));
polyLine.add(new pointObj(12,43,0,0));
polyLine.add(new pointObj(13,43,0,0));
polyLine.add(new pointObj(13,42,0,0));
polyLine.add(new pointObj(12,42,0,0));
polygon.add(polyLine);
classObj aclass = new classObj(layer);
aclass.name = "MyClass";
aclass.setMetaData("name","MyClass");
// Create a style object defining how to draw features
styleObj lineStyle = new styleObj(aclass);
lineStyle.color.setRGB(255,0,0);
// lineStyle.
layer.addFeature(polygon);
I should see a red colored rectangle, but I only see the other layers.
Have you got an example of how to do it?
Fabrizio
Da: Tamas Szekeres [mailto:szekerest at gmail.com]
Inviato: giovedì 27 ottobre 2011 21:37
A: GMail
Cc: mapserver-dev at lists.osgeo.org
Oggetto: Re: [mapserver-dev] Writing text to image after map rendering
Fabrizio,
The most reasonable approach is to add a new annotation layer to the mapObj with the desired transform, opacity and postlabelcache setting.
Alternatively you could load the resulting byte array to a .NET Image object then use GDI+ to draw the text over the image.
Best regards,
Tamas
2011/10/26 GMail <itacasoft at gmail.com>
Hello everybody,
I'm using MapScript-C# to render PNG map images and send it to a Silverlight
client.
Is it possible to write some text (e.g.: copyright information) to the
imageObj before to send the image stream to the client? How?
Thanks
Fabrizio
_______________________________________________
mapserver-dev mailing list
mapserver-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20111030/12663c22/attachment.html
More information about the mapserver-dev
mailing list