MapWindow 4 - Plugins : MapWindow Discussion Forum
Hello everyone, The MapWindow team has just completed developement of a new layout engine for the MapWindow 4 application. It is based on code developed for the new MapWindow 6 and should give you a taste of some of the new functionality that we are developing. The layout files gener
Current Page: 4 of 7
Re: MapWindow 4 Print Layout Plug-in
Posted by: skea ()
Date: December 13, 2009 08:47AM

Hi Brian, i love this plugin. but i am failing to call it in my custom application. What i did is to copy the files(MapWindow6.dll,mwLayout.dll,mwLayout.dll.config,mwLayout.xml) from the MapWindow4Dev\Bin\ApplicationPlugins\mwLayout folder to my Bin\Debug Folder of my app. I created a reference for the mwLayout.dll.
I used the code below to call it but it gives me an exception(FileNotFoundException was unhandled)
"Could not load file or assembly 'MapWindow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=ca60e6823c3a6ee5' or one of its dependencies. The system cannot find the file specified."

I am wondering! do i need to have ApplicationPlugins\mwLayout folder in my bin folder?

My mapform Implements the IMapWin interface.

Code:

void smnuPrint_Click(object sender, EventArgs e)
     {
       string mapunit = "lat/long";
       mwLayout.mwLayout.LayoutFormMW4 printLayOut = new mwLayout.mwLayout.LayoutFormMW4(ref MapMain,ref Legend,ref mapunit);
       printLayOut.Show();
     }



Any help will be appreciated.

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: December 13, 2009 10:04PM

Hi Skea,

Try adding a reference to MapWindow6.dll to your project along with your existing reference to mwLayout.dll I think that will probably solve your problem.

If that doesn't fix it for you can you please post your entire exception message. It will help figure out where in the code this error is occurring.

Thanks,

Brian

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: December 13, 2009 10:06PM

Thanks tgdye,

I don't have a copy of Windows 7 to test on just yet so it hasn't been tested on that setup yet. Once I get a new machine and have a 64bit environment to test on I'll like get that bug fixed in no time, but until then its really hard to figure out whats wrong. Can you post the exception message that it creates when it crashes, that will really help us figure out whats wrong. Also make sure that you have a printer driver installed, that might cause it to crash.

Brian Marchionni

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: skea ()
Date: December 14, 2009 05:56AM

Hi brian thanks for the reply.I did all the trickery but it's still tricking me. First,I added the MapWindow6.dll and the mwLayout.dll directly and it jammed. Next, i tried to add the MaWindow6.dll via the the toolbox.(when u look at the pics, u will see some MapWindow6 controls on the tool box), still it gave the same exception message. Attached is also the exception file and the images.

I don't see where i could be going wrong. If you can't see too, i request that you provide a mocking demo of the mwlayout, that uses the ocx(Mapwindow 4.x) and Mapwindow6.dll. It will serve everyone a great deal.

NOTE: I am still using MapWindow 4.X and not the MapWindow6 controls. I need help coz a mapping application without a printing component is almost useless, and your component is the ultimate tool for this.

regards
Sam Kea



Edited 1 time(s). Last edit at 12/14/2009 05:59AM by skea.

Attachments: mwLayoutExp.rar (145.8 KB)  
Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: December 14, 2009 09:37AM

Hey Sam Kea,

Can you try placing a copy of MapWindow6.dll in you bin/debug folder and rename it MapWindow.dll thats what its originally called so maybe its getting lost along the way somewhere.

I haven't tried making a stand alone app with the mwLayout in a while so I'll try today and see whats going wrong with your setup.

Brian

P.S. I'm curious are you planning on using the entire layout form or just some of the layout components?

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: skea ()
Date: December 14, 2009 09:56AM

[RESOLVED]
THANKS A BUNCH....THAT DID THE TRICK.



Edited 2 time(s). Last edit at 12/14/2009 10:09AM by skea.

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: skea ()
Date: December 14, 2009 10:44AM

However, when i try to render or insert a map into the view area, it does but leaves the cursor blinking between 2 states(and hour glass, then the previous cursor on the AxMap).It never stops unless i go and close the print dialog.

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: tgdye ()
Date: December 14, 2009 08:10PM

