GeodeticDatum *GeodeticDatum::clone() const { GeodeticDatum *datum = new GeodeticDatum(); datum->name(name()) ; datum->code(code()); datum->setDescription(description()); datum->_area = _area; datum->_authority = _authority; datum->_datumParams = _datumParams; datum->_mode = _mode; datum->_isValid = _isValid; datum->_wkt = _wkt; return datum; }
GeodeticDatum *InternalIlwisObjectFactory::createDatum(const Resource& resource, const IOOptions &options) const { QString query; if ( resource.code() != sUNDEF) { QString code = resource.code(); if ( code != "") { query = QString("Select * from datum where code = '%1'").arg(code); } } if ( resource["area"] != sUNDEF) { QString name = resource.name(); QString area = resource["area"].toString(); query = QString("Select * from datum where name='%1' and area='%1'").arg(name, area); } if ( query == "") return 0; InternalDatabaseConnection db; if (db.exec(query) && db.next()) { GeodeticDatum *datum = new GeodeticDatum(); QSqlRecord rec = db.record(); datum->name(rec.field("name").value().toString()); datum->setDescription(rec.field("description").value().toString()); datum->setAuthority(rec.field("authority").value().toString()); datum->setArea(rec.field("area").value().toString()); datum->code(rec.field("code").value().toString()); QString ellips = rec.field("code").value().toString(); IEllipsoid ell; QString ellres = QString("code=ellipsoid:%1").arg(ellips); ell.prepare(ellres); datum->set3TransformationParameters(rec.field("dx").value().toDouble(), rec.field("dy").value().toDouble(), rec.field("dz").value().toDouble(), ell); return datum; } return 0; }