Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] printing enhancement

This is something that was inadequately planned for. The code that you
will probably find the most interesting is in CreatePageAction. A page
is initialized with a size that corresponds to the printed paper.
Currently this is hardcoded to be the system's default size. 

The issue with scale on a map could be handled by MapBoxPrinter (or your
own implementation if you wish to supply one). I'm not sure about the
specifics of calculating scale, but I think the API has some methods
that grant access to it. Jesse might know.

Some ideas:
- When initialized, a Template is provided with a map. It could analyze
the map's scale and re-adjust itself to compensate for the desired size.
Or,
- The specified scale parameter could be stored in the StyleBlackboard
(along with any other parameters you wish to use), and that could be
accessed by the MapBoxPrinter.

Hope that helps. I haven't played around in that area of the code for a
while, so I may have forgotten about some details. It's definitely one
spot that needs some work. (Also needs some users, but it looks like we
have one now :)

Richard

On Wed, 2006-30-08 at 14:28 +0300, Vitali Diatchkov wrote:
> 
> We have the following task: print maps with specified scale with predefined
> paper template.
> 
> Template basics are implemented in UDIG and there is an opportunity to
> create own templates through extension point as I see. The problem is with
> scale. 
> 
> So, how to print maps on the specified template where size of map image (map
> box on the template) is, let's say, fixed (18 cm on 18 cm e.g.) and scale is
> specified?
> 
> The desired behavior is:
> There is a map with layers. Take central coordinate of the map that is in
> map editor, take scale as a parameter and calculate piece of map
> (rectangular box) by "clipping" the appropriate bounding box of the map and
> which fits in the map box of the template with specified dimension in cm
> without dimension ratio distortion.
>  Central point of the map in editor goes to the central point of map box on
> the template, and consequently to the central point of map image on the
> printed paper. Knowing the scale parameter, size of map box on the template
> in cm, and coordinate of central point of currently visible map in the
> editor we can calculate bounding box and ask renderers to draw piece of map
> with this bounds to the map box, then print.
> So all calculations are easy and require central coordinate of the map, size
> of map box, scale.
> 
> Unclear issues:
> 1. How to specify exact size of map box in cm on the template
> 2. May be some other issues...
> 
> 
> Current behavior is that all visible viewport of map editor fits into map
> box with dimension distortion. We need an algorithm described above.
> 
> Any suggestions and advises how reachable is that functionality in limits of
> current printing functionality of UDIG? I give a task to our developers to
> implement this functionality and contribute to UDIG base code.
> 
> Regards, Vitali.
> 
> _______________________________________________
> User-friendly Desktop Internet GIS (uDig)
> http://udig.refractions.net
> http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top