pmeems Wrote:
-------------------------------------------------------
> What works fine and what doesn't.
> Which version of MW are you using?
> Are you running a 32Bit or 34Bit version of
> Windows 7
>
> --
> Paul

I have tried both the 32bit and 64bit versions of MapWindow on my 64bit install of windows 7. With the latest dll files it no longer locks up the print layout it simply reverts to the old print options window. Windows 7 is starting to become a real pain, it lacks a lot of backwards compatibility.

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: tgdye ()
Date: December 14, 2009 11:15PM

I have been playing around with the compatibility settings in Windows 7 (Tried running in XP and 2000 settings) , but still come up with the insert map error when using the Print Layout plugin. I hope this is helpful.

MapWindow version
MapWindow47SRa-x86-Setup.exe (47.6 MB - November 28 2009.)
Full MapWindow GIS application installation - v4.7 Stable Release. For 32-bit machines (x86 and WOW64).

Running on Windows 7 64bit version


MapWindow GIS 4.7.5 (11/13/2009)

System.ArgumentException: Parameter is not valid.
at System.Drawing.Graphics.ScaleTransform(Single sx, Single sy, MatrixOrder order)
at System.Drawing.Graphics.ScaleTransform(Single sx, Single sy)
at MapWindow.Layout.Elements.LayoutElement.UpdateThumbnail()
at mwLayout.mwLayout.LayoutMapMW4.set_Envelope(IEnvelope value)
at mwLayout.mwLayout.LayoutMapMW4.ZoomViewExtent()
at mwLayout.mwLayout.LayoutMapMW4..ctor(LayoutControlMW4 layoutControl)
at mwLayout.mwLayout.LayoutControlMW4.CreateMapElement()
at MapWindow.Layout.LayoutInsertToolStrip._btnMap_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

MapWinUtility (debug reporter) Assembly Version: 2.0.4927.50727
Operating System: Win32NT
Service Pack:
Major Version: 6
Minor Version: 1
Revision: 0
Build: 7600

------------End Debug Info------------------------



Edited 1 time(s). Last edit at 12/15/2009 02:03AM by pmeems.

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: pmeems ()
Date: December 15, 2009 02:08AM

@tgdye:
Try using this dll: mwLayout/MapWindow6.dll
Replace it with the one in your /ApplicationPlugins/mwLayout/ folder.

If you still get an error (or a new one) please report it to Mantis so we can track it.

Thanks,

Paul

--
Don't forget to read the new documentation: www.mapwindow.org/documentation/mapwingis4.8
Join us Google+: MapWindow GIS Google+ Community
Join the MapWindow Group on LinkedIn! LinkedIn - MapWindow Group

Download the latest beta installer at:
tinyurl.com/mwMonthly 32-Bit
tinyurl.com/mwMonthlyx64 64-Bit
Follow me on Twitter MapWindow_nl to read when a new installer is published.

---
Paul Meems
The Netherlands
[www.bontepaarden.nl]
Release manager, configuration manager and
forum moderator of MapWindow GIS

Owner of MapWindow.nl - Support for
Dutch speaking users: www.mapwindow.nl

*******
Everything I say or write is my personal opinion and
not the opinion of the company I work for.
*******
View my profile on LinkedIn

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: December 15, 2009 07:29AM

Hummm,

Those are two very odd bugs you guys have found.

skea:

Are you using my default layout window or are you using the layout components in your own design? It could be something simple like setting the cursor from your main form before you open the print layout dialog. I'll have to try and reproduce it.

tgdye:

Thats a curious bug there, seems to crash when the layout engine updates the thumbnail in the list view of the layout elements. I would guess that the math that calculates the scaling to use for the thumbnail is somehow wrong because of another variable that is system provided. Do you have a few printer drivers loaded?


Brian

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: skea ()
Date: December 15, 2009 01:24PM

Brian, i am using the default, not the components.
I tried to set the Cursor handle to -1, set the cursor to arrow and the cursor mode to none but it still failed.
I realise the Name Lable in the property panel thats docked at the bottom right keeps on blinking.
Could this be the issue!

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: December 15, 2009 04:01PM

