small bugfix related to digitizing

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@2185 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
mhugent 2004-10-30 19:33:26 +00:00
parent 75978402ea
commit 60029ee4aa
2 changed files with 12 additions and 15 deletions

View File

@ -925,7 +925,11 @@ bool QgsPostgresProvider::commitFeature(QgsFeature* f)
QString insert("INSERT INTO ");
insert+=tableName;
insert+="(";
//add the name of the geometry column to the insert statement
insert+=geometryColumn;//first the geometry
//add the names of the other fields to the insert
std::vector<QgsFeatureAttribute> attributevec=f->attributeMap();
for(std::vector<QgsFeatureAttribute>::iterator it=attributevec.begin();it!=attributevec.end();++it)
{
@ -936,7 +940,10 @@ bool QgsPostgresProvider::commitFeature(QgsFeature* f)
insert+=fieldname;
}
}
insert+=") VALUES (GeomFromWKB('";
//add the wkb geometry to the insert statement
unsigned char* geom=f->getGeometry();
for(int i=0;i<f->getGeometrySize();++i)
{
@ -945,13 +952,11 @@ bool QgsPostgresProvider::commitFeature(QgsFeature* f)
{
hex="0"+hex;
}
#ifdef QGISDEBUG
qWarning("in geometry loop: "+QString::number((int)geom[i],16).upper());
#endif
insert+=hex;
}
insert+="',-1)";
//add the field values to the insert statement
for(std::vector<QgsFeatureAttribute>::iterator it=attributevec.begin();it!=attributevec.end();++it)
{
if(it->fieldName()!=geometryColumn)
@ -959,6 +964,8 @@ bool QgsPostgresProvider::commitFeature(QgsFeature* f)
QString fieldvalue=it->fieldValue();
bool charactertype=false;
insert+=",";
//add quotes if the field is a characted type
if(fieldvalue!="NULL")
{
for(std::vector<QgsField>::iterator iter=attributeFields.begin();iter!=attributeFields.end();++iter)

View File

@ -1246,18 +1246,8 @@ void QgsMapCanvas::mouseReleaseEvent(QMouseEvent * e)
{
if(!vlayer->getDataProvider()||!vlayer->getDataProvider()->isEditable())
{
// QMessageBox::information(0,"Layer not editable","Cannot edit the vector layer. Use 'Start editing' in the legend item menu",QMessageBox::Ok);
// break;
QPainter paint(this);
paint.setPen(QPen(QColor(255,0,0),4,Qt::DashLine));
std::list<QgsPoint>::iterator it=mCaptureList.end();
--it;
--it;
QgsPoint lastpoint = mCanvasProperties->coordXForm->transform(it->x(),it->y());
paint.drawLine(static_cast<int>(lastpoint.x()),
static_cast<int>(lastpoint.y()),
e->x(),
e->y());
QMessageBox::information(0,"Layer not editable","Cannot edit the vector layer. Use 'Start editing' in the legend item menu",QMessageBox::Ok);
break;
}
}
else