00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <string.h>
00021 #include <grass/gis.h>
00022 #include <grass/Vect.h>
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 int
00052 dig_Rd_P_node (
00053 struct Plus_head *Plus,
00054 int n,
00055 GVFILE * fp)
00056 {
00057 int cnt, n_edges;
00058 P_NODE *ptr;
00059
00060 G_debug (3, "dig_Rd_P_node()");
00061
00062
00063 if (0 >= dig__fread_port_P (&cnt, 1, fp))
00064 return (-1);
00065
00066 if ( cnt == 0 ) {
00067 G_debug (3, " node is dead");
00068 Plus->Node[n] = NULL ;
00069 return 0;
00070 }
00071
00072 ptr = dig_alloc_node();
00073 ptr->n_lines = cnt;
00074
00075 if ( dig_node_alloc_line ( ptr, ptr->n_lines) == -1)
00076 return -1;
00077
00078 if (ptr->n_lines) {
00079 if (0 >= dig__fread_port_P (ptr->lines, ptr->n_lines, fp))
00080 return (-1);
00081 if (0 >= dig__fread_port_F (ptr->angles, ptr->n_lines, fp))
00082 return (-1);
00083 }
00084
00085 if ( Plus->with_z )
00086 if (0 >= dig__fread_port_P (&n_edges, 1, fp))
00087 return (-1);
00088
00089
00090
00091 if (0 >= dig__fread_port_D (&(ptr->x), 1, fp))
00092 return (-1);
00093 if (0 >= dig__fread_port_D (&(ptr->y), 1, fp))
00094 return (-1);
00095
00096 if ( Plus->with_z ) {
00097 if (0 >= dig__fread_port_D (&(ptr->z), 1, fp))
00098 return (-1);
00099 } else
00100 ptr->z = 0;
00101
00102
00103 Plus->Node[n] = ptr;
00104
00105 return (0);
00106 }
00107
00108 int
00109 dig_Wr_P_node (
00110 struct Plus_head *Plus,
00111 int n,
00112 GVFILE * fp)
00113 {
00114 int i, n_edges = 0;
00115 P_NODE *ptr;
00116
00117 G_debug (3, "dig_Wr_P_node()");
00118 ptr = Plus->Node[n];
00119
00120
00121 if ( ptr == NULL ) {
00122 G_debug (3, " node is dead -> write 0 only");
00123 i = 0;
00124 if (0 >= dig__fwrite_port_P (&i, 1, fp))
00125 return (-1);
00126 return 0;
00127 }
00128
00129 if (0 >= dig__fwrite_port_P (&(ptr->n_lines), 1, fp))
00130 return (-1);
00131
00132 if (ptr->n_lines)
00133 {
00134 if (0 >= dig__fwrite_port_P (ptr->lines, ptr->n_lines, fp))
00135 return (-1);
00136 if (0 >= dig__fwrite_port_F (ptr->angles, ptr->n_lines, fp))
00137 return (-1);
00138 }
00139
00140 if ( Plus->with_z )
00141 if (0 >= dig__fwrite_port_P (&n_edges, 1, fp))
00142 return (-1);
00143
00144
00145
00146 if (0 >= dig__fwrite_port_D (&(ptr->x), 1, fp))
00147 return (-1);
00148 if (0 >= dig__fwrite_port_D (&(ptr->y), 1, fp))
00149 return (-1);
00150
00151 if ( Plus->with_z )
00152 if (0 >= dig__fwrite_port_D (&(ptr->z), 1, fp))
00153 return (-1);
00154
00155 return (0);
00156 }
00157
00158 int
00159 dig_Rd_P_line ( struct Plus_head *Plus, int n, GVFILE * fp)
00160 {
00161 int n_edges, vol;
00162 char tp;
00163 P_LINE *ptr;
00164 P_NODE *Node;
00165
00166 G_debug (3, "dig_Rd_P_line()");
00167
00168 if (0 >= dig__fread_port_C (&tp, 1, fp))
00169 return (-1);
00170
00171 if ( tp == 0 ) {
00172 G_debug (3, " line is dead");
00173 Plus->Line[n] = NULL ;
00174 return 0;
00175 }
00176
00177 ptr = dig_alloc_line();
00178
00179 ptr->type = dig_type_from_store ( tp );
00180 G_debug (5, " line type %d -> %d", tp, ptr->type);
00181
00182 if (0 >= dig__fread_port_L (&(ptr->offset), 1, fp)) return (-1);
00183
00184
00185 if ( ptr->type & ( GV_POINTS | GV_LINES | GV_KERNEL ) )
00186 if (0 >= dig__fread_port_P (&(ptr->N1), 1, fp)) return -1;
00187
00188
00189 if ( ptr->type & (GV_LINE | GV_BOUNDARY ) ) {
00190 if (0 >= dig__fread_port_P (&(ptr->N2), 1, fp)) return -1;
00191 } else if ( ptr->type & (GV_POINTS | GV_KERNEL ) )
00192 ptr->N2 = ptr->N1;
00193
00194
00195 if ( ptr->type & (GV_BOUNDARY | GV_CENTROID) )
00196 if (0 >= dig__fread_port_P (&(ptr->left), 1, fp)) return -1;
00197
00198
00199 if ( ptr->type & GV_BOUNDARY )
00200 if (0 >= dig__fread_port_P (&(ptr->right), 1, fp)) return -1;
00201
00202 if ( (ptr->type & GV_FACE) && Plus->with_z ) {
00203 if (0 >= dig__fread_port_I (&n_edges, 1, fp)) return -1;
00204
00205
00206
00207
00208 if (0 >= dig__fread_port_P (&vol, 1, fp)) return -1;
00209 if (0 >= dig__fread_port_P (&vol, 1, fp)) return -1;
00210 }
00211
00212 if ( (ptr->type & GV_KERNEL) && Plus->with_z )
00213 if (0 >= dig__fread_port_P (&vol, 1, fp)) return -1;
00214
00215
00216 if ( ptr->type & (GV_LINE | GV_BOUNDARY | GV_FACE ) ) {
00217 if (0 >= dig__fread_port_D (&(ptr->N), 1, fp)) return -1;
00218 if (0 >= dig__fread_port_D (&(ptr->S), 1, fp)) return -1;
00219 if (0 >= dig__fread_port_D (&(ptr->E), 1, fp)) return -1;
00220 if (0 >= dig__fread_port_D (&(ptr->W), 1, fp)) return -1;
00221
00222 if ( Plus->with_z ) {
00223 if (0 >= dig__fread_port_D (&(ptr->T), 1, fp)) return -1;
00224 if (0 >= dig__fread_port_D (&(ptr->B), 1, fp)) return -1;
00225 } else {
00226 ptr->T = 0.0;
00227 ptr->B = 0.0;
00228 }
00229 } else {
00230 Node = Plus->Node[ptr->N1];
00231 ptr->N = Node->y;
00232 ptr->S = Node->y;
00233 ptr->E = Node->x;
00234 ptr->W = Node->x;
00235 ptr->T = Node->z;
00236 ptr->B = Node->z;
00237 }
00238
00239 Plus->Line[n] = ptr;
00240 return (0);
00241 }
00242
00243 int
00244 dig_Wr_P_line (
00245 struct Plus_head *Plus,
00246 int n,
00247 GVFILE * fp)
00248 {
00249 int n_edges = 0, vol = 0;
00250 char ch;
00251 P_LINE *ptr;
00252
00253 G_debug (4, "dig_Wr_P_line() line = %d", n);
00254
00255 ptr = Plus->Line[n];
00256
00257
00258 if ( ptr == NULL ) {
00259 G_debug (3, " line is dead -> write 0 only");
00260 ch = 0;
00261 if (0 >= dig__fwrite_port_C (&ch, 1, fp)) return (-1);
00262 return 0;
00263 }
00264
00265 ch = (char) dig_type_to_store ( ptr->type );
00266 G_debug (5, " line type %d -> %d", ptr->type, ch);
00267 if (0 >= dig__fwrite_port_C (&ch, 1, fp)) return (-1);
00268 if (0 >= dig__fwrite_port_L (&(ptr->offset), 1, fp)) return (-1);
00269
00270
00271 if ( ptr->type & ( GV_POINTS | GV_LINES | GV_KERNEL ) )
00272 if (0 >= dig__fwrite_port_P (&(ptr->N1), 1, fp)) return (-1);
00273
00274
00275 if ( ptr->type & (GV_LINE | GV_BOUNDARY ) )
00276 if (0 >= dig__fwrite_port_P (&(ptr->N2), 1, fp)) return (-1);
00277
00278
00279 if ( ptr->type & (GV_BOUNDARY | GV_CENTROID) )
00280 if (0 >= dig__fwrite_port_P (&(ptr->left), 1, fp)) return (-1);
00281
00282
00283 if ( ptr->type & GV_BOUNDARY )
00284 if (0 >= dig__fwrite_port_P (&(ptr->right), 1, fp)) return (-1);
00285
00286 if ( (ptr->type & GV_FACE) && Plus->with_z ) {
00287 if (0 >= dig__fwrite_port_I (&n_edges, 1, fp)) return (-1);
00288
00289
00290
00291
00292 if (0 >= dig__fwrite_port_P (&vol, 1, fp)) return (-1);
00293 if (0 >= dig__fwrite_port_P (&vol, 1, fp)) return (-1);
00294 }
00295
00296 if ( (ptr->type & GV_KERNEL) && Plus->with_z )
00297 if (0 >= dig__fwrite_port_P (&vol, 1, fp)) return (-1);
00298
00299
00300 if ( ptr->type & (GV_LINE | GV_BOUNDARY | GV_FACE ) ) {
00301 if (0 >= dig__fwrite_port_D (&(ptr->N), 1, fp)) return (-1);
00302 if (0 >= dig__fwrite_port_D (&(ptr->S), 1, fp)) return (-1);
00303 if (0 >= dig__fwrite_port_D (&(ptr->E), 1, fp)) return (-1);
00304 if (0 >= dig__fwrite_port_D (&(ptr->W), 1, fp)) return (-1);
00305
00306 if ( Plus->with_z ) {
00307 if (0 >= dig__fwrite_port_D (&(ptr->T), 1, fp)) return (-1);
00308 if (0 >= dig__fwrite_port_D (&(ptr->B), 1, fp)) return (-1);
00309 }
00310 }
00311
00312 return (0);
00313 }
00314
00315 int
00316 dig_Rd_P_area (
00317 struct Plus_head *Plus,
00318 int n,
00319 GVFILE * fp)
00320 {
00321 int cnt;
00322 P_AREA *ptr;
00323 #ifdef GDEBUG
00324 G_debug (3, "dig_Rd_P_area(): n = %d", n );
00325 #endif
00326
00327 if (0 >= dig__fread_port_P (&cnt, 1, fp))
00328 return (-1);
00329
00330 if ( cnt == 0 ) {
00331 Plus->Area[n] = NULL ;
00332 return 0;
00333 }
00334
00335 ptr = dig_alloc_area();
00336
00337
00338 ptr->n_lines = cnt;
00339
00340 if ( dig_area_alloc_line ( ptr, ptr->n_lines) == -1) return -1;
00341
00342 if (ptr->n_lines)
00343 if (0 >= dig__fread_port_P (ptr->lines, ptr->n_lines, fp)) return -1;
00344
00345
00346 if (0 >= dig__fread_port_P (&(ptr->n_isles), 1, fp)) return -1;
00347
00348 if ( dig_area_alloc_isle ( ptr, ptr->n_isles) == -1) return -1;
00349
00350 if (ptr->n_isles)
00351 if (0 >= dig__fread_port_P (ptr->isles, ptr->n_isles, fp)) return -1;
00352
00353
00354 if (0 >= dig__fread_port_P (&(ptr->centroid), 1, fp)) return -1;
00355
00356 if (0 >= dig__fread_port_D (&(ptr->N), 1, fp)) return -1;
00357 if (0 >= dig__fread_port_D (&(ptr->S), 1, fp)) return -1;
00358 if (0 >= dig__fread_port_D (&(ptr->E), 1, fp)) return -1;
00359 if (0 >= dig__fread_port_D (&(ptr->W), 1, fp)) return -1;
00360
00361 if ( Plus->with_z ) {
00362 if (0 >= dig__fread_port_D (&(ptr->T), 1, fp)) return -1;
00363 if (0 >= dig__fread_port_D (&(ptr->B), 1, fp)) return -1;
00364 } else {
00365 ptr->T = 0.0;
00366 ptr->B = 0.0;
00367 }
00368
00369 Plus->Area[n] = ptr;
00370
00371 return (0);
00372 }
00373
00374 int
00375 dig_Wr_P_area ( struct Plus_head *Plus,
00376 int n,
00377 GVFILE * fp)
00378 {
00379 int i;
00380 P_AREA *ptr;
00381
00382 ptr = Plus->Area[n];
00383
00384
00385 if ( ptr == NULL ) {
00386 i = 0;
00387 if (0 >= dig__fwrite_port_P (&i, 1, fp)) return (-1);
00388 return 0;
00389 }
00390
00391
00392 if (0 >= dig__fwrite_port_P (&(ptr->n_lines), 1, fp)) return (-1);
00393
00394 if (ptr->n_lines)
00395 if (0 >= dig__fwrite_port_P (ptr->lines, ptr->n_lines, fp)) return -1;
00396
00397
00398 if (0 >= dig__fwrite_port_P (&(ptr->n_isles), 1, fp)) return (-1);
00399
00400 if (ptr->n_isles)
00401 if (0 >= dig__fwrite_port_P (ptr->isles, ptr->n_isles, fp)) return -1;
00402
00403
00404 if (0 >= dig__fwrite_port_P (&(ptr->centroid), 1, fp)) return (-1);
00405
00406 if (0 >= dig__fwrite_port_D (&(ptr->N), 1, fp)) return (-1);
00407 if (0 >= dig__fwrite_port_D (&(ptr->S), 1, fp)) return (-1);
00408 if (0 >= dig__fwrite_port_D (&(ptr->E), 1, fp)) return (-1);
00409 if (0 >= dig__fwrite_port_D (&(ptr->W), 1, fp)) return (-1);
00410
00411 if ( Plus->with_z ) {
00412 if (0 >= dig__fwrite_port_D (&(ptr->T), 1, fp)) return (-1);
00413 if (0 >= dig__fwrite_port_D (&(ptr->B), 1, fp)) return (-1);
00414 }
00415
00416 return (0);
00417 }
00418
00419 int
00420 dig_Rd_P_isle ( struct Plus_head *Plus,
00421 int n,
00422 GVFILE * fp)
00423 {
00424 int cnt;
00425 P_ISLE *ptr;
00426 #ifdef GDEBUG
00427 G_debug (3, "dig_Rd_P_isle()");
00428 #endif
00429
00430 if (0 >= dig__fread_port_P (&cnt, 1, fp))
00431 return (-1);
00432
00433 if ( cnt == 0 ) {
00434 Plus->Isle[n] = NULL ;
00435 return 0;
00436 }
00437
00438 ptr = dig_alloc_isle();
00439
00440
00441 ptr->n_lines = cnt;
00442
00443 if ( dig_isle_alloc_line ( ptr, ptr->n_lines) == -1) return -1;
00444
00445 if (ptr->n_lines)
00446 if (0 >= dig__fread_port_P (ptr->lines, ptr->n_lines, fp)) return -1;
00447
00448
00449 if (0 >= dig__fread_port_P (&(ptr->area), 1, fp)) return -1;
00450
00451 if (0 >= dig__fread_port_D (&(ptr->N), 1, fp)) return -1;
00452 if (0 >= dig__fread_port_D (&(ptr->S), 1, fp)) return -1;
00453 if (0 >= dig__fread_port_D (&(ptr->E), 1, fp)) return -1;
00454 if (0 >= dig__fread_port_D (&(ptr->W), 1, fp)) return -1;
00455
00456 if ( Plus->with_z ) {
00457 if (0 >= dig__fread_port_D (&(ptr->T), 1, fp)) return -1;
00458 if (0 >= dig__fread_port_D (&(ptr->B), 1, fp)) return -1;
00459 } else {
00460 ptr->T = 0.0;
00461 ptr->B = 0.0;
00462 }
00463
00464 Plus->Isle[n] = ptr;
00465
00466 return (0);
00467 }
00468
00469 int
00470 dig_Wr_P_isle (
00471 struct Plus_head *Plus,
00472 int n,
00473 GVFILE * fp)
00474 {
00475 int i;
00476 P_ISLE *ptr;
00477
00478 ptr = Plus->Isle[n];
00479
00480
00481 if ( ptr == NULL ) {
00482 i = 0;
00483 if (0 >= dig__fwrite_port_P (&i, 1, fp)) return (-1);
00484 return 0;
00485 }
00486
00487
00488 if (0 >= dig__fwrite_port_P (&(ptr->n_lines), 1, fp)) return (-1);
00489
00490 if (ptr->n_lines)
00491 if (0 >= dig__fwrite_port_P (ptr->lines, ptr->n_lines, fp)) return -1;
00492
00493
00494 if (0 >= dig__fwrite_port_P (&(ptr->area), 1, fp)) return (-1);
00495
00496 if (0 >= dig__fwrite_port_D (&(ptr->N), 1, fp)) return (-1);
00497 if (0 >= dig__fwrite_port_D (&(ptr->S), 1, fp)) return (-1);
00498 if (0 >= dig__fwrite_port_D (&(ptr->E), 1, fp)) return (-1);
00499 if (0 >= dig__fwrite_port_D (&(ptr->W), 1, fp)) return (-1);
00500
00501 if ( Plus->with_z ) {
00502 if (0 >= dig__fwrite_port_D (&(ptr->T), 1, fp)) return (-1);
00503 if (0 >= dig__fwrite_port_D (&(ptr->B), 1, fp)) return (-1);
00504 }
00505
00506 return (0);
00507 }
00508
00509
00510
00511
00512
00513 int
00514 dig_Rd_Plus_head ( GVFILE * fp,
00515 struct Plus_head *ptr)
00516 {
00517 unsigned char buf[5];
00518 int byte_order;
00519
00520 dig_rewind (fp);
00521
00522
00523 if (0 >= dig__fread_port_C (buf, 5, fp)) return (-1);
00524 ptr->Version_Major = buf[0];
00525 ptr->Version_Minor = buf[1];
00526 ptr->Back_Major = buf[2];
00527 ptr->Back_Minor = buf[3];
00528 byte_order = buf[4];
00529
00530 G_debug (2, "Topo header: file version %d.%d , supported from GRASS version %d.%d",
00531 ptr->Version_Major, ptr->Version_Minor, ptr->Back_Major, ptr->Back_Minor );
00532
00533 G_debug (2, " byte order %d", byte_order );
00534
00535
00536 if ( ptr->Version_Major > GV_TOPO_VER_MAJOR || ptr->Version_Minor > GV_TOPO_VER_MINOR ) {
00537
00538
00539 if ( ptr->Back_Major > GV_TOPO_VER_MAJOR || ptr->Back_Minor > GV_TOPO_VER_MINOR ) {
00540
00541 G_fatal_error ( "Topology format version %d.%d is not supported by this release."
00542 " Try to rebuild topology or upgrade GRASS.",
00543 ptr->Version_Major, ptr->Version_Minor);
00544 return (-1);
00545 }
00546
00547 G_warning ( "Your GRASS version does not fully support topology format %d.%d of the vector."
00548 " Consider to rebuild topology or upgrade GRASS.",
00549 ptr->Version_Major, ptr->Version_Minor );
00550 }
00551
00552 dig_init_portable ( &(ptr->port), byte_order);
00553 dig_set_cur_port ( &(ptr->port) );
00554
00555
00556 if (0 >= dig__fread_port_L (&(ptr->head_size), 1, fp)) return (-1);
00557 G_debug (2, " header size %d", ptr->head_size );
00558
00559
00560 if (0 >= dig__fread_port_C (buf, 1, fp)) return (-1);
00561 ptr->with_z = buf[0];
00562 G_debug (2, " with_z %d", ptr->with_z );
00563
00564
00565 if (0 >= dig__fread_port_D (&(ptr->box.N), 1, fp)) return (-1);
00566 if (0 >= dig__fread_port_D (&(ptr->box.S), 1, fp)) return (-1);
00567 if (0 >= dig__fread_port_D (&(ptr->box.E), 1, fp)) return (-1);
00568 if (0 >= dig__fread_port_D (&(ptr->box.W), 1, fp)) return (-1);
00569 if (0 >= dig__fread_port_D (&(ptr->box.T), 1, fp)) return (-1);
00570 if (0 >= dig__fread_port_D (&(ptr->box.B), 1, fp)) return (-1);
00571
00572
00573 if (0 >= dig__fread_port_P (&(ptr->n_nodes), 1, fp)) return (-1);
00574 if (0 >= dig__fread_port_P (&(ptr->n_edges), 1, fp)) return (-1);
00575 if (0 >= dig__fread_port_P (&(ptr->n_lines), 1, fp)) return (-1);
00576 if (0 >= dig__fread_port_P (&(ptr->n_areas), 1, fp)) return (-1);
00577 if (0 >= dig__fread_port_P (&(ptr->n_isles), 1, fp)) return (-1);
00578 if (0 >= dig__fread_port_P (&(ptr->n_volumes), 1, fp)) return (-1);
00579 if (0 >= dig__fread_port_P (&(ptr->n_holes), 1, fp)) return (-1);
00580
00581
00582 if (0 >= dig__fread_port_P (&(ptr->n_plines), 1, fp)) return (-1);
00583 if (0 >= dig__fread_port_P (&(ptr->n_llines), 1, fp)) return (-1);
00584 if (0 >= dig__fread_port_P (&(ptr->n_blines), 1, fp)) return (-1);
00585 if (0 >= dig__fread_port_P (&(ptr->n_clines), 1, fp)) return (-1);
00586 if (0 >= dig__fread_port_P (&(ptr->n_flines), 1, fp)) return (-1);
00587 if (0 >= dig__fread_port_P (&(ptr->n_klines), 1, fp)) return (-1);
00588
00589
00590 if (0 >= dig__fread_port_L (&(ptr->Node_offset), 1, fp)) return (-1);
00591 if (0 >= dig__fread_port_L (&(ptr->Edge_offset), 1, fp)) return (-1);
00592 if (0 >= dig__fread_port_L (&(ptr->Line_offset), 1, fp)) return (-1);
00593 if (0 >= dig__fread_port_L (&(ptr->Area_offset), 1, fp)) return (-1);
00594 if (0 >= dig__fread_port_L (&(ptr->Isle_offset), 1, fp)) return (-1);
00595 if (0 >= dig__fread_port_L (&(ptr->Volume_offset), 1, fp)) return (-1);
00596 if (0 >= dig__fread_port_L (&(ptr->Hole_offset), 1, fp)) return (-1);
00597
00598
00599 if (0 >= dig__fread_port_L (&(ptr->coor_size), 1, fp)) return (-1);
00600
00601 G_debug (2, " coor size %d", ptr->coor_size );
00602
00603 dig_fseek ( fp, ptr->head_size, SEEK_SET );
00604
00605 return (0);
00606 }
00607
00608 int
00609 dig_Wr_Plus_head ( GVFILE * fp,
00610 struct Plus_head *ptr)
00611 {
00612 unsigned char buf[10];
00613 long length = 142;
00614
00615 dig_rewind (fp);
00616 dig_set_cur_port (&(ptr->port));
00617
00618
00619 buf[0] = GV_TOPO_VER_MAJOR;
00620 buf[1] = GV_TOPO_VER_MINOR;
00621 buf[2] = GV_TOPO_EARLIEST_MAJOR;
00622 buf[3] = GV_TOPO_EARLIEST_MINOR;
00623 buf[4] = ptr->port.byte_order;
00624 if (0 >= dig__fwrite_port_C (buf, 5, fp)) return (-1);
00625
00626
00627 if (0 >= dig__fwrite_port_L ( &length, 1, fp)) return (0);
00628
00629
00630 buf[0] = ptr->with_z;
00631 if (0 >= dig__fwrite_port_C ( buf, 1, fp)) return (0);
00632
00633
00634 if (0 >= dig__fwrite_port_D (&(ptr->box.N), 1, fp)) return (-1);
00635 if (0 >= dig__fwrite_port_D (&(ptr->box.S), 1, fp)) return (-1);
00636 if (0 >= dig__fwrite_port_D (&(ptr->box.E), 1, fp)) return (-1);
00637 if (0 >= dig__fwrite_port_D (&(ptr->box.W), 1, fp)) return (-1);
00638 if (0 >= dig__fwrite_port_D (&(ptr->box.T), 1, fp)) return (-1);
00639 if (0 >= dig__fwrite_port_D (&(ptr->box.B), 1, fp)) return (-1);
00640
00641
00642 if (0 >= dig__fwrite_port_P (&(ptr->n_nodes), 1, fp)) return (-1);
00643 if (0 >= dig__fwrite_port_P (&(ptr->n_edges), 1, fp)) return (-1);
00644 if (0 >= dig__fwrite_port_P (&(ptr->n_lines), 1, fp)) return (-1);
00645 if (0 >= dig__fwrite_port_P (&(ptr->n_areas), 1, fp)) return (-1);
00646 if (0 >= dig__fwrite_port_P (&(ptr->n_isles), 1, fp)) return (-1);
00647 if (0 >= dig__fwrite_port_P (&(ptr->n_volumes), 1, fp)) return (-1);
00648 if (0 >= dig__fwrite_port_P (&(ptr->n_holes), 1, fp)) return (-1);
00649
00650
00651 if (0 >= dig__fwrite_port_P (&(ptr->n_plines), 1, fp)) return (-1);
00652 if (0 >= dig__fwrite_port_P (&(ptr->n_llines), 1, fp)) return (-1);
00653 if (0 >= dig__fwrite_port_P (&(ptr->n_blines), 1, fp)) return (-1);
00654 if (0 >= dig__fwrite_port_P (&(ptr->n_clines), 1, fp)) return (-1);
00655 if (0 >= dig__fwrite_port_P (&(ptr->n_flines), 1, fp)) return (-1);
00656 if (0 >= dig__fwrite_port_P (&(ptr->n_klines), 1, fp)) return (-1);
00657
00658
00659 if (0 >= dig__fwrite_port_L (&(ptr->Node_offset), 1, fp)) return (-1);
00660 if (0 >= dig__fwrite_port_L (&(ptr->Edge_offset), 1, fp)) return (-1);
00661 if (0 >= dig__fwrite_port_L (&(ptr->Line_offset), 1, fp)) return (-1);
00662 if (0 >= dig__fwrite_port_L (&(ptr->Area_offset), 1, fp)) return (-1);
00663 if (0 >= dig__fwrite_port_L (&(ptr->Isle_offset), 1, fp)) return (-1);
00664 if (0 >= dig__fwrite_port_L (&(ptr->Volume_offset), 1, fp)) return (-1);
00665 if (0 >= dig__fwrite_port_L (&(ptr->Hole_offset), 1, fp)) return (-1);
00666
00667
00668 if (0 >= dig__fwrite_port_L (&(ptr->coor_size), 1, fp)) return (-1);
00669
00670 G_debug (2, "topo body offset %d", dig_ftell( fp) );
00671
00672 return (0);
00673 }
00674