24 static const std::string TABLE_NAME =
"gpkg_tile_matrix";
43 m_table_name(obj.m_table_name),
44 m_zoom_level(obj.m_zoom_level),
45 m_matrix_width(obj.m_matrix_width),
46 m_matrix_height(obj.m_matrix_height),
47 m_tile_width(obj.m_tile_width),
48 m_tile_height(obj.m_tile_height),
49 m_pixel_x_size(obj.m_pixel_x_size),
50 m_pixel_y_size(obj.m_pixel_y_size)
79 if ( (matrixSize.
hasNans() ==
false) && (tileSize.
hasNans() ==
false) &&
106 sql <<
"CREATE TABLE " << TABLE_NAME <<
" ( " 107 <<
"table_name TEXT NOT NULL, " 108 <<
"zoom_level INTEGER NOT NULL, " 109 <<
"matrix_width INTEGER NOT NULL, " 110 <<
"matrix_height INTEGER NOT NULL, " 111 <<
"tile_width INTEGER NOT NULL, " 112 <<
"tile_height INTEGER NOT NULL, " 113 <<
"pixel_x_size DOUBLE NOT NULL, " 114 <<
"pixel_y_size DOUBLE NOT NULL, " 115 <<
"CONSTRAINT pk_ttm PRIMARY KEY (table_name, zoom_level), " 116 <<
"CONSTRAINT fk_tmm_table_name FOREIGN KEY (table_name) REFERENCES gpkg_contents(table_name) " 134 sql <<
"INSERT INTO gpkg_tile_matrix VALUES ( " 141 << std::setiosflags(std::ios::fixed) << std::setprecision(16)
165 static const char M[] =
"ossimGpkgTileMatrixRecord::init";
174 if ( nCol != EXPECTED_COLUMNS )
177 << M <<
" WARNING:\nUnexpected number of columns: " << nCol
178 <<
"Expected column count: " << EXPECTED_COLUMNS
182 if ( nCol >= EXPECTED_COLUMNS )
190 colName = sqlite3_column_name(pStmt, i);
191 if ( colName.size() )
193 if ( colName ==
"table_name" )
195 c = (
const char*)sqlite3_column_text(pStmt, i);
199 else if ( colName ==
"zoom_level" )
204 else if ( colName ==
"matrix_width" )
209 else if ( colName ==
"matrix_height" )
214 else if ( colName ==
"tile_width" )
219 else if ( colName ==
"tile_height" )
224 else if ( colName ==
"pixel_x_size" )
229 else if ( colName ==
"pixel_y_size" )
237 << M <<
" Unhandled column name[" 238 << i <<
"]: " << colName << std::endl;
243 if ( columnsFound == EXPECTED_COLUMNS )
259 const std::string& prefix )
const 261 std::string myPref = prefix.size() ? prefix : std::string(
"gpkg_tile_matrix.");
264 std::string key =
"table_name";
269 kwl.
addPair(myPref, key, value,
true);
271 key =
"matrix_width";
273 kwl.
addPair(myPref, key, value,
true);
275 key =
"matrix_height";
277 kwl.
addPair(myPref, key, value,
true);
281 kwl.
addPair(myPref, key, value,
true);
285 kwl.
addPair(myPref, key, value,
true);
287 key =
"pixel_x_size";
289 kwl.
addPair(myPref, key, value,
true);
291 key =
"pixel_y_size";
293 kwl.
addPair(myPref, key, value,
true);
std::basic_ostringstream< char > ostringstream
Class for char output memory streams.
virtual void saveState(ossimKeywordlist &kwl, const std::string &prefix) const
Saves the state of object.
Represents serializable keyword/value map.
static const std::string & getTableName()
Get the table name "gpkg_tile_matrix".
bool insert(sqlite3 *db)
Inserst this record into gpkg_spatial_ref_sys table.
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.
ossim_float64 m_pixel_y_size
static ossimString toString(bool aValue)
Numeric to string methods.
ossim_int32 m_matrix_width
void addPair(const std::string &key, const std::string &value, bool overwrite=true)
void getGsd(ossimDpt &gsd) const
Get gsd.
ossimGpkgTileMatrixRecord()
default constructor
virtual bool init(sqlite3_stmt *pStmt)
Initialize from database.
void getMatrixSize(ossimIpt &size) const
Get matrix size.
ossim_float64 m_pixel_x_size
virtual ~ossimGpkgTileMatrixRecord()
destructor
const ossimGpkgTileMatrixRecord & operator=(const ossimGpkgTileMatrixRecord &obj)
void getTileSize(ossimIpt &size) const
Get tile size.
ossim_int32 m_matrix_height
static bool createTable(sqlite3 *db)
Creates table in database.
ossim_int32 m_tile_height
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
const std::string & string() const