libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00040 #include "lwpolyline.h" 00041 00042 00056 DxfLWPolyline * 00057 dxf_lwpolyline_new () 00058 { 00059 #if DEBUG 00060 DXF_DEBUG_BEGIN 00061 #endif 00062 DxfLWPolyline *lwpolyline = NULL; 00063 size_t size; 00064 00065 size = sizeof (DxfLWPolyline); 00066 /* avoid malloc of 0 bytes */ 00067 if (size == 0) size = 1; 00068 if ((lwpolyline = malloc (size)) == NULL) 00069 { 00070 fprintf (stderr, 00071 (_("Error in %s () could not allocate memory for a DxfLWPolyline struct.\n")), 00072 __FUNCTION__); 00073 lwpolyline = NULL; 00074 } 00075 else 00076 { 00077 memset (lwpolyline, 0, size); 00078 } 00079 #if DEBUG 00080 DXF_DEBUG_END 00081 #endif 00082 return (lwpolyline); 00083 } 00084 00085 00099 DxfLWPolyline * 00100 dxf_lwpolyline_init 00101 ( 00102 DxfLWPolyline *lwpolyline 00104 ) 00105 { 00106 #if DEBUG 00107 DXF_DEBUG_BEGIN 00108 #endif 00109 /* Do some basic checks. */ 00110 if (lwpolyline == NULL) 00111 { 00112 fprintf (stderr, 00113 (_("Warning in %s () a NULL pointer was passed.\n")), 00114 __FUNCTION__); 00115 lwpolyline = dxf_lwpolyline_new (); 00116 } 00117 if (lwpolyline == NULL) 00118 { 00119 fprintf (stderr, 00120 (_("Error in %s () could not allocate memory for a DxfLWPolyline struct.\n")), 00121 __FUNCTION__); 00122 return (NULL); 00123 } 00124 lwpolyline->id_code = 0; 00125 lwpolyline->linetype = strdup (DXF_DEFAULT_LINETYPE); 00126 lwpolyline->layer = strdup (DXF_DEFAULT_LAYER); 00127 lwpolyline->elevation = 0.0; 00128 lwpolyline->thickness = 0.0; 00129 lwpolyline->linetype_scale = DXF_DEFAULT_LINETYPE_SCALE; 00130 lwpolyline->visibility = DXF_DEFAULT_VISIBILITY; 00131 lwpolyline->constant_width = 0.0; 00132 lwpolyline->color = DXF_COLOR_BYLAYER; 00133 lwpolyline->paperspace = DXF_MODELSPACE; 00134 lwpolyline->flag = 0; 00135 lwpolyline->number_vertices = 0; 00136 lwpolyline->extr_x0 = 0.0; 00137 lwpolyline->extr_y0 = 0.0; 00138 lwpolyline->extr_z0 = 0.0; 00139 lwpolyline->dictionary_owner_soft = strdup (""); 00140 lwpolyline->dictionary_owner_hard = strdup (""); 00141 lwpolyline->vertices = (struct DxfVertex *) dxf_vertex_new (); 00142 lwpolyline->next = NULL; 00143 #if DEBUG 00144 DXF_DEBUG_END 00145 #endif 00146 return (lwpolyline); 00147 } 00148 00149 00167 DxfLWPolyline * 00168 dxf_lwpolyline_read 00169 ( 00170 DxfFile *fp, 00172 DxfLWPolyline *lwpolyline 00174 ) 00175 { 00176 #if DEBUG 00177 DXF_DEBUG_BEGIN 00178 #endif 00179 char *temp_string = NULL; 00180 DxfVertex *iter = NULL; 00181 00182 /* Do some basic checks. */ 00183 if (fp == NULL) 00184 { 00185 fprintf (stderr, 00186 (_("Error in %s () a NULL file pointer was passed.\n")), 00187 __FUNCTION__); 00188 /* Clean up. */ 00189 free (temp_string); 00190 return (NULL); 00191 } 00192 if (lwpolyline == NULL) 00193 { 00194 fprintf (stderr, 00195 (_("Warning in %s () a NULL pointer was passed.\n")), 00196 __FUNCTION__); 00197 lwpolyline = dxf_lwpolyline_new (); 00198 lwpolyline = dxf_lwpolyline_init (lwpolyline); 00199 } 00200 iter = (DxfVertex *) lwpolyline->vertices; 00201 (fp->line_number)++; 00202 fscanf (fp->fp, "%[^\n]", temp_string); 00203 while (strcmp (temp_string, "0") != 0) 00204 { 00205 if (ferror (fp->fp)) 00206 { 00207 fprintf (stderr, 00208 (_("Error in %s () while reading from: %s in line: %d.\n")), 00209 __FUNCTION__, fp->filename, fp->line_number); 00210 fclose (fp->fp); 00211 return (NULL); 00212 } 00213 if (strcmp (temp_string, "5") == 0) 00214 { 00215 /* Now follows a string containing a sequential 00216 * id number. */ 00217 (fp->line_number)++; 00218 fscanf (fp->fp, "%x\n", &lwpolyline->id_code); 00219 } 00220 else if (strcmp (temp_string, "6") == 0) 00221 { 00222 /* Now follows a string containing a linetype 00223 * name. */ 00224 (fp->line_number)++; 00225 fscanf (fp->fp, "%s\n", lwpolyline->linetype); 00226 } 00227 else if (strcmp (temp_string, "8") == 0) 00228 { 00229 /* Now follows a string containing a layer name. */ 00230 (fp->line_number)++; 00231 fscanf (fp->fp, "%s\n", lwpolyline->layer); 00232 } 00233 else if (strcmp (temp_string, "10") == 0) 00234 { 00235 /* Now follows a string containing the 00236 * X-coordinate of a vertex. */ 00237 (fp->line_number)++; 00238 fscanf (fp->fp, "%lf\n", &iter->x0); 00239 } 00240 else if (strcmp (temp_string, "20") == 0) 00241 { 00242 /* Now follows a string containing the 00243 * Y-coordinate of a vertex. */ 00244 (fp->line_number)++; 00245 fscanf (fp->fp, "%lf\n", &iter->y0); 00246 } 00247 else if ((fp->acad_version_number <= AutoCAD_11) 00248 && (strcmp (temp_string, "38") == 0) 00249 && (lwpolyline->elevation != 0.0)) 00250 { 00251 /* Now follows a string containing the 00252 * elevation. */ 00253 (fp->line_number)++; 00254 fscanf (fp->fp, "%lf\n", &lwpolyline->elevation); 00255 } 00256 else if (strcmp (temp_string, "39") == 0) 00257 { 00258 /* Now follows a string containing the 00259 * thickness. */ 00260 (fp->line_number)++; 00261 fscanf (fp->fp, "%lf\n", &lwpolyline->thickness); 00262 } 00263 else if (strcmp (temp_string, "40") == 0) 00264 { 00265 /* Now follows a string containing the 00266 * start width of the vertex. */ 00267 (fp->line_number)++; 00268 fscanf (fp->fp, "%lf\n", &iter->start_width); 00269 } 00270 else if (strcmp (temp_string, "41") == 0) 00271 { 00272 /* Now follows a string containing the 00273 * start width of the vertex. */ 00274 (fp->line_number)++; 00275 fscanf (fp->fp, "%lf\n", &iter->end_width); 00276 } 00277 else if (strcmp (temp_string, "42") == 0) 00278 { 00279 /* Now follows a string containing the bulge of 00280 * the vertex. */ 00281 (fp->line_number)++; 00282 fscanf (fp->fp, "%lf\n", &iter->bulge); 00283 /* The last member of the vertex is read.\n */ 00285 /* Increment iter to next DxfVertex. */ 00286 iter->next = (struct DxfVertex *) dxf_vertex_new (); 00287 iter = (DxfVertex *) iter->next; 00288 } 00289 else if (strcmp (temp_string, "43") == 0) 00290 { 00291 /* Now follows a string containing the 00292 * constant width. */ 00293 (fp->line_number)++; 00294 fscanf (fp->fp, "%lf\n", &lwpolyline->constant_width); 00295 } 00296 else if (strcmp (temp_string, "48") == 0) 00297 { 00298 /* Now follows a string containing the linetype 00299 * scale. */ 00300 (fp->line_number)++; 00301 fscanf (fp->fp, "%lf\n", &lwpolyline->linetype_scale); 00302 } 00303 else if (strcmp (temp_string, "60") == 0) 00304 { 00305 /* Now follows a string containing the 00306 * visibility value. */ 00307 (fp->line_number)++; 00308 fscanf (fp->fp, "%hd\n", &lwpolyline->visibility); 00309 } 00310 else if (strcmp (temp_string, "62") == 0) 00311 { 00312 /* Now follows a string containing the 00313 * color value. */ 00314 (fp->line_number)++; 00315 fscanf (fp->fp, "%d\n", &lwpolyline->color); 00316 } 00317 else if (strcmp (temp_string, "67") == 0) 00318 { 00319 /* Now follows a string containing the 00320 * paperspace value. */ 00321 (fp->line_number)++; 00322 fscanf (fp->fp, "%d\n", &lwpolyline->paperspace); 00323 } 00324 else if (strcmp (temp_string, "70") == 0) 00325 { 00326 /* Now follows a string containing the 00327 * flag value. */ 00328 (fp->line_number)++; 00329 fscanf (fp->fp, "%d\n", &lwpolyline->flag); 00330 } 00331 else if (strcmp (temp_string, "90") == 0) 00332 { 00333 /* Now follows a string containing the number 00334 * of following vertices. */ 00335 (fp->line_number)++; 00336 fscanf (fp->fp, "%d\n", &lwpolyline->number_vertices); 00337 } 00338 else if ((fp->acad_version_number >= AutoCAD_12) 00339 && (strcmp (temp_string, "100") == 0)) 00340 { 00341 /* Subclass markers are post AutoCAD R12 00342 * variable so additional testing for the 00343 * version should probably be added here. 00344 * Now follows a string containing the 00345 * subclass marker value. */ 00346 (fp->line_number)++; 00347 fscanf (fp->fp, "%s\n", temp_string); 00348 } 00349 else if (strcmp (temp_string, "210") == 0) 00350 { 00351 /* Now follows a string containing the 00352 * X-value of the extrusion vector. */ 00353 (fp->line_number)++; 00354 fscanf (fp->fp, "%lf\n", &lwpolyline->extr_x0); 00355 } 00356 else if (strcmp (temp_string, "220") == 0) 00357 { 00358 /* Now follows a string containing the 00359 * Y-value of the extrusion vector. */ 00360 (fp->line_number)++; 00361 fscanf (fp->fp, "%lf\n", &lwpolyline->extr_y0); 00362 } 00363 else if (strcmp (temp_string, "230") == 0) 00364 { 00365 /* Now follows a string containing the 00366 * Z-value of the extrusion vector. */ 00367 (fp->line_number)++; 00368 fscanf (fp->fp, "%lf\n", &lwpolyline->extr_z0); 00369 } 00370 else if (strcmp (temp_string, "330") == 0) 00371 { 00372 /* Now follows a string containing Soft-pointer 00373 * ID/handle to owner dictionary. */ 00374 (fp->line_number)++; 00375 fscanf (fp->fp, "%s\n", lwpolyline->dictionary_owner_soft); 00376 } 00377 else if (strcmp (temp_string, "360") == 0) 00378 { 00379 /* Now follows a string containing Hard owner 00380 * ID/handle to owner dictionary. */ 00381 (fp->line_number)++; 00382 fscanf (fp->fp, "%s\n", lwpolyline->dictionary_owner_hard); 00383 } 00384 else if (strcmp (temp_string, "999") == 0) 00385 { 00386 /* Now follows a string containing a comment. */ 00387 (fp->line_number)++; 00388 fscanf (fp->fp, "%s\n", temp_string); 00389 fprintf (stdout, "DXF comment: %s\n", temp_string); 00390 } 00391 else 00392 { 00393 fprintf (stderr, 00394 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00395 __FUNCTION__, fp->filename, fp->line_number); 00396 } 00397 } 00400 /* Set the pointer to the last (unused) vertex in the linked list to NULL. */ 00401 iter->next = NULL; 00402 /* Handle omitted members and/or illegal values. */ 00403 if (strcmp (lwpolyline->linetype, "") == 0) 00404 { 00405 lwpolyline->linetype = strdup (DXF_DEFAULT_LINETYPE); 00406 } 00407 if (strcmp (lwpolyline->layer, "") == 0) 00408 { 00409 lwpolyline->layer = strdup (DXF_DEFAULT_LAYER); 00410 } 00411 /* Clean up. */ 00412 free (temp_string); 00413 #if DEBUG 00414 DXF_DEBUG_END 00415 #endif 00416 return (lwpolyline); 00417 } 00418 00419 00439 int 00440 dxf_lwpolyline_write 00441 ( 00442 DxfFile *fp, 00444 DxfLWPolyline *lwpolyline 00446 ) 00447 { 00448 #if DEBUG 00449 DXF_DEBUG_BEGIN 00450 #endif 00451 char *dxf_entity_name = strdup ("LWPOLYLINE"); 00452 DxfVertex *iter = NULL; 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 (lwpolyline == NULL) 00465 { 00466 fprintf (stderr, 00467 (_("Error in %s () a NULL pointer was passed.\n")), 00468 __FUNCTION__); 00469 /* Clean up. */ 00470 free (dxf_entity_name); 00471 return (EXIT_FAILURE); 00472 } 00473 if ((fp->acad_version_number < AutoCAD_14) 00474 && (fp->follow_strict_version_rules)) 00475 { 00476 fprintf (stderr, 00477 (_("Error in %s () illegal DXF version for this %s entity with id-code: %x.\n")), 00478 __FUNCTION__, dxf_entity_name, lwpolyline->id_code); 00479 return (EXIT_FAILURE); 00480 } 00481 else 00482 { 00483 fprintf (stderr, 00484 (_("Warning in %s () illegal DXF version for this %s entity with id-code: %x.\n")), 00485 __FUNCTION__, dxf_entity_name, lwpolyline->id_code); 00486 } 00487 if (strcmp (lwpolyline->linetype, "") == 0) 00488 { 00489 fprintf (stderr, 00490 (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")), 00491 __FUNCTION__, dxf_entity_name, lwpolyline->id_code); 00492 fprintf (stderr, 00493 (_("\t%s entity is reset to default linetype")), 00494 dxf_entity_name); 00495 lwpolyline->linetype = strdup (DXF_DEFAULT_LINETYPE); 00496 } 00497 if (strcmp (lwpolyline->layer, "") == 0) 00498 { 00499 fprintf (stderr, 00500 (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")), 00501 __FUNCTION__, dxf_entity_name, lwpolyline->id_code); 00502 fprintf (stderr, 00503 (_("\t%s entity is relocated to layer 0\n")), 00504 dxf_entity_name); 00505 lwpolyline->layer = strdup (DXF_DEFAULT_LAYER); 00506 } 00507 /* Start writing output. */ 00508 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00509 if (lwpolyline->id_code != -1) 00510 { 00511 fprintf (fp->fp, " 5\n%x\n", lwpolyline->id_code); 00512 } 00523 if ((strcmp (lwpolyline->dictionary_owner_soft, "") != 0) 00524 && (fp->acad_version_number >= AutoCAD_14)) 00525 { 00526 fprintf (fp->fp, "102\n{ACAD_REACTORS\n"); 00527 fprintf (fp->fp, "330\n%s\n", lwpolyline->dictionary_owner_soft); 00528 fprintf (fp->fp, "102\n}\n"); 00529 } 00530 if ((strcmp (lwpolyline->dictionary_owner_hard, "") != 0) 00531 && (fp->acad_version_number >= AutoCAD_14)) 00532 { 00533 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n"); 00534 fprintf (fp->fp, "360\n%s\n", lwpolyline->dictionary_owner_hard); 00535 fprintf (fp->fp, "102\n}\n"); 00536 } 00537 if (fp->acad_version_number >= AutoCAD_13) 00538 { 00539 fprintf (fp->fp, "100\nAcDbEntity\n"); 00540 } 00541 if (lwpolyline->paperspace == DXF_PAPERSPACE) 00542 { 00543 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE); 00544 } 00545 fprintf (fp->fp, " 8\n%s\n", lwpolyline->layer); 00546 if (strcmp (lwpolyline->linetype, DXF_DEFAULT_LINETYPE) != 0) 00547 { 00548 fprintf (fp->fp, " 6\n%s\n", lwpolyline->linetype); 00549 } 00550 if (lwpolyline->color != DXF_COLOR_BYLAYER) 00551 { 00552 fprintf (fp->fp, " 62\n%d\n", lwpolyline->color); 00553 } 00554 if (lwpolyline->linetype_scale != 1.0) 00555 { 00556 fprintf (fp->fp, " 48\n%f\n", lwpolyline->linetype_scale); 00557 } 00558 if (lwpolyline->visibility != 0) 00559 { 00560 fprintf (fp->fp, " 60\n%d\n", lwpolyline->visibility); 00561 } 00562 if (fp->acad_version_number >= AutoCAD_13) 00563 { 00564 fprintf (fp->fp, "100\nAcDbPolyline\n"); 00565 } 00566 fprintf (fp->fp, " 90\n%d\n", lwpolyline->number_vertices); 00567 fprintf (fp->fp, " 70\n%d\n", lwpolyline->flag); 00568 fprintf (fp->fp, " 43\n%f\n", lwpolyline->constant_width); 00569 if (lwpolyline->elevation != 0.0) 00570 { 00571 fprintf (fp->fp, " 38\n%f\n", lwpolyline->elevation); 00572 } 00573 if (lwpolyline->thickness != 0.0) 00574 { 00575 fprintf (fp->fp, " 39\n%f\n", lwpolyline->thickness); 00576 } 00577 /* Start of writing (multiple) vertices. */ 00578 iter = (DxfVertex *) lwpolyline->vertices; 00579 while (iter != NULL) 00580 { 00581 fprintf (fp->fp, " 10\n%f\n", iter->x0); 00582 fprintf (fp->fp, " 20\n%f\n", iter->y0); 00583 if ((iter->start_width != lwpolyline->constant_width) 00584 || (iter->end_width != lwpolyline->constant_width)) 00585 { 00586 fprintf (fp->fp, " 40\n%f\n", iter->start_width); 00587 fprintf (fp->fp, " 41\n%f\n", iter->end_width); 00588 } 00589 fprintf (fp->fp, " 42\n%f\n", iter->bulge); 00590 iter = (DxfVertex *) iter->next; 00591 } 00592 /* End of writing (multiple) vertices. */ 00593 if (fp->acad_version_number >= AutoCAD_12) 00594 { 00595 fprintf (fp->fp, "210\n%f\n", lwpolyline->extr_x0); 00596 fprintf (fp->fp, "220\n%f\n", lwpolyline->extr_y0); 00597 fprintf (fp->fp, "230\n%f\n", lwpolyline->extr_z0); 00598 } 00599 /* Clean up. */ 00600 free (dxf_entity_name); 00601 #if DEBUG 00602 DXF_DEBUG_END 00603 #endif 00604 return (EXIT_SUCCESS); 00605 } 00606 00607 00621 int 00622 dxf_lwpolyline_free 00623 ( 00624 DxfLWPolyline *lwpolyline 00626 ) 00627 { 00628 #if DEBUG 00629 DXF_DEBUG_BEGIN 00630 #endif 00631 /* Do some basic checks. */ 00632 if (lwpolyline == NULL) 00633 { 00634 fprintf (stderr, 00635 (_("Error in %s () a NULL pointer was passed.\n")), 00636 __FUNCTION__); 00637 return (EXIT_FAILURE); 00638 } 00639 if (lwpolyline->next != NULL) 00640 { 00641 fprintf (stderr, 00642 (_("Error in %s () pointer to next was not NULL.\n")), 00643 __FUNCTION__); 00644 return (EXIT_FAILURE); 00645 } 00646 free (lwpolyline->linetype); 00647 free (lwpolyline->layer); 00648 free (lwpolyline); 00649 lwpolyline = NULL; 00650 #if DEBUG 00651 DXF_DEBUG_END 00652 #endif 00653 return (EXIT_SUCCESS); 00654 } 00655 00656 00667 void 00668 dxf_lwpolyline_free_chain 00669 ( 00670 DxfLWPolyline *lwpolylines 00672 ) 00673 { 00674 #ifdef DEBUG 00675 DXF_DEBUG_BEGIN 00676 #endif 00677 if (lwpolylines == NULL) 00678 { 00679 fprintf (stderr, 00680 (_("Warning in %s () a NULL pointer was passed.\n")), 00681 __FUNCTION__); 00682 } 00683 while (lwpolylines != NULL) 00684 { 00685 struct DxfLWPolyline *iter = lwpolylines->next; 00686 dxf_lwpolyline_free (lwpolylines); 00687 lwpolylines = (DxfLWPolyline *) iter; 00688 } 00689 #if DEBUG 00690 DXF_DEBUG_END 00691 #endif 00692 } 00693 00694 00700 int 00701 dxf_lwpolyline_get_id_code 00702 ( 00703 DxfLWPolyline *lwpolyline 00705 ) 00706 { 00707 #if DEBUG 00708 DXF_DEBUG_BEGIN 00709 #endif 00710 /* Do some basic checks. */ 00711 if (lwpolyline == NULL) 00712 { 00713 fprintf (stderr, 00714 (_("Error in %s () a NULL pointer was passed.\n")), 00715 __FUNCTION__); 00716 return (EXIT_FAILURE); 00717 } 00718 if (lwpolyline->id_code < 0) 00719 { 00720 fprintf (stderr, 00721 (_("Error in %s () a negative value was found.\n")), 00722 __FUNCTION__); 00723 return (EXIT_FAILURE); 00724 } 00725 #if DEBUG 00726 DXF_DEBUG_END 00727 #endif 00728 return (lwpolyline->id_code); 00729 } 00730 00731 00735 DxfLWPolyline * 00736 dxf_lwpolyline_set_id_code 00737 ( 00738 DxfLWPolyline *lwpolyline, 00740 int id_code 00744 ) 00745 { 00746 #if DEBUG 00747 DXF_DEBUG_BEGIN 00748 #endif 00749 /* Do some basic checks. */ 00750 if (lwpolyline == NULL) 00751 { 00752 fprintf (stderr, 00753 (_("Error in %s () a NULL pointer was passed.\n")), 00754 __FUNCTION__); 00755 return (NULL); 00756 } 00757 if (id_code < 0) 00758 { 00759 fprintf (stderr, 00760 (_("Error in %s () a negative value was passed.\n")), 00761 __FUNCTION__); 00762 return (NULL); 00763 } 00764 lwpolyline->id_code = id_code; 00765 #if DEBUG 00766 DXF_DEBUG_END 00767 #endif 00768 return (lwpolyline); 00769 } 00770 00771 00777 char * 00778 dxf_lwpolyline_get_linetype 00779 ( 00780 DxfLWPolyline *lwpolyline 00782 ) 00783 { 00784 #if DEBUG 00785 DXF_DEBUG_BEGIN 00786 #endif 00787 /* Do some basic checks. */ 00788 if (lwpolyline == NULL) 00789 { 00790 fprintf (stderr, 00791 (_("Error in %s () a NULL pointer was passed.\n")), 00792 __FUNCTION__); 00793 return (NULL); 00794 } 00795 if (lwpolyline->linetype == NULL) 00796 { 00797 fprintf (stderr, 00798 (_("Error in %s () a NULL pointer was found.\n")), 00799 __FUNCTION__); 00800 return (NULL); 00801 } 00802 #if DEBUG 00803 DXF_DEBUG_END 00804 #endif 00805 return (strdup (lwpolyline->linetype)); 00806 } 00807 00808 00812 DxfLWPolyline * 00813 dxf_lwpolyline_set_linetype 00814 ( 00815 DxfLWPolyline *lwpolyline, 00817 char *linetype 00819 ) 00820 { 00821 #if DEBUG 00822 DXF_DEBUG_BEGIN 00823 #endif 00824 /* Do some basic checks. */ 00825 if (lwpolyline == NULL) 00826 { 00827 fprintf (stderr, 00828 (_("Error in %s () a NULL pointer was passed.\n")), 00829 __FUNCTION__); 00830 return (NULL); 00831 } 00832 if (linetype == NULL) 00833 { 00834 fprintf (stderr, 00835 (_("Error in %s () a NULL pointer was passed.\n")), 00836 __FUNCTION__); 00837 return (NULL); 00838 } 00839 lwpolyline->linetype = strdup (linetype); 00840 #if DEBUG 00841 DXF_DEBUG_END 00842 #endif 00843 return (lwpolyline); 00844 } 00845 00846 00852 char * 00853 dxf_lwpolyline_get_layer 00854 ( 00855 DxfLWPolyline *lwpolyline 00857 ) 00858 { 00859 #if DEBUG 00860 DXF_DEBUG_BEGIN 00861 #endif 00862 /* Do some basic checks. */ 00863 if (lwpolyline == NULL) 00864 { 00865 fprintf (stderr, 00866 (_("Error in %s () a NULL pointer was passed.\n")), 00867 __FUNCTION__); 00868 return (NULL); 00869 } 00870 if (lwpolyline->layer == NULL) 00871 { 00872 fprintf (stderr, 00873 (_("Error in %s () a NULL pointer was found.\n")), 00874 __FUNCTION__); 00875 return (NULL); 00876 } 00877 #if DEBUG 00878 DXF_DEBUG_END 00879 #endif 00880 return (strdup (lwpolyline->layer)); 00881 } 00882 00883 00887 DxfLWPolyline * 00888 dxf_lwpolyline_set_layer 00889 ( 00890 DxfLWPolyline *lwpolyline, 00892 char *layer 00894 ) 00895 { 00896 #if DEBUG 00897 DXF_DEBUG_BEGIN 00898 #endif 00899 /* Do some basic checks. */ 00900 if (lwpolyline == NULL) 00901 { 00902 fprintf (stderr, 00903 (_("Error in %s () a NULL pointer was passed.\n")), 00904 __FUNCTION__); 00905 return (NULL); 00906 } 00907 if (layer == NULL) 00908 { 00909 fprintf (stderr, 00910 (_("Error in %s () a NULL pointer was passed.\n")), 00911 __FUNCTION__); 00912 return (NULL); 00913 } 00914 lwpolyline->layer = strdup (layer); 00915 #if DEBUG 00916 DXF_DEBUG_END 00917 #endif 00918 return (lwpolyline); 00919 } 00920 00921 00927 double 00928 dxf_lwpolyline_get_elevation 00929 ( 00930 DxfLWPolyline *lwpolyline 00932 ) 00933 { 00934 #if DEBUG 00935 DXF_DEBUG_BEGIN 00936 #endif 00937 /* Do some basic checks. */ 00938 if (lwpolyline == NULL) 00939 { 00940 fprintf (stderr, 00941 (_("Error in %s () a NULL pointer was passed.\n")), 00942 __FUNCTION__); 00943 return (EXIT_FAILURE); 00944 } 00945 #if DEBUG 00946 DXF_DEBUG_END 00947 #endif 00948 return (lwpolyline->elevation); 00949 } 00950 00951 00955 DxfLWPolyline * 00956 dxf_lwpolyline_set_elevation 00957 ( 00958 DxfLWPolyline *lwpolyline, 00960 double elevation 00962 ) 00963 { 00964 #if DEBUG 00965 DXF_DEBUG_BEGIN 00966 #endif 00967 /* Do some basic checks. */ 00968 if (lwpolyline == NULL) 00969 { 00970 fprintf (stderr, 00971 (_("Error in %s () a NULL pointer was passed.\n")), 00972 __FUNCTION__); 00973 return (NULL); 00974 } 00975 lwpolyline->elevation = elevation; 00976 #if DEBUG 00977 DXF_DEBUG_END 00978 #endif 00979 return (lwpolyline); 00980 } 00981 00982 00988 double 00989 dxf_lwpolyline_get_thickness 00990 ( 00991 DxfLWPolyline *lwpolyline 00993 ) 00994 { 00995 #if DEBUG 00996 DXF_DEBUG_BEGIN 00997 #endif 00998 /* Do some basic checks. */ 00999 if (lwpolyline == NULL) 01000 { 01001 fprintf (stderr, 01002 (_("Error in %s () a NULL pointer was passed.\n")), 01003 __FUNCTION__); 01004 return (EXIT_FAILURE); 01005 } 01006 if (lwpolyline->thickness < 0.0) 01007 { 01008 fprintf (stderr, 01009 (_("Error in %s () a negative value was found.\n")), 01010 __FUNCTION__); 01011 return (EXIT_FAILURE); 01012 } 01013 #if DEBUG 01014 DXF_DEBUG_END 01015 #endif 01016 return (lwpolyline->thickness); 01017 } 01018 01019 01023 DxfLWPolyline * 01024 dxf_lwpolyline_set_thickness 01025 ( 01026 DxfLWPolyline *lwpolyline, 01028 double thickness 01030 ) 01031 { 01032 #if DEBUG 01033 DXF_DEBUG_BEGIN 01034 #endif 01035 /* Do some basic checks. */ 01036 if (lwpolyline == NULL) 01037 { 01038 fprintf (stderr, 01039 (_("Error in %s () a NULL pointer was passed.\n")), 01040 __FUNCTION__); 01041 return (NULL); 01042 } 01043 if (thickness < 0.0) 01044 { 01045 fprintf (stderr, 01046 (_("Error in %s () a negative value was passed.\n")), 01047 __FUNCTION__); 01048 return (NULL); 01049 } 01050 lwpolyline->thickness = thickness; 01051 #if DEBUG 01052 DXF_DEBUG_END 01053 #endif 01054 return (lwpolyline); 01055 } 01056 01057 01063 double 01064 dxf_lwpolyline_get_linetype_scale 01065 ( 01066 DxfLWPolyline *lwpolyline 01068 ) 01069 { 01070 #if DEBUG 01071 DXF_DEBUG_BEGIN 01072 #endif 01073 /* Do some basic checks. */ 01074 if (lwpolyline == NULL) 01075 { 01076 fprintf (stderr, 01077 (_("Error in %s () a NULL pointer was passed.\n")), 01078 __FUNCTION__); 01079 return (EXIT_FAILURE); 01080 } 01081 if (lwpolyline->linetype_scale < 0.0) 01082 { 01083 fprintf (stderr, 01084 (_("Error in %s () a negative value was found.\n")), 01085 __FUNCTION__); 01086 return (EXIT_FAILURE); 01087 } 01088 #if DEBUG 01089 DXF_DEBUG_END 01090 #endif 01091 return (lwpolyline->linetype_scale); 01092 } 01093 01094 01098 DxfLWPolyline * 01099 dxf_lwpolyline_set_linetype_scale 01100 ( 01101 DxfLWPolyline *lwpolyline, 01103 double linetype_scale 01105 ) 01106 { 01107 #if DEBUG 01108 DXF_DEBUG_BEGIN 01109 #endif 01110 /* Do some basic checks. */ 01111 if (lwpolyline == NULL) 01112 { 01113 fprintf (stderr, 01114 (_("Error in %s () a NULL pointer was passed.\n")), 01115 __FUNCTION__); 01116 return (NULL); 01117 } 01118 if (linetype_scale < 0.0) 01119 { 01120 fprintf (stderr, 01121 (_("Error in %s () a negative value was passed.\n")), 01122 __FUNCTION__); 01123 return (NULL); 01124 } 01125 lwpolyline->linetype_scale = linetype_scale; 01126 #if DEBUG 01127 DXF_DEBUG_END 01128 #endif 01129 return (lwpolyline); 01130 } 01131 01132 01138 int16_t 01139 dxf_lwpolyline_get_visibility 01140 ( 01141 DxfLWPolyline *lwpolyline 01143 ) 01144 { 01145 #if DEBUG 01146 DXF_DEBUG_BEGIN 01147 #endif 01148 /* Do some basic checks. */ 01149 if (lwpolyline == NULL) 01150 { 01151 fprintf (stderr, 01152 (_("Error in %s () a NULL pointer was passed.\n")), 01153 __FUNCTION__); 01154 return (EXIT_FAILURE); 01155 } 01156 if (lwpolyline->visibility < 0) 01157 { 01158 fprintf (stderr, 01159 (_("Error in %s () a negative value was found.\n")), 01160 __FUNCTION__); 01161 return (EXIT_FAILURE); 01162 } 01163 if (lwpolyline->visibility > 1) 01164 { 01165 fprintf (stderr, 01166 (_("Error in %s () an out of range value was found.\n")), 01167 __FUNCTION__); 01168 return (EXIT_FAILURE); 01169 } 01170 #if DEBUG 01171 DXF_DEBUG_END 01172 #endif 01173 return (lwpolyline->visibility); 01174 } 01175 01176 01180 DxfLWPolyline * 01181 dxf_lwpolyline_set_visibility 01182 ( 01183 DxfLWPolyline *lwpolyline, 01185 int16_t visibility 01187 ) 01188 { 01189 #if DEBUG 01190 DXF_DEBUG_BEGIN 01191 #endif 01192 /* Do some basic checks. */ 01193 if (lwpolyline == NULL) 01194 { 01195 fprintf (stderr, 01196 (_("Error in %s () a NULL pointer was passed.\n")), 01197 __FUNCTION__); 01198 return (NULL); 01199 } 01200 if (visibility < 0) 01201 { 01202 fprintf (stderr, 01203 (_("Error in %s () a negative value was passed.\n")), 01204 __FUNCTION__); 01205 return (NULL); 01206 } 01207 if (visibility > 1) 01208 { 01209 fprintf (stderr, 01210 (_("Error in %s () an out of range value was passed.\n")), 01211 __FUNCTION__); 01212 return (NULL); 01213 } 01214 lwpolyline->visibility = visibility; 01215 #if DEBUG 01216 DXF_DEBUG_END 01217 #endif 01218 return (lwpolyline); 01219 } 01220 01221 01227 int 01228 dxf_lwpolyline_get_color 01229 ( 01230 DxfLWPolyline *lwpolyline 01232 ) 01233 { 01234 #if DEBUG 01235 DXF_DEBUG_BEGIN 01236 #endif 01237 /* Do some basic checks. */ 01238 if (lwpolyline == NULL) 01239 { 01240 fprintf (stderr, 01241 (_("Error in %s () a NULL pointer was passed.\n")), 01242 __FUNCTION__); 01243 return (EXIT_FAILURE); 01244 } 01245 if (lwpolyline->color < 0) 01246 { 01247 fprintf (stderr, 01248 (_("Warning in %s () a negative value was found.\n")), 01249 __FUNCTION__); 01250 } 01251 #if DEBUG 01252 DXF_DEBUG_END 01253 #endif 01254 return (lwpolyline->color); 01255 } 01256 01257 01261 DxfLWPolyline * 01262 dxf_lwpolyline_set_color 01263 ( 01264 DxfLWPolyline *lwpolyline, 01266 int color 01268 ) 01269 { 01270 #if DEBUG 01271 DXF_DEBUG_BEGIN 01272 #endif 01273 /* Do some basic checks. */ 01274 if (lwpolyline == NULL) 01275 { 01276 fprintf (stderr, 01277 (_("Error in %s () a NULL pointer was passed.\n")), 01278 __FUNCTION__); 01279 return (NULL); 01280 } 01281 if (color < 0) 01282 { 01283 fprintf (stderr, 01284 (_("Warning in %s () a negative value was passed.\n")), 01285 __FUNCTION__); 01286 } 01287 lwpolyline->color = color; 01288 #if DEBUG 01289 DXF_DEBUG_END 01290 #endif 01291 return (lwpolyline); 01292 } 01293 01294 01300 int 01301 dxf_lwpolyline_get_paperspace 01302 ( 01303 DxfLWPolyline *lwpolyline 01305 ) 01306 { 01307 #if DEBUG 01308 DXF_DEBUG_BEGIN 01309 #endif 01310 /* Do some basic checks. */ 01311 if (lwpolyline == NULL) 01312 { 01313 fprintf (stderr, 01314 (_("Error in %s () a NULL pointer was passed.\n")), 01315 __FUNCTION__); 01316 return (EXIT_FAILURE); 01317 } 01318 if (lwpolyline->paperspace < 0) 01319 { 01320 fprintf (stderr, 01321 (_("Warning in %s () a negative value was found.\n")), 01322 __FUNCTION__); 01323 } 01324 if (lwpolyline->paperspace > 1) 01325 { 01326 fprintf (stderr, 01327 (_("Warning in %s () an out of range value was found.\n")), 01328 __FUNCTION__); 01329 } 01330 #if DEBUG 01331 DXF_DEBUG_END 01332 #endif 01333 return (lwpolyline->paperspace); 01334 } 01335 01336 01340 DxfLWPolyline * 01341 dxf_lwpolyline_set_paperspace 01342 ( 01343 DxfLWPolyline *lwpolyline, 01345 int paperspace 01347 ) 01348 { 01349 #if DEBUG 01350 DXF_DEBUG_BEGIN 01351 #endif 01352 /* Do some basic checks. */ 01353 if (lwpolyline == NULL) 01354 { 01355 fprintf (stderr, 01356 (_("Error in %s () a NULL pointer was passed.\n")), 01357 __FUNCTION__); 01358 return (NULL); 01359 } 01360 if (paperspace < 0) 01361 { 01362 fprintf (stderr, 01363 (_("Error in %s () a negative value was passed.\n")), 01364 __FUNCTION__); 01365 return (NULL); 01366 } 01367 if (paperspace > 1) 01368 { 01369 fprintf (stderr, 01370 (_("Error in %s () an out of range value was passed.\n")), 01371 __FUNCTION__); 01372 return (NULL); 01373 } 01374 lwpolyline->paperspace = paperspace; 01375 #if DEBUG 01376 DXF_DEBUG_END 01377 #endif 01378 return (lwpolyline); 01379 } 01380 01381 01389 int 01390 dxf_lwpolyline_get_graphics_data_size 01391 ( 01392 DxfLWPolyline *lwpolyline 01394 ) 01395 { 01396 #if DEBUG 01397 DXF_DEBUG_BEGIN 01398 #endif 01399 /* Do some basic checks. */ 01400 if (lwpolyline == NULL) 01401 { 01402 fprintf (stderr, 01403 (_("Error in %s () a NULL pointer was passed.\n")), 01404 __FUNCTION__); 01405 return (EXIT_FAILURE); 01406 } 01407 if (lwpolyline->graphics_data_size < 0) 01408 { 01409 fprintf (stderr, 01410 (_("Warning in %s () a negative value was found.\n")), 01411 __FUNCTION__); 01412 } 01413 if (lwpolyline->graphics_data_size == 0) 01414 { 01415 fprintf (stderr, 01416 (_("Warning in %s () a zero value was found.\n")), 01417 __FUNCTION__); 01418 } 01419 #if DEBUG 01420 DXF_DEBUG_END 01421 #endif 01422 return (lwpolyline->graphics_data_size); 01423 } 01424 01425 01433 DxfLWPolyline * 01434 dxf_lwpolyline_set_graphics_data_size 01435 ( 01436 DxfLWPolyline *lwpolyline, 01438 int graphics_data_size 01441 ) 01442 { 01443 #if DEBUG 01444 DXF_DEBUG_BEGIN 01445 #endif 01446 /* Do some basic checks. */ 01447 if (lwpolyline == NULL) 01448 { 01449 fprintf (stderr, 01450 (_("Error in %s () a NULL pointer was passed.\n")), 01451 __FUNCTION__); 01452 return (NULL); 01453 } 01454 if (graphics_data_size < 0) 01455 { 01456 fprintf (stderr, 01457 (_("Error in %s () a negative value was passed.\n")), 01458 __FUNCTION__); 01459 return (NULL); 01460 } 01461 if (graphics_data_size == 0) 01462 { 01463 fprintf (stderr, 01464 (_("Warning in %s () a zero value was passed.\n")), 01465 __FUNCTION__); 01466 } 01467 lwpolyline->graphics_data_size = graphics_data_size; 01468 #if DEBUG 01469 DXF_DEBUG_END 01470 #endif 01471 return (lwpolyline); 01472 } 01473 01474 01481 int16_t 01482 dxf_lwpolyline_get_shadow_mode 01483 ( 01484 DxfLWPolyline *lwpolyline 01486 ) 01487 { 01488 #if DEBUG 01489 DXF_DEBUG_BEGIN 01490 #endif 01491 /* Do some basic checks. */ 01492 if (lwpolyline == NULL) 01493 { 01494 fprintf (stderr, 01495 (_("Error in %s () a NULL pointer was passed.\n")), 01496 __FUNCTION__); 01497 return (EXIT_FAILURE); 01498 } 01499 if (lwpolyline->shadow_mode < 0) 01500 { 01501 fprintf (stderr, 01502 (_("Error in %s () a negative value was found.\n")), 01503 __FUNCTION__); 01504 return (EXIT_FAILURE); 01505 } 01506 if (lwpolyline->shadow_mode > 3) 01507 { 01508 fprintf (stderr, 01509 (_("Error in %s () an out of range value was found.\n")), 01510 __FUNCTION__); 01511 return (EXIT_FAILURE); 01512 } 01513 #if DEBUG 01514 DXF_DEBUG_END 01515 #endif 01516 return (lwpolyline->shadow_mode); 01517 } 01518 01519 01526 DxfLWPolyline * 01527 dxf_lwpolyline_set_shadow_mode 01528 ( 01529 DxfLWPolyline *lwpolyline, 01531 int16_t shadow_mode 01533 ) 01534 { 01535 #if DEBUG 01536 DXF_DEBUG_BEGIN 01537 #endif 01538 /* Do some basic checks. */ 01539 if (lwpolyline == NULL) 01540 { 01541 fprintf (stderr, 01542 (_("Error in %s () a NULL pointer was passed.\n")), 01543 __FUNCTION__); 01544 return (NULL); 01545 } 01546 if (shadow_mode < 0) 01547 { 01548 fprintf (stderr, 01549 (_("Error in %s () a negative value was passed.\n")), 01550 __FUNCTION__); 01551 return (NULL); 01552 } 01553 if (shadow_mode > 3) 01554 { 01555 fprintf (stderr, 01556 (_("Error in %s () an out of range value was passed.\n")), 01557 __FUNCTION__); 01558 return (NULL); 01559 } 01560 lwpolyline->shadow_mode = shadow_mode; 01561 #if DEBUG 01562 DXF_DEBUG_END 01563 #endif 01564 return (lwpolyline); 01565 } 01566 01567 01576 DxfBinaryGraphicsData * 01577 dxf_lwpolyline_get_binary_graphics_data 01578 ( 01579 DxfLWPolyline *lwpolyline 01581 ) 01582 { 01583 #if DEBUG 01584 DXF_DEBUG_BEGIN 01585 #endif 01586 /* Do some basic checks. */ 01587 if (lwpolyline == NULL) 01588 { 01589 fprintf (stderr, 01590 (_("Error in %s () a NULL pointer was passed.\n")), 01591 __FUNCTION__); 01592 return (NULL); 01593 } 01594 if (lwpolyline->binary_graphics_data == NULL) 01595 { 01596 fprintf (stderr, 01597 (_("Error in %s () a NULL pointer was found.\n")), 01598 __FUNCTION__); 01599 return (NULL); 01600 } 01601 #if DEBUG 01602 DXF_DEBUG_END 01603 #endif 01604 return ((DxfBinaryGraphicsData *) lwpolyline->binary_graphics_data); 01605 } 01606 01607 01612 DxfLWPolyline * 01613 dxf_lwpolyline_set_binary_graphics_data 01614 ( 01615 DxfLWPolyline *lwpolyline, 01617 DxfBinaryGraphicsData *data 01620 ) 01621 { 01622 #if DEBUG 01623 DXF_DEBUG_BEGIN 01624 #endif 01625 /* Do some basic checks. */ 01626 if (lwpolyline == NULL) 01627 { 01628 fprintf (stderr, 01629 (_("Error in %s () a NULL pointer was passed.\n")), 01630 __FUNCTION__); 01631 return (NULL); 01632 } 01633 if (data == NULL) 01634 { 01635 fprintf (stderr, 01636 (_("Error in %s () a NULL pointer was passed.\n")), 01637 __FUNCTION__); 01638 return (NULL); 01639 } 01640 lwpolyline->binary_graphics_data = (DxfBinaryGraphicsData *) data; 01641 #if DEBUG 01642 DXF_DEBUG_END 01643 #endif 01644 return (lwpolyline); 01645 } 01646 01647 01656 char * 01657 dxf_lwpolyline_get_dictionary_owner_soft 01658 ( 01659 DxfLWPolyline *lwpolyline 01661 ) 01662 { 01663 #if DEBUG 01664 DXF_DEBUG_BEGIN 01665 #endif 01666 /* Do some basic checks. */ 01667 if (lwpolyline == NULL) 01668 { 01669 fprintf (stderr, 01670 (_("Error in %s () a NULL pointer was passed.\n")), 01671 __FUNCTION__); 01672 return (NULL); 01673 } 01674 if (lwpolyline->dictionary_owner_soft == NULL) 01675 { 01676 fprintf (stderr, 01677 (_("Error in %s () a NULL pointer was found.\n")), 01678 __FUNCTION__); 01679 return (NULL); 01680 } 01681 #if DEBUG 01682 DXF_DEBUG_END 01683 #endif 01684 return (strdup (lwpolyline->dictionary_owner_soft)); 01685 } 01686 01687 01692 DxfLWPolyline * 01693 dxf_lwpolyline_set_dictionary_owner_soft 01694 ( 01695 DxfLWPolyline *lwpolyline, 01697 char *dictionary_owner_soft 01700 ) 01701 { 01702 #if DEBUG 01703 DXF_DEBUG_BEGIN 01704 #endif 01705 /* Do some basic checks. */ 01706 if (lwpolyline == NULL) 01707 { 01708 fprintf (stderr, 01709 (_("Error in %s () a NULL pointer was passed.\n")), 01710 __FUNCTION__); 01711 return (NULL); 01712 } 01713 if (dictionary_owner_soft == NULL) 01714 { 01715 fprintf (stderr, 01716 (_("Error in %s () a NULL pointer was passed.\n")), 01717 __FUNCTION__); 01718 return (NULL); 01719 } 01720 lwpolyline->dictionary_owner_soft = strdup (dictionary_owner_soft); 01721 #if DEBUG 01722 DXF_DEBUG_END 01723 #endif 01724 return (lwpolyline); 01725 } 01726 01727 01736 char * 01737 dxf_lwpolyline_get_material 01738 ( 01739 DxfLWPolyline *lwpolyline 01741 ) 01742 { 01743 #if DEBUG 01744 DXF_DEBUG_BEGIN 01745 #endif 01746 /* Do some basic checks. */ 01747 if (lwpolyline == NULL) 01748 { 01749 fprintf (stderr, 01750 (_("Error in %s () a NULL pointer was passed.\n")), 01751 __FUNCTION__); 01752 return (NULL); 01753 } 01754 if (lwpolyline->material == NULL) 01755 { 01756 fprintf (stderr, 01757 (_("Error in %s () a NULL pointer was found.\n")), 01758 __FUNCTION__); 01759 return (NULL); 01760 } 01761 #if DEBUG 01762 DXF_DEBUG_END 01763 #endif 01764 return (strdup (lwpolyline->material)); 01765 } 01766 01767 01775 DxfLWPolyline * 01776 dxf_lwpolyline_set_material 01777 ( 01778 DxfLWPolyline *lwpolyline, 01780 char *material 01783 ) 01784 { 01785 #if DEBUG 01786 DXF_DEBUG_BEGIN 01787 #endif 01788 /* Do some basic checks. */ 01789 if (lwpolyline == NULL) 01790 { 01791 fprintf (stderr, 01792 (_("Error in %s () a NULL pointer was passed.\n")), 01793 __FUNCTION__); 01794 return (NULL); 01795 } 01796 if (material == NULL) 01797 { 01798 fprintf (stderr, 01799 (_("Error in %s () a NULL pointer was passed.\n")), 01800 __FUNCTION__); 01801 return (NULL); 01802 } 01803 lwpolyline->material = strdup (material); 01804 #if DEBUG 01805 DXF_DEBUG_END 01806 #endif 01807 return (lwpolyline); 01808 } 01809 01810 01819 char * 01820 dxf_lwpolyline_get_dictionary_owner_hard 01821 ( 01822 DxfLWPolyline *lwpolyline 01824 ) 01825 { 01826 #if DEBUG 01827 DXF_DEBUG_BEGIN 01828 #endif 01829 /* Do some basic checks. */ 01830 if (lwpolyline == NULL) 01831 { 01832 fprintf (stderr, 01833 (_("Error in %s () a NULL pointer was passed.\n")), 01834 __FUNCTION__); 01835 return (NULL); 01836 } 01837 if (lwpolyline->dictionary_owner_hard == NULL) 01838 { 01839 fprintf (stderr, 01840 (_("Error in %s () a NULL pointer was found.\n")), 01841 __FUNCTION__); 01842 return (NULL); 01843 } 01844 #if DEBUG 01845 DXF_DEBUG_END 01846 #endif 01847 return (strdup (lwpolyline->dictionary_owner_hard)); 01848 } 01849 01850 01855 DxfLWPolyline * 01856 dxf_lwpolyline_set_dictionary_owner_hard 01857 ( 01858 DxfLWPolyline *lwpolyline, 01860 char *dictionary_owner_hard 01863 ) 01864 { 01865 #if DEBUG 01866 DXF_DEBUG_BEGIN 01867 #endif 01868 /* Do some basic checks. */ 01869 if (lwpolyline == NULL) 01870 { 01871 fprintf (stderr, 01872 (_("Error in %s () a NULL pointer was passed.\n")), 01873 __FUNCTION__); 01874 return (NULL); 01875 } 01876 if (dictionary_owner_hard == NULL) 01877 { 01878 fprintf (stderr, 01879 (_("Error in %s () a NULL pointer was passed.\n")), 01880 __FUNCTION__); 01881 return (NULL); 01882 } 01883 lwpolyline->dictionary_owner_hard = strdup (dictionary_owner_hard); 01884 #if DEBUG 01885 DXF_DEBUG_END 01886 #endif 01887 return (lwpolyline); 01888 } 01889 01890 01897 int16_t 01898 dxf_lwpolyline_get_lineweight 01899 ( 01900 DxfLWPolyline *lwpolyline 01902 ) 01903 { 01904 #if DEBUG 01905 DXF_DEBUG_BEGIN 01906 #endif 01907 /* Do some basic checks. */ 01908 if (lwpolyline == NULL) 01909 { 01910 fprintf (stderr, 01911 (_("Error in %s () a NULL pointer was passed.\n")), 01912 __FUNCTION__); 01913 return (EXIT_FAILURE); 01914 } 01915 #if DEBUG 01916 DXF_DEBUG_END 01917 #endif 01918 return (lwpolyline->lineweight); 01919 } 01920 01921 01928 DxfLWPolyline * 01929 dxf_lwpolyline_set_lineweight 01930 ( 01931 DxfLWPolyline *lwpolyline, 01933 int16_t lineweight 01935 ) 01936 { 01937 #if DEBUG 01938 DXF_DEBUG_BEGIN 01939 #endif 01940 /* Do some basic checks. */ 01941 if (lwpolyline == NULL) 01942 { 01943 fprintf (stderr, 01944 (_("Error in %s () a NULL pointer was passed.\n")), 01945 __FUNCTION__); 01946 return (NULL); 01947 } 01948 lwpolyline->lineweight = lineweight; 01949 #if DEBUG 01950 DXF_DEBUG_END 01951 #endif 01952 return (lwpolyline); 01953 } 01954 01955 01962 char * 01963 dxf_lwpolyline_get_plot_style_name 01964 ( 01965 DxfLWPolyline *lwpolyline 01967 ) 01968 { 01969 #if DEBUG 01970 DXF_DEBUG_BEGIN 01971 #endif 01972 /* Do some basic checks. */ 01973 if (lwpolyline == NULL) 01974 { 01975 fprintf (stderr, 01976 (_("Error in %s () a NULL pointer was passed.\n")), 01977 __FUNCTION__); 01978 return (NULL); 01979 } 01980 if (lwpolyline->plot_style_name == NULL) 01981 { 01982 fprintf (stderr, 01983 (_("Error in %s () a NULL pointer was found.\n")), 01984 __FUNCTION__); 01985 return (NULL); 01986 } 01987 #if DEBUG 01988 DXF_DEBUG_END 01989 #endif 01990 return (strdup (lwpolyline->plot_style_name)); 01991 } 01992 01993 02000 DxfLWPolyline * 02001 dxf_lwpolyline_set_plot_style_name 02002 ( 02003 DxfLWPolyline *lwpolyline, 02005 char *plot_style_name 02008 ) 02009 { 02010 #if DEBUG 02011 DXF_DEBUG_BEGIN 02012 #endif 02013 /* Do some basic checks. */ 02014 if (lwpolyline == NULL) 02015 { 02016 fprintf (stderr, 02017 (_("Error in %s () a NULL pointer was passed.\n")), 02018 __FUNCTION__); 02019 return (NULL); 02020 } 02021 if (plot_style_name == NULL) 02022 { 02023 fprintf (stderr, 02024 (_("Error in %s () a NULL pointer was passed.\n")), 02025 __FUNCTION__); 02026 return (NULL); 02027 } 02028 lwpolyline->plot_style_name = strdup (plot_style_name); 02029 #if DEBUG 02030 DXF_DEBUG_END 02031 #endif 02032 return (lwpolyline); 02033 } 02034 02035 02042 long 02043 dxf_lwpolyline_get_color_value 02044 ( 02045 DxfLWPolyline *lwpolyline 02047 ) 02048 { 02049 #if DEBUG 02050 DXF_DEBUG_BEGIN 02051 #endif 02052 /* Do some basic checks. */ 02053 if (lwpolyline == NULL) 02054 { 02055 fprintf (stderr, 02056 (_("Error in %s () a NULL pointer was passed.\n")), 02057 __FUNCTION__); 02058 return (EXIT_FAILURE); 02059 } 02060 #if DEBUG 02061 DXF_DEBUG_END 02062 #endif 02063 return (lwpolyline->color_value); 02064 } 02065 02066 02073 DxfLWPolyline * 02074 dxf_lwpolyline_set_color_value 02075 ( 02076 DxfLWPolyline *lwpolyline, 02078 long color_value 02080 ) 02081 { 02082 #if DEBUG 02083 DXF_DEBUG_BEGIN 02084 #endif 02085 /* Do some basic checks. */ 02086 if (lwpolyline == NULL) 02087 { 02088 fprintf (stderr, 02089 (_("Error in %s () a NULL pointer was passed.\n")), 02090 __FUNCTION__); 02091 return (NULL); 02092 } 02093 lwpolyline->color_value = color_value; 02094 #if DEBUG 02095 DXF_DEBUG_END 02096 #endif 02097 return (lwpolyline); 02098 } 02099 02100 02107 char * 02108 dxf_lwpolyline_get_color_name 02109 ( 02110 DxfLWPolyline *lwpolyline 02112 ) 02113 { 02114 #if DEBUG 02115 DXF_DEBUG_BEGIN 02116 #endif 02117 /* Do some basic checks. */ 02118 if (lwpolyline == NULL) 02119 { 02120 fprintf (stderr, 02121 (_("Error in %s () a NULL pointer was passed.\n")), 02122 __FUNCTION__); 02123 return (NULL); 02124 } 02125 if (lwpolyline->color_name == NULL) 02126 { 02127 fprintf (stderr, 02128 (_("Error in %s () a NULL pointer was found.\n")), 02129 __FUNCTION__); 02130 return (NULL); 02131 } 02132 #if DEBUG 02133 DXF_DEBUG_END 02134 #endif 02135 return (strdup (lwpolyline->color_name)); 02136 } 02137 02138 02145 DxfLWPolyline * 02146 dxf_lwpolyline_set_color_name 02147 ( 02148 DxfLWPolyline *lwpolyline, 02150 char *color_name 02153 ) 02154 { 02155 #if DEBUG 02156 DXF_DEBUG_BEGIN 02157 #endif 02158 /* Do some basic checks. */ 02159 if (lwpolyline == NULL) 02160 { 02161 fprintf (stderr, 02162 (_("Error in %s () a NULL pointer was passed.\n")), 02163 __FUNCTION__); 02164 return (NULL); 02165 } 02166 if (color_name == NULL) 02167 { 02168 fprintf (stderr, 02169 (_("Error in %s () a NULL pointer was passed.\n")), 02170 __FUNCTION__); 02171 return (NULL); 02172 } 02173 lwpolyline->color_name = strdup (color_name); 02174 #if DEBUG 02175 DXF_DEBUG_END 02176 #endif 02177 return (lwpolyline); 02178 } 02179 02180 02187 long 02188 dxf_lwpolyline_get_transparency 02189 ( 02190 DxfLWPolyline *lwpolyline 02192 ) 02193 { 02194 #if DEBUG 02195 DXF_DEBUG_BEGIN 02196 #endif 02197 /* Do some basic checks. */ 02198 if (lwpolyline == NULL) 02199 { 02200 fprintf (stderr, 02201 (_("Error in %s () a NULL pointer was passed.\n")), 02202 __FUNCTION__); 02203 return (EXIT_FAILURE); 02204 } 02205 #if DEBUG 02206 DXF_DEBUG_END 02207 #endif 02208 return (lwpolyline->transparency); 02209 } 02210 02211 02218 DxfLWPolyline * 02219 dxf_lwpolyline_set_transparency 02220 ( 02221 DxfLWPolyline *lwpolyline, 02223 long transparency 02225 ) 02226 { 02227 #if DEBUG 02228 DXF_DEBUG_BEGIN 02229 #endif 02230 /* Do some basic checks. */ 02231 if (lwpolyline == NULL) 02232 { 02233 fprintf (stderr, 02234 (_("Error in %s () a NULL pointer was passed.\n")), 02235 __FUNCTION__); 02236 return (NULL); 02237 } 02238 lwpolyline->transparency = transparency; 02239 #if DEBUG 02240 DXF_DEBUG_END 02241 #endif 02242 return (lwpolyline); 02243 } 02244 02245 02251 double 02252 dxf_lwpolyline_get_constant_width 02253 ( 02254 DxfLWPolyline *lwpolyline 02256 ) 02257 { 02258 #ifdef DEBUG 02259 DXF_DEBUG_BEGIN 02260 #endif 02261 02262 /* Do some basic checks. */ 02263 if (lwpolyline == NULL) 02264 { 02265 fprintf (stderr, 02266 (_("Error in %s () a NULL pointer was passed.\n")), 02267 __FUNCTION__); 02268 return (EXIT_FAILURE); 02269 } 02270 if (lwpolyline->constant_width < 0.0) 02271 { 02272 fprintf (stderr, 02273 (_("Warning in %s () a negative value was found.\n")), 02274 __FUNCTION__); 02275 } 02276 #if DEBUG 02277 DXF_DEBUG_END 02278 #endif 02279 return (lwpolyline->constant_width); 02280 } 02281 02282 02290 DxfLWPolyline * 02291 dxf_lwpolyline_set_constant_width 02292 ( 02293 DxfLWPolyline *lwpolyline, 02295 double constant_width 02298 ) 02299 { 02300 #ifdef DEBUG 02301 DXF_DEBUG_BEGIN 02302 #endif 02303 /* Do some basic checks. */ 02304 if (lwpolyline == NULL) 02305 { 02306 fprintf (stderr, 02307 (_("Error in %s () a NULL pointer was passed.\n")), 02308 __FUNCTION__); 02309 return (NULL); 02310 } 02311 if (lwpolyline->constant_width < 0.0) 02312 { 02313 fprintf (stderr, 02314 (_("Warning in %s () a negative value was found.\n")), 02315 __FUNCTION__); 02316 } 02317 lwpolyline->constant_width = constant_width; 02318 #if DEBUG 02319 DXF_DEBUG_END 02320 #endif 02321 return (lwpolyline); 02322 } 02323 02324 02330 int 02331 dxf_lwpolyline_get_flag 02332 ( 02333 DxfLWPolyline *lwpolyline 02335 ) 02336 { 02337 #if DEBUG 02338 DXF_DEBUG_BEGIN 02339 #endif 02340 /* Do some basic checks. */ 02341 if (lwpolyline == NULL) 02342 { 02343 fprintf (stderr, 02344 (_("Error in %s () a NULL pointer was passed.\n")), 02345 __FUNCTION__); 02346 return (EXIT_FAILURE); 02347 } 02348 if (lwpolyline->flag < 0) 02349 { 02350 fprintf (stderr, 02351 (_("Error in %s () a negative value was found.\n")), 02352 __FUNCTION__); 02353 return (EXIT_FAILURE); 02354 } 02355 #if DEBUG 02356 DXF_DEBUG_END 02357 #endif 02358 return (lwpolyline->flag); 02359 } 02360 02361 02365 DxfLWPolyline * 02366 dxf_lwpolyline_set_flag 02367 ( 02368 DxfLWPolyline *lwpolyline, 02370 int flag 02372 ) 02373 { 02374 #if DEBUG 02375 DXF_DEBUG_BEGIN 02376 #endif 02377 /* Do some basic checks. */ 02378 if (lwpolyline == NULL) 02379 { 02380 fprintf (stderr, 02381 (_("Error in %s () a NULL pointer was passed.\n")), 02382 __FUNCTION__); 02383 return (NULL); 02384 } 02385 if (flag < 0) 02386 { 02387 fprintf (stderr, 02388 (_("Error in %s () a negative value was passed.\n")), 02389 __FUNCTION__); 02390 return (NULL); 02391 } 02392 lwpolyline->flag = flag; 02393 #if DEBUG 02394 DXF_DEBUG_END 02395 #endif 02396 return (lwpolyline); 02397 } 02398 02399 02405 int 02406 dxf_lwpolyline_get_number_vertices 02407 ( 02408 DxfLWPolyline *lwpolyline 02410 ) 02411 { 02412 #if DEBUG 02413 DXF_DEBUG_BEGIN 02414 #endif 02415 /* Do some basic checks. */ 02416 if (lwpolyline == NULL) 02417 { 02418 fprintf (stderr, 02419 (_("Error in %s () a NULL pointer was passed.\n")), 02420 __FUNCTION__); 02421 return (EXIT_FAILURE); 02422 } 02423 if (lwpolyline->number_vertices < 0) 02424 { 02425 fprintf (stderr, 02426 (_("Error in %s () a negative value was found.\n")), 02427 __FUNCTION__); 02428 return (EXIT_FAILURE); 02429 } 02430 #if DEBUG 02431 DXF_DEBUG_END 02432 #endif 02433 return (lwpolyline->number_vertices); 02434 } 02435 02436 02441 DxfLWPolyline * 02442 dxf_lwpolyline_set_number_vertices 02443 ( 02444 DxfLWPolyline *lwpolyline, 02446 int number_vertices 02448 ) 02449 { 02450 #if DEBUG 02451 DXF_DEBUG_BEGIN 02452 #endif 02453 /* Do some basic checks. */ 02454 if (lwpolyline == NULL) 02455 { 02456 fprintf (stderr, 02457 (_("Error in %s () a NULL pointer was passed.\n")), 02458 __FUNCTION__); 02459 return (NULL); 02460 } 02461 if (number_vertices < 0) 02462 { 02463 fprintf (stderr, 02464 (_("Error in %s () a negative value was passed.\n")), 02465 __FUNCTION__); 02466 return (NULL); 02467 } 02468 lwpolyline->number_vertices = number_vertices; 02469 #if DEBUG 02470 DXF_DEBUG_END 02471 #endif 02472 return (lwpolyline); 02473 } 02474 02475 02482 double 02483 dxf_lwpolyline_get_extr_x0 02484 ( 02485 DxfLWPolyline *lwpolyline 02487 ) 02488 { 02489 #ifdef DEBUG 02490 DXF_DEBUG_BEGIN 02491 #endif 02492 02493 /* Do some basic checks. */ 02494 if (lwpolyline == NULL) 02495 { 02496 fprintf (stderr, 02497 (_("Error in %s () a NULL pointer was passed.\n")), 02498 __FUNCTION__); 02499 return (EXIT_FAILURE); 02500 } 02501 #if DEBUG 02502 DXF_DEBUG_END 02503 #endif 02504 return (lwpolyline->extr_x0); 02505 } 02506 02507 02515 DxfLWPolyline * 02516 dxf_lwpolyline_set_extr_x0 02517 ( 02518 DxfLWPolyline *lwpolyline, 02520 double extr_x0 02523 ) 02524 { 02525 #ifdef DEBUG 02526 DXF_DEBUG_BEGIN 02527 #endif 02528 /* Do some basic checks. */ 02529 if (lwpolyline == NULL) 02530 { 02531 fprintf (stderr, 02532 (_("Error in %s () a NULL pointer was passed.\n")), 02533 __FUNCTION__); 02534 return (NULL); 02535 } 02536 lwpolyline->extr_x0 = extr_x0; 02537 #if DEBUG 02538 DXF_DEBUG_END 02539 #endif 02540 return (lwpolyline); 02541 } 02542 02543 02550 double 02551 dxf_lwpolyline_get_extr_y0 02552 ( 02553 DxfLWPolyline *lwpolyline 02555 ) 02556 { 02557 #ifdef DEBUG 02558 DXF_DEBUG_BEGIN 02559 #endif 02560 02561 /* Do some basic checks. */ 02562 if (lwpolyline == NULL) 02563 { 02564 fprintf (stderr, 02565 (_("Error in %s () a NULL pointer was passed.\n")), 02566 __FUNCTION__); 02567 return (EXIT_FAILURE); 02568 } 02569 #if DEBUG 02570 DXF_DEBUG_END 02571 #endif 02572 return (lwpolyline->extr_y0); 02573 } 02574 02575 02583 DxfLWPolyline * 02584 dxf_lwpolyline_set_extr_y0 02585 ( 02586 DxfLWPolyline *lwpolyline, 02588 double extr_y0 02591 ) 02592 { 02593 #ifdef DEBUG 02594 DXF_DEBUG_BEGIN 02595 #endif 02596 /* Do some basic checks. */ 02597 if (lwpolyline == NULL) 02598 { 02599 fprintf (stderr, 02600 (_("Error in %s () a NULL pointer was passed.\n")), 02601 __FUNCTION__); 02602 return (NULL); 02603 } 02604 lwpolyline->extr_y0 = extr_y0; 02605 #if DEBUG 02606 DXF_DEBUG_END 02607 #endif 02608 return (lwpolyline); 02609 } 02610 02611 02618 double 02619 dxf_lwpolyline_get_extr_z0 02620 ( 02621 DxfLWPolyline *lwpolyline 02623 ) 02624 { 02625 #ifdef DEBUG 02626 DXF_DEBUG_BEGIN 02627 #endif 02628 02629 /* Do some basic checks. */ 02630 if (lwpolyline == NULL) 02631 { 02632 fprintf (stderr, 02633 (_("Error in %s () a NULL pointer was passed.\n")), 02634 __FUNCTION__); 02635 return (EXIT_FAILURE); 02636 } 02637 #if DEBUG 02638 DXF_DEBUG_END 02639 #endif 02640 return (lwpolyline->extr_z0); 02641 } 02642 02643 02651 DxfLWPolyline * 02652 dxf_lwpolyline_set_extr_z0 02653 ( 02654 DxfLWPolyline *lwpolyline, 02656 double extr_z0 02659 ) 02660 { 02661 #ifdef DEBUG 02662 DXF_DEBUG_BEGIN 02663 #endif 02664 /* Do some basic checks. */ 02665 if (lwpolyline == NULL) 02666 { 02667 fprintf (stderr, 02668 (_("Error in %s () a NULL pointer was passed.\n")), 02669 __FUNCTION__); 02670 return (NULL); 02671 } 02672 lwpolyline->extr_z0 = extr_z0; 02673 #if DEBUG 02674 DXF_DEBUG_END 02675 #endif 02676 return (lwpolyline); 02677 } 02678 02679 02688 DxfVertex * 02689 dxf_lwpolyline_get_vertices 02690 ( 02691 DxfLWPolyline *lwpolyline 02693 ) 02694 { 02695 #if DEBUG 02696 DXF_DEBUG_BEGIN 02697 #endif 02698 /* Do some basic checks. */ 02699 if (lwpolyline == NULL) 02700 { 02701 fprintf (stderr, 02702 (_("Error in %s () a NULL pointer was passed.\n")), 02703 __FUNCTION__); 02704 return (NULL); 02705 } 02706 if (lwpolyline->vertices == NULL) 02707 { 02708 fprintf (stderr, 02709 (_("Error in %s () a NULL pointer was found in the vertices member.\n")), 02710 __FUNCTION__); 02711 return (NULL); 02712 } 02713 #if DEBUG 02714 DXF_DEBUG_END 02715 #endif 02716 return ((DxfVertex *) lwpolyline->vertices); 02717 } 02718 02719 02724 DxfLWPolyline * 02725 dxf_lwpolyline_set_vertices 02726 ( 02727 DxfLWPolyline *lwpolyline, 02729 DxfVertex *vertices 02732 ) 02733 { 02734 #if DEBUG 02735 DXF_DEBUG_BEGIN 02736 #endif 02737 /* Do some basic checks. */ 02738 if (lwpolyline == NULL) 02739 { 02740 fprintf (stderr, 02741 (_("Error in %s () a NULL pointer was passed.\n")), 02742 __FUNCTION__); 02743 return (NULL); 02744 } 02745 if (vertices == NULL) 02746 { 02747 fprintf (stderr, 02748 (_("Error in %s () a NULL pointer was passed.\n")), 02749 __FUNCTION__); 02750 return (NULL); 02751 } 02752 lwpolyline->vertices = (struct DxfVertex *) vertices; 02753 #if DEBUG 02754 DXF_DEBUG_END 02755 #endif 02756 return (lwpolyline); 02757 } 02758 02759 02768 DxfLWPolyline * 02769 dxf_lwpolyline_get_next 02770 ( 02771 DxfLWPolyline *lwpolyline 02773 ) 02774 { 02775 #if DEBUG 02776 DXF_DEBUG_BEGIN 02777 #endif 02778 /* Do some basic checks. */ 02779 if (lwpolyline == NULL) 02780 { 02781 fprintf (stderr, 02782 (_("Error in %s () a NULL pointer was passed.\n")), 02783 __FUNCTION__); 02784 return (NULL); 02785 } 02786 if (lwpolyline->next == NULL) 02787 { 02788 fprintf (stderr, 02789 (_("Error in %s () a NULL pointer was found in the next member.\n")), 02790 __FUNCTION__); 02791 return (NULL); 02792 } 02793 #if DEBUG 02794 DXF_DEBUG_END 02795 #endif 02796 return ((DxfLWPolyline *) lwpolyline->next); 02797 } 02798 02799 02804 DxfLWPolyline * 02805 dxf_lwpolyline_set_next 02806 ( 02807 DxfLWPolyline *lwpolyline, 02809 DxfLWPolyline *next 02811 ) 02812 { 02813 #if DEBUG 02814 DXF_DEBUG_BEGIN 02815 #endif 02816 /* Do some basic checks. */ 02817 if (lwpolyline == NULL) 02818 { 02819 fprintf (stderr, 02820 (_("Error in %s () a NULL pointer was passed.\n")), 02821 __FUNCTION__); 02822 return (NULL); 02823 } 02824 if (next == NULL) 02825 { 02826 fprintf (stderr, 02827 (_("Error in %s () a NULL pointer was passed.\n")), 02828 __FUNCTION__); 02829 return (NULL); 02830 } 02831 lwpolyline->next = (struct DxfLWPolyline *) next; 02832 #if DEBUG 02833 DXF_DEBUG_END 02834 #endif 02835 return (lwpolyline); 02836 } 02837 02838 02847 DxfLWPolyline * 02848 dxf_lwpolyline_get_last 02849 ( 02850 DxfLWPolyline *lwpolyline 02852 ) 02853 { 02854 #if DEBUG 02855 DXF_DEBUG_BEGIN 02856 #endif 02857 /* Do some basic checks. */ 02858 if (lwpolyline == NULL) 02859 { 02860 fprintf (stderr, 02861 (_("Error in %s () a NULL pointer was passed.\n")), 02862 __FUNCTION__); 02863 return (NULL); 02864 } 02865 if (lwpolyline->next == NULL) 02866 { 02867 fprintf (stderr, 02868 (_("Warning in %s () a NULL pointer was found.\n")), 02869 __FUNCTION__); 02870 return ((DxfLWPolyline *) lwpolyline); 02871 } 02872 DxfLWPolyline *iter = (DxfLWPolyline *) lwpolyline->next; 02873 while (iter->next != NULL) 02874 { 02875 iter = (DxfLWPolyline *) iter->next; 02876 } 02877 #if DEBUG 02878 DXF_DEBUG_END 02879 #endif 02880 return ((DxfLWPolyline *) iter); 02881 } 02882 02883 02884 /* EOF */