25 static const std::string TABLE_NAME =
"nsg_tile_matrix_extent";
48 m_table_name(obj.m_table_name),
49 m_zoom_level(obj.m_zoom_level),
50 m_extent_type(obj.m_extent_type),
51 m_min_column(obj.m_min_column),
52 m_min_row(obj.m_min_row),
53 m_max_column(obj.m_max_column),
54 m_max_row(obj.m_max_row),
93 static const char M[] =
"ossimGpkgNsgTileMatrixExtentRecord::init";
102 if ( nCol != EXPECTED_COLUMNS )
105 << M <<
" WARNING:\nUnexpected number of columns: " << nCol
106 <<
"Expected column count: " << EXPECTED_COLUMNS
110 if ( nCol >= EXPECTED_COLUMNS )
120 colName = sqlite3_column_name(pStmt, i);
121 type = sqlite3_column_type(pStmt, i);
122 if ( colName.size() )
124 if ( colName ==
"table_name" )
126 c = (
const char*)sqlite3_column_text(pStmt, i);
130 else if ( ( colName ==
"zoom_level" ) && ( type == SQLITE_INTEGER ) )
135 else if ( colName ==
"extent_type" )
137 c = (
const char*)sqlite3_column_text(pStmt, i);
141 else if ( ( colName ==
"min_column" ) && ( type == SQLITE_INTEGER ) )
146 else if ( ( colName ==
"min_row" ) && ( type == SQLITE_INTEGER ) )
148 m_min_row = sqlite3_column_int(pStmt, i);
151 else if ( ( colName ==
"max_column" ) && ( type == SQLITE_INTEGER ) )
156 else if ( ( colName ==
"max_row" ) && ( type == SQLITE_INTEGER ) )
158 m_max_row = sqlite3_column_int(pStmt, i);
161 else if ( ( colName ==
"min_x" ) && ( type == SQLITE_FLOAT ) )
163 m_min_x = sqlite3_column_double(pStmt, i);
166 else if ( ( colName ==
"min_y" ) && ( type == SQLITE_FLOAT ) )
168 m_min_y = sqlite3_column_double(pStmt, i);
171 else if ( ( colName ==
"max_x" ) && ( type == SQLITE_FLOAT ) )
173 m_max_x = sqlite3_column_double(pStmt, i);
176 else if ( colName ==
"max_y" )
178 m_max_y = sqlite3_column_double(pStmt, i);
184 << M <<
" Unhandled column name[" 185 << i <<
"]: " << colName << std::endl;
190 if ( columnsFound == EXPECTED_COLUMNS )
211 if ( (imageRect.
hasNans() ==
false) && (projectionRect.
hasNans() ==
false) )
239 sql <<
"CREATE TABLE " << TABLE_NAME <<
" ( " 240 <<
"table_name TEXT NOT NULL, " 241 <<
"zoom_level INTEGER NOT NULL, " 242 <<
"extent_type TEXT NOT NULL, " 243 <<
"min_column INTEGER NOT NULL, " 244 <<
"min_row INTEGER NOT NULL, " 245 <<
"max_column INTEGER NOT NULL, " 246 <<
"max_row INTEGER NOT NULL, " 247 <<
"min_x DOUBLE NOT NULL, " 248 <<
"min_y DOUBLE NOT NULL, " 249 <<
"max_x DOUBLE NOT NULL, " 250 <<
"max_y DOUBLE NOT NULL, " 251 <<
"CONSTRAINT pk_ntme PRIMARY KEY (table_name, zoom_level, extent_type, min_column, min_row, max_column, max_row), " 252 <<
"CONSTRAINT fk_ntme FOREIGN KEY (table_name, zoom_level) " 253 <<
"REFERENCES gpkg_tile_matrix(table_name, zoom_level)" 271 sql <<
"INSERT INTO nsg_tile_matrix_extent VALUES ( " 279 << std::setprecision(16)
295 const std::string& prefix )
const 297 std::string myPref = prefix.size() ? prefix : std::string(
"nsg_tile_matrix_extent.");
300 std::string key =
"table_name";
305 kwl.
addPair(myPref, key, value,
true);
312 kwl.
addPair(myPref, key, value,
true);
316 kwl.
addPair(myPref, key, value,
true);
320 kwl.
addPair(myPref, key, value,
true);
324 kwl.
addPair(myPref, key, value,
true);
328 kwl.
addPair(myPref, key, value,
true);
332 kwl.
addPair(myPref, key, value,
true);
336 kwl.
addPair(myPref, key, value,
true);
340 kwl.
addPair(myPref, key, value,
true);
ossimGpkgNsgTileMatrixExtentRecord()
default constructor
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
Represents serializable keyword/value map.
const ossimGpkgNsgTileMatrixExtentRecord & operator=(const ossimGpkgNsgTileMatrixExtentRecord &obj)
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 bool createTable(sqlite3 *db)
Creates table in database.
static ossimString toString(bool aValue)
Numeric to string methods.
virtual void saveState(ossimKeywordlist &kwl, const std::string &prefix) const
Saves the state of object.
const ossimIpt & ul() const
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
virtual bool init(sqlite3_stmt *pStmt)
Initialize from database.
std::string m_extent_type
“complete”,”missing”,“present”,”absent”,”mixed”
const ossimIpt & lr() const
bool insert(sqlite3 *db)
Inserst this record into gpkg_spatial_ref_sys table.
static const std::string & getTableName()
Get the table name "nsg_tile_matrix_extent".
const ossimDpt & ur() const
virtual ~ossimGpkgNsgTileMatrixExtentRecord()
destructor
const ossimDpt & ll() const
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const