[Qgis-developer] QgsMapLayerRegistry (and QgsMapCanvas) problem

Tim Sutton tim at linfiniti.com
Sun Oct 19 15:33:06 EDT 2008


Hi

2008/10/18 Martin Dobias <wonder.sk at gmail.com>:
> On Fri, Oct 17, 2008 at 11:31 PM, Tim Sutton <tim at linfiniti.com> wrote:
>> Regarding c) they should all be returning enumerated types but I guess
>> the side effect is that the QgsMapLayer::type() enumerators and those
>> of teh first two entries in QgsVectorLayer::type() return  matchin
>> numbers. I could force them to be higher no's to remove such
>> inadvertant collisions. I'll take a look at this later tomorrow -
>> thanks for the feedback on this.
>
> AFAIK python doesn't support enumerations, you get an integer instead.
> SIP generates objects for enumerations, so you can use e.g.
> QgsMapLayer.VectorLayer instead of numbers.
>
> Tim, please rename vector layer's type() either back to vectorType()
> or some other name to avoid override.


The override has been resolved as of yesterday (sat 18 oct).


>
>
>> Any other comments on API changes as I do them are welcome...
>
> I was not happy with all the renaming taking place, but generally
> they're fine.

Bear in mind whatever we dont clean up now, we will be stuck with for
a long time (3 years+?). The API is full of inconsistancies and
english wobblies that make using it harder than it needs to be. For
example we have enumerators in various forms:

enum FOO
{
  BAR_VAL,
  ZED_VAL
}

enum foo
{
  barval,
  zedval
}

etc etc. There are many other places where it needs cleanup beyond
this simple type of example, so better we spend the time now and get
them sorted out...




>One thing I don't really like is that
> QgsVectorDataProvider::reset() was renamed to begin(). The real
> purpose of this function is to restart reading of the data, one
> doesn't have to call it when starting retrieval of features - but
> that's what the current name suggest. I would suggest using e.g.
> resetReading() as it better corresponds with the action it takes (and
> stays consistent with OGR).

1) The change to reset was done in consultation with Marco H. Calling
reset sounds like its doing something damaging rather than moving to
the start of the selection. Another option would be something like
toSelectionStart() if you feel it would make its purpose clearer.

2) Providers are an abstraction and the Provider interface should not
emulate the OGR api per se.


Regards

Tim

>
> bye
> Martin
>



-- 
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Visit http://linfiniti.com to find out about:
 * QGIS programming services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux Irc: timlinux on #qgis at freenode.net
==============================================


More information about the Qgis-developer mailing list