![]() |
OpenSWMM Engine
6.0.0-alpha.1
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.1)
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | DbDeleter |
| struct | DecodedLinestring |
| struct | DecodedMultipolygon |
| struct | DecodedPoint |
| class | GeoPackageInputPlugin |
| class | GeoPackageOutputPlugin |
| class | GeoPackagePluginInfo |
| IPluginComponentInfo for the GeoPackage I/O plugin. More... | |
| class | GeoPackageReportPlugin |
| class | GpkgError |
| struct | StmtDeleter |
| class | Transaction |
Typedefs | |
| using | DbPtr = std::unique_ptr< sqlite3, DbDeleter > |
| using | StmtPtr = std::unique_ptr< sqlite3_stmt, StmtDeleter > |
Enumerations | |
| enum | WkbType : uint32_t { WKB_POINT = 1 , WKB_LINESTRING = 2 , WKB_POLYGON = 3 , WKB_MULTIPOLYGON = 6 } |
Functions | |
| int | read_model (sqlite3 *db, SimulationContext &ctx, const std::string &simulation_id) |
| Read a model definition from a GeoPackage into a SimulationContext. | |
| int | read_from_file (const std::string &path, SimulationContext &ctx, const std::string &simulation_id) |
| Convenience: open a GeoPackage file and read a model. | |
| void | create_schema (sqlite3 *db) |
| Create all GeoPackage metadata tables and OpenSWMM application tables. | |
| void | register_crs (sqlite3 *db, int srs_id, const std::string &org, int org_id, const std::string &srs_name, const std::string &wkt) |
| Register a CRS in gpkg_spatial_ref_sys (if not already present). | |
| void | register_feature_table (sqlite3 *db, const std::string &table_name, const std::string &geom_type, int srs_id, const std::string &identifier, const std::string &description, double min_x, double min_y, double max_x, double max_y) |
| Register a feature table in gpkg_contents and gpkg_geometry_columns. | |
| void | populate_default_variables (sqlite3 *db) |
| Pre-populate the variables catalog with known SWMM output variables. | |
| void | write_model (sqlite3 *db, const SimulationContext &ctx, const std::string &simulation_id, int srs_id=0) |
| Write the full model definition from a SimulationContext into a GeoPackage. | |
| int | write_to_file (const std::string &path, const SimulationContext &ctx, const std::string &simulation_id) |
| Convenience: create a new GeoPackage file, write schema + model. | |
| std::vector< uint8_t > | encode_point (double x, double y, int32_t srs_id) |
| Encode a POINT geometry in GeoPackage Binary format. | |
| std::vector< uint8_t > | encode_linestring (const std::vector< double > &xs, const std::vector< double > &ys, int32_t srs_id) |
| Encode a LINESTRING geometry in GeoPackage Binary format. | |
| std::vector< uint8_t > | encode_multipolygon (const std::vector< double > &xs, const std::vector< double > &ys, int32_t srs_id) |
| Encode a MULTIPOLYGON geometry (single polygon, single ring) in GeoPackage Binary format. | |
| DecodedPoint | decode_point (const std::vector< uint8_t > &blob) |
| DecodedLinestring | decode_linestring (const std::vector< uint8_t > &blob) |
| DecodedMultipolygon | decode_multipolygon (const std::vector< uint8_t > &blob) |
| DbPtr | open_database (const std::string &path, int flags=SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE) |
| StmtPtr | prepare (sqlite3 *db, const std::string &sql) |
| void | exec (sqlite3 *db, const std::string &sql) |
| void | bind_text (sqlite3_stmt *stmt, int col, const std::string &val) |
| void | bind_double (sqlite3_stmt *stmt, int col, double val) |
| void | bind_int (sqlite3_stmt *stmt, int col, int val) |
| void | bind_null (sqlite3_stmt *stmt, int col) |
| void | bind_blob (sqlite3_stmt *stmt, int col, const void *data, int size) |
| std::string | column_text (sqlite3_stmt *stmt, int col) |
| double | column_double (sqlite3_stmt *stmt, int col) |
| int | column_int (sqlite3_stmt *stmt, int col) |
| bool | column_is_null (sqlite3_stmt *stmt, int col) |
| std::vector< uint8_t > | column_blob (sqlite3_stmt *stmt, int col) |
Variables | |
| constexpr uint8_t | WKB_LITTLE_ENDIAN = 1 |
| constexpr uint8_t | GP_MAGIC_1 = 0x47 |
| constexpr uint8_t | GP_MAGIC_2 = 0x50 |
| using openswmm::gpkg::DbPtr = typedef std::unique_ptr<sqlite3, DbDeleter> |
| using openswmm::gpkg::StmtPtr = typedef std::unique_ptr<sqlite3_stmt, StmtDeleter> |
| enum openswmm::gpkg::WkbType : uint32_t |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
| void openswmm::gpkg::create_schema | ( | sqlite3 * | db | ) |
Create all GeoPackage metadata tables and OpenSWMM application tables.
Creates (idempotently):
| db | Open SQLite database handle. |
| GpkgError | on failure. |
|
inline |
|
inline |
|
inline |
|
inline |
Encode a LINESTRING geometry in GeoPackage Binary format.
| xs | X coordinates of vertices. |
| ys | Y coordinates of vertices. |
|
inline |
Encode a MULTIPOLYGON geometry (single polygon, single ring) in GeoPackage Binary format.
| xs | X coordinates of polygon ring vertices. |
| ys | Y coordinates of polygon ring vertices. |
|
inline |
Encode a POINT geometry in GeoPackage Binary format.
|
inline |
|
inline |
| void openswmm::gpkg::populate_default_variables | ( | sqlite3 * | db | ) |
Pre-populate the variables catalog with known SWMM output variables.
| db | Open database handle. |
|
inline |
| int openswmm::gpkg::read_from_file | ( | const std::string & | path, |
| SimulationContext & | ctx, | ||
| const std::string & | simulation_id | ||
| ) |
Convenience: open a GeoPackage file and read a model.
| path | Path to the .gpkg file. |
| ctx | Simulation context to populate. |
| simulation_id | Which model instance to load. |
| int openswmm::gpkg::read_model | ( | sqlite3 * | db, |
| SimulationContext & | ctx, | ||
| const std::string & | simulation_id | ||
| ) |
Read a model definition from a GeoPackage into a SimulationContext.
| db | Open SQLite database handle. |
| ctx | Simulation context to populate. |
| simulation_id | Which model instance to load. |
| void openswmm::gpkg::register_crs | ( | sqlite3 * | db, |
| int | srs_id, | ||
| const std::string & | org, | ||
| int | org_id, | ||
| const std::string & | srs_name, | ||
| const std::string & | wkt | ||
| ) |
Register a CRS in gpkg_spatial_ref_sys (if not already present).
| db | Open database handle. |
| srs_id | Numeric SRS ID (e.g., 4326). |
| org | Organization name (e.g., "EPSG"). |
| org_id | Organization CRS ID (e.g., 4326). |
| srs_name | Human-readable name (e.g., "WGS 84"). |
| wkt | WKT definition string. |
| void openswmm::gpkg::register_feature_table | ( | sqlite3 * | db, |
| const std::string & | table_name, | ||
| const std::string & | geom_type, | ||
| int | srs_id, | ||
| const std::string & | identifier, | ||
| const std::string & | description, | ||
| double | min_x, | ||
| double | min_y, | ||
| double | max_x, | ||
| double | max_y | ||
| ) |
Register a feature table in gpkg_contents and gpkg_geometry_columns.
| db | Open database handle. |
| table_name | Table name (e.g., "nodes"). |
| geom_type | Geometry type name (e.g., "POINT", "LINESTRING", "MULTIPOLYGON"). |
| srs_id | SRS ID from gpkg_spatial_ref_sys. |
| identifier | Human-readable identifier. |
| description | Table description. |
| min_x,min_y,max_x,max_y | Bounding box. |
| void openswmm::gpkg::write_model | ( | sqlite3 * | db, |
| const SimulationContext & | ctx, | ||
| const std::string & | simulation_id, | ||
| int | srs_id = 0 |
||
| ) |
Write the full model definition from a SimulationContext into a GeoPackage.
Creates the schema if needed, registers the CRS, and writes all SWMM input sections as feature/attribute tables. The simulation_id groups all written data for this model instance.
| db | Open SQLite database handle (schema must exist or will be created). |
| ctx | Simulation context containing the parsed model. |
| simulation_id | Unique ID for this model instance. |
| srs_id | SRS ID to use for geometry encoding (default: 0 = undefined). |
| int openswmm::gpkg::write_to_file | ( | const std::string & | path, |
| const SimulationContext & | ctx, | ||
| const std::string & | simulation_id | ||
| ) |
Convenience: create a new GeoPackage file, write schema + model.
| path | Output file path (created or overwritten). |
| ctx | Simulation context. |
| simulation_id | Unique ID for this model instance. |
|
constexpr |
|
constexpr |
|
constexpr |