Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Antwort: Re: [udig-devel] Incorrect scaledenominator after map creation

Hi,
thanks for your offer to fix it although you don't have much time. It's not necessary: I examined the ScaleRatioLabel and there I saw that one can add a listener to the ViewportModel. I did it and now it works. The ViewportModel fires an event and then I can get the scaleDenominator directly from the ViewportModel and it's the same like in the ScaleRatioLabel. (would be odd if not, it's the same way to get it)
 
I think this means that not all changes of the ViewportModel are noticed by the map even the map itself fires events of the type VIEWPORT_MODEL.
 
tony roth
 


 
So this is an area that is known to have some bugs.  I will try to find time to fix this bug but I don't have much time so if you want a fast resolution I will be able to apply a patch and make a release for you in very short order.

FYI it is the ViewportModel's setScaleDenominator that is not accurate.  You can look at Geotools RenderUtilities.getOGCScale for the opposite calculation.  Then just the reverse calculation needs to be done.

Jesse

On 20-Mar-07, at 5:59 AM, tony.roth@xxxxxx wrote:

After creation of a map the ScaleDenominator given by the ViewPortModel is incorrect.
my Code:
Envelope bbox = new Envelope(-180,180,-90,90); // initial map covers the world
map = ProjectFactory.eINSTANCE.createMap(....)
// create Layers and add them to the map ....
// set bounding box
map.getViewportModelInternal().setBounds(bbox);
// some more stuff ....
// finally
page.openEditor(new MapEditorInput(map), MapEditor.ID);
The editor opens and the renderer renders the map. Below the map the ScaleDenominator is shown correctly in the ScaleRatioLabel. So it seems everything correct but when I fetch the ScaleDenominator with
map.getViewportModel().getScaleDenominator() then I get an incorrect ScaleDenominator.
This only happens directly after map creation. After any action (zoom, pan, layer changed) the ScaleDenominator is correct.
And that's what I think:
The editorpart doesn't have the same aspect ratio like the map with the bounding box mentioned above. The map (with the used projection in my case) has an aspect ratio of 2:1, the editorpart something like 2:1,5. Therefore there are white bars above and below the map like watching a 16:9 movie on a 4:3 screen. As mentioned above the ScaleDenominator in the ScaleRatioLabel is correct (in my case 1:87'699'473) but the ScaleDenominator given by map.getViewportModel().getScaleDenominator() is 1:67'781'811. If I set the ScaleDenominator of the map to this value, then there will be the special case that the top of the map (90°) is the upper edge of the editorpart and the bottom of the map (-90°) is the lower edge. Like scaling the 16:9 movie that you don't have any bars on your 4:3 screen but cutting of the left and right part of the movie. I don't think that's a coincidence. Could it be that when opening the editorpart and first time rendering of the map someone forgets to set the scaledenominator of the internal ViewportModel?
tony roth
_______________________________________________
User-friendly Desktop Internet GIS (uDig)

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel


Back to the top