[Qgis-developer] Re: composer redesign branch

Marco Hugentobler marco.hugentobler at karto.baug.ethz.ch
Wed Mar 5 05:09:55 EST 2008


Hi Steven,

> I would remove symbolScale and widthScale in favor of defining the widths
> in terms of concrete units, whether pixels, millimeters, or map units. 

It would be good for me if you could explain this idea in more detail as I'm 
still not sure my understanding is correct.

Do you mean that QgsSymbol should have its own pen width and stroke width? 
They would be specified e.g. in mm instead of pixels and when the symbol is 
applied, transformed to pixels according to the ouput device dpi?


The idea that i had was to just work on pixel level with one scalefactor 
(mResolutionRatio). So if e.g. a printer has a resolution of screen dpi * 2, 
then mResolutionRatio would be 2 and all the width values for QPen, QBrush 
and also width/height for images would be scaled by factor 2. Caching pixmaps 
would only be alloud if mResolutionRatio is 1.

I think that would be doable without many code changes. But it is not as 
generic and clean as working with real units (e.g. mm) in the qgis core.

Regards,
Marco




Am Dienstag 04 März 2008 17:26:08 schrieb Steven Bell:
> > So my suggestion is to have the rendering context somehow like this:
> >
> > class QgsMapRenderContext
> > {
> >        QgsMapToPixel mMapToPixel;
> >        QgsCoordinateTransform mCoordTransform;
> >        QgsRect mExtent;
> >        bool drawEditingInformation;
> >        bool mRenderingStopped;
> >        double mResolutionRatio;
> > };
> >
> > The resolution ratio is usually 1, except when drawing to a different
> > paint
> > device (like QPrinter). I hope it will allow to consider for different
> > line
> > width / symbol sizes on these output devices.
> >
> >
> >From what I understand, QgsMapToPixel basically holds the information that
>
> mResolutionRatio would contain.
>
> Martin already mentioned this, but the rendering context needs to have some
> way to tell the renderer whether to use maximum-resolution vector ouput or
> cached pixmaps.  I would also add something about what the output units
> are, whether pixels or millimeters.  Both of the above might be done
> together with an "are we printing to ps/pdf/svg" bool.
>
> I would remove symbolScale and widthScale in favor of defining the widths
> in terms of concrete units, whether pixels, millimeters, or map units. 
> This is what I have attempted to do in the current composer_redesign code.
> One of the major problems is that printed millimeters are treated as the
> same as screen pixels, rather than a separate but similar type of
> measurement.
>
> I hope this makes sense.  Let me know if I need to clarify anything.
> Steven



-- 
Dr. Marco Hugentobler
Institute of Cartography
ETH Zurich
Technical Advisor QGIS Project Steering Committee


More information about the Qgis-developer mailing list