libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00042 #include "3dface.h" 00043 00044 00053 Dxf3dface * 00054 dxf_3dface_new () 00055 { 00056 #ifdef DEBUG 00057 DXF_DEBUG_BEGIN 00058 #endif 00059 Dxf3dface *face = NULL; 00060 size_t size; 00061 00062 size = sizeof (Dxf3dface); 00063 /* avoid malloc of 0 bytes */ 00064 if (size == 0) size = 1; 00065 if ((face = malloc (size)) == NULL) 00066 { 00067 fprintf (stderr, 00068 (_("Error in %s () could not allocate memory.\n")), 00069 __FUNCTION__); 00070 face = NULL; 00071 } 00072 else 00073 { 00074 memset (face, 0, size); 00075 } 00076 #ifdef DEBUG 00077 DXF_DEBUG_END 00078 #endif 00079 return (face); 00080 } 00081 00082 00090 Dxf3dface * 00091 dxf_3dface_init 00092 ( 00093 Dxf3dface *face 00095 ) 00096 { 00097 #ifdef DEBUG 00098 DXF_DEBUG_BEGIN 00099 #endif 00100 /* Do some basic checks. */ 00101 if (face == NULL) 00102 { 00103 fprintf (stderr, 00104 (_("Warning in %s () a NULL pointer was passed.\n")), 00105 __FUNCTION__); 00106 face = dxf_3dface_new (); 00107 } 00108 if (face == NULL) 00109 { 00110 fprintf (stderr, 00111 (_("Error in %s () could not allocate memory.\n")), 00112 __FUNCTION__); 00113 return (NULL); 00114 } 00115 dxf_3dface_set_id_code (face, 0); 00116 dxf_3dface_set_linetype (face, strdup (DXF_DEFAULT_LINETYPE)); 00117 dxf_3dface_set_layer (face, strdup (DXF_DEFAULT_LAYER)); 00118 dxf_3dface_set_p0 (face, dxf_point_new ()); 00119 dxf_point_init ((DxfPoint *) dxf_3dface_get_p0 (face)); 00120 dxf_3dface_set_x0 (face, 0.0); 00121 dxf_3dface_set_y0 (face, 0.0); 00122 dxf_3dface_set_z0 (face, 0.0); 00123 dxf_3dface_set_p1 (face, dxf_point_new ()); 00124 dxf_point_init ((DxfPoint *) dxf_3dface_get_p1 (face)); 00125 dxf_3dface_set_x1 (face, 0.0); 00126 dxf_3dface_set_y1 (face, 0.0); 00127 dxf_3dface_set_z1 (face, 0.0); 00128 dxf_3dface_set_p2 (face, dxf_point_new ()); 00129 dxf_point_init ((DxfPoint *) dxf_3dface_get_p2 (face)); 00130 dxf_3dface_set_x2 (face, 0.0); 00131 dxf_3dface_set_y2 (face, 0.0); 00132 dxf_3dface_set_z2 (face, 0.0); 00133 dxf_3dface_set_p3 (face, dxf_point_new ()); 00134 dxf_point_init ((DxfPoint *) dxf_3dface_get_p3 (face)); 00135 dxf_3dface_set_x3 (face, 0.0); 00136 dxf_3dface_set_y3 (face, 0.0); 00137 dxf_3dface_set_z3 (face, 0.0); 00138 dxf_3dface_set_elevation (face, 0.0); 00139 dxf_3dface_set_thickness (face, 0.0); 00140 dxf_3dface_set_linetype_scale (face, DXF_DEFAULT_LINETYPE_SCALE); 00141 dxf_3dface_set_visibility (face, DXF_DEFAULT_VISIBILITY); 00142 dxf_3dface_set_color (face, DXF_COLOR_BYLAYER); 00143 dxf_3dface_set_paperspace (face, DXF_MODELSPACE); 00144 dxf_3dface_set_flag (face, 0); 00145 dxf_3dface_set_graphics_data_size (face, 0); 00146 dxf_3dface_set_shadow_mode (face, 0); 00147 dxf_3dface_set_binary_graphics_data (face, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ()); 00148 dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) dxf_3dface_get_binary_graphics_data (face)); 00149 dxf_3dface_set_dictionary_owner_soft (face, strdup ("")); 00150 dxf_3dface_set_material (face, strdup ("")); 00151 dxf_3dface_set_dictionary_owner_hard (face, strdup ("")); 00152 dxf_3dface_set_lineweight (face, 0); 00153 dxf_3dface_set_plot_style_name (face, strdup ("")); 00154 dxf_3dface_set_color_value (face, 0); 00155 dxf_3dface_set_color_name (face, strdup ("")); 00156 dxf_3dface_set_transparency (face, 0); 00157 dxf_3dface_set_next (face, NULL); 00158 #ifdef DEBUG 00159 DXF_DEBUG_END 00160 #endif 00161 return (face); 00162 } 00163 00164 00176 Dxf3dface * 00177 dxf_3dface_read 00178 ( 00179 DxfFile *fp, 00181 Dxf3dface *face 00183 ) 00184 { 00185 #ifdef DEBUG 00186 DXF_DEBUG_BEGIN 00187 #endif 00188 char *temp_string = NULL; 00189 00190 /* Do some basic checks. */ 00191 if (fp == NULL) 00192 { 00193 fprintf (stderr, 00194 (_("Error in %s () a NULL file pointer was passed.\n")), 00195 __FUNCTION__); 00196 /* Clean up. */ 00197 free (temp_string); 00198 return (NULL); 00199 } 00200 if (face == NULL) 00201 { 00202 fprintf (stderr, 00203 (_("Warning in %s () a NULL pointer was passed.\n")), 00204 __FUNCTION__); 00205 face = dxf_3dface_new (); 00206 face = dxf_3dface_init (face); 00207 } 00208 (fp->line_number)++; 00209 fscanf (fp->fp, "%[^\n]", temp_string); 00210 while (strcmp (temp_string, "0") != 0) 00211 { 00212 if (ferror (fp->fp)) 00213 { 00214 fprintf (stderr, 00215 (_("Error in %s () while reading from: %s in line: %d.\n")), 00216 __FUNCTION__, fp->filename, fp->line_number); 00217 /* Clean up. */ 00218 free (temp_string); 00219 fclose (fp->fp); 00220 return (NULL); 00221 } 00222 if (strcmp (temp_string, "5") == 0) 00223 { 00224 /* Now follows a string containing a sequential 00225 * id number. */ 00226 (fp->line_number)++; 00227 fscanf (fp->fp, "%x\n", &face->id_code); 00228 } 00229 else if (strcmp (temp_string, "6") == 0) 00230 { 00231 /* Now follows a string containing a linetype 00232 * name. */ 00233 (fp->line_number)++; 00234 fscanf (fp->fp, "%s\n", face->linetype); 00235 } 00236 else if (strcmp (temp_string, "8") == 0) 00237 { 00238 /* Now follows a string containing a layer name. */ 00239 (fp->line_number)++; 00240 fscanf (fp->fp, "%s\n", face->layer); 00241 } 00242 else if (strcmp (temp_string, "10") == 0) 00243 { 00244 /* Now follows a string containing the 00245 * X-coordinate of the first point. */ 00246 (fp->line_number)++; 00247 fscanf (fp->fp, "%lf\n", &face->p0->x0); 00248 } 00249 else if (strcmp (temp_string, "20") == 0) 00250 { 00251 /* Now follows a string containing the 00252 * Y-coordinate of the first point. */ 00253 (fp->line_number)++; 00254 fscanf (fp->fp, "%lf\n", &face->p0->y0); 00255 } 00256 else if (strcmp (temp_string, "30") == 0) 00257 { 00258 /* Now follows a string containing the 00259 * Z-coordinate of first the point. */ 00260 (fp->line_number)++; 00261 fscanf (fp->fp, "%lf\n", &face->p0->z0); 00262 } 00263 else if (strcmp (temp_string, "11") == 0) 00264 { 00265 /* Now follows a string containing the 00266 * X-coordinate of the second point. */ 00267 (fp->line_number)++; 00268 fscanf (fp->fp, "%lf\n", &face->p1->x0); 00269 } 00270 else if (strcmp (temp_string, "21") == 0) 00271 { 00272 /* Now follows a string containing the 00273 * Y-coordinate of the second point. */ 00274 (fp->line_number)++; 00275 fscanf (fp->fp, "%lf\n", &face->p1->y0); 00276 } 00277 else if (strcmp (temp_string, "31") == 0) 00278 { 00279 /* Now follows a string containing the 00280 * Z-coordinate of the second point. */ 00281 (fp->line_number)++; 00282 fscanf (fp->fp, "%lf\n", &face->p1->z0); 00283 } 00284 else if (strcmp (temp_string, "12") == 0) 00285 { 00286 /* Now follows a string containing the 00287 * X-coordinate of the third point. */ 00288 (fp->line_number)++; 00289 fscanf (fp->fp, "%lf\n", &face->p2->x0); 00290 } 00291 else if (strcmp (temp_string, "22") == 0) 00292 { 00293 /* Now follows a string containing the 00294 * Y-coordinate of the third point. */ 00295 (fp->line_number)++; 00296 fscanf (fp->fp, "%lf\n", &face->p2->y0); 00297 } 00298 else if (strcmp (temp_string, "32") == 0) 00299 { 00300 /* Now follows a string containing the 00301 * Z-coordinate of the third point. */ 00302 (fp->line_number)++; 00303 fscanf (fp->fp, "%lf\n", &face->p2->z0); 00304 } 00305 else if (strcmp (temp_string, "13") == 0) 00306 { 00307 /* Now follows a string containing the 00308 * X-coordinate of the fourth point. */ 00309 (fp->line_number)++; 00310 fscanf (fp->fp, "%lf\n", &face->p3->x0); 00311 } 00312 else if (strcmp (temp_string, "23") == 0) 00313 { 00314 /* Now follows a string containing the 00315 * Y-coordinate of the fourth point. */ 00316 (fp->line_number)++; 00317 fscanf (fp->fp, "%lf\n", &face->p3->y0); 00318 } 00319 else if (strcmp (temp_string, "33") == 0) 00320 { 00321 /* Now follows a string containing the 00322 * Z-coordinate of the fourth point. */ 00323 (fp->line_number)++; 00324 fscanf (fp->fp, "%lf\n", &face->p3->z0); 00325 } 00326 else if ((strcmp (temp_string, "38") == 0)) 00327 { 00328 /* Now follows a string containing the 00329 * elevation. */ 00330 (fp->line_number)++; 00331 fscanf (fp->fp, "%lf\n", &face->elevation); 00332 } 00333 else if (strcmp (temp_string, "39") == 0) 00334 { 00335 /* Now follows a string containing the 00336 * thickness. */ 00337 (fp->line_number)++; 00338 fscanf (fp->fp, "%lf\n", &face->thickness); 00339 } 00340 else if (strcmp (temp_string, "48") == 0) 00341 { 00342 /* Now follows a string containing the linetype 00343 * scale. */ 00344 (fp->line_number)++; 00345 fscanf (fp->fp, "%lf\n", &face->linetype_scale); 00346 } 00347 else if (strcmp (temp_string, "60") == 0) 00348 { 00349 /* Now follows a string containing the 00350 * visibility value. */ 00351 (fp->line_number)++; 00352 fscanf (fp->fp, "%hd\n", &face->visibility); 00353 } 00354 else if (strcmp (temp_string, "62") == 0) 00355 { 00356 /* Now follows a string containing the 00357 * color value. */ 00358 (fp->line_number)++; 00359 fscanf (fp->fp, "%d\n", &face->color); 00360 } 00361 else if (strcmp (temp_string, "67") == 0) 00362 { 00363 /* Now follows a string containing the 00364 * paperspace value. */ 00365 (fp->line_number)++; 00366 fscanf (fp->fp, "%d\n", &face->paperspace); 00367 } 00368 else if (strcmp (temp_string, "70") == 0) 00369 { 00370 /* Now follows a string containing the 00371 * value of edge visibility flag. */ 00372 (fp->line_number)++; 00373 fscanf (fp->fp, "%d\n", &face->flag); 00374 } 00375 else if (strcmp (temp_string, "92") == 0) 00376 { 00377 /* Now follows a string containing the 00378 * graphics data size value. */ 00379 (fp->line_number)++; 00380 fscanf (fp->fp, "%d\n", &face->graphics_data_size); 00381 } 00382 else if (strcmp (temp_string, "100") == 0) 00383 { 00384 /* Now follows a string containing the 00385 * subclass marker value. */ 00386 (fp->line_number)++; 00387 fscanf (fp->fp, "%s\n", temp_string); 00388 if ((strcmp (temp_string, "AcDbEntity") != 0) 00389 && (strcmp (temp_string, "AcDbFace") != 0)) 00390 { 00391 fprintf (stderr, 00392 (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")), 00393 __FUNCTION__, fp->filename, fp->line_number); 00394 } 00395 } 00396 else if (strcmp (temp_string, "160") == 0) 00397 { 00398 /* Now follows a string containing the 00399 * graphics data size value. */ 00400 (fp->line_number)++; 00401 fscanf (fp->fp, "%d\n", &face->graphics_data_size); 00402 } 00403 else if (strcmp (temp_string, "284") == 0) 00404 { 00405 /* Now follows a string containing the shadow 00406 * mode value. */ 00407 (fp->line_number)++; 00408 fscanf (fp->fp, "%hd\n", &face->shadow_mode); 00409 } 00410 else if (strcmp (temp_string, "310") == 0) 00411 { 00412 /* Now follows a string containing binary 00413 * graphics data. */ 00414 (fp->line_number)++; 00415 fscanf (fp->fp, "%s\n", face->binary_graphics_data->data_line); 00416 dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) face->binary_graphics_data->next); 00417 face->binary_graphics_data = (DxfBinaryGraphicsData *) face->binary_graphics_data->next; 00418 } 00419 else if (strcmp (temp_string, "330") == 0) 00420 { 00421 /* Now follows a string containing Soft-pointer 00422 * ID/handle to owner dictionary. */ 00423 (fp->line_number)++; 00424 fscanf (fp->fp, "%s\n", face->dictionary_owner_soft); 00425 } 00426 else if (strcmp (temp_string, "347") == 0) 00427 { 00428 /* Now follows a string containing a 00429 * hard-pointer ID/handle to material object. */ 00430 (fp->line_number)++; 00431 fscanf (fp->fp, "%s\n", face->material); 00432 } 00433 else if (strcmp (temp_string, "360") == 0) 00434 { 00435 /* Now follows a string containing Hard owner 00436 * ID/handle to owner dictionary. */ 00437 (fp->line_number)++; 00438 fscanf (fp->fp, "%s\n", face->dictionary_owner_hard); 00439 } 00440 else if (strcmp (temp_string, "370") == 0) 00441 { 00442 /* Now follows a string containing the lineweight 00443 * value. */ 00444 (fp->line_number)++; 00445 fscanf (fp->fp, "%hd\n", &face->lineweight); 00446 } 00447 else if (strcmp (temp_string, "390") == 0) 00448 { 00449 /* Now follows a string containing a plot style 00450 * name value. */ 00451 (fp->line_number)++; 00452 fscanf (fp->fp, "%s\n", face->plot_style_name); 00453 } 00454 else if (strcmp (temp_string, "420") == 0) 00455 { 00456 /* Now follows a string containing a color value. */ 00457 (fp->line_number)++; 00458 fscanf (fp->fp, "%ld\n", &face->color_value); 00459 } 00460 else if (strcmp (temp_string, "430") == 0) 00461 { 00462 /* Now follows a string containing a color 00463 * name value. */ 00464 (fp->line_number)++; 00465 fscanf (fp->fp, "%s\n", face->color_name); 00466 } 00467 else if (strcmp (temp_string, "440") == 0) 00468 { 00469 /* Now follows a string containing a transparency 00470 * value. */ 00471 (fp->line_number)++; 00472 fscanf (fp->fp, "%ld\n", &face->transparency); 00473 } 00474 else if (strcmp (temp_string, "999") == 0) 00475 { 00476 /* Now follows a string containing a comment. */ 00477 (fp->line_number)++; 00478 fscanf (fp->fp, "%s\n", temp_string); 00479 fprintf (stdout, (_("DXF comment: %s\n")), temp_string); 00480 } 00481 else 00482 { 00483 fprintf (stderr, 00484 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00485 __FUNCTION__, fp->filename, fp->line_number); 00486 } 00487 } 00488 /* Handle omitted members and/or illegal values. */ 00489 if (strcmp (face->linetype, "") == 0) 00490 { 00491 face->linetype = strdup (DXF_DEFAULT_LINETYPE); 00492 } 00493 if (strcmp (face->layer, "") == 0) 00494 { 00495 face->layer = strdup (DXF_DEFAULT_LAYER); 00496 } 00497 /* Clean up. */ 00498 free (temp_string); 00499 #if DEBUG 00500 DXF_DEBUG_END 00501 #endif 00502 return (face); 00503 } 00504 00505 00512 int 00513 dxf_3dface_write 00514 ( 00515 DxfFile *fp, 00517 Dxf3dface *face 00519 ) 00520 { 00521 #ifdef DEBUG 00522 DXF_DEBUG_BEGIN 00523 #endif 00524 char *dxf_entity_name = strdup ("3DFACE"); 00525 00526 /* Do some basic checks. */ 00527 if (fp == NULL) 00528 { 00529 fprintf (stderr, 00530 (_("Error in %s () a NULL file pointer was passed.\n")), 00531 __FUNCTION__); 00532 /* Clean up. */ 00533 free (dxf_entity_name); 00534 return (EXIT_FAILURE); 00535 } 00536 if (face == NULL) 00537 { 00538 fprintf (stderr, 00539 (_("Error in %s () a NULL pointer was passed.\n")), 00540 __FUNCTION__); 00541 /* Clean up. */ 00542 free (dxf_entity_name); 00543 return (EXIT_FAILURE); 00544 } 00545 if ((strcmp (dxf_3dface_get_layer (face), "") == 0) 00546 || (dxf_3dface_get_layer (face) == NULL)) 00547 { 00548 fprintf (stderr, 00549 (_("Warning in %s () invalid layer string for the %s entity with id-code: %x\n")), 00550 __FUNCTION__, dxf_entity_name, dxf_3dface_get_id_code (face)); 00551 fprintf (stderr, 00552 (_("\t%s entity is relocated to layer 0")), 00553 dxf_entity_name); 00554 dxf_3dface_set_layer (face, strdup (DXF_DEFAULT_LAYER)); 00555 } 00556 if (dxf_3dface_get_linetype (face) == NULL) 00557 { 00558 fprintf (stderr, 00559 (_("Warning in %s () invalid linetype string for the %s entity with id-code: %x\n")), 00560 __FUNCTION__, dxf_entity_name, dxf_3dface_get_id_code (face)); 00561 fprintf (stderr, 00562 (_("\t%s linetype is set to %s\n")), 00563 dxf_entity_name, DXF_DEFAULT_LINETYPE); 00564 dxf_3dface_set_linetype (face, strdup (DXF_DEFAULT_LINETYPE)); 00565 } 00566 /* Start writing output. */ 00567 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00568 if (dxf_3dface_get_id_code (face) != -1) 00569 { 00570 fprintf (fp->fp, " 5\n%x\n", dxf_3dface_get_id_code (face)); 00571 } 00582 if ((strcmp (dxf_3dface_get_dictionary_owner_soft (face), "") != 0) 00583 && (fp->acad_version_number >= AutoCAD_14)) 00584 { 00585 fprintf (fp->fp, "102\n{ACAD_REACTORS\n"); 00586 fprintf (fp->fp, "330\n%s\n", dxf_3dface_get_dictionary_owner_soft (face)); 00587 fprintf (fp->fp, "102\n}\n"); 00588 } 00589 if ((strcmp (dxf_3dface_get_dictionary_owner_hard (face), "") != 0) 00590 && (fp->acad_version_number >= AutoCAD_14)) 00591 { 00592 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n"); 00593 fprintf (fp->fp, "360\n%s\n", dxf_3dface_get_dictionary_owner_hard (face)); 00594 fprintf (fp->fp, "102\n}\n"); 00595 } 00596 if (fp->acad_version_number >= AutoCAD_13) 00597 { 00598 fprintf (fp->fp, "100\nAcDbEntity\n"); 00599 } 00600 if (dxf_3dface_get_paperspace (face) == DXF_PAPERSPACE) 00601 { 00602 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE); 00603 } 00604 fprintf (fp->fp, " 8\n%s\n", dxf_3dface_get_layer (face)); 00605 if (strcmp (dxf_3dface_get_linetype (face), DXF_DEFAULT_LINETYPE) != 0) 00606 { 00607 fprintf (fp->fp, " 6\n%s\n", dxf_3dface_get_linetype (face)); 00608 } 00609 if ((fp->acad_version_number >= AutoCAD_2008) 00610 && (strcmp (dxf_3dface_get_material (face), "") != 0)) 00611 { 00612 fprintf (fp->fp, "347\n%s\n", dxf_3dface_get_material (face)); 00613 } 00614 if (dxf_3dface_get_color (face) != DXF_COLOR_BYLAYER) 00615 { 00616 fprintf (fp->fp, " 62\n%d\n", dxf_3dface_get_color (face)); 00617 } 00618 if (fp->acad_version_number >= AutoCAD_2002) 00619 { 00620 fprintf (fp->fp, "370\n%d\n", dxf_3dface_get_lineweight (face)); 00621 } 00622 if ((fp->acad_version_number <= AutoCAD_11) 00623 && DXF_FLATLAND 00624 && (dxf_3dface_get_elevation (face) != 0.0)) 00625 { 00626 fprintf (fp->fp, " 38\n%f\n", dxf_3dface_get_elevation (face)); 00627 } 00628 if ((fp->acad_version_number <= AutoCAD_13) 00629 && (dxf_3dface_get_thickness (face) != 0.0)) 00630 { 00631 fprintf (fp->fp, " 39\n%f\n", dxf_3dface_get_thickness (face)); 00632 } 00633 if (dxf_3dface_get_linetype_scale (face) != 1.0) 00634 { 00635 fprintf (fp->fp, " 48\n%f\n", dxf_3dface_get_linetype_scale (face)); 00636 } 00637 if (dxf_3dface_get_visibility (face) != 0) 00638 { 00639 fprintf (fp->fp, " 60\n%d\n", dxf_3dface_get_visibility (face)); 00640 } 00641 if ((fp->acad_version_number >= AutoCAD_2000) 00642 && (dxf_3dface_get_graphics_data_size (face) > 0)) 00643 { 00644 #ifdef BUILD_64 00645 fprintf (fp->fp, "160\n%d\n", dxf_3dface_get_graphics_data_size (face)); 00646 #else 00647 fprintf (fp->fp, " 92\n%d\n", dxf_3dface_get_graphics_data_size (face)); 00648 #endif 00649 if (dxf_3dface_get_binary_graphics_data (face) != NULL) 00650 { 00651 DxfBinaryGraphicsData *iter; 00652 iter = dxf_3dface_get_binary_graphics_data (face); 00653 while (iter != NULL) 00654 { 00655 fprintf (fp->fp, "310\n%s\n", dxf_binary_graphics_data_get_data_line (iter)); 00656 iter = (DxfBinaryGraphicsData *) dxf_binary_graphics_data_get_next (iter); 00657 } 00658 } 00659 } 00660 if (fp->acad_version_number >= AutoCAD_2004) 00661 { 00662 fprintf (fp->fp, "420\n%ld\n", dxf_3dface_get_color_value (face)); 00663 fprintf (fp->fp, "430\n%s\n", dxf_3dface_get_color_name (face)); 00664 fprintf (fp->fp, "440\n%ld\n", dxf_3dface_get_transparency (face)); 00665 } 00666 if (fp->acad_version_number >= AutoCAD_2009) 00667 { 00668 fprintf (fp->fp, "390\n%s\n", dxf_3dface_get_plot_style_name (face)); 00669 fprintf (fp->fp, "284\n%d\n", dxf_3dface_get_shadow_mode (face)); 00670 } 00671 if (fp->acad_version_number >= AutoCAD_13) 00672 { 00673 fprintf (fp->fp, "100\nAcDbFace\n"); 00674 } 00675 fprintf (fp->fp, " 10\n%f\n", dxf_3dface_get_x0 (face)); 00676 fprintf (fp->fp, " 20\n%f\n", dxf_3dface_get_y0 (face)); 00677 fprintf (fp->fp, " 30\n%f\n", dxf_3dface_get_z0 (face)); 00678 fprintf (fp->fp, " 11\n%f\n", dxf_3dface_get_x1 (face)); 00679 fprintf (fp->fp, " 21\n%f\n", dxf_3dface_get_y1 (face)); 00680 fprintf (fp->fp, " 31\n%f\n", dxf_3dface_get_z1 (face)); 00681 fprintf (fp->fp, " 12\n%f\n", dxf_3dface_get_x2 (face)); 00682 fprintf (fp->fp, " 22\n%f\n", dxf_3dface_get_y2 (face)); 00683 fprintf (fp->fp, " 32\n%f\n", dxf_3dface_get_z2 (face)); 00684 fprintf (fp->fp, " 13\n%f\n", dxf_3dface_get_x3 (face)); 00685 fprintf (fp->fp, " 23\n%f\n", dxf_3dface_get_y3 (face)); 00686 fprintf (fp->fp, " 33\n%f\n", dxf_3dface_get_z3 (face)); 00687 fprintf (fp->fp, " 70\n%d\n", dxf_3dface_get_flag (face)); 00688 /* Clean up. */ 00689 free (dxf_entity_name); 00690 #ifdef DEBUG 00691 DXF_DEBUG_END 00692 #endif 00693 return (EXIT_SUCCESS); 00694 } 00695 00696 00704 Dxf3dface * 00705 dxf_3dface_free 00706 ( 00707 Dxf3dface *face 00710 ) 00711 { 00712 #ifdef DEBUG 00713 DXF_DEBUG_BEGIN 00714 #endif 00715 if (face == NULL) 00716 { 00717 fprintf (stderr, 00718 (_("Error in %s () a NULL pointer was passed.\n")), 00719 __FUNCTION__); 00720 return (NULL); 00721 } 00722 if (face->next != NULL) 00723 { 00724 fprintf (stderr, 00725 (_("Error in %s () pointer to next was not NULL.\n")), 00726 __FUNCTION__); 00727 return (face); 00728 } 00729 free (dxf_3dface_get_linetype (face)); 00730 free (dxf_3dface_get_layer (face)); 00731 dxf_binary_graphics_data_free_chain (dxf_3dface_get_binary_graphics_data (face)); 00732 free (dxf_3dface_get_dictionary_owner_soft (face)); 00733 free (dxf_3dface_get_material (face)); 00734 free (dxf_3dface_get_dictionary_owner_hard (face)); 00735 free (dxf_3dface_get_plot_style_name (face)); 00736 free (dxf_3dface_get_color_name (face)); 00737 dxf_point_free (dxf_3dface_get_p0 (face)); 00738 dxf_point_free (dxf_3dface_get_p1 (face)); 00739 dxf_point_free (dxf_3dface_get_p2 (face)); 00740 dxf_point_free (dxf_3dface_get_p3 (face)); 00741 free (face); 00742 face = NULL; 00743 #ifdef DEBUG 00744 DXF_DEBUG_END 00745 #endif 00746 return (face); 00747 } 00748 00749 00754 void 00755 dxf_3dface_free_chain 00756 ( 00757 Dxf3dface *faces 00759 ) 00760 { 00761 #ifdef DEBUG 00762 DXF_DEBUG_BEGIN 00763 #endif 00764 if (faces == NULL) 00765 { 00766 fprintf (stderr, 00767 (_("Warning in %s () a NULL pointer was passed.\n")), 00768 __FUNCTION__); 00769 } 00770 while (faces != NULL) 00771 { 00772 struct Dxf3dface *iter = faces->next; 00773 dxf_3dface_free (faces); 00774 faces = (Dxf3dface *) iter; 00775 } 00776 #if DEBUG 00777 DXF_DEBUG_END 00778 #endif 00779 } 00780 00781 00787 int 00788 dxf_3dface_get_id_code 00789 ( 00790 Dxf3dface *face 00792 ) 00793 { 00794 #if DEBUG 00795 DXF_DEBUG_BEGIN 00796 #endif 00797 /* Do some basic checks. */ 00798 if (face == NULL) 00799 { 00800 fprintf (stderr, 00801 (_("Error in %s () a NULL pointer was passed.\n")), 00802 __FUNCTION__); 00803 return (EXIT_FAILURE); 00804 } 00805 if (face->id_code < 0) 00806 { 00807 fprintf (stderr, 00808 (_("Warning in %s () a negative value was found.\n")), 00809 __FUNCTION__); 00810 } 00811 #if DEBUG 00812 DXF_DEBUG_END 00813 #endif 00814 return (face->id_code); 00815 } 00816 00817 00824 Dxf3dface * 00825 dxf_3dface_set_id_code 00826 ( 00827 Dxf3dface *face, 00829 int id_code 00833 ) 00834 { 00835 #if DEBUG 00836 DXF_DEBUG_BEGIN 00837 #endif 00838 /* Do some basic checks. */ 00839 if (face == NULL) 00840 { 00841 fprintf (stderr, 00842 (_("Error in %s () a NULL pointer was passed.\n")), 00843 __FUNCTION__); 00844 return (NULL); 00845 } 00846 if (id_code < 0) 00847 { 00848 fprintf (stderr, 00849 (_("Warning in %s () a negative value was passed.\n")), 00850 __FUNCTION__); 00851 } 00852 face->id_code = id_code; 00853 #if DEBUG 00854 DXF_DEBUG_END 00855 #endif 00856 return (face); 00857 } 00858 00859 00866 char * 00867 dxf_3dface_get_linetype 00868 ( 00869 Dxf3dface *face 00871 ) 00872 { 00873 #if DEBUG 00874 DXF_DEBUG_BEGIN 00875 #endif 00876 /* Do some basic checks. */ 00877 if (face == NULL) 00878 { 00879 fprintf (stderr, 00880 (_("Error in %s () a NULL pointer was passed.\n")), 00881 __FUNCTION__); 00882 return (NULL); 00883 } 00884 if (face->linetype == NULL) 00885 { 00886 fprintf (stderr, 00887 (_("Error in %s () a NULL pointer was found.\n")), 00888 __FUNCTION__); 00889 return (NULL); 00890 } 00891 #if DEBUG 00892 DXF_DEBUG_END 00893 #endif 00894 return (strdup (face->linetype)); 00895 } 00896 00897 00907 Dxf3dface * 00908 dxf_3dface_set_linetype 00909 ( 00910 Dxf3dface *face, 00912 char *linetype 00914 ) 00915 { 00916 #if DEBUG 00917 DXF_DEBUG_BEGIN 00918 #endif 00919 /* Do some basic checks. */ 00920 if (face == NULL) 00921 { 00922 fprintf (stderr, 00923 (_("Error in %s () a NULL pointer was passed.\n")), 00924 __FUNCTION__); 00925 return (NULL); 00926 } 00927 if (linetype == NULL) 00928 { 00929 fprintf (stderr, 00930 (_("Error in %s () a NULL pointer was passed.\n")), 00931 __FUNCTION__); 00932 return (NULL); 00933 } 00934 face->linetype = strdup (linetype); 00935 #if DEBUG 00936 DXF_DEBUG_END 00937 #endif 00938 return (face); 00939 } 00940 00941 00948 char * 00949 dxf_3dface_get_layer 00950 ( 00951 Dxf3dface *face 00953 ) 00954 { 00955 #if DEBUG 00956 DXF_DEBUG_BEGIN 00957 #endif 00958 /* Do some basic checks. */ 00959 if (face == NULL) 00960 { 00961 fprintf (stderr, 00962 (_("Error in %s () a NULL pointer was passed.\n")), 00963 __FUNCTION__); 00964 return (NULL); 00965 } 00966 if (face->layer == NULL) 00967 { 00968 fprintf (stderr, 00969 (_("Error in %s () a NULL pointer was found.\n")), 00970 __FUNCTION__); 00971 return (NULL); 00972 } 00973 #if DEBUG 00974 DXF_DEBUG_END 00975 #endif 00976 return (strdup (face->layer)); 00977 } 00978 00979 00988 Dxf3dface * 00989 dxf_3dface_set_layer 00990 ( 00991 Dxf3dface *face, 00993 char *layer 00995 ) 00996 { 00997 #if DEBUG 00998 DXF_DEBUG_BEGIN 00999 #endif 01000 /* Do some basic checks. */ 01001 if (face == NULL) 01002 { 01003 fprintf (stderr, 01004 (_("Error in %s () a NULL pointer was passed.\n")), 01005 __FUNCTION__); 01006 return (NULL); 01007 } 01008 if (layer == NULL) 01009 { 01010 fprintf (stderr, 01011 (_("Error in %s () a NULL pointer was passed.\n")), 01012 __FUNCTION__); 01013 return (NULL); 01014 } 01015 face->layer = strdup (layer); 01016 #if DEBUG 01017 DXF_DEBUG_END 01018 #endif 01019 return (face); 01020 } 01021 01022 01028 double 01029 dxf_3dface_get_elevation 01030 ( 01031 Dxf3dface *face 01033 ) 01034 { 01035 #if DEBUG 01036 DXF_DEBUG_BEGIN 01037 #endif 01038 /* Do some basic checks. */ 01039 if (face == NULL) 01040 { 01041 fprintf (stderr, 01042 (_("Error in %s () a NULL pointer was passed.\n")), 01043 __FUNCTION__); 01044 return (EXIT_FAILURE); 01045 } 01046 #if DEBUG 01047 DXF_DEBUG_END 01048 #endif 01049 return (face->elevation); 01050 } 01051 01052 01059 Dxf3dface * 01060 dxf_3dface_set_elevation 01061 ( 01062 Dxf3dface *face, 01064 double elevation 01066 ) 01067 { 01068 #if DEBUG 01069 DXF_DEBUG_BEGIN 01070 #endif 01071 /* Do some basic checks. */ 01072 if (face == NULL) 01073 { 01074 fprintf (stderr, 01075 (_("Error in %s () a NULL pointer was passed.\n")), 01076 __FUNCTION__); 01077 return (NULL); 01078 } 01079 face->elevation = elevation; 01080 #if DEBUG 01081 DXF_DEBUG_END 01082 #endif 01083 return (face); 01084 } 01085 01086 01092 double 01093 dxf_3dface_get_thickness 01094 ( 01095 Dxf3dface *face 01097 ) 01098 { 01099 #if DEBUG 01100 DXF_DEBUG_BEGIN 01101 #endif 01102 /* Do some basic checks. */ 01103 if (face == NULL) 01104 { 01105 fprintf (stderr, 01106 (_("Error in %s () a NULL pointer was passed.\n")), 01107 __FUNCTION__); 01108 return (EXIT_FAILURE); 01109 } 01110 if (face->thickness < 0.0) 01111 { 01112 fprintf (stderr, 01113 (_("Warning in %s () a negative value was found.\n")), 01114 __FUNCTION__); 01115 } 01116 #if DEBUG 01117 DXF_DEBUG_END 01118 #endif 01119 return (face->thickness); 01120 } 01121 01122 01129 Dxf3dface * 01130 dxf_3dface_set_thickness 01131 ( 01132 Dxf3dface *face, 01134 double thickness 01136 ) 01137 { 01138 #if DEBUG 01139 DXF_DEBUG_BEGIN 01140 #endif 01141 /* Do some basic checks. */ 01142 if (face == NULL) 01143 { 01144 fprintf (stderr, 01145 (_("Error in %s () a NULL pointer was passed.\n")), 01146 __FUNCTION__); 01147 return (NULL); 01148 } 01149 if (thickness < 0.0) 01150 { 01151 fprintf (stderr, 01152 (_("Warning in %s () a negative value was passed.\n")), 01153 __FUNCTION__); 01154 } 01155 face->thickness = thickness; 01156 #if DEBUG 01157 DXF_DEBUG_END 01158 #endif 01159 return (face); 01160 } 01161 01162 01168 double 01169 dxf_3dface_get_linetype_scale 01170 ( 01171 Dxf3dface *face 01173 ) 01174 { 01175 #if DEBUG 01176 DXF_DEBUG_BEGIN 01177 #endif 01178 /* Do some basic checks. */ 01179 if (face == NULL) 01180 { 01181 fprintf (stderr, 01182 (_("Error in %s () a NULL pointer was passed.\n")), 01183 __FUNCTION__); 01184 return (EXIT_FAILURE); 01185 } 01186 if (face->linetype_scale < 0.0) 01187 { 01188 fprintf (stderr, 01189 (_("Warning in %s () a negative value was found.\n")), 01190 __FUNCTION__); 01191 } 01192 #if DEBUG 01193 DXF_DEBUG_END 01194 #endif 01195 return (face->linetype_scale); 01196 } 01197 01198 01205 Dxf3dface * 01206 dxf_3dface_set_linetype_scale 01207 ( 01208 Dxf3dface *face, 01210 double linetype_scale 01212 ) 01213 { 01214 #if DEBUG 01215 DXF_DEBUG_BEGIN 01216 #endif 01217 /* Do some basic checks. */ 01218 if (face == NULL) 01219 { 01220 fprintf (stderr, 01221 (_("Error in %s () a NULL pointer was passed.\n")), 01222 __FUNCTION__); 01223 return (NULL); 01224 } 01225 if (linetype_scale < 0.0) 01226 { 01227 fprintf (stderr, 01228 (_("Warning in %s () a negative value was passed.\n")), 01229 __FUNCTION__); 01230 } 01231 face->linetype_scale = linetype_scale; 01232 #if DEBUG 01233 DXF_DEBUG_END 01234 #endif 01235 return (face); 01236 } 01237 01238 01244 int16_t 01245 dxf_3dface_get_visibility 01246 ( 01247 Dxf3dface *face 01249 ) 01250 { 01251 #if DEBUG 01252 DXF_DEBUG_BEGIN 01253 #endif 01254 /* Do some basic checks. */ 01255 if (face == NULL) 01256 { 01257 fprintf (stderr, 01258 (_("Error in %s () a NULL pointer was passed.\n")), 01259 __FUNCTION__); 01260 return (EXIT_FAILURE); 01261 } 01262 if (face->visibility < 0) 01263 { 01264 fprintf (stderr, 01265 (_("Error in %s () a negative value was found.\n")), 01266 __FUNCTION__); 01267 return (EXIT_FAILURE); 01268 } 01269 if (face->visibility > 1) 01270 { 01271 fprintf (stderr, 01272 (_("Error in %s () an out of range value was found.\n")), 01273 __FUNCTION__); 01274 return (EXIT_FAILURE); 01275 } 01276 #if DEBUG 01277 DXF_DEBUG_END 01278 #endif 01279 return (face->visibility); 01280 } 01281 01282 01289 Dxf3dface * 01290 dxf_3dface_set_visibility 01291 ( 01292 Dxf3dface *face, 01294 int16_t visibility 01296 ) 01297 { 01298 #if DEBUG 01299 DXF_DEBUG_BEGIN 01300 #endif 01301 /* Do some basic checks. */ 01302 if (face == NULL) 01303 { 01304 fprintf (stderr, 01305 (_("Error in %s () a NULL pointer was passed.\n")), 01306 __FUNCTION__); 01307 return (NULL); 01308 } 01309 if (visibility < 0) 01310 { 01311 fprintf (stderr, 01312 (_("Error in %s () a negative value was passed.\n")), 01313 __FUNCTION__); 01314 return (NULL); 01315 } 01316 if (visibility > 1) 01317 { 01318 fprintf (stderr, 01319 (_("Error in %s () an out of range value was passed.\n")), 01320 __FUNCTION__); 01321 return (NULL); 01322 } 01323 face->visibility = visibility; 01324 #if DEBUG 01325 DXF_DEBUG_END 01326 #endif 01327 return (face); 01328 } 01329 01330 01336 int 01337 dxf_3dface_get_color 01338 ( 01339 Dxf3dface *face 01341 ) 01342 { 01343 #if DEBUG 01344 DXF_DEBUG_BEGIN 01345 #endif 01346 /* Do some basic checks. */ 01347 if (face == NULL) 01348 { 01349 fprintf (stderr, 01350 (_("Error in %s () a NULL pointer was passed.\n")), 01351 __FUNCTION__); 01352 return (EXIT_FAILURE); 01353 } 01354 if (face->color < 0) 01355 { 01356 fprintf (stderr, 01357 (_("Warning in %s () a negative value was found.\n")), 01358 __FUNCTION__); 01359 } 01360 #if DEBUG 01361 DXF_DEBUG_END 01362 #endif 01363 return (face->color); 01364 } 01365 01366 01373 Dxf3dface * 01374 dxf_3dface_set_color 01375 ( 01376 Dxf3dface *face, 01378 int color 01380 ) 01381 { 01382 #if DEBUG 01383 DXF_DEBUG_BEGIN 01384 #endif 01385 /* Do some basic checks. */ 01386 if (face == NULL) 01387 { 01388 fprintf (stderr, 01389 (_("Error in %s () a NULL pointer was passed.\n")), 01390 __FUNCTION__); 01391 return (NULL); 01392 } 01393 if (color < 0) 01394 { 01395 fprintf (stderr, 01396 (_("Warning in %s () a negative value was passed.\n")), 01397 __FUNCTION__); 01398 } 01399 face->color = color; 01400 #if DEBUG 01401 DXF_DEBUG_END 01402 #endif 01403 return (face); 01404 } 01405 01406 01412 int 01413 dxf_3dface_get_paperspace 01414 ( 01415 Dxf3dface *face 01417 ) 01418 { 01419 #if DEBUG 01420 DXF_DEBUG_BEGIN 01421 #endif 01422 /* Do some basic checks. */ 01423 if (face == NULL) 01424 { 01425 fprintf (stderr, 01426 (_("Error in %s () a NULL pointer was passed.\n")), 01427 __FUNCTION__); 01428 return (EXIT_FAILURE); 01429 } 01430 if (face->paperspace < 0) 01431 { 01432 fprintf (stderr, 01433 (_("Warning in %s () a negative value was found.\n")), 01434 __FUNCTION__); 01435 } 01436 if (face->paperspace > 1) 01437 { 01438 fprintf (stderr, 01439 (_("Warning in %s () an out of range value was found.\n")), 01440 __FUNCTION__); 01441 } 01442 #if DEBUG 01443 DXF_DEBUG_END 01444 #endif 01445 return (face->paperspace); 01446 } 01447 01448 01455 Dxf3dface * 01456 dxf_3dface_set_paperspace 01457 ( 01458 Dxf3dface *face, 01460 int paperspace 01462 ) 01463 { 01464 #if DEBUG 01465 DXF_DEBUG_BEGIN 01466 #endif 01467 /* Do some basic checks. */ 01468 if (face == NULL) 01469 { 01470 fprintf (stderr, 01471 (_("Error in %s () a NULL pointer was passed.\n")), 01472 __FUNCTION__); 01473 return (NULL); 01474 } 01475 if (paperspace < 0) 01476 { 01477 fprintf (stderr, 01478 (_("Error in %s () a negative value was passed.\n")), 01479 __FUNCTION__); 01480 return (NULL); 01481 } 01482 if (paperspace > 1) 01483 { 01484 fprintf (stderr, 01485 (_("Error in %s () an out of range value was passed.\n")), 01486 __FUNCTION__); 01487 return (NULL); 01488 } 01489 face->paperspace = paperspace; 01490 #if DEBUG 01491 DXF_DEBUG_END 01492 #endif 01493 return (face); 01494 } 01495 01496 01504 int 01505 dxf_3dface_get_graphics_data_size 01506 ( 01507 Dxf3dface *face 01509 ) 01510 { 01511 #if DEBUG 01512 DXF_DEBUG_BEGIN 01513 #endif 01514 /* Do some basic checks. */ 01515 if (face == NULL) 01516 { 01517 fprintf (stderr, 01518 (_("Error in %s () a NULL pointer was passed.\n")), 01519 __FUNCTION__); 01520 return (EXIT_FAILURE); 01521 } 01522 if (face->graphics_data_size < 0) 01523 { 01524 fprintf (stderr, 01525 (_("Warning in %s () a negative value was found.\n")), 01526 __FUNCTION__); 01527 } 01528 if (face->graphics_data_size == 0) 01529 { 01530 fprintf (stderr, 01531 (_("Warning in %s () a zero value was found.\n")), 01532 __FUNCTION__); 01533 } 01534 #if DEBUG 01535 DXF_DEBUG_END 01536 #endif 01537 return (face->graphics_data_size); 01538 } 01539 01540 01547 Dxf3dface * 01548 dxf_3dface_set_graphics_data_size 01549 ( 01550 Dxf3dface *face, 01552 int graphics_data_size 01555 ) 01556 { 01557 #if DEBUG 01558 DXF_DEBUG_BEGIN 01559 #endif 01560 /* Do some basic checks. */ 01561 if (face == NULL) 01562 { 01563 fprintf (stderr, 01564 (_("Error in %s () a NULL pointer was passed.\n")), 01565 __FUNCTION__); 01566 return (NULL); 01567 } 01568 if (graphics_data_size < 0) 01569 { 01570 fprintf (stderr, 01571 (_("Error in %s () a negative value was passed.\n")), 01572 __FUNCTION__); 01573 return (NULL); 01574 } 01575 if (graphics_data_size == 0) 01576 { 01577 fprintf (stderr, 01578 (_("Warning in %s () a zero value was passed.\n")), 01579 __FUNCTION__); 01580 } 01581 face->graphics_data_size = graphics_data_size; 01582 #if DEBUG 01583 DXF_DEBUG_END 01584 #endif 01585 return (face); 01586 } 01587 01588 01595 int16_t 01596 dxf_3dface_get_shadow_mode 01597 ( 01598 Dxf3dface *face 01600 ) 01601 { 01602 #if DEBUG 01603 DXF_DEBUG_BEGIN 01604 #endif 01605 /* Do some basic checks. */ 01606 if (face == NULL) 01607 { 01608 fprintf (stderr, 01609 (_("Error in %s () a NULL pointer was passed.\n")), 01610 __FUNCTION__); 01611 return (EXIT_FAILURE); 01612 } 01613 if (face->shadow_mode < 0) 01614 { 01615 fprintf (stderr, 01616 (_("Error in %s () a negative value was found.\n")), 01617 __FUNCTION__); 01618 return (EXIT_FAILURE); 01619 } 01620 if (face->shadow_mode > 3) 01621 { 01622 fprintf (stderr, 01623 (_("Error in %s () an out of range value was found.\n")), 01624 __FUNCTION__); 01625 return (EXIT_FAILURE); 01626 } 01627 #if DEBUG 01628 DXF_DEBUG_END 01629 #endif 01630 return (face->shadow_mode); 01631 } 01632 01633 01640 Dxf3dface * 01641 dxf_3dface_set_shadow_mode 01642 ( 01643 Dxf3dface *face, 01645 int16_t shadow_mode 01647 ) 01648 { 01649 #if DEBUG 01650 DXF_DEBUG_BEGIN 01651 #endif 01652 /* Do some basic checks. */ 01653 if (face == NULL) 01654 { 01655 fprintf (stderr, 01656 (_("Error in %s () a NULL pointer was passed.\n")), 01657 __FUNCTION__); 01658 return (NULL); 01659 } 01660 if (shadow_mode < 0) 01661 { 01662 fprintf (stderr, 01663 (_("Error in %s () a negative value was passed.\n")), 01664 __FUNCTION__); 01665 return (NULL); 01666 } 01667 if (shadow_mode > 3) 01668 { 01669 fprintf (stderr, 01670 (_("Error in %s () an out of range value was passed.\n")), 01671 __FUNCTION__); 01672 return (NULL); 01673 } 01674 face->shadow_mode = shadow_mode; 01675 #if DEBUG 01676 DXF_DEBUG_END 01677 #endif 01678 return (face); 01679 } 01680 01681 01690 DxfBinaryGraphicsData * 01691 dxf_3dface_get_binary_graphics_data 01692 ( 01693 Dxf3dface *face 01695 ) 01696 { 01697 #if DEBUG 01698 DXF_DEBUG_BEGIN 01699 #endif 01700 /* Do some basic checks. */ 01701 if (face == NULL) 01702 { 01703 fprintf (stderr, 01704 (_("Error in %s () a NULL pointer was passed.\n")), 01705 __FUNCTION__); 01706 return (NULL); 01707 } 01708 if (face->binary_graphics_data == NULL) 01709 { 01710 fprintf (stderr, 01711 (_("Error in %s () a NULL pointer was found.\n")), 01712 __FUNCTION__); 01713 return (NULL); 01714 } 01715 #if DEBUG 01716 DXF_DEBUG_END 01717 #endif 01718 return ((DxfBinaryGraphicsData *) face->binary_graphics_data); 01719 } 01720 01721 01726 Dxf3dface * 01727 dxf_3dface_set_binary_graphics_data 01728 ( 01729 Dxf3dface *face, 01731 DxfBinaryGraphicsData *data 01734 ) 01735 { 01736 #if DEBUG 01737 DXF_DEBUG_BEGIN 01738 #endif 01739 /* Do some basic checks. */ 01740 if (face == NULL) 01741 { 01742 fprintf (stderr, 01743 (_("Error in %s () a NULL pointer was passed.\n")), 01744 __FUNCTION__); 01745 return (NULL); 01746 } 01747 if (data == NULL) 01748 { 01749 fprintf (stderr, 01750 (_("Error in %s () a NULL pointer was passed.\n")), 01751 __FUNCTION__); 01752 return (NULL); 01753 } 01754 face->binary_graphics_data = (DxfBinaryGraphicsData *) data; 01755 #if DEBUG 01756 DXF_DEBUG_END 01757 #endif 01758 return (face); 01759 } 01760 01761 01770 char * 01771 dxf_3dface_get_dictionary_owner_soft 01772 ( 01773 Dxf3dface *face 01775 ) 01776 { 01777 #if DEBUG 01778 DXF_DEBUG_BEGIN 01779 #endif 01780 /* Do some basic checks. */ 01781 if (face == NULL) 01782 { 01783 fprintf (stderr, 01784 (_("Error in %s () a NULL pointer was passed.\n")), 01785 __FUNCTION__); 01786 return (NULL); 01787 } 01788 if (face->dictionary_owner_soft == NULL) 01789 { 01790 fprintf (stderr, 01791 (_("Error in %s () a NULL pointer was found.\n")), 01792 __FUNCTION__); 01793 return (NULL); 01794 } 01795 #if DEBUG 01796 DXF_DEBUG_END 01797 #endif 01798 return (strdup (face->dictionary_owner_soft)); 01799 } 01800 01801 01806 Dxf3dface * 01807 dxf_3dface_set_dictionary_owner_soft 01808 ( 01809 Dxf3dface *face, 01811 char *dictionary_owner_soft 01814 ) 01815 { 01816 #if DEBUG 01817 DXF_DEBUG_BEGIN 01818 #endif 01819 /* Do some basic checks. */ 01820 if (face == NULL) 01821 { 01822 fprintf (stderr, 01823 (_("Error in %s () a NULL pointer was passed.\n")), 01824 __FUNCTION__); 01825 return (NULL); 01826 } 01827 if (dictionary_owner_soft == NULL) 01828 { 01829 fprintf (stderr, 01830 (_("Error in %s () a NULL pointer was passed.\n")), 01831 __FUNCTION__); 01832 return (NULL); 01833 } 01834 face->dictionary_owner_soft = strdup (dictionary_owner_soft); 01835 #if DEBUG 01836 DXF_DEBUG_END 01837 #endif 01838 return (face); 01839 } 01840 01841 01850 char * 01851 dxf_3dface_get_material 01852 ( 01853 Dxf3dface *face 01855 ) 01856 { 01857 #if DEBUG 01858 DXF_DEBUG_BEGIN 01859 #endif 01860 /* Do some basic checks. */ 01861 if (face == NULL) 01862 { 01863 fprintf (stderr, 01864 (_("Error in %s () a NULL pointer was passed.\n")), 01865 __FUNCTION__); 01866 return (NULL); 01867 } 01868 if (face->material == NULL) 01869 { 01870 fprintf (stderr, 01871 (_("Error in %s () a NULL pointer was found.\n")), 01872 __FUNCTION__); 01873 return (NULL); 01874 } 01875 #if DEBUG 01876 DXF_DEBUG_END 01877 #endif 01878 return (strdup (face->material)); 01879 } 01880 01881 01888 Dxf3dface * 01889 dxf_3dface_set_material 01890 ( 01891 Dxf3dface *face, 01893 char *material 01896 ) 01897 { 01898 #if DEBUG 01899 DXF_DEBUG_BEGIN 01900 #endif 01901 /* Do some basic checks. */ 01902 if (face == NULL) 01903 { 01904 fprintf (stderr, 01905 (_("Error in %s () a NULL pointer was passed.\n")), 01906 __FUNCTION__); 01907 return (NULL); 01908 } 01909 if (material == NULL) 01910 { 01911 fprintf (stderr, 01912 (_("Error in %s () a NULL pointer was passed.\n")), 01913 __FUNCTION__); 01914 return (NULL); 01915 } 01916 face->material = strdup (material); 01917 #if DEBUG 01918 DXF_DEBUG_END 01919 #endif 01920 return (face); 01921 } 01922 01923 01932 char * 01933 dxf_3dface_get_dictionary_owner_hard 01934 ( 01935 Dxf3dface *face 01937 ) 01938 { 01939 #if DEBUG 01940 DXF_DEBUG_BEGIN 01941 #endif 01942 /* Do some basic checks. */ 01943 if (face == NULL) 01944 { 01945 fprintf (stderr, 01946 (_("Error in %s () a NULL pointer was passed.\n")), 01947 __FUNCTION__); 01948 return (NULL); 01949 } 01950 if (face->dictionary_owner_hard == NULL) 01951 { 01952 fprintf (stderr, 01953 (_("Error in %s () a NULL pointer was found.\n")), 01954 __FUNCTION__); 01955 return (NULL); 01956 } 01957 #if DEBUG 01958 DXF_DEBUG_END 01959 #endif 01960 return (strdup (face->dictionary_owner_hard)); 01961 } 01962 01963 01971 Dxf3dface * 01972 dxf_3dface_set_dictionary_owner_hard 01973 ( 01974 Dxf3dface *face, 01976 char *dictionary_owner_hard 01979 ) 01980 { 01981 #if DEBUG 01982 DXF_DEBUG_BEGIN 01983 #endif 01984 /* Do some basic checks. */ 01985 if (face == NULL) 01986 { 01987 fprintf (stderr, 01988 (_("Error in %s () a NULL pointer was passed.\n")), 01989 __FUNCTION__); 01990 return (NULL); 01991 } 01992 if (dictionary_owner_hard == NULL) 01993 { 01994 fprintf (stderr, 01995 (_("Error in %s () a NULL pointer was passed.\n")), 01996 __FUNCTION__); 01997 return (NULL); 01998 } 01999 face->dictionary_owner_hard = strdup (dictionary_owner_hard); 02000 #if DEBUG 02001 DXF_DEBUG_END 02002 #endif 02003 return (face); 02004 } 02005 02006 02013 int16_t 02014 dxf_3dface_get_lineweight 02015 ( 02016 Dxf3dface *face 02018 ) 02019 { 02020 #if DEBUG 02021 DXF_DEBUG_BEGIN 02022 #endif 02023 /* Do some basic checks. */ 02024 if (face == NULL) 02025 { 02026 fprintf (stderr, 02027 (_("Error in %s () a NULL pointer was passed.\n")), 02028 __FUNCTION__); 02029 return (EXIT_FAILURE); 02030 } 02031 #if DEBUG 02032 DXF_DEBUG_END 02033 #endif 02034 return (face->lineweight); 02035 } 02036 02037 02044 Dxf3dface * 02045 dxf_3dface_set_lineweight 02046 ( 02047 Dxf3dface *face, 02049 int16_t lineweight 02051 ) 02052 { 02053 #if DEBUG 02054 DXF_DEBUG_BEGIN 02055 #endif 02056 /* Do some basic checks. */ 02057 if (face == NULL) 02058 { 02059 fprintf (stderr, 02060 (_("Error in %s () a NULL pointer was passed.\n")), 02061 __FUNCTION__); 02062 return (NULL); 02063 } 02064 face->lineweight = lineweight; 02065 #if DEBUG 02066 DXF_DEBUG_END 02067 #endif 02068 return (face); 02069 } 02070 02071 02078 char * 02079 dxf_3dface_get_plot_style_name 02080 ( 02081 Dxf3dface *face 02083 ) 02084 { 02085 #if DEBUG 02086 DXF_DEBUG_BEGIN 02087 #endif 02088 /* Do some basic checks. */ 02089 if (face == NULL) 02090 { 02091 fprintf (stderr, 02092 (_("Error in %s () a NULL pointer was passed.\n")), 02093 __FUNCTION__); 02094 return (NULL); 02095 } 02096 if (face->plot_style_name == NULL) 02097 { 02098 fprintf (stderr, 02099 (_("Error in %s () a NULL pointer was found.\n")), 02100 __FUNCTION__); 02101 return (NULL); 02102 } 02103 #if DEBUG 02104 DXF_DEBUG_END 02105 #endif 02106 return (strdup (face->plot_style_name)); 02107 } 02108 02109 02116 Dxf3dface * 02117 dxf_3dface_set_plot_style_name 02118 ( 02119 Dxf3dface *face, 02121 char *plot_style_name 02124 ) 02125 { 02126 #if DEBUG 02127 DXF_DEBUG_BEGIN 02128 #endif 02129 /* Do some basic checks. */ 02130 if (face == NULL) 02131 { 02132 fprintf (stderr, 02133 (_("Error in %s () a NULL pointer was passed.\n")), 02134 __FUNCTION__); 02135 return (NULL); 02136 } 02137 if (plot_style_name == NULL) 02138 { 02139 fprintf (stderr, 02140 (_("Error in %s () a NULL pointer was passed.\n")), 02141 __FUNCTION__); 02142 return (NULL); 02143 } 02144 face->plot_style_name = strdup (plot_style_name); 02145 #if DEBUG 02146 DXF_DEBUG_END 02147 #endif 02148 return (face); 02149 } 02150 02151 02158 long 02159 dxf_3dface_get_color_value 02160 ( 02161 Dxf3dface *face 02163 ) 02164 { 02165 #if DEBUG 02166 DXF_DEBUG_BEGIN 02167 #endif 02168 /* Do some basic checks. */ 02169 if (face == NULL) 02170 { 02171 fprintf (stderr, 02172 (_("Error in %s () a NULL pointer was passed.\n")), 02173 __FUNCTION__); 02174 return (EXIT_FAILURE); 02175 } 02176 #if DEBUG 02177 DXF_DEBUG_END 02178 #endif 02179 return (face->color_value); 02180 } 02181 02182 02189 Dxf3dface * 02190 dxf_3dface_set_color_value 02191 ( 02192 Dxf3dface *face, 02194 long color_value 02196 ) 02197 { 02198 #if DEBUG 02199 DXF_DEBUG_BEGIN 02200 #endif 02201 /* Do some basic checks. */ 02202 if (face == NULL) 02203 { 02204 fprintf (stderr, 02205 (_("Error in %s () a NULL pointer was passed.\n")), 02206 __FUNCTION__); 02207 return (NULL); 02208 } 02209 face->color_value = color_value; 02210 #if DEBUG 02211 DXF_DEBUG_END 02212 #endif 02213 return (face); 02214 } 02215 02216 02223 char * 02224 dxf_3dface_get_color_name 02225 ( 02226 Dxf3dface *face 02228 ) 02229 { 02230 #if DEBUG 02231 DXF_DEBUG_BEGIN 02232 #endif 02233 /* Do some basic checks. */ 02234 if (face == NULL) 02235 { 02236 fprintf (stderr, 02237 (_("Error in %s () a NULL pointer was passed.\n")), 02238 __FUNCTION__); 02239 return (NULL); 02240 } 02241 if (face->color_name == NULL) 02242 { 02243 fprintf (stderr, 02244 (_("Error in %s () a NULL pointer was found.\n")), 02245 __FUNCTION__); 02246 return (NULL); 02247 } 02248 #if DEBUG 02249 DXF_DEBUG_END 02250 #endif 02251 return (strdup (face->color_name)); 02252 } 02253 02254 02261 Dxf3dface * 02262 dxf_3dface_set_color_name 02263 ( 02264 Dxf3dface *face, 02266 char *color_name 02269 ) 02270 { 02271 #if DEBUG 02272 DXF_DEBUG_BEGIN 02273 #endif 02274 /* Do some basic checks. */ 02275 if (face == NULL) 02276 { 02277 fprintf (stderr, 02278 (_("Error in %s () a NULL pointer was passed.\n")), 02279 __FUNCTION__); 02280 return (NULL); 02281 } 02282 if (color_name == NULL) 02283 { 02284 fprintf (stderr, 02285 (_("Error in %s () a NULL pointer was passed.\n")), 02286 __FUNCTION__); 02287 return (NULL); 02288 } 02289 face->color_name = strdup (color_name); 02290 #if DEBUG 02291 DXF_DEBUG_END 02292 #endif 02293 return (face); 02294 } 02295 02296 02303 long 02304 dxf_3dface_get_transparency 02305 ( 02306 Dxf3dface *face 02308 ) 02309 { 02310 #if DEBUG 02311 DXF_DEBUG_BEGIN 02312 #endif 02313 /* Do some basic checks. */ 02314 if (face == NULL) 02315 { 02316 fprintf (stderr, 02317 (_("Error in %s () a NULL pointer was passed.\n")), 02318 __FUNCTION__); 02319 return (EXIT_FAILURE); 02320 } 02321 #if DEBUG 02322 DXF_DEBUG_END 02323 #endif 02324 return (face->transparency); 02325 } 02326 02327 02334 Dxf3dface * 02335 dxf_3dface_set_transparency 02336 ( 02337 Dxf3dface *face, 02339 long transparency 02341 ) 02342 { 02343 #if DEBUG 02344 DXF_DEBUG_BEGIN 02345 #endif 02346 /* Do some basic checks. */ 02347 if (face == NULL) 02348 { 02349 fprintf (stderr, 02350 (_("Error in %s () a NULL pointer was passed.\n")), 02351 __FUNCTION__); 02352 return (NULL); 02353 } 02354 face->transparency = transparency; 02355 #if DEBUG 02356 DXF_DEBUG_END 02357 #endif 02358 return (face); 02359 } 02360 02361 02367 DxfPoint * 02368 dxf_3dface_get_p0 02369 ( 02370 Dxf3dface *face 02372 ) 02373 { 02374 #ifdef DEBUG 02375 DXF_DEBUG_BEGIN 02376 #endif 02377 /* Do some basic checks. */ 02378 if (face == NULL) 02379 { 02380 fprintf (stderr, 02381 (_("Error in %s () a NULL pointer was passed.\n")), 02382 __FUNCTION__); 02383 return (NULL); 02384 } 02385 if (face->p0 == NULL) 02386 { 02387 fprintf (stderr, 02388 (_("Error in %s () a NULL pointer was found.\n")), 02389 __FUNCTION__); 02390 return (NULL); 02391 } 02392 #if DEBUG 02393 DXF_DEBUG_END 02394 #endif 02395 return (face->p0); 02396 } 02397 02398 02405 Dxf3dface * 02406 dxf_3dface_set_p0 02407 ( 02408 Dxf3dface *face, 02410 DxfPoint *point 02412 ) 02413 { 02414 #ifdef DEBUG 02415 DXF_DEBUG_BEGIN 02416 #endif 02417 /* Do some basic checks. */ 02418 if (face == NULL) 02419 { 02420 fprintf (stderr, 02421 (_("Error in %s () a NULL pointer was passed.\n")), 02422 __FUNCTION__); 02423 return (NULL); 02424 } 02425 if (point == NULL) 02426 { 02427 fprintf (stderr, 02428 (_("Error in %s () a NULL pointer was passed.\n")), 02429 __FUNCTION__); 02430 return (NULL); 02431 } 02432 face->p0 = (DxfPoint *) point; 02433 #if DEBUG 02434 DXF_DEBUG_END 02435 #endif 02436 return (face); 02437 } 02438 02439 02446 double 02447 dxf_3dface_get_x0 02448 ( 02449 Dxf3dface *face 02451 ) 02452 { 02453 #ifdef DEBUG 02454 DXF_DEBUG_BEGIN 02455 #endif 02456 02457 /* Do some basic checks. */ 02458 if (face == NULL) 02459 { 02460 fprintf (stderr, 02461 (_("Error in %s () a NULL pointer was passed.\n")), 02462 __FUNCTION__); 02463 return (EXIT_FAILURE); 02464 } 02465 if (face->p0 == NULL) 02466 { 02467 fprintf (stderr, 02468 (_("Error in %s () a NULL pointer was found.\n")), 02469 __FUNCTION__); 02470 return (EXIT_FAILURE); 02471 } 02472 #if DEBUG 02473 DXF_DEBUG_END 02474 #endif 02475 return (face->p0->x0); 02476 } 02477 02478 02486 Dxf3dface * 02487 dxf_3dface_set_x0 02488 ( 02489 Dxf3dface *face, 02491 double x0 02494 ) 02495 { 02496 #ifdef DEBUG 02497 DXF_DEBUG_BEGIN 02498 #endif 02499 /* Do some basic checks. */ 02500 if (face == NULL) 02501 { 02502 fprintf (stderr, 02503 (_("Error in %s () a NULL pointer was passed.\n")), 02504 __FUNCTION__); 02505 return (NULL); 02506 } 02507 if (face->p0 == NULL) 02508 { 02509 fprintf (stderr, 02510 (_("Error in %s () a NULL pointer was found.\n")), 02511 __FUNCTION__); 02512 return (NULL); 02513 } 02514 face->p0->x0 = x0; 02515 #if DEBUG 02516 DXF_DEBUG_END 02517 #endif 02518 return (face); 02519 } 02520 02521 02528 double 02529 dxf_3dface_get_y0 02530 ( 02531 Dxf3dface *face 02533 ) 02534 { 02535 #ifdef DEBUG 02536 DXF_DEBUG_BEGIN 02537 #endif 02538 02539 /* Do some basic checks. */ 02540 if (face == NULL) 02541 { 02542 fprintf (stderr, 02543 (_("Error in %s () a NULL pointer was passed.\n")), 02544 __FUNCTION__); 02545 return (EXIT_FAILURE); 02546 } 02547 if (face->p0 == NULL) 02548 { 02549 fprintf (stderr, 02550 (_("Error in %s () a NULL pointer was found.\n")), 02551 __FUNCTION__); 02552 return (EXIT_FAILURE); 02553 } 02554 #if DEBUG 02555 DXF_DEBUG_END 02556 #endif 02557 return (face->p0->y0); 02558 } 02559 02560 02568 Dxf3dface * 02569 dxf_3dface_set_y0 02570 ( 02571 Dxf3dface *face, 02573 double y0 02576 ) 02577 { 02578 #ifdef DEBUG 02579 DXF_DEBUG_BEGIN 02580 #endif 02581 /* Do some basic checks. */ 02582 if (face == NULL) 02583 { 02584 fprintf (stderr, 02585 (_("Error in %s () a NULL pointer was passed.\n")), 02586 __FUNCTION__); 02587 return (NULL); 02588 } 02589 if (face->p0 == NULL) 02590 { 02591 fprintf (stderr, 02592 (_("Error in %s () a NULL pointer was found.\n")), 02593 __FUNCTION__); 02594 return (NULL); 02595 } 02596 face->p0->y0 = y0; 02597 #if DEBUG 02598 DXF_DEBUG_END 02599 #endif 02600 return (face); 02601 } 02602 02603 02610 double 02611 dxf_3dface_get_z0 02612 ( 02613 Dxf3dface *face 02615 ) 02616 { 02617 #ifdef DEBUG 02618 DXF_DEBUG_BEGIN 02619 #endif 02620 02621 /* Do some basic checks. */ 02622 if (face == NULL) 02623 { 02624 fprintf (stderr, 02625 (_("Error in %s () a NULL pointer was passed.\n")), 02626 __FUNCTION__); 02627 return (EXIT_FAILURE); 02628 } 02629 if (face->p0 == NULL) 02630 { 02631 fprintf (stderr, 02632 (_("Error in %s () a NULL pointer was found.\n")), 02633 __FUNCTION__); 02634 return (EXIT_FAILURE); 02635 } 02636 #if DEBUG 02637 DXF_DEBUG_END 02638 #endif 02639 return (face->p0->z0); 02640 } 02641 02642 02650 Dxf3dface * 02651 dxf_3dface_set_z0 02652 ( 02653 Dxf3dface *face, 02655 double z0 02658 ) 02659 { 02660 #ifdef DEBUG 02661 DXF_DEBUG_BEGIN 02662 #endif 02663 /* Do some basic checks. */ 02664 if (face == NULL) 02665 { 02666 fprintf (stderr, 02667 (_("Error in %s () a NULL pointer was passed.\n")), 02668 __FUNCTION__); 02669 return (NULL); 02670 } 02671 if (face->p0 == NULL) 02672 { 02673 fprintf (stderr, 02674 (_("Error in %s () a NULL pointer was found.\n")), 02675 __FUNCTION__); 02676 return (NULL); 02677 } 02678 face->p0->z0 = z0; 02679 #if DEBUG 02680 DXF_DEBUG_END 02681 #endif 02682 return (face); 02683 } 02684 02685 02691 DxfPoint * 02692 dxf_3dface_get_p1 02693 ( 02694 Dxf3dface *face 02696 ) 02697 { 02698 #ifdef DEBUG 02699 DXF_DEBUG_BEGIN 02700 #endif 02701 /* Do some basic checks. */ 02702 if (face == NULL) 02703 { 02704 fprintf (stderr, 02705 (_("Error in %s () a NULL pointer was passed.\n")), 02706 __FUNCTION__); 02707 return (NULL); 02708 } 02709 if (face->p1 == NULL) 02710 { 02711 fprintf (stderr, 02712 (_("Error in %s () a NULL pointer was found.\n")), 02713 __FUNCTION__); 02714 return (NULL); 02715 } 02716 #if DEBUG 02717 DXF_DEBUG_END 02718 #endif 02719 return (face->p1); 02720 } 02721 02722 02729 Dxf3dface * 02730 dxf_3dface_set_p1 02731 ( 02732 Dxf3dface *face, 02734 DxfPoint *point 02736 ) 02737 { 02738 #ifdef DEBUG 02739 DXF_DEBUG_BEGIN 02740 #endif 02741 /* Do some basic checks. */ 02742 if (face == NULL) 02743 { 02744 fprintf (stderr, 02745 (_("Error in %s () a NULL pointer was passed.\n")), 02746 __FUNCTION__); 02747 return (NULL); 02748 } 02749 if (point == NULL) 02750 { 02751 fprintf (stderr, 02752 (_("Error in %s () a NULL pointer was passed.\n")), 02753 __FUNCTION__); 02754 return (NULL); 02755 } 02756 face->p1 = (DxfPoint *) point; 02757 #if DEBUG 02758 DXF_DEBUG_END 02759 #endif 02760 return (face); 02761 } 02762 02763 02770 double 02771 dxf_3dface_get_x1 02772 ( 02773 Dxf3dface *face 02775 ) 02776 { 02777 #ifdef DEBUG 02778 DXF_DEBUG_BEGIN 02779 #endif 02780 02781 /* Do some basic checks. */ 02782 if (face == NULL) 02783 { 02784 fprintf (stderr, 02785 (_("Error in %s () a NULL pointer was passed.\n")), 02786 __FUNCTION__); 02787 return (EXIT_FAILURE); 02788 } 02789 if (face->p1 == NULL) 02790 { 02791 fprintf (stderr, 02792 (_("Error in %s () a NULL pointer was found.\n")), 02793 __FUNCTION__); 02794 return (EXIT_FAILURE); 02795 } 02796 #if DEBUG 02797 DXF_DEBUG_END 02798 #endif 02799 return (face->p1->x0); 02800 } 02801 02802 02810 Dxf3dface * 02811 dxf_3dface_set_x1 02812 ( 02813 Dxf3dface *face, 02815 double x1 02818 ) 02819 { 02820 #ifdef DEBUG 02821 DXF_DEBUG_BEGIN 02822 #endif 02823 /* Do some basic checks. */ 02824 if (face == NULL) 02825 { 02826 fprintf (stderr, 02827 (_("Error in %s () a NULL pointer was passed.\n")), 02828 __FUNCTION__); 02829 return (NULL); 02830 } 02831 if (face->p1 == NULL) 02832 { 02833 fprintf (stderr, 02834 (_("Error in %s () a NULL pointer was found.\n")), 02835 __FUNCTION__); 02836 return (NULL); 02837 } 02838 face->p1->x0 = x1; 02839 #if DEBUG 02840 DXF_DEBUG_END 02841 #endif 02842 return (face); 02843 } 02844 02845 02852 double 02853 dxf_3dface_get_y1 02854 ( 02855 Dxf3dface *face 02857 ) 02858 { 02859 #ifdef DEBUG 02860 DXF_DEBUG_BEGIN 02861 #endif 02862 02863 /* Do some basic checks. */ 02864 if (face == NULL) 02865 { 02866 fprintf (stderr, 02867 (_("Error in %s () a NULL pointer was passed.\n")), 02868 __FUNCTION__); 02869 return (EXIT_FAILURE); 02870 } 02871 if (face->p1 == NULL) 02872 { 02873 fprintf (stderr, 02874 (_("Error in %s () a NULL pointer was found.\n")), 02875 __FUNCTION__); 02876 return (EXIT_FAILURE); 02877 } 02878 #if DEBUG 02879 DXF_DEBUG_END 02880 #endif 02881 return (face->p1->y0); 02882 } 02883 02884 02892 Dxf3dface * 02893 dxf_3dface_set_y1 02894 ( 02895 Dxf3dface *face, 02897 double y1 02900 ) 02901 { 02902 #ifdef DEBUG 02903 DXF_DEBUG_BEGIN 02904 #endif 02905 /* Do some basic checks. */ 02906 if (face == NULL) 02907 { 02908 fprintf (stderr, 02909 (_("Error in %s () a NULL pointer was passed.\n")), 02910 __FUNCTION__); 02911 return (NULL); 02912 } 02913 if (face->p1 == NULL) 02914 { 02915 fprintf (stderr, 02916 (_("Error in %s () a NULL pointer was found.\n")), 02917 __FUNCTION__); 02918 return (NULL); 02919 } 02920 face->p1->y0 = y1; 02921 #if DEBUG 02922 DXF_DEBUG_END 02923 #endif 02924 return (face); 02925 } 02926 02927 02934 double 02935 dxf_3dface_get_z1 02936 ( 02937 Dxf3dface *face 02939 ) 02940 { 02941 #ifdef DEBUG 02942 DXF_DEBUG_BEGIN 02943 #endif 02944 02945 /* Do some basic checks. */ 02946 if (face == NULL) 02947 { 02948 fprintf (stderr, 02949 (_("Error in %s () a NULL pointer was passed.\n")), 02950 __FUNCTION__); 02951 return (EXIT_FAILURE); 02952 } 02953 if (face->p1 == NULL) 02954 { 02955 fprintf (stderr, 02956 (_("Error in %s () a NULL pointer was found.\n")), 02957 __FUNCTION__); 02958 return (EXIT_FAILURE); 02959 } 02960 #if DEBUG 02961 DXF_DEBUG_END 02962 #endif 02963 return (face->p1->z0); 02964 } 02965 02966 02974 Dxf3dface * 02975 dxf_3dface_set_z1 02976 ( 02977 Dxf3dface *face, 02979 double z1 02982 ) 02983 { 02984 #ifdef DEBUG 02985 DXF_DEBUG_BEGIN 02986 #endif 02987 /* Do some basic checks. */ 02988 if (face == NULL) 02989 { 02990 fprintf (stderr, 02991 (_("Error in %s () a NULL pointer was passed.\n")), 02992 __FUNCTION__); 02993 return (NULL); 02994 } 02995 if (face->p1 == NULL) 02996 { 02997 fprintf (stderr, 02998 (_("Error in %s () a NULL pointer was found.\n")), 02999 __FUNCTION__); 03000 return (NULL); 03001 } 03002 face->p1->z0 = z1; 03003 #if DEBUG 03004 DXF_DEBUG_END 03005 #endif 03006 return (face); 03007 } 03008 03009 03015 DxfPoint * 03016 dxf_3dface_get_p2 03017 ( 03018 Dxf3dface *face 03020 ) 03021 { 03022 #ifdef DEBUG 03023 DXF_DEBUG_BEGIN 03024 #endif 03025 /* Do some basic checks. */ 03026 if (face == NULL) 03027 { 03028 fprintf (stderr, 03029 (_("Error in %s () a NULL pointer was passed.\n")), 03030 __FUNCTION__); 03031 return (NULL); 03032 } 03033 if (face->p2 == NULL) 03034 { 03035 fprintf (stderr, 03036 (_("Error in %s () a NULL pointer was found.\n")), 03037 __FUNCTION__); 03038 return (NULL); 03039 } 03040 #if DEBUG 03041 DXF_DEBUG_END 03042 #endif 03043 return (face->p2); 03044 } 03045 03046 03053 Dxf3dface * 03054 dxf_3dface_set_p2 03055 ( 03056 Dxf3dface *face, 03058 DxfPoint *point 03060 ) 03061 { 03062 #ifdef DEBUG 03063 DXF_DEBUG_BEGIN 03064 #endif 03065 /* Do some basic checks. */ 03066 if (face == NULL) 03067 { 03068 fprintf (stderr, 03069 (_("Error in %s () a NULL pointer was passed.\n")), 03070 __FUNCTION__); 03071 return (NULL); 03072 } 03073 if (point == NULL) 03074 { 03075 fprintf (stderr, 03076 (_("Error in %s () a NULL pointer was passed.\n")), 03077 __FUNCTION__); 03078 return (NULL); 03079 } 03080 face->p2 = (DxfPoint *) point; 03081 #if DEBUG 03082 DXF_DEBUG_END 03083 #endif 03084 return (face); 03085 } 03086 03087 03094 double 03095 dxf_3dface_get_x2 03096 ( 03097 Dxf3dface *face 03099 ) 03100 { 03101 #ifdef DEBUG 03102 DXF_DEBUG_BEGIN 03103 #endif 03104 03105 /* Do some basic checks. */ 03106 if (face == NULL) 03107 { 03108 fprintf (stderr, 03109 (_("Error in %s () a NULL pointer was passed.\n")), 03110 __FUNCTION__); 03111 return (EXIT_FAILURE); 03112 } 03113 if (face->p2 == NULL) 03114 { 03115 fprintf (stderr, 03116 (_("Error in %s () a NULL pointer was found.\n")), 03117 __FUNCTION__); 03118 return (EXIT_FAILURE); 03119 } 03120 #if DEBUG 03121 DXF_DEBUG_END 03122 #endif 03123 return (face->p2->x0); 03124 } 03125 03126 03134 Dxf3dface * 03135 dxf_3dface_set_x2 03136 ( 03137 Dxf3dface *face, 03139 double x2 03142 ) 03143 { 03144 #ifdef DEBUG 03145 DXF_DEBUG_BEGIN 03146 #endif 03147 /* Do some basic checks. */ 03148 if (face == NULL) 03149 { 03150 fprintf (stderr, 03151 (_("Error in %s () a NULL pointer was passed.\n")), 03152 __FUNCTION__); 03153 return (NULL); 03154 } 03155 if (face->p2 == NULL) 03156 { 03157 fprintf (stderr, 03158 (_("Error in %s () a NULL pointer was found.\n")), 03159 __FUNCTION__); 03160 return (NULL); 03161 } 03162 face->p2->x0 = x2; 03163 #if DEBUG 03164 DXF_DEBUG_END 03165 #endif 03166 return (face); 03167 } 03168 03169 03176 double 03177 dxf_3dface_get_y2 03178 ( 03179 Dxf3dface *face 03181 ) 03182 { 03183 #ifdef DEBUG 03184 DXF_DEBUG_BEGIN 03185 #endif 03186 03187 /* Do some basic checks. */ 03188 if (face == NULL) 03189 { 03190 fprintf (stderr, 03191 (_("Error in %s () a NULL pointer was passed.\n")), 03192 __FUNCTION__); 03193 return (EXIT_FAILURE); 03194 } 03195 if (face->p2 == NULL) 03196 { 03197 fprintf (stderr, 03198 (_("Error in %s () a NULL pointer was found.\n")), 03199 __FUNCTION__); 03200 return (EXIT_FAILURE); 03201 } 03202 #if DEBUG 03203 DXF_DEBUG_END 03204 #endif 03205 return (face->p2->y0); 03206 } 03207 03208 03216 Dxf3dface * 03217 dxf_3dface_set_y2 03218 ( 03219 Dxf3dface *face, 03221 double y2 03224 ) 03225 { 03226 #ifdef DEBUG 03227 DXF_DEBUG_BEGIN 03228 #endif 03229 /* Do some basic checks. */ 03230 if (face == NULL) 03231 { 03232 fprintf (stderr, 03233 (_("Error in %s () a NULL pointer was passed.\n")), 03234 __FUNCTION__); 03235 return (NULL); 03236 } 03237 if (face->p2 == NULL) 03238 { 03239 fprintf (stderr, 03240 (_("Error in %s () a NULL pointer was found.\n")), 03241 __FUNCTION__); 03242 return (NULL); 03243 } 03244 face->p2->y0 = y2; 03245 #if DEBUG 03246 DXF_DEBUG_END 03247 #endif 03248 return (face); 03249 } 03250 03251 03258 double 03259 dxf_3dface_get_z2 03260 ( 03261 Dxf3dface *face 03263 ) 03264 { 03265 #ifdef DEBUG 03266 DXF_DEBUG_BEGIN 03267 #endif 03268 03269 /* Do some basic checks. */ 03270 if (face == NULL) 03271 { 03272 fprintf (stderr, 03273 (_("Error in %s () a NULL pointer was passed.\n")), 03274 __FUNCTION__); 03275 return (EXIT_FAILURE); 03276 } 03277 if (face->p2 == NULL) 03278 { 03279 fprintf (stderr, 03280 (_("Error in %s () a NULL pointer was found.\n")), 03281 __FUNCTION__); 03282 return (EXIT_FAILURE); 03283 } 03284 #if DEBUG 03285 DXF_DEBUG_END 03286 #endif 03287 return (face->p2->z0); 03288 } 03289 03290 03298 Dxf3dface * 03299 dxf_3dface_set_z2 03300 ( 03301 Dxf3dface *face, 03303 double z2 03306 ) 03307 { 03308 #ifdef DEBUG 03309 DXF_DEBUG_BEGIN 03310 #endif 03311 /* Do some basic checks. */ 03312 if (face == NULL) 03313 { 03314 fprintf (stderr, 03315 (_("Error in %s () a NULL pointer was passed.\n")), 03316 __FUNCTION__); 03317 return (NULL); 03318 } 03319 if (face->p2 == NULL) 03320 { 03321 fprintf (stderr, 03322 (_("Error in %s () a NULL pointer was found.\n")), 03323 __FUNCTION__); 03324 return (NULL); 03325 } 03326 face->p2->z0 = z2; 03327 #if DEBUG 03328 DXF_DEBUG_END 03329 #endif 03330 return (face); 03331 } 03332 03333 03339 DxfPoint * 03340 dxf_3dface_get_p3 03341 ( 03342 Dxf3dface *face 03344 ) 03345 { 03346 #ifdef DEBUG 03347 DXF_DEBUG_BEGIN 03348 #endif 03349 /* Do some basic checks. */ 03350 if (face == NULL) 03351 { 03352 fprintf (stderr, 03353 (_("Error in %s () a NULL pointer was passed.\n")), 03354 __FUNCTION__); 03355 return (NULL); 03356 } 03357 if (face->p3 == NULL) 03358 { 03359 fprintf (stderr, 03360 (_("Error in %s () a NULL pointer was found.\n")), 03361 __FUNCTION__); 03362 return (NULL); 03363 } 03364 #if DEBUG 03365 DXF_DEBUG_END 03366 #endif 03367 return (face->p3); 03368 } 03369 03370 03377 Dxf3dface * 03378 dxf_3dface_set_p3 03379 ( 03380 Dxf3dface *face, 03382 DxfPoint *point 03384 ) 03385 { 03386 #ifdef DEBUG 03387 DXF_DEBUG_BEGIN 03388 #endif 03389 /* Do some basic checks. */ 03390 if (face == NULL) 03391 { 03392 fprintf (stderr, 03393 (_("Error in %s () a NULL pointer was passed.\n")), 03394 __FUNCTION__); 03395 return (NULL); 03396 } 03397 if (point == NULL) 03398 { 03399 fprintf (stderr, 03400 (_("Error in %s () a NULL pointer was passed.\n")), 03401 __FUNCTION__); 03402 return (NULL); 03403 } 03404 face->p3 = (DxfPoint *) point; 03405 #if DEBUG 03406 DXF_DEBUG_END 03407 #endif 03408 return (face); 03409 } 03410 03411 03418 double 03419 dxf_3dface_get_x3 03420 ( 03421 Dxf3dface *face 03423 ) 03424 { 03425 #ifdef DEBUG 03426 DXF_DEBUG_BEGIN 03427 #endif 03428 03429 /* Do some basic checks. */ 03430 if (face == NULL) 03431 { 03432 fprintf (stderr, 03433 (_("Error in %s () a NULL pointer was passed.\n")), 03434 __FUNCTION__); 03435 return (EXIT_FAILURE); 03436 } 03437 if (face->p3 == NULL) 03438 { 03439 fprintf (stderr, 03440 (_("Error in %s () a NULL pointer was found.\n")), 03441 __FUNCTION__); 03442 return (EXIT_FAILURE); 03443 } 03444 #if DEBUG 03445 DXF_DEBUG_END 03446 #endif 03447 return (face->p3->x0); 03448 } 03449 03450 03458 Dxf3dface * 03459 dxf_3dface_set_x3 03460 ( 03461 Dxf3dface *face, 03463 double x3 03466 ) 03467 { 03468 #ifdef DEBUG 03469 DXF_DEBUG_BEGIN 03470 #endif 03471 /* Do some basic checks. */ 03472 if (face == NULL) 03473 { 03474 fprintf (stderr, 03475 (_("Error in %s () a NULL pointer was passed.\n")), 03476 __FUNCTION__); 03477 return (NULL); 03478 } 03479 if (face->p3 == NULL) 03480 { 03481 fprintf (stderr, 03482 (_("Error in %s () a NULL pointer was found.\n")), 03483 __FUNCTION__); 03484 return (NULL); 03485 } 03486 face->p3->x0 = x3; 03487 #if DEBUG 03488 DXF_DEBUG_END 03489 #endif 03490 return (face); 03491 } 03492 03493 03500 double 03501 dxf_3dface_get_y3 03502 ( 03503 Dxf3dface *face 03505 ) 03506 { 03507 #ifdef DEBUG 03508 DXF_DEBUG_BEGIN 03509 #endif 03510 03511 /* Do some basic checks. */ 03512 if (face == NULL) 03513 { 03514 fprintf (stderr, 03515 (_("Error in %s () a NULL pointer was passed.\n")), 03516 __FUNCTION__); 03517 return (EXIT_FAILURE); 03518 } 03519 if (face->p3 == NULL) 03520 { 03521 fprintf (stderr, 03522 (_("Error in %s () a NULL pointer was found.\n")), 03523 __FUNCTION__); 03524 return (EXIT_FAILURE); 03525 } 03526 #if DEBUG 03527 DXF_DEBUG_END 03528 #endif 03529 return (face->p3->y0); 03530 } 03531 03532 03540 Dxf3dface * 03541 dxf_3dface_set_y3 03542 ( 03543 Dxf3dface *face, 03545 double y3 03548 ) 03549 { 03550 #ifdef DEBUG 03551 DXF_DEBUG_BEGIN 03552 #endif 03553 /* Do some basic checks. */ 03554 if (face == NULL) 03555 { 03556 fprintf (stderr, 03557 (_("Error in %s () a NULL pointer was passed.\n")), 03558 __FUNCTION__); 03559 return (NULL); 03560 } 03561 if (face->p3 == NULL) 03562 { 03563 fprintf (stderr, 03564 (_("Error in %s () a NULL pointer was found.\n")), 03565 __FUNCTION__); 03566 return (NULL); 03567 } 03568 face->p3->y0 = y3; 03569 #if DEBUG 03570 DXF_DEBUG_END 03571 #endif 03572 return (face); 03573 } 03574 03575 03582 double 03583 dxf_3dface_get_z3 03584 ( 03585 Dxf3dface *face 03587 ) 03588 { 03589 #ifdef DEBUG 03590 DXF_DEBUG_BEGIN 03591 #endif 03592 03593 /* Do some basic checks. */ 03594 if (face == NULL) 03595 { 03596 fprintf (stderr, 03597 (_("Error in %s () a NULL pointer was passed.\n")), 03598 __FUNCTION__); 03599 return (EXIT_FAILURE); 03600 } 03601 if (face->p3 == NULL) 03602 { 03603 fprintf (stderr, 03604 (_("Error in %s () a NULL pointer was found.\n")), 03605 __FUNCTION__); 03606 return (EXIT_FAILURE); 03607 } 03608 #if DEBUG 03609 DXF_DEBUG_END 03610 #endif 03611 return (face->p3->z0); 03612 } 03613 03614 03622 Dxf3dface * 03623 dxf_3dface_set_z3 03624 ( 03625 Dxf3dface *face, 03627 double z3 03630 ) 03631 { 03632 #ifdef DEBUG 03633 DXF_DEBUG_BEGIN 03634 #endif 03635 /* Do some basic checks. */ 03636 if (face == NULL) 03637 { 03638 fprintf (stderr, 03639 (_("Error in %s () a NULL pointer was passed.\n")), 03640 __FUNCTION__); 03641 return (NULL); 03642 } 03643 if (face->p3 == NULL) 03644 { 03645 fprintf (stderr, 03646 (_("Error in %s () a NULL pointer was found.\n")), 03647 __FUNCTION__); 03648 return (NULL); 03649 } 03650 face->p3->z0 = z3; 03651 #if DEBUG 03652 DXF_DEBUG_END 03653 #endif 03654 return (face); 03655 } 03656 03657 03663 int 03664 dxf_3dface_get_flag 03665 ( 03666 Dxf3dface *face 03668 ) 03669 { 03670 #if DEBUG 03671 DXF_DEBUG_BEGIN 03672 #endif 03673 /* Do some basic checks. */ 03674 if (face == NULL) 03675 { 03676 fprintf (stderr, 03677 (_("Error in %s () a NULL pointer was passed.\n")), 03678 __FUNCTION__); 03679 return (EXIT_FAILURE); 03680 } 03681 if (face->flag < 0) 03682 { 03683 fprintf (stderr, 03684 (_("Error in %s () a negative value was found.\n")), 03685 __FUNCTION__); 03686 return (EXIT_FAILURE); 03687 } 03688 if (face->flag > 15) 03689 { 03690 fprintf (stderr, 03691 (_("Error in %s () an out of range value was found.\n")), 03692 __FUNCTION__); 03693 return (EXIT_FAILURE); 03694 } 03695 #if DEBUG 03696 DXF_DEBUG_END 03697 #endif 03698 return (face->flag); 03699 } 03700 03701 03708 Dxf3dface * 03709 dxf_3dface_set_flag 03710 ( 03711 Dxf3dface *face, 03713 int flag 03715 ) 03716 { 03717 #if DEBUG 03718 DXF_DEBUG_BEGIN 03719 #endif 03720 /* Do some basic checks. */ 03721 if (face == NULL) 03722 { 03723 fprintf (stderr, 03724 (_("Error in %s () a NULL pointer was passed.\n")), 03725 __FUNCTION__); 03726 return (NULL); 03727 } 03728 if (flag < 0) 03729 { 03730 fprintf (stderr, 03731 (_("Error in %s () a negative value was passed.\n")), 03732 __FUNCTION__); 03733 return (NULL); 03734 } 03735 face->flag = flag; 03736 #if DEBUG 03737 DXF_DEBUG_END 03738 #endif 03739 return (face); 03740 } 03741 03742 03749 int 03750 dxf_3dface_is_first_edge_invisible 03751 ( 03752 Dxf3dface *face 03754 ) 03755 { 03756 #if DEBUG 03757 DXF_DEBUG_BEGIN 03758 #endif 03759 /* Do some basic checks. */ 03760 if (face == NULL) 03761 { 03762 fprintf (stderr, 03763 (_("Error in %s () a NULL pointer was passed.\n")), 03764 __FUNCTION__); 03765 return (EXIT_FAILURE); 03766 } 03767 #if DEBUG 03768 DXF_DEBUG_END 03769 #endif 03770 return (DXF_CHECK_BIT (face->flag, 0)); 03771 } 03772 03773 03780 int 03781 dxf_3dface_is_second_edge_invisible 03782 ( 03783 Dxf3dface *face 03785 ) 03786 { 03787 #if DEBUG 03788 DXF_DEBUG_BEGIN 03789 #endif 03790 /* Do some basic checks. */ 03791 if (face == NULL) 03792 { 03793 fprintf (stderr, 03794 (_("Error in %s () a NULL pointer was passed.\n")), 03795 __FUNCTION__); 03796 return (EXIT_FAILURE); 03797 } 03798 #if DEBUG 03799 DXF_DEBUG_END 03800 #endif 03801 return (DXF_CHECK_BIT (face->flag, 1)); 03802 } 03803 03804 03811 int 03812 dxf_3dface_is_third_edge_invisible 03813 ( 03814 Dxf3dface *face 03816 ) 03817 { 03818 #if DEBUG 03819 DXF_DEBUG_BEGIN 03820 #endif 03821 /* Do some basic checks. */ 03822 if (face == NULL) 03823 { 03824 fprintf (stderr, 03825 (_("Error in %s () a NULL pointer was passed.\n")), 03826 __FUNCTION__); 03827 return (EXIT_FAILURE); 03828 } 03829 #if DEBUG 03830 DXF_DEBUG_END 03831 #endif 03832 return (DXF_CHECK_BIT (face->flag, 2)); 03833 } 03834 03835 03842 int 03843 dxf_3dface_is_fourth_edge_invisible 03844 ( 03845 Dxf3dface *face 03847 ) 03848 { 03849 #if DEBUG 03850 DXF_DEBUG_BEGIN 03851 #endif 03852 /* Do some basic checks. */ 03853 if (face == NULL) 03854 { 03855 fprintf (stderr, 03856 (_("Error in %s () a NULL pointer was passed.\n")), 03857 __FUNCTION__); 03858 return (EXIT_FAILURE); 03859 } 03860 #if DEBUG 03861 DXF_DEBUG_END 03862 #endif 03863 return (DXF_CHECK_BIT (face->flag, 3)); 03864 } 03865 03866 03874 Dxf3dface * 03875 dxf_3dface_create_from_points 03876 ( 03877 DxfPoint *p0, 03879 DxfPoint *p1, 03881 DxfPoint *p2, 03883 DxfPoint *p3, 03885 int id_code, 03889 int inheritance 03900 ) 03901 { 03902 #ifdef DEBUG 03903 DXF_DEBUG_BEGIN 03904 #endif 03905 Dxf3dface *face = NULL; 03906 03907 /* Do some basic checks. */ 03908 if (((p0 != NULL) && (p1 != NULL) && (p2 != NULL)) 03909 || ((p0 != NULL) && (p1 != NULL) && (p3 != NULL)) 03910 || ((p1 != NULL) && (p2 != NULL) && (p3 != NULL))) 03911 { 03912 /* Do nothing, we only need three valid points to form a 03913 * 3dface (test of all three valid permutations). */ 03914 } 03915 else 03916 { 03917 fprintf (stderr, 03918 (_("Error in %s () to many NULL pointers were passed.\n")), 03919 __FUNCTION__); 03920 return (NULL); 03921 } 03922 if (id_code < 0) 03923 { 03924 fprintf (stderr, 03925 (_("Warning in %s () passed id_code is smaller than 0.\n")), 03926 __FUNCTION__); 03927 } 03928 if ((inheritance < 0) || (inheritance > 4)) 03929 { 03930 fprintf (stderr, 03931 (_("Error in %s () an illegal inherit value was passed.\n")), 03932 __FUNCTION__); 03933 return (NULL); 03934 } 03935 face = dxf_3dface_init (face); 03936 if (face == NULL) 03937 { 03938 fprintf (stderr, 03939 (_("Error in %s () could not allocate memory.\n")), 03940 __FUNCTION__); 03941 return (NULL); 03942 } 03943 if (p1 != NULL) 03944 { 03945 face->p0 = (DxfPoint *) p0; 03946 } 03947 if (p2 != NULL) 03948 { 03949 face->p1 = (DxfPoint *) p1; 03950 } 03951 if (p3 != NULL) 03952 { 03953 face->p2 = (DxfPoint *) p2; 03954 } 03955 if (p3 != NULL) 03956 { 03957 face->p3 = (DxfPoint *) p3; 03958 } 03959 switch (inheritance) 03960 { 03961 case 0: 03962 /* Do nothing. */ 03963 break; 03964 case 1: 03965 if (p0 == NULL) 03966 { 03967 break; 03968 } 03969 if (p0->linetype != NULL) 03970 { 03971 face->linetype = strdup (p0->linetype); 03972 } 03973 if (p0->layer != NULL) 03974 { 03975 face->layer = strdup (p0->layer); 03976 } 03977 face->thickness = p0->thickness; 03978 face->linetype_scale = p0->linetype_scale; 03979 face->visibility = p0->visibility; 03980 face->color = p0->color; 03981 face->paperspace = p0->paperspace; 03982 if (p0->dictionary_owner_soft != NULL) 03983 { 03984 face->dictionary_owner_soft = strdup (p0->dictionary_owner_soft); 03985 } 03986 if (p0->dictionary_owner_hard != NULL) 03987 { 03988 face->dictionary_owner_hard = strdup (p0->dictionary_owner_hard); 03989 } 03990 break; 03991 case 2: 03992 if (p1 == NULL) 03993 { 03994 break; 03995 } 03996 if (p1->linetype != NULL) 03997 { 03998 face->linetype = strdup (p1->linetype); 03999 } 04000 if (p1->layer != NULL) 04001 { 04002 face->layer = strdup (p1->layer); 04003 } 04004 face->thickness = p1->thickness; 04005 face->linetype_scale = p1->linetype_scale; 04006 face->visibility = p1->visibility; 04007 face->color = p1->color; 04008 face->paperspace = p1->paperspace; 04009 if (p1->dictionary_owner_soft != NULL) 04010 { 04011 face->dictionary_owner_soft = strdup (p1->dictionary_owner_soft); 04012 } 04013 if (p1->dictionary_owner_hard != NULL) 04014 { 04015 face->dictionary_owner_hard = strdup (p1->dictionary_owner_hard); 04016 } 04017 break; 04018 case 3: 04019 if (p2 == NULL) 04020 { 04021 break; 04022 } 04023 if (p2->linetype != NULL) 04024 { 04025 face->linetype = strdup (p2->linetype); 04026 } 04027 if (p2->layer != NULL) 04028 { 04029 face->layer = strdup (p2->layer); 04030 } 04031 face->thickness = p2->thickness; 04032 face->linetype_scale = p2->linetype_scale; 04033 face->visibility = p2->visibility; 04034 face->color = p2->color; 04035 face->paperspace = p2->paperspace; 04036 if (p2->dictionary_owner_soft != NULL) 04037 { 04038 face->dictionary_owner_soft = strdup (p2->dictionary_owner_soft); 04039 } 04040 if (p2->dictionary_owner_hard != NULL) 04041 { 04042 face->dictionary_owner_hard = strdup (p2->dictionary_owner_hard); 04043 } 04044 break; 04045 case 4: 04046 if (p3 == NULL) 04047 { 04048 break; 04049 } 04050 if (p3->linetype != NULL) 04051 { 04052 face->linetype = strdup (p3->linetype); 04053 } 04054 if (p3->layer != NULL) 04055 { 04056 face->layer = strdup (p3->layer); 04057 } 04058 face->thickness = p3->thickness; 04059 face->linetype_scale = p3->linetype_scale; 04060 face->visibility = p3->visibility; 04061 face->color = p3->color; 04062 face->paperspace = p3->paperspace; 04063 if (p3->dictionary_owner_soft != NULL) 04064 { 04065 face->dictionary_owner_soft = strdup (p3->dictionary_owner_soft); 04066 } 04067 if (p3->dictionary_owner_hard != NULL) 04068 { 04069 face->dictionary_owner_hard = strdup (p3->dictionary_owner_hard); 04070 } 04071 break; 04072 default: 04073 fprintf (stderr, 04074 (_("Warning in %s (): unknown inheritance option passed.\n")), 04075 __FUNCTION__); 04076 fprintf (stderr, 04077 (_("\tResolving to default.\n"))); 04078 break; 04079 } 04080 #if DEBUG 04081 DXF_DEBUG_END 04082 #endif 04083 return (face); 04084 } 04085 04086 04095 Dxf3dface * 04096 dxf_3dface_get_next 04097 ( 04098 Dxf3dface *face 04100 ) 04101 { 04102 #if DEBUG 04103 DXF_DEBUG_BEGIN 04104 #endif 04105 /* Do some basic checks. */ 04106 if (face == NULL) 04107 { 04108 fprintf (stderr, 04109 (_("Error in %s () a NULL pointer was passed.\n")), 04110 __FUNCTION__); 04111 return (NULL); 04112 } 04113 if (face->next == NULL) 04114 { 04115 fprintf (stderr, 04116 (_("Error in %s () a NULL pointer was found.\n")), 04117 __FUNCTION__); 04118 return (NULL); 04119 } 04120 #if DEBUG 04121 DXF_DEBUG_END 04122 #endif 04123 return ((Dxf3dface *) face->next); 04124 } 04125 04126 04134 Dxf3dface * 04135 dxf_3dface_set_next 04136 ( 04137 Dxf3dface *face, 04139 Dxf3dface *next 04141 ) 04142 { 04143 #if DEBUG 04144 DXF_DEBUG_BEGIN 04145 #endif 04146 /* Do some basic checks. */ 04147 if (face == NULL) 04148 { 04149 fprintf (stderr, 04150 (_("Error in %s () a NULL pointer was passed.\n")), 04151 __FUNCTION__); 04152 return (NULL); 04153 } 04154 if (next == NULL) 04155 { 04156 fprintf (stderr, 04157 (_("Error in %s () a NULL pointer was passed.\n")), 04158 __FUNCTION__); 04159 return (NULL); 04160 } 04161 face->next = (struct Dxf3dface *) next; 04162 #if DEBUG 04163 DXF_DEBUG_END 04164 #endif 04165 return (face); 04166 } 04167 04168 04177 Dxf3dface * 04178 dxf_3dface_get_last 04179 ( 04180 Dxf3dface *face 04182 ) 04183 { 04184 #if DEBUG 04185 DXF_DEBUG_BEGIN 04186 #endif 04187 /* Do some basic checks. */ 04188 if (face == NULL) 04189 { 04190 fprintf (stderr, 04191 (_("Error in %s () a NULL pointer was passed.\n")), 04192 __FUNCTION__); 04193 return (NULL); 04194 } 04195 if (face->next == NULL) 04196 { 04197 fprintf (stderr, 04198 (_("Warning in %s () a NULL pointer was found.\n")), 04199 __FUNCTION__); 04200 return ((Dxf3dface *) face); 04201 } 04202 Dxf3dface *iter = (Dxf3dface *) face->next; 04203 while (iter->next != NULL) 04204 { 04205 iter = (Dxf3dface *) iter->next; 04206 } 04207 #if DEBUG 04208 DXF_DEBUG_END 04209 #endif 04210 return ((Dxf3dface *) iter); 04211 } 04212 04213 04214 /* EOF */