Hi Tony,
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, [EMAIL PROTECTED] 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)
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