Jesse has created a couple of tutorials on embedded a map viewer; you could review his code for hints.
I have spent a fair bit of time cleaning up ToolManager recently - it seems to be the definition of the "God Object" anti-patern (http://en.wikipedia.org/wiki/God_object) :-) I think I have it to the point where each map could have its own tool manager; and indeed tool manager would be well enough behaved to stand on its own. Your method sounds find to me; I was forced to add similar methods when I was wiring things up. Would you like to submit your your method as a pull request? -- Jody Garnett On Thursday, 1 March 2012 at 9:42 AM, Emily Gouge wrote: > Hi uDiggers, > > I'm using uDig as the mapping component of a larger project to track and > manage Patrol data. The quick summary is - Rangers (or others) take GPS > devices into the field (park or protected area) and record information > (wildlife sightings, poaching sighting) using these devices. The > application then provides the ability to download, manage, and report on > the information collected. > > So far I've had little trouble integrating uDig - so thanks to everyone. > > I have one question - I'm developing a very simple map view that is not > meant to be used for anything other than quickly viewing data. I want > it to only have a few simple tools (pan, zoom and possibly one or two > custom tools). As a result I'm creating my own custom toolbar with the > set of tools I need. > > I want to use the ToolManager to find the defined tools and add them to > my custom toolbar. I tried using the ToolManager.findTool(toolID) > function but it doesn't search non-modal tools and it doesn't return the > tool proxy (that contains the name, image and other information I need). > > The solution I came up with was to add a function to the ToolManager > called findToolProxy(toolId) [as shown below]. This function searchs > all tools (modal, action and background) and returns the associated > toolproxy. This function would also need to be added to the IToolManager. > > If there is some better way of accessing the Tool extensions please > point me at it and I'll have a look. Otherwise, (if I create a patch > and submit it via git) would it be possible to get this update into udig? > > Thanks, > Emily > > > > > /** > * Find a tool proxy with the provided ID. > * <p>This searches modal tools, background tools, and > * action tools</p> > * @param toolID toolId to search for > * @return ToolProxy of tool if found or null > */ > public ToolProxy findToolProxy(String toolID) { > for(ModalToolCategory category : modalCategories){ > for (ModalItem item : category) { > if(toolID.equals(item.getId())){ > return (ToolProxy)item; > } > } > } > for(ActionToolCategory category : actionCategories){ > for (ModalItem item : category) { > if(toolID.equals(item.getId())){ > return (ToolProxy)item; > } > } > } > for(ToolProxy item : backgroundTools){ > if(toolID.equals(item.getId())){ > return (ToolProxy)item; > } > } > return null; > } > > > > > _______________________________________________ > User-friendly Desktop Internet GIS (uDig) > http://udig.refractions.net > http://lists.refractions.net/mailman/listinfo/udig-devel > >
_______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel
