MapWindow Developer Team : MapWindow Discussion Forum
Hi everyone! Some work was done and a toolbox was added to MW4 GUI to substitute GIS tools menu. It's located in the same window with legend, in separate tab. It's possible to add custom tools in the toolbox as well. Here is code sample which demonstrates the basics o
[New functionality] GIS Toolbox
Posted by:
Sergei ()
Date: July 12, 2011 05:07PM
Hi everyone!
Some work was done and a toolbox was added to MW4 GUI to substitute GIS tools menu. It's located in the same window with legend, in separate tab.
It's possible to add custom tools in the toolbox as well. Here is code sample which demonstrates the basics of interaction with toolbox.
I'll attach screenshots soon.
Some work was done and a toolbox was added to MW4 GUI to substitute GIS tools menu. It's located in the same window with legend, in separate tab.
It's possible to add custom tools in the toolbox as well. Here is code sample which demonstrates the basics of interaction with toolbox.
I'll attach screenshots soon.
/// <summary> /// Fills toolbox with tools and sets the handler for tool click event /// </summary> /// <param name="mapWin"></param> private void FillToolbox(IMapWin mapWin) { MapWindow.Interfaces.IGisToolBox toolbox = mapWin.GisToolbox; IGisToolboxGroup root = toolbox.CreateGroup("My custom tools", "key_group1"); // text, key // creating first sub group IGisToolboxGroup group = toolbox.CreateGroup("Sub group 1", "key_sub1"); // adding the first tool IGisTool tool = toolbox.CreateTool("Tool 1", "key_tool1"); tool.Description = "Here is the description of the first tool"; group.Tools.Add(tool); // adding more without description group.Tools.Add(toolbox.CreateTool("Tool 2", "key_tool2")); group.Tools.Add(toolbox.CreateTool("Tool 3", "key_tool3")); root.SubGroups.Add(group); // adding to the toolbox toolbox.Groups.Add(root); // creating second sub group group = toolbox.CreateGroup("Sub group 2", "key_sub2"); group.Tools.Add(toolbox.CreateTool("Tool 4", "key_tool4")); group.Tools.Add(toolbox.CreateTool("Tool 5", "key_tool5")); group.Expanded = false; root.SubGroups.Add(group); // adding event handler toolbox.ToolClicked += new ToolSelectedDelegate(toolbox_ToolClicked); } /// <summary> /// Handles tool clicked event of gis toolbox, runs appropriate tool /// </summary> /// <param name="tool">The tool that was clicked</param> /// <param name="handled">Notifies the caller that event was handled</param> void toolbox_ToolClicked(IGisTool tool, ref bool handled) { switch (tool.Key) { case "key_tool1": MessageBox.Show("Tool 1 was called"); handled = true; break; case "key_tool2": MessageBox.Show("Tool 2 was called"); handled = true; break; // etc. default: break; } } /// <summary> /// Remove custom tools node from the toolbox /// </summary> private void RemoveCustomTools(IMapWin mapWin) { foreach (IGisToolboxGroup group in mapWin.GisToolbox.Groups) { if (group.Name == "My custom tools") { mapWin.GisToolbox.Groups.Remove(group); break; } } }
Re: [New functionality] GIS Toolbox
Posted by:
pmeems ()
Date: July 13, 2011 01:55AM
Sergei,
This is great!!!!
I knew you were working on changing the GIS Tools to a Toolbox with tree view, but I didn't know you were implementing an interface as well to add custom tools.
I was going to propose that for v4.9, but it seems you've done it already.
Good work!
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
This is great!!!!
I knew you were working on changing the GIS Tools to a Toolbox with tree view, but I didn't know you were implementing an interface as well to add custom tools.
I was going to propose that for v4.9, but it seems you've done it already.
Good work!
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
Sorry, only registered users may post in this forum.


