[Qgis-developer] HELP!!geometryType() problem!!!

SiR Man_Utd bonar_reddevil at yahoo.com
Tue Mar 10 00:27:05 EDT 2009



--- On Wed, 3/4/09, Tim Sutton <tim at linfiniti.com> wrote:
From: Tim Sutton <tim at linfiniti.com>
Subject: Re: [Qgis-developer] HELP!!geometryType() problem!!!
To: "bonar" <bonar_reddevil at yahoo.com>
Cc: qgis-developer at lists.osgeo.org
Date: Wednesday, March 4, 2009, 2:53 PM

bonar wrote:
> i have a problem on compiling Tim Sutton's QGis Code Examples. Its
give me an
> error on this code
>
> "QgsSingleSymbolRenderer *mypRenderer = new
> QgsSingleSymbolRenderer(mypLayer->geometryType());"
>  
> no matching function for call to
> `QgsSingleSymbolRenderer::QgsSingleSymbolRenderer(QGis::WKBTYPE)'.
>
>   
Thats odd since in qgssinglesymbolrenderer.h we have:

 26 class CORE_EXPORT QgsSingleSymbolRenderer: public QgsRenderer
 27 {
 28   public:
 29     QgsSingleSymbolRenderer( QGis::GeometryType type );

and from qgsvectorlayer.h we have:

163     /** Returns point, line or polygon */
164     QGis::GeometryType geometryType() const;

So your first attempt should have been correct and working. Are you sure
you have 1.0 final and no stray headers from older versions?

8<-------------snip

> Example 1 and 2 give this same error to me. What is a different between
> vectorType() and geometryType()? For your info,i'm using QGis 1.0 and
run on
> Windows platform. Please help me,i'm new to QGis.
>   

If I recall   vectorType was dropped in favour of geometryType in the
API revisions leading up to the release of QGIS 1.0.
>
> Thanks in advance,
> Bonar 
>   

Regards

-- 

Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical 
support questions. Using the lists will gain 
more exposure for your issues and the knowledge 
surrounding you issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux 
Irc: timlinux on #qgis at freenode.net
==============================================

Hi all,

    Mr.Tim Sutton thanks for your reply, i really appreciate your help. Sorry for late reply, 
    lately i'm doing QGis development under Linux Red Hat because of QGis installations 
    on Windows problems. It's going really well for Linux but sadly i still need to make a 
    development under Windows because of some issuese. Based on your email, i already make 
    a new QGis installations on Windows from source. I'm using QGis 1.0 + Qt4.4.3, but i still
    have no luck, this time i get different error:

    undefined reference to `_imp___ZN12QgsMapCanvas9setExtentERK12QgsRectangle'
    undefined reference to `_imp___ZN23QgsSingleSymbolRendererC1EN4QGis12GeometryTypeE'
    CMakeFiles\timtut1.dir\main.cpp.obj In function `main':
    make: *** [all] Error 2
    make[1]: *** [CMakeFiles/timtut1.dir/all] Error 2
    make[2]: *** [timtut1.exe] Error 1

    Really hope your help in this matters because i already out of ideas about this errors.

    Another questions, sorry because asking different question on same topic but if you think 
    i should make a new post for this question, i will do it as it should. Regarding my 
    development on Linux Red Hat, how can i load PostGIS layer into my QGis application? 
    This is my pieces of code about how i do it:

      QgsDataSourceURI * uri = new QgsDataSourceURI();
    // set host name, port, database name, username and password
      uri->setConnection("localhost", "5432", "postgis", "postgres", "postgres");
    // set database schema, table name, geometry column and optionaly subset (WHERE clause)
      uri->setDataSource("public", "klkv_poi2", "the_geom", "id=4");
      QgsVectorLayer * mypLayerPoi = new QgsVectorLayer(uri->uri(), myLayerBaseNamePoi, "postgres");

    This code give me error:

    Layer Not Valid

    Hope you can give me an advice for this matters.


    Thanks in advance,

    bonar




      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090309/86e88a04/attachment.html


More information about the Qgis-developer mailing list