Hey skea,

Sounds like there is a focus issue going on. The name property would only flash like that if the focus was being changed, maybe the map is updating for some reason, thats the only reason I can think the hourglass would pop up. Let me think about it a bit...

Brian

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: December 15, 2009 10:06PM

Hey Skea,

Ok so I've tried reproducing your bug but I can't seem to be able to get it to act they way you describe.

A few Questions:

What type of data is loaded into your map, how many layers and data types (.SHP/.Tif/.BGD...etc)?

Are you adding the data to the legend control and is your legend control linked to you AxMap control?

Are you trying to print to a very large piece of paper? Bigger than approximately 36 inches x 36 inches doesn't work very well.

Do you have a reference to MapWinGeoProc.dll, you need that but it doubt it would cause this if you don't have it, the scale numbers just wont work.

Can you post your code please it may be simpler to go read through it, although frankly I dunno what you could be doing to cause this effect. Another thought I had is that there is code to increment the number that appears after the name Map 1 Map 2 etc... I suppose if that got into some kinda loop it might cause the name property to flash and the map redraw but I can't see how. It only does this once when the map is added and it occurs before any drawing takes place.

Brian

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: skea ()
Date: December 16, 2009 08:13AM

Brian,
thanks for all the effort. I am just loading a simple shape file(1 file). Yes the legend is linked to my map and it displays my layer data.
I i am clicking on the insert Map button on the toolbar, then going to the default view area and drag-dropping. after dropping, the map renders...then...the cursor splashes and causes the whole application to hang.

I have a reference to mwLayout, MapWindow(after renaming it from MapWindow6), MapWinGeoProc.dll.

The only code around is that on top of this page.
I will try stripdown what i have and post it to you.

regardo
Sam Kea

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: December 16, 2009 01:18PM

Hey Skea,

Have you tried checking out the latest version of MapWindow4 from the SVN or are you using a installed version.

Try getting the copy from here:

[svn.mapwindow.org]

and referencing those files instead, you'll need an SVN client like [tortoisesvn.tigris.org] to download it.

Brian



Edited 1 time(s). Last edit at 12/16/2009 01:20PM by bmarch.

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: skea ()
Date: December 18, 2009 03:33AM

Hi Brian, i have tried updating with the latest version. Still failing.
I have attached a simple demo and a shape file.
it reproduces the same behaviour on my PC. all required Dlls except the MapWinGIS.ocx, MapWindow.dll and MapWinGeoProc.dll are in the sample bin folder. I never attached them because of its size issues.

regardo
Sam Kea

Attachments: MWPrintDemo.rar (195.1 KB)  
Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: January 05, 2010 01:37PM

Hey Skea,

Sorry for the delay getting back to you on this. I've figure it out!

There seems to be a bug in the layout engine code such that if you have data that is in a relatively small unit (like meters) and you set the data type to lat/long it causes that effect. It does the same thing in the MapWindow app if you add your data and set the unit to lat/long it does the exact same thing. I'm not sure exactly where its getting into that big loop but I suspect its an overflow of some sort. I'll dig into it and try to get it fixed, in the mean time, just make sure that your map units match your data.

Brian

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: bmarch ()
Date: January 05, 2010 02:03PM

Hey,

Ok so I've fixed the little bug. Now if the scale of the map is larger than Int32.MaxValue (Which can only happen if you use a unit thats really big for a data set with a really small unit, like lat/long with meters) or if its negative it will always return -1. That should fix any infinite cursor bugs that have popped up.

Let me know if that fixes it.

Brian

P.S. Happy New Year! and map printing!

Options: ReplyQuote
Re: MapWindow 4 Print Layout Plug-in
Posted by: tomc ()
Date: January 18, 2010 04:37PM

Brian et al

Do you have some notes on procedures to use the atlas generator?

Am working on documenting the print layout usage, but that one has me stumped.

add here or send to landcarevic at gmail.com

Tom

Options: ReplyQuote
Current Page: 4 of 7


Sorry, only registered users may post in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: