Incorrect scaledenominator in map's viewportmodel after map creation
--------------------------------------------------------------------

                 Key: UDIG-1226
                 URL: http://jira.codehaus.org/browse/UDIG-1226
             Project: uDIG
          Issue Type: Bug
          Components: API map
    Affects Versions: UDIG 1.1.RC8
            Reporter: Tony Roth
            Priority: Minor


I just copied my mails from the mailinglist: 

After creation of a map the ScaleDenominator given by the ViewPortModel of the 
map 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 the renderer tries 
to fill the editorpart in width and height and that the scaledenominator of the 
map is set at this point. 

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. 



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira


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

Reply via email to