libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00042 #include "arc.h" 00043 00044 00053 DxfArc * 00054 dxf_arc_new () 00055 { 00056 #if DEBUG 00057 DXF_DEBUG_BEGIN 00058 #endif 00059 DxfArc *arc = NULL; 00060 size_t size; 00061 00062 size = sizeof (DxfArc); 00063 /* avoid malloc of 0 bytes */ 00064 if (size == 0) size = 1; 00065 if ((arc = malloc (size)) == NULL) 00066 { 00067 fprintf (stderr, 00068 (_("Error in %s () could not allocate memory.\n")), 00069 __FUNCTION__); 00070 arc = NULL; 00071 } 00072 else 00073 { 00074 memset (arc, 0, size); 00075 } 00076 #if DEBUG 00077 DXF_DEBUG_END 00078 #endif 00079 return (arc); 00080 } 00081 00082 00090 DxfArc * 00091 dxf_arc_init 00092 ( 00093 DxfArc *arc 00095 ) 00096 { 00097 #if DEBUG 00098 DXF_DEBUG_BEGIN 00099 #endif 00100 /* Do some basic checks. */ 00101 if (arc == NULL) 00102 { 00103 fprintf (stderr, 00104 (_("Warning in %s () a NULL pointer was passed.\n")), 00105 __FUNCTION__); 00106 arc = dxf_arc_new (); 00107 } 00108 if (arc == NULL) 00109 { 00110 fprintf (stderr, 00111 (_("Error in %s () could not allocate memory.\n")), 00112 __FUNCTION__); 00113 return (NULL); 00114 } 00115 dxf_arc_set_id_code (arc, 0); 00116 dxf_arc_set_linetype (arc, strdup (DXF_DEFAULT_LINETYPE)); 00117 dxf_arc_set_layer (arc, strdup (DXF_DEFAULT_LAYER)); 00118 dxf_arc_set_elevation (arc, 0.0); 00119 dxf_arc_set_thickness (arc, 0.0); 00120 dxf_arc_set_linetype_scale (arc, DXF_DEFAULT_LINETYPE_SCALE); 00121 dxf_arc_set_visibility (arc, DXF_DEFAULT_VISIBILITY); 00122 dxf_arc_set_color (arc, DXF_COLOR_BYLAYER); 00123 dxf_arc_set_paperspace (arc, DXF_MODELSPACE); 00124 dxf_arc_set_graphics_data_size (arc, 0); 00125 dxf_arc_set_shadow_mode (arc, 0); 00126 dxf_arc_set_binary_graphics_data (arc, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ()); 00127 dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) dxf_arc_get_binary_graphics_data (arc)); 00128 dxf_arc_set_dictionary_owner_soft (arc, strdup ("")); 00129 dxf_arc_set_material (arc, strdup ("")); 00130 dxf_arc_set_dictionary_owner_hard (arc, strdup ("")); 00131 dxf_arc_set_lineweight (arc, 0); 00132 dxf_arc_set_plot_style_name (arc, strdup ("")); 00133 dxf_arc_set_color_value (arc, 0); 00134 dxf_arc_set_color_name (arc, strdup ("")); 00135 dxf_arc_set_transparency (arc, 0); 00136 dxf_arc_set_p0 (arc, dxf_point_new ()); 00137 dxf_point_init ((DxfPoint *) dxf_arc_get_p0 (arc)); 00138 dxf_arc_set_x0 (arc, 0.0); 00139 dxf_arc_set_y0 (arc, 0.0); 00140 dxf_arc_set_z0 (arc, 0.0); 00141 dxf_arc_set_radius (arc, 0.0); 00142 dxf_arc_set_start_angle (arc, 0.0); 00143 dxf_arc_set_end_angle (arc, 0.0); 00144 dxf_arc_set_extr_x0 (arc, 0.0); 00145 dxf_arc_set_extr_y0 (arc, 0.0); 00146 dxf_arc_set_extr_z0 (arc, 1.0); 00147 dxf_arc_set_next (arc, NULL); 00148 #if DEBUG 00149 DXF_DEBUG_END 00150 #endif 00151 return (arc); 00152 } 00153 00154 00166 DxfArc * 00167 dxf_arc_read 00168 ( 00169 DxfFile *fp, 00171 DxfArc *arc 00173 ) 00174 { 00175 #if DEBUG 00176 DXF_DEBUG_BEGIN 00177 #endif 00178 char *temp_string = NULL; 00179 00180 /* Do some basic checks. */ 00181 if (fp == NULL) 00182 { 00183 fprintf (stderr, 00184 (_("Error in %s () a NULL file pointer was passed.\n")), 00185 __FUNCTION__); 00186 /* Clean up. */ 00187 free (temp_string); 00188 return (NULL); 00189 } 00190 if (arc == NULL) 00191 { 00192 fprintf (stderr, 00193 (_("Warning in %s () a NULL pointer was passed.\n")), 00194 __FUNCTION__); 00195 arc = dxf_arc_new (); 00196 arc = dxf_arc_init (arc); 00197 } 00198 (fp->line_number)++; 00199 fscanf (fp->fp, "%[^\n]", temp_string); 00200 while (strcmp (temp_string, "0") != 0) 00201 { 00202 if (ferror (fp->fp)) 00203 { 00204 fprintf (stderr, 00205 (_("Error in %s () while reading from: %s in line: %d.\n")), 00206 __FUNCTION__, fp->filename, fp->line_number); 00207 fclose (fp->fp); 00208 /* Clean up. */ 00209 free (temp_string); 00210 return (NULL); 00211 } 00212 if (strcmp (temp_string, "5") == 0) 00213 { 00214 /* Now follows a string containing a sequential 00215 * id number. */ 00216 (fp->line_number)++; 00217 fscanf (fp->fp, "%x\n", &arc->id_code); 00218 } 00219 else if (strcmp (temp_string, "6") == 0) 00220 { 00221 /* Now follows a string containing a linetype 00222 * name. */ 00223 (fp->line_number)++; 00224 fscanf (fp->fp, "%s\n", arc->linetype); 00225 } 00226 else if (strcmp (temp_string, "8") == 0) 00227 { 00228 /* Now follows a string containing a layer name. */ 00229 (fp->line_number)++; 00230 fscanf (fp->fp, "%s\n", arc->layer); 00231 } 00232 else if (strcmp (temp_string, "10") == 0) 00233 { 00234 /* Now follows a string containing the 00235 * X-coordinate of the center point. */ 00236 (fp->line_number)++; 00237 fscanf (fp->fp, "%lf\n", &arc->p0->x0); 00238 } 00239 else if (strcmp (temp_string, "20") == 0) 00240 { 00241 /* Now follows a string containing the 00242 * Y-coordinate of the center point. */ 00243 (fp->line_number)++; 00244 fscanf (fp->fp, "%lf\n", &arc->p0->y0); 00245 } 00246 else if (strcmp (temp_string, "30") == 0) 00247 { 00248 /* Now follows a string containing the 00249 * Z-coordinate of the center point. */ 00250 (fp->line_number)++; 00251 fscanf (fp->fp, "%lf\n", &arc->p0->z0); 00252 } 00253 else if ((fp->acad_version_number <= AutoCAD_11) 00254 && (strcmp (temp_string, "38") == 0)) 00255 { 00256 /* Now follows a string containing the 00257 * elevation. */ 00258 (fp->line_number)++; 00259 fscanf (fp->fp, "%lf\n", &arc->elevation); 00260 } 00261 else if (strcmp (temp_string, "39") == 0) 00262 { 00263 /* Now follows a string containing the 00264 * thickness. */ 00265 (fp->line_number)++; 00266 fscanf (fp->fp, "%lf\n", &arc->thickness); 00267 } 00268 else if (strcmp (temp_string, "40") == 0) 00269 { 00270 /* Now follows a string containing the 00271 * radius. */ 00272 (fp->line_number)++; 00273 fscanf (fp->fp, "%lf\n", &arc->radius); 00274 } 00275 else if (strcmp (temp_string, "48") == 0) 00276 { 00277 /* Now follows a string containing the linetype 00278 * scale. */ 00279 (fp->line_number)++; 00280 fscanf (fp->fp, "%lf\n", &arc->linetype_scale); 00281 } 00282 else if (strcmp (temp_string, "50") == 0) 00283 { 00284 /* Now follows a string containing the 00285 * start angle. */ 00286 (fp->line_number)++; 00287 fscanf (fp->fp, "%lf\n", &arc->start_angle); 00288 } 00289 else if (strcmp (temp_string, "51") == 0) 00290 { 00291 /* Now follows a string containing the 00292 * end angle. */ 00293 (fp->line_number)++; 00294 fscanf (fp->fp, "%lf\n", &arc->end_angle); 00295 } 00296 else if (strcmp (temp_string, "60") == 0) 00297 { 00298 /* Now follows a string containing the 00299 * visibility value. */ 00300 (fp->line_number)++; 00301 fscanf (fp->fp, "%hd\n", &arc->visibility); 00302 } 00303 else if (strcmp (temp_string, "62") == 0) 00304 { 00305 /* Now follows a string containing the 00306 * color value. */ 00307 (fp->line_number)++; 00308 fscanf (fp->fp, "%d\n", &arc->color); 00309 } 00310 else if (strcmp (temp_string, "67") == 0) 00311 { 00312 /* Now follows a string containing the 00313 * paperspace value. */ 00314 (fp->line_number)++; 00315 fscanf (fp->fp, "%d\n", &arc->paperspace); 00316 } 00317 else if ((fp->acad_version_number >= AutoCAD_13) 00318 && (strcmp (temp_string, "100") == 0)) 00319 { 00320 /* Now follows a string containing the 00321 * subclass marker value. */ 00322 (fp->line_number)++; 00323 fscanf (fp->fp, "%s\n", temp_string); 00324 if ((strcmp (temp_string, "AcDbEntity") != 0) 00325 && ((strcmp (temp_string, "AcDbCircle") != 0))) 00326 { 00327 fprintf (stderr, 00328 (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")), 00329 __FUNCTION__, fp->filename, fp->line_number); 00330 } 00331 } 00332 else if (strcmp (temp_string, "210") == 0) 00333 { 00334 /* Now follows a string containing the 00335 * X-value of the extrusion vector. */ 00336 (fp->line_number)++; 00337 fscanf (fp->fp, "%lf\n", &arc->extr_x0); 00338 } 00339 else if (strcmp (temp_string, "220") == 0) 00340 { 00341 /* Now follows a string containing the 00342 * Y-value of the extrusion vector. */ 00343 (fp->line_number)++; 00344 fscanf (fp->fp, "%lf\n", &arc->extr_y0); 00345 } 00346 else if (strcmp (temp_string, "230") == 0) 00347 { 00348 /* Now follows a string containing the 00349 * Z-value of the extrusion vector. */ 00350 (fp->line_number)++; 00351 fscanf (fp->fp, "%lf\n", &arc->extr_z0); 00352 } 00353 else if (strcmp (temp_string, "330") == 0) 00354 { 00355 /* Now follows a string containing Soft-pointer 00356 * ID/handle to owner dictionary. */ 00357 (fp->line_number)++; 00358 fscanf (fp->fp, "%s\n", arc->dictionary_owner_soft); 00359 } 00360 else if (strcmp (temp_string, "360") == 0) 00361 { 00362 /* Now follows a string containing Hard owner 00363 * ID/handle to owner dictionary. */ 00364 (fp->line_number)++; 00365 fscanf (fp->fp, "%s\n", arc->dictionary_owner_hard); 00366 } 00367 else if (strcmp (temp_string, "999") == 0) 00368 { 00369 /* Now follows a string containing a comment. */ 00370 (fp->line_number)++; 00371 fscanf (fp->fp, "%s\n", temp_string); 00372 fprintf (stdout, "DXF comment: %s\n", temp_string); 00373 } 00374 else 00375 { 00376 fprintf (stderr, 00377 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00378 __FUNCTION__, fp->filename, fp->line_number); 00379 } 00380 } 00381 /* Handle omitted members and/or illegal values. */ 00382 if (strcmp (arc->linetype, "") == 0) 00383 { 00384 arc->linetype = strdup (DXF_DEFAULT_LINETYPE); 00385 } 00386 if (strcmp (arc->layer, "") == 0) 00387 { 00388 arc->layer = strdup (DXF_DEFAULT_LAYER); 00389 } 00390 /* Clean up. */ 00391 free (temp_string); 00392 #if DEBUG 00393 DXF_DEBUG_END 00394 #endif 00395 return (arc); 00396 } 00397 00398 00405 int 00406 dxf_arc_write 00407 ( 00408 DxfFile *fp, 00410 DxfArc *arc 00412 ) 00413 { 00414 #if DEBUG 00415 DXF_DEBUG_BEGIN 00416 #endif 00417 char *dxf_entity_name = strdup ("ARC"); 00418 00419 /* Do some basic checks. */ 00420 if (fp == NULL) 00421 { 00422 fprintf (stderr, 00423 (_("Error in %s () a NULL file pointer was passed.\n")), 00424 __FUNCTION__); 00425 /* Clean up. */ 00426 free (dxf_entity_name); 00427 return (EXIT_FAILURE); 00428 } 00429 if (arc == NULL) 00430 { 00431 fprintf (stderr, 00432 (_("Error in %s () a NULL pointer was passed.\n")), 00433 __FUNCTION__); 00434 /* Clean up. */ 00435 free (dxf_entity_name); 00436 return (EXIT_FAILURE); 00437 } 00438 if (dxf_arc_get_start_angle (arc) == dxf_arc_get_end_angle (arc)) 00439 { 00440 fprintf (stderr, 00441 (_("Error in %s () start angle and end angle are identical for the %s entity with id-code: %x.\n")), 00442 __FUNCTION__, dxf_entity_name, dxf_arc_get_id_code (arc)); 00443 fprintf (stderr, 00444 (_("\tskipping %s entity.\n")), dxf_entity_name); 00445 /* Clean up. */ 00446 free (dxf_entity_name); 00447 return (EXIT_FAILURE); 00448 } 00449 if (dxf_arc_get_start_angle (arc)> 360.0) 00450 { 00451 fprintf (stderr, "Error in dxf_arc_write () start angle is greater than 360 degrees for the %s entity with id-code: %x.\n", 00452 dxf_entity_name, dxf_arc_get_id_code (arc)); 00453 fprintf (stderr, "\tskipping %s entity.\n", 00454 dxf_entity_name); 00455 /* Clean up. */ 00456 free (dxf_entity_name); 00457 return (EXIT_FAILURE); 00458 } 00459 if (dxf_arc_get_start_angle (arc) < 0.0) 00460 { 00461 fprintf (stderr, "Error in dxf_arc_write () start angle is lesser than 0 degrees for the %s entity with id-code: %x.\n", 00462 dxf_entity_name, dxf_arc_get_id_code (arc)); 00463 fprintf (stderr, "\tskipping %s entity.\n", 00464 dxf_entity_name); 00465 /* Clean up. */ 00466 free (dxf_entity_name); 00467 return (EXIT_FAILURE); 00468 } 00469 if (dxf_arc_get_end_angle (arc) > 360.0) 00470 { 00471 fprintf (stderr, "Error in dxf_arc_write () end angle is greater than 360 degrees for the %s entity with id-code: %x.\n", 00472 dxf_entity_name, dxf_arc_get_id_code (arc)); 00473 fprintf (stderr, "\tskipping %s entity.\n", 00474 dxf_entity_name); 00475 /* Clean up. */ 00476 free (dxf_entity_name); 00477 return (EXIT_FAILURE); 00478 } 00479 if (dxf_arc_get_end_angle (arc) < 0.0) 00480 { 00481 fprintf (stderr, "Error in dxf_arc_write () end angle is lesser than 0 degrees for the %s entity with id-code: %x.\n", 00482 dxf_entity_name, dxf_arc_get_id_code (arc)); 00483 fprintf (stderr, "\tskipping %s entity.\n", 00484 dxf_entity_name); 00485 /* Clean up. */ 00486 free (dxf_entity_name); 00487 return (EXIT_FAILURE); 00488 } 00489 if (dxf_arc_get_radius (arc) == 0.0) 00490 { 00491 fprintf (stderr, "Error in dxf_arc_write () radius value equals 0.0 for the %s entity with id-code: %x.\n", 00492 dxf_entity_name, dxf_arc_get_id_code (arc)); 00493 fprintf (stderr, "\tskipping %s entity.\n", 00494 dxf_entity_name); 00495 /* Clean up. */ 00496 free (dxf_entity_name); 00497 return (EXIT_FAILURE); 00498 } 00499 if (strcmp (dxf_arc_get_linetype (arc), "") == 0) 00500 { 00501 fprintf (stderr, 00502 (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")), 00503 __FUNCTION__, dxf_entity_name, dxf_arc_get_id_code (arc)); 00504 fprintf (stderr, 00505 (_("\t%s entity is reset to default linetype")), 00506 dxf_entity_name); 00507 dxf_arc_set_linetype (arc, strdup (DXF_DEFAULT_LINETYPE)); 00508 } 00509 if (strcmp (dxf_arc_get_layer (arc), "") == 0) 00510 { 00511 fprintf (stderr, 00512 (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")), 00513 __FUNCTION__, dxf_entity_name, dxf_arc_get_id_code (arc)); 00514 fprintf (stderr, 00515 (_("\t%s entity is relocated to layer 0")), 00516 dxf_entity_name); 00517 dxf_arc_set_layer (arc, DXF_DEFAULT_LAYER); 00518 } 00519 /* Start writing output. */ 00520 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00521 if (dxf_arc_get_id_code (arc) != -1) 00522 { 00523 fprintf (fp->fp, " 5\n%x\n", dxf_arc_get_id_code (arc)); 00524 } 00535 if ((strcmp (dxf_arc_get_dictionary_owner_soft (arc), "") != 0) 00536 && (fp->acad_version_number >= AutoCAD_14)) 00537 { 00538 fprintf (fp->fp, "102\n{ACAD_REACTORS\n"); 00539 fprintf (fp->fp, "330\n%s\n", dxf_arc_get_dictionary_owner_soft (arc)); 00540 fprintf (fp->fp, "102\n}\n"); 00541 } 00542 if ((strcmp (dxf_arc_get_dictionary_owner_hard (arc), "") != 0) 00543 && (fp->acad_version_number >= AutoCAD_14)) 00544 { 00545 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n"); 00546 fprintf (fp->fp, "360\n%s\n", dxf_arc_get_dictionary_owner_hard (arc)); 00547 fprintf (fp->fp, "102\n}\n"); 00548 } 00549 if (fp->acad_version_number >= AutoCAD_13) 00550 { 00551 fprintf (fp->fp, "100\nAcDbEntity\n"); 00552 } 00553 if (dxf_arc_get_paperspace (arc) == DXF_PAPERSPACE) 00554 { 00555 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE); 00556 } 00557 fprintf (fp->fp, " 8\n%s\n", dxf_arc_get_layer (arc)); 00558 if (strcmp (dxf_arc_get_linetype (arc), DXF_DEFAULT_LINETYPE) != 0) 00559 { 00560 fprintf (fp->fp, " 6\n%s\n", dxf_arc_get_linetype (arc)); 00561 } 00562 if ((fp->acad_version_number <= AutoCAD_11) 00563 && DXF_FLATLAND 00564 && (dxf_arc_get_elevation (arc) != 0.0)) 00565 { 00566 fprintf (fp->fp, " 38\n%f\n", dxf_arc_get_elevation (arc)); 00567 } 00568 if (dxf_arc_get_color (arc) != DXF_COLOR_BYLAYER) 00569 { 00570 fprintf (fp->fp, " 62\n%d\n", dxf_arc_get_color (arc)); 00571 } 00572 if (dxf_arc_get_linetype_scale (arc) != 1.0) 00573 { 00574 fprintf (fp->fp, " 48\n%f\n", dxf_arc_get_linetype_scale (arc)); 00575 } 00576 if (dxf_arc_get_visibility (arc) != 0) 00577 { 00578 fprintf (fp->fp, " 60\n%d\n", dxf_arc_get_visibility (arc)); 00579 } 00580 if (fp->acad_version_number >= AutoCAD_13) 00581 { 00582 fprintf (fp->fp, "100\nAcDbCircle\n"); 00583 } 00584 if (dxf_arc_get_thickness (arc) != 0.0) 00585 { 00586 fprintf (fp->fp, " 39\n%f\n", dxf_arc_get_thickness (arc)); 00587 } 00588 fprintf (fp->fp, " 10\n%f\n", dxf_arc_get_x0 (arc)); 00589 fprintf (fp->fp, " 20\n%f\n", dxf_arc_get_y0 (arc)); 00590 fprintf (fp->fp, " 30\n%f\n", dxf_arc_get_z0 (arc)); 00591 fprintf (fp->fp, " 40\n%f\n", dxf_arc_get_radius (arc)); 00592 if (fp->acad_version_number >= AutoCAD_13) 00593 { 00594 fprintf (fp->fp, "100\nAcDbArc\n"); 00595 } 00596 fprintf (fp->fp, " 50\n%f\n", dxf_arc_get_start_angle (arc)); 00597 fprintf (fp->fp, " 51\n%f\n", dxf_arc_get_end_angle (arc)); 00598 if ((fp->acad_version_number >= AutoCAD_12) 00599 && (dxf_arc_get_extr_x0 (arc) != 0.0) 00600 && (dxf_arc_get_extr_y0 (arc) != 0.0) 00601 && (dxf_arc_get_extr_z0 (arc) != 1.0)) 00602 { 00603 fprintf (fp->fp, "210\n%f\n", dxf_arc_get_extr_x0 (arc)); 00604 fprintf (fp->fp, "220\n%f\n", dxf_arc_get_extr_y0 (arc)); 00605 fprintf (fp->fp, "230\n%f\n", dxf_arc_get_extr_z0 (arc)); 00606 } 00607 /* Clean up. */ 00608 free (dxf_entity_name); 00609 #if DEBUG 00610 DXF_DEBUG_END 00611 #endif 00612 return (EXIT_SUCCESS); 00613 } 00614 00615 00623 int 00624 dxf_arc_free 00625 ( 00626 DxfArc *arc 00629 ) 00630 { 00631 #if DEBUG 00632 DXF_DEBUG_BEGIN 00633 #endif 00634 /* Do some basic checks. */ 00635 if (arc == NULL) 00636 { 00637 fprintf (stderr, 00638 (_("Error in %s () a NULL pointer was passed.\n")), 00639 __FUNCTION__); 00640 return (EXIT_FAILURE); 00641 } 00642 if (arc->next != NULL) 00643 { 00644 fprintf (stderr, 00645 (_("Error in %s () pointer to next was not NULL.\n")), 00646 __FUNCTION__); 00647 return (EXIT_FAILURE); 00648 } 00649 free (arc->linetype); 00650 free (arc->layer); 00651 free (arc->dictionary_owner_soft); 00652 free (arc->material); 00653 free (arc->dictionary_owner_hard); 00654 free (arc->plot_style_name); 00655 free (arc->color_name); 00656 dxf_point_free (arc->p0); 00657 free (arc); 00658 arc = NULL; 00659 #if DEBUG 00660 DXF_DEBUG_END 00661 #endif 00662 return (EXIT_SUCCESS); 00663 } 00664 00665 00670 void 00671 dxf_arc_free_chain 00672 ( 00673 DxfArc *arcs 00675 ) 00676 { 00677 #ifdef DEBUG 00678 DXF_DEBUG_BEGIN 00679 #endif 00680 if (arcs == NULL) 00681 { 00682 fprintf (stderr, 00683 (_("Warning in %s () a NULL pointer was passed.\n")), 00684 __FUNCTION__); 00685 } 00686 while (arcs != NULL) 00687 { 00688 struct DxfArc *iter = arcs->next; 00689 dxf_arc_free (arcs); 00690 arcs = (DxfArc *) iter; 00691 } 00692 #if DEBUG 00693 DXF_DEBUG_END 00694 #endif 00695 } 00696 00697 00703 int 00704 dxf_arc_get_id_code 00705 ( 00706 DxfArc *arc 00708 ) 00709 { 00710 #if DEBUG 00711 DXF_DEBUG_BEGIN 00712 #endif 00713 /* Do some basic checks. */ 00714 if (arc == NULL) 00715 { 00716 fprintf (stderr, 00717 (_("Error in %s () a NULL pointer was passed.\n")), 00718 __FUNCTION__); 00719 return (EXIT_FAILURE); 00720 } 00721 if (arc->id_code < 0) 00722 { 00723 fprintf (stderr, 00724 (_("Warning in %s () a negative value was found.\n")), 00725 __FUNCTION__); 00726 } 00727 #if DEBUG 00728 DXF_DEBUG_END 00729 #endif 00730 return (arc->id_code); 00731 } 00732 00733 00737 DxfArc * 00738 dxf_arc_set_id_code 00739 ( 00740 DxfArc *arc, 00742 int id_code 00746 ) 00747 { 00748 #if DEBUG 00749 DXF_DEBUG_BEGIN 00750 #endif 00751 /* Do some basic checks. */ 00752 if (arc == NULL) 00753 { 00754 fprintf (stderr, 00755 (_("Error in %s () a NULL pointer was passed.\n")), 00756 __FUNCTION__); 00757 return (NULL); 00758 } 00759 if (id_code < 0) 00760 { 00761 fprintf (stderr, 00762 (_("Warning in %s () a negative value was passed.\n")), 00763 __FUNCTION__); 00764 } 00765 arc->id_code = id_code; 00766 #if DEBUG 00767 DXF_DEBUG_END 00768 #endif 00769 return (arc); 00770 } 00771 00772 00778 char * 00779 dxf_arc_get_linetype 00780 ( 00781 DxfArc *arc 00783 ) 00784 { 00785 #if DEBUG 00786 DXF_DEBUG_BEGIN 00787 #endif 00788 /* Do some basic checks. */ 00789 if (arc == NULL) 00790 { 00791 fprintf (stderr, 00792 (_("Error in %s () a NULL pointer was passed.\n")), 00793 __FUNCTION__); 00794 return (NULL); 00795 } 00796 if (arc->linetype == NULL) 00797 { 00798 fprintf (stderr, 00799 (_("Error in %s () a NULL pointer was found.\n")), 00800 __FUNCTION__); 00801 return (NULL); 00802 } 00803 #if DEBUG 00804 DXF_DEBUG_END 00805 #endif 00806 return (strdup (arc->linetype)); 00807 } 00808 00809 00813 DxfArc * 00814 dxf_arc_set_linetype 00815 ( 00816 DxfArc *arc, 00818 char *linetype 00821 ) 00822 { 00823 #if DEBUG 00824 DXF_DEBUG_BEGIN 00825 #endif 00826 /* Do some basic checks. */ 00827 if (arc == NULL) 00828 { 00829 fprintf (stderr, 00830 (_("Error in %s () a NULL pointer was passed.\n")), 00831 __FUNCTION__); 00832 return (NULL); 00833 } 00834 if (linetype == NULL) 00835 { 00836 fprintf (stderr, 00837 (_("Error in %s () a NULL pointer was passed.\n")), 00838 __FUNCTION__); 00839 return (NULL); 00840 } 00841 arc->linetype = strdup (linetype); 00842 #if DEBUG 00843 DXF_DEBUG_END 00844 #endif 00845 return (arc); 00846 } 00847 00848 00854 char * 00855 dxf_arc_get_layer 00856 ( 00857 DxfArc *arc 00859 ) 00860 { 00861 #if DEBUG 00862 DXF_DEBUG_BEGIN 00863 #endif 00864 /* Do some basic checks. */ 00865 if (arc == NULL) 00866 { 00867 fprintf (stderr, 00868 (_("Error in %s () a NULL pointer was passed.\n")), 00869 __FUNCTION__); 00870 return (NULL); 00871 } 00872 if (arc->layer == NULL) 00873 { 00874 fprintf (stderr, 00875 (_("Error in %s () a NULL pointer was found.\n")), 00876 __FUNCTION__); 00877 return (NULL); 00878 } 00879 #if DEBUG 00880 DXF_DEBUG_END 00881 #endif 00882 return (strdup (arc->layer)); 00883 } 00884 00885 00889 DxfArc * 00890 dxf_arc_set_layer 00891 ( 00892 DxfArc *arc, 00894 char *layer 00897 ) 00898 { 00899 #if DEBUG 00900 DXF_DEBUG_BEGIN 00901 #endif 00902 /* Do some basic checks. */ 00903 if (arc == NULL) 00904 { 00905 fprintf (stderr, 00906 (_("Error in %s () a NULL pointer was passed.\n")), 00907 __FUNCTION__); 00908 return (NULL); 00909 } 00910 if (layer == NULL) 00911 { 00912 fprintf (stderr, 00913 (_("Error in %s () a NULL pointer was passed.\n")), 00914 __FUNCTION__); 00915 return (NULL); 00916 } 00917 arc->layer = strdup (layer); 00918 #if DEBUG 00919 DXF_DEBUG_END 00920 #endif 00921 return (arc); 00922 } 00923 00924 00930 double 00931 dxf_arc_get_elevation 00932 ( 00933 DxfArc *arc 00935 ) 00936 { 00937 #if DEBUG 00938 DXF_DEBUG_BEGIN 00939 #endif 00940 /* Do some basic checks. */ 00941 if (arc == NULL) 00942 { 00943 fprintf (stderr, 00944 (_("Error in %s () a NULL pointer was passed.\n")), 00945 __FUNCTION__); 00946 return (EXIT_FAILURE); 00947 } 00948 #if DEBUG 00949 DXF_DEBUG_END 00950 #endif 00951 return (arc->elevation); 00952 } 00953 00954 00958 DxfArc * 00959 dxf_arc_set_elevation 00960 ( 00961 DxfArc *arc, 00963 double elevation 00965 ) 00966 { 00967 #if DEBUG 00968 DXF_DEBUG_BEGIN 00969 #endif 00970 /* Do some basic checks. */ 00971 if (arc == NULL) 00972 { 00973 fprintf (stderr, 00974 (_("Error in %s () a NULL pointer was passed.\n")), 00975 __FUNCTION__); 00976 return (NULL); 00977 } 00978 arc->elevation = elevation; 00979 #if DEBUG 00980 DXF_DEBUG_END 00981 #endif 00982 return (arc); 00983 } 00984 00985 00991 double 00992 dxf_arc_get_thickness 00993 ( 00994 DxfArc *arc 00996 ) 00997 { 00998 #if DEBUG 00999 DXF_DEBUG_BEGIN 01000 #endif 01001 /* Do some basic checks. */ 01002 if (arc == NULL) 01003 { 01004 fprintf (stderr, 01005 (_("Error in %s () a NULL pointer was passed.\n")), 01006 __FUNCTION__); 01007 return (EXIT_FAILURE); 01008 } 01009 if (arc->thickness < 0.0) 01010 { 01011 fprintf (stderr, 01012 (_("Error in %s () a negative value was found.\n")), 01013 __FUNCTION__); 01014 return (EXIT_FAILURE); 01015 } 01016 #if DEBUG 01017 DXF_DEBUG_END 01018 #endif 01019 return (arc->thickness); 01020 } 01021 01022 01026 DxfArc * 01027 dxf_arc_set_thickness 01028 ( 01029 DxfArc *arc, 01031 double thickness 01033 ) 01034 { 01035 #if DEBUG 01036 DXF_DEBUG_BEGIN 01037 #endif 01038 /* Do some basic checks. */ 01039 if (arc == NULL) 01040 { 01041 fprintf (stderr, 01042 (_("Error in %s () a NULL pointer was passed.\n")), 01043 __FUNCTION__); 01044 return (NULL); 01045 } 01046 if (thickness < 0.0) 01047 { 01048 fprintf (stderr, 01049 (_("Error in %s () a negative value was passed.\n")), 01050 __FUNCTION__); 01051 return (NULL); 01052 } 01053 arc->thickness = thickness; 01054 #if DEBUG 01055 DXF_DEBUG_END 01056 #endif 01057 return (arc); 01058 } 01059 01060 01066 double 01067 dxf_arc_get_linetype_scale 01068 ( 01069 DxfArc *arc 01071 ) 01072 { 01073 #if DEBUG 01074 DXF_DEBUG_BEGIN 01075 #endif 01076 /* Do some basic checks. */ 01077 if (arc == NULL) 01078 { 01079 fprintf (stderr, 01080 (_("Error in %s () a NULL pointer was passed.\n")), 01081 __FUNCTION__); 01082 return (EXIT_FAILURE); 01083 } 01084 if (arc->linetype_scale < 0.0) 01085 { 01086 fprintf (stderr, 01087 (_("Error in %s () a negative value was found.\n")), 01088 __FUNCTION__); 01089 return (EXIT_FAILURE); 01090 } 01091 #if DEBUG 01092 DXF_DEBUG_END 01093 #endif 01094 return (arc->linetype_scale); 01095 } 01096 01097 01101 DxfArc * 01102 dxf_arc_set_linetype_scale 01103 ( 01104 DxfArc *arc, 01106 double linetype_scale 01108 ) 01109 { 01110 #if DEBUG 01111 DXF_DEBUG_BEGIN 01112 #endif 01113 /* Do some basic checks. */ 01114 if (arc == NULL) 01115 { 01116 fprintf (stderr, 01117 (_("Error in %s () a NULL pointer was passed.\n")), 01118 __FUNCTION__); 01119 return (NULL); 01120 } 01121 if (linetype_scale < 0.0) 01122 { 01123 fprintf (stderr, 01124 (_("Error in %s () a negative value was passed.\n")), 01125 __FUNCTION__); 01126 return (NULL); 01127 } 01128 arc->linetype_scale = linetype_scale; 01129 #if DEBUG 01130 DXF_DEBUG_END 01131 #endif 01132 return (arc); 01133 } 01134 01135 01141 int16_t 01142 dxf_arc_get_visibility 01143 ( 01144 DxfArc *arc 01146 ) 01147 { 01148 #if DEBUG 01149 DXF_DEBUG_BEGIN 01150 #endif 01151 /* Do some basic checks. */ 01152 if (arc == NULL) 01153 { 01154 fprintf (stderr, 01155 (_("Error in %s () a NULL pointer was passed.\n")), 01156 __FUNCTION__); 01157 return (EXIT_FAILURE); 01158 } 01159 if (arc->visibility < 0) 01160 { 01161 fprintf (stderr, 01162 (_("Error in %s () a negative value was found.\n")), 01163 __FUNCTION__); 01164 return (EXIT_FAILURE); 01165 } 01166 if (arc->visibility > 1) 01167 { 01168 fprintf (stderr, 01169 (_("Error in %s () an out of range value was found.\n")), 01170 __FUNCTION__); 01171 return (EXIT_FAILURE); 01172 } 01173 #if DEBUG 01174 DXF_DEBUG_END 01175 #endif 01176 return (arc->visibility); 01177 } 01178 01179 01183 DxfArc * 01184 dxf_arc_set_visibility 01185 ( 01186 DxfArc *arc, 01188 int16_t visibility 01190 ) 01191 { 01192 #if DEBUG 01193 DXF_DEBUG_BEGIN 01194 #endif 01195 /* Do some basic checks. */ 01196 if (arc == NULL) 01197 { 01198 fprintf (stderr, 01199 (_("Error in %s () a NULL pointer was passed.\n")), 01200 __FUNCTION__); 01201 return (NULL); 01202 } 01203 if (visibility < 0) 01204 { 01205 fprintf (stderr, 01206 (_("Error in %s () a negative value was passed.\n")), 01207 __FUNCTION__); 01208 return (NULL); 01209 } 01210 if (visibility > 1) 01211 { 01212 fprintf (stderr, 01213 (_("Error in %s () an out of range value was passed.\n")), 01214 __FUNCTION__); 01215 return (NULL); 01216 } 01217 arc->visibility = visibility; 01218 #if DEBUG 01219 DXF_DEBUG_END 01220 #endif 01221 return (arc); 01222 } 01223 01224 01230 int 01231 dxf_arc_get_color 01232 ( 01233 DxfArc *arc 01235 ) 01236 { 01237 #if DEBUG 01238 DXF_DEBUG_BEGIN 01239 #endif 01240 /* Do some basic checks. */ 01241 if (arc == NULL) 01242 { 01243 fprintf (stderr, 01244 (_("Error in %s () a NULL pointer was passed.\n")), 01245 __FUNCTION__); 01246 return (EXIT_FAILURE); 01247 } 01248 if (arc->color < 0) 01249 { 01250 fprintf (stderr, 01251 (_("Warning in %s () a negative value was found.\n")), 01252 __FUNCTION__); 01253 } 01254 #if DEBUG 01255 DXF_DEBUG_END 01256 #endif 01257 return (arc->color); 01258 } 01259 01260 01264 DxfArc * 01265 dxf_arc_set_color 01266 ( 01267 DxfArc *arc, 01269 int color 01271 ) 01272 { 01273 #if DEBUG 01274 DXF_DEBUG_BEGIN 01275 #endif 01276 /* Do some basic checks. */ 01277 if (arc == NULL) 01278 { 01279 fprintf (stderr, 01280 (_("Error in %s () a NULL pointer was passed.\n")), 01281 __FUNCTION__); 01282 return (NULL); 01283 } 01284 if (color < 0) 01285 { 01286 fprintf (stderr, 01287 (_("Warning in %s () a negative value was passed.\n")), 01288 __FUNCTION__); 01289 } 01290 arc->color = color; 01291 #if DEBUG 01292 DXF_DEBUG_END 01293 #endif 01294 return (arc); 01295 } 01296 01297 01303 int 01304 dxf_arc_get_paperspace 01305 ( 01306 DxfArc *arc 01308 ) 01309 { 01310 #if DEBUG 01311 DXF_DEBUG_BEGIN 01312 #endif 01313 /* Do some basic checks. */ 01314 if (arc == NULL) 01315 { 01316 fprintf (stderr, 01317 (_("Error in %s () a NULL pointer was passed.\n")), 01318 __FUNCTION__); 01319 return (EXIT_FAILURE); 01320 } 01321 if (arc->paperspace < 0) 01322 { 01323 fprintf (stderr, 01324 (_("Warning in %s () a negative value was found.\n")), 01325 __FUNCTION__); 01326 } 01327 if (arc->paperspace > 1) 01328 { 01329 fprintf (stderr, 01330 (_("Warning in %s () an out of range value was found.\n")), 01331 __FUNCTION__); 01332 } 01333 #if DEBUG 01334 DXF_DEBUG_END 01335 #endif 01336 return (arc->paperspace); 01337 } 01338 01339 01343 DxfArc * 01344 dxf_arc_set_paperspace 01345 ( 01346 DxfArc *arc, 01348 int paperspace 01351 ) 01352 { 01353 #if DEBUG 01354 DXF_DEBUG_BEGIN 01355 #endif 01356 /* Do some basic checks. */ 01357 if (arc == NULL) 01358 { 01359 fprintf (stderr, 01360 (_("Error in %s () a NULL pointer was passed.\n")), 01361 __FUNCTION__); 01362 return (NULL); 01363 } 01364 if (paperspace < 0) 01365 { 01366 fprintf (stderr, 01367 (_("Error in %s () a negative value was passed.\n")), 01368 __FUNCTION__); 01369 return (NULL); 01370 } 01371 if (paperspace > 1) 01372 { 01373 fprintf (stderr, 01374 (_("Error in %s () an out of range value was passed.\n")), 01375 __FUNCTION__); 01376 return (NULL); 01377 } 01378 arc->paperspace = paperspace; 01379 #if DEBUG 01380 DXF_DEBUG_END 01381 #endif 01382 return (arc); 01383 } 01384 01385 01392 int 01393 dxf_arc_get_graphics_data_size 01394 ( 01395 DxfArc *arc 01397 ) 01398 { 01399 #if DEBUG 01400 DXF_DEBUG_BEGIN 01401 #endif 01402 /* Do some basic checks. */ 01403 if (arc == NULL) 01404 { 01405 fprintf (stderr, 01406 (_("Error in %s () a NULL pointer was passed.\n")), 01407 __FUNCTION__); 01408 return (EXIT_FAILURE); 01409 } 01410 if (arc->graphics_data_size < 0) 01411 { 01412 fprintf (stderr, 01413 (_("Warning in %s () a negative value was found.\n")), 01414 __FUNCTION__); 01415 } 01416 if (arc->graphics_data_size == 0) 01417 { 01418 fprintf (stderr, 01419 (_("Warning in %s () a zero value was found.\n")), 01420 __FUNCTION__); 01421 } 01422 #if DEBUG 01423 DXF_DEBUG_END 01424 #endif 01425 return (arc->graphics_data_size); 01426 } 01427 01428 01435 DxfArc * 01436 dxf_arc_set_graphics_data_size 01437 ( 01438 DxfArc *arc, 01440 int graphics_data_size 01443 ) 01444 { 01445 #if DEBUG 01446 DXF_DEBUG_BEGIN 01447 #endif 01448 /* Do some basic checks. */ 01449 if (arc == NULL) 01450 { 01451 fprintf (stderr, 01452 (_("Error in %s () a NULL pointer was passed.\n")), 01453 __FUNCTION__); 01454 return (NULL); 01455 } 01456 if (graphics_data_size < 0) 01457 { 01458 fprintf (stderr, 01459 (_("Error in %s () a negative value was passed.\n")), 01460 __FUNCTION__); 01461 return (NULL); 01462 } 01463 if (graphics_data_size == 0) 01464 { 01465 fprintf (stderr, 01466 (_("Warning in %s () a zero value was passed.\n")), 01467 __FUNCTION__); 01468 } 01469 arc->graphics_data_size = graphics_data_size; 01470 #if DEBUG 01471 DXF_DEBUG_END 01472 #endif 01473 return (arc); 01474 } 01475 01476 01483 int16_t 01484 dxf_arc_get_shadow_mode 01485 ( 01486 DxfArc *arc 01488 ) 01489 { 01490 #if DEBUG 01491 DXF_DEBUG_BEGIN 01492 #endif 01493 /* Do some basic checks. */ 01494 if (arc == NULL) 01495 { 01496 fprintf (stderr, 01497 (_("Error in %s () a NULL pointer was passed.\n")), 01498 __FUNCTION__); 01499 return (EXIT_FAILURE); 01500 } 01501 if (arc->shadow_mode < 0) 01502 { 01503 fprintf (stderr, 01504 (_("Error in %s () a negative value was found.\n")), 01505 __FUNCTION__); 01506 return (EXIT_FAILURE); 01507 } 01508 if (arc->shadow_mode > 3) 01509 { 01510 fprintf (stderr, 01511 (_("Error in %s () an out of range value was found.\n")), 01512 __FUNCTION__); 01513 return (EXIT_FAILURE); 01514 } 01515 #if DEBUG 01516 DXF_DEBUG_END 01517 #endif 01518 return (arc->shadow_mode); 01519 } 01520 01521 01528 DxfArc * 01529 dxf_arc_set_shadow_mode 01530 ( 01531 DxfArc *arc, 01533 int16_t shadow_mode 01535 ) 01536 { 01537 #if DEBUG 01538 DXF_DEBUG_BEGIN 01539 #endif 01540 /* Do some basic checks. */ 01541 if (arc == NULL) 01542 { 01543 fprintf (stderr, 01544 (_("Error in %s () a NULL pointer was passed.\n")), 01545 __FUNCTION__); 01546 return (NULL); 01547 } 01548 if (shadow_mode < 0) 01549 { 01550 fprintf (stderr, 01551 (_("Error in %s () a negative value was passed.\n")), 01552 __FUNCTION__); 01553 return (NULL); 01554 } 01555 if (shadow_mode > 3) 01556 { 01557 fprintf (stderr, 01558 (_("Error in %s () an out of range value was passed.\n")), 01559 __FUNCTION__); 01560 return (NULL); 01561 } 01562 arc->shadow_mode = shadow_mode; 01563 #if DEBUG 01564 DXF_DEBUG_END 01565 #endif 01566 return (arc); 01567 } 01568 01569 01578 DxfBinaryGraphicsData * 01579 dxf_arc_get_binary_graphics_data 01580 ( 01581 DxfArc *arc 01583 ) 01584 { 01585 #if DEBUG 01586 DXF_DEBUG_BEGIN 01587 #endif 01588 /* Do some basic checks. */ 01589 if (arc == NULL) 01590 { 01591 fprintf (stderr, 01592 (_("Error in %s () a NULL pointer was passed.\n")), 01593 __FUNCTION__); 01594 return (NULL); 01595 } 01596 if (arc->binary_graphics_data == NULL) 01597 { 01598 fprintf (stderr, 01599 (_("Error in %s () a NULL pointer was found.\n")), 01600 __FUNCTION__); 01601 return (NULL); 01602 } 01603 #if DEBUG 01604 DXF_DEBUG_END 01605 #endif 01606 return ((DxfBinaryGraphicsData *) arc->binary_graphics_data); 01607 } 01608 01609 01614 DxfArc * 01615 dxf_arc_set_binary_graphics_data 01616 ( 01617 DxfArc *arc, 01619 DxfBinaryGraphicsData *data 01622 ) 01623 { 01624 #if DEBUG 01625 DXF_DEBUG_BEGIN 01626 #endif 01627 /* Do some basic checks. */ 01628 if (arc == NULL) 01629 { 01630 fprintf (stderr, 01631 (_("Error in %s () a NULL pointer was passed.\n")), 01632 __FUNCTION__); 01633 return (NULL); 01634 } 01635 if (data == NULL) 01636 { 01637 fprintf (stderr, 01638 (_("Error in %s () a NULL pointer was passed.\n")), 01639 __FUNCTION__); 01640 return (NULL); 01641 } 01642 arc->binary_graphics_data = (DxfBinaryGraphicsData *) data; 01643 #if DEBUG 01644 DXF_DEBUG_END 01645 #endif 01646 return (arc); 01647 } 01648 01649 01658 char * 01659 dxf_arc_get_dictionary_owner_soft 01660 ( 01661 DxfArc *arc 01663 ) 01664 { 01665 #if DEBUG 01666 DXF_DEBUG_BEGIN 01667 #endif 01668 /* Do some basic checks. */ 01669 if (arc == NULL) 01670 { 01671 fprintf (stderr, 01672 (_("Error in %s () a NULL pointer was passed.\n")), 01673 __FUNCTION__); 01674 return (NULL); 01675 } 01676 if (arc->dictionary_owner_soft == NULL) 01677 { 01678 fprintf (stderr, 01679 (_("Error in %s () a NULL pointer was found.\n")), 01680 __FUNCTION__); 01681 return (NULL); 01682 } 01683 #if DEBUG 01684 DXF_DEBUG_END 01685 #endif 01686 return (strdup (arc->dictionary_owner_soft)); 01687 } 01688 01689 01694 DxfArc * 01695 dxf_arc_set_dictionary_owner_soft 01696 ( 01697 DxfArc *arc, 01699 char *dictionary_owner_soft 01702 ) 01703 { 01704 #if DEBUG 01705 DXF_DEBUG_BEGIN 01706 #endif 01707 /* Do some basic checks. */ 01708 if (arc == NULL) 01709 { 01710 fprintf (stderr, 01711 (_("Error in %s () a NULL pointer was passed.\n")), 01712 __FUNCTION__); 01713 return (NULL); 01714 } 01715 if (dictionary_owner_soft == NULL) 01716 { 01717 fprintf (stderr, 01718 (_("Error in %s () a NULL pointer was passed.\n")), 01719 __FUNCTION__); 01720 return (NULL); 01721 } 01722 arc->dictionary_owner_soft = strdup (dictionary_owner_soft); 01723 #if DEBUG 01724 DXF_DEBUG_END 01725 #endif 01726 return (arc); 01727 } 01728 01729 01738 char * 01739 dxf_arc_get_material 01740 ( 01741 DxfArc *arc 01743 ) 01744 { 01745 #if DEBUG 01746 DXF_DEBUG_BEGIN 01747 #endif 01748 /* Do some basic checks. */ 01749 if (arc == NULL) 01750 { 01751 fprintf (stderr, 01752 (_("Error in %s () a NULL pointer was passed.\n")), 01753 __FUNCTION__); 01754 return (NULL); 01755 } 01756 if (arc->material == NULL) 01757 { 01758 fprintf (stderr, 01759 (_("Error in %s () a NULL pointer was found.\n")), 01760 __FUNCTION__); 01761 return (NULL); 01762 } 01763 #if DEBUG 01764 DXF_DEBUG_END 01765 #endif 01766 return (strdup (arc->material)); 01767 } 01768 01769 01776 DxfArc * 01777 dxf_arc_set_material 01778 ( 01779 DxfArc *arc, 01781 char *material 01784 ) 01785 { 01786 #if DEBUG 01787 DXF_DEBUG_BEGIN 01788 #endif 01789 /* Do some basic checks. */ 01790 if (arc == NULL) 01791 { 01792 fprintf (stderr, 01793 (_("Error in %s () a NULL pointer was passed.\n")), 01794 __FUNCTION__); 01795 return (NULL); 01796 } 01797 if (material == NULL) 01798 { 01799 fprintf (stderr, 01800 (_("Error in %s () a NULL pointer was passed.\n")), 01801 __FUNCTION__); 01802 return (NULL); 01803 } 01804 arc->material = strdup (material); 01805 #if DEBUG 01806 DXF_DEBUG_END 01807 #endif 01808 return (arc); 01809 } 01810 01811 01820 char * 01821 dxf_arc_get_dictionary_owner_hard 01822 ( 01823 DxfArc *arc 01825 ) 01826 { 01827 #if DEBUG 01828 DXF_DEBUG_BEGIN 01829 #endif 01830 /* Do some basic checks. */ 01831 if (arc == NULL) 01832 { 01833 fprintf (stderr, 01834 (_("Error in %s () a NULL pointer was passed.\n")), 01835 __FUNCTION__); 01836 return (NULL); 01837 } 01838 if (arc->dictionary_owner_hard == NULL) 01839 { 01840 fprintf (stderr, 01841 (_("Error in %s () a NULL pointer was found.\n")), 01842 __FUNCTION__); 01843 return (NULL); 01844 } 01845 #if DEBUG 01846 DXF_DEBUG_END 01847 #endif 01848 return (strdup (arc->dictionary_owner_hard)); 01849 } 01850 01851 01856 DxfArc * 01857 dxf_arc_set_dictionary_owner_hard 01858 ( 01859 DxfArc *arc, 01861 char *dictionary_owner_hard 01864 ) 01865 { 01866 #if DEBUG 01867 DXF_DEBUG_BEGIN 01868 #endif 01869 /* Do some basic checks. */ 01870 if (arc == NULL) 01871 { 01872 fprintf (stderr, 01873 (_("Error in %s () a NULL pointer was passed.\n")), 01874 __FUNCTION__); 01875 return (NULL); 01876 } 01877 if (dictionary_owner_hard == NULL) 01878 { 01879 fprintf (stderr, 01880 (_("Error in %s () a NULL pointer was passed.\n")), 01881 __FUNCTION__); 01882 return (NULL); 01883 } 01884 arc->dictionary_owner_hard = strdup (dictionary_owner_hard); 01885 #if DEBUG 01886 DXF_DEBUG_END 01887 #endif 01888 return (arc); 01889 } 01890 01891 01898 int16_t 01899 dxf_arc_get_lineweight 01900 ( 01901 DxfArc *arc 01903 ) 01904 { 01905 #if DEBUG 01906 DXF_DEBUG_BEGIN 01907 #endif 01908 /* Do some basic checks. */ 01909 if (arc == NULL) 01910 { 01911 fprintf (stderr, 01912 (_("Error in %s () a NULL pointer was passed.\n")), 01913 __FUNCTION__); 01914 return (EXIT_FAILURE); 01915 } 01916 #if DEBUG 01917 DXF_DEBUG_END 01918 #endif 01919 return (arc->lineweight); 01920 } 01921 01922 01929 DxfArc * 01930 dxf_arc_set_lineweight 01931 ( 01932 DxfArc *arc, 01934 int16_t lineweight 01936 ) 01937 { 01938 #if DEBUG 01939 DXF_DEBUG_BEGIN 01940 #endif 01941 /* Do some basic checks. */ 01942 if (arc == NULL) 01943 { 01944 fprintf (stderr, 01945 (_("Error in %s () a NULL pointer was passed.\n")), 01946 __FUNCTION__); 01947 return (NULL); 01948 } 01949 arc->lineweight = lineweight; 01950 #if DEBUG 01951 DXF_DEBUG_END 01952 #endif 01953 return (arc); 01954 } 01955 01956 01963 char * 01964 dxf_arc_get_plot_style_name 01965 ( 01966 DxfArc *arc 01968 ) 01969 { 01970 #if DEBUG 01971 DXF_DEBUG_BEGIN 01972 #endif 01973 /* Do some basic checks. */ 01974 if (arc == NULL) 01975 { 01976 fprintf (stderr, 01977 (_("Error in %s () a NULL pointer was passed.\n")), 01978 __FUNCTION__); 01979 return (NULL); 01980 } 01981 if (arc->plot_style_name == NULL) 01982 { 01983 fprintf (stderr, 01984 (_("Error in %s () a NULL pointer was found.\n")), 01985 __FUNCTION__); 01986 return (NULL); 01987 } 01988 #if DEBUG 01989 DXF_DEBUG_END 01990 #endif 01991 return (strdup (arc->plot_style_name)); 01992 } 01993 01994 02001 DxfArc * 02002 dxf_arc_set_plot_style_name 02003 ( 02004 DxfArc *arc, 02006 char *plot_style_name 02009 ) 02010 { 02011 #if DEBUG 02012 DXF_DEBUG_BEGIN 02013 #endif 02014 /* Do some basic checks. */ 02015 if (arc == NULL) 02016 { 02017 fprintf (stderr, 02018 (_("Error in %s () a NULL pointer was passed.\n")), 02019 __FUNCTION__); 02020 return (NULL); 02021 } 02022 if (plot_style_name == NULL) 02023 { 02024 fprintf (stderr, 02025 (_("Error in %s () a NULL pointer was passed.\n")), 02026 __FUNCTION__); 02027 return (NULL); 02028 } 02029 arc->plot_style_name = strdup (plot_style_name); 02030 #if DEBUG 02031 DXF_DEBUG_END 02032 #endif 02033 return (arc); 02034 } 02035 02036 02043 long 02044 dxf_arc_get_color_value 02045 ( 02046 DxfArc *arc 02048 ) 02049 { 02050 #if DEBUG 02051 DXF_DEBUG_BEGIN 02052 #endif 02053 /* Do some basic checks. */ 02054 if (arc == NULL) 02055 { 02056 fprintf (stderr, 02057 (_("Error in %s () a NULL pointer was passed.\n")), 02058 __FUNCTION__); 02059 return (EXIT_FAILURE); 02060 } 02061 #if DEBUG 02062 DXF_DEBUG_END 02063 #endif 02064 return (arc->color_value); 02065 } 02066 02067 02074 DxfArc * 02075 dxf_arc_set_color_value 02076 ( 02077 DxfArc *arc, 02079 long color_value 02081 ) 02082 { 02083 #if DEBUG 02084 DXF_DEBUG_BEGIN 02085 #endif 02086 /* Do some basic checks. */ 02087 if (arc == NULL) 02088 { 02089 fprintf (stderr, 02090 (_("Error in %s () a NULL pointer was passed.\n")), 02091 __FUNCTION__); 02092 return (NULL); 02093 } 02094 arc->color_value = color_value; 02095 #if DEBUG 02096 DXF_DEBUG_END 02097 #endif 02098 return (arc); 02099 } 02100 02101 02108 char * 02109 dxf_arc_get_color_name 02110 ( 02111 DxfArc *arc 02113 ) 02114 { 02115 #if DEBUG 02116 DXF_DEBUG_BEGIN 02117 #endif 02118 /* Do some basic checks. */ 02119 if (arc == NULL) 02120 { 02121 fprintf (stderr, 02122 (_("Error in %s () a NULL pointer was passed.\n")), 02123 __FUNCTION__); 02124 return (NULL); 02125 } 02126 if (arc->color_name == NULL) 02127 { 02128 fprintf (stderr, 02129 (_("Error in %s () a NULL pointer was found.\n")), 02130 __FUNCTION__); 02131 return (NULL); 02132 } 02133 #if DEBUG 02134 DXF_DEBUG_END 02135 #endif 02136 return (strdup (arc->color_name)); 02137 } 02138 02139 02146 DxfArc * 02147 dxf_arc_set_color_name 02148 ( 02149 DxfArc *arc, 02151 char *color_name 02154 ) 02155 { 02156 #if DEBUG 02157 DXF_DEBUG_BEGIN 02158 #endif 02159 /* Do some basic checks. */ 02160 if (arc == NULL) 02161 { 02162 fprintf (stderr, 02163 (_("Error in %s () a NULL pointer was passed.\n")), 02164 __FUNCTION__); 02165 return (NULL); 02166 } 02167 if (color_name == NULL) 02168 { 02169 fprintf (stderr, 02170 (_("Error in %s () a NULL pointer was passed.\n")), 02171 __FUNCTION__); 02172 return (NULL); 02173 } 02174 arc->color_name = strdup (color_name); 02175 #if DEBUG 02176 DXF_DEBUG_END 02177 #endif 02178 return (arc); 02179 } 02180 02181 02188 long 02189 dxf_arc_get_transparency 02190 ( 02191 DxfArc *arc 02193 ) 02194 { 02195 #if DEBUG 02196 DXF_DEBUG_BEGIN 02197 #endif 02198 /* Do some basic checks. */ 02199 if (arc == NULL) 02200 { 02201 fprintf (stderr, 02202 (_("Error in %s () a NULL pointer was passed.\n")), 02203 __FUNCTION__); 02204 return (EXIT_FAILURE); 02205 } 02206 #if DEBUG 02207 DXF_DEBUG_END 02208 #endif 02209 return (arc->transparency); 02210 } 02211 02212 02219 DxfArc * 02220 dxf_arc_set_transparency 02221 ( 02222 DxfArc *arc, 02224 long transparency 02226 ) 02227 { 02228 #if DEBUG 02229 DXF_DEBUG_BEGIN 02230 #endif 02231 /* Do some basic checks. */ 02232 if (arc == NULL) 02233 { 02234 fprintf (stderr, 02235 (_("Error in %s () a NULL pointer was passed.\n")), 02236 __FUNCTION__); 02237 return (NULL); 02238 } 02239 arc->transparency = transparency; 02240 #if DEBUG 02241 DXF_DEBUG_END 02242 #endif 02243 return (arc); 02244 } 02245 02246 02252 DxfPoint * 02253 dxf_arc_get_p0 02254 ( 02255 DxfArc *arc 02257 ) 02258 { 02259 #ifdef DEBUG 02260 DXF_DEBUG_BEGIN 02261 #endif 02262 /* Do some basic checks. */ 02263 if (arc == NULL) 02264 { 02265 fprintf (stderr, 02266 (_("Error in %s () a NULL pointer was passed.\n")), 02267 __FUNCTION__); 02268 return (NULL); 02269 } 02270 if (arc->p0 == NULL) 02271 { 02272 fprintf (stderr, 02273 (_("Error in %s () a NULL pointer was found.\n")), 02274 __FUNCTION__); 02275 return (NULL); 02276 } 02277 #if DEBUG 02278 DXF_DEBUG_END 02279 #endif 02280 return (arc->p0); 02281 } 02282 02283 02289 DxfArc * 02290 dxf_arc_set_p0 02291 ( 02292 DxfArc *arc, 02294 DxfPoint *p0 02296 ) 02297 { 02298 #ifdef DEBUG 02299 DXF_DEBUG_BEGIN 02300 #endif 02301 /* Do some basic checks. */ 02302 if (arc == NULL) 02303 { 02304 fprintf (stderr, 02305 (_("Error in %s () a NULL pointer was passed.\n")), 02306 __FUNCTION__); 02307 return (NULL); 02308 } 02309 if (p0 == NULL) 02310 { 02311 fprintf (stderr, 02312 (_("Error in %s () a NULL pointer was passed.\n")), 02313 __FUNCTION__); 02314 return (NULL); 02315 } 02316 arc->p0 = p0; 02317 #if DEBUG 02318 DXF_DEBUG_END 02319 #endif 02320 return (arc); 02321 } 02322 02323 02330 double 02331 dxf_arc_get_x0 02332 ( 02333 DxfArc *arc 02335 ) 02336 { 02337 #ifdef DEBUG 02338 DXF_DEBUG_BEGIN 02339 #endif 02340 02341 /* Do some basic checks. */ 02342 if (arc == NULL) 02343 { 02344 fprintf (stderr, 02345 (_("Error in %s () a NULL pointer was passed.\n")), 02346 __FUNCTION__); 02347 return (EXIT_FAILURE); 02348 } 02349 if (arc->p0 == NULL) 02350 { 02351 fprintf (stderr, 02352 (_("Error in %s () a NULL pointer was found.\n")), 02353 __FUNCTION__); 02354 return (EXIT_FAILURE); 02355 } 02356 #if DEBUG 02357 DXF_DEBUG_END 02358 #endif 02359 return (arc->p0->x0); 02360 } 02361 02362 02370 DxfArc * 02371 dxf_arc_set_x0 02372 ( 02373 DxfArc *arc, 02375 double x0 02378 ) 02379 { 02380 #ifdef DEBUG 02381 DXF_DEBUG_BEGIN 02382 #endif 02383 /* Do some basic checks. */ 02384 if (arc == NULL) 02385 { 02386 fprintf (stderr, 02387 (_("Error in %s () a NULL pointer was passed.\n")), 02388 __FUNCTION__); 02389 return (NULL); 02390 } 02391 if (arc->p0 == NULL) 02392 { 02393 fprintf (stderr, 02394 (_("Error in %s () a NULL pointer was found.\n")), 02395 __FUNCTION__); 02396 return (NULL); 02397 } 02398 arc->p0->x0 = x0; 02399 #if DEBUG 02400 DXF_DEBUG_END 02401 #endif 02402 return (arc); 02403 } 02404 02405 02412 double 02413 dxf_arc_get_y0 02414 ( 02415 DxfArc *arc 02417 ) 02418 { 02419 #ifdef DEBUG 02420 DXF_DEBUG_BEGIN 02421 #endif 02422 02423 /* Do some basic checks. */ 02424 if (arc == NULL) 02425 { 02426 fprintf (stderr, 02427 (_("Error in %s () a NULL pointer was passed.\n")), 02428 __FUNCTION__); 02429 return (EXIT_FAILURE); 02430 } 02431 if (arc->p0 == NULL) 02432 { 02433 fprintf (stderr, 02434 (_("Error in %s () a NULL pointer was found.\n")), 02435 __FUNCTION__); 02436 return (EXIT_FAILURE); 02437 } 02438 #if DEBUG 02439 DXF_DEBUG_END 02440 #endif 02441 return (arc->p0->y0); 02442 } 02443 02444 02452 DxfArc * 02453 dxf_arc_set_y0 02454 ( 02455 DxfArc *arc, 02457 double y0 02460 ) 02461 { 02462 #ifdef DEBUG 02463 DXF_DEBUG_BEGIN 02464 #endif 02465 /* Do some basic checks. */ 02466 if (arc == NULL) 02467 { 02468 fprintf (stderr, 02469 (_("Error in %s () a NULL pointer was passed.\n")), 02470 __FUNCTION__); 02471 return (NULL); 02472 } 02473 if (arc->p0 == NULL) 02474 { 02475 fprintf (stderr, 02476 (_("Error in %s () a NULL pointer was found.\n")), 02477 __FUNCTION__); 02478 return (NULL); 02479 } 02480 arc->p0->y0 = y0; 02481 #if DEBUG 02482 DXF_DEBUG_END 02483 #endif 02484 return (arc); 02485 } 02486 02487 02494 double 02495 dxf_arc_get_z0 02496 ( 02497 DxfArc *arc 02499 ) 02500 { 02501 #ifdef DEBUG 02502 DXF_DEBUG_BEGIN 02503 #endif 02504 02505 /* Do some basic checks. */ 02506 if (arc == NULL) 02507 { 02508 fprintf (stderr, 02509 (_("Error in %s () a NULL pointer was passed.\n")), 02510 __FUNCTION__); 02511 return (EXIT_FAILURE); 02512 } 02513 if (arc->p0 == NULL) 02514 { 02515 fprintf (stderr, 02516 (_("Error in %s () a NULL pointer was found.\n")), 02517 __FUNCTION__); 02518 return (EXIT_FAILURE); 02519 } 02520 #if DEBUG 02521 DXF_DEBUG_END 02522 #endif 02523 return (arc->p0->z0); 02524 } 02525 02526 02534 DxfArc * 02535 dxf_arc_set_z0 02536 ( 02537 DxfArc *arc, 02539 double z0 02542 ) 02543 { 02544 #ifdef DEBUG 02545 DXF_DEBUG_BEGIN 02546 #endif 02547 /* Do some basic checks. */ 02548 if (arc == NULL) 02549 { 02550 fprintf (stderr, 02551 (_("Error in %s () a NULL pointer was passed.\n")), 02552 __FUNCTION__); 02553 return (NULL); 02554 } 02555 if (arc->p0 == NULL) 02556 { 02557 fprintf (stderr, 02558 (_("Error in %s () a NULL pointer was found.\n")), 02559 __FUNCTION__); 02560 return (NULL); 02561 } 02562 arc->p0->z0 = z0; 02563 #if DEBUG 02564 DXF_DEBUG_END 02565 #endif 02566 return (arc); 02567 } 02568 02569 02575 double 02576 dxf_arc_get_radius 02577 ( 02578 DxfArc *arc 02580 ) 02581 { 02582 #if DEBUG 02583 DXF_DEBUG_BEGIN 02584 #endif 02585 /* Do some basic checks. */ 02586 if (arc == NULL) 02587 { 02588 fprintf (stderr, 02589 (_("Error in %s () a NULL pointer was passed.\n")), 02590 __FUNCTION__); 02591 return (EXIT_FAILURE); 02592 } 02593 if (arc->radius < 0.0) 02594 { 02595 fprintf (stderr, 02596 (_("Error in %s () a negative value was found.\n")), 02597 __FUNCTION__); 02598 return (EXIT_FAILURE); 02599 } 02600 if (arc->radius == 0.0) 02601 { 02602 fprintf (stderr, 02603 (_("Error in %s () a value of zero was found.\n")), 02604 __FUNCTION__); 02605 return (EXIT_FAILURE); 02606 } 02607 #if DEBUG 02608 DXF_DEBUG_END 02609 #endif 02610 return (arc->radius); 02611 } 02612 02613 02617 DxfArc * 02618 dxf_arc_set_radius 02619 ( 02620 DxfArc *arc, 02622 double radius 02624 ) 02625 { 02626 #if DEBUG 02627 DXF_DEBUG_BEGIN 02628 #endif 02629 /* Do some basic checks. */ 02630 if (arc == NULL) 02631 { 02632 fprintf (stderr, 02633 (_("Error in %s () a NULL pointer was passed.\n")), 02634 __FUNCTION__); 02635 return (NULL); 02636 } 02637 if (radius < 0.0) 02638 { 02639 fprintf (stderr, 02640 (_("Error in %s () a negative value was passed.\n")), 02641 __FUNCTION__); 02642 return (NULL); 02643 } 02644 if (radius == 0.0) 02645 { 02646 fprintf (stderr, 02647 (_("Error in %s () a value of zero was passed.\n")), 02648 __FUNCTION__); 02649 return (NULL); 02650 } 02651 arc->radius = radius; 02652 #if DEBUG 02653 DXF_DEBUG_END 02654 #endif 02655 return (arc); 02656 } 02657 02658 02664 double 02665 dxf_arc_get_start_angle 02666 ( 02667 DxfArc *arc 02669 ) 02670 { 02671 #if DEBUG 02672 DXF_DEBUG_BEGIN 02673 #endif 02674 /* Do some basic checks. */ 02675 if (arc == NULL) 02676 { 02677 fprintf (stderr, 02678 (_("Error in %s () a NULL pointer was passed.\n")), 02679 __FUNCTION__); 02680 return (EXIT_FAILURE); 02681 } 02682 #if DEBUG 02683 DXF_DEBUG_END 02684 #endif 02685 return (arc->start_angle); 02686 } 02687 02688 02692 DxfArc * 02693 dxf_arc_set_start_angle 02694 ( 02695 DxfArc *arc, 02697 double start_angle 02699 ) 02700 { 02701 #if DEBUG 02702 DXF_DEBUG_BEGIN 02703 #endif 02704 /* Do some basic checks. */ 02705 if (arc == NULL) 02706 { 02707 fprintf (stderr, 02708 (_("Error in %s () a NULL pointer was passed.\n")), 02709 __FUNCTION__); 02710 return (NULL); 02711 } 02712 arc->start_angle = start_angle; 02713 #if DEBUG 02714 DXF_DEBUG_END 02715 #endif 02716 return (arc); 02717 } 02718 02719 02725 double 02726 dxf_arc_get_end_angle 02727 ( 02728 DxfArc *arc 02730 ) 02731 { 02732 #if DEBUG 02733 DXF_DEBUG_BEGIN 02734 #endif 02735 /* Do some basic checks. */ 02736 if (arc == NULL) 02737 { 02738 fprintf (stderr, 02739 (_("Error in %s () a NULL pointer was passed.\n")), 02740 __FUNCTION__); 02741 return (EXIT_FAILURE); 02742 } 02743 #if DEBUG 02744 DXF_DEBUG_END 02745 #endif 02746 return (arc->end_angle); 02747 } 02748 02749 02753 DxfArc * 02754 dxf_arc_set_end_angle 02755 ( 02756 DxfArc *arc, 02758 double end_angle 02760 ) 02761 { 02762 #if DEBUG 02763 DXF_DEBUG_BEGIN 02764 #endif 02765 /* Do some basic checks. */ 02766 if (arc == NULL) 02767 { 02768 fprintf (stderr, 02769 (_("Error in %s () a NULL pointer was passed.\n")), 02770 __FUNCTION__); 02771 return (NULL); 02772 } 02773 arc->end_angle = end_angle; 02774 #if DEBUG 02775 DXF_DEBUG_END 02776 #endif 02777 return (arc); 02778 } 02779 02780 02786 double 02787 dxf_arc_get_length 02788 ( 02789 DxfArc *arc 02791 ) 02792 { 02793 #ifdef DEBUG 02794 DXF_DEBUG_BEGIN 02795 #endif 02796 02797 /* Do some basic checks. */ 02798 if (arc == NULL) 02799 { 02800 fprintf (stderr, 02801 (_("Error in %s () a NULL pointer was passed.\n")), 02802 __FUNCTION__); 02803 return (EXIT_FAILURE); 02804 } 02805 if (arc->radius == 0.0) 02806 { 02807 fprintf (stderr, 02808 (_("Error in %s () a radius of 0.0 was found.\n")), 02809 __FUNCTION__); 02810 return (EXIT_FAILURE); 02811 } 02812 if (arc->radius < 0.0) 02813 { 02814 fprintf (stderr, 02815 (_("Warning in %s () a radius smaller than 0.0 was found.\n")), 02816 __FUNCTION__); 02817 return (EXIT_FAILURE); 02818 } 02819 #if DEBUG 02820 DXF_DEBUG_END 02821 #endif 02822 return (arc->radius * ((arc->end_angle - arc->start_angle) / 360.0)); 02823 } 02824 02825 02834 DxfPoint * 02835 dxf_arc_get_extrusion_vector_as_point 02836 ( 02837 DxfArc *arc 02839 ) 02840 { 02841 #ifdef DEBUG 02842 DXF_DEBUG_BEGIN 02843 #endif 02844 DxfPoint *point = NULL; 02845 02846 /* Do some basic checks. */ 02847 if (arc == NULL) 02848 { 02849 fprintf (stderr, 02850 (_("Error in %s () a NULL pointer was passed.\n")), 02851 __FUNCTION__); 02852 return (NULL); 02853 } 02854 point = dxf_point_init (point); 02855 if (point == NULL) 02856 { 02857 fprintf (stderr, 02858 (_("Error in %s () could not allocate memory.\n")), 02859 __FUNCTION__); 02860 return (NULL); 02861 } 02862 point->x0 = arc->extr_x0; 02863 point->y0 = arc->extr_y0; 02864 point->z0 = arc->extr_z0; 02865 #if DEBUG 02866 DXF_DEBUG_END 02867 #endif 02868 return (point); 02869 } 02870 02871 02878 double 02879 dxf_arc_get_extr_x0 02880 ( 02881 DxfArc *arc 02883 ) 02884 { 02885 #ifdef DEBUG 02886 DXF_DEBUG_BEGIN 02887 #endif 02888 02889 /* Do some basic checks. */ 02890 if (arc == NULL) 02891 { 02892 fprintf (stderr, 02893 (_("Error in %s () a NULL pointer was passed.\n")), 02894 __FUNCTION__); 02895 return (EXIT_FAILURE); 02896 } 02897 #if DEBUG 02898 DXF_DEBUG_END 02899 #endif 02900 return (arc->extr_x0); 02901 } 02902 02903 02911 DxfArc * 02912 dxf_arc_set_extr_x0 02913 ( 02914 DxfArc *arc, 02916 double extr_x0 02919 ) 02920 { 02921 #ifdef DEBUG 02922 DXF_DEBUG_BEGIN 02923 #endif 02924 /* Do some basic checks. */ 02925 if (arc == NULL) 02926 { 02927 fprintf (stderr, 02928 (_("Error in %s () a NULL pointer was passed.\n")), 02929 __FUNCTION__); 02930 return (NULL); 02931 } 02932 arc->extr_x0 = extr_x0; 02933 #if DEBUG 02934 DXF_DEBUG_END 02935 #endif 02936 return (arc); 02937 } 02938 02939 02946 double 02947 dxf_arc_get_extr_y0 02948 ( 02949 DxfArc *arc 02951 ) 02952 { 02953 #ifdef DEBUG 02954 DXF_DEBUG_BEGIN 02955 #endif 02956 02957 /* Do some basic checks. */ 02958 if (arc == NULL) 02959 { 02960 fprintf (stderr, 02961 (_("Error in %s () a NULL pointer was passed.\n")), 02962 __FUNCTION__); 02963 return (EXIT_FAILURE); 02964 } 02965 #if DEBUG 02966 DXF_DEBUG_END 02967 #endif 02968 return (arc->extr_y0); 02969 } 02970 02971 02979 DxfArc * 02980 dxf_arc_set_extr_y0 02981 ( 02982 DxfArc *arc, 02984 double extr_y0 02987 ) 02988 { 02989 #ifdef DEBUG 02990 DXF_DEBUG_BEGIN 02991 #endif 02992 /* Do some basic checks. */ 02993 if (arc == NULL) 02994 { 02995 fprintf (stderr, 02996 (_("Error in %s () a NULL pointer was passed.\n")), 02997 __FUNCTION__); 02998 return (NULL); 02999 } 03000 arc->extr_y0 = extr_y0; 03001 #if DEBUG 03002 DXF_DEBUG_END 03003 #endif 03004 return (arc); 03005 } 03006 03007 03014 double 03015 dxf_arc_get_extr_z0 03016 ( 03017 DxfArc *arc 03019 ) 03020 { 03021 #ifdef DEBUG 03022 DXF_DEBUG_BEGIN 03023 #endif 03024 03025 /* Do some basic checks. */ 03026 if (arc == NULL) 03027 { 03028 fprintf (stderr, 03029 (_("Error in %s () a NULL pointer was passed.\n")), 03030 __FUNCTION__); 03031 return (EXIT_FAILURE); 03032 } 03033 #if DEBUG 03034 DXF_DEBUG_END 03035 #endif 03036 return (arc->extr_z0); 03037 } 03038 03039 03047 DxfArc * 03048 dxf_arc_set_extr_z0 03049 ( 03050 DxfArc *arc, 03052 double extr_z0 03055 ) 03056 { 03057 #ifdef DEBUG 03058 DXF_DEBUG_BEGIN 03059 #endif 03060 /* Do some basic checks. */ 03061 if (arc == NULL) 03062 { 03063 fprintf (stderr, 03064 (_("Error in %s () a NULL pointer was passed.\n")), 03065 __FUNCTION__); 03066 return (NULL); 03067 } 03068 arc->extr_z0 = extr_z0; 03069 #if DEBUG 03070 DXF_DEBUG_END 03071 #endif 03072 return (arc); 03073 } 03074 03075 03080 DxfArc * 03081 dxf_arc_set_extrusion_vector_from_point 03082 ( 03083 DxfArc *arc, 03085 DxfPoint *point 03087 ) 03088 { 03089 #if DEBUG 03090 DXF_DEBUG_BEGIN 03091 #endif 03092 /* Do some basic checks. */ 03093 if (arc == NULL) 03094 { 03095 fprintf (stderr, 03096 (_("Error in %s () a NULL pointer was passed.\n")), 03097 __FUNCTION__); 03098 return (NULL); 03099 } 03100 if (point == NULL) 03101 { 03102 fprintf (stderr, 03103 (_("Error in %s () a NULL pointer was passed.\n")), 03104 __FUNCTION__); 03105 return (NULL); 03106 } 03107 arc->extr_x0 = (double) point->x0; 03108 arc->extr_y0 = (double) point->y0; 03109 arc->extr_z0 = (double) point->z0; 03110 #if DEBUG 03111 DXF_DEBUG_END 03112 #endif 03113 return (arc); 03114 } 03115 03116 03120 DxfArc * 03121 dxf_arc_set_extrusion_vector 03122 ( 03123 DxfArc *arc, 03125 double extr_x0, 03127 double extr_y0, 03129 double extr_z0 03131 ) 03132 { 03133 #if DEBUG 03134 DXF_DEBUG_BEGIN 03135 #endif 03136 /* Do some basic checks. */ 03137 if (arc == NULL) 03138 { 03139 fprintf (stderr, 03140 (_("Error in %s () a NULL pointer was passed.\n")), 03141 __FUNCTION__); 03142 return (NULL); 03143 } 03144 arc->extr_x0 = extr_x0; 03145 arc->extr_y0 = extr_y0; 03146 arc->extr_z0 = extr_z0; 03147 #if DEBUG 03148 DXF_DEBUG_END 03149 #endif 03150 return (arc); 03151 } 03152 03153 03162 DxfArc * 03163 dxf_arc_get_next 03164 ( 03165 DxfArc *arc 03167 ) 03168 { 03169 #if DEBUG 03170 DXF_DEBUG_BEGIN 03171 #endif 03172 /* Do some basic checks. */ 03173 if (arc == NULL) 03174 { 03175 fprintf (stderr, 03176 (_("Error in %s () a NULL pointer was passed.\n")), 03177 __FUNCTION__); 03178 return (NULL); 03179 } 03180 if (arc->next == NULL) 03181 { 03182 fprintf (stderr, 03183 (_("Error in %s () a NULL pointer was found.\n")), 03184 __FUNCTION__); 03185 return (NULL); 03186 } 03187 #if DEBUG 03188 DXF_DEBUG_END 03189 #endif 03190 return ((DxfArc *) arc->next); 03191 } 03192 03193 03198 DxfArc * 03199 dxf_arc_set_next 03200 ( 03201 DxfArc *arc, 03203 DxfArc *next 03205 ) 03206 { 03207 #if DEBUG 03208 DXF_DEBUG_BEGIN 03209 #endif 03210 /* Do some basic checks. */ 03211 if (arc == NULL) 03212 { 03213 fprintf (stderr, 03214 (_("Error in %s () a NULL pointer was passed.\n")), 03215 __FUNCTION__); 03216 return (NULL); 03217 } 03218 if (next == NULL) 03219 { 03220 fprintf (stderr, 03221 (_("Error in %s () a NULL pointer was passed.\n")), 03222 __FUNCTION__); 03223 return (NULL); 03224 } 03225 arc->next = (struct DxfArc *) next; 03226 #if DEBUG 03227 DXF_DEBUG_END 03228 #endif 03229 return (arc); 03230 } 03231 03232 03241 DxfArc * 03242 dxf_arc_get_last 03243 ( 03244 DxfArc *arc 03246 ) 03247 { 03248 #if DEBUG 03249 DXF_DEBUG_BEGIN 03250 #endif 03251 /* Do some basic checks. */ 03252 if (arc == NULL) 03253 { 03254 fprintf (stderr, 03255 (_("Error in %s () a NULL pointer was passed.\n")), 03256 __FUNCTION__); 03257 return (NULL); 03258 } 03259 if (arc->next == NULL) 03260 { 03261 fprintf (stderr, 03262 (_("Warning in %s () a NULL pointer was found.\n")), 03263 __FUNCTION__); 03264 return ((DxfArc *) arc); 03265 } 03266 DxfArc *iter = (DxfArc *) arc->next; 03267 while (iter->next != NULL) 03268 { 03269 iter = (DxfArc *) iter->next; 03270 } 03271 #if DEBUG 03272 DXF_DEBUG_END 03273 #endif 03274 return ((DxfArc *) iter); 03275 } 03276 03277 03278 /* EOF*/