valid layer checking added

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@85 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
gsherman 2002-08-03 06:37:40 +00:00
parent 8c51591ad1
commit 87321765a6
3 changed files with 13 additions and 11 deletions

View File

@ -92,8 +92,14 @@ void QgisApp::addLayer ()
QgsShapeFileLayer *lyr = new QgsShapeFileLayer (*it, base);
// give it a random color
// add it to the mapcanvas collection
mapCanvas->addLayer (lyr);
if(lyr->isValid()){
// add it to the mapcanvas collection
mapCanvas->addLayer (lyr);
}else{
QString msg = *it;
msg += " is not a valid or recognized data source";
QMessageBox::critical(this,"Invalid Data Source",msg);
}
++it;
}

View File

@ -102,3 +102,6 @@ void QgsMapLayer::setZ (int zorder)
{
zpos = zorder;
}
bool QgsMapLayer::isValid(){
return valid;
}

View File

@ -44,15 +44,8 @@ QgsShapeFileLayer::QgsShapeFileLayer (QString vectorLayerPath, QString baseName)
layerExtent.setXmin (ext->MinX);
layerExtent.setYmax (ext->MaxY);
layerExtent.setYmin (ext->MinY);
/* while(OGRFeature *fet = ogrLayer->GetNextFeature()){
fet->DumpReadable(stdout);
OGRGeometry *geom = fet->GetGeometryRef();
std::cout << geom->getGeometryName() << std::endl;
delete fet;
}
*/
}else{
valid = false;
}
}