I can't answer all your questions but I'll try with a few
On 1/7/2013 12:50 PM, Christian Hempe wrote:
Hello everybody, i'm currently trying to integrate the uDig api in an existing RCP application. The goal is to replace the currently used but outdated OpenMap api. Following the tool-view tutorial i was able to show a first map view in my application using the DefaultMapViewPart. But before i go further i would appreciate some hints, just to prevent reinventing the wheel. My scenario is as follows: - i need a single view in my application displaying a map - fixed set of "background" layers displaying data from ESRI shape files - the "foreground" layers should display my own data/features which are generated in memory - my data consist of name (for labels), lat/lon coordinates (WGS 84), range information in nautical miles - my features should be rendered in one layer with e.g. a small square marking the position and on a second one with a circle with radius calculated by the range information - if user double clicks on such a feature i want to show an dialog containing more information - if the viewport of the map changes (by changing the scale or panning around on the map, i need to calculate a list of the currently displayed features (my data only) My main questions at the moment are: 1) How can i programmatically change the style of the shape file layers (fill and line color)?
My understanding is that you should be able to get a style from the style blackboard, manipulate it and put it back on the blackboard.
Have a look at this page. I think you probably want to SLD styles: http://udig.github.com/docs/dev/style.html
2) I can create a List<SimpleFeature> from my data like in the GeoTools csv2shp tutorial. But how can i add a layer for this to the map? Do i need to write my own renderer? I think i'm missing some step here.
You should not need to write your own renderer. I had a similar problem when I wanted to display "custom" data from a database on a map. I ended up writing my own GeoTools DataSource and an associated uDig Service/GeoResource. This sounds worse than it is. Have a look at the GeoTools AbstractDataStore. I extended this and created my own FeatureReader. The net.refractions.udig.tutorials.catalog.csv tutorial has an example of how to create a uDig Service/GeoResource.
This seems to work well for me and I also got the benefit of all the uDig functions (styling, info tool) etc.
3) For user interaction (double click) i would create a Tool extending SimpleTool and query for the clicked feature via a bounding box like in the SendAlertTool example. Would that be correct? 4) Would an IMapListener be the correct way to handle the viewport changes as described above? Or would an IViewportModelListener be a better way?
I would think an IViewportModelListener would be more appropriate as it sounds like that is what you are interested in the most. The MapListener fires for a number other events I don't think you care about.
Hopefully this helps a bit, Emily
5) If my data changes (elements added/removed) is there an automatic way to refresh the map or must i explicitly call map.getRenderManager().refresh() ? I know the learning curve for uDig/GeoTools is very steep but i'm certain i would find solutions in the sources, but i would be thankful for any hint... Greetings _______________________________________________ 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
