libDXF 0.0.1
A library with DXF related functions written in C.
|
00001 00044 #include "region.h" 00045 00046 00052 DxfRegion * 00053 dxf_region_new () 00054 { 00055 #if DEBUG 00056 DXF_DEBUG_BEGIN 00057 #endif 00058 DxfRegion *region = NULL; 00059 size_t size; 00060 00061 size = sizeof (DxfRegion); 00062 /* avoid malloc of 0 bytes */ 00063 if (size == 0) size = 1; 00064 if ((region = malloc (size)) == NULL) 00065 { 00066 fprintf (stderr, 00067 (_("Error in %s () could not allocate memory for a DxfRegion struct.\n")), 00068 __FUNCTION__); 00069 region = NULL; 00070 } 00071 else 00072 { 00073 memset (region, 0, size); 00074 } 00075 #if DEBUG 00076 DXF_DEBUG_END 00077 #endif 00078 return (region); 00079 } 00080 00081 00089 DxfRegion * 00090 dxf_region_init 00091 ( 00092 DxfRegion *region 00094 ) 00095 { 00096 #if DEBUG 00097 DXF_DEBUG_BEGIN 00098 #endif 00099 /* Do some basic checks. */ 00100 if (region == NULL) 00101 { 00102 fprintf (stderr, 00103 (_("Warning in %s () a NULL pointer was passed.\n")), 00104 __FUNCTION__); 00105 region = dxf_region_new (); 00106 } 00107 if (region == NULL) 00108 { 00109 fprintf (stderr, 00110 (_("Error in %s () could not allocate memory for a DxfRegion struct.\n")), 00111 __FUNCTION__); 00112 return (NULL); 00113 } 00114 region->modeler_format_version_number = 0; 00115 region->id_code = 0; 00116 region->linetype = strdup (DXF_DEFAULT_LINETYPE); 00117 region->layer = strdup (DXF_DEFAULT_LAYER); 00118 region->elevation = 0.0; 00119 region->thickness = 0.0; 00120 region->linetype_scale = DXF_DEFAULT_LINETYPE_SCALE; 00121 region->visibility = DXF_DEFAULT_VISIBILITY; 00122 region->color = DXF_COLOR_BYLAYER; 00123 region->paperspace = DXF_MODELSPACE; 00124 region->modeler_format_version_number = 1; 00125 dxf_char_new (region->proprietary_data); 00126 region->proprietary_data = dxf_char_init (region->proprietary_data); 00127 region->proprietary_data->value = strdup (""); 00128 region->proprietary_data->length = 0; 00129 region->proprietary_data->next = NULL; 00130 dxf_char_new (region->additional_proprietary_data); 00131 region->additional_proprietary_data = dxf_char_init (region->additional_proprietary_data); 00132 region->additional_proprietary_data->value = strdup (""); 00133 region->additional_proprietary_data->length = 0; 00134 region->additional_proprietary_data->next = NULL; 00135 region->dictionary_owner_soft = strdup (""); 00136 region->dictionary_owner_hard = strdup (""); 00137 region->next = NULL; 00138 #if DEBUG 00139 DXF_DEBUG_END 00140 #endif 00141 return (region); 00142 } 00143 00144 00157 DxfRegion * 00158 dxf_region_read 00159 ( 00160 DxfFile *fp, 00162 DxfRegion *region 00164 ) 00165 { 00166 #if DEBUG 00167 DXF_DEBUG_BEGIN 00168 #endif 00169 char *temp_string = NULL; 00170 DxfChar *iter1 = NULL; 00171 DxfChar *iter2 = NULL; 00172 00173 /* Do some basic checks. */ 00174 if (fp == NULL) 00175 { 00176 fprintf (stderr, 00177 (_("Error in %s () a NULL file pointer was passed.\n")), 00178 __FUNCTION__); 00179 /* Clean up. */ 00180 free (temp_string); 00181 return (NULL); 00182 } 00183 if (region == NULL) 00184 { 00185 fprintf (stderr, 00186 (_("Warning in %s () a NULL pointer was passed.\n")), 00187 __FUNCTION__); 00188 region = dxf_region_new (); 00189 region = dxf_region_init (region); 00190 } 00191 iter1 = (DxfChar *) region->proprietary_data; 00192 iter2 = (DxfChar *) region->additional_proprietary_data; 00193 (fp->line_number)++; 00194 fscanf (fp->fp, "%[^\n]", temp_string); 00195 while (strcmp (temp_string, "0") != 0) 00196 { 00197 if (ferror (fp->fp)) 00198 { 00199 fprintf (stderr, 00200 (_("Error in %s () while reading from: %s in line: %d.\n")), 00201 __FUNCTION__, fp->filename, fp->line_number); 00202 fclose (fp->fp); 00203 /* Clean up. */ 00204 free (temp_string); 00205 return (NULL); 00206 } 00207 else if (strcmp (temp_string, " 1") == 0) 00208 { 00209 /* Now follows a string containing proprietary 00210 * data. */ 00211 (fp->line_number)++; 00212 fscanf (fp->fp, "%s\n", iter1->value); 00213 iter1->next = (struct DxfChar *) dxf_char_init ((DxfChar *) iter1->next); 00214 iter1 = (DxfChar *) iter1->next; 00215 } 00216 else if (strcmp (temp_string, " 3") == 0) 00217 { 00218 /* Now follows a string containing additional 00219 * proprietary data. */ 00220 (fp->line_number)++; 00221 fscanf (fp->fp, "%s\n", iter2->value); 00222 iter2->next = (struct DxfChar *) dxf_char_init ((DxfChar *) iter2->next); 00223 iter2 = (DxfChar *) iter2->next; 00224 } 00225 if (strcmp (temp_string, "5") == 0) 00226 { 00227 /* Now follows a string containing a sequential 00228 * id number. */ 00229 (fp->line_number)++; 00230 fscanf (fp->fp, "%x\n", ®ion->id_code); 00231 } 00232 else if (strcmp (temp_string, "6") == 0) 00233 { 00234 /* Now follows a string containing a linetype 00235 * name. */ 00236 (fp->line_number)++; 00237 fscanf (fp->fp, "%s\n", region->linetype); 00238 } 00239 else if (strcmp (temp_string, "8") == 0) 00240 { 00241 /* Now follows a string containing a layer name. */ 00242 (fp->line_number)++; 00243 fscanf (fp->fp, "%s\n", region->layer); 00244 } 00245 else if ((fp->acad_version_number <= AutoCAD_11) 00246 && (strcmp (temp_string, "38") == 0) 00247 && (region->elevation != 0.0)) 00248 { 00249 /* Now follows a string containing the 00250 * elevation. */ 00251 (fp->line_number)++; 00252 fscanf (fp->fp, "%lf\n", ®ion->elevation); 00253 } 00254 else if (strcmp (temp_string, "39") == 0) 00255 { 00256 /* Now follows a string containing the 00257 * thickness. */ 00258 (fp->line_number)++; 00259 fscanf (fp->fp, "%lf\n", ®ion->thickness); 00260 } 00261 else if (strcmp (temp_string, "48") == 0) 00262 { 00263 /* Now follows a string containing the linetype 00264 * scale. */ 00265 (fp->line_number)++; 00266 fscanf (fp->fp, "%lf\n", ®ion->linetype_scale); 00267 } 00268 else if (strcmp (temp_string, "60") == 0) 00269 { 00270 /* Now follows a string containing the 00271 * visibility value. */ 00272 (fp->line_number)++; 00273 fscanf (fp->fp, "%hd\n", ®ion->visibility); 00274 } 00275 else if (strcmp (temp_string, "62") == 0) 00276 { 00277 /* Now follows a string containing the 00278 * color value. */ 00279 (fp->line_number)++; 00280 fscanf (fp->fp, "%d\n", ®ion->color); 00281 } 00282 else if (strcmp (temp_string, "67") == 0) 00283 { 00284 /* Now follows a string containing the 00285 * paperspace value. */ 00286 (fp->line_number)++; 00287 fscanf (fp->fp, "%d\n", ®ion->paperspace); 00288 } 00289 else if ((fp->acad_version_number >= AutoCAD_13) 00290 && (strcmp (temp_string, "70") == 0)) 00291 { 00292 /* Now follows a string containing the modeler 00293 * format version number. */ 00294 (fp->line_number)++; 00295 fscanf (fp->fp, "%d\n", ®ion->modeler_format_version_number); 00296 } 00297 else if ((fp->acad_version_number >= AutoCAD_13) 00298 && (strcmp (temp_string, "100") == 0)) 00299 { 00300 /* Now follows a string containing the 00301 * subclass marker value. */ 00302 (fp->line_number)++; 00303 fscanf (fp->fp, "%s\n", temp_string); 00304 if (strcmp (temp_string, "AcDbModelerGeometry") != 0) 00305 { 00306 fprintf (stderr, "Error in dxf_region_read () found a bad subclass marker in: %s in line: %d.\n", 00307 fp->filename, fp->line_number); 00308 } 00309 } 00310 else if (strcmp (temp_string, "330") == 0) 00311 { 00312 /* Now follows a string containing Soft-pointer 00313 * ID/handle to owner dictionary. */ 00314 (fp->line_number)++; 00315 fscanf (fp->fp, "%s\n", region->dictionary_owner_soft); 00316 } 00317 else if (strcmp (temp_string, "360") == 0) 00318 { 00319 /* Now follows a string containing Hard owner 00320 * ID/handle to owner dictionary. */ 00321 (fp->line_number)++; 00322 fscanf (fp->fp, "%s\n", region->dictionary_owner_hard); 00323 } 00324 else if (strcmp (temp_string, "999") == 0) 00325 { 00326 /* Now follows a string containing a comment. */ 00327 (fp->line_number)++; 00328 fscanf (fp->fp, "%s\n", temp_string); 00329 fprintf (stdout, "DXF comment: %s\n", temp_string); 00330 } 00331 else 00332 { 00333 fprintf (stderr, 00334 (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")), 00335 __FUNCTION__, fp->filename, fp->line_number); 00336 } 00337 } 00338 /* Handle omitted members and/or illegal values. */ 00339 if (strcmp (region->linetype, "") == 0) 00340 { 00341 region->linetype = strdup (DXF_DEFAULT_LINETYPE); 00342 } 00343 if (strcmp (region->layer, "") == 0) 00344 { 00345 region->layer = strdup (DXF_DEFAULT_LAYER); 00346 } 00347 /* Clean up. */ 00348 free (temp_string); 00349 #if DEBUG 00350 DXF_DEBUG_END 00351 #endif 00352 return (region); 00353 } 00354 00355 00362 int 00363 dxf_region_write 00364 ( 00365 DxfFile *fp, 00367 DxfRegion *region 00369 ) 00370 { 00371 #if DEBUG 00372 DXF_DEBUG_BEGIN 00373 #endif 00374 char *dxf_entity_name = strdup ("REGION"); 00375 DxfChar *iter1 = NULL; 00376 DxfChar *iter2 = NULL; 00377 00378 /* Do some basic checks. */ 00379 if (fp == NULL) 00380 { 00381 fprintf (stderr, 00382 (_("Error in %s () a NULL file pointer was passed.\n")), 00383 __FUNCTION__); 00384 /* Clean up. */ 00385 free (dxf_entity_name); 00386 return (EXIT_FAILURE); 00387 } 00388 if (region == NULL) 00389 { 00390 fprintf (stderr, 00391 (_("Error in %s () a NULL pointer was passed.\n")), 00392 __FUNCTION__); 00393 /* Clean up. */ 00394 free (dxf_entity_name); 00395 return (EXIT_FAILURE); 00396 } 00397 if (fp->acad_version_number < AutoCAD_13) 00398 { 00399 fprintf (stderr, 00400 (_("Warning in %s () illegal DXF version for this %s entity with id-code: %x.\n")), 00401 __FUNCTION__, dxf_entity_name, region->id_code); 00402 } 00403 if (strcmp (region->linetype, "") == 0) 00404 { 00405 fprintf (stderr, 00406 (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")), 00407 __FUNCTION__, dxf_entity_name, region->id_code); 00408 fprintf (stderr, 00409 (_("\t%s entity is reset to default linetype")), 00410 dxf_entity_name); 00411 region->linetype = strdup (DXF_DEFAULT_LINETYPE); 00412 } 00413 if (strcmp (region->layer, "") == 0) 00414 { 00415 fprintf (stderr, 00416 (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")), 00417 __FUNCTION__, dxf_entity_name, region->id_code); 00418 fprintf (stderr, 00419 (_("\t%s entity is relocated to layer 0")), 00420 dxf_entity_name); 00421 region->layer = strdup (DXF_DEFAULT_LAYER); 00422 } 00423 /* Start writing output. */ 00424 fprintf (fp->fp, " 0\n%s\n", dxf_entity_name); 00425 if (region->id_code != -1) 00426 { 00427 fprintf (fp->fp, " 5\n%x\n", region->id_code); 00428 } 00439 if ((strcmp (region->dictionary_owner_soft, "") != 0) 00440 && (fp->acad_version_number >= AutoCAD_14)) 00441 { 00442 fprintf (fp->fp, "102\n{ACAD_REACTORS\n"); 00443 fprintf (fp->fp, "330\n%s\n", region->dictionary_owner_soft); 00444 fprintf (fp->fp, "102\n}\n"); 00445 } 00446 if ((strcmp (region->dictionary_owner_hard, "") != 0) 00447 && (fp->acad_version_number >= AutoCAD_14)) 00448 { 00449 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n"); 00450 fprintf (fp->fp, "360\n%s\n", region->dictionary_owner_hard); 00451 fprintf (fp->fp, "102\n}\n"); 00452 } 00453 if (fp->acad_version_number >= AutoCAD_13) 00454 { 00455 fprintf (fp->fp, "100\nAcDbEntity\n"); 00456 } 00457 if (region->paperspace == DXF_PAPERSPACE) 00458 { 00459 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE); 00460 } 00461 fprintf (fp->fp, " 8\n%s\n", region->layer); 00462 if (strcmp (region->linetype, DXF_DEFAULT_LINETYPE) != 0) 00463 { 00464 fprintf (fp->fp, " 6\n%s\n", region->linetype); 00465 } 00466 if ((fp->acad_version_number <= AutoCAD_11) 00467 && DXF_FLATLAND 00468 && (region->elevation != 0.0)) 00469 { 00470 fprintf (fp->fp, " 38\n%f\n", region->elevation); 00471 } 00472 if (region->color != DXF_COLOR_BYLAYER) 00473 { 00474 fprintf (fp->fp, " 62\n%d\n", region->color); 00475 } 00476 if (region->linetype_scale != 1.0) 00477 { 00478 fprintf (fp->fp, " 48\n%f\n", region->linetype_scale); 00479 } 00480 if (region->visibility != 0) 00481 { 00482 fprintf (fp->fp, " 60\n%d\n", region->visibility); 00483 } 00484 if (fp->acad_version_number >= AutoCAD_13) 00485 { 00486 fprintf (fp->fp, "100\nAcDbModelerGeometry\n"); 00487 } 00488 if (region->thickness != 0.0) 00489 { 00490 fprintf (fp->fp, " 39\n%f\n", region->thickness); 00491 } 00492 if (fp->acad_version_number >= AutoCAD_13) 00493 { 00494 fprintf (fp->fp, " 70\n%d\n", region->modeler_format_version_number); 00495 } 00496 if (region->proprietary_data != NULL) 00497 { 00498 iter1 = (DxfChar*) region->proprietary_data; 00499 while ((iter1 != NULL) && (iter1->value != NULL)) 00500 { 00501 fprintf (fp->fp, " 1\n%s\n", iter1->value); 00502 iter1 = (DxfChar*) iter1->next; 00503 } 00504 } 00505 else 00506 { 00507 fprintf (fp->fp, " 1\n\n"); 00508 } 00509 if (region->additional_proprietary_data != NULL) 00510 { 00511 iter2 = (DxfChar*) region->additional_proprietary_data; 00512 while ((iter2 != NULL) && (iter2->value != NULL)) 00513 { 00514 fprintf (fp->fp, " 3\n%s\n", iter2->value); 00515 iter2 = (DxfChar*) iter2->next; 00516 } 00517 } 00518 else 00519 { 00520 fprintf (fp->fp, " 3\n\n"); 00521 } 00522 /* Clean up. */ 00523 free (dxf_entity_name); 00524 #if DEBUG 00525 DXF_DEBUG_END 00526 #endif 00527 return (EXIT_SUCCESS); 00528 } 00529 00530 00538 int 00539 dxf_region_free 00540 ( 00541 DxfRegion *region 00544 ) 00545 { 00546 #if DEBUG 00547 DXF_DEBUG_BEGIN 00548 #endif 00549 /* Do some basic checks. */ 00550 if (region == NULL) 00551 { 00552 fprintf (stderr, 00553 (_("Error in %s () a NULL pointer was passed.\n")), 00554 __FUNCTION__); 00555 return (EXIT_FAILURE); 00556 } 00557 if (region->next != NULL) 00558 { 00559 fprintf (stderr, 00560 (_("Error in %s () pointer to next was not NULL.\n")), 00561 __FUNCTION__); 00562 return (EXIT_FAILURE); 00563 } 00564 free (region->linetype); 00565 free (region->layer); 00566 dxf_binary_graphics_data_free (region->binary_graphics_data); 00567 free (region->dictionary_owner_soft); 00568 free (region->material); 00569 free (region->dictionary_owner_hard); 00570 free (region->plot_style_name); 00571 free (region->color_name); 00572 dxf_char_free_chain (region->proprietary_data); 00573 dxf_char_free_chain (region->additional_proprietary_data); 00574 free (region); 00575 region = NULL; 00576 #if DEBUG 00577 DXF_DEBUG_END 00578 #endif 00579 return (EXIT_SUCCESS); 00580 } 00581 00582 00587 void 00588 dxf_region_free_chain 00589 ( 00590 DxfRegion *regions 00592 ) 00593 { 00594 #ifdef DEBUG 00595 DXF_DEBUG_BEGIN 00596 #endif 00597 if (regions == NULL) 00598 { 00599 fprintf (stderr, 00600 (_("Warning in %s () a NULL pointer was passed.\n")), 00601 __FUNCTION__); 00602 } 00603 while (regions != NULL) 00604 { 00605 struct DxfRegion *iter = regions->next; 00606 dxf_region_free (regions); 00607 regions = (DxfRegion *) iter; 00608 } 00609 #if DEBUG 00610 DXF_DEBUG_END 00611 #endif 00612 } 00613 00614 00620 int 00621 dxf_region_get_id_code 00622 ( 00623 DxfRegion *region 00625 ) 00626 { 00627 #if DEBUG 00628 DXF_DEBUG_BEGIN 00629 #endif 00630 /* Do some basic checks. */ 00631 if (region == NULL) 00632 { 00633 fprintf (stderr, 00634 (_("Error in %s () a NULL pointer was passed.\n")), 00635 __FUNCTION__); 00636 return (EXIT_FAILURE); 00637 } 00638 if (region->id_code < 0) 00639 { 00640 fprintf (stderr, 00641 (_("Warning in %s () a negative value was found.\n")), 00642 __FUNCTION__); 00643 } 00644 #if DEBUG 00645 DXF_DEBUG_END 00646 #endif 00647 return (region->id_code); 00648 } 00649 00650 00654 DxfRegion * 00655 dxf_region_set_id_code 00656 ( 00657 DxfRegion *region, 00659 int id_code 00663 ) 00664 { 00665 #if DEBUG 00666 DXF_DEBUG_BEGIN 00667 #endif 00668 /* Do some basic checks. */ 00669 if (region == NULL) 00670 { 00671 fprintf (stderr, 00672 (_("Error in %s () a NULL pointer was passed.\n")), 00673 __FUNCTION__); 00674 return (NULL); 00675 } 00676 if (id_code < 0) 00677 { 00678 fprintf (stderr, 00679 (_("Warning in %s () a negative value was passed.\n")), 00680 __FUNCTION__); 00681 } 00682 region->id_code = id_code; 00683 #if DEBUG 00684 DXF_DEBUG_END 00685 #endif 00686 return (region); 00687 } 00688 00689 00695 char * 00696 dxf_region_get_linetype 00697 ( 00698 DxfRegion *region 00700 ) 00701 { 00702 #if DEBUG 00703 DXF_DEBUG_BEGIN 00704 #endif 00705 /* Do some basic checks. */ 00706 if (region == NULL) 00707 { 00708 fprintf (stderr, 00709 (_("Error in %s () a NULL pointer was passed.\n")), 00710 __FUNCTION__); 00711 return (NULL); 00712 } 00713 if (region->linetype == NULL) 00714 { 00715 fprintf (stderr, 00716 (_("Error in %s () a NULL pointer was found.\n")), 00717 __FUNCTION__); 00718 return (NULL); 00719 } 00720 #if DEBUG 00721 DXF_DEBUG_END 00722 #endif 00723 return (strdup (region->linetype)); 00724 } 00725 00726 00730 DxfRegion * 00731 dxf_region_set_linetype 00732 ( 00733 DxfRegion *region, 00735 char *linetype 00738 ) 00739 { 00740 #if DEBUG 00741 DXF_DEBUG_BEGIN 00742 #endif 00743 /* Do some basic checks. */ 00744 if (region == NULL) 00745 { 00746 fprintf (stderr, 00747 (_("Error in %s () a NULL pointer was passed.\n")), 00748 __FUNCTION__); 00749 return (NULL); 00750 } 00751 if (linetype == NULL) 00752 { 00753 fprintf (stderr, 00754 (_("Error in %s () a NULL pointer was passed.\n")), 00755 __FUNCTION__); 00756 return (NULL); 00757 } 00758 region->linetype = strdup (linetype); 00759 #if DEBUG 00760 DXF_DEBUG_END 00761 #endif 00762 return (region); 00763 } 00764 00765 00771 char * 00772 dxf_region_get_layer 00773 ( 00774 DxfRegion *region 00776 ) 00777 { 00778 #if DEBUG 00779 DXF_DEBUG_BEGIN 00780 #endif 00781 /* Do some basic checks. */ 00782 if (region == NULL) 00783 { 00784 fprintf (stderr, 00785 (_("Error in %s () a NULL pointer was passed.\n")), 00786 __FUNCTION__); 00787 return (NULL); 00788 } 00789 if (region->layer == NULL) 00790 { 00791 fprintf (stderr, 00792 (_("Error in %s () a NULL pointer was found.\n")), 00793 __FUNCTION__); 00794 return (NULL); 00795 } 00796 #if DEBUG 00797 DXF_DEBUG_END 00798 #endif 00799 return (strdup (region->layer)); 00800 } 00801 00802 00806 DxfRegion * 00807 dxf_region_set_layer 00808 ( 00809 DxfRegion *region, 00811 char *layer 00814 ) 00815 { 00816 #if DEBUG 00817 DXF_DEBUG_BEGIN 00818 #endif 00819 /* Do some basic checks. */ 00820 if (region == NULL) 00821 { 00822 fprintf (stderr, 00823 (_("Error in %s () a NULL pointer was passed.\n")), 00824 __FUNCTION__); 00825 return (NULL); 00826 } 00827 if (layer == NULL) 00828 { 00829 fprintf (stderr, 00830 (_("Error in %s () a NULL pointer was passed.\n")), 00831 __FUNCTION__); 00832 return (NULL); 00833 } 00834 region->layer = strdup (layer); 00835 #if DEBUG 00836 DXF_DEBUG_END 00837 #endif 00838 return (region); 00839 } 00840 00841 00847 double 00848 dxf_region_get_elevation 00849 ( 00850 DxfRegion *region 00852 ) 00853 { 00854 #if DEBUG 00855 DXF_DEBUG_BEGIN 00856 #endif 00857 /* Do some basic checks. */ 00858 if (region == NULL) 00859 { 00860 fprintf (stderr, 00861 (_("Error in %s () a NULL pointer was passed.\n")), 00862 __FUNCTION__); 00863 return (EXIT_FAILURE); 00864 } 00865 #if DEBUG 00866 DXF_DEBUG_END 00867 #endif 00868 return (region->elevation); 00869 } 00870 00871 00875 DxfRegion * 00876 dxf_region_set_elevation 00877 ( 00878 DxfRegion *region, 00880 double elevation 00882 ) 00883 { 00884 #if DEBUG 00885 DXF_DEBUG_BEGIN 00886 #endif 00887 /* Do some basic checks. */ 00888 if (region == NULL) 00889 { 00890 fprintf (stderr, 00891 (_("Error in %s () a NULL pointer was passed.\n")), 00892 __FUNCTION__); 00893 return (NULL); 00894 } 00895 region->elevation = elevation; 00896 #if DEBUG 00897 DXF_DEBUG_END 00898 #endif 00899 return (region); 00900 } 00901 00902 00908 double 00909 dxf_region_get_thickness 00910 ( 00911 DxfRegion *region 00913 ) 00914 { 00915 #if DEBUG 00916 DXF_DEBUG_BEGIN 00917 #endif 00918 /* Do some basic checks. */ 00919 if (region == NULL) 00920 { 00921 fprintf (stderr, 00922 (_("Error in %s () a NULL pointer was passed.\n")), 00923 __FUNCTION__); 00924 return (EXIT_FAILURE); 00925 } 00926 if (region->thickness < 0.0) 00927 { 00928 fprintf (stderr, 00929 (_("Error in %s () a negative value was found.\n")), 00930 __FUNCTION__); 00931 return (EXIT_FAILURE); 00932 } 00933 #if DEBUG 00934 DXF_DEBUG_END 00935 #endif 00936 return (region->thickness); 00937 } 00938 00939 00943 DxfRegion * 00944 dxf_region_set_thickness 00945 ( 00946 DxfRegion *region, 00948 double thickness 00950 ) 00951 { 00952 #if DEBUG 00953 DXF_DEBUG_BEGIN 00954 #endif 00955 /* Do some basic checks. */ 00956 if (region == NULL) 00957 { 00958 fprintf (stderr, 00959 (_("Error in %s () a NULL pointer was passed.\n")), 00960 __FUNCTION__); 00961 return (NULL); 00962 } 00963 if (thickness < 0.0) 00964 { 00965 fprintf (stderr, 00966 (_("Error in %s () a negative value was passed.\n")), 00967 __FUNCTION__); 00968 return (NULL); 00969 } 00970 region->thickness = thickness; 00971 #if DEBUG 00972 DXF_DEBUG_END 00973 #endif 00974 return (region); 00975 } 00976 00977 00983 double 00984 dxf_region_get_linetype_scale 00985 ( 00986 DxfRegion *region 00988 ) 00989 { 00990 #if DEBUG 00991 DXF_DEBUG_BEGIN 00992 #endif 00993 /* Do some basic checks. */ 00994 if (region == NULL) 00995 { 00996 fprintf (stderr, 00997 (_("Error in %s () a NULL pointer was passed.\n")), 00998 __FUNCTION__); 00999 return (EXIT_FAILURE); 01000 } 01001 if (region->linetype_scale < 0.0) 01002 { 01003 fprintf (stderr, 01004 (_("Error in %s () a negative value was found.\n")), 01005 __FUNCTION__); 01006 return (EXIT_FAILURE); 01007 } 01008 #if DEBUG 01009 DXF_DEBUG_END 01010 #endif 01011 return (region->linetype_scale); 01012 } 01013 01014 01018 DxfRegion * 01019 dxf_region_set_linetype_scale 01020 ( 01021 DxfRegion *region, 01023 double linetype_scale 01025 ) 01026 { 01027 #if DEBUG 01028 DXF_DEBUG_BEGIN 01029 #endif 01030 /* Do some basic checks. */ 01031 if (region == NULL) 01032 { 01033 fprintf (stderr, 01034 (_("Error in %s () a NULL pointer was passed.\n")), 01035 __FUNCTION__); 01036 return (NULL); 01037 } 01038 if (linetype_scale < 0.0) 01039 { 01040 fprintf (stderr, 01041 (_("Error in %s () a negative value was passed.\n")), 01042 __FUNCTION__); 01043 return (NULL); 01044 } 01045 region->linetype_scale = linetype_scale; 01046 #if DEBUG 01047 DXF_DEBUG_END 01048 #endif 01049 return (region); 01050 } 01051 01052 01058 int16_t 01059 dxf_region_get_visibility 01060 ( 01061 DxfRegion *region 01063 ) 01064 { 01065 #if DEBUG 01066 DXF_DEBUG_BEGIN 01067 #endif 01068 /* Do some basic checks. */ 01069 if (region == NULL) 01070 { 01071 fprintf (stderr, 01072 (_("Error in %s () a NULL pointer was passed.\n")), 01073 __FUNCTION__); 01074 return (EXIT_FAILURE); 01075 } 01076 if (region->visibility < 0) 01077 { 01078 fprintf (stderr, 01079 (_("Error in %s () a negative value was found.\n")), 01080 __FUNCTION__); 01081 return (EXIT_FAILURE); 01082 } 01083 if (region->visibility > 1) 01084 { 01085 fprintf (stderr, 01086 (_("Error in %s () an out of range value was found.\n")), 01087 __FUNCTION__); 01088 return (EXIT_FAILURE); 01089 } 01090 #if DEBUG 01091 DXF_DEBUG_END 01092 #endif 01093 return (region->visibility); 01094 } 01095 01096 01100 DxfRegion * 01101 dxf_region_set_visibility 01102 ( 01103 DxfRegion *region, 01105 int16_t visibility 01107 ) 01108 { 01109 #if DEBUG 01110 DXF_DEBUG_BEGIN 01111 #endif 01112 /* Do some basic checks. */ 01113 if (region == NULL) 01114 { 01115 fprintf (stderr, 01116 (_("Error in %s () a NULL pointer was passed.\n")), 01117 __FUNCTION__); 01118 return (NULL); 01119 } 01120 if (visibility < 0) 01121 { 01122 fprintf (stderr, 01123 (_("Error in %s () a negative value was passed.\n")), 01124 __FUNCTION__); 01125 return (NULL); 01126 } 01127 if (visibility > 1) 01128 { 01129 fprintf (stderr, 01130 (_("Error in %s () an out of range value was passed.\n")), 01131 __FUNCTION__); 01132 return (NULL); 01133 } 01134 region->visibility = visibility; 01135 #if DEBUG 01136 DXF_DEBUG_END 01137 #endif 01138 return (region); 01139 } 01140 01141 01147 int 01148 dxf_region_get_color 01149 ( 01150 DxfRegion *region 01152 ) 01153 { 01154 #if DEBUG 01155 DXF_DEBUG_BEGIN 01156 #endif 01157 /* Do some basic checks. */ 01158 if (region == NULL) 01159 { 01160 fprintf (stderr, 01161 (_("Error in %s () a NULL pointer was passed.\n")), 01162 __FUNCTION__); 01163 return (EXIT_FAILURE); 01164 } 01165 if (region->color < 0) 01166 { 01167 fprintf (stderr, 01168 (_("Warning in %s () a negative value was found.\n")), 01169 __FUNCTION__); 01170 } 01171 #if DEBUG 01172 DXF_DEBUG_END 01173 #endif 01174 return (region->color); 01175 } 01176 01177 01181 DxfRegion * 01182 dxf_region_set_color 01183 ( 01184 DxfRegion *region, 01186 int color 01188 ) 01189 { 01190 #if DEBUG 01191 DXF_DEBUG_BEGIN 01192 #endif 01193 /* Do some basic checks. */ 01194 if (region == NULL) 01195 { 01196 fprintf (stderr, 01197 (_("Error in %s () a NULL pointer was passed.\n")), 01198 __FUNCTION__); 01199 return (NULL); 01200 } 01201 if (color < 0) 01202 { 01203 fprintf (stderr, 01204 (_("Warning in %s () a negative value was passed.\n")), 01205 __FUNCTION__); 01206 } 01207 region->color = color; 01208 #if DEBUG 01209 DXF_DEBUG_END 01210 #endif 01211 return (region); 01212 } 01213 01214 01220 int 01221 dxf_region_get_paperspace 01222 ( 01223 DxfRegion *region 01225 ) 01226 { 01227 #if DEBUG 01228 DXF_DEBUG_BEGIN 01229 #endif 01230 /* Do some basic checks. */ 01231 if (region == NULL) 01232 { 01233 fprintf (stderr, 01234 (_("Error in %s () a NULL pointer was passed.\n")), 01235 __FUNCTION__); 01236 return (EXIT_FAILURE); 01237 } 01238 if (region->paperspace < 0) 01239 { 01240 fprintf (stderr, 01241 (_("Warning in %s () a negative value was found.\n")), 01242 __FUNCTION__); 01243 } 01244 if (region->paperspace > 1) 01245 { 01246 fprintf (stderr, 01247 (_("Warning in %s () an out of range value was found.\n")), 01248 __FUNCTION__); 01249 } 01250 #if DEBUG 01251 DXF_DEBUG_END 01252 #endif 01253 return (region->paperspace); 01254 } 01255 01256 01260 DxfRegion * 01261 dxf_region_set_paperspace 01262 ( 01263 DxfRegion *region, 01265 int paperspace 01268 ) 01269 { 01270 #if DEBUG 01271 DXF_DEBUG_BEGIN 01272 #endif 01273 /* Do some basic checks. */ 01274 if (region == NULL) 01275 { 01276 fprintf (stderr, 01277 (_("Error in %s () a NULL pointer was passed.\n")), 01278 __FUNCTION__); 01279 return (NULL); 01280 } 01281 if (paperspace < 0) 01282 { 01283 fprintf (stderr, 01284 (_("Error in %s () a negative value was passed.\n")), 01285 __FUNCTION__); 01286 return (NULL); 01287 } 01288 if (paperspace > 1) 01289 { 01290 fprintf (stderr, 01291 (_("Error in %s () an out of range value was passed.\n")), 01292 __FUNCTION__); 01293 return (NULL); 01294 } 01295 region->paperspace = paperspace; 01296 #if DEBUG 01297 DXF_DEBUG_END 01298 #endif 01299 return (region); 01300 } 01301 01302 01310 int 01311 dxf_region_get_graphics_data_size 01312 ( 01313 DxfRegion *region 01315 ) 01316 { 01317 #if DEBUG 01318 DXF_DEBUG_BEGIN 01319 #endif 01320 /* Do some basic checks. */ 01321 if (region == NULL) 01322 { 01323 fprintf (stderr, 01324 (_("Error in %s () a NULL pointer was passed.\n")), 01325 __FUNCTION__); 01326 return (EXIT_FAILURE); 01327 } 01328 if (region->graphics_data_size < 0) 01329 { 01330 fprintf (stderr, 01331 (_("Warning in %s () a negative value was found.\n")), 01332 __FUNCTION__); 01333 } 01334 if (region->graphics_data_size == 0) 01335 { 01336 fprintf (stderr, 01337 (_("Warning in %s () a zero value was found.\n")), 01338 __FUNCTION__); 01339 } 01340 #if DEBUG 01341 DXF_DEBUG_END 01342 #endif 01343 return (region->graphics_data_size); 01344 } 01345 01346 01353 DxfRegion * 01354 dxf_region_set_graphics_data_size 01355 ( 01356 DxfRegion *region, 01358 int graphics_data_size 01361 ) 01362 { 01363 #if DEBUG 01364 DXF_DEBUG_BEGIN 01365 #endif 01366 /* Do some basic checks. */ 01367 if (region == NULL) 01368 { 01369 fprintf (stderr, 01370 (_("Error in %s () a NULL pointer was passed.\n")), 01371 __FUNCTION__); 01372 return (NULL); 01373 } 01374 if (graphics_data_size < 0) 01375 { 01376 fprintf (stderr, 01377 (_("Error in %s () a negative value was passed.\n")), 01378 __FUNCTION__); 01379 return (NULL); 01380 } 01381 if (graphics_data_size == 0) 01382 { 01383 fprintf (stderr, 01384 (_("Warning in %s () a zero value was passed.\n")), 01385 __FUNCTION__); 01386 } 01387 region->graphics_data_size = graphics_data_size; 01388 #if DEBUG 01389 DXF_DEBUG_END 01390 #endif 01391 return (region); 01392 } 01393 01394 01401 int16_t 01402 dxf_region_get_shadow_mode 01403 ( 01404 DxfRegion *region 01406 ) 01407 { 01408 #if DEBUG 01409 DXF_DEBUG_BEGIN 01410 #endif 01411 /* Do some basic checks. */ 01412 if (region == NULL) 01413 { 01414 fprintf (stderr, 01415 (_("Error in %s () a NULL pointer was passed.\n")), 01416 __FUNCTION__); 01417 return (EXIT_FAILURE); 01418 } 01419 if (region->shadow_mode < 0) 01420 { 01421 fprintf (stderr, 01422 (_("Error in %s () a negative value was found.\n")), 01423 __FUNCTION__); 01424 return (EXIT_FAILURE); 01425 } 01426 if (region->shadow_mode > 3) 01427 { 01428 fprintf (stderr, 01429 (_("Error in %s () an out of range value was found.\n")), 01430 __FUNCTION__); 01431 return (EXIT_FAILURE); 01432 } 01433 #if DEBUG 01434 DXF_DEBUG_END 01435 #endif 01436 return (region->shadow_mode); 01437 } 01438 01439 01446 DxfRegion * 01447 dxf_region_set_shadow_mode 01448 ( 01449 DxfRegion *region, 01451 int16_t shadow_mode 01453 ) 01454 { 01455 #if DEBUG 01456 DXF_DEBUG_BEGIN 01457 #endif 01458 /* Do some basic checks. */ 01459 if (region == NULL) 01460 { 01461 fprintf (stderr, 01462 (_("Error in %s () a NULL pointer was passed.\n")), 01463 __FUNCTION__); 01464 return (NULL); 01465 } 01466 if (shadow_mode < 0) 01467 { 01468 fprintf (stderr, 01469 (_("Error in %s () a negative value was passed.\n")), 01470 __FUNCTION__); 01471 return (NULL); 01472 } 01473 if (shadow_mode > 3) 01474 { 01475 fprintf (stderr, 01476 (_("Error in %s () an out of range value was passed.\n")), 01477 __FUNCTION__); 01478 return (NULL); 01479 } 01480 region->shadow_mode = shadow_mode; 01481 #if DEBUG 01482 DXF_DEBUG_END 01483 #endif 01484 return (region); 01485 } 01486 01487 01496 DxfBinaryGraphicsData * 01497 dxf_region_get_binary_graphics_data 01498 ( 01499 DxfRegion *region 01501 ) 01502 { 01503 #if DEBUG 01504 DXF_DEBUG_BEGIN 01505 #endif 01506 /* Do some basic checks. */ 01507 if (region == NULL) 01508 { 01509 fprintf (stderr, 01510 (_("Error in %s () a NULL pointer was passed.\n")), 01511 __FUNCTION__); 01512 return (NULL); 01513 } 01514 if (region->binary_graphics_data == NULL) 01515 { 01516 fprintf (stderr, 01517 (_("Error in %s () a NULL pointer was found.\n")), 01518 __FUNCTION__); 01519 return (NULL); 01520 } 01521 #if DEBUG 01522 DXF_DEBUG_END 01523 #endif 01524 return ((DxfBinaryGraphicsData *) region->binary_graphics_data); 01525 } 01526 01527 01532 DxfRegion * 01533 dxf_region_set_binary_graphics_data 01534 ( 01535 DxfRegion *region, 01537 DxfBinaryGraphicsData *data 01540 ) 01541 { 01542 #if DEBUG 01543 DXF_DEBUG_BEGIN 01544 #endif 01545 /* Do some basic checks. */ 01546 if (region == NULL) 01547 { 01548 fprintf (stderr, 01549 (_("Error in %s () a NULL pointer was passed.\n")), 01550 __FUNCTION__); 01551 return (NULL); 01552 } 01553 if (data == NULL) 01554 { 01555 fprintf (stderr, 01556 (_("Error in %s () a NULL pointer was passed.\n")), 01557 __FUNCTION__); 01558 return (NULL); 01559 } 01560 region->binary_graphics_data = (DxfBinaryGraphicsData *) data; 01561 #if DEBUG 01562 DXF_DEBUG_END 01563 #endif 01564 return (region); 01565 } 01566 01567 01576 char * 01577 dxf_region_get_dictionary_owner_soft 01578 ( 01579 DxfRegion *region 01581 ) 01582 { 01583 #if DEBUG 01584 DXF_DEBUG_BEGIN 01585 #endif 01586 /* Do some basic checks. */ 01587 if (region == NULL) 01588 { 01589 fprintf (stderr, 01590 (_("Error in %s () a NULL pointer was passed.\n")), 01591 __FUNCTION__); 01592 return (NULL); 01593 } 01594 if (region->dictionary_owner_soft == 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 (strdup (region->dictionary_owner_soft)); 01605 } 01606 01607 01612 DxfRegion * 01613 dxf_region_set_dictionary_owner_soft 01614 ( 01615 DxfRegion *region, 01617 char *dictionary_owner_soft 01620 ) 01621 { 01622 #if DEBUG 01623 DXF_DEBUG_BEGIN 01624 #endif 01625 /* Do some basic checks. */ 01626 if (region == NULL) 01627 { 01628 fprintf (stderr, 01629 (_("Error in %s () a NULL pointer was passed.\n")), 01630 __FUNCTION__); 01631 return (NULL); 01632 } 01633 if (dictionary_owner_soft == NULL) 01634 { 01635 fprintf (stderr, 01636 (_("Error in %s () a NULL pointer was passed.\n")), 01637 __FUNCTION__); 01638 return (NULL); 01639 } 01640 region->dictionary_owner_soft = strdup (dictionary_owner_soft); 01641 #if DEBUG 01642 DXF_DEBUG_END 01643 #endif 01644 return (region); 01645 } 01646 01647 01656 char * 01657 dxf_region_get_material 01658 ( 01659 DxfRegion *region 01661 ) 01662 { 01663 #if DEBUG 01664 DXF_DEBUG_BEGIN 01665 #endif 01666 /* Do some basic checks. */ 01667 if (region == NULL) 01668 { 01669 fprintf (stderr, 01670 (_("Error in %s () a NULL pointer was passed.\n")), 01671 __FUNCTION__); 01672 return (NULL); 01673 } 01674 if (region->material == 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 (region->material)); 01685 } 01686 01687 01694 DxfRegion * 01695 dxf_region_set_material 01696 ( 01697 DxfRegion *region, 01699 char *material 01702 ) 01703 { 01704 #if DEBUG 01705 DXF_DEBUG_BEGIN 01706 #endif 01707 /* Do some basic checks. */ 01708 if (region == NULL) 01709 { 01710 fprintf (stderr, 01711 (_("Error in %s () a NULL pointer was passed.\n")), 01712 __FUNCTION__); 01713 return (NULL); 01714 } 01715 if (material == NULL) 01716 { 01717 fprintf (stderr, 01718 (_("Error in %s () a NULL pointer was passed.\n")), 01719 __FUNCTION__); 01720 return (NULL); 01721 } 01722 region->material = strdup (material); 01723 #if DEBUG 01724 DXF_DEBUG_END 01725 #endif 01726 return (region); 01727 } 01728 01729 01738 char * 01739 dxf_region_get_dictionary_owner_hard 01740 ( 01741 DxfRegion *region 01743 ) 01744 { 01745 #if DEBUG 01746 DXF_DEBUG_BEGIN 01747 #endif 01748 /* Do some basic checks. */ 01749 if (region == NULL) 01750 { 01751 fprintf (stderr, 01752 (_("Error in %s () a NULL pointer was passed.\n")), 01753 __FUNCTION__); 01754 return (NULL); 01755 } 01756 if (region->dictionary_owner_hard == NULL) 01757 { 01758 fprintf (stderr, 01759 (_("Error in %s () a NULL pointer was found.\n")), 01760 __FUNCTION__); 01761 return (NULL); 01762 } 01763 #if DEBUG 01764 DXF_DEBUG_END 01765 #endif 01766 return (strdup (region->dictionary_owner_hard)); 01767 } 01768 01769 01774 DxfRegion * 01775 dxf_region_set_dictionary_owner_hard 01776 ( 01777 DxfRegion *region, 01779 char *dictionary_owner_hard 01782 ) 01783 { 01784 #if DEBUG 01785 DXF_DEBUG_BEGIN 01786 #endif 01787 /* Do some basic checks. */ 01788 if (region == NULL) 01789 { 01790 fprintf (stderr, 01791 (_("Error in %s () a NULL pointer was passed.\n")), 01792 __FUNCTION__); 01793 return (NULL); 01794 } 01795 if (dictionary_owner_hard == NULL) 01796 { 01797 fprintf (stderr, 01798 (_("Error in %s () a NULL pointer was passed.\n")), 01799 __FUNCTION__); 01800 return (NULL); 01801 } 01802 region->dictionary_owner_hard = strdup (dictionary_owner_hard); 01803 #if DEBUG 01804 DXF_DEBUG_END 01805 #endif 01806 return (region); 01807 } 01808 01809 01816 int16_t 01817 dxf_region_get_lineweight 01818 ( 01819 DxfRegion *region 01821 ) 01822 { 01823 #if DEBUG 01824 DXF_DEBUG_BEGIN 01825 #endif 01826 /* Do some basic checks. */ 01827 if (region == NULL) 01828 { 01829 fprintf (stderr, 01830 (_("Error in %s () a NULL pointer was passed.\n")), 01831 __FUNCTION__); 01832 return (EXIT_FAILURE); 01833 } 01834 #if DEBUG 01835 DXF_DEBUG_END 01836 #endif 01837 return (region->lineweight); 01838 } 01839 01840 01847 DxfRegion * 01848 dxf_region_set_lineweight 01849 ( 01850 DxfRegion *region, 01852 int16_t lineweight 01854 ) 01855 { 01856 #if DEBUG 01857 DXF_DEBUG_BEGIN 01858 #endif 01859 /* Do some basic checks. */ 01860 if (region == NULL) 01861 { 01862 fprintf (stderr, 01863 (_("Error in %s () a NULL pointer was passed.\n")), 01864 __FUNCTION__); 01865 return (NULL); 01866 } 01867 region->lineweight = lineweight; 01868 #if DEBUG 01869 DXF_DEBUG_END 01870 #endif 01871 return (region); 01872 } 01873 01874 01881 char * 01882 dxf_region_get_plot_style_name 01883 ( 01884 DxfRegion *region 01886 ) 01887 { 01888 #if DEBUG 01889 DXF_DEBUG_BEGIN 01890 #endif 01891 /* Do some basic checks. */ 01892 if (region == NULL) 01893 { 01894 fprintf (stderr, 01895 (_("Error in %s () a NULL pointer was passed.\n")), 01896 __FUNCTION__); 01897 return (NULL); 01898 } 01899 if (region->plot_style_name == NULL) 01900 { 01901 fprintf (stderr, 01902 (_("Error in %s () a NULL pointer was found.\n")), 01903 __FUNCTION__); 01904 return (NULL); 01905 } 01906 #if DEBUG 01907 DXF_DEBUG_END 01908 #endif 01909 return (strdup (region->plot_style_name)); 01910 } 01911 01912 01919 DxfRegion * 01920 dxf_region_set_plot_style_name 01921 ( 01922 DxfRegion *region, 01924 char *plot_style_name 01927 ) 01928 { 01929 #if DEBUG 01930 DXF_DEBUG_BEGIN 01931 #endif 01932 /* Do some basic checks. */ 01933 if (region == NULL) 01934 { 01935 fprintf (stderr, 01936 (_("Error in %s () a NULL pointer was passed.\n")), 01937 __FUNCTION__); 01938 return (NULL); 01939 } 01940 if (plot_style_name == NULL) 01941 { 01942 fprintf (stderr, 01943 (_("Error in %s () a NULL pointer was passed.\n")), 01944 __FUNCTION__); 01945 return (NULL); 01946 } 01947 region->plot_style_name = strdup (plot_style_name); 01948 #if DEBUG 01949 DXF_DEBUG_END 01950 #endif 01951 return (region); 01952 } 01953 01954 01961 long 01962 dxf_region_get_color_value 01963 ( 01964 DxfRegion *region 01966 ) 01967 { 01968 #if DEBUG 01969 DXF_DEBUG_BEGIN 01970 #endif 01971 /* Do some basic checks. */ 01972 if (region == NULL) 01973 { 01974 fprintf (stderr, 01975 (_("Error in %s () a NULL pointer was passed.\n")), 01976 __FUNCTION__); 01977 return (EXIT_FAILURE); 01978 } 01979 #if DEBUG 01980 DXF_DEBUG_END 01981 #endif 01982 return (region->color_value); 01983 } 01984 01985 01992 DxfRegion * 01993 dxf_region_set_color_value 01994 ( 01995 DxfRegion *region, 01997 long color_value 01999 ) 02000 { 02001 #if DEBUG 02002 DXF_DEBUG_BEGIN 02003 #endif 02004 /* Do some basic checks. */ 02005 if (region == NULL) 02006 { 02007 fprintf (stderr, 02008 (_("Error in %s () a NULL pointer was passed.\n")), 02009 __FUNCTION__); 02010 return (NULL); 02011 } 02012 region->color_value = color_value; 02013 #if DEBUG 02014 DXF_DEBUG_END 02015 #endif 02016 return (region); 02017 } 02018 02019 02026 char * 02027 dxf_region_get_color_name 02028 ( 02029 DxfRegion *region 02031 ) 02032 { 02033 #if DEBUG 02034 DXF_DEBUG_BEGIN 02035 #endif 02036 /* Do some basic checks. */ 02037 if (region == NULL) 02038 { 02039 fprintf (stderr, 02040 (_("Error in %s () a NULL pointer was passed.\n")), 02041 __FUNCTION__); 02042 return (NULL); 02043 } 02044 if (region->color_name == NULL) 02045 { 02046 fprintf (stderr, 02047 (_("Error in %s () a NULL pointer was found.\n")), 02048 __FUNCTION__); 02049 return (NULL); 02050 } 02051 #if DEBUG 02052 DXF_DEBUG_END 02053 #endif 02054 return (strdup (region->color_name)); 02055 } 02056 02057 02064 DxfRegion * 02065 dxf_region_set_color_name 02066 ( 02067 DxfRegion *region, 02069 char *color_name 02072 ) 02073 { 02074 #if DEBUG 02075 DXF_DEBUG_BEGIN 02076 #endif 02077 /* Do some basic checks. */ 02078 if (region == NULL) 02079 { 02080 fprintf (stderr, 02081 (_("Error in %s () a NULL pointer was passed.\n")), 02082 __FUNCTION__); 02083 return (NULL); 02084 } 02085 if (color_name == NULL) 02086 { 02087 fprintf (stderr, 02088 (_("Error in %s () a NULL pointer was passed.\n")), 02089 __FUNCTION__); 02090 return (NULL); 02091 } 02092 region->color_name = strdup (color_name); 02093 #if DEBUG 02094 DXF_DEBUG_END 02095 #endif 02096 return (region); 02097 } 02098 02099 02106 long 02107 dxf_region_get_transparency 02108 ( 02109 DxfRegion *region 02111 ) 02112 { 02113 #if DEBUG 02114 DXF_DEBUG_BEGIN 02115 #endif 02116 /* Do some basic checks. */ 02117 if (region == NULL) 02118 { 02119 fprintf (stderr, 02120 (_("Error in %s () a NULL pointer was passed.\n")), 02121 __FUNCTION__); 02122 return (EXIT_FAILURE); 02123 } 02124 #if DEBUG 02125 DXF_DEBUG_END 02126 #endif 02127 return (region->transparency); 02128 } 02129 02130 02137 DxfRegion * 02138 dxf_region_set_transparency 02139 ( 02140 DxfRegion *region, 02142 long transparency 02144 ) 02145 { 02146 #if DEBUG 02147 DXF_DEBUG_BEGIN 02148 #endif 02149 /* Do some basic checks. */ 02150 if (region == NULL) 02151 { 02152 fprintf (stderr, 02153 (_("Error in %s () a NULL pointer was passed.\n")), 02154 __FUNCTION__); 02155 return (NULL); 02156 } 02157 region->transparency = transparency; 02158 #if DEBUG 02159 DXF_DEBUG_END 02160 #endif 02161 return (region); 02162 } 02163 02164 02171 DxfChar * 02172 dxf_region_get_proprietary_data 02173 ( 02174 DxfRegion *region 02176 ) 02177 { 02178 #if DEBUG 02179 DXF_DEBUG_BEGIN 02180 #endif 02181 /* Do some basic checks. */ 02182 if (region == NULL) 02183 { 02184 fprintf (stderr, 02185 (_("Error in %s () a NULL pointer was passed.\n")), 02186 __FUNCTION__); 02187 return (NULL); 02188 } 02189 if (region->proprietary_data == NULL) 02190 { 02191 fprintf (stderr, 02192 (_("Error in %s () a NULL pointer was found.\n")), 02193 __FUNCTION__); 02194 return (NULL); 02195 } 02196 if (region->proprietary_data->value == NULL) 02197 { 02198 fprintf (stderr, 02199 (_("Error in %s () a NULL pointer was found.\n")), 02200 __FUNCTION__); 02201 return (NULL); 02202 } 02203 #if DEBUG 02204 DXF_DEBUG_END 02205 #endif 02206 return (region->proprietary_data); 02207 } 02208 02209 02216 DxfRegion * 02217 dxf_region_set_proprietary_data 02218 ( 02219 DxfRegion *region, 02221 DxfChar *proprietary_data 02224 ) 02225 { 02226 #if DEBUG 02227 DXF_DEBUG_BEGIN 02228 #endif 02229 /* Do some basic checks. */ 02230 if (region == NULL) 02231 { 02232 fprintf (stderr, 02233 (_("Error in %s () a NULL pointer was passed.\n")), 02234 __FUNCTION__); 02235 return (NULL); 02236 } 02237 if (proprietary_data == NULL) 02238 { 02239 fprintf (stderr, 02240 (_("Error in %s () a NULL pointer was passed.\n")), 02241 __FUNCTION__); 02242 return (NULL); 02243 } 02244 if (proprietary_data->value == NULL) 02245 { 02246 fprintf (stderr, 02247 (_("Error in %s () a NULL pointer was found.\n")), 02248 __FUNCTION__); 02249 return (NULL); 02250 } 02251 region->proprietary_data = proprietary_data; 02252 #if DEBUG 02253 DXF_DEBUG_END 02254 #endif 02255 return (region); 02256 } 02257 02258 02266 DxfChar * 02267 dxf_region_get_additional_proprietary_data 02268 ( 02269 DxfRegion *region 02271 ) 02272 { 02273 #if DEBUG 02274 DXF_DEBUG_BEGIN 02275 #endif 02276 /* Do some basic checks. */ 02277 if (region == NULL) 02278 { 02279 fprintf (stderr, 02280 (_("Error in %s () a NULL pointer was passed.\n")), 02281 __FUNCTION__); 02282 return (NULL); 02283 } 02284 if (region->additional_proprietary_data == NULL) 02285 { 02286 fprintf (stderr, 02287 (_("Error in %s () a NULL pointer was found.\n")), 02288 __FUNCTION__); 02289 return (NULL); 02290 } 02291 if (region->additional_proprietary_data->value == NULL) 02292 { 02293 fprintf (stderr, 02294 (_("Error in %s () a NULL pointer was found.\n")), 02295 __FUNCTION__); 02296 return (NULL); 02297 } 02298 #if DEBUG 02299 DXF_DEBUG_END 02300 #endif 02301 return (region->additional_proprietary_data); 02302 } 02303 02304 02312 DxfRegion * 02313 dxf_region_set_additional_proprietary_data 02314 ( 02315 DxfRegion *region, 02317 DxfChar *additional_proprietary_data 02320 ) 02321 { 02322 #if DEBUG 02323 DXF_DEBUG_BEGIN 02324 #endif 02325 /* Do some basic checks. */ 02326 if (region == NULL) 02327 { 02328 fprintf (stderr, 02329 (_("Error in %s () a NULL pointer was passed.\n")), 02330 __FUNCTION__); 02331 return (NULL); 02332 } 02333 if (additional_proprietary_data == NULL) 02334 { 02335 fprintf (stderr, 02336 (_("Error in %s () a NULL pointer was passed.\n")), 02337 __FUNCTION__); 02338 return (NULL); 02339 } 02340 if (additional_proprietary_data->value == NULL) 02341 { 02342 fprintf (stderr, 02343 (_("Error in %s () a NULL pointer was found.\n")), 02344 __FUNCTION__); 02345 return (NULL); 02346 } 02347 region->additional_proprietary_data = additional_proprietary_data; 02348 #if DEBUG 02349 DXF_DEBUG_END 02350 #endif 02351 return (region); 02352 } 02353 02354 02361 int 02362 dxf_region_get_modeler_format_version_number 02363 ( 02364 DxfRegion *region 02366 ) 02367 { 02368 #if DEBUG 02369 DXF_DEBUG_BEGIN 02370 #endif 02371 /* Do some basic checks. */ 02372 if (region == NULL) 02373 { 02374 fprintf (stderr, 02375 (_("Error in %s () a NULL pointer was passed.\n")), 02376 __FUNCTION__); 02377 return (EXIT_FAILURE); 02378 } 02379 if (region->modeler_format_version_number != 1) 02380 { 02381 fprintf (stderr, 02382 (_("Warning in %s () an invalid value was found.\n")), 02383 __FUNCTION__); 02384 } 02385 #if DEBUG 02386 DXF_DEBUG_END 02387 #endif 02388 return (region->modeler_format_version_number); 02389 } 02390 02391 02396 DxfRegion * 02397 dxf_region_set_modeler_format_version_number 02398 ( 02399 DxfRegion *region, 02401 int modeler_format_version_number 02404 ) 02405 { 02406 #if DEBUG 02407 DXF_DEBUG_BEGIN 02408 #endif 02409 /* Do some basic checks. */ 02410 if (region == NULL) 02411 { 02412 fprintf (stderr, 02413 (_("Error in %s () a NULL pointer was passed.\n")), 02414 __FUNCTION__); 02415 return (NULL); 02416 } 02417 if (modeler_format_version_number != 1) 02418 { 02419 fprintf (stderr, 02420 (_("Warning in %s () an invalid value was passed.\n")), 02421 __FUNCTION__); 02422 } 02423 region->modeler_format_version_number = modeler_format_version_number; 02424 #if DEBUG 02425 DXF_DEBUG_END 02426 #endif 02427 return (region); 02428 } 02429 02430 02439 DxfRegion * 02440 dxf_region_get_next 02441 ( 02442 DxfRegion *region 02444 ) 02445 { 02446 #if DEBUG 02447 DXF_DEBUG_BEGIN 02448 #endif 02449 /* Do some basic checks. */ 02450 if (region == NULL) 02451 { 02452 fprintf (stderr, 02453 (_("Error in %s () a NULL pointer was passed.\n")), 02454 __FUNCTION__); 02455 return (NULL); 02456 } 02457 if (region->next == NULL) 02458 { 02459 fprintf (stderr, 02460 (_("Error in %s () a NULL pointer was found.\n")), 02461 __FUNCTION__); 02462 return (NULL); 02463 } 02464 #if DEBUG 02465 DXF_DEBUG_END 02466 #endif 02467 return ((DxfRegion *) region->next); 02468 } 02469 02470 02475 DxfRegion * 02476 dxf_region_set_next 02477 ( 02478 DxfRegion *region, 02480 DxfRegion *next 02482 ) 02483 { 02484 #if DEBUG 02485 DXF_DEBUG_BEGIN 02486 #endif 02487 /* Do some basic checks. */ 02488 if (region == NULL) 02489 { 02490 fprintf (stderr, 02491 (_("Error in %s () a NULL pointer was passed.\n")), 02492 __FUNCTION__); 02493 return (NULL); 02494 } 02495 if (next == NULL) 02496 { 02497 fprintf (stderr, 02498 (_("Error in %s () a NULL pointer was passed.\n")), 02499 __FUNCTION__); 02500 return (NULL); 02501 } 02502 region->next = (struct DxfRegion *) next; 02503 #if DEBUG 02504 DXF_DEBUG_END 02505 #endif 02506 return (region); 02507 } 02508 02509 02518 DxfRegion * 02519 dxf_region_get_last 02520 ( 02521 DxfRegion *region 02523 ) 02524 { 02525 #if DEBUG 02526 DXF_DEBUG_BEGIN 02527 #endif 02528 /* Do some basic checks. */ 02529 if (region == NULL) 02530 { 02531 fprintf (stderr, 02532 (_("Error in %s () a NULL pointer was passed.\n")), 02533 __FUNCTION__); 02534 return (NULL); 02535 } 02536 if (region->next == NULL) 02537 { 02538 fprintf (stderr, 02539 (_("Warning in %s () a NULL pointer was found.\n")), 02540 __FUNCTION__); 02541 return ((DxfRegion *) region); 02542 } 02543 DxfRegion *iter = (DxfRegion *) region->next; 02544 while (iter->next != NULL) 02545 { 02546 iter = (DxfRegion *) iter->next; 02547 } 02548 #if DEBUG 02549 DXF_DEBUG_END 02550 #endif 02551 return ((DxfRegion *) iter); 02552 } 02553 02554 02555 /* EOF */