mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
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:
parent
8c51591ad1
commit
87321765a6
@ -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;
|
||||
}
|
||||
|
@ -102,3 +102,6 @@ void QgsMapLayer::setZ (int zorder)
|
||||
{
|
||||
zpos = zorder;
|
||||
}
|
||||
bool QgsMapLayer::isValid(){
|
||||
return valid;
|
||||
}
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user