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

polyline.c

Go to the documentation of this file.
00001 
00044 #include "polyline.h"
00045 
00046 
00052 DxfPolyline *
00053 dxf_polyline_new ()
00054 {
00055 #if DEBUG
00056         DXF_DEBUG_BEGIN
00057 #endif
00058         DxfPolyline *polyline = NULL;
00059         size_t size;
00060 
00061         size = sizeof (DxfPolyline);
00062         /* avoid malloc of 0 bytes */
00063         if (size == 0) size = 1;
00064         if ((polyline = malloc (size)) == NULL)
00065         {
00066                 fprintf (stderr,
00067                   (_("Error in %s () could not allocate memory for a DxfArc struct.\n")),
00068                   __FUNCTION__);
00069                 polyline = NULL;
00070         }
00071         else
00072         {
00073                 memset (polyline, 0, size);
00074         }
00075 #if DEBUG
00076         DXF_DEBUG_END
00077 #endif
00078         return (polyline);
00079 }
00080 
00081 
00088 DxfPolyline *
00089 dxf_polyline_init
00090 (
00091         DxfPolyline *polyline
00093 )
00094 {
00095 #if DEBUG
00096         DXF_DEBUG_BEGIN
00097 #endif
00098         /* Do some basic checks. */
00099         if (polyline == NULL)
00100         {
00101                 fprintf (stderr,
00102                   (_("Warning in %s () a NULL pointer was passed.\n")),
00103                   __FUNCTION__);
00104                 polyline = dxf_polyline_new ();
00105         }
00106         if (polyline == NULL)
00107         {
00108               fprintf (stderr,
00109                 (_("Error in %s () could not allocate memory for a DxfPolyline struct.\n")),
00110                 __FUNCTION__);
00111               return (NULL);
00112         }
00113         dxf_polyline_set_id_code (polyline, 0);
00114         dxf_polyline_set_linetype (polyline, strdup (DXF_DEFAULT_LINETYPE));
00115         dxf_polyline_set_layer (polyline, strdup (DXF_DEFAULT_LAYER));
00116         dxf_polyline_set_elevation (polyline, 0.0);
00117         dxf_polyline_set_thickness (polyline, 0.0);
00118         dxf_polyline_set_linetype_scale (polyline, DXF_DEFAULT_LINETYPE_SCALE);
00119         dxf_polyline_set_visibility (polyline, DXF_DEFAULT_VISIBILITY);
00120         dxf_polyline_set_color (polyline, DXF_COLOR_BYLAYER);
00121         dxf_polyline_set_paperspace (polyline, DXF_MODELSPACE);
00122         dxf_polyline_set_graphics_data_size (polyline, 0);
00123         dxf_polyline_set_shadow_mode (polyline, 0);
00124         dxf_polyline_set_binary_graphics_data (polyline, (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ());
00125         dxf_polyline_set_dictionary_owner_soft (polyline, strdup (""));
00126         dxf_polyline_set_material (polyline, strdup (""));
00127         dxf_polyline_set_dictionary_owner_hard (polyline, strdup (""));
00128         dxf_polyline_set_lineweight (polyline, 0);
00129         dxf_polyline_set_plot_style_name (polyline, strdup (""));
00130         dxf_polyline_set_color_value (polyline, 0);
00131         dxf_polyline_set_color_name (polyline, strdup (""));
00132         dxf_polyline_set_transparency (polyline, 0);
00133         dxf_polyline_set_p0 (polyline, (DxfPoint *) dxf_point_new ());
00134         dxf_point_init ((DxfPoint *) dxf_polyline_get_p0 (polyline));
00135         dxf_polyline_set_x0 (polyline, 0.0);
00136         dxf_polyline_set_y0 (polyline, 0.0);
00137         dxf_polyline_set_z0 (polyline, 0.0);
00138         dxf_polyline_set_start_width (polyline, 0.0);
00139         dxf_polyline_set_end_width (polyline, 0.0);
00140         dxf_polyline_set_vertices_follow (polyline, 1);
00141         dxf_polyline_set_flag (polyline, 0);
00142         dxf_polyline_set_polygon_mesh_M_vertex_count (polyline, 0);
00143         dxf_polyline_set_polygon_mesh_N_vertex_count (polyline, 0);
00144         dxf_polyline_set_smooth_M_surface_density (polyline, 0);
00145         dxf_polyline_set_smooth_N_surface_density (polyline, 0);
00146         dxf_polyline_set_surface_type (polyline, 0);
00147         dxf_polyline_set_extr_x0 (polyline, 0.0);
00148         dxf_polyline_set_extr_y0 (polyline, 0.0);
00149         dxf_polyline_set_extr_z0 (polyline, 0.0);
00150         dxf_polyline_set_vertices (polyline, (DxfVertex *) dxf_vertex_new ());
00151         dxf_vertex_init ((DxfVertex *) dxf_polyline_get_vertices (polyline));
00152         dxf_polyline_set_next (polyline, NULL);
00153 #if DEBUG
00154         DXF_DEBUG_END
00155 #endif
00156         return (polyline);
00157 }
00158 
00159 
00160 
00173 DxfPolyline *
00174 dxf_polyline_read
00175 (
00176         DxfFile *fp,
00178         DxfPolyline *polyline
00180 )
00181 {
00182 #if DEBUG
00183         DXF_DEBUG_BEGIN
00184 #endif
00185         char *temp_string = NULL;
00186 
00187         /* Do some basic checks. */
00188         if (fp == NULL)
00189         {
00190                 fprintf (stderr,
00191                   (_("Error in %s () a NULL file pointer was passed.\n")),
00192                   __FUNCTION__);
00193                 /* Clean up. */
00194                 free (temp_string);
00195                 return (NULL);
00196         }
00197         if (polyline == NULL)
00198         {
00199                 fprintf (stderr,
00200                   (_("Warning in %s () a NULL pointer was passed.\n")),
00201                   __FUNCTION__);
00202                 polyline = dxf_polyline_new ();
00203                 polyline = dxf_polyline_init (polyline);
00204         }
00205         (fp->line_number)++;
00206         fscanf (fp->fp, "%[^\n]", temp_string);
00207         while (strcmp (temp_string, "0") != 0)
00208         {
00209                 if (ferror (fp->fp))
00210                 {
00211                         fprintf (stderr,
00212                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00213                           __FUNCTION__, fp->filename, fp->line_number);
00214                         fclose (fp->fp);
00215                         /* Clean up. */
00216                         free (temp_string);
00217                         return (NULL);
00218                 }
00219                 if (strcmp (temp_string, "5") == 0)
00220                 {
00221                         /* Now follows a string containing a sequential
00222                          * id number. */
00223                         (fp->line_number)++;
00224                         fscanf (fp->fp, "%x\n", &polyline->id_code);
00225                 }
00226                 else if (strcmp (temp_string, "6") == 0)
00227                 {
00228                         /* Now follows a string containing a linetype
00229                          * name. */
00230                         (fp->line_number)++;
00231                         fscanf (fp->fp, "%s\n", polyline->linetype);
00232                 }
00233                 else if (strcmp (temp_string, "8") == 0)
00234                 {
00235                         /* Now follows a string containing a layer name. */
00236                         (fp->line_number)++;
00237                         fscanf (fp->fp, "%s\n", polyline->layer);
00238                 }
00239                 else if (strcmp (temp_string, "10") == 0)
00240                 {
00241                         /* Now follows a string containing the
00242                          * X-coordinate of the primary point. */
00243                         (fp->line_number)++;
00244                         fscanf (fp->fp, "%lf\n", &polyline->p0->x0);
00245                 }
00246                 else if (strcmp (temp_string, "20") == 0)
00247                 {
00248                         /* Now follows a string containing the
00249                          * Y-coordinate of the primary point. */
00250                         (fp->line_number)++;
00251                         fscanf (fp->fp, "%lf\n", &polyline->p0->y0);
00252                 }
00253                 else if (strcmp (temp_string, "30") == 0)
00254                 {
00255                         /* Now follows a string containing the
00256                          * Z-coordinate of the primary point. */
00257                         (fp->line_number)++;
00258                         fscanf (fp->fp, "%lf\n", &polyline->p0->z0);
00259                 }
00260                 else if (strcmp (temp_string, "38") == 0)
00261                 {
00262                         /* Now follows a string containing the
00263                          * elevation. */
00264                         (fp->line_number)++;
00265                         fscanf (fp->fp, "%lf\n", &polyline->elevation);
00266                 }
00267                 else if (strcmp (temp_string, "39") == 0)
00268                 {
00269                         /* Now follows a string containing the
00270                          * thickness. */
00271                         (fp->line_number)++;
00272                         fscanf (fp->fp, "%lf\n", &polyline->thickness);
00273                 }
00274                 else if (strcmp (temp_string, "40") == 0)
00275                 {
00276                         /* Now follows a string containing the
00277                          * starting width. */
00278                         (fp->line_number)++;
00279                         fscanf (fp->fp, "%lf\n", &polyline->start_width);
00280                 }
00281                 else if (strcmp (temp_string, "41") == 0)
00282                 {
00283                         /* Now follows a string containing the
00284                          * end width. */
00285                         (fp->line_number)++;
00286                         fscanf (fp->fp, "%lf\n", &polyline->end_width);
00287                 }
00288                 else if (strcmp (temp_string, "48") == 0)
00289                 {
00290                         /* Now follows a string containing the linetype
00291                          * scale. */
00292                         (fp->line_number)++;
00293                         fscanf (fp->fp, "%lf\n", &polyline->linetype_scale);
00294                 }
00295                 else if (strcmp (temp_string, "60") == 0)
00296                 {
00297                         /* Now follows a string containing the
00298                          * visibility value. */
00299                         (fp->line_number)++;
00300                         fscanf (fp->fp, "%hd\n", &polyline->visibility);
00301                 }
00302                 else if (strcmp (temp_string, "62") == 0)
00303                 {
00304                         /* Now follows a string containing the
00305                          * color value. */
00306                         (fp->line_number)++;
00307                         fscanf (fp->fp, "%d\n", &polyline->color);
00308                 }
00309                 else if (strcmp (temp_string, "66") == 0)
00310                 {
00311                         /* Now follows a string containing the
00312                          * vertces follow flag. */
00313                         (fp->line_number)++;
00314                         fscanf (fp->fp, "%d\n", &polyline->vertices_follow);
00315                 }
00316                 else if (strcmp (temp_string, "67") == 0)
00317                 {
00318                         /* Now follows a string containing the
00319                          * paperspace value. */
00320                         (fp->line_number)++;
00321                         fscanf (fp->fp, "%d\n", &polyline->paperspace);
00322                 }
00323                 else if (strcmp (temp_string, "70") == 0)
00324                 {
00325                         /* Now follows a string containing the
00326                          * flag value. */
00327                         (fp->line_number)++;
00328                         fscanf (fp->fp, "%d\n", &polyline->flag);
00329                 }
00330                 else if (strcmp (temp_string, "71") == 0)
00331                 {
00332                         /* Now follows a string containing the polygon
00333                          * mesh M vertex count value. */
00334                         (fp->line_number)++;
00335                         fscanf (fp->fp, "%d\n", &polyline->polygon_mesh_M_vertex_count);
00336                 }
00337                 else if (strcmp (temp_string, "72") == 0)
00338                 {
00339                         /* Now follows a string containing the polygon
00340                          * mesh N vertex count value. */
00341                         (fp->line_number)++;
00342                         fscanf (fp->fp, "%d\n", &polyline->polygon_mesh_N_vertex_count);
00343                 }
00344                 else if (strcmp (temp_string, "73") == 0)
00345                 {
00346                         /* Now follows a string containing the smooth M
00347                          * surface density value. */
00348                         (fp->line_number)++;
00349                         fscanf (fp->fp, "%d\n", &polyline->smooth_M_surface_density);
00350                 }
00351                 else if (strcmp (temp_string, "74") == 0)
00352                 {
00353                         /* Now follows a string containing the smooth N
00354                          * surface density value. */
00355                         (fp->line_number)++;
00356                         fscanf (fp->fp, "%d\n", &polyline->smooth_M_surface_density);
00357                 }
00358                 else if (strcmp (temp_string, "75") == 0)
00359                 {
00360                         /* Now follows a string containing the surface
00361                          * type value. */
00362                         (fp->line_number)++;
00363                         fscanf (fp->fp, "%d\n", &polyline->surface_type);
00364                 }
00365                 else if (strcmp (temp_string, "100") == 0)
00366                 {
00367                         /* Subclass markers are post AutoCAD R12
00368                          * variable so additional testing for the
00369                          * version should probably be added here.
00370                          * Now follows a string containing the
00371                          * subclass marker value. */
00372                         (fp->line_number)++;
00373                         fscanf (fp->fp, "%s\n", temp_string);
00374                 }
00375                 else if (strcmp (temp_string, "210") == 0)
00376                 {
00377                         /* Now follows a string containing the
00378                          * X-value of the extrusion vector. */
00379                         (fp->line_number)++;
00380                         fscanf (fp->fp, "%lf\n", &polyline->extr_x0);
00381                 }
00382                 else if (strcmp (temp_string, "220") == 0)
00383                 {
00384                         /* Now follows a string containing the
00385                          * Y-value of the extrusion vector. */
00386                         (fp->line_number)++;
00387                         fscanf (fp->fp, "%lf\n", &polyline->extr_y0);
00388                 }
00389                 else if (strcmp (temp_string, "230") == 0)
00390                 {
00391                         /* Now follows a string containing the
00392                          * Z-value of the extrusion vector. */
00393                         (fp->line_number)++;
00394                         fscanf (fp->fp, "%lf\n", &polyline->extr_z0);
00395                 }
00396                 else if (strcmp (temp_string, "330") == 0)
00397                 {
00398                         /* Now follows a string containing Soft-pointer
00399                          * ID/handle to owner dictionary. */
00400                         (fp->line_number)++;
00401                         fscanf (fp->fp, "%s\n", polyline->dictionary_owner_soft);
00402                 }
00403                 else if (strcmp (temp_string, "360") == 0)
00404                 {
00405                         /* Now follows a string containing Hard owner
00406                          * ID/handle to owner dictionary. */
00407                         (fp->line_number)++;
00408                         fscanf (fp->fp, "%s\n", polyline->dictionary_owner_hard);
00409                 }
00410                 else if (strcmp (temp_string, "999") == 0)
00411                 {
00412                         /* Now follows a string containing a comment. */
00413                         (fp->line_number)++;
00414                         fscanf (fp->fp, "%s\n", temp_string);
00415                         fprintf (stdout, "DXF comment: %s\n", temp_string);
00416                 }
00417                 else
00418                 {
00419                         fprintf (stderr,
00420                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00421                           __FUNCTION__, fp->filename, fp->line_number);
00422                 }
00423         }
00424         /* Handle omitted members and/or illegal values. */
00425         if (strcmp (dxf_polyline_get_linetype (polyline), "") == 0)
00426         {
00427                 dxf_polyline_set_linetype (polyline, strdup (DXF_DEFAULT_LINETYPE));
00428         }
00429         if (strcmp (dxf_polyline_get_layer (polyline), "") == 0)
00430         {
00431                 dxf_polyline_set_layer (polyline, strdup (DXF_DEFAULT_LAYER));
00432         }
00433         /* Clean up. */
00434         free (temp_string);
00435 #if DEBUG
00436         DXF_DEBUG_END
00437 #endif
00438         return (polyline);
00439 }
00440 
00441 
00448 int
00449 dxf_polyline_write
00450 (
00451         DxfFile *fp,
00453         DxfPolyline *polyline
00455 )
00456 {
00457 #if DEBUG
00458         DXF_DEBUG_BEGIN
00459 #endif
00460         char *dxf_entity_name = strdup ("POLYLINE");
00461         DxfVertex *iter = NULL;
00462 
00463         /* Do some basic checks. */
00464         if (fp == NULL)
00465         {
00466                 fprintf (stderr,
00467                   (_("Error in %s () a NULL file pointer was passed.\n")),
00468                   __FUNCTION__);
00469                 /* Clean up. */
00470                 free (dxf_entity_name);
00471                 return (EXIT_FAILURE);
00472         }
00473         if (polyline == NULL)
00474         {
00475                 fprintf (stderr,
00476                   (_("Error in %s () a NULL pointer was passed.\n")),
00477                   __FUNCTION__);
00478                 /* Clean up. */
00479                 free (dxf_entity_name);
00480                 return (EXIT_FAILURE);
00481         }
00482         if (dxf_polyline_get_x0 (polyline) != 0.0)
00483         {
00484                 fprintf (stderr,
00485                   (_("Error in %s () start point has an invalid X-value for the %s entity with id-code: %x\n")),
00486                   __FUNCTION__, dxf_entity_name, dxf_polyline_get_id_code (polyline));
00487                 /* Clean up. */
00488                 free (dxf_entity_name);
00489                 return (EXIT_FAILURE);
00490         }
00491         if (dxf_polyline_get_y0 (polyline) != 0.0)
00492         {
00493                 fprintf (stderr,
00494                   (_("Error in %s () start point has an invalid Y-value for the %s entity with id-code: %x\n")),
00495                   __FUNCTION__, dxf_entity_name, dxf_polyline_get_id_code (polyline));
00496                 /* Clean up. */
00497                 free (dxf_entity_name);
00498                 return (EXIT_FAILURE);
00499         }
00500         if (dxf_polyline_get_vertices_follow (polyline) != 1)
00501         {
00502                 fprintf (stderr,
00503                   (_("Error in %s () vertices follow flag has an invalid value for the %s entity with id-code: %x\n")),
00504                   __FUNCTION__, dxf_entity_name, dxf_polyline_get_id_code (polyline));
00505                 /* Clean up. */
00506                 free (dxf_entity_name);
00507                 return (EXIT_FAILURE);
00508         }
00509         if (strcmp (dxf_polyline_get_linetype (polyline), "") == 0)
00510         {
00511                 fprintf (stderr,
00512                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00513                   __FUNCTION__, dxf_entity_name, dxf_polyline_get_id_code (polyline));
00514                 fprintf (stderr,
00515                   (_("\t%s entity is reset to default linetype")),
00516                   dxf_entity_name);
00517                 dxf_polyline_set_linetype (polyline, strdup (DXF_DEFAULT_LINETYPE));
00518         }
00519         if (strcmp (dxf_polyline_get_layer (polyline), "") == 0)
00520         {
00521                 fprintf (stderr,
00522                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")),
00523                   __FUNCTION__, dxf_entity_name, dxf_polyline_get_id_code (polyline));
00524                 fprintf (stderr,
00525                   (_("\t%s entity is relocated to layer 0\n")),
00526                   dxf_entity_name);
00527                 dxf_polyline_set_layer (polyline, strdup (DXF_DEFAULT_LAYER));
00528         }
00529         /* Start writing output. */
00530         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00531         if (dxf_polyline_get_id_code (polyline) != -1)
00532         {
00533                 fprintf (fp->fp, "  5\n%x\n", dxf_polyline_get_id_code (polyline));
00534         }
00545         if ((strcmp (polyline->dictionary_owner_soft, "") != 0)
00546           && (fp->acad_version_number >= AutoCAD_14))
00547         {
00548                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00549                 fprintf (fp->fp, "330\n%s\n", dxf_polyline_get_dictionary_owner_soft (polyline));
00550                 fprintf (fp->fp, "102\n}\n");
00551         }
00552         if ((strcmp (polyline->dictionary_owner_hard, "") != 0)
00553           && (fp->acad_version_number >= AutoCAD_14))
00554         {
00555                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00556                 fprintf (fp->fp, "360\n%s\n", dxf_polyline_get_dictionary_owner_hard (polyline));
00557                 fprintf (fp->fp, "102\n}\n");
00558         }
00559         if (fp->acad_version_number >= AutoCAD_13)
00560         {
00561                 fprintf (fp->fp, "100\nAcDbEntity\n");
00562         }
00563         if (dxf_polyline_get_paperspace (polyline) == DXF_PAPERSPACE)
00564         {
00565                 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE);
00566         }
00567         fprintf (fp->fp, "  8\n%s\n", dxf_polyline_get_layer (polyline));
00568         if (strcmp (dxf_polyline_get_linetype (polyline), DXF_DEFAULT_LINETYPE) != 0)
00569         {
00570                 fprintf (fp->fp, "  6\n%s\n", dxf_polyline_get_linetype (polyline));
00571         }
00572         if ((fp->acad_version_number <= AutoCAD_11)
00573           && DXF_FLATLAND
00574           && (dxf_polyline_get_elevation (polyline) != 0.0))
00575         {
00576                 fprintf (fp->fp, " 38\n%f\n", dxf_polyline_get_elevation (polyline));
00577         }
00578         if (dxf_polyline_get_color (polyline) != DXF_COLOR_BYLAYER)
00579         {
00580                 fprintf (fp->fp, " 62\n%d\n", dxf_polyline_get_color (polyline));
00581         }
00582         if (dxf_polyline_get_linetype_scale (polyline) != 1.0)
00583         {
00584                 fprintf (fp->fp, " 48\n%f\n", dxf_polyline_get_linetype_scale (polyline));
00585         }
00586         if (dxf_polyline_get_visibility (polyline) != 0)
00587         {
00588                 fprintf (fp->fp, " 60\n%d\n", dxf_polyline_get_visibility (polyline));
00589         }
00590         if (fp->acad_version_number >= AutoCAD_13)
00591         {
00592                 fprintf (fp->fp, "100\nAcDb3dPolyline\n");
00593         }
00594         if (fp->acad_version_number < AutoCAD_2002)
00595         {
00596                 fprintf (fp->fp, " 66\n%d\n", dxf_polyline_get_vertices_follow (polyline));
00597         }
00598         fprintf (fp->fp, " 10\n%f\n", dxf_polyline_get_x0 (polyline));
00599         fprintf (fp->fp, " 20\n%f\n", dxf_polyline_get_y0 (polyline));
00600         fprintf (fp->fp, " 30\n%f\n", dxf_polyline_get_z0 (polyline));
00601         if (dxf_polyline_get_thickness (polyline) != 0.0)
00602         {
00603                 fprintf (fp->fp, " 39\n%f\n", dxf_polyline_get_thickness (polyline));
00604         }
00605         fprintf (fp->fp, " 70\n%d\n", dxf_polyline_get_flag (polyline));
00606         if (dxf_polyline_get_start_width (polyline) != 0.0)
00607         {
00608                 fprintf (fp->fp, " 40\n%f\n", dxf_polyline_get_start_width (polyline));
00609         }
00610         if (dxf_polyline_get_end_width (polyline) != 0.0)
00611         {
00612                 fprintf (fp->fp, " 41\n%f\n", dxf_polyline_get_end_width (polyline));
00613         }
00614         fprintf (fp->fp, " 71\n%d\n", dxf_polyline_get_polygon_mesh_M_vertex_count (polyline));
00615         fprintf (fp->fp, " 72\n%d\n", dxf_polyline_get_polygon_mesh_N_vertex_count (polyline));
00616         fprintf (fp->fp, " 73\n%d\n", dxf_polyline_get_smooth_M_surface_density (polyline));
00617         fprintf (fp->fp, " 74\n%d\n", dxf_polyline_get_smooth_N_surface_density (polyline));
00618         fprintf (fp->fp, " 75\n%d\n", dxf_polyline_get_surface_type (polyline));
00619         if ((fp->acad_version_number >= AutoCAD_12)
00620                 && (dxf_polyline_get_extr_x0 (polyline) != 0.0)
00621                 && (dxf_polyline_get_extr_y0 (polyline) != 0.0)
00622                 && (dxf_polyline_get_extr_z0 (polyline) != 1.0))
00623         {
00624                 fprintf (fp->fp, "210\n%f\n", dxf_polyline_get_extr_x0 (polyline));
00625                 fprintf (fp->fp, "220\n%f\n", dxf_polyline_get_extr_y0 (polyline));
00626                 fprintf (fp->fp, "230\n%f\n", dxf_polyline_get_extr_z0 (polyline));
00627         }
00628         /* Start of writing (multiple) vertices. */
00629         iter = (DxfVertex *) dxf_polyline_get_vertices (polyline);
00630         while (iter != NULL)
00631         {
00632                 dxf_vertex_write (fp, iter);
00633                 iter = (DxfVertex *) iter->next;
00634         }
00635         dxf_vertex_free (iter);
00636         /* Clean up. */
00637         free (dxf_entity_name);
00638 #if DEBUG
00639         DXF_DEBUG_END
00640 #endif
00641         return (EXIT_SUCCESS);
00642 }
00643 
00644 
00652 int
00653 dxf_polyline_free
00654 (
00655         DxfPolyline *polyline
00658 )
00659 {
00660 #if DEBUG
00661         DXF_DEBUG_BEGIN
00662 #endif
00663         /* Do some basic checks. */
00664         if (polyline == NULL)
00665         {
00666                 fprintf (stderr,
00667                   (_("Error in %s () a NULL pointer was passed.\n")),
00668                   __FUNCTION__);
00669                 return (EXIT_FAILURE);
00670         }
00671         if (polyline->next != NULL)
00672         {
00673                 fprintf (stderr,
00674                   (_("Error in %s () pointer to next was not NULL.\n")),
00675                   __FUNCTION__);
00676                 return (EXIT_FAILURE);
00677         }
00678         free (dxf_polyline_get_linetype (polyline));
00679         free (dxf_polyline_get_layer (polyline));
00680         dxf_binary_graphics_data_free_chain (dxf_polyline_get_binary_graphics_data (polyline));
00681         free (dxf_polyline_get_dictionary_owner_soft (polyline));
00682         free (dxf_polyline_get_material (polyline));
00683         free (dxf_polyline_get_dictionary_owner_hard (polyline));
00684         free (dxf_polyline_get_plot_style_name (polyline));
00685         free (dxf_polyline_get_color_name (polyline));
00686         dxf_point_free (dxf_polyline_get_p0 (polyline));
00687         dxf_vertex_free_chain (dxf_polyline_get_vertices (polyline));
00688         free (polyline);
00689         polyline = NULL;
00690 #if DEBUG
00691         DXF_DEBUG_END
00692 #endif
00693         return (EXIT_SUCCESS);
00694 }
00695 
00696 
00701 void
00702 dxf_polyline_free_chain
00703 (
00704         DxfPolyline *polylines
00706 )
00707 {
00708 #ifdef DEBUG
00709         DXF_DEBUG_BEGIN
00710 #endif
00711         if (polylines == NULL)
00712         {
00713                 fprintf (stderr,
00714                   (_("Warning in %s () a NULL pointer was passed.\n")),
00715                   __FUNCTION__);
00716         }
00717         while (polylines != NULL)
00718         {
00719                 struct DxfPolyline *iter = polylines->next;
00720                 dxf_polyline_free (polylines);
00721                 polylines = (DxfPolyline *) iter;
00722         }
00723 #if DEBUG
00724         DXF_DEBUG_END
00725 #endif
00726 }
00727 
00728 
00734 int
00735 dxf_polyline_get_id_code
00736 (
00737         DxfPolyline *polyline
00739 )
00740 {
00741 #if DEBUG
00742         DXF_DEBUG_BEGIN
00743 #endif
00744         /* Do some basic checks. */
00745         if (polyline == NULL)
00746         {
00747                 fprintf (stderr,
00748                   (_("Error in %s () a NULL pointer was passed.\n")),
00749                   __FUNCTION__);
00750                 return (EXIT_FAILURE);
00751         }
00752         if (polyline->id_code < 0)
00753         {
00754                 fprintf (stderr,
00755                   (_("Warning in %s () a negative value was found in the id-code member.\n")),
00756                   __FUNCTION__);
00757         }
00758 #if DEBUG
00759         DXF_DEBUG_END
00760 #endif
00761         return (polyline->id_code);
00762 }
00763 
00764 
00771 DxfPolyline *
00772 dxf_polyline_set_id_code
00773 (
00774         DxfPolyline *polyline,
00776         int id_code
00780 )
00781 {
00782 #if DEBUG
00783         DXF_DEBUG_BEGIN
00784 #endif
00785         /* Do some basic checks. */
00786         if (polyline == NULL)
00787         {
00788                 fprintf (stderr,
00789                   (_("Error in %s () a NULL pointer was passed.\n")),
00790                   __FUNCTION__);
00791                 return (NULL);
00792         }
00793         if (id_code < 0)
00794         {
00795                 fprintf (stderr,
00796                   (_("Warning in %s () a negative id-code value was passed.\n")),
00797                   __FUNCTION__);
00798         }
00799         polyline->id_code = id_code;
00800 #if DEBUG
00801         DXF_DEBUG_END
00802 #endif
00803         return (polyline);
00804 }
00805 
00806 
00813 char *
00814 dxf_polyline_get_linetype
00815 (
00816         DxfPolyline *polyline
00818 )
00819 {
00820 #if DEBUG
00821         DXF_DEBUG_BEGIN
00822 #endif
00823         /* Do some basic checks. */
00824         if (polyline == NULL)
00825         {
00826                 fprintf (stderr,
00827                   (_("Error in %s () a NULL pointer was passed.\n")),
00828                   __FUNCTION__);
00829                 return (NULL);
00830         }
00831         if (polyline->linetype ==  NULL)
00832         {
00833                 fprintf (stderr,
00834                   (_("Error in %s () a NULL pointer was found in the linetype member.\n")),
00835                   __FUNCTION__);
00836                 return (NULL);
00837         }
00838 #if DEBUG
00839         DXF_DEBUG_END
00840 #endif
00841         return (strdup (polyline->linetype));
00842 }
00843 
00844 
00854 DxfPolyline *
00855 dxf_polyline_set_linetype
00856 (
00857         DxfPolyline *polyline,
00859         char *linetype
00861 )
00862 {
00863 #if DEBUG
00864         DXF_DEBUG_BEGIN
00865 #endif
00866         /* Do some basic checks. */
00867         if (polyline == NULL)
00868         {
00869                 fprintf (stderr,
00870                   (_("Error in %s () a NULL pointer was passed.\n")),
00871                   __FUNCTION__);
00872                 return (NULL);
00873         }
00874         if (linetype == NULL)
00875         {
00876                 fprintf (stderr,
00877                   (_("Error in %s () a NULL pointer was passed.\n")),
00878                   __FUNCTION__);
00879                 return (NULL);
00880         }
00881         polyline->linetype = strdup (linetype);
00882 #if DEBUG
00883         DXF_DEBUG_END
00884 #endif
00885         return (polyline);
00886 }
00887 
00888 
00895 char *
00896 dxf_polyline_get_layer
00897 (
00898         DxfPolyline *polyline
00900 )
00901 {
00902 #if DEBUG
00903         DXF_DEBUG_BEGIN
00904 #endif
00905         /* Do some basic checks. */
00906         if (polyline == NULL)
00907         {
00908                 fprintf (stderr,
00909                   (_("Error in %s () a NULL pointer was passed.\n")),
00910                   __FUNCTION__);
00911                 return (NULL);
00912         }
00913         if (polyline->layer ==  NULL)
00914         {
00915                 fprintf (stderr,
00916                   (_("Error in %s () a NULL pointer was found in the layer member.\n")),
00917                   __FUNCTION__);
00918                 return (NULL);
00919         }
00920 #if DEBUG
00921         DXF_DEBUG_END
00922 #endif
00923         return (strdup (polyline->layer));
00924 }
00925 
00926 
00935 DxfPolyline *
00936 dxf_polyline_set_layer
00937 (
00938         DxfPolyline *polyline,
00940         char *layer
00942 )
00943 {
00944 #if DEBUG
00945         DXF_DEBUG_BEGIN
00946 #endif
00947         /* Do some basic checks. */
00948         if (polyline == NULL)
00949         {
00950                 fprintf (stderr,
00951                   (_("Error in %s () a NULL pointer was passed.\n")),
00952                   __FUNCTION__);
00953                 return (NULL);
00954         }
00955         if (layer == NULL)
00956         {
00957                 fprintf (stderr,
00958                   (_("Error in %s () a NULL pointer was passed.\n")),
00959                   __FUNCTION__);
00960                 return (NULL);
00961         }
00962         polyline->layer = strdup (layer);
00963 #if DEBUG
00964         DXF_DEBUG_END
00965 #endif
00966         return (polyline);
00967 }
00968 
00969 
00975 double
00976 dxf_polyline_get_elevation
00977 (
00978         DxfPolyline *polyline
00980 )
00981 {
00982 #if DEBUG
00983         DXF_DEBUG_BEGIN
00984 #endif
00985         /* Do some basic checks. */
00986         if (polyline == NULL)
00987         {
00988                 fprintf (stderr,
00989                   (_("Error in %s () a NULL pointer was passed.\n")),
00990                   __FUNCTION__);
00991                 return (EXIT_FAILURE);
00992         }
00993 #if DEBUG
00994         DXF_DEBUG_END
00995 #endif
00996         return (polyline->elevation);
00997 }
00998 
00999 
01006 DxfPolyline *
01007 dxf_polyline_set_elevation
01008 (
01009         DxfPolyline *polyline,
01011         double elevation
01013 )
01014 {
01015 #if DEBUG
01016         DXF_DEBUG_BEGIN
01017 #endif
01018         /* Do some basic checks. */
01019         if (polyline == NULL)
01020         {
01021                 fprintf (stderr,
01022                   (_("Error in %s () a NULL pointer was passed.\n")),
01023                   __FUNCTION__);
01024                 return (NULL);
01025         }
01026         polyline->elevation = elevation;
01027 #if DEBUG
01028         DXF_DEBUG_END
01029 #endif
01030         return (polyline);
01031 }
01032 
01033 
01039 double
01040 dxf_polyline_get_thickness
01041 (
01042         DxfPolyline *polyline
01044 )
01045 {
01046 #if DEBUG
01047         DXF_DEBUG_BEGIN
01048 #endif
01049         /* Do some basic checks. */
01050         if (polyline == NULL)
01051         {
01052                 fprintf (stderr,
01053                   (_("Error in %s () a NULL pointer was passed.\n")),
01054                   __FUNCTION__);
01055                 return (EXIT_FAILURE);
01056         }
01057         if (polyline->thickness < 0.0)
01058         {
01059                 fprintf (stderr,
01060                   (_("Warning in %s () a negative value was found in the thickness member.\n")),
01061                   __FUNCTION__);
01062         }
01063 #if DEBUG
01064         DXF_DEBUG_END
01065 #endif
01066         return (polyline->thickness);
01067 }
01068 
01069 
01076 DxfPolyline *
01077 dxf_polyline_set_thickness
01078 (
01079         DxfPolyline *polyline,
01081         double thickness
01083 )
01084 {
01085 #if DEBUG
01086         DXF_DEBUG_BEGIN
01087 #endif
01088         /* Do some basic checks. */
01089         if (polyline == NULL)
01090         {
01091                 fprintf (stderr,
01092                   (_("Error in %s () a NULL pointer was passed.\n")),
01093                   __FUNCTION__);
01094                 return (NULL);
01095         }
01096         if (thickness < 0.0)
01097         {
01098                 fprintf (stderr,
01099                   (_("Warning in %s () a negative thickness value was passed.\n")),
01100                   __FUNCTION__);
01101         }
01102         polyline->thickness = thickness;
01103 #if DEBUG
01104         DXF_DEBUG_END
01105 #endif
01106         return (polyline);
01107 }
01108 
01109 
01115 double
01116 dxf_polyline_get_linetype_scale
01117 (
01118         DxfPolyline *polyline
01120 )
01121 {
01122 #if DEBUG
01123         DXF_DEBUG_BEGIN
01124 #endif
01125         /* Do some basic checks. */
01126         if (polyline == NULL)
01127         {
01128                 fprintf (stderr,
01129                   (_("Error in %s () a NULL pointer was passed.\n")),
01130                   __FUNCTION__);
01131                 return (EXIT_FAILURE);
01132         }
01133         if (polyline->linetype_scale < 0.0)
01134         {
01135                 fprintf (stderr,
01136                   (_("Warning in %s () a negative value was found in the linetype_scale member.\n")),
01137                   __FUNCTION__);
01138         }
01139 #if DEBUG
01140         DXF_DEBUG_END
01141 #endif
01142         return (polyline->linetype_scale);
01143 }
01144 
01145 
01152 DxfPolyline *
01153 dxf_polyline_set_linetype_scale
01154 (
01155         DxfPolyline *polyline,
01157         double linetype_scale
01159 )
01160 {
01161 #if DEBUG
01162         DXF_DEBUG_BEGIN
01163 #endif
01164         /* Do some basic checks. */
01165         if (polyline == NULL)
01166         {
01167                 fprintf (stderr,
01168                   (_("Error in %s () a NULL pointer was passed.\n")),
01169                   __FUNCTION__);
01170                 return (NULL);
01171         }
01172         if (linetype_scale < 0.0)
01173         {
01174                 fprintf (stderr,
01175                   (_("Warning in %s () a negative linetype_scale value was passed.\n")),
01176                   __FUNCTION__);
01177         }
01178         polyline->linetype_scale = linetype_scale;
01179 #if DEBUG
01180         DXF_DEBUG_END
01181 #endif
01182         return (polyline);
01183 }
01184 
01185 
01191 int16_t
01192 dxf_polyline_get_visibility
01193 (
01194         DxfPolyline *polyline
01196 )
01197 {
01198 #if DEBUG
01199         DXF_DEBUG_BEGIN
01200 #endif
01201         /* Do some basic checks. */
01202         if (polyline == NULL)
01203         {
01204                 fprintf (stderr,
01205                   (_("Error in %s () a NULL pointer was passed.\n")),
01206                   __FUNCTION__);
01207                 return (EXIT_FAILURE);
01208         }
01209         if (polyline->visibility < 0)
01210         {
01211                 fprintf (stderr,
01212                   (_("Error in %s () a negative value was found in the visibility member.\n")),
01213                   __FUNCTION__);
01214                 return (EXIT_FAILURE);
01215         }
01216         if (polyline->visibility > 1)
01217         {
01218                 fprintf (stderr,
01219                   (_("Error in %s () an out of range value was found in the visibility member.\n")),
01220                   __FUNCTION__);
01221                 return (EXIT_FAILURE);
01222         }
01223 #if DEBUG
01224         DXF_DEBUG_END
01225 #endif
01226         return (polyline->visibility);
01227 }
01228 
01229 
01236 DxfPolyline *
01237 dxf_polyline_set_visibility
01238 (
01239         DxfPolyline *polyline,
01241         int16_t visibility
01243 )
01244 {
01245 #if DEBUG
01246         DXF_DEBUG_BEGIN
01247 #endif
01248         /* Do some basic checks. */
01249         if (polyline == NULL)
01250         {
01251                 fprintf (stderr,
01252                   (_("Error in %s () a NULL pointer was passed.\n")),
01253                   __FUNCTION__);
01254                 return (NULL);
01255         }
01256         if (visibility < 0)
01257         {
01258                 fprintf (stderr,
01259                   (_("Error in %s () a negative visibility value was passed.\n")),
01260                   __FUNCTION__);
01261                 return (NULL);
01262         }
01263         if (visibility > 1)
01264         {
01265                 fprintf (stderr,
01266                   (_("Error in %s () an out of range visibility value was passed.\n")),
01267                   __FUNCTION__);
01268                 return (NULL);
01269         }
01270         polyline->visibility = visibility;
01271 #if DEBUG
01272         DXF_DEBUG_END
01273 #endif
01274         return (polyline);
01275 }
01276 
01277 
01283 int
01284 dxf_polyline_get_color
01285 (
01286         DxfPolyline *polyline
01288 )
01289 {
01290 #if DEBUG
01291         DXF_DEBUG_BEGIN
01292 #endif
01293         /* Do some basic checks. */
01294         if (polyline == NULL)
01295         {
01296                 fprintf (stderr,
01297                   (_("Error in %s () a NULL pointer was passed.\n")),
01298                   __FUNCTION__);
01299                 return (EXIT_FAILURE);
01300         }
01301         if (polyline->color < 0)
01302         {
01303                 fprintf (stderr,
01304                   (_("Warning in %s () a negative value was found in the color member.\n")),
01305                   __FUNCTION__);
01306         }
01307 #if DEBUG
01308         DXF_DEBUG_END
01309 #endif
01310         return (polyline->color);
01311 }
01312 
01313 
01320 DxfPolyline *
01321 dxf_polyline_set_color
01322 (
01323         DxfPolyline *polyline,
01325         int color
01327 )
01328 {
01329 #if DEBUG
01330         DXF_DEBUG_BEGIN
01331 #endif
01332         /* Do some basic checks. */
01333         if (polyline == NULL)
01334         {
01335                 fprintf (stderr,
01336                   (_("Error in %s () a NULL pointer was passed.\n")),
01337                   __FUNCTION__);
01338                 return (NULL);
01339         }
01340         if (color < 0)
01341         {
01342                 fprintf (stderr,
01343                   (_("Warning in %s () a negative color value was passed.\n")),
01344                   __FUNCTION__);
01345                 fprintf (stderr,
01346                   (_("\teffectively turning this entity it's visibility off.\n")));
01347         }
01348         polyline->color = color;
01349 #if DEBUG
01350         DXF_DEBUG_END
01351 #endif
01352         return (polyline);
01353 }
01354 
01355 
01362 int
01363 dxf_polyline_get_paperspace
01364 (
01365         DxfPolyline *polyline
01367 )
01368 {
01369 #if DEBUG
01370         DXF_DEBUG_BEGIN
01371 #endif
01372         /* Do some basic checks. */
01373         if (polyline == NULL)
01374         {
01375                 fprintf (stderr,
01376                   (_("Error in %s () a NULL pointer was passed.\n")),
01377                   __FUNCTION__);
01378                 return (EXIT_FAILURE);
01379         }
01380         if (polyline->paperspace < 0)
01381         {
01382                 fprintf (stderr,
01383                   (_("Warning in %s () a negative value was found in the paperspace member.\n")),
01384                   __FUNCTION__);
01385         }
01386         if (polyline->paperspace > 1)
01387         {
01388                 fprintf (stderr,
01389                   (_("Warning in %s () an out of range value was found in the paperspace member.\n")),
01390                   __FUNCTION__);
01391         }
01392 #if DEBUG
01393         DXF_DEBUG_END
01394 #endif
01395         return (polyline->paperspace);
01396 }
01397 
01398 
01405 DxfPolyline *
01406 dxf_polyline_set_paperspace
01407 (
01408         DxfPolyline *polyline,
01410         int paperspace
01412 )
01413 {
01414 #if DEBUG
01415         DXF_DEBUG_BEGIN
01416 #endif
01417         /* Do some basic checks. */
01418         if (polyline == NULL)
01419         {
01420                 fprintf (stderr,
01421                   (_("Error in %s () a NULL pointer was passed.\n")),
01422                   __FUNCTION__);
01423                 return (NULL);
01424         }
01425         if (paperspace < 0)
01426         {
01427                 fprintf (stderr,
01428                   (_("Error in %s () a negative paperspace value was passed.\n")),
01429                   __FUNCTION__);
01430                 return (NULL);
01431         }
01432         if (paperspace > 1)
01433         {
01434                 fprintf (stderr,
01435                   (_("Error in %s () an out of range paperspace value was passed.\n")),
01436                   __FUNCTION__);
01437                 return (NULL);
01438         }
01439         polyline->paperspace = paperspace;
01440 #if DEBUG
01441         DXF_DEBUG_END
01442 #endif
01443         return (polyline);
01444 }
01445 
01446 
01454 int
01455 dxf_polyline_get_graphics_data_size
01456 (
01457         DxfPolyline *polyline
01459 )
01460 {
01461 #if DEBUG
01462         DXF_DEBUG_BEGIN
01463 #endif
01464         /* Do some basic checks. */
01465         if (polyline == NULL)
01466         {
01467                 fprintf (stderr,
01468                   (_("Error in %s () a NULL pointer was passed.\n")),
01469                   __FUNCTION__);
01470                 return (EXIT_FAILURE);
01471         }
01472         if (polyline->graphics_data_size < 0)
01473         {
01474                 fprintf (stderr,
01475                   (_("Warning in %s () a negative value was found in the graphics_data_size member.\n")),
01476                   __FUNCTION__);
01477         }
01478         if (polyline->graphics_data_size == 0)
01479         {
01480                 fprintf (stderr,
01481                   (_("Warning in %s () a zero value was found in the graphics_data_size member.\n")),
01482                   __FUNCTION__);
01483         }
01484 #if DEBUG
01485         DXF_DEBUG_END
01486 #endif
01487         return (polyline->graphics_data_size);
01488 }
01489 
01490 
01498 DxfPolyline *
01499 dxf_polyline_set_graphics_data_size
01500 (
01501         DxfPolyline *polyline,
01503         int graphics_data_size
01506 )
01507 {
01508 #if DEBUG
01509         DXF_DEBUG_BEGIN
01510 #endif
01511         /* Do some basic checks. */
01512         if (polyline == NULL)
01513         {
01514                 fprintf (stderr,
01515                   (_("Error in %s () a NULL pointer was passed.\n")),
01516                   __FUNCTION__);
01517                 return (NULL);
01518         }
01519         if (graphics_data_size < 0)
01520         {
01521                 fprintf (stderr,
01522                   (_("Error in %s () a negative graphics_data_size value was passed.\n")),
01523                   __FUNCTION__);
01524                 return (NULL);
01525         }
01526         if (graphics_data_size == 0)
01527         {
01528                 fprintf (stderr,
01529                   (_("Warning in %s () a zero graphics_data_size value was passed.\n")),
01530                   __FUNCTION__);
01531         }
01532         polyline->graphics_data_size = graphics_data_size;
01533 #if DEBUG
01534         DXF_DEBUG_END
01535 #endif
01536         return (polyline);
01537 }
01538 
01539 
01546 int16_t
01547 dxf_polyline_get_shadow_mode
01548 (
01549         DxfPolyline *polyline
01551 )
01552 {
01553 #if DEBUG
01554         DXF_DEBUG_BEGIN
01555 #endif
01556         /* Do some basic checks. */
01557         if (polyline == NULL)
01558         {
01559                 fprintf (stderr,
01560                   (_("Error in %s () a NULL pointer was passed.\n")),
01561                   __FUNCTION__);
01562                 return (EXIT_FAILURE);
01563         }
01564         if (polyline->shadow_mode < 0)
01565         {
01566                 fprintf (stderr,
01567                   (_("Error in %s () a negative value was found in the shadow_mode member.\n")),
01568                   __FUNCTION__);
01569                 return (EXIT_FAILURE);
01570         }
01571         if (polyline->shadow_mode > 3)
01572         {
01573                 fprintf (stderr,
01574                   (_("Error in %s () an out of range value was found in the shadow_mode member.\n")),
01575                   __FUNCTION__);
01576                 return (EXIT_FAILURE);
01577         }
01578 #if DEBUG
01579         DXF_DEBUG_END
01580 #endif
01581         return (polyline->shadow_mode);
01582 }
01583 
01584 
01591 DxfPolyline *
01592 dxf_polyline_set_shadow_mode
01593 (
01594         DxfPolyline *polyline,
01596         int16_t shadow_mode
01598 )
01599 {
01600 #if DEBUG
01601         DXF_DEBUG_BEGIN
01602 #endif
01603         /* Do some basic checks. */
01604         if (polyline == NULL)
01605         {
01606                 fprintf (stderr,
01607                   (_("Error in %s () a NULL pointer was passed.\n")),
01608                   __FUNCTION__);
01609                 return (NULL);
01610         }
01611         if (shadow_mode < 0)
01612         {
01613                 fprintf (stderr,
01614                   (_("Error in %s () a negative shadow_mode value was passed.\n")),
01615                   __FUNCTION__);
01616                 return (NULL);
01617         }
01618         if (shadow_mode > 3)
01619         {
01620                 fprintf (stderr,
01621                   (_("Error in %s () an out of range shadow_mode value was passed.\n")),
01622                   __FUNCTION__);
01623                 return (NULL);
01624         }
01625         polyline->shadow_mode = shadow_mode;
01626 #if DEBUG
01627         DXF_DEBUG_END
01628 #endif
01629         return (polyline);
01630 }
01631 
01632 
01641 DxfBinaryGraphicsData *
01642 dxf_polyline_get_binary_graphics_data
01643 (
01644         DxfPolyline *polyline
01646 )
01647 {
01648 #if DEBUG
01649         DXF_DEBUG_BEGIN
01650 #endif
01651         /* Do some basic checks. */
01652         if (polyline == NULL)
01653         {
01654                 fprintf (stderr,
01655                   (_("Error in %s () a NULL pointer was passed.\n")),
01656                   __FUNCTION__);
01657                 return (NULL);
01658         }
01659         if (polyline->binary_graphics_data ==  NULL)
01660         {
01661                 fprintf (stderr,
01662                   (_("Error in %s () a NULL pointer was found in the binary_graphics_data member.\n")),
01663                   __FUNCTION__);
01664                 return (NULL);
01665         }
01666 #if DEBUG
01667         DXF_DEBUG_END
01668 #endif
01669         return ((DxfBinaryGraphicsData *) polyline->binary_graphics_data);
01670 }
01671 
01672 
01677 DxfPolyline *
01678 dxf_polyline_set_binary_graphics_data
01679 (
01680         DxfPolyline *polyline,
01682         DxfBinaryGraphicsData *data
01685 )
01686 {
01687 #if DEBUG
01688         DXF_DEBUG_BEGIN
01689 #endif
01690         /* Do some basic checks. */
01691         if (polyline == NULL)
01692         {
01693                 fprintf (stderr,
01694                   (_("Error in %s () a NULL pointer was passed.\n")),
01695                   __FUNCTION__);
01696                 return (NULL);
01697         }
01698         if (data == NULL)
01699         {
01700                 fprintf (stderr,
01701                   (_("Error in %s () a NULL pointer was passed.\n")),
01702                   __FUNCTION__);
01703                 return (NULL);
01704         }
01705         polyline->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01706 #if DEBUG
01707         DXF_DEBUG_END
01708 #endif
01709         return (polyline);
01710 }
01711 
01712 
01721 char *
01722 dxf_polyline_get_dictionary_owner_soft
01723 (
01724         DxfPolyline *polyline
01726 )
01727 {
01728 #if DEBUG
01729         DXF_DEBUG_BEGIN
01730 #endif
01731         /* Do some basic checks. */
01732         if (polyline == NULL)
01733         {
01734                 fprintf (stderr,
01735                   (_("Error in %s () a NULL pointer was passed.\n")),
01736                   __FUNCTION__);
01737                 return (NULL);
01738         }
01739         if (polyline->dictionary_owner_soft ==  NULL)
01740         {
01741                 fprintf (stderr,
01742                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")),
01743                   __FUNCTION__);
01744                 return (NULL);
01745         }
01746 #if DEBUG
01747         DXF_DEBUG_END
01748 #endif
01749         return (strdup (polyline->dictionary_owner_soft));
01750 }
01751 
01752 
01757 DxfPolyline *
01758 dxf_polyline_set_dictionary_owner_soft
01759 (
01760         DxfPolyline *polyline,
01762         char *dictionary_owner_soft
01765 )
01766 {
01767 #if DEBUG
01768         DXF_DEBUG_BEGIN
01769 #endif
01770         /* Do some basic checks. */
01771         if (polyline == NULL)
01772         {
01773                 fprintf (stderr,
01774                   (_("Error in %s () a NULL pointer was passed.\n")),
01775                   __FUNCTION__);
01776                 return (NULL);
01777         }
01778         if (dictionary_owner_soft == NULL)
01779         {
01780                 fprintf (stderr,
01781                   (_("Error in %s () a NULL pointer was passed.\n")),
01782                   __FUNCTION__);
01783                 return (NULL);
01784         }
01785         polyline->dictionary_owner_soft = strdup (dictionary_owner_soft);
01786 #if DEBUG
01787         DXF_DEBUG_END
01788 #endif
01789         return (polyline);
01790 }
01791 
01792 
01802 char *
01803 dxf_polyline_get_material
01804 (
01805         DxfPolyline *polyline
01807 )
01808 {
01809 #if DEBUG
01810         DXF_DEBUG_BEGIN
01811 #endif
01812         /* Do some basic checks. */
01813         if (polyline == NULL)
01814         {
01815                 fprintf (stderr,
01816                   (_("Error in %s () a NULL pointer was passed.\n")),
01817                   __FUNCTION__);
01818                 return (NULL);
01819         }
01820         if (polyline->material ==  NULL)
01821         {
01822                 fprintf (stderr,
01823                   (_("Error in %s () a NULL pointer was found in the material member.\n")),
01824                   __FUNCTION__);
01825                 return (NULL);
01826         }
01827 #if DEBUG
01828         DXF_DEBUG_END
01829 #endif
01830         return (strdup (polyline->material));
01831 }
01832 
01833 
01841 DxfPolyline *
01842 dxf_polyline_set_material
01843 (
01844         DxfPolyline *polyline,
01846         char *material
01849 )
01850 {
01851 #if DEBUG
01852         DXF_DEBUG_BEGIN
01853 #endif
01854         /* Do some basic checks. */
01855         if (polyline == NULL)
01856         {
01857                 fprintf (stderr,
01858                   (_("Error in %s () a NULL pointer was passed.\n")),
01859                   __FUNCTION__);
01860                 return (NULL);
01861         }
01862         if (material == NULL)
01863         {
01864                 fprintf (stderr,
01865                   (_("Error in %s () a NULL pointer was passed.\n")),
01866                   __FUNCTION__);
01867                 return (NULL);
01868         }
01869         polyline->material = strdup (material);
01870 #if DEBUG
01871         DXF_DEBUG_END
01872 #endif
01873         return (polyline);
01874 }
01875 
01876 
01885 char *
01886 dxf_polyline_get_dictionary_owner_hard
01887 (
01888         DxfPolyline *polyline
01890 )
01891 {
01892 #if DEBUG
01893         DXF_DEBUG_BEGIN
01894 #endif
01895         /* Do some basic checks. */
01896         if (polyline == NULL)
01897         {
01898                 fprintf (stderr,
01899                   (_("Error in %s () a NULL pointer was passed.\n")),
01900                   __FUNCTION__);
01901                 return (NULL);
01902         }
01903         if (polyline->dictionary_owner_hard ==  NULL)
01904         {
01905                 fprintf (stderr,
01906                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")),
01907                   __FUNCTION__);
01908                 return (NULL);
01909         }
01910 #if DEBUG
01911         DXF_DEBUG_END
01912 #endif
01913         return (strdup (polyline->dictionary_owner_hard));
01914 }
01915 
01916 
01924 DxfPolyline *
01925 dxf_polyline_set_dictionary_owner_hard
01926 (
01927         DxfPolyline *polyline,
01929         char *dictionary_owner_hard
01932 )
01933 {
01934 #if DEBUG
01935         DXF_DEBUG_BEGIN
01936 #endif
01937         /* Do some basic checks. */
01938         if (polyline == NULL)
01939         {
01940                 fprintf (stderr,
01941                   (_("Error in %s () a NULL pointer was passed.\n")),
01942                   __FUNCTION__);
01943                 return (NULL);
01944         }
01945         if (dictionary_owner_hard == NULL)
01946         {
01947                 fprintf (stderr,
01948                   (_("Error in %s () a NULL pointer was passed.\n")),
01949                   __FUNCTION__);
01950                 return (NULL);
01951         }
01952         polyline->dictionary_owner_hard = strdup (dictionary_owner_hard);
01953 #if DEBUG
01954         DXF_DEBUG_END
01955 #endif
01956         return (polyline);
01957 }
01958 
01959 
01966 int16_t
01967 dxf_polyline_get_lineweight
01968 (
01969         DxfPolyline *polyline
01971 )
01972 {
01973 #if DEBUG
01974         DXF_DEBUG_BEGIN
01975 #endif
01976         /* Do some basic checks. */
01977         if (polyline == NULL)
01978         {
01979                 fprintf (stderr,
01980                   (_("Error in %s () a NULL pointer was passed.\n")),
01981                   __FUNCTION__);
01982                 return (EXIT_FAILURE);
01983         }
01984 #if DEBUG
01985         DXF_DEBUG_END
01986 #endif
01987         return (polyline->lineweight);
01988 }
01989 
01990 
01997 DxfPolyline *
01998 dxf_polyline_set_lineweight
01999 (
02000         DxfPolyline *polyline,
02002         int16_t lineweight
02004 )
02005 {
02006 #if DEBUG
02007         DXF_DEBUG_BEGIN
02008 #endif
02009         /* Do some basic checks. */
02010         if (polyline == NULL)
02011         {
02012                 fprintf (stderr,
02013                   (_("Error in %s () a NULL pointer was passed.\n")),
02014                   __FUNCTION__);
02015                 return (NULL);
02016         }
02017         polyline->lineweight = lineweight;
02018 #if DEBUG
02019         DXF_DEBUG_END
02020 #endif
02021         return (polyline);
02022 }
02023 
02024 
02031 char *
02032 dxf_polyline_get_plot_style_name
02033 (
02034         DxfPolyline *polyline
02036 )
02037 {
02038 #if DEBUG
02039         DXF_DEBUG_BEGIN
02040 #endif
02041         /* Do some basic checks. */
02042         if (polyline == NULL)
02043         {
02044                 fprintf (stderr,
02045                   (_("Error in %s () a NULL pointer was passed.\n")),
02046                   __FUNCTION__);
02047                 return (NULL);
02048         }
02049         if (polyline->plot_style_name ==  NULL)
02050         {
02051                 fprintf (stderr,
02052                   (_("Error in %s () a NULL pointer was found in the plot_style_name member.\n")),
02053                   __FUNCTION__);
02054                 return (NULL);
02055         }
02056 #if DEBUG
02057         DXF_DEBUG_END
02058 #endif
02059         return (strdup (polyline->plot_style_name));
02060 }
02061 
02062 
02069 DxfPolyline *
02070 dxf_polyline_set_plot_style_name
02071 (
02072         DxfPolyline *polyline,
02074         char *plot_style_name
02077 )
02078 {
02079 #if DEBUG
02080         DXF_DEBUG_BEGIN
02081 #endif
02082         /* Do some basic checks. */
02083         if (polyline == NULL)
02084         {
02085                 fprintf (stderr,
02086                   (_("Error in %s () a NULL pointer was passed.\n")),
02087                   __FUNCTION__);
02088                 return (NULL);
02089         }
02090         if (plot_style_name == NULL)
02091         {
02092                 fprintf (stderr,
02093                   (_("Error in %s () a NULL pointer was passed.\n")),
02094                   __FUNCTION__);
02095                 return (NULL);
02096         }
02097         polyline->plot_style_name = strdup (plot_style_name);
02098 #if DEBUG
02099         DXF_DEBUG_END
02100 #endif
02101         return (polyline);
02102 }
02103 
02104 
02111 long
02112 dxf_polyline_get_color_value
02113 (
02114         DxfPolyline *polyline
02116 )
02117 {
02118 #if DEBUG
02119         DXF_DEBUG_BEGIN
02120 #endif
02121         /* Do some basic checks. */
02122         if (polyline == NULL)
02123         {
02124                 fprintf (stderr,
02125                   (_("Error in %s () a NULL pointer was passed.\n")),
02126                   __FUNCTION__);
02127                 return (EXIT_FAILURE);
02128         }
02129 #if DEBUG
02130         DXF_DEBUG_END
02131 #endif
02132         return (polyline->color_value);
02133 }
02134 
02135 
02142 DxfPolyline *
02143 dxf_polyline_set_color_value
02144 (
02145         DxfPolyline *polyline,
02147         long color_value
02149 )
02150 {
02151 #if DEBUG
02152         DXF_DEBUG_BEGIN
02153 #endif
02154         /* Do some basic checks. */
02155         if (polyline == NULL)
02156         {
02157                 fprintf (stderr,
02158                   (_("Error in %s () a NULL pointer was passed.\n")),
02159                   __FUNCTION__);
02160                 return (NULL);
02161         }
02162         polyline->color_value = color_value;
02163 #if DEBUG
02164         DXF_DEBUG_END
02165 #endif
02166         return (polyline);
02167 }
02168 
02169 
02176 char *
02177 dxf_polyline_get_color_name
02178 (
02179         DxfPolyline *polyline
02181 )
02182 {
02183 #if DEBUG
02184         DXF_DEBUG_BEGIN
02185 #endif
02186         /* Do some basic checks. */
02187         if (polyline == NULL)
02188         {
02189                 fprintf (stderr,
02190                   (_("Error in %s () a NULL pointer was passed.\n")),
02191                   __FUNCTION__);
02192                 return (NULL);
02193         }
02194         if (polyline->color_name ==  NULL)
02195         {
02196                 fprintf (stderr,
02197                   (_("Error in %s () a NULL pointer was found in the color_name member.\n")),
02198                   __FUNCTION__);
02199                 return (NULL);
02200         }
02201 #if DEBUG
02202         DXF_DEBUG_END
02203 #endif
02204         return (strdup (polyline->color_name));
02205 }
02206 
02207 
02214 DxfPolyline *
02215 dxf_polyline_set_color_name
02216 (
02217         DxfPolyline *polyline,
02219         char *color_name
02222 )
02223 {
02224 #if DEBUG
02225         DXF_DEBUG_BEGIN
02226 #endif
02227         /* Do some basic checks. */
02228         if (polyline == NULL)
02229         {
02230                 fprintf (stderr,
02231                   (_("Error in %s () a NULL pointer was passed.\n")),
02232                   __FUNCTION__);
02233                 return (NULL);
02234         }
02235         if (color_name == NULL)
02236         {
02237                 fprintf (stderr,
02238                   (_("Error in %s () a NULL pointer was passed.\n")),
02239                   __FUNCTION__);
02240                 return (NULL);
02241         }
02242         polyline->color_name = strdup (color_name);
02243 #if DEBUG
02244         DXF_DEBUG_END
02245 #endif
02246         return (polyline);
02247 }
02248 
02249 
02256 long
02257 dxf_polyline_get_transparency
02258 (
02259         DxfPolyline *polyline
02261 )
02262 {
02263 #if DEBUG
02264         DXF_DEBUG_BEGIN
02265 #endif
02266         /* Do some basic checks. */
02267         if (polyline == NULL)
02268         {
02269                 fprintf (stderr,
02270                   (_("Error in %s () a NULL pointer was passed.\n")),
02271                   __FUNCTION__);
02272                 return (EXIT_FAILURE);
02273         }
02274 #if DEBUG
02275         DXF_DEBUG_END
02276 #endif
02277         return (polyline->transparency);
02278 }
02279 
02280 
02287 DxfPolyline *
02288 dxf_polyline_set_transparency
02289 (
02290         DxfPolyline *polyline,
02292         long transparency
02294 )
02295 {
02296 #if DEBUG
02297         DXF_DEBUG_BEGIN
02298 #endif
02299         /* Do some basic checks. */
02300         if (polyline == NULL)
02301         {
02302                 fprintf (stderr,
02303                   (_("Error in %s () a NULL pointer was passed.\n")),
02304                   __FUNCTION__);
02305                 return (NULL);
02306         }
02307         polyline->transparency = transparency;
02308 #if DEBUG
02309         DXF_DEBUG_END
02310 #endif
02311         return (polyline);
02312 }
02313 
02314 
02320 DxfPoint *
02321 dxf_polyline_get_p0
02322 (
02323         DxfPolyline *polyline
02325 )
02326 {
02327 #ifdef DEBUG
02328         DXF_DEBUG_BEGIN
02329 #endif
02330         /* Do some basic checks. */
02331         if (polyline == NULL)
02332         {
02333                 fprintf (stderr,
02334                   (_("Error in %s () a NULL pointer was passed.\n")),
02335                   __FUNCTION__);
02336                 return (NULL);
02337         }
02338         if (polyline->p0 == NULL)
02339         {
02340                 fprintf (stderr,
02341                   (_("Error in %s () a NULL pointer was passed.\n")),
02342                   __FUNCTION__);
02343                 return (NULL);
02344         }
02345 #if DEBUG
02346         DXF_DEBUG_END
02347 #endif
02348         return (polyline->p0);
02349 }
02350 
02351 
02358 DxfPolyline *
02359 dxf_polyline_set_p0
02360 (
02361         DxfPolyline *polyline,
02363         DxfPoint *p0
02365 )
02366 {
02367 #ifdef DEBUG
02368         DXF_DEBUG_BEGIN
02369 #endif
02370         /* Do some basic checks. */
02371         if (polyline == NULL)
02372         {
02373                 fprintf (stderr,
02374                   (_("Error in %s () a NULL pointer was passed.\n")),
02375                   __FUNCTION__);
02376                 return (NULL);
02377         }
02378         if (p0 == NULL)
02379         {
02380                 fprintf (stderr,
02381                   (_("Error in %s () a NULL pointer was passed.\n")),
02382                   __FUNCTION__);
02383                 return (NULL);
02384         }
02385         polyline->p0 = (DxfPoint *) p0;
02386 #if DEBUG
02387         DXF_DEBUG_END
02388 #endif
02389         return (polyline);
02390 }
02391 
02392 
02399 double
02400 dxf_polyline_get_x0
02401 (
02402         DxfPolyline *polyline
02404 )
02405 {
02406 #ifdef DEBUG
02407         DXF_DEBUG_BEGIN
02408 #endif
02409 
02410         /* Do some basic checks. */
02411         if (polyline == NULL)
02412         {
02413                 fprintf (stderr,
02414                   (_("Error in %s () a NULL pointer was passed.\n")),
02415                   __FUNCTION__);
02416                 return (EXIT_FAILURE);
02417         }
02418         if (polyline->p0 == NULL)
02419         {
02420                 fprintf (stderr,
02421                   (_("Error in %s () a NULL pointer was passed.\n")),
02422                   __FUNCTION__);
02423                 return (EXIT_FAILURE);
02424         }
02425 #if DEBUG
02426         DXF_DEBUG_END
02427 #endif
02428         return (polyline->p0->x0);
02429 }
02430 
02431 
02439 DxfPolyline *
02440 dxf_polyline_set_x0
02441 (
02442         DxfPolyline *polyline,
02444         double x0
02447 )
02448 {
02449 #ifdef DEBUG
02450         DXF_DEBUG_BEGIN
02451 #endif
02452         /* Do some basic checks. */
02453         if (polyline == NULL)
02454         {
02455                 fprintf (stderr,
02456                   (_("Error in %s () a NULL pointer was passed.\n")),
02457                   __FUNCTION__);
02458                 return (NULL);
02459         }
02460         if (polyline->p0 == NULL)
02461         {
02462                 fprintf (stderr,
02463                   (_("Error in %s () a NULL pointer was found.\n")),
02464                   __FUNCTION__);
02465                 return (NULL);
02466         }
02467         polyline->p0->x0 = x0;
02468 #if DEBUG
02469         DXF_DEBUG_END
02470 #endif
02471         return (polyline);
02472 }
02473 
02474 
02481 double
02482 dxf_polyline_get_y0
02483 (
02484         DxfPolyline *polyline
02486 )
02487 {
02488 #ifdef DEBUG
02489         DXF_DEBUG_BEGIN
02490 #endif
02491 
02492         /* Do some basic checks. */
02493         if (polyline == NULL)
02494         {
02495                 fprintf (stderr,
02496                   (_("Error in %s () a NULL pointer was passed.\n")),
02497                   __FUNCTION__);
02498                 return (EXIT_FAILURE);
02499         }
02500         if (polyline->p0 == NULL)
02501         {
02502                 fprintf (stderr,
02503                   (_("Error in %s () a NULL pointer was passed.\n")),
02504                   __FUNCTION__);
02505                 return (EXIT_FAILURE);
02506         }
02507 #if DEBUG
02508         DXF_DEBUG_END
02509 #endif
02510         return (polyline->p0->y0);
02511 }
02512 
02513 
02521 DxfPolyline *
02522 dxf_polyline_set_y0
02523 (
02524         DxfPolyline *polyline,
02526         double y0
02529 )
02530 {
02531 #ifdef DEBUG
02532         DXF_DEBUG_BEGIN
02533 #endif
02534         /* Do some basic checks. */
02535         if (polyline == NULL)
02536         {
02537                 fprintf (stderr,
02538                   (_("Error in %s () a NULL pointer was passed.\n")),
02539                   __FUNCTION__);
02540                 return (NULL);
02541         }
02542         if (polyline->p0 == NULL)
02543         {
02544                 fprintf (stderr,
02545                   (_("Error in %s () a NULL pointer was passed.\n")),
02546                   __FUNCTION__);
02547                 return (NULL);
02548         }
02549         polyline->p0->y0 = y0;
02550 #if DEBUG
02551         DXF_DEBUG_END
02552 #endif
02553         return (polyline);
02554 }
02555 
02556 
02563 double
02564 dxf_polyline_get_z0
02565 (
02566         DxfPolyline *polyline
02568 )
02569 {
02570 #ifdef DEBUG
02571         DXF_DEBUG_BEGIN
02572 #endif
02573 
02574         /* Do some basic checks. */
02575         if (polyline == NULL)
02576         {
02577                 fprintf (stderr,
02578                   (_("Error in %s () a NULL pointer was passed.\n")),
02579                   __FUNCTION__);
02580                 return (EXIT_FAILURE);
02581         }
02582         if (polyline->p0 == NULL)
02583         {
02584                 fprintf (stderr,
02585                   (_("Error in %s () a NULL pointer was passed.\n")),
02586                   __FUNCTION__);
02587                 return (EXIT_FAILURE);
02588         }
02589 #if DEBUG
02590         DXF_DEBUG_END
02591 #endif
02592         return (polyline->p0->z0);
02593 }
02594 
02595 
02603 DxfPolyline *
02604 dxf_polyline_set_z0
02605 (
02606         DxfPolyline *polyline,
02608         double z0
02611 )
02612 {
02613 #ifdef DEBUG
02614         DXF_DEBUG_BEGIN
02615 #endif
02616         /* Do some basic checks. */
02617         if (polyline == NULL)
02618         {
02619                 fprintf (stderr,
02620                   (_("Error in %s () a NULL pointer was passed.\n")),
02621                   __FUNCTION__);
02622                 return (NULL);
02623         }
02624         if (polyline->p0 == NULL)
02625         {
02626                 fprintf (stderr,
02627                   (_("Error in %s () a NULL pointer was passed.\n")),
02628                   __FUNCTION__);
02629                 return (NULL);
02630         }
02631         polyline->p0->z0 = z0;
02632 #if DEBUG
02633         DXF_DEBUG_END
02634 #endif
02635         return (polyline);
02636 }
02637 
02638 
02644 double
02645 dxf_polyline_get_start_width
02646 (
02647         DxfPolyline *polyline
02649 )
02650 {
02651 #ifdef DEBUG
02652         DXF_DEBUG_BEGIN
02653 #endif
02654 
02655         /* Do some basic checks. */
02656         if (polyline == NULL)
02657         {
02658                 fprintf (stderr,
02659                   (_("Error in %s () a NULL pointer was passed.\n")),
02660                   __FUNCTION__);
02661                 return (EXIT_FAILURE);
02662         }
02663         if (polyline->start_width < 0.0)
02664         {
02665                 fprintf (stderr,
02666                   (_("Warning in %s () a start width smaller than 0.0 was found.\n")),
02667                   __FUNCTION__);
02668         }
02669 #if DEBUG
02670         DXF_DEBUG_END
02671 #endif
02672         return (polyline->start_width);
02673 }
02674 
02675 
02682 DxfPolyline *
02683 dxf_polyline_set_start_width
02684 (
02685         DxfPolyline *polyline,
02687         double start_width
02689 )
02690 {
02691 #ifdef DEBUG
02692         DXF_DEBUG_BEGIN
02693 #endif
02694         /* Do some basic checks. */
02695         if (polyline == NULL)
02696         {
02697                 fprintf (stderr,
02698                   (_("Error in %s () a NULL pointer was passed.\n")),
02699                   __FUNCTION__);
02700                 return (NULL);
02701         }
02702         if (start_width < 0.0)
02703         {
02704                 fprintf (stderr,
02705                   (_("Warning in %s () a start_width smaller than 0.0 was passed.\n")),
02706                   __FUNCTION__);
02707         }
02708         polyline->start_width = start_width;
02709 #if DEBUG
02710         DXF_DEBUG_END
02711 #endif
02712         return (polyline);
02713 }
02714 
02715 
02721 double
02722 dxf_polyline_get_end_width
02723 (
02724         DxfPolyline *polyline
02726 )
02727 {
02728 #ifdef DEBUG
02729         DXF_DEBUG_BEGIN
02730 #endif
02731 
02732         /* Do some basic checks. */
02733         if (polyline == NULL)
02734         {
02735                 fprintf (stderr,
02736                   (_("Error in %s () a NULL pointer was passed.\n")),
02737                   __FUNCTION__);
02738                 return (EXIT_FAILURE);
02739         }
02740         if (polyline->end_width < 0.0)
02741         {
02742                 fprintf (stderr,
02743                   (_("Warning in %s () a end width smaller than 0.0 was found.\n")),
02744                   __FUNCTION__);
02745         }
02746 #if DEBUG
02747         DXF_DEBUG_END
02748 #endif
02749         return (polyline->end_width);
02750 }
02751 
02752 
02759 DxfPolyline *
02760 dxf_polyline_set_end_width
02761 (
02762         DxfPolyline *polyline,
02764         double end_width
02766 )
02767 {
02768 #ifdef DEBUG
02769         DXF_DEBUG_BEGIN
02770 #endif
02771         /* Do some basic checks. */
02772         if (polyline == NULL)
02773         {
02774                 fprintf (stderr,
02775                   (_("Error in %s () a NULL pointer was passed.\n")),
02776                   __FUNCTION__);
02777                 return (NULL);
02778         }
02779         if (end_width < 0.0)
02780         {
02781                 fprintf (stderr,
02782                   (_("Warning in %s () an end_width smaller than 0.0 was passed.\n")),
02783                   __FUNCTION__);
02784         }
02785         polyline->end_width = end_width;
02786 #if DEBUG
02787         DXF_DEBUG_END
02788 #endif
02789         return (polyline);
02790 }
02791 
02792 
02798 int
02799 dxf_polyline_get_vertices_follow
02800 (
02801         DxfPolyline *polyline
02803 )
02804 {
02805 #if DEBUG
02806         DXF_DEBUG_BEGIN
02807 #endif
02808         /* Do some basic checks. */
02809         if (polyline == NULL)
02810         {
02811                 fprintf (stderr,
02812                   (_("Error in %s () a NULL pointer was passed.\n")),
02813                   __FUNCTION__);
02814                 return (EXIT_FAILURE);
02815         }
02816         if (polyline->vertices_follow < 0)
02817         {
02818                 fprintf (stderr,
02819                   (_("Warning in %s () a negative value was found in the vertices_follow member.\n")),
02820                   __FUNCTION__);
02821         }
02822 #if DEBUG
02823         DXF_DEBUG_END
02824 #endif
02825         return (polyline->vertices_follow);
02826 }
02827 
02828 
02835 DxfPolyline *
02836 dxf_polyline_set_vertices_follow
02837 (
02838         DxfPolyline *polyline,
02840         int vertices_follow
02842 )
02843 {
02844 #if DEBUG
02845         DXF_DEBUG_BEGIN
02846 #endif
02847         /* Do some basic checks. */
02848         if (polyline == NULL)
02849         {
02850                 fprintf (stderr,
02851                   (_("Error in %s () a NULL pointer was passed.\n")),
02852                   __FUNCTION__);
02853                 return (NULL);
02854         }
02855         if (vertices_follow < 0)
02856         {
02857                 fprintf (stderr,
02858                   (_("Warning in %s () a negative vertices_follow value was passed.\n")),
02859                   __FUNCTION__);
02860         }
02861         polyline->vertices_follow = vertices_follow;
02862 #if DEBUG
02863         DXF_DEBUG_END
02864 #endif
02865         return (polyline);
02866 }
02867 
02868 
02874 int
02875 dxf_polyline_get_flag
02876 (
02877         DxfPolyline *polyline
02879 )
02880 {
02881 #if DEBUG
02882         DXF_DEBUG_BEGIN
02883 #endif
02884         /* Do some basic checks. */
02885         if (polyline == NULL)
02886         {
02887                 fprintf (stderr,
02888                   (_("Error in %s () a NULL pointer was passed.\n")),
02889                   __FUNCTION__);
02890                 return (EXIT_FAILURE);
02891         }
02892         if (polyline->flag < 0)
02893         {
02894                 fprintf (stderr,
02895                   (_("Warning in %s () a negative value was found in the flag member.\n")),
02896                   __FUNCTION__);
02897         }
02898         if (polyline->flag > 255)
02899         {
02900                 fprintf (stderr,
02901                   (_("Warning in %s () an out of range value was found in the flag member.\n")),
02902                   __FUNCTION__);
02903         }
02904 #if DEBUG
02905         DXF_DEBUG_END
02906 #endif
02907         return (polyline->flag);
02908 }
02909 
02910 
02917 DxfPolyline *
02918 dxf_polyline_set_flag
02919 (
02920         DxfPolyline *polyline,
02922         int flag
02924 )
02925 {
02926 #if DEBUG
02927         DXF_DEBUG_BEGIN
02928 #endif
02929         /* Do some basic checks. */
02930         if (polyline == NULL)
02931         {
02932                 fprintf (stderr,
02933                   (_("Error in %s () a NULL pointer was passed.\n")),
02934                   __FUNCTION__);
02935                 return (NULL);
02936         }
02937         if (flag < 0)
02938         {
02939                 fprintf (stderr,
02940                   (_("Warning in %s () a negative value was passed.\n")),
02941                   __FUNCTION__);
02942         }
02943         if (flag > 255)
02944         {
02945                 fprintf (stderr,
02946                   (_("Warning in %s () an out of range value was passed.\n")),
02947                   __FUNCTION__);
02948         }
02949         polyline->flag = flag;
02950 #if DEBUG
02951         DXF_DEBUG_END
02952 #endif
02953         return (polyline);
02954 }
02955 
02956 
02962 int
02963 dxf_polyline_get_polygon_mesh_M_vertex_count
02964 (
02965         DxfPolyline *polyline
02967 )
02968 {
02969 #if DEBUG
02970         DXF_DEBUG_BEGIN
02971 #endif
02972         /* Do some basic checks. */
02973         if (polyline == NULL)
02974         {
02975                 fprintf (stderr,
02976                   (_("Error in %s () a NULL pointer was passed.\n")),
02977                   __FUNCTION__);
02978                 return (EXIT_FAILURE);
02979         }
02980         if (polyline->polygon_mesh_M_vertex_count < 0)
02981         {
02982                 fprintf (stderr,
02983                   (_("Warning in %s () a negative value was found in the polygon_mesh_M_vertex_count member.\n")),
02984                   __FUNCTION__);
02985         }
02986 #if DEBUG
02987         DXF_DEBUG_END
02988 #endif
02989         return (polyline->polygon_mesh_M_vertex_count);
02990 }
02991 
02992 
03000 DxfPolyline *
03001 dxf_polyline_set_polygon_mesh_M_vertex_count
03002 (
03003         DxfPolyline *polyline,
03005         int polygon_mesh_M_vertex_count
03007 )
03008 {
03009 #if DEBUG
03010         DXF_DEBUG_BEGIN
03011 #endif
03012         /* Do some basic checks. */
03013         if (polyline == NULL)
03014         {
03015                 fprintf (stderr,
03016                   (_("Error in %s () a NULL pointer was passed.\n")),
03017                   __FUNCTION__);
03018                 return (NULL);
03019         }
03020         if (polygon_mesh_M_vertex_count < 0)
03021         {
03022                 fprintf (stderr,
03023                   (_("Warning in %s () a negative value was passed.\n")),
03024                   __FUNCTION__);
03025         }
03026         polyline->polygon_mesh_M_vertex_count = polygon_mesh_M_vertex_count;
03027 #if DEBUG
03028         DXF_DEBUG_END
03029 #endif
03030         return (polyline);
03031 }
03032 
03033 
03039 int
03040 dxf_polyline_get_polygon_mesh_N_vertex_count
03041 (
03042         DxfPolyline *polyline
03044 )
03045 {
03046 #if DEBUG
03047         DXF_DEBUG_BEGIN
03048 #endif
03049         /* Do some basic checks. */
03050         if (polyline == NULL)
03051         {
03052                 fprintf (stderr,
03053                   (_("Error in %s () a NULL pointer was passed.\n")),
03054                   __FUNCTION__);
03055                 return (EXIT_FAILURE);
03056         }
03057         if (polyline->polygon_mesh_N_vertex_count < 0)
03058         {
03059                 fprintf (stderr,
03060                   (_("Warning in %s () a negative value was found in the polygon_mesh_N_vertex_count member.\n")),
03061                   __FUNCTION__);
03062         }
03063 #if DEBUG
03064         DXF_DEBUG_END
03065 #endif
03066         return (polyline->polygon_mesh_N_vertex_count);
03067 }
03068 
03069 
03077 DxfPolyline *
03078 dxf_polyline_set_polygon_mesh_N_vertex_count
03079 (
03080         DxfPolyline *polyline,
03082         int polygon_mesh_N_vertex_count
03084 )
03085 {
03086 #if DEBUG
03087         DXF_DEBUG_BEGIN
03088 #endif
03089         /* Do some basic checks. */
03090         if (polyline == NULL)
03091         {
03092                 fprintf (stderr,
03093                   (_("Error in %s () a NULL pointer was passed.\n")),
03094                   __FUNCTION__);
03095                 return (NULL);
03096         }
03097         if (polygon_mesh_N_vertex_count < 0)
03098         {
03099                 fprintf (stderr,
03100                   (_("Warning in %s () a negative value was passed.\n")),
03101                   __FUNCTION__);
03102         }
03103         polyline->polygon_mesh_N_vertex_count = polygon_mesh_N_vertex_count;
03104 #if DEBUG
03105         DXF_DEBUG_END
03106 #endif
03107         return (polyline);
03108 }
03109 
03110 
03116 int
03117 dxf_polyline_get_smooth_M_surface_density
03118 (
03119         DxfPolyline *polyline
03121 )
03122 {
03123 #if DEBUG
03124         DXF_DEBUG_BEGIN
03125 #endif
03126         /* Do some basic checks. */
03127         if (polyline == NULL)
03128         {
03129                 fprintf (stderr,
03130                   (_("Error in %s () a NULL pointer was passed.\n")),
03131                   __FUNCTION__);
03132                 return (EXIT_FAILURE);
03133         }
03134         if (polyline->smooth_M_surface_density < 0)
03135         {
03136                 fprintf (stderr,
03137                   (_("Warning in %s () a negative value was found in the smooth_M_surface_density member.\n")),
03138                   __FUNCTION__);
03139         }
03140 #if DEBUG
03141         DXF_DEBUG_END
03142 #endif
03143         return (polyline->smooth_M_surface_density);
03144 }
03145 
03146 
03154 DxfPolyline *
03155 dxf_polyline_set_smooth_M_surface_density
03156 (
03157         DxfPolyline *polyline,
03159         int smooth_M_surface_density
03161 )
03162 {
03163 #if DEBUG
03164         DXF_DEBUG_BEGIN
03165 #endif
03166         /* Do some basic checks. */
03167         if (polyline == NULL)
03168         {
03169                 fprintf (stderr,
03170                   (_("Error in %s () a NULL pointer was passed.\n")),
03171                   __FUNCTION__);
03172                 return (NULL);
03173         }
03174         if (smooth_M_surface_density < 0)
03175         {
03176                 fprintf (stderr,
03177                   (_("Warning in %s () a negative value was passed.\n")),
03178                   __FUNCTION__);
03179         }
03180         polyline->smooth_M_surface_density = smooth_M_surface_density;
03181 #if DEBUG
03182         DXF_DEBUG_END
03183 #endif
03184         return (polyline);
03185 }
03186 
03187 
03194 int
03195 dxf_polyline_get_smooth_N_surface_density
03196 (
03197         DxfPolyline *polyline
03199 )
03200 {
03201 #if DEBUG
03202         DXF_DEBUG_BEGIN
03203 #endif
03204         /* Do some basic checks. */
03205         if (polyline == NULL)
03206         {
03207                 fprintf (stderr,
03208                   (_("Error in %s () a NULL pointer was passed.\n")),
03209                   __FUNCTION__);
03210                 return (EXIT_FAILURE);
03211         }
03212         if (polyline->smooth_N_surface_density < 0)
03213         {
03214                 fprintf (stderr,
03215                   (_("Warning in %s () a negative value was found in the smooth_N_surface_density member.\n")),
03216                   __FUNCTION__);
03217         }
03218 #if DEBUG
03219         DXF_DEBUG_END
03220 #endif
03221         return (polyline->smooth_N_surface_density);
03222 }
03223 
03224 
03232 DxfPolyline *
03233 dxf_polyline_set_smooth_N_surface_density
03234 (
03235         DxfPolyline *polyline,
03237         int smooth_N_surface_density
03239 )
03240 {
03241 #if DEBUG
03242         DXF_DEBUG_BEGIN
03243 #endif
03244         /* Do some basic checks. */
03245         if (polyline == NULL)
03246         {
03247                 fprintf (stderr,
03248                   (_("Error in %s () a NULL pointer was passed.\n")),
03249                   __FUNCTION__);
03250                 return (NULL);
03251         }
03252         if (smooth_N_surface_density < 0)
03253         {
03254                 fprintf (stderr,
03255                   (_("Warning in %s () a negative value was passed.\n")),
03256                   __FUNCTION__);
03257         }
03258         polyline->smooth_N_surface_density = smooth_N_surface_density;
03259 #if DEBUG
03260         DXF_DEBUG_END
03261 #endif
03262         return (polyline);
03263 }
03264 
03265 
03271 int
03272 dxf_polyline_get_surface_type
03273 (
03274         DxfPolyline *polyline
03276 )
03277 {
03278 #if DEBUG
03279         DXF_DEBUG_BEGIN
03280 #endif
03281         /* Do some basic checks. */
03282         if (polyline == NULL)
03283         {
03284                 fprintf (stderr,
03285                   (_("Error in %s () a NULL pointer was passed.\n")),
03286                   __FUNCTION__);
03287                 return (EXIT_FAILURE);
03288         }
03289         if (polyline->surface_type < 0)
03290         {
03291                 fprintf (stderr,
03292                   (_("Warning in %s () a negative value was found in the surface_type member.\n")),
03293                   __FUNCTION__);
03294         }
03295 #if DEBUG
03296         DXF_DEBUG_END
03297 #endif
03298         return (polyline->surface_type);
03299 }
03300 
03301 
03308 DxfPolyline *
03309 dxf_polyline_set_surface_type
03310 (
03311         DxfPolyline *polyline,
03313         int surface_type
03315 )
03316 {
03317 #if DEBUG
03318         DXF_DEBUG_BEGIN
03319 #endif
03320         /* Do some basic checks. */
03321         if (polyline == NULL)
03322         {
03323                 fprintf (stderr,
03324                   (_("Error in %s () a NULL pointer was passed.\n")),
03325                   __FUNCTION__);
03326                 return (NULL);
03327         }
03328         if (surface_type < 0)
03329         {
03330                 fprintf (stderr,
03331                   (_("Warning in %s () a negative value was passed.\n")),
03332                   __FUNCTION__);
03333         }
03334         polyline->surface_type = surface_type;
03335 #if DEBUG
03336         DXF_DEBUG_END
03337 #endif
03338         return (polyline);
03339 }
03340 
03341 
03348 double
03349 dxf_polyline_get_extr_x0
03350 (
03351         DxfPolyline *polyline
03353 )
03354 {
03355 #ifdef DEBUG
03356         DXF_DEBUG_BEGIN
03357 #endif
03358 
03359         /* Do some basic checks. */
03360         if (polyline == NULL)
03361         {
03362                 fprintf (stderr,
03363                   (_("Error in %s () a NULL pointer was passed.\n")),
03364                   __FUNCTION__);
03365                 return (EXIT_FAILURE);
03366         }
03367 #if DEBUG
03368         DXF_DEBUG_END
03369 #endif
03370         return (polyline->extr_x0);
03371 }
03372 
03373 
03381 DxfPolyline *
03382 dxf_polyline_set_extr_x0
03383 (
03384         DxfPolyline *polyline,
03386         double extr_x0
03389 )
03390 {
03391 #ifdef DEBUG
03392         DXF_DEBUG_BEGIN
03393 #endif
03394         /* Do some basic checks. */
03395         if (polyline == NULL)
03396         {
03397                 fprintf (stderr,
03398                   (_("Error in %s () a NULL pointer was passed.\n")),
03399                   __FUNCTION__);
03400                 return (NULL);
03401         }
03402         polyline->extr_x0 = extr_x0;
03403 #if DEBUG
03404         DXF_DEBUG_END
03405 #endif
03406         return (polyline);
03407 }
03408 
03409 
03416 double
03417 dxf_polyline_get_extr_y0
03418 (
03419         DxfPolyline *polyline
03421 )
03422 {
03423 #ifdef DEBUG
03424         DXF_DEBUG_BEGIN
03425 #endif
03426 
03427         /* Do some basic checks. */
03428         if (polyline == NULL)
03429         {
03430                 fprintf (stderr,
03431                   (_("Error in %s () a NULL pointer was passed.\n")),
03432                   __FUNCTION__);
03433                 return (EXIT_FAILURE);
03434         }
03435 #if DEBUG
03436         DXF_DEBUG_END
03437 #endif
03438         return (polyline->extr_y0);
03439 }
03440 
03441 
03449 DxfPolyline *
03450 dxf_polyline_set_extr_y0
03451 (
03452         DxfPolyline *polyline,
03454         double extr_y0
03457 )
03458 {
03459 #ifdef DEBUG
03460         DXF_DEBUG_BEGIN
03461 #endif
03462         /* Do some basic checks. */
03463         if (polyline == NULL)
03464         {
03465                 fprintf (stderr,
03466                   (_("Error in %s () a NULL pointer was passed.\n")),
03467                   __FUNCTION__);
03468                 return (NULL);
03469         }
03470         polyline->extr_y0 = extr_y0;
03471 #if DEBUG
03472         DXF_DEBUG_END
03473 #endif
03474         return (polyline);
03475 }
03476 
03477 
03484 double
03485 dxf_polyline_get_extr_z0
03486 (
03487         DxfPolyline *polyline
03489 )
03490 {
03491 #ifdef DEBUG
03492         DXF_DEBUG_BEGIN
03493 #endif
03494 
03495         /* Do some basic checks. */
03496         if (polyline == NULL)
03497         {
03498                 fprintf (stderr,
03499                   (_("Error in %s () a NULL pointer was passed.\n")),
03500                   __FUNCTION__);
03501                 return (EXIT_FAILURE);
03502         }
03503 #if DEBUG
03504         DXF_DEBUG_END
03505 #endif
03506         return (polyline->extr_z0);
03507 }
03508 
03509 
03517 DxfPolyline *
03518 dxf_polyline_set_extr_z0
03519 (
03520         DxfPolyline *polyline,
03522         double extr_z0
03525 )
03526 {
03527 #ifdef DEBUG
03528         DXF_DEBUG_BEGIN
03529 #endif
03530         /* Do some basic checks. */
03531         if (polyline == NULL)
03532         {
03533                 fprintf (stderr,
03534                   (_("Error in %s () a NULL pointer was passed.\n")),
03535                   __FUNCTION__);
03536                 return (NULL);
03537         }
03538         polyline->extr_z0 = extr_z0;
03539 #if DEBUG
03540         DXF_DEBUG_END
03541 #endif
03542         return (polyline);
03543 }
03544 
03545 
03554 DxfVertex *
03555 dxf_polyline_get_vertices
03556 (
03557         DxfPolyline *polyline
03559 )
03560 {
03561 #if DEBUG
03562         DXF_DEBUG_BEGIN
03563 #endif
03564         /* Do some basic checks. */
03565         if (polyline == NULL)
03566         {
03567                 fprintf (stderr,
03568                   (_("Error in %s () a NULL pointer was passed.\n")),
03569                   __FUNCTION__);
03570                 return (NULL);
03571         }
03572         if (polyline->vertices == NULL)
03573         {
03574                 fprintf (stderr,
03575                   (_("Error in %s () a NULL pointer was found in the vertices member.\n")),
03576                   __FUNCTION__);
03577                 return (NULL);
03578         }
03579 #if DEBUG
03580         DXF_DEBUG_END
03581 #endif
03582         return ((DxfVertex *) polyline->vertices);
03583 }
03584 
03585 
03590 DxfPolyline *
03591 dxf_polyline_set_vertices
03592 (
03593         DxfPolyline *polyline,
03595         DxfVertex *vertices
03598 )
03599 {
03600 #if DEBUG
03601         DXF_DEBUG_BEGIN
03602 #endif
03603         /* Do some basic checks. */
03604         if (polyline == NULL)
03605         {
03606                 fprintf (stderr,
03607                   (_("Error in %s () a NULL pointer was passed.\n")),
03608                   __FUNCTION__);
03609                 return (NULL);
03610         }
03611         if (vertices == NULL)
03612         {
03613                 fprintf (stderr,
03614                   (_("Error in %s () a NULL pointer was passed.\n")),
03615                   __FUNCTION__);
03616                 return (NULL);
03617         }
03618         polyline->vertices = (DxfVertex *) vertices;
03619 #if DEBUG
03620         DXF_DEBUG_END
03621 #endif
03622         return (polyline);
03623 }
03624 
03625 
03634 DxfPolyline *
03635 dxf_polyline_get_next
03636 (
03637         DxfPolyline *polyline
03639 )
03640 {
03641 #if DEBUG
03642         DXF_DEBUG_BEGIN
03643 #endif
03644         /* Do some basic checks. */
03645         if (polyline == NULL)
03646         {
03647                 fprintf (stderr,
03648                   (_("Error in %s () a NULL pointer was passed.\n")),
03649                   __FUNCTION__);
03650                 return (NULL);
03651         }
03652         if (polyline->next == NULL)
03653         {
03654                 fprintf (stderr,
03655                   (_("Error in %s () a NULL pointer was found in the next member.\n")),
03656                   __FUNCTION__);
03657                 return (NULL);
03658         }
03659 #if DEBUG
03660         DXF_DEBUG_END
03661 #endif
03662         return ((DxfPolyline *) polyline->next);
03663 }
03664 
03665 
03670 DxfPolyline *
03671 dxf_polyline_set_next
03672 (
03673         DxfPolyline *polyline,
03675         DxfPolyline *next
03677 )
03678 {
03679 #if DEBUG
03680         DXF_DEBUG_BEGIN
03681 #endif
03682         /* Do some basic checks. */
03683         if (polyline == NULL)
03684         {
03685                 fprintf (stderr,
03686                   (_("Error in %s () a NULL pointer was passed.\n")),
03687                   __FUNCTION__);
03688                 return (NULL);
03689         }
03690         if (next == NULL)
03691         {
03692                 fprintf (stderr,
03693                   (_("Error in %s () a NULL pointer was passed.\n")),
03694                   __FUNCTION__);
03695                 return (NULL);
03696         }
03697         polyline->next = (struct DxfPolyline *) next;
03698 #if DEBUG
03699         DXF_DEBUG_END
03700 #endif
03701         return (polyline);
03702 }
03703 
03704 
03713 DxfPolyline *
03714 dxf_polyline_get_last
03715 (
03716         DxfPolyline *polyline
03718 )
03719 {
03720 #if DEBUG
03721         DXF_DEBUG_BEGIN
03722 #endif
03723         /* Do some basic checks. */
03724         if (polyline == NULL)
03725         {
03726                 fprintf (stderr,
03727                   (_("Error in %s () a NULL pointer was passed.\n")),
03728                   __FUNCTION__);
03729                 return (NULL);
03730         }
03731         if (polyline->next == NULL)
03732         {
03733                 fprintf (stderr,
03734                   (_("Warning in %s () a NULL pointer was found.\n")),
03735                   __FUNCTION__);
03736                 return ((DxfPolyline *) polyline);
03737         }
03738         DxfPolyline *iter = (DxfPolyline *) polyline->next;
03739         while (iter->next != NULL)
03740         {
03741                 iter = (DxfPolyline *) iter->next;
03742         }
03743 #if DEBUG
03744         DXF_DEBUG_END
03745 #endif
03746         return ((DxfPolyline *) iter);
03747 }
03748 
03749 
03750 /* EOF */