Pan and zoom - as per kraghavk's post

Dec 1, 2010 at 10:12 PM
Hi
I am attempting to use the pan and zoom features as outlined in kraghavik's post at the bottom of this page.
I keep getting the error "name MapImage could not be found" - even though I have placed SharpMap.Forms in the using column and have included the following .dll as reference.
GeoApi
SharpMap
SharpMap.Extensions
SharpMap.UI
ProjNet
I have also tried copying MapImage.cs and put it in the Forms path.
I would appreciate any suggestions as to what I may still be missing.
Bob
Coordinator
Dec 2, 2010 at 7:45 AM

Hello BobPawley,

the current version in the trunk has a PanOrQuery tool, is it that what you are looking for?

If you use the actual version from trunk, you might have set a compiler switch which includes MapBox instead of MapImage as the control for Windows.Forms.

Hth FObermaier

Dec 2, 2010 at 3:06 PM
Hi FObermaier
At the moment I am using an older version of source code.
If I converted to the current trunk I imagine that would involve upgrading the references??
Would I face other issues??
How would I get around the compiler switch problem of MapBox and MapImage, if that is what is happening?
Bob

Sent: Thursday, December 02, 2010 12:45 AM
To: [email removed]
Subject: Re: Pan and zoom - as per kraghavk's post [SharpMap:236783]

From: FObermaier

Hello BobPawley,

the current version in the trunk has a PanOrQuery tool, is it that what you are looking for?

If you use the actual version from trunk, you might have set a compiler switch which includes MapBox instead of MapImage as the control for Windows.Forms.

Hth FObermaier

Read the full discussion online.

To add a post to this discussion, reply to this email (SharpMap@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SharpMap@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Dec 2, 2010 at 4:13 PM
Hi FObermaier
I've managed to switch to the newer source code and the MapImage errors seem to have cleared up.
I do have some other issues to deal with but I'll have a go at them before I bother the list again.
Thanks for the suggestion to upgrade.
Bob

Sent: Thursday, December 02, 2010 12:45 AM
To: [email removed]
Subject: Re: Pan and zoom - as per kraghavk's post [SharpMap:236783]

From: FObermaier

Hello BobPawley,

the current version in the trunk has a PanOrQuery tool, is it that what you are looking for?

If you use the actual version from trunk, you might have set a compiler switch which includes MapBox instead of MapImage as the control for Windows.Forms.

Hth FObermaier

Read the full discussion online.

To add a post to this discussion, reply to this email (SharpMap@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SharpMap@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Dec 5, 2010 at 4:57 PM
Hi
I managed to get the zoom working but I am having trouble adapting 'pan' to my app.
One problem seems to revolve around the keyword "base". as in -
base.MouseMove += new MouseEventHandler(this.MapImage_MouseMove);

base.MouseUp += new MouseEventHandler(this.MapImage_MouseUp);

base.MouseDown += new MouseEventHandler(this.MapImage_MouseDown);

base.MouseWheel += new MouseEventHandler(this.MapImage_Wheel);

"base" in my app is defined by System.Windows.Forms.Form.
That doesn't seem applicable when referenced to an image such as -
(base.Image != null)
which seems to be better served by PictureBox.
Could someone suggest what I am missing??
Bob

Sent: Thursday, December 02, 2010 12:45 AM
To: [email removed]
Subject: Re: Pan and zoom - as per kraghavk's post [SharpMap:236783]

From: FObermaier

Hello BobPawley,

the current version in the trunk has a PanOrQuery tool, is it that what you are looking for?

If you use the actual version from trunk, you might have set a compiler switch which includes MapBox instead of MapImage as the control for Windows.Forms.

Hth FObermaier

Read the full discussion online.

To add a post to this discussion, reply to this email (SharpMap@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SharpMap@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Coordinator
Dec 6, 2010 at 8:01 AM

Bob,

I do not quite get what you are doing? Are you putting the logic of MapImage control on a Form?

FObermaier?

Dec 6, 2010 at 4:58 PM
I'm attempting to use Kraghavk's Zoom and Pan code and learn a little about C# and SharpMap at the same time.
As I mentioned I have the Zoom working, but for the Pan I have errors.
I am not sure what the keyword `base` should point to, as in the following method suggested by Kraghavk -

base.MouseUp += new MouseEventHandler(this.MapImage_MouseUp);

In my app `base` points to System.Windows.Forms.Form. Is this what it should be doing.
In another part of the code -

(base.Image != null) - - - This code gives an error that Systems.Windows.Forms.Form does not contain a definition for Image.

It would seem that the PictureBox component should be referenced by the keyword `base` if Image is part of it.
To sum up, in Kraghavk's code in my application, the keyword `base` which points to System.Windows.Forms.Form seems to give errors in some cases (where Image is included) but doesn`t give errors in other cases.
Hope this is somewhat clearer.
Bob

Read the full discussion online.

To add a post to this discussion, reply to this email (SharpMap@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SharpMap@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Coordinator
Dec 6, 2010 at 7:08 PM

Bob, MapImage control is derived from PictureBox, that's why there is an image button

Hth FObermaier

Dec 7, 2010 at 8:50 PM
Hi
I`m having a problem with this code -

private void picMap_MouseDown(object sender, MouseEventArgs e)

{

if (this._sharpMap != null)

{

if (e.Button == MouseButtons.Left)

this.mousedrag = e.Location;

SharpMap.Geometries.Point worldPos = this._sharpMap.ImageToWorld((PointF)new Point (e.X, e.Y));

OnMouseDown(worldPos, e);

}

}

This expression :- ((PointF)new Point (e.X, e.Y)); shows error ..... Cannot convert type 'SharpMap.Geometries.Point' to 'System.Drawing.PointF'
Bob

Read the full discussion online.

To add a post to this discussion, reply to this email (SharpMap@discussions.codeplex.com@discussions.codeplex.com)

To start a new discussion for this project, email SharpMap@discussions.codeplex.com@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Coordinator
Dec 8, 2010 at 6:55 AM

Bob,

this is probably due to a using clause that makes the compiler think Point is of type SharpMap.Geometries.Point.

you can safely write:

SharpMap.Geometries.Point worldPos = this._sharpMap.ImageToWorld(new PointF(e.X, e.Y));
Hth FObermaier