|
@@ -14,11 +14,8 @@
|
|
\param height fixed height (used only if column is NULL)
|
|
\param height fixed height (used only if column is NULL)
|
|
\param field layer number
|
|
\param field layer number
|
|
\param column attribute column used for height
|
|
\param column attribute column used for height
|
|
-
|
|
|
|
- \return number of writen features
|
|
|
|
- \return -1 on error
|
|
|
|
*/
|
|
*/
|
|
-int trans2d(struct Map_info *In, struct Map_info *Out, int type,
|
|
|
|
|
|
+void trans2d(struct Map_info *In, struct Map_info *Out, int type,
|
|
double height, const char *field_name, const char *column)
|
|
double height, const char *field_name, const char *column)
|
|
{
|
|
{
|
|
int i, ltype, line, field;
|
|
int i, ltype, line, field;
|
|
@@ -49,28 +46,25 @@ int trans2d(struct Map_info *In, struct Map_info *Out, int type,
|
|
|
|
|
|
Fi = Vect_get_field(In, field);
|
|
Fi = Vect_get_field(In, field);
|
|
if (!Fi) {
|
|
if (!Fi) {
|
|
- G_warning(_("Database connection not defined for layer <%s>"),
|
|
|
|
- field_name);
|
|
|
|
- return -1;
|
|
|
|
|
|
+ G_fatal_error(_("Database connection not defined for layer <%s>"),
|
|
|
|
+ field_name);
|
|
}
|
|
}
|
|
|
|
|
|
driver = db_start_driver_open_database(Fi->driver, Fi->database);
|
|
driver = db_start_driver_open_database(Fi->driver, Fi->database);
|
|
if (!driver) {
|
|
if (!driver) {
|
|
- G_warning(_("Unable to open database <%s> by driver <%s>"),
|
|
|
|
- Fi->database, Fi->driver);
|
|
|
|
- return -1;
|
|
|
|
|
|
+ G_fatal_error(_("Unable to open database <%s> by driver <%s>"),
|
|
|
|
+ Fi->database, Fi->driver);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ db_set_error_handler_driver(driver);
|
|
|
|
+
|
|
/* column type must numeric */
|
|
/* column type must numeric */
|
|
ctype = db_column_Ctype(driver, Fi->table, column);
|
|
ctype = db_column_Ctype(driver, Fi->table, column);
|
|
if (ctype == -1) {
|
|
if (ctype == -1) {
|
|
- G_warning(_("Column <%s> not found in table <%s>"),
|
|
|
|
- column, Fi->table);
|
|
|
|
- return -1;
|
|
|
|
|
|
+ G_fatal_error(_("Column <%s> not found in table <%s>"),
|
|
|
|
+ column, Fi->table);
|
|
}
|
|
}
|
|
if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE) {
|
|
if (ctype != DB_C_TYPE_INT && ctype != DB_C_TYPE_DOUBLE) {
|
|
- G_warning(_("Column must be numeric"));
|
|
|
|
- return -1;
|
|
|
|
|
|
+ G_fatal_error(_("Column must be numeric"));
|
|
}
|
|
}
|
|
|
|
|
|
G_message(_("Fetching height from <%s> column..."), column);
|
|
G_message(_("Fetching height from <%s> column..."), column);
|
|
@@ -87,8 +81,7 @@ int trans2d(struct Map_info *In, struct Map_info *Out, int type,
|
|
while (1) {
|
|
while (1) {
|
|
ltype = Vect_read_next_line(In, Points, Cats);
|
|
ltype = Vect_read_next_line(In, Points, Cats);
|
|
if (ltype == -1) {
|
|
if (ltype == -1) {
|
|
- G_warning(_("Unable to read vector map"));
|
|
|
|
- return -1;
|
|
|
|
|
|
+ G_fatal_error(_("Unable to read vector map"));
|
|
}
|
|
}
|
|
if (ltype == -2) { /* EOF */
|
|
if (ltype == -2) { /* EOF */
|
|
break;
|
|
break;
|
|
@@ -136,6 +129,4 @@ int trans2d(struct Map_info *In, struct Map_info *Out, int type,
|
|
|
|
|
|
Vect_destroy_line_struct(Points);
|
|
Vect_destroy_line_struct(Points);
|
|
Vect_destroy_cats_struct(Cats);
|
|
Vect_destroy_cats_struct(Cats);
|
|
-
|
|
|
|
- return line - 1;
|
|
|
|
}
|
|
}
|