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

shape.c

Go to the documentation of this file.
00001 
00044 #include "shape.h"
00045 
00046 
00055 DxfShape *
00056 dxf_shape_new ()
00057 {
00058 #if DEBUG
00059         DXF_DEBUG_BEGIN
00060 #endif
00061         DxfShape *shape = NULL;
00062         size_t size;
00063 
00064         size = sizeof (DxfShape);
00065         /* avoid malloc of 0 bytes */
00066         if (size == 0) size = 1;
00067         if ((shape = malloc (size)) == NULL)
00068         {
00069                 fprintf (stderr,
00070                   (_("Error in %s () could not allocate memory for a DxfShape struct.\n")),
00071                   __FUNCTION__);
00072                 shape = NULL;
00073         }
00074         else
00075         {
00076                 memset (shape, 0, size);
00077         }
00078 #if DEBUG
00079         DXF_DEBUG_END
00080 #endif
00081         return (shape);
00082 }
00083 
00084 
00092 DxfShape *
00093 dxf_shape_init
00094 (
00095         DxfShape *shape
00097 )
00098 {
00099 #if DEBUG
00100         DXF_DEBUG_BEGIN
00101 #endif
00102         /* Do some basic checks. */
00103         if (shape == NULL)
00104         {
00105                 fprintf (stderr,
00106                   (_("Warning in %s () a NULL pointer was passed.\n")),
00107                   __FUNCTION__);
00108                 shape = dxf_shape_new ();
00109         }
00110         if (shape == NULL)
00111         {
00112               fprintf (stderr,
00113                 (_("Error in %s () could not allocate memory for a DxfShape struct.\n")),
00114                 __FUNCTION__);
00115               return (NULL);
00116         }
00117         shape->id_code = 0;
00118         shape->linetype = strdup (DXF_DEFAULT_LINETYPE);
00119         shape->layer = strdup (DXF_DEFAULT_LAYER);
00120         shape->elevation = 0.0;
00121         shape->thickness = 0.0;
00122         shape->linetype_scale = DXF_DEFAULT_LINETYPE_SCALE;
00123         shape->visibility = DXF_DEFAULT_VISIBILITY;
00124         shape->color = DXF_COLOR_BYLAYER;
00125         shape->paperspace = DXF_MODELSPACE;
00126         shape->graphics_data_size = 0;
00127         shape->shadow_mode = 0;
00128         shape->binary_graphics_data = dxf_binary_graphics_data_new ();
00129         shape->binary_graphics_data = dxf_binary_graphics_data_init (shape->binary_graphics_data);
00130         shape->dictionary_owner_soft = strdup ("");
00131         shape->material = strdup ("");
00132         shape->dictionary_owner_hard = strdup ("");
00133         shape->lineweight = 0;
00134         shape->plot_style_name = strdup ("");
00135         shape->color_value = 0;
00136         shape->color_name = strdup ("");
00137         shape->transparency = 0;
00138         shape->shape_name = strdup ("");
00139         shape->p0->x0 = 0.0;
00140         shape->p0->y0 = 0.0;
00141         shape->p0->z0 = 0.0;
00142         shape->size = 0.0;
00143         shape->rel_x_scale = 0.0;
00144         shape->rot_angle = 0.0;
00145         shape->obl_angle = 0.0;
00146         shape->extr_x0 = 0.0;
00147         shape->extr_y0 = 0.0;
00148         shape->extr_z0 = 0.0;
00149         shape->next = NULL;
00150 #if DEBUG
00151         DXF_DEBUG_END
00152 #endif
00153         return (shape);
00154 }
00155 
00156 
00167 DxfShape *
00168 dxf_shape_read
00169 (
00170         DxfFile *fp,
00172         DxfShape *shape
00174 )
00175 {
00176 #if DEBUG
00177         DXF_DEBUG_BEGIN
00178 #endif
00179         char *temp_string = NULL;
00180         char *dxf_entity_name = strdup ("SHAPE");
00181 
00182         /* Do some basic checks. */
00183         if (fp == NULL)
00184         {
00185                 fprintf (stderr,
00186                   (_("Error in %s () a NULL file pointer was passed.\n")),
00187                   __FUNCTION__);
00188                 /* Clean up. */
00189                 free (temp_string);
00190                 return (NULL);
00191         }
00192         if (shape == NULL)
00193         {
00194                 fprintf (stderr,
00195                   (_("Warning in %s () a NULL pointer was passed.\n")),
00196                   __FUNCTION__);
00197                 shape = dxf_shape_new ();
00198                 shape = dxf_shape_init (shape);
00199         }
00200         (fp->line_number)++;
00201         fscanf (fp->fp, "%[^\n]", temp_string);
00202         while (strcmp (temp_string, "0") != 0)
00203         {
00204                 if (ferror (fp->fp))
00205                 {
00206                         fprintf (stderr,
00207                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00208                           __FUNCTION__, fp->filename, fp->line_number);
00209                         fclose (fp->fp);
00210                         /* Clean up. */
00211                         free (temp_string);
00212                         return (NULL);
00213                 }
00214                 if (strcmp (temp_string, "2") == 0)
00215                 {
00216                         /* Now follows a string containing a shape
00217                          * name. */
00218                         (fp->line_number)++;
00219                         fscanf (fp->fp, "%s\n", shape->shape_name);
00220                 }
00221                 else if (strcmp (temp_string, "5") == 0)
00222                 {
00223                         /* Now follows a string containing a sequential
00224                          * id number. */
00225                         (fp->line_number)++;
00226                         fscanf (fp->fp, "%x\n", &shape->id_code);
00227                 }
00228                 else if (strcmp (temp_string, "6") == 0)
00229                 {
00230                         /* Now follows a string containing a linetype
00231                          * name. */
00232                         (fp->line_number)++;
00233                         fscanf (fp->fp, "%s\n", shape->linetype);
00234                 }
00235                 else if (strcmp (temp_string, "8") == 0)
00236                 {
00237                         /* Now follows a string containing a layer name. */
00238                         (fp->line_number)++;
00239                         fscanf (fp->fp, "%s\n", shape->layer);
00240                 }
00241                 else if (strcmp (temp_string, "10") == 0)
00242                 {
00243                         /* Now follows a string containing the
00244                          * X-coordinate of the insertion point. */
00245                         (fp->line_number)++;
00246                         fscanf (fp->fp, "%lf\n", &shape->p0->x0);
00247                 }
00248                 else if (strcmp (temp_string, "20") == 0)
00249                 {
00250                         /* Now follows a string containing the
00251                          * Y-coordinate of the insertion point. */
00252                         (fp->line_number)++;
00253                         fscanf (fp->fp, "%lf\n", &shape->p0->y0);
00254                 }
00255                 else if (strcmp (temp_string, "30") == 0)
00256                 {
00257                         /* Now follows a string containing the
00258                          * Z-coordinate of the insertion point. */
00259                         (fp->line_number)++;
00260                         fscanf (fp->fp, "%lf\n", &shape->p0->z0);
00261                 }
00262                 else if (strcmp (temp_string, "38") == 0)
00263                 {
00264                         /* Now follows a string containing the
00265                          * elevation. */
00266                         (fp->line_number)++;
00267                         fscanf (fp->fp, "%lf\n", &shape->elevation);
00268                 }
00269                 else if (strcmp (temp_string, "39") == 0)
00270                 {
00271                         /* Now follows a string containing the
00272                          * thickness. */
00273                         (fp->line_number)++;
00274                         fscanf (fp->fp, "%lf\n", &shape->thickness);
00275                 }
00276                 else if (strcmp (temp_string, "40") == 0)
00277                 {
00278                         /* Now follows a string containing the
00279                          * size. */
00280                         (fp->line_number)++;
00281                         fscanf (fp->fp, "%lf\n", &shape->size);
00282                 }
00283                 else if (strcmp (temp_string, "41") == 0)
00284                 {
00285                         /* Now follows a string containing the
00286                          * relative X scale. */
00287                         (fp->line_number)++;
00288                         fscanf (fp->fp, "%lf\n", &shape->rel_x_scale);
00289                 }
00290                 else if (strcmp (temp_string, "48") == 0)
00291                 {
00292                         /* Now follows a string containing the linetype
00293                          * scale. */
00294                         (fp->line_number)++;
00295                         fscanf (fp->fp, "%lf\n", &shape->linetype_scale);
00296                 }
00297                 else if (strcmp (temp_string, "50") == 0)
00298                 {
00299                         /* Now follows a string containing the
00300                          * rotation angle. */
00301                         (fp->line_number)++;
00302                         fscanf (fp->fp, "%lf\n", &shape->rot_angle);
00303                 }
00304                 else if (strcmp (temp_string, "51") == 0)
00305                 {
00306                         /* Now follows a string containing the
00307                          * oblique angle. */
00308                         (fp->line_number)++;
00309                         fscanf (fp->fp, "%lf\n", &shape->obl_angle);
00310                 }
00311                 else if (strcmp (temp_string, "60") == 0)
00312                 {
00313                         /* Now follows a string containing the
00314                          * visibility value. */
00315                         (fp->line_number)++;
00316                         fscanf (fp->fp, "%hd\n", &shape->visibility);
00317                 }
00318                 else if (strcmp (temp_string, "62") == 0)
00319                 {
00320                         /* Now follows a string containing the
00321                          * color value. */
00322                         (fp->line_number)++;
00323                         fscanf (fp->fp, "%d\n", &shape->color);
00324                 }
00325                 else if (strcmp (temp_string, "67") == 0)
00326                 {
00327                         /* Now follows a string containing the
00328                          * paperspace value. */
00329                         (fp->line_number)++;
00330                         fscanf (fp->fp, "%d\n", &shape->paperspace);
00331                 }
00332                 else if (strcmp (temp_string, "92") == 0)
00333                 {
00334                         /* Now follows a string containing the
00335                          * graphics data size value. */
00336                         (fp->line_number)++;
00337                         fscanf (fp->fp, "%d\n", &shape->graphics_data_size);
00338                 }
00339                 else if ((fp->acad_version_number >= AutoCAD_13)
00340                         && (strcmp (temp_string, "100") == 0))
00341                 {
00342                         /* Now follows a string containing the
00343                          * subclass marker value. */
00344                         (fp->line_number)++;
00345                         fscanf (fp->fp, "%s\n", temp_string);
00346                         if ((strcmp (temp_string, "AcDbEntity") != 0)
00347                         && ((strcmp (temp_string, "AcDbShape") != 0)))
00348                         {
00349                                 fprintf (stderr,
00350                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00351                                   __FUNCTION__, fp->filename, fp->line_number);
00352                         }
00353                 }
00354                 else if (strcmp (temp_string, "210") == 0)
00355                 {
00356                         /* Now follows a string containing the
00357                          * X-value of the extrusion vector. */
00358                         (fp->line_number)++;
00359                         fscanf (fp->fp, "%lf\n", &shape->extr_x0);
00360                 }
00361                 else if (strcmp (temp_string, "220") == 0)
00362                 {
00363                         /* Now follows a string containing the
00364                          * Y-value of the extrusion vector. */
00365                         (fp->line_number)++;
00366                         fscanf (fp->fp, "%lf\n", &shape->extr_y0);
00367                 }
00368                 else if (strcmp (temp_string, "230") == 0)
00369                 {
00370                         /* Now follows a string containing the
00371                          * Z-value of the extrusion vector. */
00372                         (fp->line_number)++;
00373                         fscanf (fp->fp, "%lf\n", &shape->extr_z0);
00374                 }
00375                 else if (strcmp (temp_string, "284") == 0)
00376                 {
00377                         /* Now follows a string containing the shadow
00378                          * mode value. */
00379                         (fp->line_number)++;
00380                         fscanf (fp->fp, "%hd\n", &shape->shadow_mode);
00381                 }
00382                 else if (strcmp (temp_string, "310") == 0)
00383                 {
00384                         /* Now follows a string containing binary
00385                          * graphics data. */
00386                         (fp->line_number)++;
00387                         fscanf (fp->fp, "%s\n", shape->binary_graphics_data->data_line);
00388                         dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) shape->binary_graphics_data->next);
00389                         shape->binary_graphics_data = (DxfBinaryGraphicsData *) shape->binary_graphics_data->next;
00390                 }
00391                 else if (strcmp (temp_string, "330") == 0)
00392                 {
00393                         /* Now follows a string containing Soft-pointer
00394                          * ID/handle to owner dictionary. */
00395                         (fp->line_number)++;
00396                         fscanf (fp->fp, "%s\n", shape->dictionary_owner_soft);
00397                 }
00398                 else if (strcmp (temp_string, "347") == 0)
00399                 {
00400                         /* Now follows a string containing a
00401                          * hard-pointer ID/handle to material object. */
00402                         (fp->line_number)++;
00403                         fscanf (fp->fp, "%s\n", shape->material);
00404                 }
00405                 else if (strcmp (temp_string, "360") == 0)
00406                 {
00407                         /* Now follows a string containing Hard owner
00408                          * ID/handle to owner dictionary. */
00409                         (fp->line_number)++;
00410                         fscanf (fp->fp, "%s\n", shape->dictionary_owner_hard);
00411                 }
00412                 else if (strcmp (temp_string, "370") == 0)
00413                 {
00414                         /* Now follows a string containing the lineweight
00415                          * value. */
00416                         (fp->line_number)++;
00417                         fscanf (fp->fp, "%hd\n", &shape->lineweight);
00418                 }
00419                 else if (strcmp (temp_string, "390") == 0)
00420                 {
00421                         /* Now follows a string containing a plot style
00422                          * name value. */
00423                         (fp->line_number)++;
00424                         fscanf (fp->fp, "%s\n", shape->plot_style_name);
00425                 }
00426                 else if (strcmp (temp_string, "420") == 0)
00427                 {
00428                         /* Now follows a string containing a color value. */
00429                         (fp->line_number)++;
00430                         fscanf (fp->fp, "%ld\n", &shape->color_value);
00431                 }
00432                 else if (strcmp (temp_string, "430") == 0)
00433                 {
00434                         /* Now follows a string containing a color
00435                          * name value. */
00436                         (fp->line_number)++;
00437                         fscanf (fp->fp, "%s\n", shape->color_name);
00438                 }
00439                 else if (strcmp (temp_string, "440") == 0)
00440                 {
00441                         /* Now follows a string containing a transparency
00442                          * value. */
00443                         (fp->line_number)++;
00444                         fscanf (fp->fp, "%ld\n", &shape->transparency);
00445                 }
00446                 else if (strcmp (temp_string, "999") == 0)
00447                 {
00448                         /* Now follows a string containing a comment. */
00449                         (fp->line_number)++;
00450                         fscanf (fp->fp, "%s\n", temp_string);
00451                         fprintf (stdout, "DXF comment: %s\n", temp_string);
00452                 }
00453                 else
00454                 {
00455                         fprintf (stderr,
00456                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00457                           __FUNCTION__, fp->filename, fp->line_number);
00458                 }
00459         }
00460         /* Handle omitted members and/or illegal values. */
00461         if (strcmp (shape->shape_name, "") == 0)
00462         {
00463                 fprintf (stderr,
00464                   (_("Error in %s () empty name string for the %s entity with id-code: %x\n")),
00465                   __FUNCTION__, dxf_entity_name, shape->id_code);
00466                 return (NULL);
00467         }
00468         if (strcmp (shape->linetype, "") == 0)
00469         {
00470                 shape->linetype = strdup (DXF_DEFAULT_LINETYPE);
00471         }
00472         if (strcmp (shape->layer, "") == 0)
00473         {
00474                 shape->layer = strdup (DXF_DEFAULT_LAYER);
00475         }
00476         /* Clean up. */
00477         free (temp_string);
00478 #if DEBUG
00479         DXF_DEBUG_END
00480 #endif
00481         return (shape);
00482 }
00483 
00484 
00491 int
00492 dxf_shape_write
00493 (
00494         DxfFile *fp,
00496         DxfShape *shape
00498 )
00499 {
00500 #if DEBUG
00501         DXF_DEBUG_BEGIN
00502 #endif
00503         char *dxf_entity_name = strdup ("SHAPE");
00504 
00505         /* Do some basic checks. */
00506         if (fp == NULL)
00507         {
00508                 fprintf (stderr,
00509                   (_("Error in %s () a NULL file pointer was passed.\n")),
00510                   __FUNCTION__);
00511                 /* Clean up. */
00512                 free (dxf_entity_name);
00513                 return (EXIT_FAILURE);
00514         }
00515         if (shape == NULL)
00516         {
00517                 fprintf (stderr,
00518                   (_("Error in %s () a NULL pointer was passed.\n")),
00519                   __FUNCTION__);
00520                 /* Clean up. */
00521                 free (dxf_entity_name);
00522                 return (EXIT_FAILURE);
00523         }
00524         if (strcmp (shape->shape_name, "") == 0)
00525         {
00526                 fprintf (stderr,
00527                   (_("Error in %s () empty name string for the %s entity with id-code: %x\n")),
00528                   __FUNCTION__, dxf_entity_name, shape->id_code);
00529                 /* Clean up. */
00530                 free (dxf_entity_name);
00531                 return (EXIT_FAILURE);
00532         }
00533         if (strcmp (shape->linetype, "") == 0)
00534         {
00535                 fprintf (stderr,
00536                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00537                   __FUNCTION__, dxf_entity_name, shape->id_code);
00538                 fprintf (stderr,
00539                   (_("\t%s entity is reset to default linetype")),
00540                   dxf_entity_name);
00541                 shape->linetype = strdup (DXF_DEFAULT_LINETYPE);
00542         }
00543         if (strcmp (shape->layer, "") == 0)
00544         {
00545                 fprintf (stderr,
00546                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")),
00547                   __FUNCTION__, dxf_entity_name, shape->id_code);
00548                 fprintf (stderr,
00549                   (_("\t%s entity is relocated to layer 0")),
00550                   dxf_entity_name);
00551                 shape->layer = strdup (DXF_DEFAULT_LAYER);
00552         }
00553         if (shape->size == 0.0)
00554         {
00555                 fprintf (stderr,
00556                   (_("Warning in %s () size has a value of 0.0 for the %s entity with id-code: %x\n")),
00557                   __FUNCTION__, dxf_entity_name, shape->id_code);
00558         }
00559         if (shape->rel_x_scale == 0.0)
00560         {
00561                 fprintf (stderr,
00562                   (_("Warning: in %s () relative X-scale factor has a value of 0.0 for the %s entity with id-code: %x\n")),
00563                   __FUNCTION__, dxf_entity_name, shape->id_code);
00564         }
00565         /* Start writing output. */
00566         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00567         if (shape->id_code != -1)
00568         {
00569                 fprintf (fp->fp, "  5\n%x\n", shape->id_code);
00570         }
00581         if ((strcmp (shape->dictionary_owner_soft, "") != 0)
00582           && (fp->acad_version_number >= AutoCAD_14))
00583         {
00584                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00585                 fprintf (fp->fp, "330\n%s\n", shape->dictionary_owner_soft);
00586                 fprintf (fp->fp, "102\n}\n");
00587         }
00588         if ((strcmp (shape->dictionary_owner_hard, "") != 0)
00589           && (fp->acad_version_number >= AutoCAD_14))
00590         {
00591                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00592                 fprintf (fp->fp, "360\n%s\n", shape->dictionary_owner_hard);
00593                 fprintf (fp->fp, "102\n}\n");
00594         }
00595         if (fp->acad_version_number >= AutoCAD_13)
00596         {
00597                 fprintf (fp->fp, "100\nAcDbEntity\n");
00598         }
00599         if (shape->paperspace == DXF_PAPERSPACE)
00600         {
00601                 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE);
00602         }
00603         fprintf (fp->fp, "  8\n%s\n", shape->layer);
00604         if (strcmp (shape->linetype, DXF_DEFAULT_LINETYPE) != 0)
00605         {
00606                 fprintf (fp->fp, "  6\n%s\n", shape->linetype);
00607         }
00608         if ((fp->acad_version_number >= AutoCAD_2008)
00609           && (strcmp (shape->material, "") != 0))
00610         {
00611                 fprintf (fp->fp, "347\n%s\n", shape->material);
00612         }
00613         if (shape->color != DXF_COLOR_BYLAYER)
00614         {
00615                 fprintf (fp->fp, " 62\n%d\n", shape->color);
00616         }
00617         if (fp->acad_version_number >= AutoCAD_2002)
00618         {
00619                 fprintf (fp->fp, "370\n%d\n", shape->lineweight);
00620         }
00621         if ((fp->acad_version_number <= AutoCAD_11)
00622           && DXF_FLATLAND
00623           && (shape->elevation != 0.0))
00624         {
00625                 fprintf (fp->fp, " 38\n%f\n", shape->elevation);
00626         }
00627         if ((fp->acad_version_number <= AutoCAD_13)
00628           && (shape->thickness != 0.0))
00629         {
00630                 fprintf (fp->fp, " 39\n%f\n", shape->thickness);
00631         }
00632         if (shape->linetype_scale != 1.0)
00633         {
00634                 fprintf (fp->fp, " 48\n%f\n", shape->linetype_scale);
00635         }
00636         if (shape->visibility != 0)
00637         {
00638                 fprintf (fp->fp, " 60\n%d\n", shape->visibility);
00639         }
00640         if ((fp->acad_version_number >= AutoCAD_2000)
00641           && (shape->graphics_data_size > 0))
00642         {
00643 #ifdef BUILD_64
00644                 fprintf (fp->fp, "160\n%d\n", shape->graphics_data_size);
00645 #else
00646                 fprintf (fp->fp, " 92\n%d\n", shape->graphics_data_size);
00647 #endif
00648                 if (shape->binary_graphics_data != NULL)
00649                 {
00650                         DxfBinaryGraphicsData *iter;
00651                         iter = (DxfBinaryGraphicsData *) shape->binary_graphics_data;
00652                         while (iter != NULL)
00653                         {
00654                                 fprintf (fp->fp, "310\n%s\n", dxf_binary_graphics_data_get_data_line (iter));
00655                                 iter = (DxfBinaryGraphicsData *) dxf_binary_graphics_data_get_next (iter);
00656                         }
00657                 }
00658         }
00659         if (fp->acad_version_number >= AutoCAD_2004)
00660         {
00661                 fprintf (fp->fp, "420\n%ld\n", shape->color_value);
00662                 fprintf (fp->fp, "430\n%s\n", shape->color_name);
00663                 fprintf (fp->fp, "440\n%ld\n", shape->transparency);
00664         }
00665         if (fp->acad_version_number >= AutoCAD_2009)
00666         {
00667                 fprintf (fp->fp, "390\n%s\n", shape->plot_style_name);
00668                 fprintf (fp->fp, "284\n%d\n", shape->shadow_mode);
00669         }
00670         if (fp->acad_version_number >= AutoCAD_13)
00671         {
00672                 fprintf (fp->fp, "100\nAcDbShape\n");
00673         }
00674         if (shape->thickness != 0.0)
00675         {
00676                 fprintf (fp->fp, " 39\n%f\n", shape->thickness);
00677         }
00678         fprintf (fp->fp, " 10\n%f\n", shape->x0);
00679         fprintf (fp->fp, " 20\n%f\n", shape->y0);
00680         fprintf (fp->fp, " 30\n%f\n", shape->z0);
00681         fprintf (fp->fp, " 40\n%f\n", shape->size);
00682         fprintf (fp->fp, "  2\n%s\n", shape->shape_name);
00683         if (shape->rot_angle != 0.0)
00684         {
00685                 fprintf (fp->fp, " 50\n%f\n", shape->rot_angle);
00686         }
00687         if (shape->rel_x_scale != 1.0)
00688         {
00689                 fprintf (fp->fp, " 41\n%f\n", shape->rel_x_scale);
00690         }
00691         if (shape->obl_angle != 0.0)
00692         {
00693                 fprintf (fp->fp, " 51\n%f\n", shape->obl_angle);
00694         }
00695         if ((fp->acad_version_number >= AutoCAD_12)
00696                 && (shape->extr_x0 != 0.0)
00697                 && (shape->extr_y0 != 0.0)
00698                 && (shape->extr_z0 != 1.0))
00699         {
00700                 fprintf (fp->fp, "210\n%f\n", shape->extr_x0);
00701                 fprintf (fp->fp, "220\n%f\n", shape->extr_y0);
00702                 fprintf (fp->fp, "230\n%f\n", shape->extr_z0);
00703         }
00704         /* Clean up. */
00705         free (dxf_entity_name);
00706 #if DEBUG
00707         DXF_DEBUG_END
00708 #endif
00709         return (EXIT_SUCCESS);
00710 }
00711 
00712 
00720 int
00721 dxf_shape_free
00722 (
00723         DxfShape *shape
00726 )
00727 {
00728 #if DEBUG
00729         DXF_DEBUG_BEGIN
00730 #endif
00731         /* Do some basic checks. */
00732         if (shape == NULL)
00733         {
00734                 fprintf (stderr,
00735                   (_("Error in %s () a NULL pointer was passed.\n")),
00736                   __FUNCTION__);
00737                 return (EXIT_FAILURE);
00738         }
00739         if (shape->next != NULL)
00740         {
00741                 fprintf (stderr,
00742                   (_("Error in %s () pointer to next was not NULL.\n")),
00743                   __FUNCTION__);
00744                 return (EXIT_FAILURE);
00745         }
00746         free (shape->linetype);
00747         free (shape->layer);
00748         dxf_binary_graphics_data_free_chain (shape->binary_graphics_data);
00749         free (shape->dictionary_owner_soft);
00750         free (shape->material);
00751         free (shape->dictionary_owner_hard);
00752         free (shape->plot_style_name);
00753         free (shape->color_name);
00754         free (shape->shape_name);
00755         dxf_point_free (shape->p0);
00756         free (shape);
00757         shape = NULL;
00758 #if DEBUG
00759         DXF_DEBUG_END
00760 #endif
00761         return (EXIT_SUCCESS);
00762 }
00763 
00764 
00769 void
00770 dxf_shape_free_chain
00771 (
00772         DxfShape *shapes
00774 )
00775 {
00776 #ifdef DEBUG
00777         DXF_DEBUG_BEGIN
00778 #endif
00779         if (shapes == NULL)
00780         {
00781                 fprintf (stderr,
00782                   (_("Warning in %s () a NULL pointer was passed.\n")),
00783                   __FUNCTION__);
00784         }
00785         while (shapes != NULL)
00786         {
00787                 struct DxfShape *iter = shapes->next;
00788                 dxf_shape_free (shapes);
00789                 shapes = (DxfShape *) iter;
00790         }
00791 #if DEBUG
00792         DXF_DEBUG_END
00793 #endif
00794 }
00795 
00796 
00802 int
00803 dxf_shape_get_id_code
00804 (
00805         DxfShape *shape
00807 )
00808 {
00809 #if DEBUG
00810         DXF_DEBUG_BEGIN
00811 #endif
00812         /* Do some basic checks. */
00813         if (shape == NULL)
00814         {
00815                 fprintf (stderr,
00816                   (_("Error in %s () a NULL pointer was passed.\n")),
00817                   __FUNCTION__);
00818                 return (EXIT_FAILURE);
00819         }
00820         if (shape->id_code < 0)
00821         {
00822                 fprintf (stderr,
00823                   (_("Warning in %s () a negative value was found.\n")),
00824                   __FUNCTION__);
00825         }
00826 #if DEBUG
00827         DXF_DEBUG_END
00828 #endif
00829         return (shape->id_code);
00830 }
00831 
00832 
00836 DxfShape *
00837 dxf_shape_set_id_code
00838 (
00839         DxfShape *shape,
00841         int id_code
00845 )
00846 {
00847 #if DEBUG
00848         DXF_DEBUG_BEGIN
00849 #endif
00850         /* Do some basic checks. */
00851         if (shape == NULL)
00852         {
00853                 fprintf (stderr,
00854                   (_("Error in %s () a NULL pointer was passed.\n")),
00855                   __FUNCTION__);
00856                 return (NULL);
00857         }
00858         if (id_code < 0)
00859         {
00860                 fprintf (stderr,
00861                   (_("Warning in %s () a negative value was passed.\n")),
00862                   __FUNCTION__);
00863         }
00864         shape->id_code = id_code;
00865 #if DEBUG
00866         DXF_DEBUG_END
00867 #endif
00868         return (shape);
00869 }
00870 
00871 
00877 char *
00878 dxf_shape_get_linetype
00879 (
00880         DxfShape *shape
00882 )
00883 {
00884 #if DEBUG
00885         DXF_DEBUG_BEGIN
00886 #endif
00887         /* Do some basic checks. */
00888         if (shape == NULL)
00889         {
00890                 fprintf (stderr,
00891                   (_("Error in %s () a NULL pointer was passed.\n")),
00892                   __FUNCTION__);
00893                 return (NULL);
00894         }
00895         if (shape->linetype ==  NULL)
00896         {
00897                 fprintf (stderr,
00898                   (_("Error in %s () a NULL pointer was found.\n")),
00899                   __FUNCTION__);
00900                 return (NULL);
00901         }
00902 #if DEBUG
00903         DXF_DEBUG_END
00904 #endif
00905         return (strdup (shape->linetype));
00906 }
00907 
00908 
00912 DxfShape *
00913 dxf_shape_set_linetype
00914 (
00915         DxfShape *shape,
00917         char *linetype
00920 )
00921 {
00922 #if DEBUG
00923         DXF_DEBUG_BEGIN
00924 #endif
00925         /* Do some basic checks. */
00926         if (shape == NULL)
00927         {
00928                 fprintf (stderr,
00929                   (_("Error in %s () a NULL pointer was passed.\n")),
00930                   __FUNCTION__);
00931                 return (NULL);
00932         }
00933         if (linetype == NULL)
00934         {
00935                 fprintf (stderr,
00936                   (_("Error in %s () a NULL pointer was passed.\n")),
00937                   __FUNCTION__);
00938                 return (NULL);
00939         }
00940         shape->linetype = strdup (linetype);
00941 #if DEBUG
00942         DXF_DEBUG_END
00943 #endif
00944         return (shape);
00945 }
00946 
00947 
00953 char *
00954 dxf_shape_get_layer
00955 (
00956         DxfShape *shape
00958 )
00959 {
00960 #if DEBUG
00961         DXF_DEBUG_BEGIN
00962 #endif
00963         /* Do some basic checks. */
00964         if (shape == NULL)
00965         {
00966                 fprintf (stderr,
00967                   (_("Error in %s () a NULL pointer was passed.\n")),
00968                   __FUNCTION__);
00969                 return (NULL);
00970         }
00971         if (shape->layer ==  NULL)
00972         {
00973                 fprintf (stderr,
00974                   (_("Error in %s () a NULL pointer was found.\n")),
00975                   __FUNCTION__);
00976                 return (NULL);
00977         }
00978 #if DEBUG
00979         DXF_DEBUG_END
00980 #endif
00981         return (strdup (shape->layer));
00982 }
00983 
00984 
00988 DxfShape *
00989 dxf_shape_set_layer
00990 (
00991         DxfShape *shape,
00993         char *layer
00996 )
00997 {
00998 #if DEBUG
00999         DXF_DEBUG_BEGIN
01000 #endif
01001         /* Do some basic checks. */
01002         if (shape == NULL)
01003         {
01004                 fprintf (stderr,
01005                   (_("Error in %s () a NULL pointer was passed.\n")),
01006                   __FUNCTION__);
01007                 return (NULL);
01008         }
01009         if (layer == NULL)
01010         {
01011                 fprintf (stderr,
01012                   (_("Error in %s () a NULL pointer was passed.\n")),
01013                   __FUNCTION__);
01014                 return (NULL);
01015         }
01016         shape->layer = strdup (layer);
01017 #if DEBUG
01018         DXF_DEBUG_END
01019 #endif
01020         return (shape);
01021 }
01022 
01023 
01029 double
01030 dxf_shape_get_elevation
01031 (
01032         DxfShape *shape
01034 )
01035 {
01036 #if DEBUG
01037         DXF_DEBUG_BEGIN
01038 #endif
01039         /* Do some basic checks. */
01040         if (shape == NULL)
01041         {
01042                 fprintf (stderr,
01043                   (_("Error in %s () a NULL pointer was passed.\n")),
01044                   __FUNCTION__);
01045                 return (EXIT_FAILURE);
01046         }
01047 #if DEBUG
01048         DXF_DEBUG_END
01049 #endif
01050         return (shape->elevation);
01051 }
01052 
01053 
01057 DxfShape *
01058 dxf_shape_set_elevation
01059 (
01060         DxfShape *shape,
01062         double elevation
01064 )
01065 {
01066 #if DEBUG
01067         DXF_DEBUG_BEGIN
01068 #endif
01069         /* Do some basic checks. */
01070         if (shape == NULL)
01071         {
01072                 fprintf (stderr,
01073                   (_("Error in %s () a NULL pointer was passed.\n")),
01074                   __FUNCTION__);
01075                 return (NULL);
01076         }
01077         shape->elevation = elevation;
01078 #if DEBUG
01079         DXF_DEBUG_END
01080 #endif
01081         return (shape);
01082 }
01083 
01084 
01090 double
01091 dxf_shape_get_thickness
01092 (
01093         DxfShape *shape
01095 )
01096 {
01097 #if DEBUG
01098         DXF_DEBUG_BEGIN
01099 #endif
01100         /* Do some basic checks. */
01101         if (shape == NULL)
01102         {
01103                 fprintf (stderr,
01104                   (_("Error in %s () a NULL pointer was passed.\n")),
01105                   __FUNCTION__);
01106                 return (EXIT_FAILURE);
01107         }
01108         if (shape->thickness < 0.0)
01109         {
01110                 fprintf (stderr,
01111                   (_("Error in %s () a negative value was found.\n")),
01112                   __FUNCTION__);
01113                 return (EXIT_FAILURE);
01114         }
01115 #if DEBUG
01116         DXF_DEBUG_END
01117 #endif
01118         return (shape->thickness);
01119 }
01120 
01121 
01125 DxfShape *
01126 dxf_shape_set_thickness
01127 (
01128         DxfShape *shape,
01130         double thickness
01132 )
01133 {
01134 #if DEBUG
01135         DXF_DEBUG_BEGIN
01136 #endif
01137         /* Do some basic checks. */
01138         if (shape == NULL)
01139         {
01140                 fprintf (stderr,
01141                   (_("Error in %s () a NULL pointer was passed.\n")),
01142                   __FUNCTION__);
01143                 return (NULL);
01144         }
01145         if (thickness < 0.0)
01146         {
01147                 fprintf (stderr,
01148                   (_("Error in %s () a negative value was passed.\n")),
01149                   __FUNCTION__);
01150                 return (NULL);
01151         }
01152         shape->thickness = thickness;
01153 #if DEBUG
01154         DXF_DEBUG_END
01155 #endif
01156         return (shape);
01157 }
01158 
01159 
01165 double
01166 dxf_shape_get_linetype_scale
01167 (
01168         DxfShape *shape
01170 )
01171 {
01172 #if DEBUG
01173         DXF_DEBUG_BEGIN
01174 #endif
01175         /* Do some basic checks. */
01176         if (shape == NULL)
01177         {
01178                 fprintf (stderr,
01179                   (_("Error in %s () a NULL pointer was passed.\n")),
01180                   __FUNCTION__);
01181                 return (EXIT_FAILURE);
01182         }
01183         if (shape->linetype_scale < 0.0)
01184         {
01185                 fprintf (stderr,
01186                   (_("Warning in %s () a negative value was found.\n")),
01187                   __FUNCTION__);
01188         }
01189 #if DEBUG
01190         DXF_DEBUG_END
01191 #endif
01192         return (shape->linetype_scale);
01193 }
01194 
01195 
01199 DxfShape *
01200 dxf_shape_set_linetype_scale
01201 (
01202         DxfShape *shape,
01204         double linetype_scale
01206 )
01207 {
01208 #if DEBUG
01209         DXF_DEBUG_BEGIN
01210 #endif
01211         /* Do some basic checks. */
01212         if (shape == NULL)
01213         {
01214                 fprintf (stderr,
01215                   (_("Error in %s () a NULL pointer was passed.\n")),
01216                   __FUNCTION__);
01217                 return (NULL);
01218         }
01219         if (linetype_scale < 0.0)
01220         {
01221                 fprintf (stderr,
01222                   (_("Error in %s () a negative value was passed.\n")),
01223                   __FUNCTION__);
01224                 return (NULL);
01225         }
01226         shape->linetype_scale = linetype_scale;
01227 #if DEBUG
01228         DXF_DEBUG_END
01229 #endif
01230         return (shape);
01231 }
01232 
01233 
01239 int16_t
01240 dxf_shape_get_visibility
01241 (
01242         DxfShape *shape
01244 )
01245 {
01246 #if DEBUG
01247         DXF_DEBUG_BEGIN
01248 #endif
01249         /* Do some basic checks. */
01250         if (shape == NULL)
01251         {
01252                 fprintf (stderr,
01253                   (_("Error in %s () a NULL pointer was passed.\n")),
01254                   __FUNCTION__);
01255                 return (EXIT_FAILURE);
01256         }
01257         if (shape->visibility < 0)
01258         {
01259                 fprintf (stderr,
01260                   (_("Warning in %s () a negative value was found.\n")),
01261                   __FUNCTION__);
01262         }
01263         if (shape->visibility > 1)
01264         {
01265                 fprintf (stderr,
01266                   (_("Warning in %s () an out of range value was found.\n")),
01267                   __FUNCTION__);
01268         }
01269 #if DEBUG
01270         DXF_DEBUG_END
01271 #endif
01272         return (shape->visibility);
01273 }
01274 
01275 
01279 DxfShape *
01280 dxf_shape_set_visibility
01281 (
01282         DxfShape *shape,
01284         int16_t visibility
01286 )
01287 {
01288 #if DEBUG
01289         DXF_DEBUG_BEGIN
01290 #endif
01291         /* Do some basic checks. */
01292         if (shape == NULL)
01293         {
01294                 fprintf (stderr,
01295                   (_("Error in %s () a NULL pointer was passed.\n")),
01296                   __FUNCTION__);
01297                 return (NULL);
01298         }
01299         if (visibility < 0)
01300         {
01301                 fprintf (stderr,
01302                   (_("Warning in %s () a negative value was passed.\n")),
01303                   __FUNCTION__);
01304         }
01305         if (visibility > 1)
01306         {
01307                 fprintf (stderr,
01308                   (_("Warning in %s () an out of range value was passed.\n")),
01309                   __FUNCTION__);
01310         }
01311         shape->visibility = visibility;
01312 #if DEBUG
01313         DXF_DEBUG_END
01314 #endif
01315         return (shape);
01316 }
01317 
01318 
01324 int
01325 dxf_shape_get_color
01326 (
01327         DxfShape *shape
01329 )
01330 {
01331 #if DEBUG
01332         DXF_DEBUG_BEGIN
01333 #endif
01334         /* Do some basic checks. */
01335         if (shape == NULL)
01336         {
01337                 fprintf (stderr,
01338                   (_("Error in %s () a NULL pointer was passed.\n")),
01339                   __FUNCTION__);
01340                 return (EXIT_FAILURE);
01341         }
01342         if (shape->color < 0)
01343         {
01344                 fprintf (stderr,
01345                   (_("Warning in %s () a negative value was found.\n")),
01346                   __FUNCTION__);
01347         }
01348 #if DEBUG
01349         DXF_DEBUG_END
01350 #endif
01351         return (shape->color);
01352 }
01353 
01354 
01358 DxfShape *
01359 dxf_shape_set_color
01360 (
01361         DxfShape *shape,
01363         int color
01365 )
01366 {
01367 #if DEBUG
01368         DXF_DEBUG_BEGIN
01369 #endif
01370         /* Do some basic checks. */
01371         if (shape == NULL)
01372         {
01373                 fprintf (stderr,
01374                   (_("Error in %s () a NULL pointer was passed.\n")),
01375                   __FUNCTION__);
01376                 return (NULL);
01377         }
01378         if (color < 0)
01379         {
01380                 fprintf (stderr,
01381                   (_("Warning in %s () a negative value was passed.\n")),
01382                   __FUNCTION__);
01383         }
01384         shape->color = color;
01385 #if DEBUG
01386         DXF_DEBUG_END
01387 #endif
01388         return (shape);
01389 }
01390 
01391 
01397 int
01398 dxf_shape_get_paperspace
01399 (
01400         DxfShape *shape
01402 )
01403 {
01404 #if DEBUG
01405         DXF_DEBUG_BEGIN
01406 #endif
01407         /* Do some basic checks. */
01408         if (shape == NULL)
01409         {
01410                 fprintf (stderr,
01411                   (_("Error in %s () a NULL pointer was passed.\n")),
01412                   __FUNCTION__);
01413                 return (EXIT_FAILURE);
01414         }
01415         if (shape->paperspace < 0)
01416         {
01417                 fprintf (stderr,
01418                   (_("Warning in %s () a negative value was found.\n")),
01419                   __FUNCTION__);
01420         }
01421         if (shape->paperspace > 1)
01422         {
01423                 fprintf (stderr,
01424                   (_("Warning in %s () an out of range value was found.\n")),
01425                   __FUNCTION__);
01426         }
01427 #if DEBUG
01428         DXF_DEBUG_END
01429 #endif
01430         return (shape->paperspace);
01431 }
01432 
01433 
01437 DxfShape *
01438 dxf_shape_set_paperspace
01439 (
01440         DxfShape *shape,
01442         int paperspace
01445 )
01446 {
01447 #if DEBUG
01448         DXF_DEBUG_BEGIN
01449 #endif
01450         /* Do some basic checks. */
01451         if (shape == NULL)
01452         {
01453                 fprintf (stderr,
01454                   (_("Error in %s () a NULL pointer was passed.\n")),
01455                   __FUNCTION__);
01456                 return (NULL);
01457         }
01458         if (paperspace < 0)
01459         {
01460                 fprintf (stderr,
01461                   (_("Warning in %s () a negative value was passed.\n")),
01462                   __FUNCTION__);
01463         }
01464         if (paperspace > 1)
01465         {
01466                 fprintf (stderr,
01467                   (_("Warning in %s () an out of range value was passed.\n")),
01468                   __FUNCTION__);
01469         }
01470         shape->paperspace = paperspace;
01471 #if DEBUG
01472         DXF_DEBUG_END
01473 #endif
01474         return (shape);
01475 }
01476 
01477 
01484 int
01485 dxf_shape_get_graphics_data_size
01486 (
01487         DxfShape *shape
01489 )
01490 {
01491 #if DEBUG
01492         DXF_DEBUG_BEGIN
01493 #endif
01494         /* Do some basic checks. */
01495         if (shape == NULL)
01496         {
01497                 fprintf (stderr,
01498                   (_("Error in %s () a NULL pointer was passed.\n")),
01499                   __FUNCTION__);
01500                 return (EXIT_FAILURE);
01501         }
01502         if (shape->graphics_data_size < 0)
01503         {
01504                 fprintf (stderr,
01505                   (_("Warning in %s () a negative value was found.\n")),
01506                   __FUNCTION__);
01507         }
01508         if (shape->graphics_data_size == 0)
01509         {
01510                 fprintf (stderr,
01511                   (_("Warning in %s () a zero value was found.\n")),
01512                   __FUNCTION__);
01513         }
01514 #if DEBUG
01515         DXF_DEBUG_END
01516 #endif
01517         return (shape->graphics_data_size);
01518 }
01519 
01520 
01527 DxfShape *
01528 dxf_shape_set_graphics_data_size
01529 (
01530         DxfShape *shape,
01532         int graphics_data_size
01535 )
01536 {
01537 #if DEBUG
01538         DXF_DEBUG_BEGIN
01539 #endif
01540         /* Do some basic checks. */
01541         if (shape == NULL)
01542         {
01543                 fprintf (stderr,
01544                   (_("Error in %s () a NULL pointer was passed.\n")),
01545                   __FUNCTION__);
01546                 return (NULL);
01547         }
01548         if (graphics_data_size < 0)
01549         {
01550                 fprintf (stderr,
01551                   (_("Warning in %s () a negative value was passed.\n")),
01552                   __FUNCTION__);
01553         }
01554         if (graphics_data_size == 0)
01555         {
01556                 fprintf (stderr,
01557                   (_("Warning in %s () a zero value was passed.\n")),
01558                   __FUNCTION__);
01559         }
01560         shape->graphics_data_size = graphics_data_size;
01561 #if DEBUG
01562         DXF_DEBUG_END
01563 #endif
01564         return (shape);
01565 }
01566 
01567 
01574 int16_t
01575 dxf_shape_get_shadow_mode
01576 (
01577         DxfShape *shape
01579 )
01580 {
01581 #if DEBUG
01582         DXF_DEBUG_BEGIN
01583 #endif
01584         /* Do some basic checks. */
01585         if (shape == NULL)
01586         {
01587                 fprintf (stderr,
01588                   (_("Error in %s () a NULL pointer was passed.\n")),
01589                   __FUNCTION__);
01590                 return (EXIT_FAILURE);
01591         }
01592         if (shape->shadow_mode < 0)
01593         {
01594                 fprintf (stderr,
01595                   (_("Warning in %s () a negative value was found.\n")),
01596                   __FUNCTION__);
01597         }
01598         if (shape->shadow_mode > 3)
01599         {
01600                 fprintf (stderr,
01601                   (_("Warning in %s () an out of range value was found.\n")),
01602                   __FUNCTION__);
01603         }
01604 #if DEBUG
01605         DXF_DEBUG_END
01606 #endif
01607         return (shape->shadow_mode);
01608 }
01609 
01610 
01617 DxfShape *
01618 dxf_shape_set_shadow_mode
01619 (
01620         DxfShape *shape,
01622         int16_t shadow_mode
01624 )
01625 {
01626 #if DEBUG
01627         DXF_DEBUG_BEGIN
01628 #endif
01629         /* Do some basic checks. */
01630         if (shape == NULL)
01631         {
01632                 fprintf (stderr,
01633                   (_("Error in %s () a NULL pointer was passed.\n")),
01634                   __FUNCTION__);
01635                 return (NULL);
01636         }
01637         if (shadow_mode < 0)
01638         {
01639                 fprintf (stderr,
01640                   (_("Warning in %s () a negative value was passed.\n")),
01641                   __FUNCTION__);
01642         }
01643         if (shadow_mode > 3)
01644         {
01645                 fprintf (stderr,
01646                   (_("Warning in %s () an out of range value was passed.\n")),
01647                   __FUNCTION__);
01648         }
01649         shape->shadow_mode = shadow_mode;
01650 #if DEBUG
01651         DXF_DEBUG_END
01652 #endif
01653         return (shape);
01654 }
01655 
01656 
01665 DxfBinaryGraphicsData *
01666 dxf_shape_get_binary_graphics_data
01667 (
01668         DxfShape *shape
01670 )
01671 {
01672 #if DEBUG
01673         DXF_DEBUG_BEGIN
01674 #endif
01675         /* Do some basic checks. */
01676         if (shape == NULL)
01677         {
01678                 fprintf (stderr,
01679                   (_("Error in %s () a NULL pointer was passed.\n")),
01680                   __FUNCTION__);
01681                 return (NULL);
01682         }
01683         if (shape->binary_graphics_data ==  NULL)
01684         {
01685                 fprintf (stderr,
01686                   (_("Error in %s () a NULL pointer was found.\n")),
01687                   __FUNCTION__);
01688                 return (NULL);
01689         }
01690 #if DEBUG
01691         DXF_DEBUG_END
01692 #endif
01693         return ((DxfBinaryGraphicsData *) shape->binary_graphics_data);
01694 }
01695 
01696 
01701 DxfShape *
01702 dxf_shape_set_binary_graphics_data
01703 (
01704         DxfShape *shape,
01706         DxfBinaryGraphicsData *data
01709 )
01710 {
01711 #if DEBUG
01712         DXF_DEBUG_BEGIN
01713 #endif
01714         /* Do some basic checks. */
01715         if (shape == NULL)
01716         {
01717                 fprintf (stderr,
01718                   (_("Error in %s () a NULL pointer was passed.\n")),
01719                   __FUNCTION__);
01720                 return (NULL);
01721         }
01722         if (data == NULL)
01723         {
01724                 fprintf (stderr,
01725                   (_("Error in %s () a NULL pointer was passed.\n")),
01726                   __FUNCTION__);
01727                 return (NULL);
01728         }
01729         shape->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01730 #if DEBUG
01731         DXF_DEBUG_END
01732 #endif
01733         return (shape);
01734 }
01735 
01736 
01745 char *
01746 dxf_shape_get_dictionary_owner_soft
01747 (
01748         DxfShape *shape
01750 )
01751 {
01752 #if DEBUG
01753         DXF_DEBUG_BEGIN
01754 #endif
01755         /* Do some basic checks. */
01756         if (shape == NULL)
01757         {
01758                 fprintf (stderr,
01759                   (_("Error in %s () a NULL pointer was passed.\n")),
01760                   __FUNCTION__);
01761                 return (NULL);
01762         }
01763         if (shape->dictionary_owner_soft ==  NULL)
01764         {
01765                 fprintf (stderr,
01766                   (_("Error in %s () a NULL pointer was found.\n")),
01767                   __FUNCTION__);
01768                 return (NULL);
01769         }
01770 #if DEBUG
01771         DXF_DEBUG_END
01772 #endif
01773         return (strdup (shape->dictionary_owner_soft));
01774 }
01775 
01776 
01781 DxfShape *
01782 dxf_shape_set_dictionary_owner_soft
01783 (
01784         DxfShape *shape,
01786         char *dictionary_owner_soft
01789 )
01790 {
01791 #if DEBUG
01792         DXF_DEBUG_BEGIN
01793 #endif
01794         /* Do some basic checks. */
01795         if (shape == NULL)
01796         {
01797                 fprintf (stderr,
01798                   (_("Error in %s () a NULL pointer was passed.\n")),
01799                   __FUNCTION__);
01800                 return (NULL);
01801         }
01802         if (dictionary_owner_soft == NULL)
01803         {
01804                 fprintf (stderr,
01805                   (_("Error in %s () a NULL pointer was passed.\n")),
01806                   __FUNCTION__);
01807                 return (NULL);
01808         }
01809         shape->dictionary_owner_soft = strdup (dictionary_owner_soft);
01810 #if DEBUG
01811         DXF_DEBUG_END
01812 #endif
01813         return (shape);
01814 }
01815 
01816 
01825 char *
01826 dxf_shape_get_material
01827 (
01828         DxfShape *shape
01830 )
01831 {
01832 #if DEBUG
01833         DXF_DEBUG_BEGIN
01834 #endif
01835         /* Do some basic checks. */
01836         if (shape == NULL)
01837         {
01838                 fprintf (stderr,
01839                   (_("Error in %s () a NULL pointer was passed.\n")),
01840                   __FUNCTION__);
01841                 return (NULL);
01842         }
01843         if (shape->material ==  NULL)
01844         {
01845                 fprintf (stderr,
01846                   (_("Error in %s () a NULL pointer was found.\n")),
01847                   __FUNCTION__);
01848                 return (NULL);
01849         }
01850 #if DEBUG
01851         DXF_DEBUG_END
01852 #endif
01853         return (strdup (shape->material));
01854 }
01855 
01856 
01863 DxfShape *
01864 dxf_shape_set_material
01865 (
01866         DxfShape *shape,
01868         char *material
01871 )
01872 {
01873 #if DEBUG
01874         DXF_DEBUG_BEGIN
01875 #endif
01876         /* Do some basic checks. */
01877         if (shape == NULL)
01878         {
01879                 fprintf (stderr,
01880                   (_("Error in %s () a NULL pointer was passed.\n")),
01881                   __FUNCTION__);
01882                 return (NULL);
01883         }
01884         if (material == NULL)
01885         {
01886                 fprintf (stderr,
01887                   (_("Error in %s () a NULL pointer was passed.\n")),
01888                   __FUNCTION__);
01889                 return (NULL);
01890         }
01891         shape->material = strdup (material);
01892 #if DEBUG
01893         DXF_DEBUG_END
01894 #endif
01895         return (shape);
01896 }
01897 
01898 
01907 char *
01908 dxf_shape_get_dictionary_owner_hard
01909 (
01910         DxfShape *shape
01912 )
01913 {
01914 #if DEBUG
01915         DXF_DEBUG_BEGIN
01916 #endif
01917         /* Do some basic checks. */
01918         if (shape == NULL)
01919         {
01920                 fprintf (stderr,
01921                   (_("Error in %s () a NULL pointer was passed.\n")),
01922                   __FUNCTION__);
01923                 return (NULL);
01924         }
01925         if (shape->dictionary_owner_hard ==  NULL)
01926         {
01927                 fprintf (stderr,
01928                   (_("Error in %s () a NULL pointer was found.\n")),
01929                   __FUNCTION__);
01930                 return (NULL);
01931         }
01932 #if DEBUG
01933         DXF_DEBUG_END
01934 #endif
01935         return (strdup (shape->dictionary_owner_hard));
01936 }
01937 
01938 
01943 DxfShape *
01944 dxf_shape_set_dictionary_owner_hard
01945 (
01946         DxfShape *shape,
01948         char *dictionary_owner_hard
01951 )
01952 {
01953 #if DEBUG
01954         DXF_DEBUG_BEGIN
01955 #endif
01956         /* Do some basic checks. */
01957         if (shape == NULL)
01958         {
01959                 fprintf (stderr,
01960                   (_("Error in %s () a NULL pointer was passed.\n")),
01961                   __FUNCTION__);
01962                 return (NULL);
01963         }
01964         if (dictionary_owner_hard == NULL)
01965         {
01966                 fprintf (stderr,
01967                   (_("Error in %s () a NULL pointer was passed.\n")),
01968                   __FUNCTION__);
01969                 return (NULL);
01970         }
01971         shape->dictionary_owner_hard = strdup (dictionary_owner_hard);
01972 #if DEBUG
01973         DXF_DEBUG_END
01974 #endif
01975         return (shape);
01976 }
01977 
01978 
01985 int16_t
01986 dxf_shape_get_lineweight
01987 (
01988         DxfShape *shape
01990 )
01991 {
01992 #if DEBUG
01993         DXF_DEBUG_BEGIN
01994 #endif
01995         /* Do some basic checks. */
01996         if (shape == NULL)
01997         {
01998                 fprintf (stderr,
01999                   (_("Error in %s () a NULL pointer was passed.\n")),
02000                   __FUNCTION__);
02001                 return (EXIT_FAILURE);
02002         }
02003 #if DEBUG
02004         DXF_DEBUG_END
02005 #endif
02006         return (shape->lineweight);
02007 }
02008 
02009 
02016 DxfShape *
02017 dxf_shape_set_lineweight
02018 (
02019         DxfShape *shape,
02021         int16_t lineweight
02023 )
02024 {
02025 #if DEBUG
02026         DXF_DEBUG_BEGIN
02027 #endif
02028         /* Do some basic checks. */
02029         if (shape == NULL)
02030         {
02031                 fprintf (stderr,
02032                   (_("Error in %s () a NULL pointer was passed.\n")),
02033                   __FUNCTION__);
02034                 return (NULL);
02035         }
02036         shape->lineweight = lineweight;
02037 #if DEBUG
02038         DXF_DEBUG_END
02039 #endif
02040         return (shape);
02041 }
02042 
02043 
02050 char *
02051 dxf_shape_get_plot_style_name
02052 (
02053         DxfShape *shape
02055 )
02056 {
02057 #if DEBUG
02058         DXF_DEBUG_BEGIN
02059 #endif
02060         /* Do some basic checks. */
02061         if (shape == NULL)
02062         {
02063                 fprintf (stderr,
02064                   (_("Error in %s () a NULL pointer was passed.\n")),
02065                   __FUNCTION__);
02066                 return (NULL);
02067         }
02068         if (shape->plot_style_name ==  NULL)
02069         {
02070                 fprintf (stderr,
02071                   (_("Error in %s () a NULL pointer was found.\n")),
02072                   __FUNCTION__);
02073                 return (NULL);
02074         }
02075 #if DEBUG
02076         DXF_DEBUG_END
02077 #endif
02078         return (strdup (shape->plot_style_name));
02079 }
02080 
02081 
02088 DxfShape *
02089 dxf_shape_set_plot_style_name
02090 (
02091         DxfShape *shape,
02093         char *plot_style_name
02096 )
02097 {
02098 #if DEBUG
02099         DXF_DEBUG_BEGIN
02100 #endif
02101         /* Do some basic checks. */
02102         if (shape == NULL)
02103         {
02104                 fprintf (stderr,
02105                   (_("Error in %s () a NULL pointer was passed.\n")),
02106                   __FUNCTION__);
02107                 return (NULL);
02108         }
02109         if (plot_style_name == NULL)
02110         {
02111                 fprintf (stderr,
02112                   (_("Error in %s () a NULL pointer was passed.\n")),
02113                   __FUNCTION__);
02114                 return (NULL);
02115         }
02116         shape->plot_style_name = strdup (plot_style_name);
02117 #if DEBUG
02118         DXF_DEBUG_END
02119 #endif
02120         return (shape);
02121 }
02122 
02123 
02130 long
02131 dxf_shape_get_color_value
02132 (
02133         DxfShape *shape
02135 )
02136 {
02137 #if DEBUG
02138         DXF_DEBUG_BEGIN
02139 #endif
02140         /* Do some basic checks. */
02141         if (shape == NULL)
02142         {
02143                 fprintf (stderr,
02144                   (_("Error in %s () a NULL pointer was passed.\n")),
02145                   __FUNCTION__);
02146                 return (EXIT_FAILURE);
02147         }
02148 #if DEBUG
02149         DXF_DEBUG_END
02150 #endif
02151         return (shape->color_value);
02152 }
02153 
02154 
02161 DxfShape *
02162 dxf_shape_set_color_value
02163 (
02164         DxfShape *shape,
02166         long color_value
02168 )
02169 {
02170 #if DEBUG
02171         DXF_DEBUG_BEGIN
02172 #endif
02173         /* Do some basic checks. */
02174         if (shape == NULL)
02175         {
02176                 fprintf (stderr,
02177                   (_("Error in %s () a NULL pointer was passed.\n")),
02178                   __FUNCTION__);
02179                 return (NULL);
02180         }
02181         shape->color_value = color_value;
02182 #if DEBUG
02183         DXF_DEBUG_END
02184 #endif
02185         return (shape);
02186 }
02187 
02188 
02195 char *
02196 dxf_shape_get_color_name
02197 (
02198         DxfShape *shape
02200 )
02201 {
02202 #if DEBUG
02203         DXF_DEBUG_BEGIN
02204 #endif
02205         /* Do some basic checks. */
02206         if (shape == NULL)
02207         {
02208                 fprintf (stderr,
02209                   (_("Error in %s () a NULL pointer was passed.\n")),
02210                   __FUNCTION__);
02211                 return (NULL);
02212         }
02213         if (shape->color_name ==  NULL)
02214         {
02215                 fprintf (stderr,
02216                   (_("Error in %s () a NULL pointer was found.\n")),
02217                   __FUNCTION__);
02218                 return (NULL);
02219         }
02220 #if DEBUG
02221         DXF_DEBUG_END
02222 #endif
02223         return (strdup (shape->color_name));
02224 }
02225 
02226 
02233 DxfShape *
02234 dxf_shape_set_color_name
02235 (
02236         DxfShape *shape,
02238         char *color_name
02241 )
02242 {
02243 #if DEBUG
02244         DXF_DEBUG_BEGIN
02245 #endif
02246         /* Do some basic checks. */
02247         if (shape == NULL)
02248         {
02249                 fprintf (stderr,
02250                   (_("Error in %s () a NULL pointer was passed.\n")),
02251                   __FUNCTION__);
02252                 return (NULL);
02253         }
02254         if (color_name == NULL)
02255         {
02256                 fprintf (stderr,
02257                   (_("Error in %s () a NULL pointer was passed.\n")),
02258                   __FUNCTION__);
02259                 return (NULL);
02260         }
02261         shape->color_name = strdup (color_name);
02262 #if DEBUG
02263         DXF_DEBUG_END
02264 #endif
02265         return (shape);
02266 }
02267 
02268 
02275 long
02276 dxf_shape_get_transparency
02277 (
02278         DxfShape *shape
02280 )
02281 {
02282 #if DEBUG
02283         DXF_DEBUG_BEGIN
02284 #endif
02285         /* Do some basic checks. */
02286         if (shape == NULL)
02287         {
02288                 fprintf (stderr,
02289                   (_("Error in %s () a NULL pointer was passed.\n")),
02290                   __FUNCTION__);
02291                 return (EXIT_FAILURE);
02292         }
02293 #if DEBUG
02294         DXF_DEBUG_END
02295 #endif
02296         return (shape->transparency);
02297 }
02298 
02299 
02306 DxfShape *
02307 dxf_shape_set_transparency
02308 (
02309         DxfShape *shape,
02311         long transparency
02313 )
02314 {
02315 #if DEBUG
02316         DXF_DEBUG_BEGIN
02317 #endif
02318         /* Do some basic checks. */
02319         if (shape == NULL)
02320         {
02321                 fprintf (stderr,
02322                   (_("Error in %s () a NULL pointer was passed.\n")),
02323                   __FUNCTION__);
02324                 return (NULL);
02325         }
02326         shape->transparency = transparency;
02327 #if DEBUG
02328         DXF_DEBUG_END
02329 #endif
02330         return (shape);
02331 }
02332 
02333 
02339 DxfPoint *
02340 dxf_shape_get_p0
02341 (
02342         DxfShape *shape
02344 )
02345 {
02346 #ifdef DEBUG
02347         DXF_DEBUG_BEGIN
02348 #endif
02349         /* Do some basic checks. */
02350         if (shape == NULL)
02351         {
02352                 fprintf (stderr,
02353                   (_("Error in %s () a NULL pointer was passed.\n")),
02354                   __FUNCTION__);
02355                 return (NULL);
02356         }
02357         if (shape->p0 == NULL)
02358         {
02359                 fprintf (stderr,
02360                   (_("Error in %s () a NULL pointer was found.\n")),
02361                   __FUNCTION__);
02362                 return (NULL);
02363         }
02364 #if DEBUG
02365         DXF_DEBUG_END
02366 #endif
02367         return (shape->p0);
02368 }
02369 
02370 
02376 DxfShape *
02377 dxf_shape_set_p0
02378 (
02379         DxfShape *shape,
02381         DxfPoint *p0
02383 )
02384 {
02385 #ifdef DEBUG
02386         DXF_DEBUG_BEGIN
02387 #endif
02388         /* Do some basic checks. */
02389         if (shape == NULL)
02390         {
02391                 fprintf (stderr,
02392                   (_("Error in %s () a NULL pointer was passed.\n")),
02393                   __FUNCTION__);
02394                 return (NULL);
02395         }
02396         if (p0 == NULL)
02397         {
02398                 fprintf (stderr,
02399                   (_("Error in %s () a NULL pointer was passed.\n")),
02400                   __FUNCTION__);
02401                 return (NULL);
02402         }
02403         shape->p0 = p0;
02404 #if DEBUG
02405         DXF_DEBUG_END
02406 #endif
02407         return (shape);
02408 }
02409 
02410 
02417 double
02418 dxf_shape_get_x0
02419 (
02420         DxfShape *shape
02422 )
02423 {
02424 #ifdef DEBUG
02425         DXF_DEBUG_BEGIN
02426 #endif
02427 
02428         /* Do some basic checks. */
02429         if (shape == NULL)
02430         {
02431                 fprintf (stderr,
02432                   (_("Error in %s () a NULL pointer was passed.\n")),
02433                   __FUNCTION__);
02434                 return (EXIT_FAILURE);
02435         }
02436         if (shape->p0 == NULL)
02437         {
02438                 fprintf (stderr,
02439                   (_("Error in %s () a NULL pointer was found.\n")),
02440                   __FUNCTION__);
02441                 return (EXIT_FAILURE);
02442         }
02443 #if DEBUG
02444         DXF_DEBUG_END
02445 #endif
02446         return (shape->p0->x0);
02447 }
02448 
02449 
02457 DxfShape *
02458 dxf_shape_set_x0
02459 (
02460         DxfShape *shape,
02462         double x0
02465 )
02466 {
02467 #ifdef DEBUG
02468         DXF_DEBUG_BEGIN
02469 #endif
02470         /* Do some basic checks. */
02471         if (shape == NULL)
02472         {
02473                 fprintf (stderr,
02474                   (_("Error in %s () a NULL pointer was passed.\n")),
02475                   __FUNCTION__);
02476                 return (NULL);
02477         }
02478         if (shape->p0 == NULL)
02479         {
02480                 fprintf (stderr,
02481                   (_("Error in %s () a NULL pointer was found.\n")),
02482                   __FUNCTION__);
02483                 return (NULL);
02484         }
02485         shape->p0->x0 = x0;
02486 #if DEBUG
02487         DXF_DEBUG_END
02488 #endif
02489         return (shape);
02490 }
02491 
02492 
02499 double
02500 dxf_shape_get_y0
02501 (
02502         DxfShape *shape
02504 )
02505 {
02506 #ifdef DEBUG
02507         DXF_DEBUG_BEGIN
02508 #endif
02509 
02510         /* Do some basic checks. */
02511         if (shape == NULL)
02512         {
02513                 fprintf (stderr,
02514                   (_("Error in %s () a NULL pointer was passed.\n")),
02515                   __FUNCTION__);
02516                 return (EXIT_FAILURE);
02517         }
02518         if (shape->p0 == NULL)
02519         {
02520                 fprintf (stderr,
02521                   (_("Error in %s () a NULL pointer was found.\n")),
02522                   __FUNCTION__);
02523                 return (EXIT_FAILURE);
02524         }
02525 #if DEBUG
02526         DXF_DEBUG_END
02527 #endif
02528         return (shape->p0->y0);
02529 }
02530 
02531 
02539 DxfShape *
02540 dxf_shape_set_y0
02541 (
02542         DxfShape *shape,
02544         double y0
02547 )
02548 {
02549 #ifdef DEBUG
02550         DXF_DEBUG_BEGIN
02551 #endif
02552         /* Do some basic checks. */
02553         if (shape == NULL)
02554         {
02555                 fprintf (stderr,
02556                   (_("Error in %s () a NULL pointer was passed.\n")),
02557                   __FUNCTION__);
02558                 return (NULL);
02559         }
02560         if (shape->p0 == NULL)
02561         {
02562                 fprintf (stderr,
02563                   (_("Error in %s () a NULL pointer was found.\n")),
02564                   __FUNCTION__);
02565                 return (NULL);
02566         }
02567         shape->p0->y0 = y0;
02568 #if DEBUG
02569         DXF_DEBUG_END
02570 #endif
02571         return (shape);
02572 }
02573 
02574 
02581 double
02582 dxf_shape_get_z0
02583 (
02584         DxfShape *shape
02586 )
02587 {
02588 #ifdef DEBUG
02589         DXF_DEBUG_BEGIN
02590 #endif
02591 
02592         /* Do some basic checks. */
02593         if (shape == NULL)
02594         {
02595                 fprintf (stderr,
02596                   (_("Error in %s () a NULL pointer was passed.\n")),
02597                   __FUNCTION__);
02598                 return (EXIT_FAILURE);
02599         }
02600         if (shape->p0 == NULL)
02601         {
02602                 fprintf (stderr,
02603                   (_("Error in %s () a NULL pointer was found.\n")),
02604                   __FUNCTION__);
02605                 return (EXIT_FAILURE);
02606         }
02607 #if DEBUG
02608         DXF_DEBUG_END
02609 #endif
02610         return (shape->p0->z0);
02611 }
02612 
02613 
02621 DxfShape *
02622 dxf_shape_set_z0
02623 (
02624         DxfShape *shape,
02626         double z0
02629 )
02630 {
02631 #ifdef DEBUG
02632         DXF_DEBUG_BEGIN
02633 #endif
02634         /* Do some basic checks. */
02635         if (shape == NULL)
02636         {
02637                 fprintf (stderr,
02638                   (_("Error in %s () a NULL pointer was passed.\n")),
02639                   __FUNCTION__);
02640                 return (NULL);
02641         }
02642         if (shape->p0 == NULL)
02643         {
02644                 fprintf (stderr,
02645                   (_("Error in %s () a NULL pointer was found.\n")),
02646                   __FUNCTION__);
02647                 return (NULL);
02648         }
02649         shape->p0->z0 = z0;
02650 #if DEBUG
02651         DXF_DEBUG_END
02652 #endif
02653         return (shape);
02654 }
02655 
02656 
02662 double
02663 dxf_shape_get_size
02664 (
02665         DxfShape *shape
02667 )
02668 {
02669 #ifdef DEBUG
02670         DXF_DEBUG_BEGIN
02671 #endif
02672 
02673         /* Do some basic checks. */
02674         if (shape == NULL)
02675         {
02676                 fprintf (stderr,
02677                   (_("Error in %s () a NULL pointer was passed.\n")),
02678                   __FUNCTION__);
02679                 return (EXIT_FAILURE);
02680         }
02681 #if DEBUG
02682         DXF_DEBUG_END
02683 #endif
02684         return (shape->size);
02685 }
02686 
02687 
02694 DxfShape *
02695 dxf_shape_set_size
02696 (
02697         DxfShape *shape,
02699         double size
02701 )
02702 {
02703 #ifdef DEBUG
02704         DXF_DEBUG_BEGIN
02705 #endif
02706         /* Do some basic checks. */
02707         if (shape == NULL)
02708         {
02709                 fprintf (stderr,
02710                   (_("Error in %s () a NULL pointer was passed.\n")),
02711                   __FUNCTION__);
02712                 return (NULL);
02713         }
02714         shape->size = size;
02715 #if DEBUG
02716         DXF_DEBUG_END
02717 #endif
02718         return (shape);
02719 }
02720 
02721 
02727 double
02728 dxf_shape_get_rel_x_scale
02729 (
02730         DxfShape *shape
02732 )
02733 {
02734 #ifdef DEBUG
02735         DXF_DEBUG_BEGIN
02736 #endif
02737 
02738         /* Do some basic checks. */
02739         if (shape == NULL)
02740         {
02741                 fprintf (stderr,
02742                   (_("Error in %s () a NULL pointer was passed.\n")),
02743                   __FUNCTION__);
02744                 return (EXIT_FAILURE);
02745         }
02746 #if DEBUG
02747         DXF_DEBUG_END
02748 #endif
02749         return (shape->rel_x_scale);
02750 }
02751 
02752 
02759 DxfShape *
02760 dxf_shape_set_rel_x_scale
02761 (
02762         DxfShape *shape,
02764         double rel_x_scale
02766 )
02767 {
02768 #ifdef DEBUG
02769         DXF_DEBUG_BEGIN
02770 #endif
02771         /* Do some basic checks. */
02772         if (shape == NULL)
02773         {
02774                 fprintf (stderr,
02775                   (_("Error in %s () a NULL pointer was passed.\n")),
02776                   __FUNCTION__);
02777                 return (NULL);
02778         }
02779         shape->rel_x_scale = rel_x_scale;
02780 #if DEBUG
02781         DXF_DEBUG_END
02782 #endif
02783         return (shape);
02784 }
02785 
02786 
02792 double
02793 dxf_shape_get_rot_angle
02794 (
02795         DxfShape *shape
02797 )
02798 {
02799 #ifdef DEBUG
02800         DXF_DEBUG_BEGIN
02801 #endif
02802 
02803         /* Do some basic checks. */
02804         if (shape == NULL)
02805         {
02806                 fprintf (stderr,
02807                   (_("Error in %s () a NULL pointer was passed.\n")),
02808                   __FUNCTION__);
02809                 return (EXIT_FAILURE);
02810         }
02811 #if DEBUG
02812         DXF_DEBUG_END
02813 #endif
02814         return (shape->rot_angle);
02815 }
02816 
02817 
02824 DxfShape *
02825 dxf_shape_set_rot_angle
02826 (
02827         DxfShape *shape,
02829         double rot_angle
02831 )
02832 {
02833 #ifdef DEBUG
02834         DXF_DEBUG_BEGIN
02835 #endif
02836         /* Do some basic checks. */
02837         if (shape == NULL)
02838         {
02839                 fprintf (stderr,
02840                   (_("Error in %s () a NULL pointer was passed.\n")),
02841                   __FUNCTION__);
02842                 return (NULL);
02843         }
02844         shape->rot_angle = rot_angle;
02845 #if DEBUG
02846         DXF_DEBUG_END
02847 #endif
02848         return (shape);
02849 }
02850 
02851 
02857 double
02858 dxf_shape_get_obl_angle
02859 (
02860         DxfShape *shape
02862 )
02863 {
02864 #ifdef DEBUG
02865         DXF_DEBUG_BEGIN
02866 #endif
02867 
02868         /* Do some basic checks. */
02869         if (shape == NULL)
02870         {
02871                 fprintf (stderr,
02872                   (_("Error in %s () a NULL pointer was passed.\n")),
02873                   __FUNCTION__);
02874                 return (EXIT_FAILURE);
02875         }
02876 #if DEBUG
02877         DXF_DEBUG_END
02878 #endif
02879         return (shape->obl_angle);
02880 }
02881 
02882 
02889 DxfShape *
02890 dxf_shape_set_obl_angle
02891 (
02892         DxfShape *shape,
02894         double obl_angle
02896 )
02897 {
02898 #ifdef DEBUG
02899         DXF_DEBUG_BEGIN
02900 #endif
02901         /* Do some basic checks. */
02902         if (shape == NULL)
02903         {
02904                 fprintf (stderr,
02905                   (_("Error in %s () a NULL pointer was passed.\n")),
02906                   __FUNCTION__);
02907                 return (NULL);
02908         }
02909         shape->obl_angle = obl_angle;
02910 #if DEBUG
02911         DXF_DEBUG_END
02912 #endif
02913         return (shape);
02914 }
02915 
02916 
02923 double
02924 dxf_shape_get_extr_x0
02925 (
02926         DxfShape *shape
02928 )
02929 {
02930 #ifdef DEBUG
02931         DXF_DEBUG_BEGIN
02932 #endif
02933 
02934         /* Do some basic checks. */
02935         if (shape == NULL)
02936         {
02937                 fprintf (stderr,
02938                   (_("Error in %s () a NULL pointer was passed.\n")),
02939                   __FUNCTION__);
02940                 return (EXIT_FAILURE);
02941         }
02942 #if DEBUG
02943         DXF_DEBUG_END
02944 #endif
02945         return (shape->extr_x0);
02946 }
02947 
02948 
02956 DxfShape *
02957 dxf_shape_set_extr_x0
02958 (
02959         DxfShape *shape,
02961         double extr_x0
02964 )
02965 {
02966 #ifdef DEBUG
02967         DXF_DEBUG_BEGIN
02968 #endif
02969         /* Do some basic checks. */
02970         if (shape == NULL)
02971         {
02972                 fprintf (stderr,
02973                   (_("Error in %s () a NULL pointer was passed.\n")),
02974                   __FUNCTION__);
02975                 return (NULL);
02976         }
02977         shape->extr_x0 = extr_x0;
02978 #if DEBUG
02979         DXF_DEBUG_END
02980 #endif
02981         return (shape);
02982 }
02983 
02984 
02991 double
02992 dxf_shape_get_extr_y0
02993 (
02994         DxfShape *shape
02996 )
02997 {
02998 #ifdef DEBUG
02999         DXF_DEBUG_BEGIN
03000 #endif
03001 
03002         /* Do some basic checks. */
03003         if (shape == NULL)
03004         {
03005                 fprintf (stderr,
03006                   (_("Error in %s () a NULL pointer was passed.\n")),
03007                   __FUNCTION__);
03008                 return (EXIT_FAILURE);
03009         }
03010 #if DEBUG
03011         DXF_DEBUG_END
03012 #endif
03013         return (shape->extr_y0);
03014 }
03015 
03016 
03024 DxfShape *
03025 dxf_shape_set_extr_y0
03026 (
03027         DxfShape *shape,
03029         double extr_y0
03032 )
03033 {
03034 #ifdef DEBUG
03035         DXF_DEBUG_BEGIN
03036 #endif
03037         /* Do some basic checks. */
03038         if (shape == NULL)
03039         {
03040                 fprintf (stderr,
03041                   (_("Error in %s () a NULL pointer was passed.\n")),
03042                   __FUNCTION__);
03043                 return (NULL);
03044         }
03045         shape->extr_y0 = extr_y0;
03046 #if DEBUG
03047         DXF_DEBUG_END
03048 #endif
03049         return (shape);
03050 }
03051 
03052 
03059 double
03060 dxf_shape_get_extr_z0
03061 (
03062         DxfShape *shape
03064 )
03065 {
03066 #ifdef DEBUG
03067         DXF_DEBUG_BEGIN
03068 #endif
03069 
03070         /* Do some basic checks. */
03071         if (shape == NULL)
03072         {
03073                 fprintf (stderr,
03074                   (_("Error in %s () a NULL pointer was passed.\n")),
03075                   __FUNCTION__);
03076                 return (EXIT_FAILURE);
03077         }
03078 #if DEBUG
03079         DXF_DEBUG_END
03080 #endif
03081         return (shape->extr_z0);
03082 }
03083 
03084 
03092 DxfShape *
03093 dxf_shape_set_extr_z0
03094 (
03095         DxfShape *shape,
03097         double extr_z0
03100 )
03101 {
03102 #ifdef DEBUG
03103         DXF_DEBUG_BEGIN
03104 #endif
03105         /* Do some basic checks. */
03106         if (shape == NULL)
03107         {
03108                 fprintf (stderr,
03109                   (_("Error in %s () a NULL pointer was passed.\n")),
03110                   __FUNCTION__);
03111                 return (NULL);
03112         }
03113         shape->extr_z0 = extr_z0;
03114 #if DEBUG
03115         DXF_DEBUG_END
03116 #endif
03117         return (shape);
03118 }
03119 
03120 
03129 DxfShape *
03130 dxf_shape_get_next
03131 (
03132         DxfShape *shape
03134 )
03135 {
03136 #if DEBUG
03137         DXF_DEBUG_BEGIN
03138 #endif
03139         /* Do some basic checks. */
03140         if (shape == NULL)
03141         {
03142                 fprintf (stderr,
03143                   (_("Error in %s () a NULL pointer was passed.\n")),
03144                   __FUNCTION__);
03145                 return (NULL);
03146         }
03147         if (shape->next == NULL)
03148         {
03149                 fprintf (stderr,
03150                   (_("Error in %s () a NULL pointer was found.\n")),
03151                   __FUNCTION__);
03152                 return (NULL);
03153         }
03154 #if DEBUG
03155         DXF_DEBUG_END
03156 #endif
03157         return ((DxfShape *) shape->next);
03158 }
03159 
03160 
03165 DxfShape *
03166 dxf_shape_set_next
03167 (
03168         DxfShape *shape,
03170         DxfShape *next
03172 )
03173 {
03174 #if DEBUG
03175         DXF_DEBUG_BEGIN
03176 #endif
03177         /* Do some basic checks. */
03178         if (shape == NULL)
03179         {
03180                 fprintf (stderr,
03181                   (_("Error in %s () a NULL pointer was passed.\n")),
03182                   __FUNCTION__);
03183                 return (NULL);
03184         }
03185         if (next == NULL)
03186         {
03187                 fprintf (stderr,
03188                   (_("Error in %s () a NULL pointer was passed.\n")),
03189                   __FUNCTION__);
03190                 return (NULL);
03191         }
03192         shape->next = (struct DxfShape *) next;
03193 #if DEBUG
03194         DXF_DEBUG_END
03195 #endif
03196         return (shape);
03197 }
03198 
03199 
03208 DxfShape *
03209 dxf_shape_get_last
03210 (
03211         DxfShape *shape
03213 )
03214 {
03215 #if DEBUG
03216         DXF_DEBUG_BEGIN
03217 #endif
03218         /* Do some basic checks. */
03219         if (shape == NULL)
03220         {
03221                 fprintf (stderr,
03222                   (_("Error in %s () a NULL pointer was passed.\n")),
03223                   __FUNCTION__);
03224                 return (NULL);
03225         }
03226         if (shape->next == NULL)
03227         {
03228                 fprintf (stderr,
03229                   (_("Warning in %s () a NULL pointer was found.\n")),
03230                   __FUNCTION__);
03231                 return ((DxfShape *) shape);
03232         }
03233         DxfShape *iter = (DxfShape *) shape->next;
03234         while (iter->next != NULL)
03235         {
03236                 iter = (DxfShape *) iter->next;
03237         }
03238 #if DEBUG
03239         DXF_DEBUG_END
03240 #endif
03241         return ((DxfShape *) iter);
03242 }
03243 
03244 
03245 /* EOF */