[Qgis-developer] Editing the geometry of a feature
Tait, Roger
roger.tait at ntu.ac.uk
Mon Oct 22 09:15:35 EDT 2007
Hi,
I have a QGis::WKBPoint based vector layer containing a single feature.
I want to change the position of the feature using a single click of a button embedded in the tool bar.
I have unsuccessfully tried to change the position using the following:
void QgisApp::trackWayPoint()
{
...
...
QgsFeature *feature = pointLayer->getFirstFeature(true,false);
QgsGeometry *geometry = feature->geometry();
unsigned char *wkb = geometry->wkbBuffer();
memcpy(&wkb[5], &newPosX, sizeof(double));
memcpy(&wkb[5]+sizeof(double), &newPosY, sizeof(double));
}
The correct feature and geometry are referenced however for some reason the new position is lost before the feature is drawn to screen.
I have also tried commitAttributeChanges(const std::set<QString>& deleted, ... ,std::map<QString,QString> >& changed); without success.
Please tell me how I can change the position of a feature?
Thanks Roger
This email is intended solely for the addressee. It may contain private and confidential information. If you are not the intended addressee, please take no action based on it nor show a copy to anyone. In this case, please reply to this email to highlight the error. Opinions and information in this email that do not relate to the official business of Nottingham Trent University shall be understood as neither given nor endorsed by the University.
Nottingham Trent University has taken steps to ensure that this email and any attachments are virus-free, but we do advise that the recipient should check that the email and its attachments are actually virus free. This is in keeping with good computing practice.
More information about the Qgis-developer
mailing list