[Qgis-developer] Problem in shapefiles rendering

bargi john bargi1981 at gmail.com
Thu Jun 19 00:43:43 EDT 2008


Hi Martin,

Thanks for reply......
Actually the application I am working on is similar to QGIS in which
shapefiles are rendered using QT.
In between, I researched on the problem and find out that this issue is
related to QGraphicsView architecture.
In essence, when QGraphicsView is created , it create with origin(0,0) at *top
left corner*. Due to which the positive quadrant is downwards  and negative
upwards ( What I think ) due to which when shapefiles are rendered according
the coordinates position they draw in downward direction( because
coordinates of shapefiles are positive) and they appear to inverted.I found
scaling as a clutch which invert the the GraphicsView and line and polygon
shapefiles are drawn properly but it invert the point shapefile.
Due to this I reached to the possible solution that can be applied on
application:-

--- One way can be that we create the QGraphicsView with origin(0,0) at
bottom left corner.Due to this we will get the proper coordinate system for
rendering. I have tried on it but not able to find the sol. how it will be
implemented.

Have u any idea regarding this ?

Thanks


On Tue, Jun 17, 2008 at 3:23 AM, Martin Dobias <wonder.sk at gmail.com> wrote:

> Hi,
>
> sorry but with this amount of information really none can help you.
> What exactly are you trying to do? Is it some QGIS-based application?
> Why don't you use directly map canvas? Some more code to see what
> actually is happening?
>
> Martin
>
> On Tue, Jun 10, 2008 at 8:20 AM, bargi john <bargi1981 at gmail.com> wrote:
> > Hi all,
> >
> > I am trap in a strange problem while rendering shapefiles.
> >
> > I am used some code of [quote]qgsmapcanvas.cpp [/quote] for creating
> > Graphicsview and QGraphicsScene.
> >
> > The code I have wrote is as follow:
> > [code]
> > View::View( QWidget *parent ): QGraphicsView( parent )
> > {
> >
> >     m_scene = new QGraphicsScene();
> >     setScene( m_scene );
> >
> >     setRenderHint( QPainter::Antialiasing );
> >     setMouseTracking( true );
> >
> >     setFrameShadow( QFrame::Sunken );
> >     setFrameShape ( QFrame::Panel  );
> > }
> > [/code]
> >
> > The m_scene  set here is used in other CPP file where items are added to
> > scene. The code is as follow:
> >
> > [code]
> >
> > QGraphicsScene *Draw::scene() const
> > {
> >     return m_scene; // This object is same as set in View.cpp
> > }
> >
> > void Draw::render()
> > {
> >  .........//  logic to extract items
> >
> >   m_scene->addItem( item ); //Here item is QGraphicsItem
> > }
> > [/code]
> >
> > The problem is that only point Shapfiles are drawing correctly.
> > The line and polygon shapefiles are drawn   as inverted.
> > If I put clutch using [quote]scale(1,-1) [/quote]  then it draw line and
> > polygon correct but point shapefiles inverted.
> >
> > Can any body explain me this strange behavior   and solution to it.
> >
> > Thanks :(
> >
> >
> > _______________________________________________
> > Qgis-developer mailing list
> > Qgis-developer at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20080619/ee8fa3e1/attachment.html


More information about the Qgis-developer mailing list