libDXF 0.0.1
A library with DXF related functions written in C.

circle.c

Go to the documentation of this file.
00001 
00044 #include "circle.h"
00045 
00046 
00052 DxfCircle *
00053 dxf_circle_new ()
00054 {
00055 #if DEBUG
00056         DXF_DEBUG_BEGIN
00057 #endif
00058         DxfCircle *circle = NULL;
00059         size_t size;
00060 
00061         size = sizeof (DxfCircle);
00062         /* avoid malloc of 0 bytes */
00063         if (size == 0) size = 1;
00064         if ((circle = malloc (size)) == NULL)
00065         {
00066                 fprintf (stderr,
00067                   (_("Error in %s () could not allocate memory for a DxfCircle struct.\n")),
00068                   __FUNCTION__);
00069                 circle = NULL;
00070         }
00071         else
00072         {
00073                 memset (circle, 0, size);
00074         }
00075 #if DEBUG
00076         DXF_DEBUG_END
00077 #endif
00078         return (circle);
00079 }
00080 
00081 
00089 DxfCircle *
00090 dxf_circle_init
00091 (
00092         DxfCircle *circle
00094 )
00095 {
00096 #if DEBUG
00097         DXF_DEBUG_BEGIN
00098 #endif
00099         /* Do some basic checks. */
00100         if (circle == NULL)
00101         {
00102                 fprintf (stderr,
00103                   (_("Warning in %s () a NULL pointer was passed.\n")),
00104                   __FUNCTION__);
00105                 circle = dxf_circle_new ();
00106         }
00107         if (circle == NULL)
00108         {
00109               fprintf (stderr,
00110                 (_("Error in %s () could not allocate memory for a DxfCircle struct.\n")),
00111                 __FUNCTION__);
00112               return (NULL);
00113         }
00114         dxf_circle_set_id_code (circle, 0);
00115         dxf_circle_set_linetype (circle, strdup (DXF_DEFAULT_LINETYPE));
00116         dxf_circle_set_layer (circle, strdup (DXF_DEFAULT_LAYER));
00117         dxf_circle_set_elevation (circle, 0.0);
00118         dxf_circle_set_thickness (circle, 0.0);
00119         dxf_circle_set_linetype_scale (circle, DXF_DEFAULT_LINETYPE_SCALE);
00120         dxf_circle_set_visibility (circle, DXF_DEFAULT_VISIBILITY);
00121         dxf_circle_set_color (circle, DXF_COLOR_BYLAYER);
00122         dxf_circle_set_paperspace (circle, DXF_MODELSPACE);
00123         dxf_circle_set_graphics_data_size (circle, 0);
00124         dxf_circle_set_shadow_mode (circle, 0);
00125         dxf_circle_set_binary_graphics_data (circle, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ());
00126         dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) dxf_circle_get_binary_graphics_data (circle));
00127         dxf_circle_set_dictionary_owner_soft (circle, strdup (""));
00128         dxf_circle_set_material (circle, strdup (""));
00129         dxf_circle_set_dictionary_owner_hard (circle, strdup (""));
00130         dxf_circle_set_lineweight (circle, 0);
00131         dxf_circle_set_plot_style_name (circle, strdup (""));
00132         dxf_circle_set_color_value (circle, 0);
00133         dxf_circle_set_color_name (circle, strdup (""));
00134         dxf_circle_set_transparency (circle, 0);
00135         dxf_circle_set_p0 (circle, dxf_point_new ());
00136         dxf_point_init ((DxfPoint *) dxf_circle_get_p0 (circle));
00137         dxf_circle_set_radius (circle, 0.0);
00138         dxf_circle_set_extr_x0 (circle, 0.0);
00139         dxf_circle_set_extr_y0 (circle, 0.0);
00140         dxf_circle_set_extr_z0 (circle, 0.0);
00141         dxf_circle_set_next (circle, NULL);
00142 #if DEBUG
00143         DXF_DEBUG_END
00144 #endif
00145         return (circle);
00146 }
00147 
00148 
00160 DxfCircle *
00161 dxf_circle_read
00162 (
00163         DxfFile *fp,
00165         DxfCircle *circle
00167 )
00168 {
00169 #if DEBUG
00170         DXF_DEBUG_BEGIN
00171 #endif
00172         char *temp_string = NULL;
00173 
00174         /* Do some basic checks. */
00175         if (fp == NULL)
00176         {
00177                 fprintf (stderr,
00178                   (_("Error in %s () a NULL file pointer was passed.\n")),
00179                   __FUNCTION__);
00180                 /* Clean up. */
00181                 free (temp_string);
00182                 return (NULL);
00183         }
00184         if (circle == NULL)
00185         {
00186                 fprintf (stderr,
00187                   (_("Warning in %s () a NULL pointer was passed.\n")),
00188                   __FUNCTION__);
00189                 circle = dxf_circle_new ();
00190                 circle = dxf_circle_init (circle);
00191         }
00192         (fp->line_number)++;
00193         fscanf (fp->fp, "%[^\n]", temp_string);
00194         while (strcmp (temp_string, "0") != 0)
00195         {
00196                 if (ferror (fp->fp))
00197                 {
00198                         fprintf (stderr,
00199                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00200                           __FUNCTION__, fp->filename, fp->line_number);
00201                         fclose (fp->fp);
00202                         /* Clean up. */
00203                         free (temp_string);
00204                         return (NULL);
00205                 }
00206                 if (strcmp (temp_string, "5") == 0)
00207                 {
00208                         /* Now follows a string containing a sequential
00209                          * id number. */
00210                         (fp->line_number)++;
00211                         fscanf (fp->fp, "%x\n", &circle->id_code);
00212                 }
00213                 else if (strcmp (temp_string, "6") == 0)
00214                 {
00215                         /* Now follows a string containing a linetype
00216                          * name. */
00217                         (fp->line_number)++;
00218                         fscanf (fp->fp, "%s\n", circle->linetype);
00219                 }
00220                 else if (strcmp (temp_string, "8") == 0)
00221                 {
00222                         /* Now follows a string containing a layer name. */
00223                         (fp->line_number)++;
00224                         fscanf (fp->fp, "%s\n", circle->layer);
00225                 }
00226                 else if (strcmp (temp_string, "10") == 0)
00227                 {
00228                         /* Now follows a string containing the
00229                          * X-coordinate of the center point. */
00230                         (fp->line_number)++;
00231                         fscanf (fp->fp, "%lf\n", &circle->p0->x0);
00232                 }
00233                 else if (strcmp (temp_string, "20") == 0)
00234                 {
00235                         /* Now follows a string containing the
00236                          * Y-coordinate of the center point. */
00237                         (fp->line_number)++;
00238                         fscanf (fp->fp, "%lf\n", &circle->p0->y0);
00239                 }
00240                 else if (strcmp (temp_string, "30") == 0)
00241                 {
00242                         /* Now follows a string containing the
00243                          * Z-coordinate of the center point. */
00244                         (fp->line_number)++;
00245                         fscanf (fp->fp, "%lf\n", &circle->p0->z0);
00246                 }
00247                 else if ((fp->acad_version_number <= AutoCAD_11)
00248                         && (strcmp (temp_string, "38") == 0)
00249                         && (circle->elevation != 0.0))
00250                 {
00251                         /* Now follows a string containing the
00252                          * elevation. */
00253                         (fp->line_number)++;
00254                         fscanf (fp->fp, "%lf\n", &circle->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", &circle->thickness);
00262                 }
00263                 else if (strcmp (temp_string, "40") == 0)
00264                 {
00265                         /* Now follows a string containing the
00266                          * radius. */
00267                         (fp->line_number)++;
00268                         fscanf (fp->fp, "%lf\n", &circle->radius);
00269                 }
00270                 else if (strcmp (temp_string, "48") == 0)
00271                 {
00272                         /* Now follows a string containing the linetype
00273                          * scale. */
00274                         (fp->line_number)++;
00275                         fscanf (fp->fp, "%lf\n", &circle->linetype_scale);
00276                 }
00277                 else if (strcmp (temp_string, "60") == 0)
00278                 {
00279                         /* Now follows a string containing the
00280                          * visibility value. */
00281                         (fp->line_number)++;
00282                         fscanf (fp->fp, "%hd\n", &circle->visibility);
00283                 }
00284                 else if (strcmp (temp_string, "62") == 0)
00285                 {
00286                         /* Now follows a string containing the
00287                          * color value. */
00288                         (fp->line_number)++;
00289                         fscanf (fp->fp, "%d\n", &circle->color);
00290                 }
00291                 else if (strcmp (temp_string, "67") == 0)
00292                 {
00293                         /* Now follows a string containing the
00294                          * paperspace value. */
00295                         (fp->line_number)++;
00296                         fscanf (fp->fp, "%d\n", &circle->paperspace);
00297                 }
00298                 else if ((fp->acad_version_number >= AutoCAD_13)
00299                         && (strcmp (temp_string, "100") == 0))
00300                 {
00301                         /* Now follows a string containing the
00302                          * subclass marker value. */
00303                         (fp->line_number)++;
00304                         fscanf (fp->fp, "%s\n", temp_string);
00305                         if ((strcmp (temp_string, "AcDbEntity") != 0)
00306                         && (strcmp (temp_string, "AcDbCircle") != 0))
00307                         {
00308                                 fprintf (stderr,
00309                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00310                                   __FUNCTION__, fp->filename, fp->line_number);
00311                         }
00312                 }
00313                 else if (strcmp (temp_string, "210") == 0)
00314                 {
00315                         /* Now follows a string containing the
00316                          * X-value of the extrusion vector. */
00317                         (fp->line_number)++;
00318                         fscanf (fp->fp, "%lf\n", &circle->extr_x0);
00319                 }
00320                 else if (strcmp (temp_string, "220") == 0)
00321                 {
00322                         /* Now follows a string containing the
00323                          * Y-value of the extrusion vector. */
00324                         (fp->line_number)++;
00325                         fscanf (fp->fp, "%lf\n", &circle->extr_y0);
00326                 }
00327                 else if (strcmp (temp_string, "230") == 0)
00328                 {
00329                         /* Now follows a string containing the
00330                          * Z-value of the extrusion vector. */
00331                         (fp->line_number)++;
00332                         fscanf (fp->fp, "%lf\n", &circle->extr_z0);
00333                 }
00334                 else if (strcmp (temp_string, "330") == 0)
00335                 {
00336                         /* Now follows a string containing Soft-pointer
00337                          * ID/handle to owner dictionary. */
00338                         (fp->line_number)++;
00339                         fscanf (fp->fp, "%s\n", circle->dictionary_owner_soft);
00340                 }
00341                 else if (strcmp (temp_string, "360") == 0)
00342                 {
00343                         /* Now follows a string containing Hard owner
00344                          * ID/handle to owner dictionary. */
00345                         (fp->line_number)++;
00346                         fscanf (fp->fp, "%s\n", circle->dictionary_owner_hard);
00347                 }
00348                 else if (strcmp (temp_string, "999") == 0)
00349                 {
00350                         /* Now follows a string containing a comment. */
00351                         (fp->line_number)++;
00352                         fscanf (fp->fp, "%s\n", temp_string);
00353                         fprintf (stdout, "DXF comment: %s\n", temp_string);
00354                 }
00355                 else
00356                 {
00357                         fprintf (stderr,
00358                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00359                           __FUNCTION__, fp->filename, fp->line_number);
00360                 }
00361         }
00362         /* Handle omitted members and/or illegal values. */
00363         if (strcmp (dxf_circle_get_linetype (circle), "") == 0)
00364         {
00365                 dxf_circle_set_linetype (circle, strdup (DXF_DEFAULT_LINETYPE));
00366         }
00367         if (strcmp (dxf_circle_get_layer (circle), "") == 0)
00368         {
00369                 dxf_circle_set_layer (circle, strdup (DXF_DEFAULT_LAYER));
00370         }
00371         /* Clean up. */
00372         free (temp_string);
00373 #if DEBUG
00374         DXF_DEBUG_END
00375 #endif
00376         return (circle);
00377 }
00378 
00379 
00383 int
00384 dxf_circle_write
00385 (
00386         DxfFile *fp,
00388         DxfCircle *circle
00390 )
00391 {
00392 #if DEBUG
00393         DXF_DEBUG_BEGIN
00394 #endif
00395         char *dxf_entity_name = strdup ("CIRCLE");
00396 
00397         /* Do some basic checks. */
00398         if (fp == NULL)
00399         {
00400                 fprintf (stderr,
00401                   (_("Error in %s () a NULL file pointer was passed.\n")),
00402                   __FUNCTION__);
00403                 /* Clean up. */
00404                 free (dxf_entity_name);
00405                 return (EXIT_FAILURE);
00406         }
00407         if (circle == NULL)
00408         {
00409                 fprintf (stderr,
00410                   (_("Error in %s () a NULL pointer was passed.\n")),
00411                   __FUNCTION__);
00412                 /* Clean up. */
00413                 free (dxf_entity_name);
00414                 return (EXIT_FAILURE);
00415         }
00416         if (dxf_circle_get_radius (circle) == 0.0)
00417         {
00418                 fprintf (stderr,
00419                   (_("Error in %s () radius value equals 0.0 for the %s entity with id-code: %x\n")),
00420                   __FUNCTION__, dxf_entity_name, dxf_circle_get_id_code (circle));
00421                 /* Clean up. */
00422                 free (dxf_entity_name);
00423                 return (EXIT_FAILURE);
00424         }
00425         if (strcmp (dxf_circle_get_linetype (circle), "") == 0)
00426         {
00427                 fprintf (stderr,
00428                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00429                   __FUNCTION__, dxf_entity_name, dxf_circle_get_id_code (circle));
00430                 fprintf (stderr,
00431                   (_("\t%s entity is reset to default linetype")),
00432                   dxf_entity_name);
00433                 dxf_circle_set_linetype (circle, strdup (DXF_DEFAULT_LINETYPE));
00434         }
00435         if (strcmp (dxf_circle_get_layer (circle), "") == 0)
00436         {
00437                 fprintf (stderr,
00438                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")),
00439                   __FUNCTION__, dxf_entity_name, dxf_circle_get_id_code (circle));
00440                 fprintf (stderr,
00441                   (_("\t%s entity is relocated to layer 0")),
00442                   dxf_entity_name );
00443                 dxf_circle_set_layer (circle, strdup (DXF_DEFAULT_LAYER));
00444         }
00445         /* Start writing output. */
00446         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00447         if (dxf_circle_get_id_code (circle) != -1)
00448         {
00449                 fprintf (fp->fp, "  5\n%x\n", dxf_circle_get_id_code (circle));
00450         }
00461         if ((strcmp (dxf_circle_get_dictionary_owner_soft (circle), "") != 0)
00462           && (fp->acad_version_number >= AutoCAD_14))
00463         {
00464                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00465                 fprintf (fp->fp, "330\n%s\n", dxf_circle_get_dictionary_owner_soft (circle));
00466                 fprintf (fp->fp, "102\n}\n");
00467         }
00468         if ((strcmp (dxf_circle_get_dictionary_owner_hard (circle), "") != 0)
00469           && (fp->acad_version_number >= AutoCAD_14))
00470         {
00471                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00472                 fprintf (fp->fp, "360\n%s\n", dxf_circle_get_dictionary_owner_hard (circle));
00473                 fprintf (fp->fp, "102\n}\n");
00474         }
00475         if (fp->acad_version_number >= AutoCAD_13)
00476         {
00477                 fprintf (fp->fp, "100\nAcDbEntity\n");
00478         }
00479         if (dxf_circle_get_paperspace (circle) == DXF_PAPERSPACE)
00480         {
00481                 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE);
00482         }
00483         fprintf (fp->fp, "  8\n%s\n", dxf_circle_get_layer (circle));
00484         if (strcmp (dxf_circle_get_linetype (circle), DXF_DEFAULT_LINETYPE) != 0)
00485         {
00486                 fprintf (fp->fp, "  6\n%s\n", dxf_circle_get_linetype (circle));
00487         }
00488         if (dxf_circle_get_color (circle) != DXF_COLOR_BYLAYER)
00489         {
00490                 fprintf (fp->fp, " 62\n%d\n", dxf_circle_get_color (circle));
00491         }
00492         if (dxf_circle_get_linetype_scale (circle) != 1.0)
00493         {
00494                 fprintf (fp->fp, " 48\n%f\n", dxf_circle_get_linetype_scale (circle));
00495         }
00496         if (dxf_circle_get_visibility (circle) != 0)
00497         {
00498                 fprintf (fp->fp, " 60\n%d\n", dxf_circle_get_visibility (circle));
00499         }
00500         if (fp->acad_version_number >= AutoCAD_13)
00501         {
00502                 fprintf (fp->fp, "100\nAcDbCircle\n");
00503         }
00504         if ((fp->acad_version_number <= AutoCAD_11)
00505           && DXF_FLATLAND
00506           && (dxf_circle_get_elevation (circle) != 0.0))
00507         {
00508                 fprintf (fp->fp, " 38\n%f\n", dxf_circle_get_elevation (circle));
00509         }
00510         if (dxf_circle_get_thickness (circle) != 0.0)
00511         {
00512                 fprintf (fp->fp, " 39\n%f\n", dxf_circle_get_thickness (circle));
00513         }
00514         fprintf (fp->fp, " 10\n%f\n", dxf_circle_get_x0 (circle));
00515         fprintf (fp->fp, " 20\n%f\n", dxf_circle_get_y0 (circle));
00516         fprintf (fp->fp, " 30\n%f\n", dxf_circle_get_z0 (circle));
00517         fprintf (fp->fp, " 40\n%f\n", dxf_circle_get_radius (circle));
00518         if ((fp->acad_version_number >= AutoCAD_12)
00519                 && (circle->extr_x0 != 0.0)
00520                 && (circle->extr_y0 != 0.0)
00521                 && (circle->extr_z0 != 1.0))
00522         {
00523                 fprintf (fp->fp, "210\n%f\n", circle->extr_x0);
00524                 fprintf (fp->fp, "220\n%f\n", circle->extr_y0);
00525                 fprintf (fp->fp, "230\n%f\n", circle->extr_z0);
00526         }
00527         /* Clean up. */
00528         free (dxf_entity_name);
00529 #if DEBUG
00530         DXF_DEBUG_END
00531 #endif
00532         return (EXIT_SUCCESS);
00533 }
00534 
00535 
00543 int
00544 dxf_circle_free
00545 (
00546         DxfCircle *circle
00549 )
00550 {
00551 #if DEBUG
00552         DXF_DEBUG_BEGIN
00553 #endif
00554         if (circle == NULL)
00555         {
00556                 fprintf (stderr,
00557                   (_("Error in %s () a NULL pointer was passed.\n")),
00558                   __FUNCTION__);
00559                 return (EXIT_FAILURE);
00560         }
00561         if (circle->next != NULL)
00562         {
00563                 fprintf (stderr,
00564                   (_("ERROR in %s () pointer to next was not NULL.\n")),
00565                   __FUNCTION__);
00566                 return (EXIT_FAILURE);
00567         }
00568         free (circle->linetype);
00569         free (circle->layer);
00570         free (circle->dictionary_owner_soft);
00571         free (circle->dictionary_owner_hard);
00572         free (circle);
00573         circle = NULL;
00574 #if DEBUG
00575         DXF_DEBUG_END
00576 #endif
00577         return (EXIT_SUCCESS);
00578 }
00579 
00580 
00585 void
00586 dxf_circle_free_chain
00587 (
00588         DxfCircle *circles
00590 )
00591 {
00592 #ifdef DEBUG
00593         DXF_DEBUG_BEGIN
00594 #endif
00595         if (circles == NULL)
00596         {
00597                 fprintf (stderr,
00598                   (_("Warning in %s () a NULL pointer was passed.\n")),
00599                   __FUNCTION__);
00600         }
00601         while (circles != NULL)
00602         {
00603                 struct DxfCircle *iter = circles->next;
00604                 dxf_circle_free (circles);
00605                 circles = (DxfCircle *) iter;
00606         }
00607 #if DEBUG
00608         DXF_DEBUG_END
00609 #endif
00610 }
00611 
00612 
00618 int
00619 dxf_circle_get_id_code
00620 (
00621         DxfCircle *circle
00623 )
00624 {
00625 #if DEBUG
00626         DXF_DEBUG_BEGIN
00627 #endif
00628         /* Do some basic checks. */
00629         if (circle == NULL)
00630         {
00631                 fprintf (stderr,
00632                   (_("Error in %s () a NULL pointer was passed.\n")),
00633                   __FUNCTION__);
00634                 return (EXIT_FAILURE);
00635         }
00636         if (circle->id_code < 0)
00637         {
00638                 fprintf (stderr,
00639                   (_("Error in %s () a negative value was found in the id-code member.\n")),
00640                   __FUNCTION__);
00641                 return (EXIT_FAILURE);
00642         }
00643 #if DEBUG
00644         DXF_DEBUG_END
00645 #endif
00646         return (circle->id_code);
00647 }
00648 
00649 
00653 DxfCircle *
00654 dxf_circle_set_id_code
00655 (
00656         DxfCircle *circle,
00658         int id_code
00662 )
00663 {
00664 #if DEBUG
00665         DXF_DEBUG_BEGIN
00666 #endif
00667         /* Do some basic checks. */
00668         if (circle == NULL)
00669         {
00670                 fprintf (stderr,
00671                   (_("Error in %s () a NULL pointer was passed.\n")),
00672                   __FUNCTION__);
00673                 return (NULL);
00674         }
00675         if (id_code < 0)
00676         {
00677                 fprintf (stderr,
00678                   (_("Error in %s () a negative id-code value was passed.\n")),
00679                   __FUNCTION__);
00680                 return (NULL);
00681         }
00682         circle->id_code = id_code;
00683 #if DEBUG
00684         DXF_DEBUG_END
00685 #endif
00686         return (circle);
00687 }
00688 
00689 
00695 char *
00696 dxf_circle_get_linetype
00697 (
00698         DxfCircle *circle
00700 )
00701 {
00702 #if DEBUG
00703         DXF_DEBUG_BEGIN
00704 #endif
00705         /* Do some basic checks. */
00706         if (circle == NULL)
00707         {
00708                 fprintf (stderr,
00709                   (_("Error in %s () a NULL pointer was passed.\n")),
00710                   __FUNCTION__);
00711                 return (NULL);
00712         }
00713         if (circle->linetype ==  NULL)
00714         {
00715                 fprintf (stderr,
00716                   (_("Error in %s () a NULL pointer was found in the linetype member.\n")),
00717                   __FUNCTION__);
00718                 return (NULL);
00719         }
00720 #if DEBUG
00721         DXF_DEBUG_END
00722 #endif
00723         return (strdup (circle->linetype));
00724 }
00725 
00726 
00730 DxfCircle *
00731 dxf_circle_set_linetype
00732 (
00733         DxfCircle *circle,
00735         char *linetype
00737 )
00738 {
00739 #if DEBUG
00740         DXF_DEBUG_BEGIN
00741 #endif
00742         /* Do some basic checks. */
00743         if (circle == NULL)
00744         {
00745                 fprintf (stderr,
00746                   (_("Error in %s () a NULL pointer was passed.\n")),
00747                   __FUNCTION__);
00748                 return (NULL);
00749         }
00750         if (linetype == NULL)
00751         {
00752                 fprintf (stderr,
00753                   (_("Error in %s () a NULL pointer was passed.\n")),
00754                   __FUNCTION__);
00755                 return (NULL);
00756         }
00757         circle->linetype = strdup (linetype);
00758 #if DEBUG
00759         DXF_DEBUG_END
00760 #endif
00761         return (circle);
00762 }
00763 
00764 
00770 char *
00771 dxf_circle_get_layer
00772 (
00773         DxfCircle *circle
00775 )
00776 {
00777 #if DEBUG
00778         DXF_DEBUG_BEGIN
00779 #endif
00780         /* Do some basic checks. */
00781         if (circle == NULL)
00782         {
00783                 fprintf (stderr,
00784                   (_("Error in %s () a NULL pointer was passed.\n")),
00785                   __FUNCTION__);
00786                 return (NULL);
00787         }
00788         if (circle->layer ==  NULL)
00789         {
00790                 fprintf (stderr,
00791                   (_("Error in %s () a NULL pointer was found in the layer member.\n")),
00792                   __FUNCTION__);
00793                 return (NULL);
00794         }
00795 #if DEBUG
00796         DXF_DEBUG_END
00797 #endif
00798         return (strdup (circle->layer));
00799 }
00800 
00801 
00805 DxfCircle *
00806 dxf_circle_set_layer
00807 (
00808         DxfCircle *circle,
00810         char *layer
00812 )
00813 {
00814 #if DEBUG
00815         DXF_DEBUG_BEGIN
00816 #endif
00817         /* Do some basic checks. */
00818         if (circle == NULL)
00819         {
00820                 fprintf (stderr,
00821                   (_("Error in %s () a NULL pointer was passed.\n")),
00822                   __FUNCTION__);
00823                 return (NULL);
00824         }
00825         if (layer == NULL)
00826         {
00827                 fprintf (stderr,
00828                   (_("Error in %s () a NULL pointer was passed.\n")),
00829                   __FUNCTION__);
00830                 return (NULL);
00831         }
00832         circle->layer = strdup (layer);
00833 #if DEBUG
00834         DXF_DEBUG_END
00835 #endif
00836         return (circle);
00837 }
00838 
00839 
00845 double
00846 dxf_circle_get_elevation
00847 (
00848         DxfCircle *circle
00850 )
00851 {
00852 #if DEBUG
00853         DXF_DEBUG_BEGIN
00854 #endif
00855         /* Do some basic checks. */
00856         if (circle == NULL)
00857         {
00858                 fprintf (stderr,
00859                   (_("Error in %s () a NULL pointer was passed.\n")),
00860                   __FUNCTION__);
00861                 return (EXIT_FAILURE);
00862         }
00863 #if DEBUG
00864         DXF_DEBUG_END
00865 #endif
00866         return (circle->elevation);
00867 }
00868 
00869 
00873 DxfCircle *
00874 dxf_circle_set_elevation
00875 (
00876         DxfCircle *circle,
00878         double elevation
00880 )
00881 {
00882 #if DEBUG
00883         DXF_DEBUG_BEGIN
00884 #endif
00885         /* Do some basic checks. */
00886         if (circle == NULL)
00887         {
00888                 fprintf (stderr,
00889                   (_("Error in %s () a NULL pointer was passed.\n")),
00890                   __FUNCTION__);
00891                 return (NULL);
00892         }
00893         circle->elevation = elevation;
00894 #if DEBUG
00895         DXF_DEBUG_END
00896 #endif
00897         return (circle);
00898 }
00899 
00900 
00906 double
00907 dxf_circle_get_thickness
00908 (
00909         DxfCircle *circle
00911 )
00912 {
00913 #if DEBUG
00914         DXF_DEBUG_BEGIN
00915 #endif
00916         /* Do some basic checks. */
00917         if (circle == NULL)
00918         {
00919                 fprintf (stderr,
00920                   (_("Error in %s () a NULL pointer was passed.\n")),
00921                   __FUNCTION__);
00922                 return (EXIT_FAILURE);
00923         }
00924         if (circle->thickness < 0.0)
00925         {
00926                 fprintf (stderr,
00927                   (_("Error in %s () a negative value was found in the thickness member.\n")),
00928                   __FUNCTION__);
00929                 return (EXIT_FAILURE);
00930         }
00931 #if DEBUG
00932         DXF_DEBUG_END
00933 #endif
00934         return (circle->thickness);
00935 }
00936 
00937 
00941 DxfCircle *
00942 dxf_circle_set_thickness
00943 (
00944         DxfCircle *circle,
00946         double thickness
00948 )
00949 {
00950 #if DEBUG
00951         DXF_DEBUG_BEGIN
00952 #endif
00953         /* Do some basic checks. */
00954         if (circle == NULL)
00955         {
00956                 fprintf (stderr,
00957                   (_("Error in %s () a NULL pointer was passed.\n")),
00958                   __FUNCTION__);
00959                 return (NULL);
00960         }
00961         if (thickness < 0.0)
00962         {
00963                 fprintf (stderr,
00964                   (_("Error in %s () a negative thickness value was passed.\n")),
00965                   __FUNCTION__);
00966                 return (NULL);
00967         }
00968         circle->thickness = thickness;
00969 #if DEBUG
00970         DXF_DEBUG_END
00971 #endif
00972         return (circle);
00973 }
00974 
00975 
00981 double
00982 dxf_circle_get_linetype_scale
00983 (
00984         DxfCircle *circle
00986 )
00987 {
00988 #if DEBUG
00989         DXF_DEBUG_BEGIN
00990 #endif
00991         /* Do some basic checks. */
00992         if (circle == NULL)
00993         {
00994                 fprintf (stderr,
00995                   (_("Error in %s () a NULL pointer was passed.\n")),
00996                   __FUNCTION__);
00997                 return (EXIT_FAILURE);
00998         }
00999         if (circle->linetype_scale < 0.0)
01000         {
01001                 fprintf (stderr,
01002                   (_("Error in %s () a negative value was found in the linetype scale member.\n")),
01003                   __FUNCTION__);
01004                 return (EXIT_FAILURE);
01005         }
01006 #if DEBUG
01007         DXF_DEBUG_END
01008 #endif
01009         return (circle->linetype_scale);
01010 }
01011 
01012 
01016 DxfCircle *
01017 dxf_circle_set_linetype_scale
01018 (
01019         DxfCircle *circle,
01021         double linetype_scale
01023 )
01024 {
01025 #if DEBUG
01026         DXF_DEBUG_BEGIN
01027 #endif
01028         /* Do some basic checks. */
01029         if (circle == NULL)
01030         {
01031                 fprintf (stderr,
01032                   (_("Error in %s () a NULL pointer was passed.\n")),
01033                   __FUNCTION__);
01034                 return (NULL);
01035         }
01036         if (linetype_scale < 0.0)
01037         {
01038                 fprintf (stderr,
01039                   (_("Error in %s () a negative linetype scale value was passed.\n")),
01040                   __FUNCTION__);
01041                 return (NULL);
01042         }
01043         circle->linetype_scale = linetype_scale;
01044 #if DEBUG
01045         DXF_DEBUG_END
01046 #endif
01047         return (circle);
01048 }
01049 
01050 
01056 int16_t
01057 dxf_circle_get_visibility
01058 (
01059         DxfCircle *circle
01061 )
01062 {
01063 #if DEBUG
01064         DXF_DEBUG_BEGIN
01065 #endif
01066         /* Do some basic checks. */
01067         if (circle == NULL)
01068         {
01069                 fprintf (stderr,
01070                   (_("Error in %s () a NULL pointer was passed.\n")),
01071                   __FUNCTION__);
01072                 return (EXIT_FAILURE);
01073         }
01074         if (circle->visibility < 0)
01075         {
01076                 fprintf (stderr,
01077                   (_("Error in %s () a negative value was found in the visibility member.\n")),
01078                   __FUNCTION__);
01079                 return (EXIT_FAILURE);
01080         }
01081         if (circle->visibility > 1)
01082         {
01083                 fprintf (stderr,
01084                   (_("Error in %s () an out of range value was found in the visibility member.\n")),
01085                   __FUNCTION__);
01086                 return (EXIT_FAILURE);
01087         }
01088 #if DEBUG
01089         DXF_DEBUG_END
01090 #endif
01091         return (circle->visibility);
01092 }
01093 
01094 
01098 DxfCircle *
01099 dxf_circle_set_visibility
01100 (
01101         DxfCircle *circle,
01103         int16_t visibility
01105 )
01106 {
01107 #if DEBUG
01108         DXF_DEBUG_BEGIN
01109 #endif
01110         /* Do some basic checks. */
01111         if (circle == NULL)
01112         {
01113                 fprintf (stderr,
01114                   (_("Error in %s () a NULL pointer was passed.\n")),
01115                   __FUNCTION__);
01116                 return (NULL);
01117         }
01118         if (visibility < 0)
01119         {
01120                 fprintf (stderr,
01121                   (_("Error in %s () a negative visibility value was passed.\n")),
01122                   __FUNCTION__);
01123                 return (NULL);
01124         }
01125         if (visibility > 1)
01126         {
01127                 fprintf (stderr,
01128                   (_("Error in %s () an out of range visibility value was passed.\n")),
01129                   __FUNCTION__);
01130                 return (NULL);
01131         }
01132         circle->visibility = visibility;
01133 #if DEBUG
01134         DXF_DEBUG_END
01135 #endif
01136         return (circle);
01137 }
01138 
01139 
01145 int
01146 dxf_circle_get_color
01147 (
01148         DxfCircle *circle
01150 )
01151 {
01152 #if DEBUG
01153         DXF_DEBUG_BEGIN
01154 #endif
01155         /* Do some basic checks. */
01156         if (circle == NULL)
01157         {
01158                 fprintf (stderr,
01159                   (_("Error in %s () a NULL pointer was passed.\n")),
01160                   __FUNCTION__);
01161                 return (EXIT_FAILURE);
01162         }
01163         if (circle->color < 0)
01164         {
01165                 fprintf (stderr,
01166                   (_("Warning in %s () a negative value was found in the color member.\n")),
01167                   __FUNCTION__);
01168         }
01169 #if DEBUG
01170         DXF_DEBUG_END
01171 #endif
01172         return (circle->color);
01173 }
01174 
01175 
01179 DxfCircle *
01180 dxf_circle_set_color
01181 (
01182         DxfCircle *circle,
01184         int color
01186 )
01187 {
01188 #if DEBUG
01189         DXF_DEBUG_BEGIN
01190 #endif
01191         /* Do some basic checks. */
01192         if (circle == NULL)
01193         {
01194                 fprintf (stderr,
01195                   (_("Error in %s () a NULL pointer was passed.\n")),
01196                   __FUNCTION__);
01197                 return (NULL);
01198         }
01199         if (color < 0)
01200         {
01201                 fprintf (stderr,
01202                   (_("Warning in %s () a negative color value was passed.\n")),
01203                   __FUNCTION__);
01204                 fprintf (stderr,
01205                   (_("\teffectively turning this entity it's visibility off.\n")));
01206         }
01207         circle->color = color;
01208 #if DEBUG
01209         DXF_DEBUG_END
01210 #endif
01211         return (circle);
01212 }
01213 
01214 
01220 int
01221 dxf_circle_get_paperspace
01222 (
01223         DxfCircle *circle
01225 )
01226 {
01227 #if DEBUG
01228         DXF_DEBUG_BEGIN
01229 #endif
01230         /* Do some basic checks. */
01231         if (circle == NULL)
01232         {
01233                 fprintf (stderr,
01234                   (_("Error in %s () a NULL pointer was passed.\n")),
01235                   __FUNCTION__);
01236                 return (EXIT_FAILURE);
01237         }
01238         if (circle->paperspace < 0)
01239         {
01240                 fprintf (stderr,
01241                   (_("Warning in %s () a negative value was found in the paperspace member.\n")),
01242                   __FUNCTION__);
01243         }
01244         if (circle->paperspace > 1)
01245         {
01246                 fprintf (stderr,
01247                   (_("Warning in %s () an out of range value was found in the paperspace member.\n")),
01248                   __FUNCTION__);
01249         }
01250 #if DEBUG
01251         DXF_DEBUG_END
01252 #endif
01253         return (circle->paperspace);
01254 }
01255 
01256 
01260 DxfCircle *
01261 dxf_circle_set_paperspace
01262 (
01263         DxfCircle *circle,
01265         int paperspace
01267 )
01268 {
01269 #if DEBUG
01270         DXF_DEBUG_BEGIN
01271 #endif
01272         /* Do some basic checks. */
01273         if (circle == NULL)
01274         {
01275                 fprintf (stderr,
01276                   (_("Error in %s () a NULL pointer was passed.\n")),
01277                   __FUNCTION__);
01278                 return (NULL);
01279         }
01280         if (paperspace < 0)
01281         {
01282                 fprintf (stderr,
01283                   (_("Error in %s () a negative paperspace value was passed.\n")),
01284                   __FUNCTION__);
01285                 return (NULL);
01286         }
01287         if (paperspace > 1)
01288         {
01289                 fprintf (stderr,
01290                   (_("Error in %s () an out of range paperspace value was passed.\n")),
01291                   __FUNCTION__);
01292                 return (NULL);
01293         }
01294         circle->paperspace = paperspace;
01295 #if DEBUG
01296         DXF_DEBUG_END
01297 #endif
01298         return (circle);
01299 }
01300 
01301 
01309 int
01310 dxf_circle_get_graphics_data_size
01311 (
01312         DxfCircle *circle
01314 )
01315 {
01316 #if DEBUG
01317         DXF_DEBUG_BEGIN
01318 #endif
01319         /* Do some basic checks. */
01320         if (circle == NULL)
01321         {
01322                 fprintf (stderr,
01323                   (_("Error in %s () a NULL pointer was passed.\n")),
01324                   __FUNCTION__);
01325                 return (EXIT_FAILURE);
01326         }
01327         if (circle->graphics_data_size < 0)
01328         {
01329                 fprintf (stderr,
01330                   (_("Warning in %s () a negative value was found in the graphics_data_size member.\n")),
01331                   __FUNCTION__);
01332         }
01333         if (circle->graphics_data_size == 0)
01334         {
01335                 fprintf (stderr,
01336                   (_("Warning in %s () a zero value was found in the graphics_data_size member.\n")),
01337                   __FUNCTION__);
01338         }
01339 #if DEBUG
01340         DXF_DEBUG_END
01341 #endif
01342         return (circle->graphics_data_size);
01343 }
01344 
01345 
01352 DxfCircle *
01353 dxf_circle_set_graphics_data_size
01354 (
01355         DxfCircle *circle,
01357         int graphics_data_size
01360 )
01361 {
01362 #if DEBUG
01363         DXF_DEBUG_BEGIN
01364 #endif
01365         /* Do some basic checks. */
01366         if (circle == NULL)
01367         {
01368                 fprintf (stderr,
01369                   (_("Error in %s () a NULL pointer was passed.\n")),
01370                   __FUNCTION__);
01371                 return (NULL);
01372         }
01373         if (graphics_data_size < 0)
01374         {
01375                 fprintf (stderr,
01376                   (_("Error in %s () a negative graphics_data_size value was passed.\n")),
01377                   __FUNCTION__);
01378                 return (NULL);
01379         }
01380         if (graphics_data_size == 0)
01381         {
01382                 fprintf (stderr,
01383                   (_("Error in %s () a zero graphics_data_size value was passed.\n")),
01384                   __FUNCTION__);
01385                 return (NULL);
01386         }
01387         circle->graphics_data_size = graphics_data_size;
01388 #if DEBUG
01389         DXF_DEBUG_END
01390 #endif
01391         return (circle);
01392 }
01393 
01394 
01401 int16_t
01402 dxf_circle_get_shadow_mode
01403 (
01404         DxfCircle *circle
01406 )
01407 {
01408 #if DEBUG
01409         DXF_DEBUG_BEGIN
01410 #endif
01411         /* Do some basic checks. */
01412         if (circle == NULL)
01413         {
01414                 fprintf (stderr,
01415                   (_("Error in %s () a NULL pointer was passed.\n")),
01416                   __FUNCTION__);
01417                 return (EXIT_FAILURE);
01418         }
01419         if (circle->shadow_mode < 0)
01420         {
01421                 fprintf (stderr,
01422                   (_("Error in %s () a negative value was found in the shadow_mode member.\n")),
01423                   __FUNCTION__);
01424                 return (EXIT_FAILURE);
01425         }
01426         if (circle->shadow_mode > 3)
01427         {
01428                 fprintf (stderr,
01429                   (_("Error in %s () an out of range value was found in the shadow_mode member.\n")),
01430                   __FUNCTION__);
01431                 return (EXIT_FAILURE);
01432         }
01433 #if DEBUG
01434         DXF_DEBUG_END
01435 #endif
01436         return (circle->shadow_mode);
01437 }
01438 
01439 
01446 DxfCircle *
01447 dxf_circle_set_shadow_mode
01448 (
01449         DxfCircle *circle,
01451         int16_t shadow_mode
01453 )
01454 {
01455 #if DEBUG
01456         DXF_DEBUG_BEGIN
01457 #endif
01458         /* Do some basic checks. */
01459         if (circle == 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 shadow_mode 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 shadow_mode value was passed.\n")),
01477                   __FUNCTION__);
01478                 return (NULL);
01479         }
01480         circle->shadow_mode = shadow_mode;
01481 #if DEBUG
01482         DXF_DEBUG_END
01483 #endif
01484         return (circle);
01485 }
01486 
01487 
01496 DxfBinaryGraphicsData *
01497 dxf_circle_get_binary_graphics_data
01498 (
01499         DxfCircle *circle
01501 )
01502 {
01503 #if DEBUG
01504         DXF_DEBUG_BEGIN
01505 #endif
01506         /* Do some basic checks. */
01507         if (circle == NULL)
01508         {
01509                 fprintf (stderr,
01510                   (_("Error in %s () a NULL pointer was passed.\n")),
01511                   __FUNCTION__);
01512                 return (NULL);
01513         }
01514         if (circle->binary_graphics_data ==  NULL)
01515         {
01516                 fprintf (stderr,
01517                   (_("Error in %s () a NULL pointer was found in the binary_graphics_data member.\n")),
01518                   __FUNCTION__);
01519                 return (NULL);
01520         }
01521 #if DEBUG
01522         DXF_DEBUG_END
01523 #endif
01524         return ((DxfBinaryGraphicsData *) circle->binary_graphics_data);
01525 }
01526 
01527 
01535 DxfCircle *
01536 dxf_circle_set_binary_graphics_data
01537 (
01538         DxfCircle *circle,
01540         DxfBinaryGraphicsData *data
01543 )
01544 {
01545 #if DEBUG
01546         DXF_DEBUG_BEGIN
01547 #endif
01548         /* Do some basic checks. */
01549         if (circle == NULL)
01550         {
01551                 fprintf (stderr,
01552                   (_("Error in %s () a NULL pointer was passed.\n")),
01553                   __FUNCTION__);
01554                 return (NULL);
01555         }
01556         if (data == NULL)
01557         {
01558                 fprintf (stderr,
01559                   (_("Error in %s () a NULL pointer was passed.\n")),
01560                   __FUNCTION__);
01561                 return (NULL);
01562         }
01563         circle->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01564 #if DEBUG
01565         DXF_DEBUG_END
01566 #endif
01567         return (circle);
01568 }
01569 
01570 
01579 char *
01580 dxf_circle_get_dictionary_owner_soft
01581 (
01582         DxfCircle *circle
01584 )
01585 {
01586 #if DEBUG
01587         DXF_DEBUG_BEGIN
01588 #endif
01589         /* Do some basic checks. */
01590         if (circle == NULL)
01591         {
01592                 fprintf (stderr,
01593                   (_("Error in %s () a NULL pointer was passed.\n")),
01594                   __FUNCTION__);
01595                 return (NULL);
01596         }
01597         if (circle->dictionary_owner_soft ==  NULL)
01598         {
01599                 fprintf (stderr,
01600                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")),
01601                   __FUNCTION__);
01602                 return (NULL);
01603         }
01604 #if DEBUG
01605         DXF_DEBUG_END
01606 #endif
01607         return (strdup (circle->dictionary_owner_soft));
01608 }
01609 
01610 
01615 DxfCircle *
01616 dxf_circle_set_dictionary_owner_soft
01617 (
01618         DxfCircle *circle,
01620         char *dictionary_owner_soft
01623 )
01624 {
01625 #if DEBUG
01626         DXF_DEBUG_BEGIN
01627 #endif
01628         /* Do some basic checks. */
01629         if (circle == NULL)
01630         {
01631                 fprintf (stderr,
01632                   (_("Error in %s () a NULL pointer was passed.\n")),
01633                   __FUNCTION__);
01634                 return (NULL);
01635         }
01636         if (dictionary_owner_soft == NULL)
01637         {
01638                 fprintf (stderr,
01639                   (_("Error in %s () a NULL pointer was passed.\n")),
01640                   __FUNCTION__);
01641                 return (NULL);
01642         }
01643         circle->dictionary_owner_soft = strdup (dictionary_owner_soft);
01644 #if DEBUG
01645         DXF_DEBUG_END
01646 #endif
01647         return (circle);
01648 }
01649 
01650 
01660 char *
01661 dxf_circle_get_material
01662 (
01663         DxfCircle *circle
01665 )
01666 {
01667 #if DEBUG
01668         DXF_DEBUG_BEGIN
01669 #endif
01670         /* Do some basic checks. */
01671         if (circle == NULL)
01672         {
01673                 fprintf (stderr,
01674                   (_("Error in %s () a NULL pointer was passed.\n")),
01675                   __FUNCTION__);
01676                 return (NULL);
01677         }
01678         if (circle->material ==  NULL)
01679         {
01680                 fprintf (stderr,
01681                   (_("Error in %s () a NULL pointer was found in the material member.\n")),
01682                   __FUNCTION__);
01683                 return (NULL);
01684         }
01685 #if DEBUG
01686         DXF_DEBUG_END
01687 #endif
01688         return (strdup (circle->material));
01689 }
01690 
01691 
01698 DxfCircle *
01699 dxf_circle_set_material
01700 (
01701         DxfCircle *circle,
01703         char *material
01706 )
01707 {
01708 #if DEBUG
01709         DXF_DEBUG_BEGIN
01710 #endif
01711         /* Do some basic checks. */
01712         if (circle == NULL)
01713         {
01714                 fprintf (stderr,
01715                   (_("Error in %s () a NULL pointer was passed.\n")),
01716                   __FUNCTION__);
01717                 return (NULL);
01718         }
01719         if (material == NULL)
01720         {
01721                 fprintf (stderr,
01722                   (_("Error in %s () a NULL pointer was passed.\n")),
01723                   __FUNCTION__);
01724                 return (NULL);
01725         }
01726         circle->material = strdup (material);
01727 #if DEBUG
01728         DXF_DEBUG_END
01729 #endif
01730         return (circle);
01731 }
01732 
01733 
01742 char *
01743 dxf_circle_get_dictionary_owner_hard
01744 (
01745         DxfCircle *circle
01747 )
01748 {
01749 #if DEBUG
01750         DXF_DEBUG_BEGIN
01751 #endif
01752         /* Do some basic checks. */
01753         if (circle == NULL)
01754         {
01755                 fprintf (stderr,
01756                   (_("Error in %s () a NULL pointer was passed.\n")),
01757                   __FUNCTION__);
01758                 return (NULL);
01759         }
01760         if (circle->dictionary_owner_hard ==  NULL)
01761         {
01762                 fprintf (stderr,
01763                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")),
01764                   __FUNCTION__);
01765                 return (NULL);
01766         }
01767 #if DEBUG
01768         DXF_DEBUG_END
01769 #endif
01770         return (strdup (circle->dictionary_owner_hard));
01771 }
01772 
01773 
01778 DxfCircle *
01779 dxf_circle_set_dictionary_owner_hard
01780 (
01781         DxfCircle *circle,
01783         char *dictionary_owner_hard
01786 )
01787 {
01788 #if DEBUG
01789         DXF_DEBUG_BEGIN
01790 #endif
01791         /* Do some basic checks. */
01792         if (circle == NULL)
01793         {
01794                 fprintf (stderr,
01795                   (_("Error in %s () a NULL pointer was passed.\n")),
01796                   __FUNCTION__);
01797                 return (NULL);
01798         }
01799         if (dictionary_owner_hard == NULL)
01800         {
01801                 fprintf (stderr,
01802                   (_("Error in %s () a NULL pointer was passed.\n")),
01803                   __FUNCTION__);
01804                 return (NULL);
01805         }
01806         circle->dictionary_owner_hard = strdup (dictionary_owner_hard);
01807 #if DEBUG
01808         DXF_DEBUG_END
01809 #endif
01810         return (circle);
01811 }
01812 
01813 
01820 int16_t
01821 dxf_circle_get_lineweight
01822 (
01823         DxfCircle *circle
01825 )
01826 {
01827 #if DEBUG
01828         DXF_DEBUG_BEGIN
01829 #endif
01830         /* Do some basic checks. */
01831         if (circle == NULL)
01832         {
01833                 fprintf (stderr,
01834                   (_("Error in %s () a NULL pointer was passed.\n")),
01835                   __FUNCTION__);
01836                 return (EXIT_FAILURE);
01837         }
01838 #if DEBUG
01839         DXF_DEBUG_END
01840 #endif
01841         return (circle->lineweight);
01842 }
01843 
01844 
01851 DxfCircle *
01852 dxf_circle_set_lineweight
01853 (
01854         DxfCircle *circle,
01856         int16_t lineweight
01858 )
01859 {
01860 #if DEBUG
01861         DXF_DEBUG_BEGIN
01862 #endif
01863         /* Do some basic checks. */
01864         if (circle == NULL)
01865         {
01866                 fprintf (stderr,
01867                   (_("Error in %s () a NULL pointer was passed.\n")),
01868                   __FUNCTION__);
01869                 return (NULL);
01870         }
01871         circle->lineweight = lineweight;
01872 #if DEBUG
01873         DXF_DEBUG_END
01874 #endif
01875         return (circle);
01876 }
01877 
01878 
01885 char *
01886 dxf_circle_get_plot_style_name
01887 (
01888         DxfCircle *circle
01890 )
01891 {
01892 #if DEBUG
01893         DXF_DEBUG_BEGIN
01894 #endif
01895         /* Do some basic checks. */
01896         if (circle == NULL)
01897         {
01898                 fprintf (stderr,
01899                   (_("Error in %s () a NULL pointer was passed.\n")),
01900                   __FUNCTION__);
01901                 return (NULL);
01902         }
01903         if (circle->plot_style_name ==  NULL)
01904         {
01905                 fprintf (stderr,
01906                   (_("Error in %s () a NULL pointer was found in the plot_style_name member.\n")),
01907                   __FUNCTION__);
01908                 return (NULL);
01909         }
01910 #if DEBUG
01911         DXF_DEBUG_END
01912 #endif
01913         return (strdup (circle->plot_style_name));
01914 }
01915 
01916 
01923 DxfCircle *
01924 dxf_circle_set_plot_style_name
01925 (
01926         DxfCircle *circle,
01928         char *plot_style_name
01931 )
01932 {
01933 #if DEBUG
01934         DXF_DEBUG_BEGIN
01935 #endif
01936         /* Do some basic checks. */
01937         if (circle == NULL)
01938         {
01939                 fprintf (stderr,
01940                   (_("Error in %s () a NULL pointer was passed.\n")),
01941                   __FUNCTION__);
01942                 return (NULL);
01943         }
01944         if (plot_style_name == NULL)
01945         {
01946                 fprintf (stderr,
01947                   (_("Error in %s () a NULL pointer was passed.\n")),
01948                   __FUNCTION__);
01949                 return (NULL);
01950         }
01951         circle->plot_style_name = strdup (plot_style_name);
01952 #if DEBUG
01953         DXF_DEBUG_END
01954 #endif
01955         return (circle);
01956 }
01957 
01958 
01965 long
01966 dxf_circle_get_color_value
01967 (
01968         DxfCircle *circle
01970 )
01971 {
01972 #if DEBUG
01973         DXF_DEBUG_BEGIN
01974 #endif
01975         /* Do some basic checks. */
01976         if (circle == NULL)
01977         {
01978                 fprintf (stderr,
01979                   (_("Error in %s () a NULL pointer was passed.\n")),
01980                   __FUNCTION__);
01981                 return (EXIT_FAILURE);
01982         }
01983 #if DEBUG
01984         DXF_DEBUG_END
01985 #endif
01986         return (circle->color_value);
01987 }
01988 
01989 
01996 DxfCircle *
01997 dxf_circle_set_color_value
01998 (
01999         DxfCircle *circle,
02001         long color_value
02003 )
02004 {
02005 #if DEBUG
02006         DXF_DEBUG_BEGIN
02007 #endif
02008         /* Do some basic checks. */
02009         if (circle == NULL)
02010         {
02011                 fprintf (stderr,
02012                   (_("Error in %s () a NULL pointer was passed.\n")),
02013                   __FUNCTION__);
02014                 return (NULL);
02015         }
02016         circle->color_value = color_value;
02017 #if DEBUG
02018         DXF_DEBUG_END
02019 #endif
02020         return (circle);
02021 }
02022 
02023 
02030 char *
02031 dxf_circle_get_color_name
02032 (
02033         DxfCircle *circle
02035 )
02036 {
02037 #if DEBUG
02038         DXF_DEBUG_BEGIN
02039 #endif
02040         /* Do some basic checks. */
02041         if (circle == NULL)
02042         {
02043                 fprintf (stderr,
02044                   (_("Error in %s () a NULL pointer was passed.\n")),
02045                   __FUNCTION__);
02046                 return (NULL);
02047         }
02048         if (circle->color_name ==  NULL)
02049         {
02050                 fprintf (stderr,
02051                   (_("Error in %s () a NULL pointer was found in the color_name member.\n")),
02052                   __FUNCTION__);
02053                 return (NULL);
02054         }
02055 #if DEBUG
02056         DXF_DEBUG_END
02057 #endif
02058         return (strdup (circle->color_name));
02059 }
02060 
02061 
02068 DxfCircle *
02069 dxf_circle_set_color_name
02070 (
02071         DxfCircle *circle,
02073         char *color_name
02076 )
02077 {
02078 #if DEBUG
02079         DXF_DEBUG_BEGIN
02080 #endif
02081         /* Do some basic checks. */
02082         if (circle == NULL)
02083         {
02084                 fprintf (stderr,
02085                   (_("Error in %s () a NULL pointer was passed.\n")),
02086                   __FUNCTION__);
02087                 return (NULL);
02088         }
02089         if (color_name == NULL)
02090         {
02091                 fprintf (stderr,
02092                   (_("Error in %s () a NULL pointer was passed.\n")),
02093                   __FUNCTION__);
02094                 return (NULL);
02095         }
02096         circle->color_name = strdup (color_name);
02097 #if DEBUG
02098         DXF_DEBUG_END
02099 #endif
02100         return (circle);
02101 }
02102 
02103 
02110 long
02111 dxf_circle_get_transparency
02112 (
02113         DxfCircle *circle
02115 )
02116 {
02117 #if DEBUG
02118         DXF_DEBUG_BEGIN
02119 #endif
02120         /* Do some basic checks. */
02121         if (circle == NULL)
02122         {
02123                 fprintf (stderr,
02124                   (_("Error in %s () a NULL pointer was passed.\n")),
02125                   __FUNCTION__);
02126                 return (EXIT_FAILURE);
02127         }
02128 #if DEBUG
02129         DXF_DEBUG_END
02130 #endif
02131         return (circle->transparency);
02132 }
02133 
02134 
02141 DxfCircle *
02142 dxf_circle_set_transparency
02143 (
02144         DxfCircle *circle,
02146         long transparency
02148 )
02149 {
02150 #if DEBUG
02151         DXF_DEBUG_BEGIN
02152 #endif
02153         /* Do some basic checks. */
02154         if (circle == NULL)
02155         {
02156                 fprintf (stderr,
02157                   (_("Error in %s () a NULL pointer was passed.\n")),
02158                   __FUNCTION__);
02159                 return (NULL);
02160         }
02161         circle->transparency = transparency;
02162 #if DEBUG
02163         DXF_DEBUG_END
02164 #endif
02165         return (circle);
02166 }
02167 
02168 
02174 DxfPoint *
02175 dxf_circle_get_p0
02176 (
02177         DxfCircle *circle
02179 )
02180 {
02181 #ifdef DEBUG
02182         DXF_DEBUG_BEGIN
02183 #endif
02184         /* Do some basic checks. */
02185         if (circle == NULL)
02186         {
02187                 fprintf (stderr,
02188                   (_("Error in %s () a NULL pointer was passed.\n")),
02189                   __FUNCTION__);
02190                 return (NULL);
02191         }
02192         if (circle->p0 == NULL)
02193         {
02194                 fprintf (stderr,
02195                   (_("Error in %s () a NULL pointer was passed.\n")),
02196                   __FUNCTION__);
02197                 return (NULL);
02198         }
02199 #if DEBUG
02200         DXF_DEBUG_END
02201 #endif
02202         return (circle->p0);
02203 }
02204 
02205 
02211 DxfCircle *
02212 dxf_circle_set_p0
02213 (
02214         DxfCircle *circle,
02216         DxfPoint *point
02218 )
02219 {
02220 #ifdef DEBUG
02221         DXF_DEBUG_BEGIN
02222 #endif
02223         /* Do some basic checks. */
02224         if (circle == NULL)
02225         {
02226                 fprintf (stderr,
02227                   (_("Error in %s () a NULL pointer was passed.\n")),
02228                   __FUNCTION__);
02229                 return (NULL);
02230         }
02231         if (point == NULL)
02232         {
02233                 fprintf (stderr,
02234                   (_("Error in %s () a NULL pointer was passed.\n")),
02235                   __FUNCTION__);
02236                 return (NULL);
02237         }
02238         circle->p0 = (DxfPoint *) point;
02239 #if DEBUG
02240         DXF_DEBUG_END
02241 #endif
02242         return (circle);
02243 }
02244 
02245 
02252 double
02253 dxf_circle_get_x0
02254 (
02255         DxfCircle *circle
02257 )
02258 {
02259 #ifdef DEBUG
02260         DXF_DEBUG_BEGIN
02261 #endif
02262 
02263         /* Do some basic checks. */
02264         if (circle == NULL)
02265         {
02266                 fprintf (stderr,
02267                   (_("Error in %s () a NULL pointer was passed.\n")),
02268                   __FUNCTION__);
02269                 return (EXIT_FAILURE);
02270         }
02271         if (circle->p0 == NULL)
02272         {
02273                 fprintf (stderr,
02274                   (_("Error in %s () a NULL pointer was passed.\n")),
02275                   __FUNCTION__);
02276                 return (EXIT_FAILURE);
02277         }
02278 #if DEBUG
02279         DXF_DEBUG_END
02280 #endif
02281         return (circle->p0->x0);
02282 }
02283 
02284 
02292 DxfCircle *
02293 dxf_circle_set_x0
02294 (
02295         DxfCircle *circle,
02297         double x0
02300 )
02301 {
02302 #ifdef DEBUG
02303         DXF_DEBUG_BEGIN
02304 #endif
02305         /* Do some basic checks. */
02306         if (circle == NULL)
02307         {
02308                 fprintf (stderr,
02309                   (_("Error in %s () a NULL pointer was passed.\n")),
02310                   __FUNCTION__);
02311                 return (NULL);
02312         }
02313         if (circle->p0 == NULL)
02314         {
02315                 fprintf (stderr,
02316                   (_("Error in %s () a NULL pointer was passed.\n")),
02317                   __FUNCTION__);
02318                 return (NULL);
02319         }
02320         circle->p0->x0 = x0;
02321 #if DEBUG
02322         DXF_DEBUG_END
02323 #endif
02324         return (circle);
02325 }
02326 
02327 
02334 double
02335 dxf_circle_get_y0
02336 (
02337         DxfCircle *circle
02339 )
02340 {
02341 #ifdef DEBUG
02342         DXF_DEBUG_BEGIN
02343 #endif
02344 
02345         /* Do some basic checks. */
02346         if (circle == NULL)
02347         {
02348                 fprintf (stderr,
02349                   (_("Error in %s () a NULL pointer was passed.\n")),
02350                   __FUNCTION__);
02351                 return (EXIT_FAILURE);
02352         }
02353         if (circle->p0 == NULL)
02354         {
02355                 fprintf (stderr,
02356                   (_("Error in %s () a NULL pointer was passed.\n")),
02357                   __FUNCTION__);
02358                 return (EXIT_FAILURE);
02359         }
02360 #if DEBUG
02361         DXF_DEBUG_END
02362 #endif
02363         return (circle->p0->y0);
02364 }
02365 
02366 
02374 DxfCircle *
02375 dxf_circle_set_y0
02376 (
02377         DxfCircle *circle,
02379         double y0
02382 )
02383 {
02384 #ifdef DEBUG
02385         DXF_DEBUG_BEGIN
02386 #endif
02387         /* Do some basic checks. */
02388         if (circle == NULL)
02389         {
02390                 fprintf (stderr,
02391                   (_("Error in %s () a NULL pointer was passed.\n")),
02392                   __FUNCTION__);
02393                 return (NULL);
02394         }
02395         if (circle->p0 == NULL)
02396         {
02397                 fprintf (stderr,
02398                   (_("Error in %s () a NULL pointer was passed.\n")),
02399                   __FUNCTION__);
02400                 return (NULL);
02401         }
02402         circle->p0->y0 = y0;
02403 #if DEBUG
02404         DXF_DEBUG_END
02405 #endif
02406         return (circle);
02407 }
02408 
02409 
02416 double
02417 dxf_circle_get_z0
02418 (
02419         DxfCircle *circle
02421 )
02422 {
02423 #ifdef DEBUG
02424         DXF_DEBUG_BEGIN
02425 #endif
02426 
02427         /* Do some basic checks. */
02428         if (circle == NULL)
02429         {
02430                 fprintf (stderr,
02431                   (_("Error in %s () a NULL pointer was passed.\n")),
02432                   __FUNCTION__);
02433                 return (EXIT_FAILURE);
02434         }
02435         if (circle->p0 == NULL)
02436         {
02437                 fprintf (stderr,
02438                   (_("Error in %s () a NULL pointer was passed.\n")),
02439                   __FUNCTION__);
02440                 return (EXIT_FAILURE);
02441         }
02442 #if DEBUG
02443         DXF_DEBUG_END
02444 #endif
02445         return (circle->p0->z0);
02446 }
02447 
02448 
02456 DxfCircle *
02457 dxf_circle_set_z0
02458 (
02459         DxfCircle *circle,
02461         double z0
02464 )
02465 {
02466 #ifdef DEBUG
02467         DXF_DEBUG_BEGIN
02468 #endif
02469         /* Do some basic checks. */
02470         if (circle == NULL)
02471         {
02472                 fprintf (stderr,
02473                   (_("Error in %s () a NULL pointer was passed.\n")),
02474                   __FUNCTION__);
02475                 return (NULL);
02476         }
02477         if (circle->p0 == NULL)
02478         {
02479                 fprintf (stderr,
02480                   (_("Error in %s () a NULL pointer was passed.\n")),
02481                   __FUNCTION__);
02482                 return (NULL);
02483         }
02484         circle->p0->z0 = z0;
02485 #if DEBUG
02486         DXF_DEBUG_END
02487 #endif
02488         return (circle);
02489 }
02490 
02491 
02497 double
02498 dxf_circle_get_radius
02499 (
02500         DxfCircle *circle
02502 )
02503 {
02504 #if DEBUG
02505         DXF_DEBUG_BEGIN
02506 #endif
02507         /* Do some basic checks. */
02508         if (circle == NULL)
02509         {
02510                 fprintf (stderr,
02511                   (_("Error in %s () a NULL pointer was passed.\n")),
02512                   __FUNCTION__);
02513                 return (EXIT_FAILURE);
02514         }
02515         if (circle->radius < 0.0)
02516         {
02517                 fprintf (stderr,
02518                   (_("Error in %s () a negative value was found in the radius member.\n")),
02519                   __FUNCTION__);
02520                 return (EXIT_FAILURE);
02521         }
02522         if (circle->radius == 0.0)
02523         {
02524                 fprintf (stderr,
02525                   (_("Error in %s () a value of zero was found in the radius member.\n")),
02526                   __FUNCTION__);
02527                 return (EXIT_FAILURE);
02528         }
02529 #if DEBUG
02530         DXF_DEBUG_END
02531 #endif
02532         return (circle->radius);
02533 }
02534 
02535 
02539 DxfCircle *
02540 dxf_circle_set_radius
02541 (
02542         DxfCircle *circle,
02544         double radius
02546 )
02547 {
02548 #if DEBUG
02549         DXF_DEBUG_BEGIN
02550 #endif
02551         /* Do some basic checks. */
02552         if (circle == NULL)
02553         {
02554                 fprintf (stderr,
02555                   (_("Error in %s () a NULL pointer was passed.\n")),
02556                   __FUNCTION__);
02557                 return (NULL);
02558         }
02559         if (radius < 0.0)
02560         {
02561                 fprintf (stderr,
02562                   (_("Error in %s () a negative radius value was passed.\n")),
02563                   __FUNCTION__);
02564                 return (NULL);
02565         }
02566         if (radius == 0.0)
02567         {
02568                 fprintf (stderr,
02569                   (_("Error in %s () a value of zero was passed.\n")),
02570                   __FUNCTION__);
02571                 return (NULL);
02572         }
02573         circle->radius = radius;
02574 #if DEBUG
02575         DXF_DEBUG_END
02576 #endif
02577         return (circle);
02578 }
02579 
02580 
02589 DxfPoint *
02590 dxf_circle_get_extrusion_vector_as_point
02591 (
02592         DxfCircle *circle
02594 )
02595 {
02596 #ifdef DEBUG
02597         DXF_DEBUG_BEGIN
02598 #endif
02599         DxfPoint *point = NULL;
02600 
02601         /* Do some basic checks. */
02602         if (circle == NULL)
02603         {
02604                 fprintf (stderr,
02605                   (_("Error in %s () a NULL pointer was passed.\n")),
02606                   __FUNCTION__);
02607                 return (NULL);
02608         }
02609         point = dxf_point_init (point);
02610         if (point == NULL)
02611         {
02612               fprintf (stderr,
02613                   (_("Error in %s () could not allocate memory for a DxfPoint struct.\n")),
02614                 __FUNCTION__);
02615               return (NULL);
02616         }
02617         point->x0 = circle->extr_x0;
02618         point->y0 = circle->extr_y0;
02619         point->z0 = circle->extr_z0;
02620 #if DEBUG
02621         DXF_DEBUG_END
02622 #endif
02623         return (point);
02624 }
02625 
02626 
02630 DxfCircle *
02631 dxf_circle_set_extrusion_vector
02632 (
02633         DxfCircle *circle,
02635         double extr_x0,
02637         double extr_y0,
02639         double extr_z0
02641 )
02642 {
02643 #if DEBUG
02644         DXF_DEBUG_BEGIN
02645 #endif
02646         /* Do some basic checks. */
02647         if (circle == NULL)
02648         {
02649                 fprintf (stderr,
02650                   (_("Error in %s () a NULL pointer was passed.\n")),
02651                   __FUNCTION__);
02652                 return (NULL);
02653         }
02654         circle->extr_x0 = extr_x0;
02655         circle->extr_y0 = extr_y0;
02656         circle->extr_z0 = extr_z0;
02657 #if DEBUG
02658         DXF_DEBUG_END
02659 #endif
02660         return (circle);
02661 }
02662 
02663 
02669 double
02670 dxf_circle_get_extr_x0
02671 (
02672         DxfCircle *circle
02674 )
02675 {
02676 #if DEBUG
02677         DXF_DEBUG_BEGIN
02678 #endif
02679         /* Do some basic checks. */
02680         if (circle == NULL)
02681         {
02682                 fprintf (stderr,
02683                   (_("Error in %s () a NULL pointer was passed.\n")),
02684                   __FUNCTION__);
02685                 return (EXIT_FAILURE);
02686         }
02687 #if DEBUG
02688         DXF_DEBUG_END
02689 #endif
02690         return (circle->extr_x0);
02691 }
02692 
02693 
02697 DxfCircle *
02698 dxf_circle_set_extr_x0
02699 (
02700         DxfCircle *circle,
02702         double extr_x0
02704 )
02705 {
02706 #if DEBUG
02707         DXF_DEBUG_BEGIN
02708 #endif
02709         /* Do some basic checks. */
02710         if (circle == NULL)
02711         {
02712                 fprintf (stderr,
02713                   (_("Error in %s () a NULL pointer was passed.\n")),
02714                   __FUNCTION__);
02715                 return (NULL);
02716         }
02717         circle->extr_x0 = extr_x0;
02718 #if DEBUG
02719         DXF_DEBUG_END
02720 #endif
02721         return (circle);
02722 }
02723 
02724 
02730 double
02731 dxf_circle_get_extr_y0
02732 (
02733         DxfCircle *circle
02735 )
02736 {
02737 #if DEBUG
02738         DXF_DEBUG_BEGIN
02739 #endif
02740         /* Do some basic checks. */
02741         if (circle == NULL)
02742         {
02743                 fprintf (stderr,
02744                   (_("Error in %s () a NULL pointer was passed.\n")),
02745                   __FUNCTION__);
02746                 return (EXIT_FAILURE);
02747         }
02748 #if DEBUG
02749         DXF_DEBUG_END
02750 #endif
02751         return (circle->extr_y0);
02752 }
02753 
02754 
02758 DxfCircle *
02759 dxf_circle_set_extr_y0
02760 (
02761         DxfCircle *circle,
02763         double extr_y0
02765 )
02766 {
02767 #if DEBUG
02768         DXF_DEBUG_BEGIN
02769 #endif
02770         /* Do some basic checks. */
02771         if (circle == NULL)
02772         {
02773                 fprintf (stderr,
02774                   (_("Error in %s () a NULL pointer was passed.\n")),
02775                   __FUNCTION__);
02776                 return (NULL);
02777         }
02778         circle->extr_y0 = extr_y0;
02779 #if DEBUG
02780         DXF_DEBUG_END
02781 #endif
02782         return (circle);
02783 }
02784 
02785 
02791 double
02792 dxf_circle_get_extr_z0
02793 (
02794         DxfCircle *circle
02796 )
02797 {
02798 #if DEBUG
02799         DXF_DEBUG_BEGIN
02800 #endif
02801         /* Do some basic checks. */
02802         if (circle == NULL)
02803         {
02804                 fprintf (stderr,
02805                   (_("Error in %s () a NULL pointer was passed.\n")),
02806                   __FUNCTION__);
02807                 return (EXIT_FAILURE);
02808         }
02809 #if DEBUG
02810         DXF_DEBUG_END
02811 #endif
02812         return (circle->extr_z0);
02813 }
02814 
02815 
02819 DxfCircle *
02820 dxf_circle_set_extr_z0
02821 (
02822         DxfCircle *circle,
02824         double extr_z0
02826 )
02827 {
02828 #if DEBUG
02829         DXF_DEBUG_BEGIN
02830 #endif
02831         /* Do some basic checks. */
02832         if (circle == NULL)
02833         {
02834                 fprintf (stderr,
02835                   (_("Error in %s () a NULL pointer was passed.\n")),
02836                   __FUNCTION__);
02837                 return (NULL);
02838         }
02839         circle->extr_z0 = extr_z0;
02840 #if DEBUG
02841         DXF_DEBUG_END
02842 #endif
02843         return (circle);
02844 }
02845 
02846 
02852 double
02853 dxf_circle_get_area
02854 (
02855         DxfCircle *circle
02857 )
02858 {
02859 #if DEBUG
02860         DXF_DEBUG_BEGIN
02861 #endif
02862         /* Do some basic checks. */
02863         if (circle == NULL)
02864         {
02865                 fprintf (stderr,
02866                   (_("Error in %s () a NULL pointer was passed.\n")),
02867                   __FUNCTION__);
02868                 return (EXIT_FAILURE);
02869         }
02870         if (circle->radius < 0.0)
02871         {
02872                 fprintf (stderr,
02873                   (_("Error in %s () a negative value was found in the radius member.\n")),
02874                   __FUNCTION__);
02875                 return (EXIT_FAILURE);
02876         }
02877         if (circle->radius == 0.0)
02878         {
02879                 fprintf (stderr,
02880                   (_("Error in %s () a value of zero was found in the radius member.\n")),
02881                   __FUNCTION__);
02882                 return (EXIT_FAILURE);
02883         }
02884 #if DEBUG
02885         DXF_DEBUG_END
02886 #endif
02887         return (M_PI * circle->radius * circle->radius);
02888 }
02889 
02890 
02896 double
02897 dxf_circle_get_circumference
02898 (
02899         DxfCircle *circle
02901 )
02902 {
02903 #if DEBUG
02904         DXF_DEBUG_BEGIN
02905 #endif
02906         /* Do some basic checks. */
02907         if (circle == NULL)
02908         {
02909                 fprintf (stderr,
02910                   (_("Error in %s () a NULL pointer was passed.\n")),
02911                   __FUNCTION__);
02912                 return (EXIT_FAILURE);
02913         }
02914         if (circle->radius < 0.0)
02915         {
02916                 fprintf (stderr,
02917                   (_("Error in %s () a negative value was found in the radius member.\n")),
02918                   __FUNCTION__);
02919                 return (EXIT_FAILURE);
02920         }
02921         if (circle->radius == 0.0)
02922         {
02923                 fprintf (stderr,
02924                   (_("Error in %s () a value of zero was found in the radius member.\n")),
02925                   __FUNCTION__);
02926                 return (EXIT_FAILURE);
02927         }
02928 #if DEBUG
02929         DXF_DEBUG_END
02930 #endif
02931         return (2 * M_PI * circle->radius);
02932 }
02933 
02934 
02945 int
02946 dxf_circle_test_point_in_circle
02947 (
02948         DxfPoint *point,
02950         DxfCircle *circle
02952 )
02953 {
02954         double dy;
02955         double dx;
02956 
02957 #if DEBUG
02958         DXF_DEBUG_BEGIN
02959 #endif
02960         /* Do some basic checks. */
02961         if (circle == NULL)
02962         {
02963                 fprintf (stderr,
02964                   (_("Error in %s () a NULL pointer was passed.\n")),
02965                   __FUNCTION__);
02966                 return (EXIT_FAILURE);
02967         }
02968         if (circle->radius < 0.0)
02969         {
02970                 fprintf (stderr,
02971                   (_("Error in %s () a negative value was found in the radius member.\n")),
02972                   __FUNCTION__);
02973                 return (EXIT_FAILURE);
02974         }
02975         if (circle->radius == 0.0)
02976         {
02977                 fprintf (stderr,
02978                   (_("Error in %s () a value of zero was found in the radius member.\n")),
02979                   __FUNCTION__);
02980                 return (EXIT_FAILURE);
02981         }
02982         dx = circle->p0->x0 - point->x0;
02983         dy = circle->p0->y0 - point->y0;
02984         /* "<" to not include the edge */
02985         if (dx * dx + dy * dy < circle->radius * circle->radius)
02986                 return (INSIDE);
02987         /* ">" to not include the edge */
02988         else if (dx * dx + dy * dy > circle->radius * circle->radius)
02989                 return (OUTSIDE);
02990         /* "==" to detect on edge */
02991         else if (dx * dx + dy * dy == circle->radius * circle->radius)
02992                 return (ON_EDGE);
02993 #if DEBUG
02994         DXF_DEBUG_END
02995 #endif
02996         /* dead code */
02997         return (EXIT_FAILURE);
02998 }
02999 
03000 
03009 DxfCircle *
03010 dxf_circle_get_next
03011 (
03012         DxfCircle *circle
03014 )
03015 {
03016 #if DEBUG
03017         DXF_DEBUG_BEGIN
03018 #endif
03019         /* Do some basic checks. */
03020         if (circle == NULL)
03021         {
03022                 fprintf (stderr,
03023                   (_("Error in %s () a NULL pointer was passed.\n")),
03024                   __FUNCTION__);
03025                 return (NULL);
03026         }
03027         if (circle->next == NULL)
03028         {
03029                 fprintf (stderr,
03030                   (_("Error in %s () a NULL pointer was found in the next member.\n")),
03031                   __FUNCTION__);
03032                 return (NULL);
03033         }
03034 #if DEBUG
03035         DXF_DEBUG_END
03036 #endif
03037         return ((DxfCircle *) circle->next);
03038 }
03039 
03040 
03045 DxfCircle *
03046 dxf_circle_set_next
03047 (
03048         DxfCircle *circle,
03050         DxfCircle *next
03052 )
03053 {
03054 #if DEBUG
03055         DXF_DEBUG_BEGIN
03056 #endif
03057         /* Do some basic checks. */
03058         if (circle == NULL)
03059         {
03060                 fprintf (stderr,
03061                   (_("Error in %s () a NULL pointer was passed.\n")),
03062                   __FUNCTION__);
03063                 return (NULL);
03064         }
03065         if (next == NULL)
03066         {
03067                 fprintf (stderr,
03068                   (_("Error in %s () a NULL pointer was passed.\n")),
03069                   __FUNCTION__);
03070                 return (NULL);
03071         }
03072         circle->next = (struct DxfCircle *) next;
03073 #if DEBUG
03074         DXF_DEBUG_END
03075 #endif
03076         return (circle);
03077 }
03078 
03079 
03088 DxfCircle *
03089 dxf_circle_get_last
03090 (
03091         DxfCircle *circle
03093 )
03094 {
03095 #if DEBUG
03096         DXF_DEBUG_BEGIN
03097 #endif
03098         /* Do some basic checks. */
03099         if (circle == NULL)
03100         {
03101                 fprintf (stderr,
03102                   (_("Error in %s () a NULL pointer was passed.\n")),
03103                   __FUNCTION__);
03104                 return (NULL);
03105         }
03106         if (circle->next == NULL)
03107         {
03108                 fprintf (stderr,
03109                   (_("Warning in %s () a NULL pointer was found in the next member.\n")),
03110                   __FUNCTION__);
03111                 return ((DxfCircle *) circle);
03112         }
03113         DxfCircle *iter = (DxfCircle *) circle->next;
03114         while (iter->next != NULL)
03115         {
03116                 iter = (DxfCircle *) iter->next;
03117         }
03118 #if DEBUG
03119         DXF_DEBUG_END
03120 #endif
03121         return ((DxfCircle *) iter);
03122 }
03123 
03124 
03125 /* EOF */