C# question

Sean Gillies sgillies at FRII.COM
Sat Apr 16 10:48:08 EDT 2005


On Apr 16, 2005, at 7:57 AM, Constantin Cristian wrote:

> This is a multi-part message in MIME format.
>
> ------=_NextPart_000_0355_01C542A5.509D2480
> Content-Type: text/plain;
>         charset="iso-8859-1"
> Content-Transfer-Encoding: quoted-printable
>
> Hello
>
> Does any one any idea how to implement i_obj.write method instead of =
> i_obj.save, for example if I want to use the stream with =
> "System.Drawing.Bitmap.FromStream" method.
>
> Here is some code:
>
> mapObj m_obj =3D new mapObj("C:\\ms4w\\apps\\work\\test.map");=20
>
> Console.WriteLine ("# Map layers " + m_obj.numlayers + "; Map name =3D
> " =
> + m_obj.name);=20
>
> for (int i=3D0; i<m_obj.numlayers; i++)=20
>
> {
>
> Console.WriteLine("Layer [" + i + "] name: " + m_obj.getLayer(i).name);
>
> }
>
>
> imageObj i_obj =3D m_obj.draw();
>
> Console.WriteLine("Image URL =3D " + i_obj.imageurl + "; Image path
> =3D =
> " + i_obj.imagepath);=20
>
> Console.WriteLine("Image height =3D " + i_obj.height + "; width =3D "
> + =
> i_obj.width);=20
>
>
> i_obj.save("test.png",m_obj);
>
> Any sample code will be greatly appreciated....:)
>

For versions before 4.5, the Python mapscript module has a
imageObj.write method.  You could look at that for an example.
Beginning with version 4.6 we have a standard imageObj.getBytes method
that is shared by all mapscripts (except PHP).  However, it requires a
small bit of extra code that is language specific and converts
getByte's output structure into a string or array type for the target
language.  So far we only have these typemaps for Java and Python.

The C# module is in need of someone(s) who will study the details of
SWIG/C# and implement the proper typemap.  Not being a C# user myself,
I can not justify spending my personal resources on this, but I can
provide some general assistance and coaching on how to write SWIG
typemaps.

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies



More information about the mapserver-users mailing list