24 static const std::string TABLE_NAME =
"gpkg_tile_matrix_set";
41 m_table_name(obj.m_table_name),
42 m_srs_id(obj.m_srs_id),
76 static const char M[] =
"ossimGpkgTileMatrixSetRecord::init";
85 if ( nCol != EXPECTED_COLUMNS )
88 << M <<
" WARNING:\nUnexpected number of columns: " << nCol
89 <<
"Expected column count: " << EXPECTED_COLUMNS
93 if ( nCol >= EXPECTED_COLUMNS )
101 colName = sqlite3_column_name(pStmt, i);
102 if ( colName.size() )
104 if ( colName ==
"table_name" )
106 c = (
const char*)sqlite3_column_text(pStmt, i);
110 else if ( colName ==
"srs_id" )
112 m_srs_id = sqlite3_column_int(pStmt, i);
115 else if ( colName ==
"min_x" )
117 m_min_x = sqlite3_column_double(pStmt, i);
120 else if ( colName ==
"min_y" )
122 m_min_y = sqlite3_column_double(pStmt, i);
125 else if ( colName ==
"max_x" )
127 m_max_x = sqlite3_column_double(pStmt, i);
130 else if ( colName ==
"max_y" )
132 m_max_y = sqlite3_column_double(pStmt, i);
138 << M <<
" Unhandled column name[" 139 << i <<
"]: " << colName << std::endl;
144 if ( columnsFound == EXPECTED_COLUMNS )
186 sql <<
"CREATE TABLE " << TABLE_NAME <<
" ( " 187 <<
"table_name TEXT NOT NULL PRIMARY KEY, " 188 <<
"srs_id INTEGER NOT NULL, " 189 <<
"min_x DOUBLE NOT NULL, " 190 <<
"min_y DOUBLE NOT NULL, " 191 <<
"max_x DOUBLE NOT NULL, " 192 <<
"max_y DOUBLE NOT NULL, " 193 <<
"CONSTRAINT fk_gtms_table_name FOREIGN KEY (table_name) REFERENCES gpkg_contents(table_name), " 194 <<
"CONSTRAINT fk_gtms_srs FOREIGN KEY (srs_id) REFERENCES gpkg_spatial_ref_sys (srs_id) " 212 sql <<
"INSERT INTO gpkg_tile_matrix_set VALUES ( " 215 << std::setprecision(16)
246 const std::string& prefix )
const 248 std::string myPref = prefix.size() ? prefix : std::string(
"gpkg_tile_matrix_set.");
251 std::string key =
"table_name";
256 kwl.
addPair(myPref, key, value,
true);
260 kwl.
addPair(myPref, key, value,
true);
264 kwl.
addPair(myPref, key, value,
true);
268 kwl.
addPair(myPref, key, value,
true);
272 kwl.
addPair(myPref, key, value,
true);
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Represents serializable keyword/value map.
static const std::string & getTableName()
Get the table name "gpkg_tile_matrix_set".
int exec(sqlite3 *db, const std::string &sql)
Preforms sqlite3_prepare_v2, sqlite3_step and sqlite3_finalize.
double nan()
Method to return ieee floating point double precision NAN.
This code was derived from https://gist.github.com/mshockwave.
bool tableExists(sqlite3 *db, const std::string &tableName)
Checks for existance of table.
static ossimString toString(bool aValue)
Numeric to string methods.
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
ossim_float64 getWidth() const
const ossimGpkgTileMatrixSetRecord & operator=(const ossimGpkgTileMatrixSetRecord &obj)
virtual void saveState(ossimKeywordlist &kwl, const std::string &prefix) const
Saves the state of object.
static bool createTable(sqlite3 *db)
Creates table in database.
virtual ~ossimGpkgTileMatrixSetRecord()
destructor
ossimGpkgTileMatrixSetRecord()
default constructor
void getRect(ossimDrect &rect) const
Gets the rectangle from bounds.
ossim_float64 getHeight() const
bool insert(sqlite3 *db)
Inserst this record into gpkg_spatial_ref_sys table.
virtual bool init(sqlite3_stmt *pStmt)
Initialize from database.
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const