synchronization function suggestion

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

synchronization function suggestion

Maxim Dubinin
Hi all,

Sometime ago we were stuggling with editing features within a layer. I'm not
talking about QgsVectorLayer methods that are already implemented and working fine,
but other basic geometry editing functions, that sometimes
require to store results in the same layer. Like clip, buffer etc.

The main problem is that, while methods that are already in API are
able to do that (lets take moveVertex for example), new ones should
work around to reflect changes without comitting.

So we want to propose to add a generic function to synchronize changed
geometries. This function might be useful for future
API extension or plugins, that will add functionality to work on
geometries within a layer. Something like:

bool QgsVectorLayer::updateFeature(QgsFeature &feat)
{
  mChangedGeometries[feat.id()]=*feat.geometry();
  setModified( true, true );
  return true;
}


Any thoughts?

Maxim

PS: this is from a conversation with our developer, so I might have
misinterpreted something, but it seems logical to me. We can work on
the implementation, if there are no objections.



_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

AW: synchronization function suggestion

Hugentobler  Marco
Hi Maxim

I'm also in favour of such a function. To change attribute values, there is already a function in QgsVectorLayer. But to change geometries, there is no such function (as you pointed out).
My suggestion is to call the function changeGeometry and to pass feature id and geometry as arguments, since the function does not do anything with attributes:

bool QgsVectorLayer::changeGeometry(int featureId, QgsGeometry* geom)

Regards,
Marco




-----Ursprüngliche Nachricht-----
Von: [hidden email] im Auftrag von Maxim Dubinin
Gesendet: Do 30.04.2009 21:55
An: qgis-developer
Betreff: [Qgis-developer] synchronization function suggestion
 
Hi all,

Sometime ago we were stuggling with editing features within a layer. I'm not
talking about QgsVectorLayer methods that are already implemented and working fine,
but other basic geometry editing functions, that sometimes
require to store results in the same layer. Like clip, buffer etc.

The main problem is that, while methods that are already in API are
able to do that (lets take moveVertex for example), new ones should
work around to reflect changes without comitting.

So we want to propose to add a generic function to synchronize changed
geometries. This function might be useful for future
API extension or plugins, that will add functionality to work on
geometries within a layer. Something like:

bool QgsVectorLayer::updateFeature(QgsFeature &feat)
{
  mChangedGeometries[feat.id()]=*feat.geometry();
  setModified( true, true );
  return true;
}


Any thoughts?

Maxim

PS: this is from a conversation with our developer, so I might have
misinterpreted something, but it seems logical to me. We can work on
the implementation, if there are no objections.



_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: synchronization function suggestion

Martin Dobias
On Fri, May 1, 2009 at 10:02 AM, Hugentobler  Marco
<[hidden email]> wrote:
> Hi Maxim
>
> I'm also in favour of such a function. To change attribute values, there is already a function in QgsVectorLayer. But to change geometries, there is no such function (as you pointed out).
> My suggestion is to call the function changeGeometry and to pass feature id and geometry as arguments, since the function does not do anything with attributes:
>
> bool QgsVectorLayer::changeGeometry(int featureId, QgsGeometry* geom)

+1

Actually yesterday I've encountered the same problem :-)
We should also deprecate the vector layer functions like insertVertex
or moveVertex (which just modify the geometry) in favour of this new
one.

Martin
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re[2]: synchronization function suggestion

Maxim Dubinin
great! We're ready to work on that and send patch to trac.
Actually it is already implemented locally (but not sent to trac yet). Just
want to make sure, that nobody is currently working on this.

Maxim

Вы писали 1 мая 2009 г., 5:49:55:

MD> On Fri, May 1, 2009 at 10:02 AM, Hugentobler  Marco
MD> <[hidden email]> wrote:
>> Hi Maxim
>>
>> I'm also in favour of such a function. To change attribute values, there is already a function in QgsVectorLayer. But to change geometries, there is no such function (as you pointed out).
>> My suggestion is to call the function changeGeometry and to pass feature id and geometry as arguments, since the function does not do anything with attributes:
>>
>> bool QgsVectorLayer::changeGeometry(int featureId, QgsGeometry* geom)

MD> +1

MD> Actually yesterday I've encountered the same problem :-)
MD> We should also deprecate the vector layer functions like insertVertex
MD> or moveVertex (which just modify the geometry) in favour of this new
MD> one.

MD> Martin

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Re[2]: synchronization function suggestion

Martin Dobias
2009/5/1 Maxim Dubinin <[hidden email]>:
> great! We're ready to work on that and send patch to trac.
> Actually it is already implemented locally (but not sent to trac yet). Just
> want to make sure, that nobody is currently working on this.
>
> Maxim

Function chageGeometry() added in r10701.

Enjoy!

Martin
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re[4]: synchronization function suggestion

Maxim Dubinin
Martin, thanks for working on that

please  note  I  added  the ticket with the patch, which includes both
geometry  and  attributes  update  and python bindings. If you
decided  to  keep updating geometry and attributes separate, it should
be closed as "wontfix".

Maxim

Вы писали 2 мая 2009 г., 11:15:43:

MD> 2009/5/1 Maxim Dubinin <[hidden email]>:
>> great! We're ready to work on that and send patch to trac.
>> Actually it is already implemented locally (but not sent to trac yet). Just
>> want to make sure, that nobody is currently working on this.
>>
>> Maxim

MD> Function chageGeometry() added in r10701.

MD> Enjoy!

MD> Martin

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer