c#-mapscript, display Image without saving on disk and zoom

Tamas Szekeres szekerest at GMAIL.COM
Sat Jun 10 16:56:53 EDT 2006


Christian,

Beginning with 4.8.0 you can utilize imageObj.getBytes to get the generated
image as a byte array. You can use for example:

private void RefreshMap()
{
	using(imageObj image = myMap.draw())
	{
		byte[] img = image.getBytes();
		using (MemoryStream ms = new MemoryStream(img))
		{
			Image mapimage = Image.FromStream(ms);
			if (this.map.Image != null)
			{
				this.map.Image.Dispose();
				this.map.Image = null;
			}
			this.map.Image = mapimage;
		}

	}
}

Alternatively if you are using the CVS version you can use
imageObj.write(System.IO.Stream stream) to write 
the contents of the image onto a previously generated stream object.

I hope your zoom problem could be solved accordingly.

Note: If you would like use mapObj.zoomRectange() the miny and maxy of the
given rectangle should be swapped with the previous releases. For example:


private void ZoomRectangle(rectObj imgrect)
{
	double c = imgrect.miny;
	imgrect.miny = imgrect.maxy;
	imgrect.maxy = c;
	map.zoomRectangle( imgrect, myMap.width, myMap.height, myMap.extent,
null);
	RefreshMap();
}

This problem was corrected with the current CVS HEAD.

Best Regards,

Tamas




-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU] On
Behalf Of Christian Wilmes
Sent: Thursday, June 08, 2006 6:01 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU
Subject: [UMN_MAPSERVER-USERS] c#-mapscript, display Image without saving on
disk and zoom

Hi All,

I've got 2 questions about c#-mapscript:

1. Is it possible to display the image coming from the mapserver without
saving it on disc before?
In the moment I only realized it with saving on disc:
            imageObj image = myMap.draw();
            image.save("test.jpeg", myMap);
            this.map.Image = Image.FromFile("test.jpeg"); 

2. I'm trying to realize a zoom, but theres the same problem again....how
can I do that without saving the image. If I save the Image the zoom is
correct.
In the moment my zoom-function looks like that (it doesn't work):
        public void zoomIn(Object obj, MouseEventArgs ea)
        {
            myMap.zoomPoint(2, new pointObj(ea.X, ea.Y, 0, 0), 
                this.map.Width, this.map.Height, 
                myMap.extent, 
                new rectObj(-90, -180, 90, 180, 0));
            imageObj image = myMap.draw();
            this.map.Refresh();
        }


I would be very thankful for any help!

Best Regards
Christian
-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 2006.06.09.
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.8.3/360 - Release Date: 2006.06.09.
 



More information about the mapserver-users mailing list