Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] the scale denomenator in new map

Hi,

Setting the scale before map is pasted to UI seems quite hard, i triend also
that map interceptor (which is great for my other task, thanks :)), the problem
is the setScale method in ViewportModelImpl:

    public void setScale( double scaleDenominator ) {
        RenderManager rm = getRenderManagerInternal();
        IMapDisplay display = rm.getMapDisplay();
        ReferencedEnvelope newExtents =
ScaleUtils.calculateBoundsFromScale(scaleDenominator,
                display.getDisplaySize(), display.getDPI(), getBounds());
        setWidth(newExtents.getWidth());
    }

more precisely, the setWidth(newExtents.getWidth()); causes
NullPointerException.

But for me changing the scale after CreateMapCommand is totally fine.

- Artsi

2009/6/9 Jody Garnett <jody.garnett@xxxxxxxxx>:
> I think there is something called "map interceptors" ... people often
> use those to dump a couple base layers into each and every map that is
> created for custom apps.
>
> If you wanted to do the same thing to explicitly set the viewport
> model (ie including scale) I think you could manage it. Please give it
> a go and let us know how it works out.
>
> Jody
>
> On Wed, Jun 10, 2009 at 1:26 AM, Arto Pastinen<arto.pastinen@xxxxxxxxx> wrote:
>> Is there a way to set the scaleDenominator before map is rendered, in
>> my example code
>> the scale denomenator is in event -1.0, and in UI scale label something very big
>> because my map is so big.
>>
>> I like to set it some reasonable value because otherwise it take so
>> much time to render
>> first image.
>>
>> CreateMapCommand cmc = new CreateMapCommand("default", tst, activeProject);
>> activeProject.sendSync(cmc);
>> IMap map = cmc.getCreatedMap();
>> map.executeSyncWithoutUndo(new SetScaleCommand(10000));
>>
>> map.addMapListener(new IMapListener() {
>> public void changed(MapEvent event) {
>> event.getScaleDenomenator() == -1.0
>> }
>> });
>> ApplicationGIS.openMap(map);
>>
>> - Artsi
>> _______________________________________________
>> 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
>


Back to the top