libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00042 #include "ellipse.h" 00043 00044 00053 DxfEllipse * 00054 dxf_ellipse_new () 00055 { 00056 #if DEBUG 00057 DXF_DEBUG_BEGIN 00058 #endif 00059 DxfEllipse *ellipse = NULL; 00060 size_t size; 00061 00062 size = sizeof (DxfEllipse); 00063 /* avoid malloc of 0 bytes */ 00064 if (size == 0) size = 1; 00065 if ((ellipse = malloc (size)) == NULL) 00066 { 00067 fprintf (stderr, 00068 (_("Error in %s () could not allocate memory for a DxfEllipse struct.\n")), 00069 __FUNCTION__); 00070 ellipse = NULL; 00071 } 00072 else 00073 { 00074 memset (ellipse, 0, size); 00075 } 00076 #if DEBUG 00077 DXF_DEBUG_END 00078 #endif 00079 return (ellipse); 00080 } 00081 00082 00090 DxfEllipse * 00091 dxf_ellipse_init 00092 ( 00093 DxfEllipse *ellipse 00095 ) 00096 { 00097 #if DEBUG 00098 DXF_DEBUG_BEGIN 00099 #endif 00100 /* Do some basic checks. */ 00101 if (ellipse == NULL) 00102 { 00103 fprintf (stderr, 00104 (_("Warning in %s () a NULL pointer was passed.\n")), 00105 __FUNCTION__); 00106 ellipse = dxf_ellipse_new (); 00107 } 00108 if (ellipse == NULL) 00109 { 00110 fprintf (stderr, 00111 (_("Error in %s () could not allocate memory for a DxfEllipse struct.\n")), 00112 __FUNCTION__); 00113 return (NULL); 00114 } 00115 dxf_ellipse_set_id_code (ellipse, 0); 00116 dxf_ellipse_set_linetype (ellipse, strdup (DXF_DEFAULT_LINETYPE)); 00117 dxf_ellipse_set_layer (ellipse, strdup (DXF_DEFAULT_LAYER)); 00118 dxf_ellipse_set_elevation (ellipse, 0.0); 00119 dxf_ellipse_set_thickness (ellipse, 0.0); 00120 dxf_ellipse_set_linetype_scale (ellipse, DXF_DEFAULT_LINETYPE_SCALE); 00121 dxf_ellipse_set_visibility (ellipse, DXF_DEFAULT_VISIBILITY); 00122 dxf_ellipse_set_color (ellipse, DXF_COLOR_BYLAYER); 00123 dxf_ellipse_set_paperspace (ellipse, DXF_MODELSPACE); 00124 dxf_ellipse_set_graphics_data_size (ellipse, 0); 00125 dxf_ellipse_set_shadow_mode (ellipse, 0); 00126 dxf_ellipse_set_binary_graphics_data (ellipse, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ()); 00127 dxf_ellipse_set_dictionary_owner_soft (ellipse, strdup ("")); 00128 dxf_ellipse_set_material (ellipse, strdup ("")); 00129 dxf_ellipse_set_dictionary_owner_hard (ellipse, strdup ("")); 00130 dxf_ellipse_set_lineweight (ellipse, 0); 00131 dxf_ellipse_set_plot_style_name (ellipse, strdup ("")); 00132 dxf_ellipse_set_color_value (ellipse, 0); 00133 dxf_ellipse_set_color_name (ellipse, strdup ("")); 00134 dxf_ellipse_set_transparency (ellipse, 0); 00135 dxf_ellipse_set_p0 (ellipse, (DxfPoint *) dxf_point_new ()); 00136 dxf_point_init ((DxfPoint *) dxf_ellipse_get_p0 (ellipse)); 00137 dxf_ellipse_set_x0 (ellipse, 0.0); 00138 dxf_ellipse_set_y0 (ellipse, 0.0); 00139 dxf_ellipse_set_z0 (ellipse, 0.0); 00140 dxf_ellipse_set_p1 (ellipse, (DxfPoint *) dxf_point_new ()); 00141 dxf_point_init ((DxfPoint *) dxf_ellipse_get_p1 (ellipse)); 00142 dxf_ellipse_set_x1 (ellipse, 0.0); 00143 dxf_ellipse_set_y1 (ellipse, 0.0); 00144 dxf_ellipse_set_z1 (ellipse, 0.0); 00145 dxf_ellipse_set_ratio (ellipse, 0.0); 00146 dxf_ellipse_set_start_angle (ellipse, 0.0); 00147 dxf_ellipse_set_end_angle (ellipse, 0.0); 00148 dxf_ellipse_set_extr_x0 (ellipse, 0.0); 00149 dxf_ellipse_set_extr_y0 (ellipse, 0.0); 00150 dxf_ellipse_set_extr_z0 (ellipse, 0.0); 00151 dxf_ellipse_set_next (ellipse, NULL); 00152 #if DEBUG 00153 DXF_DEBUG_END 00154 #endif 00155 return (ellipse); 00156 } 00157 00158 00170 DxfEllipse * 00171 dxf_ellipse_read 00172 ( 00173 DxfFile *fp, 00175 DxfEllipse *ellipse 00177 ) 00178 { 00179 #if DEBUG 00180 DXF_DEBUG_BEGIN 00181 #endif 00182 char *temp_string = NULL; 00183 00184 /* Do some basic checks. */ 00185 if (fp == NULL) 00186 { 00187 fprintf (stderr, 00188 (_("Error in %s () a NULL file pointer was passed.\n")), 00189 __FUNCTION__); 00190 /* Clean up. */ 00191 free (temp_string); 00192 return (NULL); 00193 } 00194 if (ellipse == NULL) 00195 { 00196 fprintf (stderr, 00197 (_("Warning in %s () a NULL pointer was passed.\n")), 00198 __FUNCTION__); 00199 ellipse = dxf_ellipse_new (); 00200 ellipse = dxf_ellipse_init (ellipse); 00201 } 00202 (fp->line_number)++; 00203 fscanf (fp->fp, "%[^\n]", temp_string); 00204 while (strcmp (temp_string, "0") != 0) 00205 { 00206 if (ferror (fp->fp)) 00207 { 00208 fprintf (stderr, 00209 (_("Error in %s () while reading from: %s in line: %d.\n")), 00210 __FUNCTION__, fp->filename, fp->line_number); 00211 fclose (fp->fp); 00212 /* Clean up. */ 00213 free (temp_string); 00214 return (NULL); 00215 } 00216 if (strcmp (temp_string, "5") == 0) 00217 { 00218 /* Now follows a string containing a sequential 00219 * id number. */ 00220 (fp->line_number)++; 00221 fscanf (fp->fp, "%x\n", &ellipse->id_code); 00222 } 00223 else if (strcmp (temp_string, "6") == 0) 00224 { 00225 /* Now follows a string containing a linetype 00226 * name. */ 00227 (fp->line_number)++; 00228 fscanf (fp->fp, "%s\n", ellipse->linetype); 00229 } 00230 else if (strcmp (temp_string, "8") == 0) 00231 { 00232 /* Now follows a string containing a layer name. */ 00233 (fp->line_number)++; 00234 fscanf (fp->fp, "%s\n", ellipse->layer); 00235 } 00236 else if (strcmp (temp_string, "10") == 0) 00237 { 00238 /* Now follows a string containing the 00239 * X-coordinate of the center point. */ 00240 (fp->line_number)++; 00241 fscanf (fp->fp, "%lf\n", &ellipse->x0); 00242 } 00243 else if (strcmp (temp_string, "20") == 0) 00244 { 00245 /* Now follows a string containing the 00246 * Y-coordinate of the center point. */ 00247 (fp->line_number)++; 00248 fscanf (fp->fp, "%lf\n", &ellipse->y0); 00249 } 00250 else if (strcmp (temp_string, "30") == 0) 00251 { 00252 /* Now follows a string containing the 00253 * Z-coordinate of the center point. */ 00254 (fp->line_number)++; 00255 fscanf (fp->fp, "%lf\n", &ellipse->z0); 00256 } 00257 else if (strcmp (temp_string, "11") == 0) 00258 { 00259 /* Now follows a string containing the 00260 * X-coordinate of the center point. */ 00261 (fp->line_number)++; 00262 fscanf (fp->fp, "%lf\n", &ellipse->x1); 00263 } 00264 else if (strcmp (temp_string, "21") == 0) 00265 { 00266 /* Now follows a string containing the 00267 * Y-coordinate of the center point. */ 00268 (fp->line_number)++; 00269 fscanf (fp->fp, "%lf\n", &ellipse->y1); 00270 } 00271 else if (strcmp (temp_string, "31") == 0) 00272 { 00273 /* Now follows a string containing the 00274 * Z-coordinate of the center point. */ 00275 (fp->line_number)++; 00276 fscanf (fp->fp, "%lf\n", &ellipse->z1); 00277 } 00278 else if ((fp->acad_version_number <= AutoCAD_11) 00279 && (strcmp (temp_string, "38") == 0) 00280 && (ellipse->elevation = 0.0)) 00281 { 00282 /* Elevation is a pre AutoCAD R11 variable 00283 * so additional testing for the version should 00284 * probably be added. 00285 * Now follows a string containing the 00286 * elevation. */ 00287 (fp->line_number)++; 00288 fscanf (fp->fp, "%lf\n", &ellipse->elevation); 00289 } 00290 else if (strcmp (temp_string, "39") == 0) 00291 { 00292 /* Now follows a string containing the 00293 * thickness. */ 00294 (fp->line_number)++; 00295 fscanf (fp->fp, "%lf\n", &ellipse->thickness); 00296 } 00297 else if (strcmp (temp_string, "40") == 0) 00298 { 00299 /* Now follows a string containing the 00300 * radius. */ 00301 (fp->line_number)++; 00302 fscanf (fp->fp, "%lf\n", &ellipse->ratio); 00303 } 00304 else if (strcmp (temp_string, "41") == 0) 00305 { 00306 /* Now follows a string containing the 00307 * start angle. */ 00308 (fp->line_number)++; 00309 fscanf (fp->fp, "%lf\n", &ellipse->start_angle); 00310 } 00311 else if (strcmp (temp_string, "42") == 0) 00312 { 00313 /* Now follows a string containing the 00314 * end angle. */ 00315 (fp->line_number)++; 00316 fscanf (fp->fp, "%lf\n", &ellipse->end_angle); 00317 } 00318 else if (strcmp (temp_string, "48") == 0) 00319 { 00320 /* Now follows a string containing the linetype 00321 * scale. */ 00322 (fp->line_number)++; 00323 fscanf (fp->fp, "%lf\n", &ellipse->linetype_scale); 00324 } 00325 else if (strcmp (temp_string, "60") == 0) 00326 { 00327 /* Now follows a string containing the 00328 * visibility value. */ 00329 (fp->line_number)++; 00330 fscanf (fp->fp, "%hd\n", &ellipse->visibility); 00331 } 00332 else if (strcmp (temp_string, "62") == 0) 00333 { 00334 /* Now follows a string containing the 00335 * color value. */ 00336 (fp->line_number)++; 00337 fscanf (fp->fp, "%d\n", &ellipse->color); 00338 } 00339 else if (strcmp (temp_string, "67") == 0) 00340 { 00341 /* Now follows a string containing the 00342 * paperspace value. */ 00343 (fp->line_number)++; 00344 fscanf (fp->fp, "%d\n", &ellipse->paperspace); 00345 } 00346 else if ((fp->acad_version_number >= AutoCAD_12) 00347 && (strcmp (temp_string, "100") == 0)) 00348 { 00349 /* Subclass markers are post AutoCAD R12 00350 * variable so additional testing for the 00351 * version should probably be added here. 00352 * Now follows a string containing the 00353 * subclass marker value. */ 00354 (fp->line_number)++; 00355 fscanf (fp->fp, "%s\n", temp_string); 00356 if ((strcmp (temp_string, "AcDbEntity") != 0) 00357 && ((strcmp (temp_string, "AcDbEllipse") != 0))) 00358 { 00359 fprintf (stderr, 00360 (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")), 00361 __FUNCTION__, fp->filename, fp->line_number); 00362 } 00363 } 00364 else if (strcmp (temp_string, "210") == 0) 00365 { 00366 /* Now follows a string containing the 00367 * X-value of the extrusion vector. */ 00368 (fp->line_number)++; 00369 fscanf (fp->fp, "%lf\n", &ellipse->extr_x0); 00370 } 00371 else if (strcmp (temp_string, "220") == 0) 00372 { 00373 /* Now follows a string containing the 00374 * Y-value of the extrusion vector. */ 00375 (fp->line_number)++; 00376 fscanf (fp->fp, "%lf\n", &ellipse->extr_y0); 00377 } 00378 else if (strcmp (temp_string, "230") == 0) 00379 { 00380 /* Now follows a string containing the 00381 * Z-value of the extrusion vector. */ 00382 (fp->line_number)++; 00383 fscanf (fp->fp, "%lf\n", &ellipse->extr_z0); 00384 } 00385 else if (strcmp (temp_string, "330") == 0) 00386 { 00387 /* Now follows a string containing Soft-pointer 00388 * ID/handle to owner dictionary. */ 00389 (fp->line_number)++; 00390 fscanf (fp->fp, "%s\n", ellipse->dictionary_owner_soft); 00391 } 00392 else if (strcmp (temp_string, "360") == 0) 00393 { 00394 /* Now follows a string containing Hard owner 00395 * ID/handle to owner dictionary. */ 00396 (fp->line_number)++; 00397 fscanf (fp->fp, "%s\n", ellipse->dictionary_owner_hard); 00398 } 00399 else if (strcmp (temp_string, "999") == 0) 00400 { 00401 /* Now follows a string containing a comment. */ 00402 (fp->line_number)++; 00403 fscanf (fp->fp, "%s\n", temp_string); 00404 fprintf (stdout, "DXF comment: %s\n", temp_string); 00405 } 00406 else 00407 { 00408 fprintf (stderr, 00409 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00410 __FUNCTION__, fp->filename, fp->line_number); 00411 } 00412 } 00413 /* Handle omitted members and/or illegal values. */ 00414 if (strcmp (ellipse->linetype, "") == 0) 00415 { 00416 ellipse->linetype = strdup (DXF_DEFAULT_LINETYPE); 00417 } 00418 if (strcmp (ellipse->layer, "") == 0) 00419 { 00420 ellipse->layer = strdup (DXF_DEFAULT_LAYER); 00421 } 00422 /* Clean up. */ 00423 free (temp_string); 00424 #if DEBUG 00425 DXF_DEBUG_END 00426 #endif 00427 return (ellipse); 00428 } 00429 00430 00440 int 00441 dxf_ellipse_write 00442 ( 00443 DxfFile *fp, 00445 DxfEllipse *ellipse 00447 ) 00448 { 00449 #if DEBUG 00450 DXF_DEBUG_BEGIN 00451 #endif 00452 char *dxf_entity_name = strdup ("ELLIPSE"); 00453 00454 /* Do some basic checks. */ 00455 if (fp == NULL) 00456 { 00457 fprintf (stderr, 00458 (_("Error in %s () a NULL file pointer was passed.\n")), 00459 __FUNCTION__); 00460 /* Clean up. */ 00461 free (dxf_entity_name); 00462 return (EXIT_FAILURE); 00463 } 00464 if (fp->acad_version_number < AutoCAD_13) 00465 { 00466 fprintf (stderr, 00467 (_("Error in %s () illegal DXF version for this entity.\n")), 00468 __FUNCTION__); 00469 /* Clean up. */ 00470 free (dxf_entity_name); 00471 return (EXIT_FAILURE); 00472 } 00473 if (ellipse == NULL) 00474 { 00475 fprintf (stderr, 00476 (_("Error in %s () a NULL pointer was passed.\n")), 00477 __FUNCTION__); 00478 /* Clean up. */ 00479 free (dxf_entity_name); 00480 return (EXIT_FAILURE); 00481 } 00482 if (ellipse->ratio == 0.0) 00483 { 00484 fprintf (stderr, 00485 (_("Error in %s () ratio value equals 0.0 for the %s entity with id-code: %x\n")), 00486 __FUNCTION__, dxf_entity_name, ellipse->id_code); 00487 /* Clean up. */ 00488 free (dxf_entity_name); 00489 return (EXIT_FAILURE); 00490 } 00491 if (strcmp (ellipse->linetype, "") == 0) 00492 { 00493 fprintf (stderr, 00494 (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")), 00495 __FUNCTION__, dxf_entity_name, ellipse->id_code); 00496 fprintf (stderr, 00497 (_("\t%s entity is reset to default linetype")), 00498 dxf_entity_name); 00499 ellipse->linetype = strdup (DXF_DEFAULT_LINETYPE); 00500 } 00501 if (strcmp (ellipse->layer, "") == 0) 00502 { 00503 fprintf (stderr, 00504 (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")), 00505 __FUNCTION__, dxf_entity_name, ellipse->id_code); 00506 fprintf (stderr, 00507 (_("\t%s entity is relocated to layer 0")), 00508 dxf_entity_name); 00509 ellipse->layer = strdup (DXF_DEFAULT_LAYER); 00510 } 00511 /* Start writing output. */ 00512 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00513 if (ellipse->id_code != -1) 00514 { 00515 fprintf (fp->fp, " 5\n%x\n", ellipse->id_code); 00516 } 00527 if ((strcmp (ellipse->dictionary_owner_soft, "") != 0) 00528 && (fp->acad_version_number >= AutoCAD_14)) 00529 { 00530 fprintf (fp->fp, "102\n{ACAD_REACTORS\n"); 00531 fprintf (fp->fp, "330\n%s\n", ellipse->dictionary_owner_soft); 00532 fprintf (fp->fp, "102\n}\n"); 00533 } 00534 if ((strcmp (ellipse->dictionary_owner_hard, "") != 0) 00535 && (fp->acad_version_number >= AutoCAD_14)) 00536 { 00537 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n"); 00538 fprintf (fp->fp, "360\n%s\n", ellipse->dictionary_owner_hard); 00539 fprintf (fp->fp, "102\n}\n"); 00540 } 00541 if (fp->acad_version_number >= AutoCAD_13) 00542 { 00543 fprintf (fp->fp, "100\nAcDbEntity\n"); 00544 } 00545 if (ellipse->paperspace == DXF_PAPERSPACE) 00546 { 00547 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE); 00548 } 00549 fprintf (fp->fp, " 8\n%s\n", ellipse->layer); 00550 if (strcmp (ellipse->linetype, DXF_DEFAULT_LINETYPE) != 0) 00551 { 00552 fprintf (fp->fp, " 6\n%s\n", ellipse->linetype); 00553 } 00554 if ((fp->acad_version_number <= AutoCAD_11) 00555 && DXF_FLATLAND 00556 && (ellipse->elevation != 0.0)) 00557 { 00558 fprintf (fp->fp, " 38\n%f\n", ellipse->elevation); 00559 } 00560 if ((fp->acad_version_number <= AutoCAD_13) 00561 && (ellipse->thickness != 0.0)) 00562 { 00563 fprintf (fp->fp, " 39\n%f\n", ellipse->thickness); 00564 } 00565 if (ellipse->color != DXF_COLOR_BYLAYER) 00566 { 00567 fprintf (fp->fp, " 62\n%d\n", ellipse->color); 00568 } 00569 if (ellipse->linetype_scale != 1.0) 00570 { 00571 fprintf (fp->fp, " 48\n%f\n", ellipse->linetype_scale); 00572 } 00573 if (ellipse->visibility != 0) 00574 { 00575 fprintf (fp->fp, " 60\n%d\n", ellipse->visibility); 00576 } 00577 if (fp->acad_version_number >= AutoCAD_13) 00578 { 00579 fprintf (fp->fp, "100\nAcDbEllipse\n"); 00580 } 00581 fprintf (fp->fp, " 10\n%f\n", ellipse->x0); 00582 fprintf (fp->fp, " 20\n%f\n", ellipse->y0); 00583 fprintf (fp->fp, " 30\n%f\n", ellipse->z0); 00584 fprintf (fp->fp, " 11\n%f\n", ellipse->x1); 00585 fprintf (fp->fp, " 21\n%f\n", ellipse->y1); 00586 fprintf (fp->fp, " 31\n%f\n", ellipse->z1); 00587 fprintf (fp->fp, " 210\n%f\n", ellipse->extr_x0); 00588 fprintf (fp->fp, " 220\n%f\n", ellipse->extr_y0); 00589 fprintf (fp->fp, " 230\n%f\n", ellipse->extr_z0); 00590 fprintf (fp->fp, " 40\n%f\n", ellipse->ratio); 00591 fprintf (fp->fp, " 41\n%f\n", ellipse->start_angle); 00592 fprintf (fp->fp, " 42\n%f\n", ellipse->end_angle); 00593 /* Clean up. */ 00594 free (dxf_entity_name); 00595 #if DEBUG 00596 DXF_DEBUG_END 00597 #endif 00598 return (EXIT_SUCCESS); 00599 } 00600 00601 00609 int 00610 dxf_ellipse_free 00611 ( 00612 DxfEllipse *ellipse 00615 ) 00616 { 00617 #if DEBUG 00618 DXF_DEBUG_BEGIN 00619 #endif 00620 /* Do some basic checks. */ 00621 if (ellipse == NULL) 00622 { 00623 fprintf (stderr, 00624 (_("Error in %s () a NULL pointer was passed.\n")), 00625 __FUNCTION__); 00626 return (EXIT_FAILURE); 00627 } 00628 if (ellipse->next != NULL) 00629 { 00630 fprintf (stderr, 00631 (_("Error in %s () pointer to next was not NULL.\n")), 00632 __FUNCTION__); 00633 return (EXIT_FAILURE); 00634 } 00635 free (ellipse->linetype); 00636 free (ellipse->layer); 00637 free (ellipse->dictionary_owner_soft); 00638 free (ellipse->dictionary_owner_hard); 00639 free (ellipse); 00640 ellipse = NULL; 00641 #if DEBUG 00642 DXF_DEBUG_END 00643 #endif 00644 return (EXIT_SUCCESS); 00645 } 00646 00647 00652 void 00653 dxf_ellipse_free_chain 00654 ( 00655 DxfEllipse *ellipses 00657 ) 00658 { 00659 #ifdef DEBUG 00660 DXF_DEBUG_BEGIN 00661 #endif 00662 if (ellipses == NULL) 00663 { 00664 fprintf (stderr, 00665 (_("Warning in %s () a NULL pointer was passed.\n")), 00666 __FUNCTION__); 00667 } 00668 while (ellipses != NULL) 00669 { 00670 struct DxfEllipse *iter = ellipses->next; 00671 dxf_ellipse_free (ellipses); 00672 ellipses = (DxfEllipse *) iter; 00673 } 00674 #if DEBUG 00675 DXF_DEBUG_END 00676 #endif 00677 } 00678 00679 00685 int 00686 dxf_ellipse_get_id_code 00687 ( 00688 DxfEllipse *ellipse 00690 ) 00691 { 00692 #if DEBUG 00693 DXF_DEBUG_BEGIN 00694 #endif 00695 /* Do some basic checks. */ 00696 if (ellipse == NULL) 00697 { 00698 fprintf (stderr, 00699 (_("Error in %s () a NULL pointer was passed.\n")), 00700 __FUNCTION__); 00701 return (EXIT_FAILURE); 00702 } 00703 if (ellipse->id_code < 0) 00704 { 00705 fprintf (stderr, 00706 (_("Error in %s () a negative value was found in the id-code member.\n")), 00707 __FUNCTION__); 00708 return (EXIT_FAILURE); 00709 } 00710 #if DEBUG 00711 DXF_DEBUG_END 00712 #endif 00713 return (ellipse->id_code); 00714 } 00715 00716 00720 DxfEllipse * 00721 dxf_ellipse_set_id_code 00722 ( 00723 DxfEllipse *ellipse, 00725 int id_code 00729 ) 00730 { 00731 #if DEBUG 00732 DXF_DEBUG_BEGIN 00733 #endif 00734 /* Do some basic checks. */ 00735 if (ellipse == NULL) 00736 { 00737 fprintf (stderr, 00738 (_("Error in %s () a NULL pointer was passed.\n")), 00739 __FUNCTION__); 00740 return (NULL); 00741 } 00742 if (id_code < 0) 00743 { 00744 fprintf (stderr, 00745 (_("Error in %s () a negative id-code value was passed.\n")), 00746 __FUNCTION__); 00747 return (NULL); 00748 } 00749 ellipse->id_code = id_code; 00750 #if DEBUG 00751 DXF_DEBUG_END 00752 #endif 00753 return (ellipse); 00754 } 00755 00756 00762 char * 00763 dxf_ellipse_get_linetype 00764 ( 00765 DxfEllipse *ellipse 00767 ) 00768 { 00769 #if DEBUG 00770 DXF_DEBUG_BEGIN 00771 #endif 00772 /* Do some basic checks. */ 00773 if (ellipse == NULL) 00774 { 00775 fprintf (stderr, 00776 (_("Error in %s () a NULL pointer was passed.\n")), 00777 __FUNCTION__); 00778 return (NULL); 00779 } 00780 if (ellipse->linetype == NULL) 00781 { 00782 fprintf (stderr, 00783 (_("Error in %s () a NULL pointer was found in the linetype member.\n")), 00784 __FUNCTION__); 00785 return (NULL); 00786 } 00787 #if DEBUG 00788 DXF_DEBUG_END 00789 #endif 00790 return (strdup (ellipse->linetype)); 00791 } 00792 00793 00797 DxfEllipse * 00798 dxf_ellipse_set_linetype 00799 ( 00800 DxfEllipse *ellipse, 00802 char *linetype 00804 ) 00805 { 00806 #if DEBUG 00807 DXF_DEBUG_BEGIN 00808 #endif 00809 /* Do some basic checks. */ 00810 if (ellipse == NULL) 00811 { 00812 fprintf (stderr, 00813 (_("Error in %s () a NULL pointer was passed.\n")), 00814 __FUNCTION__); 00815 return (NULL); 00816 } 00817 if (linetype == NULL) 00818 { 00819 fprintf (stderr, 00820 (_("Error in %s () a NULL pointer was passed.\n")), 00821 __FUNCTION__); 00822 return (NULL); 00823 } 00824 ellipse->linetype = strdup (linetype); 00825 #if DEBUG 00826 DXF_DEBUG_END 00827 #endif 00828 return (ellipse); 00829 } 00830 00831 00837 char * 00838 dxf_ellipse_get_layer 00839 ( 00840 DxfEllipse *ellipse 00842 ) 00843 { 00844 #if DEBUG 00845 DXF_DEBUG_BEGIN 00846 #endif 00847 /* Do some basic checks. */ 00848 if (ellipse == NULL) 00849 { 00850 fprintf (stderr, 00851 (_("Error in %s () a NULL pointer was passed.\n")), 00852 __FUNCTION__); 00853 return (NULL); 00854 } 00855 if (ellipse->layer == NULL) 00856 { 00857 fprintf (stderr, 00858 (_("Error in %s () a NULL pointer was found in the layer member.\n")), 00859 __FUNCTION__); 00860 return (NULL); 00861 } 00862 #if DEBUG 00863 DXF_DEBUG_END 00864 #endif 00865 return (strdup (ellipse->layer)); 00866 } 00867 00868 00872 DxfEllipse * 00873 dxf_ellipse_set_layer 00874 ( 00875 DxfEllipse *ellipse, 00877 char *layer 00879 ) 00880 { 00881 #if DEBUG 00882 DXF_DEBUG_BEGIN 00883 #endif 00884 /* Do some basic checks. */ 00885 if (ellipse == NULL) 00886 { 00887 fprintf (stderr, 00888 (_("Error in %s () a NULL pointer was passed.\n")), 00889 __FUNCTION__); 00890 return (NULL); 00891 } 00892 if (layer == NULL) 00893 { 00894 fprintf (stderr, 00895 (_("Error in %s () a NULL pointer was passed.\n")), 00896 __FUNCTION__); 00897 return (NULL); 00898 } 00899 ellipse->layer = strdup (layer); 00900 #if DEBUG 00901 DXF_DEBUG_END 00902 #endif 00903 return (ellipse); 00904 } 00905 00906 00912 double 00913 dxf_ellipse_get_elevation 00914 ( 00915 DxfEllipse *ellipse 00917 ) 00918 { 00919 #if DEBUG 00920 DXF_DEBUG_BEGIN 00921 #endif 00922 /* Do some basic checks. */ 00923 if (ellipse == NULL) 00924 { 00925 fprintf (stderr, 00926 (_("Error in %s () a NULL pointer was passed.\n")), 00927 __FUNCTION__); 00928 return (EXIT_FAILURE); 00929 } 00930 #if DEBUG 00931 DXF_DEBUG_END 00932 #endif 00933 return (ellipse->elevation); 00934 } 00935 00936 00940 DxfEllipse * 00941 dxf_ellipse_set_elevation 00942 ( 00943 DxfEllipse *ellipse, 00945 double elevation 00947 ) 00948 { 00949 #if DEBUG 00950 DXF_DEBUG_BEGIN 00951 #endif 00952 /* Do some basic checks. */ 00953 if (ellipse == NULL) 00954 { 00955 fprintf (stderr, 00956 (_("Error in %s () a NULL pointer was passed.\n")), 00957 __FUNCTION__); 00958 return (NULL); 00959 } 00960 ellipse->elevation = elevation; 00961 #if DEBUG 00962 DXF_DEBUG_END 00963 #endif 00964 return (ellipse); 00965 } 00966 00967 00973 double 00974 dxf_ellipse_get_thickness 00975 ( 00976 DxfEllipse *ellipse 00978 ) 00979 { 00980 #if DEBUG 00981 DXF_DEBUG_BEGIN 00982 #endif 00983 /* Do some basic checks. */ 00984 if (ellipse == NULL) 00985 { 00986 fprintf (stderr, 00987 (_("Error in %s () a NULL pointer was passed.\n")), 00988 __FUNCTION__); 00989 return (EXIT_FAILURE); 00990 } 00991 if (ellipse->thickness < 0.0) 00992 { 00993 fprintf (stderr, 00994 (_("Error in %s () a negative value was found in the thickness member.\n")), 00995 __FUNCTION__); 00996 return (EXIT_FAILURE); 00997 } 00998 #if DEBUG 00999 DXF_DEBUG_END 01000 #endif 01001 return (ellipse->thickness); 01002 } 01003 01004 01008 DxfEllipse * 01009 dxf_ellipse_set_thickness 01010 ( 01011 DxfEllipse *ellipse, 01013 double thickness 01015 ) 01016 { 01017 #if DEBUG 01018 DXF_DEBUG_BEGIN 01019 #endif 01020 /* Do some basic checks. */ 01021 if (ellipse == NULL) 01022 { 01023 fprintf (stderr, 01024 (_("Error in %s () a NULL pointer was passed.\n")), 01025 __FUNCTION__); 01026 return (NULL); 01027 } 01028 if (thickness < 0.0) 01029 { 01030 fprintf (stderr, 01031 (_("Error in %s () a negative thickness value was passed.\n")), 01032 __FUNCTION__); 01033 return (NULL); 01034 } 01035 ellipse->thickness = thickness; 01036 #if DEBUG 01037 DXF_DEBUG_END 01038 #endif 01039 return (ellipse); 01040 } 01041 01042 01048 double 01049 dxf_ellipse_get_linetype_scale 01050 ( 01051 DxfEllipse *ellipse 01053 ) 01054 { 01055 #if DEBUG 01056 DXF_DEBUG_BEGIN 01057 #endif 01058 /* Do some basic checks. */ 01059 if (ellipse == NULL) 01060 { 01061 fprintf (stderr, 01062 (_("Error in %s () a NULL pointer was passed.\n")), 01063 __FUNCTION__); 01064 return (EXIT_FAILURE); 01065 } 01066 if (ellipse->linetype_scale < 0.0) 01067 { 01068 fprintf (stderr, 01069 (_("Error in %s () a negative value was found in the linetype scale member.\n")), 01070 __FUNCTION__); 01071 return (EXIT_FAILURE); 01072 } 01073 #if DEBUG 01074 DXF_DEBUG_END 01075 #endif 01076 return (ellipse->linetype_scale); 01077 } 01078 01079 01083 DxfEllipse * 01084 dxf_ellipse_set_linetype_scale 01085 ( 01086 DxfEllipse *ellipse, 01088 double linetype_scale 01090 ) 01091 { 01092 #if DEBUG 01093 DXF_DEBUG_BEGIN 01094 #endif 01095 /* Do some basic checks. */ 01096 if (ellipse == NULL) 01097 { 01098 fprintf (stderr, 01099 (_("Error in %s () a NULL pointer was passed.\n")), 01100 __FUNCTION__); 01101 return (NULL); 01102 } 01103 if (linetype_scale < 0.0) 01104 { 01105 fprintf (stderr, 01106 (_("Error in %s () a negative linetype scale value was passed.\n")), 01107 __FUNCTION__); 01108 return (NULL); 01109 } 01110 ellipse->linetype_scale = linetype_scale; 01111 #if DEBUG 01112 DXF_DEBUG_END 01113 #endif 01114 return (ellipse); 01115 } 01116 01117 01123 int16_t 01124 dxf_ellipse_get_visibility 01125 ( 01126 DxfEllipse *ellipse 01128 ) 01129 { 01130 #if DEBUG 01131 DXF_DEBUG_BEGIN 01132 #endif 01133 /* Do some basic checks. */ 01134 if (ellipse == NULL) 01135 { 01136 fprintf (stderr, 01137 (_("Error in %s () a NULL pointer was passed.\n")), 01138 __FUNCTION__); 01139 return (EXIT_FAILURE); 01140 } 01141 if (ellipse->visibility < 0) 01142 { 01143 fprintf (stderr, 01144 (_("Error in %s () a negative value was found in the visibility member.\n")), 01145 __FUNCTION__); 01146 return (EXIT_FAILURE); 01147 } 01148 if (ellipse->visibility > 1) 01149 { 01150 fprintf (stderr, 01151 (_("Error in %s () an out of range value was found in the visibility member.\n")), 01152 __FUNCTION__); 01153 return (EXIT_FAILURE); 01154 } 01155 #if DEBUG 01156 DXF_DEBUG_END 01157 #endif 01158 return (ellipse->visibility); 01159 } 01160 01161 01165 DxfEllipse * 01166 dxf_ellipse_set_visibility 01167 ( 01168 DxfEllipse *ellipse, 01170 int16_t visibility 01172 ) 01173 { 01174 #if DEBUG 01175 DXF_DEBUG_BEGIN 01176 #endif 01177 /* Do some basic checks. */ 01178 if (ellipse == NULL) 01179 { 01180 fprintf (stderr, 01181 (_("Error in %s () a NULL pointer was passed.\n")), 01182 __FUNCTION__); 01183 return (NULL); 01184 } 01185 if (visibility < 0) 01186 { 01187 fprintf (stderr, 01188 (_("Error in %s () a negative visibility value was passed.\n")), 01189 __FUNCTION__); 01190 return (NULL); 01191 } 01192 if (visibility > 1) 01193 { 01194 fprintf (stderr, 01195 (_("Error in %s () an out of range visibility value was passed.\n")), 01196 __FUNCTION__); 01197 return (NULL); 01198 } 01199 ellipse->visibility = visibility; 01200 #if DEBUG 01201 DXF_DEBUG_END 01202 #endif 01203 return (ellipse); 01204 } 01205 01206 01212 int 01213 dxf_ellipse_get_color 01214 ( 01215 DxfEllipse *ellipse 01217 ) 01218 { 01219 #if DEBUG 01220 DXF_DEBUG_BEGIN 01221 #endif 01222 /* Do some basic checks. */ 01223 if (ellipse == NULL) 01224 { 01225 fprintf (stderr, 01226 (_("Error in %s () a NULL pointer was passed.\n")), 01227 __FUNCTION__); 01228 return (EXIT_FAILURE); 01229 } 01230 if (ellipse->color < 0) 01231 { 01232 fprintf (stderr, 01233 (_("Warning in %s () a negative value was found in the color member.\n")), 01234 __FUNCTION__); 01235 } 01236 #if DEBUG 01237 DXF_DEBUG_END 01238 #endif 01239 return (ellipse->color); 01240 } 01241 01242 01246 DxfEllipse * 01247 dxf_ellipse_set_color 01248 ( 01249 DxfEllipse *ellipse, 01251 int color 01253 ) 01254 { 01255 #if DEBUG 01256 DXF_DEBUG_BEGIN 01257 #endif 01258 /* Do some basic checks. */ 01259 if (ellipse == NULL) 01260 { 01261 fprintf (stderr, 01262 (_("Error in %s () a NULL pointer was passed.\n")), 01263 __FUNCTION__); 01264 return (NULL); 01265 } 01266 if (color < 0) 01267 { 01268 fprintf (stderr, 01269 (_("Warning in %s () a negative color value was passed.\n")), 01270 __FUNCTION__); 01271 fprintf (stderr, 01272 (_("\teffectively turning this entity it's visibility off.\n"))); 01273 } 01274 ellipse->color = color; 01275 #if DEBUG 01276 DXF_DEBUG_END 01277 #endif 01278 return (ellipse); 01279 } 01280 01281 01287 int 01288 dxf_ellipse_get_paperspace 01289 ( 01290 DxfEllipse *ellipse 01292 ) 01293 { 01294 #if DEBUG 01295 DXF_DEBUG_BEGIN 01296 #endif 01297 /* Do some basic checks. */ 01298 if (ellipse == NULL) 01299 { 01300 fprintf (stderr, 01301 (_("Error in %s () a NULL pointer was passed.\n")), 01302 __FUNCTION__); 01303 return (EXIT_FAILURE); 01304 } 01305 if (ellipse->paperspace < 0) 01306 { 01307 fprintf (stderr, 01308 (_("Warning in %s () a negative value was found in the paperspace member.\n")), 01309 __FUNCTION__); 01310 } 01311 if (ellipse->paperspace > 1) 01312 { 01313 fprintf (stderr, 01314 (_("Warning in %s () an out of range value was found in the paperspace member.\n")), 01315 __FUNCTION__); 01316 } 01317 #if DEBUG 01318 DXF_DEBUG_END 01319 #endif 01320 return (ellipse->paperspace); 01321 } 01322 01323 01327 DxfEllipse * 01328 dxf_ellipse_set_paperspace 01329 ( 01330 DxfEllipse *ellipse, 01332 int paperspace 01334 ) 01335 { 01336 #if DEBUG 01337 DXF_DEBUG_BEGIN 01338 #endif 01339 /* Do some basic checks. */ 01340 if (ellipse == NULL) 01341 { 01342 fprintf (stderr, 01343 (_("Error in %s () a NULL pointer was passed.\n")), 01344 __FUNCTION__); 01345 return (NULL); 01346 } 01347 if (paperspace < 0) 01348 { 01349 fprintf (stderr, 01350 (_("Error in %s () a negative paperspace value was passed.\n")), 01351 __FUNCTION__); 01352 return (NULL); 01353 } 01354 if (paperspace > 1) 01355 { 01356 fprintf (stderr, 01357 (_("Error in %s () an out of range paperspace value was passed.\n")), 01358 __FUNCTION__); 01359 return (NULL); 01360 } 01361 ellipse->paperspace = paperspace; 01362 #if DEBUG 01363 DXF_DEBUG_END 01364 #endif 01365 return (ellipse); 01366 } 01367 01368 01376 int 01377 dxf_ellipse_get_graphics_data_size 01378 ( 01379 DxfEllipse *ellipse 01381 ) 01382 { 01383 #if DEBUG 01384 DXF_DEBUG_BEGIN 01385 #endif 01386 /* Do some basic checks. */ 01387 if (ellipse == NULL) 01388 { 01389 fprintf (stderr, 01390 (_("Error in %s () a NULL pointer was passed.\n")), 01391 __FUNCTION__); 01392 return (EXIT_FAILURE); 01393 } 01394 if (ellipse->graphics_data_size < 0) 01395 { 01396 fprintf (stderr, 01397 (_("Warning in %s () a negative value was found in the graphics_data_size member.\n")), 01398 __FUNCTION__); 01399 } 01400 if (ellipse->graphics_data_size == 0) 01401 { 01402 fprintf (stderr, 01403 (_("Warning in %s () a zero value was found in the graphics_data_size member.\n")), 01404 __FUNCTION__); 01405 } 01406 #if DEBUG 01407 DXF_DEBUG_END 01408 #endif 01409 return (ellipse->graphics_data_size); 01410 } 01411 01412 01420 DxfEllipse * 01421 dxf_ellipse_set_graphics_data_size 01422 ( 01423 DxfEllipse *ellipse, 01425 int graphics_data_size 01428 ) 01429 { 01430 #if DEBUG 01431 DXF_DEBUG_BEGIN 01432 #endif 01433 /* Do some basic checks. */ 01434 if (ellipse == NULL) 01435 { 01436 fprintf (stderr, 01437 (_("Error in %s () a NULL pointer was passed.\n")), 01438 __FUNCTION__); 01439 return (NULL); 01440 } 01441 if (graphics_data_size < 0) 01442 { 01443 fprintf (stderr, 01444 (_("Error in %s () a negative graphics_data_size value was passed.\n")), 01445 __FUNCTION__); 01446 return (NULL); 01447 } 01448 if (graphics_data_size == 0) 01449 { 01450 fprintf (stderr, 01451 (_("Warning in %s () a zero graphics_data_size value was passed.\n")), 01452 __FUNCTION__); 01453 } 01454 ellipse->graphics_data_size = graphics_data_size; 01455 #if DEBUG 01456 DXF_DEBUG_END 01457 #endif 01458 return (ellipse); 01459 } 01460 01461 01468 int16_t 01469 dxf_ellipse_get_shadow_mode 01470 ( 01471 DxfEllipse *ellipse 01473 ) 01474 { 01475 #if DEBUG 01476 DXF_DEBUG_BEGIN 01477 #endif 01478 /* Do some basic checks. */ 01479 if (ellipse == NULL) 01480 { 01481 fprintf (stderr, 01482 (_("Error in %s () a NULL pointer was passed.\n")), 01483 __FUNCTION__); 01484 return (EXIT_FAILURE); 01485 } 01486 if (ellipse->shadow_mode < 0) 01487 { 01488 fprintf (stderr, 01489 (_("Error in %s () a negative value was found in the shadow_mode member.\n")), 01490 __FUNCTION__); 01491 return (EXIT_FAILURE); 01492 } 01493 if (ellipse->shadow_mode > 3) 01494 { 01495 fprintf (stderr, 01496 (_("Error in %s () an out of range value was found in the shadow_mode member.\n")), 01497 __FUNCTION__); 01498 return (EXIT_FAILURE); 01499 } 01500 #if DEBUG 01501 DXF_DEBUG_END 01502 #endif 01503 return (ellipse->shadow_mode); 01504 } 01505 01506 01513 DxfEllipse * 01514 dxf_ellipse_set_shadow_mode 01515 ( 01516 DxfEllipse *ellipse, 01518 int16_t shadow_mode 01520 ) 01521 { 01522 #if DEBUG 01523 DXF_DEBUG_BEGIN 01524 #endif 01525 /* Do some basic checks. */ 01526 if (ellipse == NULL) 01527 { 01528 fprintf (stderr, 01529 (_("Error in %s () a NULL pointer was passed.\n")), 01530 __FUNCTION__); 01531 return (NULL); 01532 } 01533 if (shadow_mode < 0) 01534 { 01535 fprintf (stderr, 01536 (_("Error in %s () a negative shadow_mode value was passed.\n")), 01537 __FUNCTION__); 01538 return (NULL); 01539 } 01540 if (shadow_mode > 3) 01541 { 01542 fprintf (stderr, 01543 (_("Error in %s () an out of range shadow_mode value was passed.\n")), 01544 __FUNCTION__); 01545 return (NULL); 01546 } 01547 ellipse->shadow_mode = shadow_mode; 01548 #if DEBUG 01549 DXF_DEBUG_END 01550 #endif 01551 return (ellipse); 01552 } 01553 01554 01563 DxfBinaryGraphicsData * 01564 dxf_ellipse_get_binary_graphics_data 01565 ( 01566 DxfEllipse *ellipse 01568 ) 01569 { 01570 #if DEBUG 01571 DXF_DEBUG_BEGIN 01572 #endif 01573 /* Do some basic checks. */ 01574 if (ellipse == NULL) 01575 { 01576 fprintf (stderr, 01577 (_("Error in %s () a NULL pointer was passed.\n")), 01578 __FUNCTION__); 01579 return (NULL); 01580 } 01581 if (ellipse->binary_graphics_data == NULL) 01582 { 01583 fprintf (stderr, 01584 (_("Error in %s () a NULL pointer was found in the binary_graphics_data member.\n")), 01585 __FUNCTION__); 01586 return (NULL); 01587 } 01588 #if DEBUG 01589 DXF_DEBUG_END 01590 #endif 01591 return ((DxfBinaryGraphicsData *) ellipse->binary_graphics_data); 01592 } 01593 01594 01599 DxfEllipse * 01600 dxf_ellipse_set_binary_graphics_data 01601 ( 01602 DxfEllipse *ellipse, 01604 DxfBinaryGraphicsData *data 01607 ) 01608 { 01609 #if DEBUG 01610 DXF_DEBUG_BEGIN 01611 #endif 01612 /* Do some basic checks. */ 01613 if (ellipse == NULL) 01614 { 01615 fprintf (stderr, 01616 (_("Error in %s () a NULL pointer was passed.\n")), 01617 __FUNCTION__); 01618 return (NULL); 01619 } 01620 if (data == NULL) 01621 { 01622 fprintf (stderr, 01623 (_("Error in %s () a NULL pointer was passed.\n")), 01624 __FUNCTION__); 01625 return (NULL); 01626 } 01627 ellipse->binary_graphics_data = (DxfBinaryGraphicsData *) data; 01628 #if DEBUG 01629 DXF_DEBUG_END 01630 #endif 01631 return (ellipse); 01632 } 01633 01634 01643 char * 01644 dxf_ellipse_get_dictionary_owner_soft 01645 ( 01646 DxfEllipse *ellipse 01648 ) 01649 { 01650 #if DEBUG 01651 DXF_DEBUG_BEGIN 01652 #endif 01653 /* Do some basic checks. */ 01654 if (ellipse == NULL) 01655 { 01656 fprintf (stderr, 01657 (_("Error in %s () a NULL pointer was passed.\n")), 01658 __FUNCTION__); 01659 return (NULL); 01660 } 01661 if (ellipse->dictionary_owner_soft == NULL) 01662 { 01663 fprintf (stderr, 01664 (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")), 01665 __FUNCTION__); 01666 return (NULL); 01667 } 01668 #if DEBUG 01669 DXF_DEBUG_END 01670 #endif 01671 return (strdup (ellipse->dictionary_owner_soft)); 01672 } 01673 01674 01679 DxfEllipse * 01680 dxf_ellipse_set_dictionary_owner_soft 01681 ( 01682 DxfEllipse *ellipse, 01684 char *dictionary_owner_soft 01687 ) 01688 { 01689 #if DEBUG 01690 DXF_DEBUG_BEGIN 01691 #endif 01692 /* Do some basic checks. */ 01693 if (ellipse == NULL) 01694 { 01695 fprintf (stderr, 01696 (_("Error in %s () a NULL pointer was passed.\n")), 01697 __FUNCTION__); 01698 return (NULL); 01699 } 01700 if (dictionary_owner_soft == NULL) 01701 { 01702 fprintf (stderr, 01703 (_("Error in %s () a NULL pointer was passed.\n")), 01704 __FUNCTION__); 01705 return (NULL); 01706 } 01707 ellipse->dictionary_owner_soft = strdup (dictionary_owner_soft); 01708 #if DEBUG 01709 DXF_DEBUG_END 01710 #endif 01711 return (ellipse); 01712 } 01713 01714 01723 char * 01724 dxf_ellipse_get_material 01725 ( 01726 DxfEllipse *ellipse 01728 ) 01729 { 01730 #if DEBUG 01731 DXF_DEBUG_BEGIN 01732 #endif 01733 /* Do some basic checks. */ 01734 if (ellipse == NULL) 01735 { 01736 fprintf (stderr, 01737 (_("Error in %s () a NULL pointer was passed.\n")), 01738 __FUNCTION__); 01739 return (NULL); 01740 } 01741 if (ellipse->material == NULL) 01742 { 01743 fprintf (stderr, 01744 (_("Error in %s () a NULL pointer was found in the material member.\n")), 01745 __FUNCTION__); 01746 return (NULL); 01747 } 01748 #if DEBUG 01749 DXF_DEBUG_END 01750 #endif 01751 return (strdup (ellipse->material)); 01752 } 01753 01754 01761 DxfEllipse * 01762 dxf_ellipse_set_material 01763 ( 01764 DxfEllipse *ellipse, 01766 char *material 01769 ) 01770 { 01771 #if DEBUG 01772 DXF_DEBUG_BEGIN 01773 #endif 01774 /* Do some basic checks. */ 01775 if (ellipse == NULL) 01776 { 01777 fprintf (stderr, 01778 (_("Error in %s () a NULL pointer was passed.\n")), 01779 __FUNCTION__); 01780 return (NULL); 01781 } 01782 if (material == NULL) 01783 { 01784 fprintf (stderr, 01785 (_("Error in %s () a NULL pointer was passed.\n")), 01786 __FUNCTION__); 01787 return (NULL); 01788 } 01789 ellipse->material = strdup (material); 01790 #if DEBUG 01791 DXF_DEBUG_END 01792 #endif 01793 return (ellipse); 01794 } 01795 01796 01805 char * 01806 dxf_ellipse_get_dictionary_owner_hard 01807 ( 01808 DxfEllipse *ellipse 01810 ) 01811 { 01812 #if DEBUG 01813 DXF_DEBUG_BEGIN 01814 #endif 01815 /* Do some basic checks. */ 01816 if (ellipse == NULL) 01817 { 01818 fprintf (stderr, 01819 (_("Error in %s () a NULL pointer was passed.\n")), 01820 __FUNCTION__); 01821 return (NULL); 01822 } 01823 if (ellipse->dictionary_owner_hard == NULL) 01824 { 01825 fprintf (stderr, 01826 (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")), 01827 __FUNCTION__); 01828 return (NULL); 01829 } 01830 #if DEBUG 01831 DXF_DEBUG_END 01832 #endif 01833 return (strdup (ellipse->dictionary_owner_hard)); 01834 } 01835 01836 01841 DxfEllipse * 01842 dxf_ellipse_set_dictionary_owner_hard 01843 ( 01844 DxfEllipse *ellipse, 01846 char *dictionary_owner_hard 01849 ) 01850 { 01851 #if DEBUG 01852 DXF_DEBUG_BEGIN 01853 #endif 01854 /* Do some basic checks. */ 01855 if (ellipse == NULL) 01856 { 01857 fprintf (stderr, 01858 (_("Error in %s () a NULL pointer was passed.\n")), 01859 __FUNCTION__); 01860 return (NULL); 01861 } 01862 if (dictionary_owner_hard == NULL) 01863 { 01864 fprintf (stderr, 01865 (_("Error in %s () a NULL pointer was passed.\n")), 01866 __FUNCTION__); 01867 return (NULL); 01868 } 01869 ellipse->dictionary_owner_hard = strdup (dictionary_owner_hard); 01870 #if DEBUG 01871 DXF_DEBUG_END 01872 #endif 01873 return (ellipse); 01874 } 01875 01876 01883 int16_t 01884 dxf_ellipse_get_lineweight 01885 ( 01886 DxfEllipse *ellipse 01888 ) 01889 { 01890 #if DEBUG 01891 DXF_DEBUG_BEGIN 01892 #endif 01893 /* Do some basic checks. */ 01894 if (ellipse == NULL) 01895 { 01896 fprintf (stderr, 01897 (_("Error in %s () a NULL pointer was passed.\n")), 01898 __FUNCTION__); 01899 return (EXIT_FAILURE); 01900 } 01901 #if DEBUG 01902 DXF_DEBUG_END 01903 #endif 01904 return (ellipse->lineweight); 01905 } 01906 01907 01914 DxfEllipse * 01915 dxf_ellipse_set_lineweight 01916 ( 01917 DxfEllipse *ellipse, 01919 int16_t lineweight 01921 ) 01922 { 01923 #if DEBUG 01924 DXF_DEBUG_BEGIN 01925 #endif 01926 /* Do some basic checks. */ 01927 if (ellipse == NULL) 01928 { 01929 fprintf (stderr, 01930 (_("Error in %s () a NULL pointer was passed.\n")), 01931 __FUNCTION__); 01932 return (NULL); 01933 } 01934 ellipse->lineweight = lineweight; 01935 #if DEBUG 01936 DXF_DEBUG_END 01937 #endif 01938 return (ellipse); 01939 } 01940 01941 01948 char * 01949 dxf_ellipse_get_plot_style_name 01950 ( 01951 DxfEllipse *ellipse 01953 ) 01954 { 01955 #if DEBUG 01956 DXF_DEBUG_BEGIN 01957 #endif 01958 /* Do some basic checks. */ 01959 if (ellipse == NULL) 01960 { 01961 fprintf (stderr, 01962 (_("Error in %s () a NULL pointer was passed.\n")), 01963 __FUNCTION__); 01964 return (NULL); 01965 } 01966 if (ellipse->plot_style_name == NULL) 01967 { 01968 fprintf (stderr, 01969 (_("Error in %s () a NULL pointer was found in the plot_style_name member.\n")), 01970 __FUNCTION__); 01971 return (NULL); 01972 } 01973 #if DEBUG 01974 DXF_DEBUG_END 01975 #endif 01976 return (strdup (ellipse->plot_style_name)); 01977 } 01978 01979 01986 DxfEllipse * 01987 dxf_ellipse_set_plot_style_name 01988 ( 01989 DxfEllipse *ellipse, 01991 char *plot_style_name 01994 ) 01995 { 01996 #if DEBUG 01997 DXF_DEBUG_BEGIN 01998 #endif 01999 /* Do some basic checks. */ 02000 if (ellipse == NULL) 02001 { 02002 fprintf (stderr, 02003 (_("Error in %s () a NULL pointer was passed.\n")), 02004 __FUNCTION__); 02005 return (NULL); 02006 } 02007 if (plot_style_name == NULL) 02008 { 02009 fprintf (stderr, 02010 (_("Error in %s () a NULL pointer was passed.\n")), 02011 __FUNCTION__); 02012 return (NULL); 02013 } 02014 ellipse->plot_style_name = strdup (plot_style_name); 02015 #if DEBUG 02016 DXF_DEBUG_END 02017 #endif 02018 return (ellipse); 02019 } 02020 02021 02028 long 02029 dxf_ellipse_get_color_value 02030 ( 02031 DxfEllipse *ellipse 02033 ) 02034 { 02035 #if DEBUG 02036 DXF_DEBUG_BEGIN 02037 #endif 02038 /* Do some basic checks. */ 02039 if (ellipse == NULL) 02040 { 02041 fprintf (stderr, 02042 (_("Error in %s () a NULL pointer was passed.\n")), 02043 __FUNCTION__); 02044 return (EXIT_FAILURE); 02045 } 02046 #if DEBUG 02047 DXF_DEBUG_END 02048 #endif 02049 return (ellipse->color_value); 02050 } 02051 02052 02059 DxfEllipse * 02060 dxf_ellipse_set_color_value 02061 ( 02062 DxfEllipse *ellipse, 02064 long color_value 02066 ) 02067 { 02068 #if DEBUG 02069 DXF_DEBUG_BEGIN 02070 #endif 02071 /* Do some basic checks. */ 02072 if (ellipse == NULL) 02073 { 02074 fprintf (stderr, 02075 (_("Error in %s () a NULL pointer was passed.\n")), 02076 __FUNCTION__); 02077 return (NULL); 02078 } 02079 ellipse->color_value = color_value; 02080 #if DEBUG 02081 DXF_DEBUG_END 02082 #endif 02083 return (ellipse); 02084 } 02085 02086 02093 char * 02094 dxf_ellipse_get_color_name 02095 ( 02096 DxfEllipse *ellipse 02098 ) 02099 { 02100 #if DEBUG 02101 DXF_DEBUG_BEGIN 02102 #endif 02103 /* Do some basic checks. */ 02104 if (ellipse == NULL) 02105 { 02106 fprintf (stderr, 02107 (_("Error in %s () a NULL pointer was passed.\n")), 02108 __FUNCTION__); 02109 return (NULL); 02110 } 02111 if (ellipse->color_name == NULL) 02112 { 02113 fprintf (stderr, 02114 (_("Error in %s () a NULL pointer was found in the color_name member.\n")), 02115 __FUNCTION__); 02116 return (NULL); 02117 } 02118 #if DEBUG 02119 DXF_DEBUG_END 02120 #endif 02121 return (strdup (ellipse->color_name)); 02122 } 02123 02124 02131 DxfEllipse * 02132 dxf_ellipse_set_color_name 02133 ( 02134 DxfEllipse *ellipse, 02136 char *color_name 02139 ) 02140 { 02141 #if DEBUG 02142 DXF_DEBUG_BEGIN 02143 #endif 02144 /* Do some basic checks. */ 02145 if (ellipse == NULL) 02146 { 02147 fprintf (stderr, 02148 (_("Error in %s () a NULL pointer was passed.\n")), 02149 __FUNCTION__); 02150 return (NULL); 02151 } 02152 if (color_name == NULL) 02153 { 02154 fprintf (stderr, 02155 (_("Error in %s () a NULL pointer was passed.\n")), 02156 __FUNCTION__); 02157 return (NULL); 02158 } 02159 ellipse->color_name = strdup (color_name); 02160 #if DEBUG 02161 DXF_DEBUG_END 02162 #endif 02163 return (ellipse); 02164 } 02165 02166 02173 long 02174 dxf_ellipse_get_transparency 02175 ( 02176 DxfEllipse *ellipse 02178 ) 02179 { 02180 #if DEBUG 02181 DXF_DEBUG_BEGIN 02182 #endif 02183 /* Do some basic checks. */ 02184 if (ellipse == NULL) 02185 { 02186 fprintf (stderr, 02187 (_("Error in %s () a NULL pointer was passed.\n")), 02188 __FUNCTION__); 02189 return (EXIT_FAILURE); 02190 } 02191 #if DEBUG 02192 DXF_DEBUG_END 02193 #endif 02194 return (ellipse->transparency); 02195 } 02196 02197 02204 DxfEllipse * 02205 dxf_ellipse_set_transparency 02206 ( 02207 DxfEllipse *ellipse, 02209 long transparency 02211 ) 02212 { 02213 #if DEBUG 02214 DXF_DEBUG_BEGIN 02215 #endif 02216 /* Do some basic checks. */ 02217 if (ellipse == NULL) 02218 { 02219 fprintf (stderr, 02220 (_("Error in %s () a NULL pointer was passed.\n")), 02221 __FUNCTION__); 02222 return (NULL); 02223 } 02224 ellipse->transparency = transparency; 02225 #if DEBUG 02226 DXF_DEBUG_END 02227 #endif 02228 return (ellipse); 02229 } 02230 02231 02237 DxfPoint * 02238 dxf_ellipse_get_p0 02239 ( 02240 DxfEllipse *ellipse 02242 ) 02243 { 02244 #ifdef DEBUG 02245 DXF_DEBUG_BEGIN 02246 #endif 02247 /* Do some basic checks. */ 02248 if (ellipse == NULL) 02249 { 02250 fprintf (stderr, 02251 (_("Error in %s () a NULL pointer was passed.\n")), 02252 __FUNCTION__); 02253 return (NULL); 02254 } 02255 if (ellipse->p0 == NULL) 02256 { 02257 fprintf (stderr, 02258 (_("Error in %s () a NULL pointer was found.\n")), 02259 __FUNCTION__); 02260 return (NULL); 02261 } 02262 #if DEBUG 02263 DXF_DEBUG_END 02264 #endif 02265 return (ellipse->p0); 02266 } 02267 02268 02274 DxfEllipse * 02275 dxf_ellipse_set_p0 02276 ( 02277 DxfEllipse *ellipse, 02279 DxfPoint *p0 02281 ) 02282 { 02283 #ifdef DEBUG 02284 DXF_DEBUG_BEGIN 02285 #endif 02286 /* Do some basic checks. */ 02287 if (ellipse == NULL) 02288 { 02289 fprintf (stderr, 02290 (_("Error in %s () a NULL pointer was passed.\n")), 02291 __FUNCTION__); 02292 return (NULL); 02293 } 02294 if (p0 == NULL) 02295 { 02296 fprintf (stderr, 02297 (_("Error in %s () a NULL pointer was passed.\n")), 02298 __FUNCTION__); 02299 return (NULL); 02300 } 02301 ellipse->p0 = (DxfPoint *) p0; 02302 #if DEBUG 02303 DXF_DEBUG_END 02304 #endif 02305 return (ellipse); 02306 } 02307 02308 02315 double 02316 dxf_ellipse_get_x0 02317 ( 02318 DxfEllipse *ellipse 02320 ) 02321 { 02322 #ifdef DEBUG 02323 DXF_DEBUG_BEGIN 02324 #endif 02325 02326 /* Do some basic checks. */ 02327 if (ellipse == NULL) 02328 { 02329 fprintf (stderr, 02330 (_("Error in %s () a NULL pointer was passed.\n")), 02331 __FUNCTION__); 02332 return (EXIT_FAILURE); 02333 } 02334 if (ellipse->p0 == NULL) 02335 { 02336 fprintf (stderr, 02337 (_("Error in %s () a NULL pointer was found.\n")), 02338 __FUNCTION__); 02339 return (EXIT_FAILURE); 02340 } 02341 #if DEBUG 02342 DXF_DEBUG_END 02343 #endif 02344 return (ellipse->p0->x0); 02345 } 02346 02347 02355 DxfEllipse * 02356 dxf_ellipse_set_x0 02357 ( 02358 DxfEllipse *ellipse, 02360 double x0 02363 ) 02364 { 02365 #ifdef DEBUG 02366 DXF_DEBUG_BEGIN 02367 #endif 02368 /* Do some basic checks. */ 02369 if (ellipse == NULL) 02370 { 02371 fprintf (stderr, 02372 (_("Error in %s () a NULL pointer was passed.\n")), 02373 __FUNCTION__); 02374 return (NULL); 02375 } 02376 if (ellipse->p0 == NULL) 02377 { 02378 fprintf (stderr, 02379 (_("Error in %s () a NULL pointer was found.\n")), 02380 __FUNCTION__); 02381 return (NULL); 02382 } 02383 ellipse->p0->x0 = x0; 02384 #if DEBUG 02385 DXF_DEBUG_END 02386 #endif 02387 return (ellipse); 02388 } 02389 02390 02397 double 02398 dxf_ellipse_get_y0 02399 ( 02400 DxfEllipse *ellipse 02402 ) 02403 { 02404 #ifdef DEBUG 02405 DXF_DEBUG_BEGIN 02406 #endif 02407 02408 /* Do some basic checks. */ 02409 if (ellipse == NULL) 02410 { 02411 fprintf (stderr, 02412 (_("Error in %s () a NULL pointer was passed.\n")), 02413 __FUNCTION__); 02414 return (EXIT_FAILURE); 02415 } 02416 if (ellipse->p0 == NULL) 02417 { 02418 fprintf (stderr, 02419 (_("Error in %s () a NULL pointer was found.\n")), 02420 __FUNCTION__); 02421 return (EXIT_FAILURE); 02422 } 02423 #if DEBUG 02424 DXF_DEBUG_END 02425 #endif 02426 return (ellipse->p0->y0); 02427 } 02428 02429 02437 DxfEllipse * 02438 dxf_ellipse_set_y0 02439 ( 02440 DxfEllipse *ellipse, 02442 double y0 02445 ) 02446 { 02447 #ifdef DEBUG 02448 DXF_DEBUG_BEGIN 02449 #endif 02450 /* Do some basic checks. */ 02451 if (ellipse == NULL) 02452 { 02453 fprintf (stderr, 02454 (_("Error in %s () a NULL pointer was passed.\n")), 02455 __FUNCTION__); 02456 return (NULL); 02457 } 02458 if (ellipse->p0 == NULL) 02459 { 02460 fprintf (stderr, 02461 (_("Error in %s () a NULL pointer was found.\n")), 02462 __FUNCTION__); 02463 return (NULL); 02464 } 02465 ellipse->p0->y0 = y0; 02466 #if DEBUG 02467 DXF_DEBUG_END 02468 #endif 02469 return (ellipse); 02470 } 02471 02472 02479 double 02480 dxf_ellipse_get_z0 02481 ( 02482 DxfEllipse *ellipse 02484 ) 02485 { 02486 #ifdef DEBUG 02487 DXF_DEBUG_BEGIN 02488 #endif 02489 02490 /* Do some basic checks. */ 02491 if (ellipse == NULL) 02492 { 02493 fprintf (stderr, 02494 (_("Error in %s () a NULL pointer was passed.\n")), 02495 __FUNCTION__); 02496 return (EXIT_FAILURE); 02497 } 02498 if (ellipse->p0 == NULL) 02499 { 02500 fprintf (stderr, 02501 (_("Error in %s () a NULL pointer was found.\n")), 02502 __FUNCTION__); 02503 return (EXIT_FAILURE); 02504 } 02505 #if DEBUG 02506 DXF_DEBUG_END 02507 #endif 02508 return (ellipse->p0->z0); 02509 } 02510 02511 02519 DxfEllipse * 02520 dxf_ellipse_set_z0 02521 ( 02522 DxfEllipse *ellipse, 02524 double z0 02527 ) 02528 { 02529 #ifdef DEBUG 02530 DXF_DEBUG_BEGIN 02531 #endif 02532 /* Do some basic checks. */ 02533 if (ellipse == NULL) 02534 { 02535 fprintf (stderr, 02536 (_("Error in %s () a NULL pointer was passed.\n")), 02537 __FUNCTION__); 02538 return (NULL); 02539 } 02540 if (ellipse->p0 == NULL) 02541 { 02542 fprintf (stderr, 02543 (_("Error in %s () a NULL pointer was found.\n")), 02544 __FUNCTION__); 02545 return (NULL); 02546 } 02547 ellipse->p0->z0 = z0; 02548 #if DEBUG 02549 DXF_DEBUG_END 02550 #endif 02551 return (ellipse); 02552 } 02553 02554 02561 DxfPoint * 02562 dxf_ellipse_get_p1 02563 ( 02564 DxfEllipse *ellipse 02566 ) 02567 { 02568 #ifdef DEBUG 02569 DXF_DEBUG_BEGIN 02570 #endif 02571 /* Do some basic checks. */ 02572 if (ellipse == NULL) 02573 { 02574 fprintf (stderr, 02575 (_("Error in %s () a NULL pointer was passed.\n")), 02576 __FUNCTION__); 02577 return (NULL); 02578 } 02579 #if DEBUG 02580 DXF_DEBUG_END 02581 #endif 02582 return (ellipse->p1); 02583 } 02584 02585 02592 DxfEllipse * 02593 dxf_ellipse_set_p1 02594 ( 02595 DxfEllipse *ellipse, 02597 DxfPoint *p1 02599 ) 02600 { 02601 #ifdef DEBUG 02602 DXF_DEBUG_BEGIN 02603 #endif 02604 /* Do some basic checks. */ 02605 if (ellipse == NULL) 02606 { 02607 fprintf (stderr, 02608 (_("Error in %s () a NULL pointer was passed.\n")), 02609 __FUNCTION__); 02610 return (NULL); 02611 } 02612 if (p1 == NULL) 02613 { 02614 fprintf (stderr, 02615 (_("Error in %s () a NULL pointer was passed.\n")), 02616 __FUNCTION__); 02617 return (NULL); 02618 } 02619 ellipse->p1 = p1; 02620 #if DEBUG 02621 DXF_DEBUG_END 02622 #endif 02623 return (ellipse); 02624 } 02625 02626 02633 double 02634 dxf_ellipse_get_x1 02635 ( 02636 DxfEllipse *ellipse 02638 ) 02639 { 02640 #ifdef DEBUG 02641 DXF_DEBUG_BEGIN 02642 #endif 02643 02644 /* Do some basic checks. */ 02645 if (ellipse == NULL) 02646 { 02647 fprintf (stderr, 02648 (_("Error in %s () a NULL pointer was passed.\n")), 02649 __FUNCTION__); 02650 return (EXIT_FAILURE); 02651 } 02652 if (ellipse->p1 == NULL) 02653 { 02654 fprintf (stderr, 02655 (_("Error in %s () a NULL pointer was found.\n")), 02656 __FUNCTION__); 02657 return (EXIT_FAILURE); 02658 } 02659 #if DEBUG 02660 DXF_DEBUG_END 02661 #endif 02662 return (ellipse->p1->x0); 02663 } 02664 02665 02673 DxfEllipse * 02674 dxf_ellipse_set_x1 02675 ( 02676 DxfEllipse *ellipse, 02678 double x1 02680 ) 02681 { 02682 #ifdef DEBUG 02683 DXF_DEBUG_BEGIN 02684 #endif 02685 /* Do some basic checks. */ 02686 if (ellipse == NULL) 02687 { 02688 fprintf (stderr, 02689 (_("Error in %s () a NULL pointer was passed.\n")), 02690 __FUNCTION__); 02691 return (NULL); 02692 } 02693 if (ellipse->p1 == NULL) 02694 { 02695 fprintf (stderr, 02696 (_("Error in %s () a NULL pointer was found.\n")), 02697 __FUNCTION__); 02698 return (NULL); 02699 } 02700 ellipse->p1->x0 = x1; 02701 #if DEBUG 02702 DXF_DEBUG_END 02703 #endif 02704 return (ellipse); 02705 } 02706 02707 02714 double 02715 dxf_ellipse_get_y1 02716 ( 02717 DxfEllipse *ellipse 02719 ) 02720 { 02721 #ifdef DEBUG 02722 DXF_DEBUG_BEGIN 02723 #endif 02724 02725 /* Do some basic checks. */ 02726 if (ellipse == NULL) 02727 { 02728 fprintf (stderr, 02729 (_("Error in %s () a NULL pointer was passed.\n")), 02730 __FUNCTION__); 02731 return (EXIT_FAILURE); 02732 } 02733 if (ellipse->p1 == NULL) 02734 { 02735 fprintf (stderr, 02736 (_("Error in %s () a NULL pointer was found.\n")), 02737 __FUNCTION__); 02738 return (EXIT_FAILURE); 02739 } 02740 #if DEBUG 02741 DXF_DEBUG_END 02742 #endif 02743 return (ellipse->p1->y0); 02744 } 02745 02746 02754 DxfEllipse * 02755 dxf_ellipse_set_y1 02756 ( 02757 DxfEllipse *ellipse, 02759 double y1 02761 ) 02762 { 02763 #ifdef DEBUG 02764 DXF_DEBUG_BEGIN 02765 #endif 02766 /* Do some basic checks. */ 02767 if (ellipse == NULL) 02768 { 02769 fprintf (stderr, 02770 (_("Error in %s () a NULL pointer was passed.\n")), 02771 __FUNCTION__); 02772 return (NULL); 02773 } 02774 if (ellipse->p1 == NULL) 02775 { 02776 fprintf (stderr, 02777 (_("Error in %s () a NULL pointer was found.\n")), 02778 __FUNCTION__); 02779 return (NULL); 02780 } 02781 ellipse->p1->y0 = y1; 02782 #if DEBUG 02783 DXF_DEBUG_END 02784 #endif 02785 return (ellipse); 02786 } 02787 02788 02795 double 02796 dxf_ellipse_get_z1 02797 ( 02798 DxfEllipse *ellipse 02800 ) 02801 { 02802 #ifdef DEBUG 02803 DXF_DEBUG_BEGIN 02804 #endif 02805 02806 /* Do some basic checks. */ 02807 if (ellipse == NULL) 02808 { 02809 fprintf (stderr, 02810 (_("Error in %s () a NULL pointer was passed.\n")), 02811 __FUNCTION__); 02812 return (EXIT_FAILURE); 02813 } 02814 if (ellipse->p1 == NULL) 02815 { 02816 fprintf (stderr, 02817 (_("Error in %s () a NULL pointer was found.\n")), 02818 __FUNCTION__); 02819 return (EXIT_FAILURE); 02820 } 02821 #if DEBUG 02822 DXF_DEBUG_END 02823 #endif 02824 return (ellipse->p1->z0); 02825 } 02826 02827 02835 DxfEllipse * 02836 dxf_ellipse_set_z1 02837 ( 02838 DxfEllipse *ellipse, 02840 double z1 02842 ) 02843 { 02844 #ifdef DEBUG 02845 DXF_DEBUG_BEGIN 02846 #endif 02847 /* Do some basic checks. */ 02848 if (ellipse == NULL) 02849 { 02850 fprintf (stderr, 02851 (_("Error in %s () a NULL pointer was passed.\n")), 02852 __FUNCTION__); 02853 return (NULL); 02854 } 02855 if (ellipse->p1 == NULL) 02856 { 02857 fprintf (stderr, 02858 (_("Error in %s () a NULL pointer was found.\n")), 02859 __FUNCTION__); 02860 return (NULL); 02861 } 02862 ellipse->p1->z0 = z1; 02863 #if DEBUG 02864 DXF_DEBUG_END 02865 #endif 02866 return (ellipse); 02867 } 02868 02869 02876 double 02877 dxf_ellipse_get_ratio 02878 ( 02879 DxfEllipse *ellipse 02881 ) 02882 { 02883 #if DEBUG 02884 DXF_DEBUG_BEGIN 02885 #endif 02886 /* Do some basic checks. */ 02887 if (ellipse == NULL) 02888 { 02889 fprintf (stderr, 02890 (_("Error in %s () a NULL pointer was passed.\n")), 02891 __FUNCTION__); 02892 return (EXIT_FAILURE); 02893 } 02894 if (ellipse->ratio < 0.0) 02895 { 02896 fprintf (stderr, 02897 (_("Error in %s () a negative value was found in the ratio member.\n")), 02898 __FUNCTION__); 02899 return (EXIT_FAILURE); 02900 } 02901 if (ellipse->ratio == 0.0) 02902 { 02903 fprintf (stderr, 02904 (_("Error in %s () a value of zero was found in the ratio member.\n")), 02905 __FUNCTION__); 02906 return (EXIT_FAILURE); 02907 } 02908 #if DEBUG 02909 DXF_DEBUG_END 02910 #endif 02911 return (ellipse->ratio); 02912 } 02913 02914 02921 DxfEllipse * 02922 dxf_ellipse_set_ratio 02923 ( 02924 DxfEllipse *ellipse, 02926 double ratio 02928 ) 02929 { 02930 #ifdef DEBUG 02931 DXF_DEBUG_BEGIN 02932 #endif 02933 /* Do some basic checks. */ 02934 if (ellipse == NULL) 02935 { 02936 fprintf (stderr, 02937 (_("Error in %s () a NULL pointer was passed.\n")), 02938 __FUNCTION__); 02939 return (NULL); 02940 } 02941 ellipse->ratio = ratio; 02942 #if DEBUG 02943 DXF_DEBUG_END 02944 #endif 02945 return (ellipse); 02946 } 02947 02948 02954 double 02955 dxf_ellipse_get_start_angle 02956 ( 02957 DxfEllipse *ellipse 02959 ) 02960 { 02961 #if DEBUG 02962 DXF_DEBUG_BEGIN 02963 #endif 02964 /* Do some basic checks. */ 02965 if (ellipse == NULL) 02966 { 02967 fprintf (stderr, 02968 (_("Error in %s () a NULL pointer was passed.\n")), 02969 __FUNCTION__); 02970 return (EXIT_FAILURE); 02971 } 02972 #if DEBUG 02973 DXF_DEBUG_END 02974 #endif 02975 return (ellipse->start_angle); 02976 } 02977 02978 02982 DxfEllipse * 02983 dxf_ellipse_set_start_angle 02984 ( 02985 DxfEllipse *ellipse, 02987 double start_angle 02989 ) 02990 { 02991 #if DEBUG 02992 DXF_DEBUG_BEGIN 02993 #endif 02994 /* Do some basic checks. */ 02995 if (ellipse == NULL) 02996 { 02997 fprintf (stderr, 02998 (_("Error in %s () a NULL pointer was passed.\n")), 02999 __FUNCTION__); 03000 return (NULL); 03001 } 03002 ellipse->start_angle = start_angle; 03003 #if DEBUG 03004 DXF_DEBUG_END 03005 #endif 03006 return (ellipse); 03007 } 03008 03009 03015 double 03016 dxf_ellipse_get_end_angle 03017 ( 03018 DxfEllipse *ellipse 03020 ) 03021 { 03022 #if DEBUG 03023 DXF_DEBUG_BEGIN 03024 #endif 03025 /* Do some basic checks. */ 03026 if (ellipse == 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 (ellipse->end_angle); 03037 } 03038 03039 03043 DxfEllipse * 03044 dxf_ellipse_set_end_angle 03045 ( 03046 DxfEllipse *ellipse, 03048 double end_angle 03050 ) 03051 { 03052 #if DEBUG 03053 DXF_DEBUG_BEGIN 03054 #endif 03055 /* Do some basic checks. */ 03056 if (ellipse == NULL) 03057 { 03058 fprintf (stderr, 03059 (_("Error in %s () a NULL pointer was passed.\n")), 03060 __FUNCTION__); 03061 return (NULL); 03062 } 03063 ellipse->end_angle = end_angle; 03064 #if DEBUG 03065 DXF_DEBUG_END 03066 #endif 03067 return (ellipse); 03068 } 03069 03070 03077 double 03078 dxf_ellipse_get_extr_x0 03079 ( 03080 DxfEllipse *ellipse 03082 ) 03083 { 03084 #ifdef DEBUG 03085 DXF_DEBUG_BEGIN 03086 #endif 03087 03088 /* Do some basic checks. */ 03089 if (ellipse == NULL) 03090 { 03091 fprintf (stderr, 03092 (_("Error in %s () a NULL pointer was passed.\n")), 03093 __FUNCTION__); 03094 return (EXIT_FAILURE); 03095 } 03096 #if DEBUG 03097 DXF_DEBUG_END 03098 #endif 03099 return (ellipse->extr_x0); 03100 } 03101 03102 03110 DxfEllipse * 03111 dxf_ellipse_set_extr_x0 03112 ( 03113 DxfEllipse *ellipse, 03115 double extr_x0 03118 ) 03119 { 03120 #ifdef DEBUG 03121 DXF_DEBUG_BEGIN 03122 #endif 03123 /* Do some basic checks. */ 03124 if (ellipse == NULL) 03125 { 03126 fprintf (stderr, 03127 (_("Error in %s () a NULL pointer was passed.\n")), 03128 __FUNCTION__); 03129 return (NULL); 03130 } 03131 ellipse->extr_x0 = extr_x0; 03132 #if DEBUG 03133 DXF_DEBUG_END 03134 #endif 03135 return (ellipse); 03136 } 03137 03138 03145 double 03146 dxf_ellipse_get_extr_y0 03147 ( 03148 DxfEllipse *ellipse 03150 ) 03151 { 03152 #ifdef DEBUG 03153 DXF_DEBUG_BEGIN 03154 #endif 03155 03156 /* Do some basic checks. */ 03157 if (ellipse == NULL) 03158 { 03159 fprintf (stderr, 03160 (_("Error in %s () a NULL pointer was passed.\n")), 03161 __FUNCTION__); 03162 return (EXIT_FAILURE); 03163 } 03164 #if DEBUG 03165 DXF_DEBUG_END 03166 #endif 03167 return (ellipse->extr_y0); 03168 } 03169 03170 03178 DxfEllipse * 03179 dxf_ellipse_set_extr_y0 03180 ( 03181 DxfEllipse *ellipse, 03183 double extr_y0 03186 ) 03187 { 03188 #ifdef DEBUG 03189 DXF_DEBUG_BEGIN 03190 #endif 03191 /* Do some basic checks. */ 03192 if (ellipse == NULL) 03193 { 03194 fprintf (stderr, 03195 (_("Error in %s () a NULL pointer was passed.\n")), 03196 __FUNCTION__); 03197 return (NULL); 03198 } 03199 ellipse->extr_y0 = extr_y0; 03200 #if DEBUG 03201 DXF_DEBUG_END 03202 #endif 03203 return (ellipse); 03204 } 03205 03206 03213 double 03214 dxf_ellipse_get_extr_z0 03215 ( 03216 DxfEllipse *ellipse 03218 ) 03219 { 03220 #ifdef DEBUG 03221 DXF_DEBUG_BEGIN 03222 #endif 03223 03224 /* Do some basic checks. */ 03225 if (ellipse == NULL) 03226 { 03227 fprintf (stderr, 03228 (_("Error in %s () a NULL pointer was passed.\n")), 03229 __FUNCTION__); 03230 return (EXIT_FAILURE); 03231 } 03232 #if DEBUG 03233 DXF_DEBUG_END 03234 #endif 03235 return (ellipse->extr_z0); 03236 } 03237 03238 03246 DxfEllipse * 03247 dxf_ellipse_set_extr_z0 03248 ( 03249 DxfEllipse *ellipse, 03251 double extr_z0 03254 ) 03255 { 03256 #ifdef DEBUG 03257 DXF_DEBUG_BEGIN 03258 #endif 03259 /* Do some basic checks. */ 03260 if (ellipse == NULL) 03261 { 03262 fprintf (stderr, 03263 (_("Error in %s () a NULL pointer was passed.\n")), 03264 __FUNCTION__); 03265 return (NULL); 03266 } 03267 ellipse->extr_z0 = extr_z0; 03268 #if DEBUG 03269 DXF_DEBUG_END 03270 #endif 03271 return (ellipse); 03272 } 03273 03274 03283 DxfPoint * 03284 dxf_ellipse_get_extrusion_vector_as_point 03285 ( 03286 DxfEllipse *ellipse 03288 ) 03289 { 03290 #ifdef DEBUG 03291 DXF_DEBUG_BEGIN 03292 #endif 03293 DxfPoint *point = NULL; 03294 03295 /* Do some basic checks. */ 03296 if (ellipse == NULL) 03297 { 03298 fprintf (stderr, 03299 (_("Error in %s () a NULL pointer was passed.\n")), 03300 __FUNCTION__); 03301 return (NULL); 03302 } 03303 point = dxf_point_init (point); 03304 if (point == NULL) 03305 { 03306 fprintf (stderr, 03307 (_("Error in %s () could not allocate memory for a DxfPoint struct.\n")), 03308 __FUNCTION__); 03309 return (NULL); 03310 } 03311 point->x0 = ellipse->extr_x0; 03312 point->y0 = ellipse->extr_y0; 03313 point->z0 = ellipse->extr_z0; 03314 #if DEBUG 03315 DXF_DEBUG_END 03316 #endif 03317 return (point); 03318 } 03319 03320 03325 DxfEllipse * 03326 dxf_ellipse_set_extrusion_vector_from_point 03327 ( 03328 DxfEllipse *ellipse, 03330 DxfPoint *point 03332 ) 03333 { 03334 #if DEBUG 03335 DXF_DEBUG_BEGIN 03336 #endif 03337 /* Do some basic checks. */ 03338 if (ellipse == NULL) 03339 { 03340 fprintf (stderr, 03341 (_("Error in %s () a NULL pointer was passed.\n")), 03342 __FUNCTION__); 03343 return (NULL); 03344 } 03345 if (point == NULL) 03346 { 03347 fprintf (stderr, 03348 (_("Error in %s () a NULL pointer was passed.\n")), 03349 __FUNCTION__); 03350 return (NULL); 03351 } 03352 ellipse->extr_x0 = (double) point->x0; 03353 ellipse->extr_y0 = (double) point->y0; 03354 ellipse->extr_z0 = (double) point->z0; 03355 #if DEBUG 03356 DXF_DEBUG_END 03357 #endif 03358 return (ellipse); 03359 } 03360 03361 03365 DxfEllipse * 03366 dxf_ellipse_set_extrusion_vector 03367 ( 03368 DxfEllipse *ellipse, 03370 double extr_x0, 03372 double extr_y0, 03374 double extr_z0 03376 ) 03377 { 03378 #if DEBUG 03379 DXF_DEBUG_BEGIN 03380 #endif 03381 /* Do some basic checks. */ 03382 if (ellipse == NULL) 03383 { 03384 fprintf (stderr, 03385 (_("Error in %s () a NULL pointer was passed.\n")), 03386 __FUNCTION__); 03387 return (NULL); 03388 } 03389 ellipse->extr_x0 = extr_x0; 03390 ellipse->extr_y0 = extr_y0; 03391 ellipse->extr_z0 = extr_z0; 03392 #if DEBUG 03393 DXF_DEBUG_END 03394 #endif 03395 return (ellipse); 03396 } 03397 03398 03407 DxfEllipse * 03408 dxf_ellipse_get_next 03409 ( 03410 DxfEllipse *ellipse 03412 ) 03413 { 03414 #if DEBUG 03415 DXF_DEBUG_BEGIN 03416 #endif 03417 /* Do some basic checks. */ 03418 if (ellipse == NULL) 03419 { 03420 fprintf (stderr, 03421 (_("Error in %s () a NULL pointer was passed.\n")), 03422 __FUNCTION__); 03423 return (NULL); 03424 } 03425 if (ellipse->next == NULL) 03426 { 03427 fprintf (stderr, 03428 (_("Error in %s () a NULL pointer was found in the next member.\n")), 03429 __FUNCTION__); 03430 return (NULL); 03431 } 03432 #if DEBUG 03433 DXF_DEBUG_END 03434 #endif 03435 return ((DxfEllipse *) ellipse->next); 03436 } 03437 03438 03443 DxfEllipse * 03444 dxf_ellipse_set_next 03445 ( 03446 DxfEllipse *ellipse, 03448 DxfEllipse *next 03450 ) 03451 { 03452 #if DEBUG 03453 DXF_DEBUG_BEGIN 03454 #endif 03455 /* Do some basic checks. */ 03456 if (ellipse == NULL) 03457 { 03458 fprintf (stderr, 03459 (_("Error in %s () a NULL pointer was passed.\n")), 03460 __FUNCTION__); 03461 return (NULL); 03462 } 03463 if (next == NULL) 03464 { 03465 fprintf (stderr, 03466 (_("Error in %s () a NULL pointer was passed.\n")), 03467 __FUNCTION__); 03468 return (NULL); 03469 } 03470 ellipse->next = (struct DxfEllipse *) next; 03471 #if DEBUG 03472 DXF_DEBUG_END 03473 #endif 03474 return (ellipse); 03475 } 03476 03477 03486 DxfEllipse * 03487 dxf_ellipse_get_last 03488 ( 03489 DxfEllipse *ellipse 03491 ) 03492 { 03493 #if DEBUG 03494 DXF_DEBUG_BEGIN 03495 #endif 03496 /* Do some basic checks. */ 03497 if (ellipse == NULL) 03498 { 03499 fprintf (stderr, 03500 (_("Error in %s () a NULL pointer was passed.\n")), 03501 __FUNCTION__); 03502 return (NULL); 03503 } 03504 if (ellipse->next == NULL) 03505 { 03506 fprintf (stderr, 03507 (_("Warning in %s () a NULL pointer was found.\n")), 03508 __FUNCTION__); 03509 return ((DxfEllipse *) ellipse); 03510 } 03511 DxfEllipse *iter = (DxfEllipse *) ellipse->next; 03512 while (iter->next != NULL) 03513 { 03514 iter = (DxfEllipse *) iter->next; 03515 } 03516 #if DEBUG 03517 DXF_DEBUG_END 03518 #endif 03519 return ((DxfEllipse *) iter); 03520 } 03521 03522 03523 /* EOF */