libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00038 #include "helix.h" 00039 00040 00049 DxfHelix * 00050 dxf_helix_new () 00051 { 00052 #if DEBUG 00053 DXF_DEBUG_BEGIN 00054 #endif 00055 DxfHelix *helix = NULL; 00056 size_t size; 00057 00058 size = sizeof (DxfHelix); 00059 /* avoid malloc of 0 bytes */ 00060 if (size == 0) size = 1; 00061 if ((helix = malloc (size)) == NULL) 00062 { 00063 fprintf (stderr, 00064 (_("Error in %s () could not allocate memory for a DxfHelix struct.\n")), 00065 __FUNCTION__); 00066 helix = NULL; 00067 } 00068 else 00069 { 00070 memset (helix, 0, size); 00071 } 00072 #if DEBUG 00073 DXF_DEBUG_END 00074 #endif 00075 return (helix); 00076 } 00077 00078 00086 DxfHelix * 00087 dxf_helix_init 00088 ( 00089 DxfHelix *helix 00091 ) 00092 { 00093 #if DEBUG 00094 DXF_DEBUG_BEGIN 00095 #endif 00096 /* Do some basic checks. */ 00097 if (helix == NULL) 00098 { 00099 fprintf (stderr, 00100 (_("Warning in %s () a NULL pointer was passed.\n")), 00101 __FUNCTION__); 00102 helix = dxf_helix_new (); 00103 } 00104 if (helix == NULL) 00105 { 00106 fprintf (stderr, 00107 (_("Error in %s () could not allocate memory for a DxfHelix struct.\n")), 00108 __FUNCTION__); 00109 return (NULL); 00110 } 00111 helix->id_code = 0; 00112 helix->linetype = strdup (DXF_DEFAULT_LINETYPE); 00113 helix->layer = strdup (DXF_DEFAULT_LAYER); 00114 helix->p0 = dxf_point_init (helix->p0); 00115 helix->p1 = dxf_point_init (helix->p1); 00116 helix->p2 = dxf_point_init (helix->p2); 00117 helix->thickness = 0.0; 00118 helix->radius = 0.0; 00119 helix->number_of_turns = 0.0; 00120 helix->turn_height = 0.0; 00121 helix->linetype_scale = 0.0; 00122 helix->visibility = 0; 00123 helix->color = DXF_COLOR_BYLAYER; 00124 helix->paperspace = DXF_MODELSPACE; 00125 helix->major_release_number = 0; 00126 helix->maintainance_release_number = 0; 00127 helix->graphics_data_size = 0; 00128 helix->constraint_type = 0; 00129 helix->shadow_mode = 0; 00130 helix->handedness = 0; 00131 helix->binary_graphics_data = (DxfBinaryGraphicsData *) dxf_binary_graphics_data_init (helix->binary_graphics_data); 00132 helix->dictionary_owner_hard = strdup (""); 00133 helix->material = strdup (""); 00134 helix->dictionary_owner_soft = strdup (""); 00135 helix->lineweight = 0; 00136 helix->plot_style_name = strdup (""); 00137 helix->color_value = 0; 00138 helix->color_name = strdup (""); 00139 helix->transparency = 0; 00140 helix->spline = (DxfSpline *) dxf_spline_init (helix->spline); 00141 helix->next = NULL; 00142 #if DEBUG 00143 DXF_DEBUG_END 00144 #endif 00145 return (helix); 00146 } 00147 00148 00161 DxfHelix * 00162 dxf_helix_read 00163 ( 00164 DxfFile *fp, 00166 DxfHelix *helix 00168 ) 00169 { 00170 #if DEBUG 00171 DXF_DEBUG_BEGIN 00172 #endif 00173 char *temp_string = NULL; 00174 int i; 00175 00176 /* Do some basic checks. */ 00177 if (fp == NULL) 00178 { 00179 fprintf (stderr, 00180 (_("Error in %s () a NULL file pointer was passed.\n")), 00181 __FUNCTION__); 00182 /* Clean up. */ 00183 free (temp_string); 00184 return (NULL); 00185 } 00186 if (helix == NULL) 00187 { 00188 fprintf (stderr, 00189 (_("Warning in %s () a NULL pointer was passed.\n")), 00190 __FUNCTION__); 00191 helix = dxf_helix_new (); 00192 helix = dxf_helix_init (helix); 00193 } 00194 i = 0; 00195 (fp->line_number)++; 00196 fscanf (fp->fp, "%[^\n]", temp_string); 00197 while (strcmp (temp_string, "0") != 0) 00198 { 00199 if (ferror (fp->fp)) 00200 { 00201 fprintf (stderr, 00202 (_("Error in %s () while reading from: %s in line: %d.\n")), 00203 __FUNCTION__, fp->filename, fp->line_number); 00204 fclose (fp->fp); 00205 /* Clean up. */ 00206 free (temp_string); 00207 return (NULL); 00208 } 00209 if (strcmp (temp_string, "5") == 0) 00210 { 00211 /* Now follows a string containing a sequential 00212 * id number. */ 00213 (fp->line_number)++; 00214 fscanf (fp->fp, "%x\n", &helix->id_code); 00215 } 00216 else if (strcmp (temp_string, "6") == 0) 00217 { 00218 /* Now follows a string containing a linetype 00219 * name. */ 00220 (fp->line_number)++; 00221 fscanf (fp->fp, "%s\n", helix->linetype); 00222 } 00223 else if (strcmp (temp_string, "8") == 0) 00224 { 00225 /* Now follows a string containing a layer name. */ 00226 (fp->line_number)++; 00227 fscanf (fp->fp, "%s\n", helix->layer); 00228 } 00229 else if (strcmp (temp_string, "10") == 0) 00230 { 00231 /* Now follows a string containing the 00232 * X-coordinate of the axis base point. */ 00233 (fp->line_number)++; 00234 fscanf (fp->fp, "%lf\n", &helix->p0->x0); 00235 } 00236 else if (strcmp (temp_string, "20") == 0) 00237 { 00238 /* Now follows a string containing the 00239 * Y-coordinate of the axis base point. */ 00240 (fp->line_number)++; 00241 fscanf (fp->fp, "%lf\n", &helix->p0->y0); 00242 } 00243 else if (strcmp (temp_string, "30") == 0) 00244 { 00245 /* Now follows a string containing the 00246 * Z-coordinate of the axis base point. */ 00247 (fp->line_number)++; 00248 fscanf (fp->fp, "%lf\n", &helix->p0->z0); 00249 } 00250 else if (strcmp (temp_string, "11") == 0) 00251 { 00252 /* Now follows a string containing the 00253 * X-coordinate of the start point. */ 00254 (fp->line_number)++; 00255 fscanf (fp->fp, "%lf\n", &helix->p1->x0); 00256 } 00257 else if (strcmp (temp_string, "21") == 0) 00258 { 00259 /* Now follows a string containing the 00260 * Y-coordinate of the start point. */ 00261 (fp->line_number)++; 00262 fscanf (fp->fp, "%lf\n", &helix->p1->y0); 00263 } 00264 else if (strcmp (temp_string, "31") == 0) 00265 { 00266 /* Now follows a string containing the 00267 * Z-coordinate of the start point. */ 00268 (fp->line_number)++; 00269 fscanf (fp->fp, "%lf\n", &helix->p1->z0); 00270 } 00271 else if (strcmp (temp_string, "12") == 0) 00272 { 00273 /* Now follows a string containing the 00274 * X-coordinate of the axis vector point. */ 00275 (fp->line_number)++; 00276 fscanf (fp->fp, "%lf\n", &helix->p2->x0); 00277 } 00278 else if (strcmp (temp_string, "22") == 0) 00279 { 00280 /* Now follows a string containing the 00281 * Y-coordinate of the axis vector point. */ 00282 (fp->line_number)++; 00283 fscanf (fp->fp, "%lf\n", &helix->p2->y0); 00284 } 00285 else if (strcmp (temp_string, "32") == 0) 00286 { 00287 /* Now follows a string containing the 00288 * Z-coordinate of the axis vector point. */ 00289 (fp->line_number)++; 00290 fscanf (fp->fp, "%lf\n", &helix->p2->z0); 00291 } 00292 else if (strcmp (temp_string, "39") == 0) 00293 { 00294 /* Now follows a string containing the 00295 * thickness. */ 00296 (fp->line_number)++; 00297 fscanf (fp->fp, "%lf\n", &helix->thickness); 00298 } 00299 else if (strcmp (temp_string, "40") == 0) 00300 { 00301 /* Now follows a string containing the 00302 * radius. */ 00303 (fp->line_number)++; 00304 fscanf (fp->fp, "%lf\n", &helix->radius); 00305 } 00306 else if (strcmp (temp_string, "41") == 0) 00307 { 00308 /* Now follows a string containing the number of 00309 * turns. */ 00310 (fp->line_number)++; 00311 fscanf (fp->fp, "%lf\n", &helix->number_of_turns); 00312 } 00313 else if (strcmp (temp_string, "42") == 0) 00314 { 00315 /* Now follows a string containing the turn 00316 * height. */ 00317 (fp->line_number)++; 00318 fscanf (fp->fp, "%lf\n", &helix->turn_height); 00319 } 00320 else if (strcmp (temp_string, "48") == 0) 00321 { 00322 /* Now follows a string containing the linetype 00323 * scale. */ 00324 (fp->line_number)++; 00325 fscanf (fp->fp, "%lf\n", &helix->linetype_scale); 00326 } 00327 else if (strcmp (temp_string, "60") == 0) 00328 { 00329 /* Now follows a string containing the 00330 * visibility value. */ 00331 (fp->line_number)++; 00332 fscanf (fp->fp, "%hd\n", &helix->visibility); 00333 } 00334 else if (strcmp (temp_string, "62") == 0) 00335 { 00336 /* Now follows a string containing the 00337 * color value. */ 00338 (fp->line_number)++; 00339 fscanf (fp->fp, "%d\n", &helix->color); 00340 } 00341 else if (strcmp (temp_string, "67") == 0) 00342 { 00343 /* Now follows a string containing the 00344 * paperspace value. */ 00345 (fp->line_number)++; 00346 fscanf (fp->fp, "%d\n", &helix->paperspace); 00347 } 00348 else if (strcmp (temp_string, "90") == 0) 00349 { 00350 /* Now follows a string containing a major 00351 * release number. */ 00352 (fp->line_number)++; 00353 fscanf (fp->fp, "%ld\n", &helix->major_release_number); 00354 } 00355 else if (strcmp (temp_string, "91") == 0) 00356 { 00357 /* Now follows a string containing a maintenance 00358 * release number. */ 00359 (fp->line_number)++; 00360 fscanf (fp->fp, "%ld\n", &helix->maintainance_release_number); 00361 } 00362 else if (strcmp (temp_string, "92") == 0) 00363 { 00364 /* Now follows a string containing the 00365 * paperspace value. */ 00366 (fp->line_number)++; 00367 fscanf (fp->fp, "%d\n", &helix->graphics_data_size); 00368 } 00369 else if (strcmp (temp_string, "100") == 0) 00370 { 00371 /* Now follows a string containing the 00372 * subclass marker value. */ 00373 (fp->line_number)++; 00374 fscanf (fp->fp, "%s\n", temp_string); 00375 if ((strcmp (temp_string, "AcDbSpline") == 0)) 00376 { 00377 helix->spline = dxf_spline_read (fp, helix->spline); 00378 } 00379 else if ((strcmp (temp_string, "AcDbEntity") != 0) 00380 && ((strcmp (temp_string, "AcDbHelix") != 0))) 00381 { 00382 fprintf (stderr, 00383 (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")), 00384 __FUNCTION__, fp->filename, fp->line_number); 00385 } 00386 } 00387 else if (strcmp (temp_string, "160") == 0) 00388 { 00389 /* Now follows a string containing the 00390 * graphics data size value. */ 00391 (fp->line_number)++; 00392 fscanf (fp->fp, "%d\n", &helix->graphics_data_size); 00393 } 00394 else if (strcmp (temp_string, "280") == 0) 00395 { 00396 /* Now follows a string containing a constraint 00397 * type value. */ 00398 (fp->line_number)++; 00399 fscanf (fp->fp, "%d\n", &helix->constraint_type); 00400 } 00401 else if (strcmp (temp_string, "284") == 0) 00402 { 00403 /* Now follows a string containing the shadow 00404 * mode value. */ 00405 (fp->line_number)++; 00406 fscanf (fp->fp, "%hd\n", &helix->shadow_mode); 00407 } 00408 else if (strcmp (temp_string, "290") == 0) 00409 { 00410 /* Now follows a string containing a handedness 00411 * value. */ 00412 (fp->line_number)++; 00413 fscanf (fp->fp, "%d\n", &helix->handedness); 00414 } 00415 else if (strcmp (temp_string, "310") == 0) 00416 { 00417 /* Now follows a string containing binary 00418 * graphics data. */ 00419 (fp->line_number)++; 00420 fscanf (fp->fp, "%s\n", helix->binary_graphics_data->data_line); 00421 dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) helix->binary_graphics_data->next); 00422 helix->binary_graphics_data = (DxfBinaryGraphicsData *) helix->binary_graphics_data->next; 00423 } 00424 else if (strcmp (temp_string, "330") == 0) 00425 { 00426 /* Now follows a string containing a 00427 * soft-pointer ID/handle to owner dictionary. */ 00428 (fp->line_number)++; 00429 fscanf (fp->fp, "%s\n", helix->dictionary_owner_soft); 00430 } 00431 else if (strcmp (temp_string, "347") == 0) 00432 { 00433 /* Now follows a string containing a 00434 * hard-pointer ID/handle to material object. */ 00435 (fp->line_number)++; 00436 fscanf (fp->fp, "%s\n", helix->material); 00437 } 00438 else if (strcmp (temp_string, "360") == 0) 00439 { 00440 /* Now follows a string containing a 00441 * hard-pointer ID/handle to owner dictionary. */ 00442 (fp->line_number)++; 00443 fscanf (fp->fp, "%s\n", helix->dictionary_owner_hard); 00444 } 00445 else if (strcmp (temp_string, "370") == 0) 00446 { 00447 /* Now follows a string containing the lineweight 00448 * value. */ 00449 (fp->line_number)++; 00450 fscanf (fp->fp, "%hd\n", &helix->lineweight); 00451 } 00452 else if (strcmp (temp_string, "390") == 0) 00453 { 00454 /* Now follows a string containing a plot style 00455 * name value. */ 00456 (fp->line_number)++; 00457 fscanf (fp->fp, "%s\n", helix->plot_style_name); 00458 } 00459 else if (strcmp (temp_string, "420") == 0) 00460 { 00461 /* Now follows a string containing a color value. */ 00462 (fp->line_number)++; 00463 fscanf (fp->fp, "%ld\n", &helix->color_value); 00464 } 00465 else if (strcmp (temp_string, "430") == 0) 00466 { 00467 /* Now follows a string containing a color 00468 * name value. */ 00469 (fp->line_number)++; 00470 fscanf (fp->fp, "%s\n", helix->color_name); 00471 } 00472 else if (strcmp (temp_string, "440") == 0) 00473 { 00474 /* Now follows a string containing a transparency 00475 * value. */ 00476 (fp->line_number)++; 00477 fscanf (fp->fp, "%ld\n", &helix->transparency); 00478 } 00479 else if (strcmp (temp_string, "999") == 0) 00480 { 00481 /* Now follows a string containing a comment. */ 00482 (fp->line_number)++; 00483 fscanf (fp->fp, "%s\n", temp_string); 00484 fprintf (stdout, "DXF comment: %s\n", temp_string); 00485 } 00486 else 00487 { 00488 fprintf (stderr, 00489 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00490 __FUNCTION__, fp->filename, fp->line_number); 00491 } 00492 } 00493 /* Handle omitted members and/or illegal values. */ 00494 if (strcmp (helix->linetype, "") == 0) 00495 { 00496 helix->linetype = strdup (DXF_DEFAULT_LINETYPE); 00497 } 00498 if (strcmp (helix->layer, "") == 0) 00499 { 00500 helix->layer = strdup (DXF_DEFAULT_LAYER); 00501 } 00502 /* Clean up. */ 00503 free (temp_string); 00504 #if DEBUG 00505 DXF_DEBUG_END 00506 #endif 00507 return (helix); 00508 } 00509 00510 00517 int 00518 dxf_helix_write 00519 ( 00520 DxfFile *fp, 00522 DxfHelix *helix 00524 ) 00525 { 00526 #if DEBUG 00527 DXF_DEBUG_BEGIN 00528 #endif 00529 char *dxf_entity_name = strdup ("HELIX"); 00530 int i; 00531 00532 /* Do some basic checks. */ 00533 if (fp == NULL) 00534 { 00535 fprintf (stderr, 00536 (_("Error in %s () a NULL file pointer was passed.\n")), 00537 __FUNCTION__); 00538 /* Clean up. */ 00539 free (dxf_entity_name); 00540 return (EXIT_FAILURE); 00541 } 00542 if (helix == NULL) 00543 { 00544 fprintf (stderr, 00545 (_("Error in %s () a NULL pointer was passed.\n")), 00546 __FUNCTION__); 00547 /* Clean up. */ 00548 free (dxf_entity_name); 00549 return (EXIT_FAILURE); 00550 } 00551 if (helix->radius == 0.0) 00552 { 00553 fprintf (stderr, 00554 (_("Error in %s () radius value equals 0.0 for the %s entity with id-code: %x.\n")), 00555 __FUNCTION__, dxf_entity_name, helix->id_code); 00556 fprintf (stderr, " skipping %s entity.\n", 00557 dxf_entity_name); 00558 /* Clean up. */ 00559 free (dxf_entity_name); 00560 return (EXIT_FAILURE); 00561 } 00562 if (fp->acad_version_number < AutoCAD_2007) 00563 { 00564 fprintf (stderr, 00565 (_("Warning in %s () illegal DXF version for this entity.\n")), 00566 __FUNCTION__); 00567 } 00568 if (strcmp (helix->linetype, "") == 0) 00569 { 00570 fprintf (stderr, 00571 (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")), 00572 __FUNCTION__, dxf_entity_name, helix->id_code); 00573 fprintf (stderr, 00574 (_("\t%s entity is reset to default linetype")), 00575 dxf_entity_name); 00576 helix->linetype = strdup (DXF_DEFAULT_LINETYPE); 00577 } 00578 if (strcmp (helix->layer, "") == 0) 00579 { 00580 fprintf (stderr, 00581 (_("Warning in %s () empty layer string for the %s entity with id-code: %x.\n")), 00582 __FUNCTION__, dxf_entity_name, helix->id_code); 00583 fprintf (stderr, 00584 (_("\t%s entity is relocated to default layer.\n")), 00585 dxf_entity_name); 00586 helix->layer = DXF_DEFAULT_LAYER; 00587 } 00588 /* Start writing output. */ 00589 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00590 if (helix->id_code != -1) 00591 { 00592 fprintf (fp->fp, " 5\n%x\n", helix->id_code); 00593 } 00594 fprintf (fp->fp, "330\n%s\n", helix->dictionary_owner_soft); 00595 fprintf (fp->fp, "100\nAcDbEntity\n"); 00596 if (helix->paperspace != DXF_MODELSPACE) 00597 { 00598 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE); 00599 } 00600 fprintf (fp->fp, " 8\n%s\n", helix->layer); 00601 if (strcmp (helix->linetype, DXF_DEFAULT_LINETYPE) != 0) 00602 { 00603 fprintf (fp->fp, " 6\n%s\n", helix->linetype); 00604 } 00605 if (strcmp (helix->material, "") != 0) 00606 { 00607 fprintf (fp->fp, "347\n%s\n", helix->material); 00608 } 00609 if (helix->color != DXF_COLOR_BYLAYER) 00610 { 00611 fprintf (fp->fp, " 62\n%d\n", helix->color); 00612 } 00613 fprintf (fp->fp, "370\n%d\n", helix->lineweight); 00614 if (helix->thickness != 0.0) 00615 { 00616 fprintf (fp->fp, " 39\n%f\n", helix->thickness); 00617 } 00618 if (helix->linetype_scale != 1.0) 00619 { 00620 fprintf (fp->fp, " 48\n%f\n", helix->linetype_scale); 00621 } 00622 if (helix->visibility != 0) 00623 { 00624 fprintf (fp->fp, " 60\n%d\n", helix->visibility); 00625 } 00626 #ifdef BUILD_64 00627 fprintf (fp->fp, "160\n%d\n", helix->graphics_data_size); 00628 #else 00629 fprintf (fp->fp, " 92\n%d\n", helix->graphics_data_size); 00630 #endif 00631 while (helix->binary_graphics_data != NULL) 00632 { 00633 fprintf (fp->fp, "310\n%s\n", helix->binary_graphics_data->data_line); 00634 helix->binary_graphics_data = (DxfBinaryGraphicsData *) dxf_binary_graphics_data_get_next (helix->binary_graphics_data); 00635 } 00636 fprintf (fp->fp, "420\n%ld\n", helix->color_value); 00637 fprintf (fp->fp, "430\n%s\n", helix->color_name); 00638 fprintf (fp->fp, "440\n%ld\n", helix->transparency); 00639 fprintf (fp->fp, "390\n%s\n", helix->plot_style_name); 00640 fprintf (fp->fp, "284\n%d\n", helix->shadow_mode); 00641 /* Write a spline to a DxfFile. */ 00642 helix->spline->flag = 0; 00643 helix->spline->degree = 3; 00644 fprintf (fp->fp, "100\nAcDbSpline\n"); 00645 fprintf (fp->fp, " 70\n%d\n", helix->spline->flag); 00646 fprintf (fp->fp, " 71\n%d\n", helix->spline->degree); 00647 fprintf (fp->fp, " 72\n%d\n", helix->spline->number_of_knots); 00648 fprintf (fp->fp, " 73\n%d\n", helix->spline->number_of_control_points); 00649 fprintf (fp->fp, " 74\n%d\n", helix->spline->number_of_fit_points); 00650 fprintf (fp->fp, " 42\n%f\n", helix->spline->knot_tolerance); 00651 fprintf (fp->fp, " 43\n%f\n", helix->spline->control_point_tolerance); 00652 fprintf (fp->fp, " 12\n%f\n", helix->spline->p2->x0); 00653 fprintf (fp->fp, " 22\n%f\n", helix->spline->p2->y0); 00654 fprintf (fp->fp, " 32\n%f\n", helix->spline->p2->z0); 00655 fprintf (fp->fp, " 13\n%f\n", helix->spline->p3->x0); 00656 fprintf (fp->fp, " 23\n%f\n", helix->spline->p3->y0); 00657 fprintf (fp->fp, " 33\n%f\n", helix->spline->p3->z0); 00658 for (i = 0; i < helix->spline->number_of_knots; i++) 00659 { 00660 fprintf (fp->fp, " 40\n%f\n", helix->spline->knot_value->value); 00662 } 00663 if (helix->spline->number_of_fit_points != 0) 00664 { 00665 for (i = 0; i < helix->spline->number_of_fit_points; i++) 00666 { 00667 fprintf (fp->fp, " 41\n%f\n", helix->spline->weight_value->value); 00669 } 00670 } 00671 while (helix->spline->p0 != NULL) 00672 { 00673 fprintf (fp->fp, " 10\n%f\n", helix->spline->p0->x0); 00674 fprintf (fp->fp, " 20\n%f\n", helix->spline->p0->y0); 00675 fprintf (fp->fp, " 30\n%f\n", helix->spline->p0->z0); 00676 helix->spline->p0 = (DxfPoint *) helix->spline->p0->next; 00677 } 00678 while (helix->spline->p1 != NULL) 00679 { 00680 fprintf (fp->fp, " 11\n%f\n", helix->spline->p1->x0); 00681 fprintf (fp->fp, " 21\n%f\n", helix->spline->p1->y0); 00682 fprintf (fp->fp, " 31\n%f\n", helix->spline->p1->z0); 00683 helix->spline->p1 = (DxfPoint *) helix->spline->p1->next; 00684 } 00685 /* Continue writing helix entity parameters. */ 00686 fprintf (fp->fp, "100\nAcDbHelix\n"); 00687 fprintf (fp->fp, " 90\n%ld\n", helix->major_release_number); 00688 fprintf (fp->fp, " 91\n%ld\n", helix->maintainance_release_number); 00689 fprintf (fp->fp, " 10\n%f\n", helix->p0->x0); 00690 fprintf (fp->fp, " 20\n%f\n", helix->p0->y0); 00691 fprintf (fp->fp, " 30\n%f\n", helix->p0->z0); 00692 fprintf (fp->fp, " 11\n%f\n", helix->p1->x0); 00693 fprintf (fp->fp, " 21\n%f\n", helix->p1->y0); 00694 fprintf (fp->fp, " 31\n%f\n", helix->p1->z0); 00695 fprintf (fp->fp, " 12\n%f\n", helix->p2->x0); 00696 fprintf (fp->fp, " 22\n%f\n", helix->p2->y0); 00697 fprintf (fp->fp, " 32\n%f\n", helix->p2->z0); 00698 fprintf (fp->fp, " 40\n%f\n", helix->radius); 00699 fprintf (fp->fp, " 41\n%f\n", helix->number_of_turns); 00700 fprintf (fp->fp, " 42\n%f\n", helix->turn_height); 00701 fprintf (fp->fp, "290\n%d\n", helix->handedness); 00702 fprintf (fp->fp, "280\n%d\n", helix->constraint_type); 00703 /* Clean up. */ 00704 free (dxf_entity_name); 00705 #if DEBUG 00706 DXF_DEBUG_END 00707 #endif 00708 return (EXIT_SUCCESS); 00709 } 00710 00711 00719 int 00720 dxf_helix_free 00721 ( 00722 DxfHelix *helix 00725 ) 00726 { 00727 #if DEBUG 00728 DXF_DEBUG_BEGIN 00729 #endif 00730 /* Do some basic checks. */ 00731 if (helix == NULL) 00732 { 00733 fprintf (stderr, 00734 (_("Error in %s () a NULL pointer was passed.\n")), 00735 __FUNCTION__); 00736 return (EXIT_FAILURE); 00737 } 00738 if (helix->next != NULL) 00739 { 00740 fprintf (stderr, 00741 (_("Error in %s () pointer to next was not NULL.\n")), 00742 __FUNCTION__); 00743 return (EXIT_FAILURE); 00744 } 00745 free (dxf_helix_get_linetype (helix)); 00746 free (dxf_helix_get_layer (helix)); 00747 dxf_binary_graphics_data_free_chain ((DxfBinaryGraphicsData *) dxf_helix_get_binary_graphics_data (helix)); 00748 free (dxf_helix_get_dictionary_owner_hard (helix)); 00749 free (dxf_helix_get_material (helix)); 00750 free (dxf_helix_get_dictionary_owner_soft (helix)); 00751 free (dxf_helix_get_plot_style_name (helix)); 00752 free (dxf_helix_get_color_name (helix)); 00753 dxf_point_free (dxf_helix_get_p0 (helix)); 00754 dxf_point_free (dxf_helix_get_p1 (helix)); 00755 dxf_point_free (dxf_helix_get_p2 (helix)); 00756 free (helix); 00757 helix = NULL; 00758 #if DEBUG 00759 DXF_DEBUG_END 00760 #endif 00761 return (EXIT_SUCCESS); 00762 } 00763 00764 00769 void 00770 dxf_helix_free_chain 00771 ( 00772 DxfHelix *helices 00775 ) 00776 { 00777 #ifdef DEBUG 00778 DXF_DEBUG_BEGIN 00779 #endif 00780 if (helices == NULL) 00781 { 00782 fprintf (stderr, 00783 (_("Warning in %s () a NULL pointer was passed.\n")), 00784 __FUNCTION__); 00785 } 00786 while (helices != NULL) 00787 { 00788 struct DxfHelix *iter = helices->next; 00789 dxf_helix_free (helices); 00790 helices = (DxfHelix *) iter; 00791 } 00792 #if DEBUG 00793 DXF_DEBUG_END 00794 #endif 00795 } 00796 00797 00804 int 00805 dxf_helix_get_id_code 00806 ( 00807 DxfHelix *helix 00809 ) 00810 { 00811 #if DEBUG 00812 DXF_DEBUG_BEGIN 00813 #endif 00814 /* Do some basic checks. */ 00815 if (helix == NULL) 00816 { 00817 fprintf (stderr, 00818 (_("Error in %s () a NULL pointer was passed.\n")), 00819 __FUNCTION__); 00820 return (EXIT_FAILURE); 00821 } 00822 if (helix->id_code < 0) 00823 { 00824 fprintf (stderr, 00825 (_("Error in %s () a negative value was found in the id_code member.\n")), 00826 __FUNCTION__); 00827 return (EXIT_FAILURE); 00828 } 00829 #if DEBUG 00830 DXF_DEBUG_END 00831 #endif 00832 return (helix->id_code); 00833 } 00834 00835 00842 DxfHelix * 00843 dxf_helix_set_id_code 00844 ( 00845 DxfHelix *helix, 00847 int id_code 00851 ) 00852 { 00853 #if DEBUG 00854 DXF_DEBUG_BEGIN 00855 #endif 00856 /* Do some basic checks. */ 00857 if (helix == NULL) 00858 { 00859 fprintf (stderr, 00860 (_("Error in %s () a NULL pointer was passed.\n")), 00861 __FUNCTION__); 00862 return (NULL); 00863 } 00864 if (id_code < 0) 00865 { 00866 fprintf (stderr, 00867 (_("Error in %s () a negative id-code value was passed.\n")), 00868 __FUNCTION__); 00869 return (NULL); 00870 } 00871 helix->id_code = id_code; 00872 #if DEBUG 00873 DXF_DEBUG_END 00874 #endif 00875 return (helix); 00876 } 00877 00878 00884 char * 00885 dxf_helix_get_linetype 00886 ( 00887 DxfHelix *helix 00889 ) 00890 { 00891 #if DEBUG 00892 DXF_DEBUG_BEGIN 00893 #endif 00894 /* Do some basic checks. */ 00895 if (helix == NULL) 00896 { 00897 fprintf (stderr, 00898 (_("Error in %s () a NULL pointer was passed.\n")), 00899 __FUNCTION__); 00900 return (NULL); 00901 } 00902 if (helix->linetype == NULL) 00903 { 00904 fprintf (stderr, 00905 (_("Error in %s () a NULL pointer was found in the linetype member.\n")), 00906 __FUNCTION__); 00907 return (NULL); 00908 } 00909 #if DEBUG 00910 DXF_DEBUG_END 00911 #endif 00912 return (strdup (helix->linetype)); 00913 } 00914 00915 00922 DxfHelix * 00923 dxf_helix_set_linetype 00924 ( 00925 DxfHelix *helix, 00927 char *linetype 00929 ) 00930 { 00931 #if DEBUG 00932 DXF_DEBUG_BEGIN 00933 #endif 00934 /* Do some basic checks. */ 00935 if (helix == NULL) 00936 { 00937 fprintf (stderr, 00938 (_("Error in %s () a NULL pointer was passed.\n")), 00939 __FUNCTION__); 00940 return (NULL); 00941 } 00942 if (linetype == NULL) 00943 { 00944 fprintf (stderr, 00945 (_("Error in %s () a NULL pointer was passed.\n")), 00946 __FUNCTION__); 00947 return (NULL); 00948 } 00949 helix->linetype = strdup (linetype); 00950 #if DEBUG 00951 DXF_DEBUG_END 00952 #endif 00953 return (helix); 00954 } 00955 00956 00962 char * 00963 dxf_helix_get_layer 00964 ( 00965 DxfHelix *helix 00967 ) 00968 { 00969 #if DEBUG 00970 DXF_DEBUG_BEGIN 00971 #endif 00972 /* Do some basic checks. */ 00973 if (helix == NULL) 00974 { 00975 fprintf (stderr, 00976 (_("Error in %s () a NULL pointer was passed.\n")), 00977 __FUNCTION__); 00978 return (NULL); 00979 } 00980 if (helix->layer == NULL) 00981 { 00982 fprintf (stderr, 00983 (_("Error in %s () a NULL pointer was found in the layer member.\n")), 00984 __FUNCTION__); 00985 return (NULL); 00986 } 00987 #if DEBUG 00988 DXF_DEBUG_END 00989 #endif 00990 return (strdup (helix->layer)); 00991 } 00992 00993 01000 DxfHelix * 01001 dxf_helix_set_layer 01002 ( 01003 DxfHelix *helix, 01005 char *layer 01007 ) 01008 { 01009 #if DEBUG 01010 DXF_DEBUG_BEGIN 01011 #endif 01012 /* Do some basic checks. */ 01013 if (helix == NULL) 01014 { 01015 fprintf (stderr, 01016 (_("Error in %s () a NULL pointer was passed.\n")), 01017 __FUNCTION__); 01018 return (NULL); 01019 } 01020 if (layer == NULL) 01021 { 01022 fprintf (stderr, 01023 (_("Error in %s () a NULL pointer was passed.\n")), 01024 __FUNCTION__); 01025 return (NULL); 01026 } 01027 helix->layer = strdup (layer); 01028 #if DEBUG 01029 DXF_DEBUG_END 01030 #endif 01031 return (helix); 01032 } 01033 01034 01041 double 01042 dxf_helix_get_thickness 01043 ( 01044 DxfHelix *helix 01046 ) 01047 { 01048 #if DEBUG 01049 DXF_DEBUG_BEGIN 01050 #endif 01051 /* Do some basic checks. */ 01052 if (helix == NULL) 01053 { 01054 fprintf (stderr, 01055 (_("Error in %s () a NULL pointer was passed.\n")), 01056 __FUNCTION__); 01057 return (EXIT_FAILURE); 01058 } 01059 if (helix->thickness < 0.0) 01060 { 01061 fprintf (stderr, 01062 (_("Warning in %s () a negative value was found in the thickness member.\n")), 01063 __FUNCTION__); 01064 } 01065 #if DEBUG 01066 DXF_DEBUG_END 01067 #endif 01068 return (helix->thickness); 01069 } 01070 01071 01078 DxfHelix * 01079 dxf_helix_set_thickness 01080 ( 01081 DxfHelix *helix, 01083 double thickness 01085 ) 01086 { 01087 #if DEBUG 01088 DXF_DEBUG_BEGIN 01089 #endif 01090 /* Do some basic checks. */ 01091 if (helix == NULL) 01092 { 01093 fprintf (stderr, 01094 (_("Error in %s () a NULL pointer was passed.\n")), 01095 __FUNCTION__); 01096 return (NULL); 01097 } 01098 if (thickness < 0.0) 01099 { 01100 fprintf (stderr, 01101 (_("Warning in %s () a negative thickness value was passed.\n")), 01102 __FUNCTION__); 01103 } 01104 helix->thickness = thickness; 01105 #if DEBUG 01106 DXF_DEBUG_END 01107 #endif 01108 return (helix); 01109 } 01110 01111 01118 double 01119 dxf_helix_get_linetype_scale 01120 ( 01121 DxfHelix *helix 01123 ) 01124 { 01125 #if DEBUG 01126 DXF_DEBUG_BEGIN 01127 #endif 01128 /* Do some basic checks. */ 01129 if (helix == NULL) 01130 { 01131 fprintf (stderr, 01132 (_("Error in %s () a NULL pointer was passed.\n")), 01133 __FUNCTION__); 01134 return (EXIT_FAILURE); 01135 } 01136 if (helix->linetype_scale < 0.0) 01137 { 01138 fprintf (stderr, 01139 (_("Error in %s () a negative value was found in the linetype scale member.\n")), 01140 __FUNCTION__); 01141 return (EXIT_FAILURE); 01142 } 01143 #if DEBUG 01144 DXF_DEBUG_END 01145 #endif 01146 return (helix->linetype_scale); 01147 } 01148 01149 01156 DxfHelix * 01157 dxf_helix_set_linetype_scale 01158 ( 01159 DxfHelix *helix, 01161 double linetype_scale 01163 ) 01164 { 01165 #if DEBUG 01166 DXF_DEBUG_BEGIN 01167 #endif 01168 /* Do some basic checks. */ 01169 if (helix == NULL) 01170 { 01171 fprintf (stderr, 01172 (_("Error in %s () a NULL pointer was passed.\n")), 01173 __FUNCTION__); 01174 return (NULL); 01175 } 01176 if (linetype_scale < 0.0) 01177 { 01178 fprintf (stderr, 01179 (_("Error in %s () a negative linetype scale value was passed.\n")), 01180 __FUNCTION__); 01181 return (NULL); 01182 } 01183 helix->linetype_scale = linetype_scale; 01184 #if DEBUG 01185 DXF_DEBUG_END 01186 #endif 01187 return (helix); 01188 } 01189 01190 01197 int16_t 01198 dxf_helix_get_visibility 01199 ( 01200 DxfHelix *helix 01202 ) 01203 { 01204 #if DEBUG 01205 DXF_DEBUG_BEGIN 01206 #endif 01207 /* Do some basic checks. */ 01208 if (helix == NULL) 01209 { 01210 fprintf (stderr, 01211 (_("Error in %s () a NULL pointer was passed.\n")), 01212 __FUNCTION__); 01213 return (EXIT_FAILURE); 01214 } 01215 if (helix->visibility < 0) 01216 { 01217 fprintf (stderr, 01218 (_("Error in %s () a negative value was found in the visibility member.\n")), 01219 __FUNCTION__); 01220 return (EXIT_FAILURE); 01221 } 01222 if (helix->visibility > 1) 01223 { 01224 fprintf (stderr, 01225 (_("Error in %s () an out of range value was found in the visibility member.\n")), 01226 __FUNCTION__); 01227 return (EXIT_FAILURE); 01228 } 01229 #if DEBUG 01230 DXF_DEBUG_END 01231 #endif 01232 return (helix->visibility); 01233 } 01234 01235 01242 DxfHelix * 01243 dxf_helix_set_visibility 01244 ( 01245 DxfHelix *helix, 01247 int16_t visibility 01249 ) 01250 { 01251 #if DEBUG 01252 DXF_DEBUG_BEGIN 01253 #endif 01254 /* Do some basic checks. */ 01255 if (helix == NULL) 01256 { 01257 fprintf (stderr, 01258 (_("Error in %s () a NULL pointer was passed.\n")), 01259 __FUNCTION__); 01260 return (NULL); 01261 } 01262 if (visibility < 0) 01263 { 01264 fprintf (stderr, 01265 (_("Error in %s () a negative visibility value was passed.\n")), 01266 __FUNCTION__); 01267 return (NULL); 01268 } 01269 if (visibility > 1) 01270 { 01271 fprintf (stderr, 01272 (_("Error in %s () an out of range visibility value was passed.\n")), 01273 __FUNCTION__); 01274 return (NULL); 01275 } 01276 helix->visibility = visibility; 01277 #if DEBUG 01278 DXF_DEBUG_END 01279 #endif 01280 return (helix); 01281 } 01282 01283 01290 int 01291 dxf_helix_get_color 01292 ( 01293 DxfHelix *helix 01295 ) 01296 { 01297 #if DEBUG 01298 DXF_DEBUG_BEGIN 01299 #endif 01300 /* Do some basic checks. */ 01301 if (helix == NULL) 01302 { 01303 fprintf (stderr, 01304 (_("Error in %s () a NULL pointer was passed.\n")), 01305 __FUNCTION__); 01306 return (EXIT_FAILURE); 01307 } 01308 if (helix->color < 0) 01309 { 01310 fprintf (stderr, 01311 (_("Warning in %s () a negative value was found in the color member.\n")), 01312 __FUNCTION__); 01313 } 01314 #if DEBUG 01315 DXF_DEBUG_END 01316 #endif 01317 return (helix->color); 01318 } 01319 01320 01327 DxfHelix * 01328 dxf_helix_set_color 01329 ( 01330 DxfHelix *helix, 01332 int color 01334 ) 01335 { 01336 #if DEBUG 01337 DXF_DEBUG_BEGIN 01338 #endif 01339 /* Do some basic checks. */ 01340 if (helix == NULL) 01341 { 01342 fprintf (stderr, 01343 (_("Error in %s () a NULL pointer was passed.\n")), 01344 __FUNCTION__); 01345 return (NULL); 01346 } 01347 if (color < 0) 01348 { 01349 fprintf (stderr, 01350 (_("Warning in %s () a negative color value was passed.\n")), 01351 __FUNCTION__); 01352 fprintf (stderr, 01353 (_("\teffectively turning this entity it's visibility off.\n"))); 01354 } 01355 helix->color = color; 01356 #if DEBUG 01357 DXF_DEBUG_END 01358 #endif 01359 return (helix); 01360 } 01361 01362 01369 int 01370 dxf_helix_get_paperspace 01371 ( 01372 DxfHelix *helix 01374 ) 01375 { 01376 #if DEBUG 01377 DXF_DEBUG_BEGIN 01378 #endif 01379 /* Do some basic checks. */ 01380 if (helix == NULL) 01381 { 01382 fprintf (stderr, 01383 (_("Error in %s () a NULL pointer was passed.\n")), 01384 __FUNCTION__); 01385 return (EXIT_FAILURE); 01386 } 01387 if (helix->paperspace < 0) 01388 { 01389 fprintf (stderr, 01390 (_("Warning in %s () a negative value was found in the paperspace member.\n")), 01391 __FUNCTION__); 01392 } 01393 if (helix->paperspace > 1) 01394 { 01395 fprintf (stderr, 01396 (_("Warning in %s () an out of range value was found in the paperspace member.\n")), 01397 __FUNCTION__); 01398 } 01399 #if DEBUG 01400 DXF_DEBUG_END 01401 #endif 01402 return (helix->paperspace); 01403 } 01404 01405 01412 DxfHelix * 01413 dxf_helix_set_paperspace 01414 ( 01415 DxfHelix *helix, 01417 int paperspace 01420 ) 01421 { 01422 #if DEBUG 01423 DXF_DEBUG_BEGIN 01424 #endif 01425 /* Do some basic checks. */ 01426 if (helix == NULL) 01427 { 01428 fprintf (stderr, 01429 (_("Error in %s () a NULL pointer was passed.\n")), 01430 __FUNCTION__); 01431 return (NULL); 01432 } 01433 if (paperspace < 0) 01434 { 01435 fprintf (stderr, 01436 (_("Error in %s () a negative paperspace value was passed.\n")), 01437 __FUNCTION__); 01438 return (NULL); 01439 } 01440 if (paperspace > 1) 01441 { 01442 fprintf (stderr, 01443 (_("Error in %s () an out of range paperspace value was passed.\n")), 01444 __FUNCTION__); 01445 return (NULL); 01446 } 01447 helix->paperspace = paperspace; 01448 #if DEBUG 01449 DXF_DEBUG_END 01450 #endif 01451 return (helix); 01452 } 01453 01454 01461 int 01462 dxf_helix_get_graphics_data_size 01463 ( 01464 DxfHelix *helix 01466 ) 01467 { 01468 #if DEBUG 01469 DXF_DEBUG_BEGIN 01470 #endif 01471 /* Do some basic checks. */ 01472 if (helix == NULL) 01473 { 01474 fprintf (stderr, 01475 (_("Error in %s () a NULL pointer was passed.\n")), 01476 __FUNCTION__); 01477 return (EXIT_FAILURE); 01478 } 01479 if (helix->graphics_data_size < 0) 01480 { 01481 fprintf (stderr, 01482 (_("Warning in %s () a negative value was found in the graphics_data_size member.\n")), 01483 __FUNCTION__); 01484 } 01485 if (helix->graphics_data_size == 0) 01486 { 01487 fprintf (stderr, 01488 (_("Warning in %s () a zero value was found in the graphics_data_size member.\n")), 01489 __FUNCTION__); 01490 } 01491 #if DEBUG 01492 DXF_DEBUG_END 01493 #endif 01494 return (helix->graphics_data_size); 01495 } 01496 01497 01504 DxfHelix * 01505 dxf_helix_set_graphics_data_size 01506 ( 01507 DxfHelix *helix, 01509 int graphics_data_size 01512 ) 01513 { 01514 #if DEBUG 01515 DXF_DEBUG_BEGIN 01516 #endif 01517 /* Do some basic checks. */ 01518 if (helix == NULL) 01519 { 01520 fprintf (stderr, 01521 (_("Error in %s () a NULL pointer was passed.\n")), 01522 __FUNCTION__); 01523 return (NULL); 01524 } 01525 if (graphics_data_size < 0) 01526 { 01527 fprintf (stderr, 01528 (_("Error in %s () a negative graphics_data_size value was passed.\n")), 01529 __FUNCTION__); 01530 return (NULL); 01531 } 01532 if (graphics_data_size == 0) 01533 { 01534 fprintf (stderr, 01535 (_("Error in %s () a zero graphics_data_size value was passed.\n")), 01536 __FUNCTION__); 01537 return (NULL); 01538 } 01539 helix->graphics_data_size = graphics_data_size; 01540 #if DEBUG 01541 DXF_DEBUG_END 01542 #endif 01543 return (helix); 01544 } 01545 01546 01553 int16_t 01554 dxf_helix_get_shadow_mode 01555 ( 01556 DxfHelix *helix 01558 ) 01559 { 01560 #if DEBUG 01561 DXF_DEBUG_BEGIN 01562 #endif 01563 /* Do some basic checks. */ 01564 if (helix == NULL) 01565 { 01566 fprintf (stderr, 01567 (_("Error in %s () a NULL pointer was passed.\n")), 01568 __FUNCTION__); 01569 return (EXIT_FAILURE); 01570 } 01571 if (helix->shadow_mode < 0) 01572 { 01573 fprintf (stderr, 01574 (_("Error in %s () a negative value was found in the shadow_mode member.\n")), 01575 __FUNCTION__); 01576 return (EXIT_FAILURE); 01577 } 01578 if (helix->shadow_mode > 3) 01579 { 01580 fprintf (stderr, 01581 (_("Error in %s () an out of range value was found in the shadow_mode member.\n")), 01582 __FUNCTION__); 01583 return (EXIT_FAILURE); 01584 } 01585 #if DEBUG 01586 DXF_DEBUG_END 01587 #endif 01588 return (helix->shadow_mode); 01589 } 01590 01591 01598 DxfHelix * 01599 dxf_helix_set_shadow_mode 01600 ( 01601 DxfHelix *helix, 01603 int16_t shadow_mode 01605 ) 01606 { 01607 #if DEBUG 01608 DXF_DEBUG_BEGIN 01609 #endif 01610 /* Do some basic checks. */ 01611 if (helix == NULL) 01612 { 01613 fprintf (stderr, 01614 (_("Error in %s () a NULL pointer was passed.\n")), 01615 __FUNCTION__); 01616 return (NULL); 01617 } 01618 if (shadow_mode < 0) 01619 { 01620 fprintf (stderr, 01621 (_("Error in %s () a negative shadow_mode value was passed.\n")), 01622 __FUNCTION__); 01623 return (NULL); 01624 } 01625 if (shadow_mode > 3) 01626 { 01627 fprintf (stderr, 01628 (_("Error in %s () an out of range shadow_mode value was passed.\n")), 01629 __FUNCTION__); 01630 return (NULL); 01631 } 01632 helix->shadow_mode = shadow_mode; 01633 #if DEBUG 01634 DXF_DEBUG_END 01635 #endif 01636 return (helix); 01637 } 01638 01639 01648 DxfBinaryGraphicsData * 01649 dxf_helix_get_binary_graphics_data 01650 ( 01651 DxfHelix *helix 01653 ) 01654 { 01655 #if DEBUG 01656 DXF_DEBUG_BEGIN 01657 #endif 01658 /* Do some basic checks. */ 01659 if (helix == NULL) 01660 { 01661 fprintf (stderr, 01662 (_("Error in %s () a NULL pointer was passed.\n")), 01663 __FUNCTION__); 01664 return (NULL); 01665 } 01666 if (helix->binary_graphics_data == NULL) 01667 { 01668 fprintf (stderr, 01669 (_("Error in %s () a NULL pointer was found in the binary_graphics_data member.\n")), 01670 __FUNCTION__); 01671 return (NULL); 01672 } 01673 #if DEBUG 01674 DXF_DEBUG_END 01675 #endif 01676 return ((DxfBinaryGraphicsData *) helix->binary_graphics_data); 01677 } 01678 01679 01687 DxfHelix * 01688 dxf_helix_set_binary_graphics_data 01689 ( 01690 DxfHelix *helix, 01692 DxfBinaryGraphicsData *data 01695 ) 01696 { 01697 #if DEBUG 01698 DXF_DEBUG_BEGIN 01699 #endif 01700 /* Do some basic checks. */ 01701 if (helix == NULL) 01702 { 01703 fprintf (stderr, 01704 (_("Error in %s () a NULL pointer was passed.\n")), 01705 __FUNCTION__); 01706 return (NULL); 01707 } 01708 if (data == NULL) 01709 { 01710 fprintf (stderr, 01711 (_("Error in %s () a NULL pointer was passed.\n")), 01712 __FUNCTION__); 01713 return (NULL); 01714 } 01715 helix->binary_graphics_data = (DxfBinaryGraphicsData *) data; 01716 #if DEBUG 01717 DXF_DEBUG_END 01718 #endif 01719 return (helix); 01720 } 01721 01722 01732 char * 01733 dxf_helix_get_dictionary_owner_soft 01734 ( 01735 DxfHelix *helix 01737 ) 01738 { 01739 #if DEBUG 01740 DXF_DEBUG_BEGIN 01741 #endif 01742 /* Do some basic checks. */ 01743 if (helix == NULL) 01744 { 01745 fprintf (stderr, 01746 (_("Error in %s () a NULL pointer was passed.\n")), 01747 __FUNCTION__); 01748 return (NULL); 01749 } 01750 if (helix->dictionary_owner_soft == NULL) 01751 { 01752 fprintf (stderr, 01753 (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")), 01754 __FUNCTION__); 01755 return (NULL); 01756 } 01757 #if DEBUG 01758 DXF_DEBUG_END 01759 #endif 01760 return (strdup (helix->dictionary_owner_soft)); 01761 } 01762 01763 01771 DxfHelix * 01772 dxf_helix_set_dictionary_owner_soft 01773 ( 01774 DxfHelix *helix, 01776 char *dictionary_owner_soft 01779 ) 01780 { 01781 #if DEBUG 01782 DXF_DEBUG_BEGIN 01783 #endif 01784 /* Do some basic checks. */ 01785 if (helix == NULL) 01786 { 01787 fprintf (stderr, 01788 (_("Error in %s () a NULL pointer was passed.\n")), 01789 __FUNCTION__); 01790 return (NULL); 01791 } 01792 if (dictionary_owner_soft == NULL) 01793 { 01794 fprintf (stderr, 01795 (_("Error in %s () a NULL pointer was passed.\n")), 01796 __FUNCTION__); 01797 return (NULL); 01798 } 01799 helix->dictionary_owner_soft = strdup (dictionary_owner_soft); 01800 #if DEBUG 01801 DXF_DEBUG_END 01802 #endif 01803 return (helix); 01804 } 01805 01806 01815 char * 01816 dxf_helix_get_material 01817 ( 01818 DxfHelix *helix 01820 ) 01821 { 01822 #if DEBUG 01823 DXF_DEBUG_BEGIN 01824 #endif 01825 /* Do some basic checks. */ 01826 if (helix == NULL) 01827 { 01828 fprintf (stderr, 01829 (_("Error in %s () a NULL pointer was passed.\n")), 01830 __FUNCTION__); 01831 return (NULL); 01832 } 01833 if (helix->material == NULL) 01834 { 01835 fprintf (stderr, 01836 (_("Error in %s () a NULL pointer was found in the material member.\n")), 01837 __FUNCTION__); 01838 return (NULL); 01839 } 01840 #if DEBUG 01841 DXF_DEBUG_END 01842 #endif 01843 return (strdup (helix->material)); 01844 } 01845 01846 01853 DxfHelix * 01854 dxf_helix_set_material 01855 ( 01856 DxfHelix *helix, 01858 char *material 01861 ) 01862 { 01863 #if DEBUG 01864 DXF_DEBUG_BEGIN 01865 #endif 01866 /* Do some basic checks. */ 01867 if (helix == NULL) 01868 { 01869 fprintf (stderr, 01870 (_("Error in %s () a NULL pointer was passed.\n")), 01871 __FUNCTION__); 01872 return (NULL); 01873 } 01874 if (material == NULL) 01875 { 01876 fprintf (stderr, 01877 (_("Error in %s () a NULL pointer was passed.\n")), 01878 __FUNCTION__); 01879 return (NULL); 01880 } 01881 helix->material = strdup (material); 01882 #if DEBUG 01883 DXF_DEBUG_END 01884 #endif 01885 return (helix); 01886 } 01887 01888 01898 char * 01899 dxf_helix_get_dictionary_owner_hard 01900 ( 01901 DxfHelix *helix 01903 ) 01904 { 01905 #if DEBUG 01906 DXF_DEBUG_BEGIN 01907 #endif 01908 /* Do some basic checks. */ 01909 if (helix == NULL) 01910 { 01911 fprintf (stderr, 01912 (_("Error in %s () a NULL pointer was passed.\n")), 01913 __FUNCTION__); 01914 return (NULL); 01915 } 01916 if (helix->dictionary_owner_hard == NULL) 01917 { 01918 fprintf (stderr, 01919 (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")), 01920 __FUNCTION__); 01921 return (NULL); 01922 } 01923 #if DEBUG 01924 DXF_DEBUG_END 01925 #endif 01926 return (strdup (helix->dictionary_owner_hard)); 01927 } 01928 01929 01937 DxfHelix * 01938 dxf_helix_set_dictionary_owner_hard 01939 ( 01940 DxfHelix *helix, 01942 char *dictionary_owner_hard 01945 ) 01946 { 01947 #if DEBUG 01948 DXF_DEBUG_BEGIN 01949 #endif 01950 /* Do some basic checks. */ 01951 if (helix == NULL) 01952 { 01953 fprintf (stderr, 01954 (_("Error in %s () a NULL pointer was passed.\n")), 01955 __FUNCTION__); 01956 return (NULL); 01957 } 01958 if (dictionary_owner_hard == NULL) 01959 { 01960 fprintf (stderr, 01961 (_("Error in %s () a NULL pointer was passed.\n")), 01962 __FUNCTION__); 01963 return (NULL); 01964 } 01965 helix->dictionary_owner_hard = strdup (dictionary_owner_hard); 01966 #if DEBUG 01967 DXF_DEBUG_END 01968 #endif 01969 return (helix); 01970 } 01971 01972 01979 int16_t 01980 dxf_helix_get_lineweight 01981 ( 01982 DxfHelix *helix 01984 ) 01985 { 01986 #if DEBUG 01987 DXF_DEBUG_BEGIN 01988 #endif 01989 /* Do some basic checks. */ 01990 if (helix == NULL) 01991 { 01992 fprintf (stderr, 01993 (_("Error in %s () a NULL pointer was passed.\n")), 01994 __FUNCTION__); 01995 return (EXIT_FAILURE); 01996 } 01997 #if DEBUG 01998 DXF_DEBUG_END 01999 #endif 02000 return (helix->lineweight); 02001 } 02002 02003 02010 DxfHelix * 02011 dxf_helix_set_lineweight 02012 ( 02013 DxfHelix *helix, 02015 int16_t lineweight 02017 ) 02018 { 02019 #if DEBUG 02020 DXF_DEBUG_BEGIN 02021 #endif 02022 /* Do some basic checks. */ 02023 if (helix == NULL) 02024 { 02025 fprintf (stderr, 02026 (_("Error in %s () a NULL pointer was passed.\n")), 02027 __FUNCTION__); 02028 return (NULL); 02029 } 02030 helix->lineweight = lineweight; 02031 #if DEBUG 02032 DXF_DEBUG_END 02033 #endif 02034 return (helix); 02035 } 02036 02037 02044 char * 02045 dxf_helix_get_plot_style_name 02046 ( 02047 DxfHelix *helix 02049 ) 02050 { 02051 #if DEBUG 02052 DXF_DEBUG_BEGIN 02053 #endif 02054 /* Do some basic checks. */ 02055 if (helix == NULL) 02056 { 02057 fprintf (stderr, 02058 (_("Error in %s () a NULL pointer was passed.\n")), 02059 __FUNCTION__); 02060 return (NULL); 02061 } 02062 if (helix->plot_style_name == NULL) 02063 { 02064 fprintf (stderr, 02065 (_("Error in %s () a NULL pointer was found in the plot_style_name member.\n")), 02066 __FUNCTION__); 02067 return (NULL); 02068 } 02069 #if DEBUG 02070 DXF_DEBUG_END 02071 #endif 02072 return (strdup (helix->plot_style_name)); 02073 } 02074 02075 02082 DxfHelix * 02083 dxf_helix_set_plot_style_name 02084 ( 02085 DxfHelix *helix, 02087 char *plot_style_name 02090 ) 02091 { 02092 #if DEBUG 02093 DXF_DEBUG_BEGIN 02094 #endif 02095 /* Do some basic checks. */ 02096 if (helix == NULL) 02097 { 02098 fprintf (stderr, 02099 (_("Error in %s () a NULL pointer was passed.\n")), 02100 __FUNCTION__); 02101 return (NULL); 02102 } 02103 if (plot_style_name == NULL) 02104 { 02105 fprintf (stderr, 02106 (_("Error in %s () a NULL pointer was passed.\n")), 02107 __FUNCTION__); 02108 return (NULL); 02109 } 02110 helix->plot_style_name = strdup (plot_style_name); 02111 #if DEBUG 02112 DXF_DEBUG_END 02113 #endif 02114 return (helix); 02115 } 02116 02117 02124 long 02125 dxf_helix_get_color_value 02126 ( 02127 DxfHelix *helix 02129 ) 02130 { 02131 #if DEBUG 02132 DXF_DEBUG_BEGIN 02133 #endif 02134 /* Do some basic checks. */ 02135 if (helix == NULL) 02136 { 02137 fprintf (stderr, 02138 (_("Error in %s () a NULL pointer was passed.\n")), 02139 __FUNCTION__); 02140 return (EXIT_FAILURE); 02141 } 02142 #if DEBUG 02143 DXF_DEBUG_END 02144 #endif 02145 return (helix->color_value); 02146 } 02147 02148 02155 DxfHelix * 02156 dxf_helix_set_color_value 02157 ( 02158 DxfHelix *helix, 02160 long color_value 02162 ) 02163 { 02164 #if DEBUG 02165 DXF_DEBUG_BEGIN 02166 #endif 02167 /* Do some basic checks. */ 02168 if (helix == NULL) 02169 { 02170 fprintf (stderr, 02171 (_("Error in %s () a NULL pointer was passed.\n")), 02172 __FUNCTION__); 02173 return (NULL); 02174 } 02175 helix->color_value = color_value; 02176 #if DEBUG 02177 DXF_DEBUG_END 02178 #endif 02179 return (helix); 02180 } 02181 02182 02189 char * 02190 dxf_helix_get_color_name 02191 ( 02192 DxfHelix *helix 02194 ) 02195 { 02196 #if DEBUG 02197 DXF_DEBUG_BEGIN 02198 #endif 02199 /* Do some basic checks. */ 02200 if (helix == NULL) 02201 { 02202 fprintf (stderr, 02203 (_("Error in %s () a NULL pointer was passed.\n")), 02204 __FUNCTION__); 02205 return (NULL); 02206 } 02207 if (helix->color_name == NULL) 02208 { 02209 fprintf (stderr, 02210 (_("Error in %s () a NULL pointer was found in the color_name member.\n")), 02211 __FUNCTION__); 02212 return (NULL); 02213 } 02214 #if DEBUG 02215 DXF_DEBUG_END 02216 #endif 02217 return (strdup (helix->color_name)); 02218 } 02219 02220 02227 DxfHelix * 02228 dxf_helix_set_color_name 02229 ( 02230 DxfHelix *helix, 02232 char *color_name 02235 ) 02236 { 02237 #if DEBUG 02238 DXF_DEBUG_BEGIN 02239 #endif 02240 /* Do some basic checks. */ 02241 if (helix == NULL) 02242 { 02243 fprintf (stderr, 02244 (_("Error in %s () a NULL pointer was passed.\n")), 02245 __FUNCTION__); 02246 return (NULL); 02247 } 02248 if (color_name == NULL) 02249 { 02250 fprintf (stderr, 02251 (_("Error in %s () a NULL pointer was passed.\n")), 02252 __FUNCTION__); 02253 return (NULL); 02254 } 02255 helix->color_name = strdup (color_name); 02256 #if DEBUG 02257 DXF_DEBUG_END 02258 #endif 02259 return (helix); 02260 } 02261 02262 02269 long 02270 dxf_helix_get_transparency 02271 ( 02272 DxfHelix *helix 02274 ) 02275 { 02276 #if DEBUG 02277 DXF_DEBUG_BEGIN 02278 #endif 02279 /* Do some basic checks. */ 02280 if (helix == NULL) 02281 { 02282 fprintf (stderr, 02283 (_("Error in %s () a NULL pointer was passed.\n")), 02284 __FUNCTION__); 02285 return (EXIT_FAILURE); 02286 } 02287 #if DEBUG 02288 DXF_DEBUG_END 02289 #endif 02290 return (helix->transparency); 02291 } 02292 02293 02300 DxfHelix * 02301 dxf_helix_set_transparency 02302 ( 02303 DxfHelix *helix, 02305 long transparency 02307 ) 02308 { 02309 #if DEBUG 02310 DXF_DEBUG_BEGIN 02311 #endif 02312 /* Do some basic checks. */ 02313 if (helix == NULL) 02314 { 02315 fprintf (stderr, 02316 (_("Error in %s () a NULL pointer was passed.\n")), 02317 __FUNCTION__); 02318 return (NULL); 02319 } 02320 helix->transparency = transparency; 02321 #if DEBUG 02322 DXF_DEBUG_END 02323 #endif 02324 return (helix); 02325 } 02326 02327 02334 DxfPoint * 02335 dxf_helix_get_p0 02336 ( 02337 DxfHelix *helix 02339 ) 02340 { 02341 #if DEBUG 02342 DXF_DEBUG_BEGIN 02343 #endif 02344 /* Do some basic checks. */ 02345 if (helix == NULL) 02346 { 02347 fprintf (stderr, 02348 (_("Error in %s () a NULL pointer was passed.\n")), 02349 __FUNCTION__); 02350 return (NULL); 02351 } 02352 if (helix->p0 == NULL) 02353 { 02354 fprintf (stderr, 02355 (_("Error in %s () a NULL pointer was found in the p0 member.\n")), 02356 __FUNCTION__); 02357 return (NULL); 02358 } 02359 #if DEBUG 02360 DXF_DEBUG_END 02361 #endif 02362 return ((DxfPoint *) helix->p0); 02363 } 02364 02365 02372 DxfHelix * 02373 dxf_helix_set_p0 02374 ( 02375 DxfHelix *helix, 02377 DxfPoint *p0 02379 ) 02380 { 02381 #if DEBUG 02382 DXF_DEBUG_BEGIN 02383 #endif 02384 /* Do some basic checks. */ 02385 if (helix == NULL) 02386 { 02387 fprintf (stderr, 02388 (_("Error in %s () a NULL pointer was passed.\n")), 02389 __FUNCTION__); 02390 return (NULL); 02391 } 02392 if (p0 == NULL) 02393 { 02394 fprintf (stderr, 02395 (_("Error in %s () a NULL pointer was passed.\n")), 02396 __FUNCTION__); 02397 return (NULL); 02398 } 02399 helix->p0 = (DxfPoint *) p0; 02400 #if DEBUG 02401 DXF_DEBUG_END 02402 #endif 02403 return (helix); 02404 } 02405 02406 02413 double 02414 dxf_helix_get_x0 02415 ( 02416 DxfHelix *helix 02418 ) 02419 { 02420 #if DEBUG 02421 DXF_DEBUG_BEGIN 02422 #endif 02423 /* Do some basic checks. */ 02424 if (helix == NULL) 02425 { 02426 fprintf (stderr, 02427 (_("Error in %s () a NULL pointer was passed.\n")), 02428 __FUNCTION__); 02429 return (EXIT_FAILURE); 02430 } 02431 #if DEBUG 02432 DXF_DEBUG_END 02433 #endif 02434 return (helix->p0->x0); 02435 } 02436 02437 02444 DxfHelix * 02445 dxf_helix_set_x0 02446 ( 02447 DxfHelix *helix, 02449 double x0 02452 ) 02453 { 02454 #if DEBUG 02455 DXF_DEBUG_BEGIN 02456 #endif 02457 /* Do some basic checks. */ 02458 if (helix == NULL) 02459 { 02460 fprintf (stderr, 02461 (_("Error in %s () a NULL pointer was passed.\n")), 02462 __FUNCTION__); 02463 return (NULL); 02464 } 02465 helix->p0->x0 = x0; 02466 #if DEBUG 02467 DXF_DEBUG_END 02468 #endif 02469 return (helix); 02470 } 02471 02472 02479 double 02480 dxf_helix_get_y0 02481 ( 02482 DxfHelix *helix 02484 ) 02485 { 02486 #if DEBUG 02487 DXF_DEBUG_BEGIN 02488 #endif 02489 /* Do some basic checks. */ 02490 if (helix == NULL) 02491 { 02492 fprintf (stderr, 02493 (_("Error in %s () a NULL pointer was passed.\n")), 02494 __FUNCTION__); 02495 return (EXIT_FAILURE); 02496 } 02497 #if DEBUG 02498 DXF_DEBUG_END 02499 #endif 02500 return (helix->p0->y0); 02501 } 02502 02503 02510 DxfHelix * 02511 dxf_helix_set_y0 02512 ( 02513 DxfHelix *helix, 02515 double y0 02518 ) 02519 { 02520 #if DEBUG 02521 DXF_DEBUG_BEGIN 02522 #endif 02523 /* Do some basic checks. */ 02524 if (helix == NULL) 02525 { 02526 fprintf (stderr, 02527 (_("Error in %s () a NULL pointer was passed.\n")), 02528 __FUNCTION__); 02529 return (NULL); 02530 } 02531 helix->p0->y0 = y0; 02532 #if DEBUG 02533 DXF_DEBUG_END 02534 #endif 02535 return (helix); 02536 } 02537 02538 02545 double 02546 dxf_helix_get_z0 02547 ( 02548 DxfHelix *helix 02550 ) 02551 { 02552 #if DEBUG 02553 DXF_DEBUG_BEGIN 02554 #endif 02555 /* Do some basic checks. */ 02556 if (helix == NULL) 02557 { 02558 fprintf (stderr, 02559 (_("Error in %s () a NULL pointer was passed.\n")), 02560 __FUNCTION__); 02561 return (EXIT_FAILURE); 02562 } 02563 #if DEBUG 02564 DXF_DEBUG_END 02565 #endif 02566 return (helix->p0->z0); 02567 } 02568 02569 02576 DxfHelix * 02577 dxf_helix_set_z0 02578 ( 02579 DxfHelix *helix, 02581 double z0 02584 ) 02585 { 02586 #if DEBUG 02587 DXF_DEBUG_BEGIN 02588 #endif 02589 /* Do some basic checks. */ 02590 if (helix == NULL) 02591 { 02592 fprintf (stderr, 02593 (_("Error in %s () a NULL pointer was passed.\n")), 02594 __FUNCTION__); 02595 return (NULL); 02596 } 02597 helix->p0->z0 = z0; 02598 #if DEBUG 02599 DXF_DEBUG_END 02600 #endif 02601 return (helix); 02602 } 02603 02604 02611 DxfPoint * 02612 dxf_helix_get_p1 02613 ( 02614 DxfHelix *helix 02616 ) 02617 { 02618 #if DEBUG 02619 DXF_DEBUG_BEGIN 02620 #endif 02621 /* Do some basic checks. */ 02622 if (helix == NULL) 02623 { 02624 fprintf (stderr, 02625 (_("Error in %s () a NULL pointer was passed.\n")), 02626 __FUNCTION__); 02627 return (NULL); 02628 } 02629 if (helix->p1 == NULL) 02630 { 02631 fprintf (stderr, 02632 (_("Error in %s () a NULL pointer was found in the p1 member.\n")), 02633 __FUNCTION__); 02634 return (NULL); 02635 } 02636 #if DEBUG 02637 DXF_DEBUG_END 02638 #endif 02639 return ((DxfPoint *) helix->p1); 02640 } 02641 02642 02649 DxfHelix * 02650 dxf_helix_set_p1 02651 ( 02652 DxfHelix *helix, 02654 DxfPoint *p1 02656 ) 02657 { 02658 #if DEBUG 02659 DXF_DEBUG_BEGIN 02660 #endif 02661 /* Do some basic checks. */ 02662 if (helix == NULL) 02663 { 02664 fprintf (stderr, 02665 (_("Error in %s () a NULL pointer was passed.\n")), 02666 __FUNCTION__); 02667 return (NULL); 02668 } 02669 if (p1 == NULL) 02670 { 02671 fprintf (stderr, 02672 (_("Error in %s () a NULL pointer was passed.\n")), 02673 __FUNCTION__); 02674 return (NULL); 02675 } 02676 helix->p1 = (DxfPoint *) p1; 02677 #if DEBUG 02678 DXF_DEBUG_END 02679 #endif 02680 return (helix); 02681 } 02682 02683 02690 double 02691 dxf_helix_get_x1 02692 ( 02693 DxfHelix *helix 02695 ) 02696 { 02697 #if DEBUG 02698 DXF_DEBUG_BEGIN 02699 #endif 02700 /* Do some basic checks. */ 02701 if (helix == NULL) 02702 { 02703 fprintf (stderr, 02704 (_("Error in %s () a NULL pointer was passed.\n")), 02705 __FUNCTION__); 02706 return (EXIT_FAILURE); 02707 } 02708 #if DEBUG 02709 DXF_DEBUG_END 02710 #endif 02711 return (helix->p1->x0); 02712 } 02713 02714 02721 DxfHelix * 02722 dxf_helix_set_x1 02723 ( 02724 DxfHelix *helix, 02726 double x1 02729 ) 02730 { 02731 #if DEBUG 02732 DXF_DEBUG_BEGIN 02733 #endif 02734 /* Do some basic checks. */ 02735 if (helix == NULL) 02736 { 02737 fprintf (stderr, 02738 (_("Error in %s () a NULL pointer was passed.\n")), 02739 __FUNCTION__); 02740 return (NULL); 02741 } 02742 helix->p1->x0 = x1; 02743 #if DEBUG 02744 DXF_DEBUG_END 02745 #endif 02746 return (helix); 02747 } 02748 02749 02756 double 02757 dxf_helix_get_y1 02758 ( 02759 DxfHelix *helix 02761 ) 02762 { 02763 #if DEBUG 02764 DXF_DEBUG_BEGIN 02765 #endif 02766 /* Do some basic checks. */ 02767 if (helix == NULL) 02768 { 02769 fprintf (stderr, 02770 (_("Error in %s () a NULL pointer was passed.\n")), 02771 __FUNCTION__); 02772 return (EXIT_FAILURE); 02773 } 02774 #if DEBUG 02775 DXF_DEBUG_END 02776 #endif 02777 return (helix->p1->y0); 02778 } 02779 02780 02787 DxfHelix * 02788 dxf_helix_set_y1 02789 ( 02790 DxfHelix *helix, 02792 double y1 02794 ) 02795 { 02796 #if DEBUG 02797 DXF_DEBUG_BEGIN 02798 #endif 02799 /* Do some basic checks. */ 02800 if (helix == NULL) 02801 { 02802 fprintf (stderr, 02803 (_("Error in %s () a NULL pointer was passed.\n")), 02804 __FUNCTION__); 02805 return (NULL); 02806 } 02807 helix->p1->y0 = y1; 02808 #if DEBUG 02809 DXF_DEBUG_END 02810 #endif 02811 return (helix); 02812 } 02813 02814 02821 double 02822 dxf_helix_get_z1 02823 ( 02824 DxfHelix *helix 02826 ) 02827 { 02828 #if DEBUG 02829 DXF_DEBUG_BEGIN 02830 #endif 02831 /* Do some basic checks. */ 02832 if (helix == NULL) 02833 { 02834 fprintf (stderr, 02835 (_("Error in %s () a NULL pointer was passed.\n")), 02836 __FUNCTION__); 02837 return (EXIT_FAILURE); 02838 } 02839 #if DEBUG 02840 DXF_DEBUG_END 02841 #endif 02842 return (helix->p1->z0); 02843 } 02844 02845 02852 DxfHelix * 02853 dxf_helix_set_z1 02854 ( 02855 DxfHelix *helix, 02857 double z1 02860 ) 02861 { 02862 #if DEBUG 02863 DXF_DEBUG_BEGIN 02864 #endif 02865 /* Do some basic checks. */ 02866 if (helix == NULL) 02867 { 02868 fprintf (stderr, 02869 (_("Error in %s () a NULL pointer was passed.\n")), 02870 __FUNCTION__); 02871 return (NULL); 02872 } 02873 helix->p1->z0 = z1; 02874 #if DEBUG 02875 DXF_DEBUG_END 02876 #endif 02877 return (helix); 02878 } 02879 02880 02887 DxfPoint * 02888 dxf_helix_get_p2 02889 ( 02890 DxfHelix *helix 02892 ) 02893 { 02894 #if DEBUG 02895 DXF_DEBUG_BEGIN 02896 #endif 02897 /* Do some basic checks. */ 02898 if (helix == NULL) 02899 { 02900 fprintf (stderr, 02901 (_("Error in %s () a NULL pointer was passed.\n")), 02902 __FUNCTION__); 02903 return (NULL); 02904 } 02905 if (helix->p2 == NULL) 02906 { 02907 fprintf (stderr, 02908 (_("Error in %s () a NULL pointer was found in the p2 member.\n")), 02909 __FUNCTION__); 02910 return (NULL); 02911 } 02912 #if DEBUG 02913 DXF_DEBUG_END 02914 #endif 02915 return ((DxfPoint *) helix->p2); 02916 } 02917 02918 02925 DxfHelix * 02926 dxf_helix_set_p2 02927 ( 02928 DxfHelix *helix, 02930 DxfPoint *p2 02933 ) 02934 { 02935 #if DEBUG 02936 DXF_DEBUG_BEGIN 02937 #endif 02938 /* Do some basic checks. */ 02939 if (helix == NULL) 02940 { 02941 fprintf (stderr, 02942 (_("Error in %s () a NULL pointer was passed.\n")), 02943 __FUNCTION__); 02944 return (NULL); 02945 } 02946 if (p2 == NULL) 02947 { 02948 fprintf (stderr, 02949 (_("Error in %s () a NULL pointer was passed.\n")), 02950 __FUNCTION__); 02951 return (NULL); 02952 } 02953 helix->p2 = (DxfPoint *) p2; 02954 #if DEBUG 02955 DXF_DEBUG_END 02956 #endif 02957 return (helix); 02958 } 02959 02960 02967 double 02968 dxf_helix_get_x2 02969 ( 02970 DxfHelix *helix 02972 ) 02973 { 02974 #if DEBUG 02975 DXF_DEBUG_BEGIN 02976 #endif 02977 /* Do some basic checks. */ 02978 if (helix == NULL) 02979 { 02980 fprintf (stderr, 02981 (_("Error in %s () a NULL pointer was passed.\n")), 02982 __FUNCTION__); 02983 return (EXIT_FAILURE); 02984 } 02985 #if DEBUG 02986 DXF_DEBUG_END 02987 #endif 02988 return (helix->p2->x0); 02989 } 02990 02991 02998 DxfHelix * 02999 dxf_helix_set_x2 03000 ( 03001 DxfHelix *helix, 03003 double x2 03006 ) 03007 { 03008 #if DEBUG 03009 DXF_DEBUG_BEGIN 03010 #endif 03011 /* Do some basic checks. */ 03012 if (helix == NULL) 03013 { 03014 fprintf (stderr, 03015 (_("Error in %s () a NULL pointer was passed.\n")), 03016 __FUNCTION__); 03017 return (NULL); 03018 } 03019 helix->p2->x0 = x2; 03020 #if DEBUG 03021 DXF_DEBUG_END 03022 #endif 03023 return (helix); 03024 } 03025 03026 03033 double 03034 dxf_helix_get_y2 03035 ( 03036 DxfHelix *helix 03038 ) 03039 { 03040 #if DEBUG 03041 DXF_DEBUG_BEGIN 03042 #endif 03043 /* Do some basic checks. */ 03044 if (helix == NULL) 03045 { 03046 fprintf (stderr, 03047 (_("Error in %s () a NULL pointer was passed.\n")), 03048 __FUNCTION__); 03049 return (EXIT_FAILURE); 03050 } 03051 #if DEBUG 03052 DXF_DEBUG_END 03053 #endif 03054 return (helix->p2->y0); 03055 } 03056 03057 03064 DxfHelix * 03065 dxf_helix_set_y2 03066 ( 03067 DxfHelix *helix, 03069 double y2 03072 ) 03073 { 03074 #if DEBUG 03075 DXF_DEBUG_BEGIN 03076 #endif 03077 /* Do some basic checks. */ 03078 if (helix == NULL) 03079 { 03080 fprintf (stderr, 03081 (_("Error in %s () a NULL pointer was passed.\n")), 03082 __FUNCTION__); 03083 return (NULL); 03084 } 03085 helix->p2->y0 = y2; 03086 #if DEBUG 03087 DXF_DEBUG_END 03088 #endif 03089 return (helix); 03090 } 03091 03092 03099 double 03100 dxf_helix_get_z2 03101 ( 03102 DxfHelix *helix 03104 ) 03105 { 03106 #if DEBUG 03107 DXF_DEBUG_BEGIN 03108 #endif 03109 /* Do some basic checks. */ 03110 if (helix == NULL) 03111 { 03112 fprintf (stderr, 03113 (_("Error in %s () a NULL pointer was passed.\n")), 03114 __FUNCTION__); 03115 return (EXIT_FAILURE); 03116 } 03117 #if DEBUG 03118 DXF_DEBUG_END 03119 #endif 03120 return (helix->p2->z0); 03121 } 03122 03123 03130 DxfHelix * 03131 dxf_helix_set_z2 03132 ( 03133 DxfHelix *helix, 03135 double z2 03138 ) 03139 { 03140 #if DEBUG 03141 DXF_DEBUG_BEGIN 03142 #endif 03143 /* Do some basic checks. */ 03144 if (helix == NULL) 03145 { 03146 fprintf (stderr, 03147 (_("Error in %s () a NULL pointer was passed.\n")), 03148 __FUNCTION__); 03149 return (NULL); 03150 } 03151 helix->p2->z0 = z2; 03152 #if DEBUG 03153 DXF_DEBUG_END 03154 #endif 03155 return (helix); 03156 } 03157 03158 03165 double 03166 dxf_helix_get_radius 03167 ( 03168 DxfHelix *helix 03170 ) 03171 { 03172 #if DEBUG 03173 DXF_DEBUG_BEGIN 03174 #endif 03175 /* Do some basic checks. */ 03176 if (helix == NULL) 03177 { 03178 fprintf (stderr, 03179 (_("Error in %s () a NULL pointer was passed.\n")), 03180 __FUNCTION__); 03181 return (EXIT_FAILURE); 03182 } 03183 #if DEBUG 03184 DXF_DEBUG_END 03185 #endif 03186 return (helix->radius); 03187 } 03188 03189 03196 DxfHelix * 03197 dxf_helix_set_radius 03198 ( 03199 DxfHelix *helix, 03201 double radius 03203 ) 03204 { 03205 #if DEBUG 03206 DXF_DEBUG_BEGIN 03207 #endif 03208 /* Do some basic checks. */ 03209 if (helix == NULL) 03210 { 03211 fprintf (stderr, 03212 (_("Error in %s () a NULL pointer was passed.\n")), 03213 __FUNCTION__); 03214 return (NULL); 03215 } 03216 helix->radius = radius; 03217 #if DEBUG 03218 DXF_DEBUG_END 03219 #endif 03220 return (helix); 03221 } 03222 03223 03230 double 03231 dxf_helix_get_number_of_turns 03232 ( 03233 DxfHelix *helix 03235 ) 03236 { 03237 #if DEBUG 03238 DXF_DEBUG_BEGIN 03239 #endif 03240 /* Do some basic checks. */ 03241 if (helix == NULL) 03242 { 03243 fprintf (stderr, 03244 (_("Error in %s () a NULL pointer was passed.\n")), 03245 __FUNCTION__); 03246 return (EXIT_FAILURE); 03247 } 03248 #if DEBUG 03249 DXF_DEBUG_END 03250 #endif 03251 return (helix->number_of_turns); 03252 } 03253 03254 03261 DxfHelix * 03262 dxf_helix_set_number_of_turns 03263 ( 03264 DxfHelix *helix, 03266 double number_of_turns 03268 ) 03269 { 03270 #if DEBUG 03271 DXF_DEBUG_BEGIN 03272 #endif 03273 /* Do some basic checks. */ 03274 if (helix == NULL) 03275 { 03276 fprintf (stderr, 03277 (_("Error in %s () a NULL pointer was passed.\n")), 03278 __FUNCTION__); 03279 return (NULL); 03280 } 03281 helix->number_of_turns = number_of_turns; 03282 #if DEBUG 03283 DXF_DEBUG_END 03284 #endif 03285 return (helix); 03286 } 03287 03288 03295 double 03296 dxf_helix_get_turn_height 03297 ( 03298 DxfHelix *helix 03300 ) 03301 { 03302 #if DEBUG 03303 DXF_DEBUG_BEGIN 03304 #endif 03305 /* Do some basic checks. */ 03306 if (helix == NULL) 03307 { 03308 fprintf (stderr, 03309 (_("Error in %s () a NULL pointer was passed.\n")), 03310 __FUNCTION__); 03311 return (EXIT_FAILURE); 03312 } 03313 #if DEBUG 03314 DXF_DEBUG_END 03315 #endif 03316 return (helix->turn_height); 03317 } 03318 03319 03326 DxfHelix * 03327 dxf_helix_set_turn_height 03328 ( 03329 DxfHelix *helix, 03331 double turn_height 03333 ) 03334 { 03335 #if DEBUG 03336 DXF_DEBUG_BEGIN 03337 #endif 03338 /* Do some basic checks. */ 03339 if (helix == NULL) 03340 { 03341 fprintf (stderr, 03342 (_("Error in %s () a NULL pointer was passed.\n")), 03343 __FUNCTION__); 03344 return (NULL); 03345 } 03346 helix->turn_height = turn_height; 03347 #if DEBUG 03348 DXF_DEBUG_END 03349 #endif 03350 return (helix); 03351 } 03352 03353 03360 long 03361 dxf_helix_get_major_release_number 03362 ( 03363 DxfHelix *helix 03365 ) 03366 { 03367 #if DEBUG 03368 DXF_DEBUG_BEGIN 03369 #endif 03370 /* Do some basic checks. */ 03371 if (helix == NULL) 03372 { 03373 fprintf (stderr, 03374 (_("Error in %s () a NULL pointer was passed.\n")), 03375 __FUNCTION__); 03376 return (EXIT_FAILURE); 03377 } 03378 #if DEBUG 03379 DXF_DEBUG_END 03380 #endif 03381 return (helix->major_release_number); 03382 } 03383 03384 03391 DxfHelix * 03392 dxf_helix_set_major_release_number 03393 ( 03394 DxfHelix *helix, 03396 long major_release_number 03399 ) 03400 { 03401 #if DEBUG 03402 DXF_DEBUG_BEGIN 03403 #endif 03404 /* Do some basic checks. */ 03405 if (helix == NULL) 03406 { 03407 fprintf (stderr, 03408 (_("Error in %s () a NULL pointer was passed.\n")), 03409 __FUNCTION__); 03410 return (NULL); 03411 } 03412 helix->major_release_number = major_release_number; 03413 #if DEBUG 03414 DXF_DEBUG_END 03415 #endif 03416 return (helix); 03417 } 03418 03419 03427 long 03428 dxf_helix_get_maintainance_release_number 03429 ( 03430 DxfHelix *helix 03432 ) 03433 { 03434 #if DEBUG 03435 DXF_DEBUG_BEGIN 03436 #endif 03437 /* Do some basic checks. */ 03438 if (helix == NULL) 03439 { 03440 fprintf (stderr, 03441 (_("Error in %s () a NULL pointer was passed.\n")), 03442 __FUNCTION__); 03443 return (EXIT_FAILURE); 03444 } 03445 #if DEBUG 03446 DXF_DEBUG_END 03447 #endif 03448 return (helix->maintainance_release_number); 03449 } 03450 03451 03458 DxfHelix * 03459 dxf_helix_set_maintainance_release_number 03460 ( 03461 DxfHelix *helix, 03463 long maintainance_release_number 03466 ) 03467 { 03468 #if DEBUG 03469 DXF_DEBUG_BEGIN 03470 #endif 03471 /* Do some basic checks. */ 03472 if (helix == NULL) 03473 { 03474 fprintf (stderr, 03475 (_("Error in %s () a NULL pointer was passed.\n")), 03476 __FUNCTION__); 03477 return (NULL); 03478 } 03479 helix->maintainance_release_number = maintainance_release_number; 03480 #if DEBUG 03481 DXF_DEBUG_END 03482 #endif 03483 return (helix); 03484 } 03485 03486 03493 int 03494 dxf_helix_get_constraint_type 03495 ( 03496 DxfHelix *helix 03498 ) 03499 { 03500 #if DEBUG 03501 DXF_DEBUG_BEGIN 03502 #endif 03503 /* Do some basic checks. */ 03504 if (helix == NULL) 03505 { 03506 fprintf (stderr, 03507 (_("Error in %s () a NULL pointer was passed.\n")), 03508 __FUNCTION__); 03509 return (EXIT_FAILURE); 03510 } 03511 if (helix->constraint_type < 0) 03512 { 03513 fprintf (stderr, 03514 (_("Error in %s () a negative value was found in the constraint_type member.\n")), 03515 __FUNCTION__); 03516 return (EXIT_FAILURE); 03517 } 03518 if (helix->constraint_type > 2) 03519 { 03520 fprintf (stderr, 03521 (_("Error in %s () an invalid value was found in the constraint_type member.\n")), 03522 __FUNCTION__); 03523 return (EXIT_FAILURE); 03524 } 03525 #if DEBUG 03526 DXF_DEBUG_END 03527 #endif 03528 return (helix->constraint_type); 03529 } 03530 03531 03538 DxfHelix * 03539 dxf_helix_set_constraint_type 03540 ( 03541 DxfHelix *helix, 03543 int constraint_type 03545 ) 03546 { 03547 #if DEBUG 03548 DXF_DEBUG_BEGIN 03549 #endif 03550 /* Do some basic checks. */ 03551 if (helix == NULL) 03552 { 03553 fprintf (stderr, 03554 (_("Error in %s () a NULL pointer was passed.\n")), 03555 __FUNCTION__); 03556 return (NULL); 03557 } 03558 if (constraint_type < 0) 03559 { 03560 fprintf (stderr, 03561 (_("Error in %s () a negative constraint_type value was passed.\n")), 03562 __FUNCTION__); 03563 return (NULL); 03564 } 03565 if (constraint_type > 2) 03566 { 03567 fprintf (stderr, 03568 (_("Error in %s () an invalid constraint_type value was passed.\n")), 03569 __FUNCTION__); 03570 return (NULL); 03571 } 03572 helix->constraint_type = constraint_type; 03573 #if DEBUG 03574 DXF_DEBUG_END 03575 #endif 03576 return (helix); 03577 } 03578 03579 03586 int 03587 dxf_helix_get_handedness 03588 ( 03589 DxfHelix *helix 03591 ) 03592 { 03593 #if DEBUG 03594 DXF_DEBUG_BEGIN 03595 #endif 03596 /* Do some basic checks. */ 03597 if (helix == NULL) 03598 { 03599 fprintf (stderr, 03600 (_("Error in %s () a NULL pointer was passed.\n")), 03601 __FUNCTION__); 03602 return (EXIT_FAILURE); 03603 } 03604 if (helix->handedness < 0) 03605 { 03606 fprintf (stderr, 03607 (_("Error in %s () a negative value was found in the handedness member.\n")), 03608 __FUNCTION__); 03609 return (EXIT_FAILURE); 03610 } 03611 if (helix->handedness > 1) 03612 { 03613 fprintf (stderr, 03614 (_("Error in %s () an invalid value was found in the handedness member.\n")), 03615 __FUNCTION__); 03616 return (EXIT_FAILURE); 03617 } 03618 #if DEBUG 03619 DXF_DEBUG_END 03620 #endif 03621 return (helix->handedness); 03622 } 03623 03624 03631 DxfHelix * 03632 dxf_helix_set_handedness 03633 ( 03634 DxfHelix *helix, 03636 int handedness 03638 ) 03639 { 03640 #if DEBUG 03641 DXF_DEBUG_BEGIN 03642 #endif 03643 /* Do some basic checks. */ 03644 if (helix == NULL) 03645 { 03646 fprintf (stderr, 03647 (_("Error in %s () a NULL pointer was passed.\n")), 03648 __FUNCTION__); 03649 return (NULL); 03650 } 03651 if (handedness < 0) 03652 { 03653 fprintf (stderr, 03654 (_("Error in %s () a negative handedness value was passed.\n")), 03655 __FUNCTION__); 03656 return (NULL); 03657 } 03658 if (handedness > 1) 03659 { 03660 fprintf (stderr, 03661 (_("Error in %s () an invalid handedness value was passed.\n")), 03662 __FUNCTION__); 03663 return (NULL); 03664 } 03665 helix->handedness = handedness; 03666 #if DEBUG 03667 DXF_DEBUG_END 03668 #endif 03669 return (helix); 03670 } 03671 03672 03679 DxfSpline * 03680 dxf_helix_get_spline 03681 ( 03682 DxfHelix *helix 03684 ) 03685 { 03686 #if DEBUG 03687 DXF_DEBUG_BEGIN 03688 #endif 03689 /* Do some basic checks. */ 03690 if (helix == NULL) 03691 { 03692 fprintf (stderr, 03693 (_("Error in %s () a NULL pointer was passed.\n")), 03694 __FUNCTION__); 03695 return (NULL); 03696 } 03697 if (helix->spline == NULL) 03698 { 03699 fprintf (stderr, 03700 (_("Error in %s () a NULL pointer was passed.\n")), 03701 __FUNCTION__); 03702 return (NULL); 03703 } 03704 #if DEBUG 03705 DXF_DEBUG_END 03706 #endif 03707 return ((DxfSpline *) helix->spline); 03708 } 03709 03710 03717 DxfHelix * 03718 dxf_helix_set_spline 03719 ( 03720 DxfHelix *helix, 03722 DxfSpline *spline 03724 ) 03725 { 03726 #if DEBUG 03727 DXF_DEBUG_BEGIN 03728 #endif 03729 /* Do some basic checks. */ 03730 if (helix == NULL) 03731 { 03732 fprintf (stderr, 03733 (_("Error in %s () a NULL pointer was passed.\n")), 03734 __FUNCTION__); 03735 return (NULL); 03736 } 03737 if (spline == NULL) 03738 { 03739 fprintf (stderr, 03740 (_("Error in %s () a NULL pointer was passed.\n")), 03741 __FUNCTION__); 03742 return (NULL); 03743 } 03744 helix->spline = (DxfSpline *) spline; 03745 #if DEBUG 03746 DXF_DEBUG_END 03747 #endif 03748 return (helix); 03749 } 03750 03751 03760 DxfHelix * 03761 dxf_helix_get_next 03762 ( 03763 DxfHelix *helix 03765 ) 03766 { 03767 #if DEBUG 03768 DXF_DEBUG_BEGIN 03769 #endif 03770 /* Do some basic checks. */ 03771 if (helix == NULL) 03772 { 03773 fprintf (stderr, 03774 (_("Error in %s () a NULL pointer was passed.\n")), 03775 __FUNCTION__); 03776 return (NULL); 03777 } 03778 if (helix->next == NULL) 03779 { 03780 fprintf (stderr, 03781 (_("Error in %s () a NULL pointer was found in the next member.\n")), 03782 __FUNCTION__); 03783 return (NULL); 03784 } 03785 #if DEBUG 03786 DXF_DEBUG_END 03787 #endif 03788 return ((DxfHelix *) helix->next); 03789 } 03790 03791 03799 DxfHelix * 03800 dxf_helix_set_next 03801 ( 03802 DxfHelix *helix, 03804 DxfHelix *next 03806 ) 03807 { 03808 #if DEBUG 03809 DXF_DEBUG_BEGIN 03810 #endif 03811 /* Do some basic checks. */ 03812 if (helix == NULL) 03813 { 03814 fprintf (stderr, 03815 (_("Error in %s () a NULL pointer was passed.\n")), 03816 __FUNCTION__); 03817 return (NULL); 03818 } 03819 if (next == NULL) 03820 { 03821 fprintf (stderr, 03822 (_("Error in %s () a NULL pointer was passed.\n")), 03823 __FUNCTION__); 03824 return (NULL); 03825 } 03826 helix->next = (struct DxfHelix *) next; 03827 #if DEBUG 03828 DXF_DEBUG_END 03829 #endif 03830 return (helix); 03831 } 03832 03833 03842 DxfHelix * 03843 dxf_helix_get_last 03844 ( 03845 DxfHelix *helix 03847 ) 03848 { 03849 #if DEBUG 03850 DXF_DEBUG_BEGIN 03851 #endif 03852 /* Do some basic checks. */ 03853 if (helix == NULL) 03854 { 03855 fprintf (stderr, 03856 (_("Error in %s () a NULL pointer was passed.\n")), 03857 __FUNCTION__); 03858 return (NULL); 03859 } 03860 if (helix->next == NULL) 03861 { 03862 fprintf (stderr, 03863 (_("Warning in %s () a NULL pointer was found in the next member.\n")), 03864 __FUNCTION__); 03865 return ((DxfHelix *) helix); 03866 } 03867 DxfHelix *iter = (DxfHelix *) helix->next; 03868 while (iter->next != NULL) 03869 { 03870 iter = (DxfHelix *) iter->next; 03871 } 03872 #if DEBUG 03873 DXF_DEBUG_END 03874 #endif 03875 return ((DxfHelix *) iter); 03876 } 03877 03878 03879 /* EOF*/