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

ray.c

Go to the documentation of this file.
00001 
00043 #include "ray.h"
00044 
00045 
00054 DxfRay *
00055 dxf_ray_new ()
00056 {
00057 #if DEBUG
00058         DXF_DEBUG_BEGIN
00059 #endif
00060         DxfRay *ray = NULL;
00061         size_t size;
00062 
00063         size = sizeof (DxfRay);
00064         /* avoid malloc of 0 bytes */
00065         if (size == 0) size = 1;
00066         if ((ray = malloc (size)) == NULL)
00067         {
00068                 fprintf (stderr,
00069                   (_("Error in %s () could not allocate memory for a DxfRay struct.\n")),
00070                   __FUNCTION__);
00071                 ray = NULL;
00072         }
00073         else
00074         {
00075                 memset (ray, 0, size);
00076         }
00077 #if DEBUG
00078         DXF_DEBUG_END
00079 #endif
00080         return (ray);
00081 }
00082 
00083 
00090 DxfRay *
00091 dxf_ray_init
00092 (
00093         DxfRay *ray
00095 )
00096 {
00097 #if DEBUG
00098         DXF_DEBUG_BEGIN
00099 #endif
00100         /* Do some basic checks. */
00101         if (ray == NULL)
00102         {
00103                 fprintf (stderr,
00104                   (_("Warning in %s () a NULL pointer was passed.\n")),
00105                   __FUNCTION__);
00106                 ray = dxf_ray_new ();
00107         }
00108         if (ray == NULL)
00109         {
00110               fprintf (stderr,
00111                 (_("Error in %s () could not allocate memory for a DxfRay struct.\n")),
00112                 __FUNCTION__);
00113               return (NULL);
00114         }
00115         ray->id_code = 0;
00116         ray->linetype = strdup (DXF_DEFAULT_LINETYPE);
00117         ray->layer = strdup (DXF_DEFAULT_LAYER);
00118         ray->elevation = 0.0;
00119         ray->thickness = 0.0;
00120         ray->linetype_scale = DXF_DEFAULT_LINETYPE_SCALE;
00121         ray->visibility = DXF_DEFAULT_VISIBILITY;
00122         ray->color = DXF_COLOR_BYLAYER;
00123         ray->paperspace = DXF_MODELSPACE;
00124         ray->graphics_data_size = 0;
00125         ray->shadow_mode = 0;
00126         ray->binary_graphics_data = (DxfBinaryGraphicsData *) dxf_binary_graphics_data_new ();
00127         ray->binary_graphics_data = (DxfBinaryGraphicsData *) dxf_binary_graphics_data_init ((DxfBinaryGraphicsData *) ray->binary_graphics_data);
00128         ray->dictionary_owner_soft = strdup ("");
00129         ray->material = strdup ("");
00130         ray->dictionary_owner_hard = strdup ("");
00131         ray->lineweight = 0;
00132         ray->plot_style_name = strdup ("");
00133         ray->color_value = 0;
00134         ray->color_name = strdup ("");
00135         ray->transparency = 0;
00136         ray->p0 = (DxfPoint *) dxf_point_new ();
00137         ray->p0 = dxf_point_init ((DxfPoint *) ray->p0);
00138         ray->p0->x0 = 0.0;
00139         ray->p0->y0 = 0.0;
00140         ray->p0->z0 = 0.0;
00141         ray->p1 = (DxfPoint *) dxf_point_new ();
00142         ray->p1 = dxf_point_init ((DxfPoint *) ray->p1);
00143         ray->p1->x0 = 0.0;
00144         ray->p1->y0 = 0.0;
00145         ray->p1->z0 = 0.0;
00146         ray->next = NULL;
00147 #if DEBUG
00148         DXF_DEBUG_END
00149 #endif
00150         return (ray);
00151 }
00152 
00153 
00166 DxfRay *
00167 dxf_ray_read
00168 (
00169         DxfFile *fp,
00171         DxfRay *ray
00173 )
00174 {
00175 #if DEBUG
00176         DXF_DEBUG_BEGIN
00177 #endif
00178         char *temp_string = NULL;
00179 
00180         /* Do some basic checks. */
00181         if (fp == NULL)
00182         {
00183                 fprintf (stderr,
00184                   (_("Error in %s () a NULL file pointer was passed.\n")),
00185                   __FUNCTION__);
00186                 /* Clean up. */
00187                 free (temp_string);
00188                 return (NULL);
00189         }
00190         if (ray == NULL)
00191         {
00192                 fprintf (stderr,
00193                   (_("Warning in %s () a NULL pointer was passed.\n")),
00194                   __FUNCTION__);
00195                 ray = dxf_ray_new ();
00196                 ray = dxf_ray_init (ray);
00197         }
00198         (fp->line_number)++;
00199         fscanf (fp->fp, "%[^\n]", temp_string);
00200         while (strcmp (temp_string, "0") != 0)
00201         {
00202                 if (ferror (fp->fp))
00203                 {
00204                         fprintf (stderr,
00205                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00206                           __FUNCTION__, fp->filename, fp->line_number);
00207                         fclose (fp->fp);
00208                         /* Clean up. */
00209                         free (temp_string);
00210                         return (NULL);
00211                 }
00212                 if (strcmp (temp_string, "5") == 0)
00213                 {
00214                         /* Now follows a string containing a sequential
00215                          * id number. */
00216                         (fp->line_number)++;
00217                         fscanf (fp->fp, "%x\n", &ray->id_code);
00218                 }
00219                 else if (strcmp (temp_string, "6") == 0)
00220                 {
00221                         /* Now follows a string containing a linetype
00222                          * name. */
00223                         (fp->line_number)++;
00224                         fscanf (fp->fp, "%s\n", ray->linetype);
00225                 }
00226                 else if (strcmp (temp_string, "8") == 0)
00227                 {
00228                         /* Now follows a string containing a layer name. */
00229                         (fp->line_number)++;
00230                         fscanf (fp->fp, "%s\n", ray->layer);
00231                 }
00232                 else if (strcmp (temp_string, "10") == 0)
00233                 {
00234                         /* Now follows a string containing the
00235                          * X-coordinate of the center point. */
00236                         (fp->line_number)++;
00237                         fscanf (fp->fp, "%lf\n", &ray->p0->x0);
00238                 }
00239                 else if (strcmp (temp_string, "20") == 0)
00240                 {
00241                         /* Now follows a string containing the
00242                          * Y-coordinate of the center point. */
00243                         (fp->line_number)++;
00244                         fscanf (fp->fp, "%lf\n", &ray->p0->y0);
00245                 }
00246                 else if (strcmp (temp_string, "30") == 0)
00247                 {
00248                         /* Now follows a string containing the
00249                          * Z-coordinate of the center point. */
00250                         (fp->line_number)++;
00251                         fscanf (fp->fp, "%lf\n", &ray->p0->z0);
00252                 }
00253                 else if (strcmp (temp_string, "11") == 0)
00254                 {
00255                         /* Now follows a string containing the
00256                          * X-coordinate of the center point. */
00257                         (fp->line_number)++;
00258                         fscanf (fp->fp, "%lf\n", &ray->p1->x0);
00259                 }
00260                 else if (strcmp (temp_string, "21") == 0)
00261                 {
00262                         /* Now follows a string containing the
00263                          * Y-coordinate of the center point. */
00264                         (fp->line_number)++;
00265                         fscanf (fp->fp, "%lf\n", &ray->p1->y0);
00266                 }
00267                 else if (strcmp (temp_string, "31") == 0)
00268                 {
00269                         /* Now follows a string containing the
00270                          * Z-coordinate of the center point. */
00271                         (fp->line_number)++;
00272                         fscanf (fp->fp, "%lf\n", &ray->p1->z0);
00273                 }
00274                 else if ((fp->acad_version_number <= AutoCAD_11)
00275                         && (strcmp (temp_string, "38") == 0)
00276                         && (ray->elevation != 0.0))
00277                 {
00278                         /* Now follows a string containing the
00279                          * elevation. */
00280                         (fp->line_number)++;
00281                         fscanf (fp->fp, "%lf\n", &ray->elevation);
00282                 }
00283                 else if (strcmp (temp_string, "39") == 0)
00284                 {
00285                         /* Now follows a string containing the
00286                          * thickness. */
00287                         (fp->line_number)++;
00288                         fscanf (fp->fp, "%lf\n", &ray->thickness);
00289                 }
00290                 else if (strcmp (temp_string, "48") == 0)
00291                 {
00292                         /* Now follows a string containing the linetype
00293                          * scale. */
00294                         (fp->line_number)++;
00295                         fscanf (fp->fp, "%lf\n", &ray->linetype_scale);
00296                 }
00297                 else if (strcmp (temp_string, "60") == 0)
00298                 {
00299                         /* Now follows a string containing the
00300                          * visibility value. */
00301                         (fp->line_number)++;
00302                         fscanf (fp->fp, "%hd\n", &ray->visibility);
00303                 }
00304                 else if (strcmp (temp_string, "62") == 0)
00305                 {
00306                         /* Now follows a string containing the
00307                          * color value. */
00308                         (fp->line_number)++;
00309                         fscanf (fp->fp, "%d\n", &ray->color);
00310                 }
00311                 else if (strcmp (temp_string, "67") == 0)
00312                 {
00313                         /* Now follows a string containing the
00314                          * paperspace value. */
00315                         (fp->line_number)++;
00316                         fscanf (fp->fp, "%d\n", &ray->paperspace);
00317                 }
00318                 else if ((fp->acad_version_number >= AutoCAD_13)
00319                         && (strcmp (temp_string, "100") == 0))
00320                 {
00321                         /* Now follows a string containing the
00322                          * subclass marker value. */
00323                         (fp->line_number)++;
00324                         fscanf (fp->fp, "%s\n", temp_string);
00325                         if ((strcmp (temp_string, "AcDbEntity") != 0)
00326                         && ((strcmp (temp_string, "AcDbRay") != 0)))
00327                         {
00328                                 fprintf (stderr,
00329                                   (_("Error in %s () found a bad subclass marker in: %s in line: %d.\n")),
00330                                   __FUNCTION__, fp->filename, fp->line_number);
00331                         }
00332                 }
00333                 else if (strcmp (temp_string, "330") == 0)
00334                 {
00335                         /* Now follows a string containing Soft-pointer
00336                          * ID/handle to owner dictionary. */
00337                         (fp->line_number)++;
00338                         fscanf (fp->fp, "%s\n", ray->dictionary_owner_soft);
00339                 }
00340                 else if (strcmp (temp_string, "360") == 0)
00341                 {
00342                         /* Now follows a string containing Hard owner
00343                          * ID/handle to owner dictionary. */
00344                         (fp->line_number)++;
00345                         fscanf (fp->fp, "%s\n", ray->dictionary_owner_hard);
00346                 }
00347                 else if (strcmp (temp_string, "999") == 0)
00348                 {
00349                         /* Now follows a string containing a comment. */
00350                         (fp->line_number)++;
00351                         fscanf (fp->fp, "%s\n", temp_string);
00352                         fprintf (stdout, "DXF comment: %s\n", temp_string);
00353                 }
00354                 else
00355                 {
00356                         fprintf (stderr,
00357                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00358                           __FUNCTION__, fp->filename, fp->line_number);
00359                 }
00360         }
00361         /* Handle omitted members and/or illegal values. */
00362         if (strcmp (ray->linetype, "") == 0)
00363         {
00364                 ray->linetype = strdup (DXF_DEFAULT_LINETYPE);
00365         }
00366         if (strcmp (ray->layer, "") == 0)
00367         {
00368                 ray->layer = strdup (DXF_DEFAULT_LAYER);
00369         }
00370         /* Clean up. */
00371         free (temp_string);
00372 #if DEBUG
00373         DXF_DEBUG_END
00374 #endif
00375         return (ray);
00376 }
00377 
00378 
00385 int
00386 dxf_ray_write
00387 (
00388         DxfFile *fp,
00390         DxfRay *ray
00392 )
00393 {
00394 #if DEBUG
00395         DXF_DEBUG_BEGIN
00396 #endif
00397         char *dxf_entity_name = strdup ("RAY");
00398 
00399         /* Do some basic checks. */
00400         if (fp == NULL)
00401         {
00402                 fprintf (stderr,
00403                   (_("Error in %s () a NULL file pointer was passed.\n")),
00404                   __FUNCTION__);
00405                 /* Clean up. */
00406                 free (dxf_entity_name);
00407                 return (EXIT_FAILURE);
00408         }
00409         if (ray == NULL)
00410         {
00411                 fprintf (stderr,
00412                   (_("Error in %s () a NULL pointer was passed.\n")),
00413                   __FUNCTION__);
00414                 /* Clean up. */
00415                 free (dxf_entity_name);
00416                 return (EXIT_FAILURE);
00417         }
00418         if ((ray->p0->x0 == ray->p1->x0)
00419                 && (ray->p0->y0 == ray->p1->y0)
00420                 && (ray->p0->z0 == ray->p1->z0))
00421         {
00422                 fprintf (stderr,
00423                   (_("Error in %s () start point and end point are identical for the %s entity with id-code: %x\n")),
00424                   __FUNCTION__, dxf_entity_name, ray->id_code);
00425                 dxf_entity_skip (dxf_entity_name);
00426                 /* Clean up. */
00427                 free (dxf_entity_name);
00428                 return (EXIT_FAILURE);
00429         }
00430         if (fp->acad_version_number < AutoCAD_13)
00431         {
00432                 fprintf (stderr,
00433                   (_("Error in %s () illegal DXF version for this entity.\n")),
00434                   __FUNCTION__);
00435         }
00436         if (strcmp (ray->linetype, "") == 0)
00437         {
00438                 fprintf (stderr,
00439                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00440                   __FUNCTION__, dxf_entity_name, ray->id_code);
00441                 fprintf (stderr,
00442                   (_("\t%s entity is reset to default linetype")),
00443                   dxf_entity_name);
00444                 ray->linetype = strdup (DXF_DEFAULT_LINETYPE);
00445         }
00446         if (strcmp (ray->layer, "") == 0)
00447         {
00448                 fprintf (stderr,
00449                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")),
00450                   __FUNCTION__, dxf_entity_name, ray->id_code);
00451                 fprintf (stderr,
00452                   (_("\t%s entity is relocated to layer 0\n")),
00453                   dxf_entity_name);
00454                 ray->layer = strdup (DXF_DEFAULT_LAYER);
00455         }
00456         /* Start writing output. */
00457         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00458         if (ray->id_code != -1)
00459         {
00460                 fprintf (fp->fp, "  5\n%x\n", ray->id_code);
00461         }
00472         if ((strcmp (ray->dictionary_owner_soft, "") != 0)
00473           && (fp->acad_version_number >= AutoCAD_14))
00474         {
00475                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00476                 fprintf (fp->fp, "330\n%s\n", ray->dictionary_owner_soft);
00477                 fprintf (fp->fp, "102\n}\n");
00478         }
00479         if ((strcmp (ray->dictionary_owner_hard, "") != 0)
00480           && (fp->acad_version_number >= AutoCAD_14))
00481         {
00482                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00483                 fprintf (fp->fp, "360\n%s\n", ray->dictionary_owner_hard);
00484                 fprintf (fp->fp, "102\n}\n");
00485         }
00486         if (fp->acad_version_number >= AutoCAD_13)
00487         {
00488                 fprintf (fp->fp, "100\nAcDbEntity\n");
00489         }
00490         if (ray->paperspace == DXF_PAPERSPACE)
00491         {
00492                 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE);
00493         }
00494         fprintf (fp->fp, "  8\n%s\n", ray->layer);
00495         if (strcmp (ray->linetype, DXF_DEFAULT_LINETYPE) != 0)
00496         {
00497                 fprintf (fp->fp, "  6\n%s\n", ray->linetype);
00498         }
00499         if ((fp->acad_version_number <= AutoCAD_11)
00500           && DXF_FLATLAND
00501           && (ray->elevation != 0.0))
00502         {
00503                 fprintf (fp->fp, " 38\n%f\n", ray->elevation);
00504         }
00505         if (ray->color != DXF_COLOR_BYLAYER)
00506         {
00507                 fprintf (fp->fp, " 62\n%d\n", ray->color);
00508         }
00509         if (ray->linetype_scale != 1.0)
00510         {
00511                 fprintf (fp->fp, " 48\n%f\n", ray->linetype_scale);
00512         }
00513         if (ray->visibility != 0)
00514         {
00515                 fprintf (fp->fp, " 60\n%d\n", ray->visibility);
00516         }
00517         if (fp->acad_version_number >= AutoCAD_13)
00518         {
00519                 fprintf (fp->fp, "100\nAcDbRay\n");
00520         }
00521         if (ray->thickness != 0.0)
00522         {
00523                 fprintf (fp->fp, " 39\n%f\n", ray->thickness);
00524         }
00525         fprintf (fp->fp, " 10\n%f\n", ray->p0->x0);
00526         fprintf (fp->fp, " 20\n%f\n", ray->p0->y0);
00527         fprintf (fp->fp, " 30\n%f\n", ray->p0->z0);
00528         fprintf (fp->fp, " 11\n%f\n", ray->p1->x0);
00529         fprintf (fp->fp, " 21\n%f\n", ray->p1->y0);
00530         fprintf (fp->fp, " 31\n%f\n", ray->p1->z0);
00531         /* Clean up. */
00532         free (dxf_entity_name);
00533 #if DEBUG
00534         DXF_DEBUG_END
00535 #endif
00536         return (EXIT_SUCCESS);
00537 }
00538 
00539 
00547 int
00548 dxf_ray_free
00549 (
00550         DxfRay *ray
00553 )
00554 {
00555 #if DEBUG
00556         DXF_DEBUG_BEGIN
00557 #endif
00558         /* Do some basic checks. */
00559         if (ray == NULL)
00560         {
00561                 fprintf (stderr,
00562                   (_("Error in %s () a NULL pointer was passed.\n")),
00563                   __FUNCTION__);
00564                 return (EXIT_FAILURE);
00565         }
00566         if (ray->next != NULL)
00567         {
00568                 fprintf (stderr,
00569                   (_("Error in %s () pointer to next was not NULL.\n")),
00570                   __FUNCTION__);
00571                 return (EXIT_FAILURE);
00572         }
00573         free (ray->linetype);
00574         free (ray->layer);
00575         free (ray->dictionary_owner_soft);
00576         free (ray->dictionary_owner_hard);
00577         dxf_point_free (ray->p0);
00578         dxf_point_free (ray->p1);
00579         free (ray);
00580         ray = NULL;
00581 #if DEBUG
00582         DXF_DEBUG_END
00583 #endif
00584         return (EXIT_SUCCESS);
00585 }
00586 
00587 
00592 void
00593 dxf_ray_free_chain
00594 (
00595         DxfRay *rays
00597 )
00598 {
00599 #ifdef DEBUG
00600         DXF_DEBUG_BEGIN
00601 #endif
00602         if (rays == NULL)
00603         {
00604                 fprintf (stderr,
00605                   (_("Warning in %s () a NULL pointer was passed.\n")),
00606                   __FUNCTION__);
00607         }
00608         while (rays != NULL)
00609         {
00610                 struct DxfRay *iter = rays->next;
00611                 dxf_ray_free (rays);
00612                 rays = (DxfRay *) iter;
00613         }
00614 #if DEBUG
00615         DXF_DEBUG_END
00616 #endif
00617 }
00618 
00619 
00625 int
00626 dxf_ray_get_id_code
00627 (
00628         DxfRay *ray
00630 )
00631 {
00632 #if DEBUG
00633         DXF_DEBUG_BEGIN
00634 #endif
00635         /* Do some basic checks. */
00636         if (ray == NULL)
00637         {
00638                 fprintf (stderr,
00639                   (_("Error in %s () a NULL pointer was passed.\n")),
00640                   __FUNCTION__);
00641                 return (EXIT_FAILURE);
00642         }
00643         if (ray->id_code < 0)
00644         {
00645                 fprintf (stderr,
00646                   (_("Warning in %s () a negative value was found.\n")),
00647                   __FUNCTION__);
00648         }
00649 #if DEBUG
00650         DXF_DEBUG_END
00651 #endif
00652         return (ray->id_code);
00653 }
00654 
00655 
00659 DxfRay *
00660 dxf_ray_set_id_code
00661 (
00662         DxfRay *ray,
00664         int id_code
00668 )
00669 {
00670 #if DEBUG
00671         DXF_DEBUG_BEGIN
00672 #endif
00673         /* Do some basic checks. */
00674         if (ray == NULL)
00675         {
00676                 fprintf (stderr,
00677                   (_("Error in %s () a NULL pointer was passed.\n")),
00678                   __FUNCTION__);
00679                 return (NULL);
00680         }
00681         if (id_code < 0)
00682         {
00683                 fprintf (stderr,
00684                   (_("Warning in %s () a negative value was passed.\n")),
00685                   __FUNCTION__);
00686         }
00687         ray->id_code = id_code;
00688 #if DEBUG
00689         DXF_DEBUG_END
00690 #endif
00691         return (ray);
00692 }
00693 
00694 
00700 char *
00701 dxf_ray_get_linetype
00702 (
00703         DxfRay *ray
00705 )
00706 {
00707 #if DEBUG
00708         DXF_DEBUG_BEGIN
00709 #endif
00710         /* Do some basic checks. */
00711         if (ray == NULL)
00712         {
00713                 fprintf (stderr,
00714                   (_("Error in %s () a NULL pointer was passed.\n")),
00715                   __FUNCTION__);
00716                 return (NULL);
00717         }
00718         if (ray->linetype ==  NULL)
00719         {
00720                 fprintf (stderr,
00721                   (_("Error in %s () a NULL pointer was found.\n")),
00722                   __FUNCTION__);
00723                 return (NULL);
00724         }
00725 #if DEBUG
00726         DXF_DEBUG_END
00727 #endif
00728         return (strdup (ray->linetype));
00729 }
00730 
00731 
00735 DxfRay *
00736 dxf_ray_set_linetype
00737 (
00738         DxfRay *ray,
00740         char *linetype
00743 )
00744 {
00745 #if DEBUG
00746         DXF_DEBUG_BEGIN
00747 #endif
00748         /* Do some basic checks. */
00749         if (ray == NULL)
00750         {
00751                 fprintf (stderr,
00752                   (_("Error in %s () a NULL pointer was passed.\n")),
00753                   __FUNCTION__);
00754                 return (NULL);
00755         }
00756         if (linetype == NULL)
00757         {
00758                 fprintf (stderr,
00759                   (_("Error in %s () a NULL pointer was passed.\n")),
00760                   __FUNCTION__);
00761                 return (NULL);
00762         }
00763         ray->linetype = strdup (linetype);
00764 #if DEBUG
00765         DXF_DEBUG_END
00766 #endif
00767         return (ray);
00768 }
00769 
00770 
00776 char *
00777 dxf_ray_get_layer
00778 (
00779         DxfRay *ray
00781 )
00782 {
00783 #if DEBUG
00784         DXF_DEBUG_BEGIN
00785 #endif
00786         /* Do some basic checks. */
00787         if (ray == NULL)
00788         {
00789                 fprintf (stderr,
00790                   (_("Error in %s () a NULL pointer was passed.\n")),
00791                   __FUNCTION__);
00792                 return (NULL);
00793         }
00794         if (ray->layer ==  NULL)
00795         {
00796                 fprintf (stderr,
00797                   (_("Error in %s () a NULL pointer was found.\n")),
00798                   __FUNCTION__);
00799                 return (NULL);
00800         }
00801 #if DEBUG
00802         DXF_DEBUG_END
00803 #endif
00804         return (strdup (ray->layer));
00805 }
00806 
00807 
00811 DxfRay *
00812 dxf_ray_set_layer
00813 (
00814         DxfRay *ray,
00816         char *layer
00819 )
00820 {
00821 #if DEBUG
00822         DXF_DEBUG_BEGIN
00823 #endif
00824         /* Do some basic checks. */
00825         if (ray == NULL)
00826         {
00827                 fprintf (stderr,
00828                   (_("Error in %s () a NULL pointer was passed.\n")),
00829                   __FUNCTION__);
00830                 return (NULL);
00831         }
00832         if (layer == NULL)
00833         {
00834                 fprintf (stderr,
00835                   (_("Error in %s () a NULL pointer was passed.\n")),
00836                   __FUNCTION__);
00837                 return (NULL);
00838         }
00839         ray->layer = strdup (layer);
00840 #if DEBUG
00841         DXF_DEBUG_END
00842 #endif
00843         return (ray);
00844 }
00845 
00846 
00852 double
00853 dxf_ray_get_elevation
00854 (
00855         DxfRay *ray
00857 )
00858 {
00859 #if DEBUG
00860         DXF_DEBUG_BEGIN
00861 #endif
00862         /* Do some basic checks. */
00863         if (ray == NULL)
00864         {
00865                 fprintf (stderr,
00866                   (_("Error in %s () a NULL pointer was passed.\n")),
00867                   __FUNCTION__);
00868                 return (EXIT_FAILURE);
00869         }
00870 #if DEBUG
00871         DXF_DEBUG_END
00872 #endif
00873         return (ray->elevation);
00874 }
00875 
00876 
00880 DxfRay *
00881 dxf_ray_set_elevation
00882 (
00883         DxfRay *ray,
00885         double elevation
00887 )
00888 {
00889 #if DEBUG
00890         DXF_DEBUG_BEGIN
00891 #endif
00892         /* Do some basic checks. */
00893         if (ray == NULL)
00894         {
00895                 fprintf (stderr,
00896                   (_("Error in %s () a NULL pointer was passed.\n")),
00897                   __FUNCTION__);
00898                 return (NULL);
00899         }
00900         ray->elevation = elevation;
00901 #if DEBUG
00902         DXF_DEBUG_END
00903 #endif
00904         return (ray);
00905 }
00906 
00907 
00913 double
00914 dxf_ray_get_thickness
00915 (
00916         DxfRay *ray
00918 )
00919 {
00920 #if DEBUG
00921         DXF_DEBUG_BEGIN
00922 #endif
00923         /* Do some basic checks. */
00924         if (ray == NULL)
00925         {
00926                 fprintf (stderr,
00927                   (_("Error in %s () a NULL pointer was passed.\n")),
00928                   __FUNCTION__);
00929                 return (EXIT_FAILURE);
00930         }
00931         if (ray->thickness < 0.0)
00932         {
00933                 fprintf (stderr,
00934                   (_("Error in %s () a negative value was found.\n")),
00935                   __FUNCTION__);
00936                 return (EXIT_FAILURE);
00937         }
00938 #if DEBUG
00939         DXF_DEBUG_END
00940 #endif
00941         return (ray->thickness);
00942 }
00943 
00944 
00948 DxfRay *
00949 dxf_ray_set_thickness
00950 (
00951         DxfRay *ray,
00953         double thickness
00955 )
00956 {
00957 #if DEBUG
00958         DXF_DEBUG_BEGIN
00959 #endif
00960         /* Do some basic checks. */
00961         if (ray == NULL)
00962         {
00963                 fprintf (stderr,
00964                   (_("Error in %s () a NULL pointer was passed.\n")),
00965                   __FUNCTION__);
00966                 return (NULL);
00967         }
00968         if (thickness < 0.0)
00969         {
00970                 fprintf (stderr,
00971                   (_("Error in %s () a negative value was passed.\n")),
00972                   __FUNCTION__);
00973                 return (NULL);
00974         }
00975         ray->thickness = thickness;
00976 #if DEBUG
00977         DXF_DEBUG_END
00978 #endif
00979         return (ray);
00980 }
00981 
00982 
00988 double
00989 dxf_ray_get_linetype_scale
00990 (
00991         DxfRay *ray
00993 )
00994 {
00995 #if DEBUG
00996         DXF_DEBUG_BEGIN
00997 #endif
00998         /* Do some basic checks. */
00999         if (ray == NULL)
01000         {
01001                 fprintf (stderr,
01002                   (_("Error in %s () a NULL pointer was passed.\n")),
01003                   __FUNCTION__);
01004                 return (EXIT_FAILURE);
01005         }
01006         if (ray->linetype_scale < 0.0)
01007         {
01008                 fprintf (stderr,
01009                   (_("Error in %s () a negative value was found.\n")),
01010                   __FUNCTION__);
01011                 return (EXIT_FAILURE);
01012         }
01013 #if DEBUG
01014         DXF_DEBUG_END
01015 #endif
01016         return (ray->linetype_scale);
01017 }
01018 
01019 
01023 DxfRay *
01024 dxf_ray_set_linetype_scale
01025 (
01026         DxfRay *ray,
01028         double linetype_scale
01030 )
01031 {
01032 #if DEBUG
01033         DXF_DEBUG_BEGIN
01034 #endif
01035         /* Do some basic checks. */
01036         if (ray == NULL)
01037         {
01038                 fprintf (stderr,
01039                   (_("Error in %s () a NULL pointer was passed.\n")),
01040                   __FUNCTION__);
01041                 return (NULL);
01042         }
01043         if (linetype_scale < 0.0)
01044         {
01045                 fprintf (stderr,
01046                   (_("Error in %s () a negative value was passed.\n")),
01047                   __FUNCTION__);
01048                 return (NULL);
01049         }
01050         ray->linetype_scale = linetype_scale;
01051 #if DEBUG
01052         DXF_DEBUG_END
01053 #endif
01054         return (ray);
01055 }
01056 
01057 
01063 int16_t
01064 dxf_ray_get_visibility
01065 (
01066         DxfRay *ray
01068 )
01069 {
01070 #if DEBUG
01071         DXF_DEBUG_BEGIN
01072 #endif
01073         /* Do some basic checks. */
01074         if (ray == NULL)
01075         {
01076                 fprintf (stderr,
01077                   (_("Error in %s () a NULL pointer was passed.\n")),
01078                   __FUNCTION__);
01079                 return (EXIT_FAILURE);
01080         }
01081         if (ray->visibility < 0)
01082         {
01083                 fprintf (stderr,
01084                   (_("Error in %s () a negative value was found.\n")),
01085                   __FUNCTION__);
01086                 return (EXIT_FAILURE);
01087         }
01088         if (ray->visibility > 1)
01089         {
01090                 fprintf (stderr,
01091                   (_("Error in %s () an out of range value was found.\n")),
01092                   __FUNCTION__);
01093                 return (EXIT_FAILURE);
01094         }
01095 #if DEBUG
01096         DXF_DEBUG_END
01097 #endif
01098         return (ray->visibility);
01099 }
01100 
01101 
01105 DxfRay *
01106 dxf_ray_set_visibility
01107 (
01108         DxfRay *ray,
01110         int16_t visibility
01112 )
01113 {
01114 #if DEBUG
01115         DXF_DEBUG_BEGIN
01116 #endif
01117         /* Do some basic checks. */
01118         if (ray == NULL)
01119         {
01120                 fprintf (stderr,
01121                   (_("Error in %s () a NULL pointer was passed.\n")),
01122                   __FUNCTION__);
01123                 return (NULL);
01124         }
01125         if (visibility < 0)
01126         {
01127                 fprintf (stderr,
01128                   (_("Error in %s () a negative value was passed.\n")),
01129                   __FUNCTION__);
01130                 return (NULL);
01131         }
01132         if (visibility > 1)
01133         {
01134                 fprintf (stderr,
01135                   (_("Error in %s () an out of range value was passed.\n")),
01136                   __FUNCTION__);
01137                 return (NULL);
01138         }
01139         ray->visibility = visibility;
01140 #if DEBUG
01141         DXF_DEBUG_END
01142 #endif
01143         return (ray);
01144 }
01145 
01146 
01152 int
01153 dxf_ray_get_color
01154 (
01155         DxfRay *ray
01157 )
01158 {
01159 #if DEBUG
01160         DXF_DEBUG_BEGIN
01161 #endif
01162         /* Do some basic checks. */
01163         if (ray == NULL)
01164         {
01165                 fprintf (stderr,
01166                   (_("Error in %s () a NULL pointer was passed.\n")),
01167                   __FUNCTION__);
01168                 return (EXIT_FAILURE);
01169         }
01170         if (ray->color < 0)
01171         {
01172                 fprintf (stderr,
01173                   (_("Warning in %s () a negative value was found.\n")),
01174                   __FUNCTION__);
01175         }
01176 #if DEBUG
01177         DXF_DEBUG_END
01178 #endif
01179         return (ray->color);
01180 }
01181 
01182 
01186 DxfRay *
01187 dxf_ray_set_color
01188 (
01189         DxfRay *ray,
01191         int color
01193 )
01194 {
01195 #if DEBUG
01196         DXF_DEBUG_BEGIN
01197 #endif
01198         /* Do some basic checks. */
01199         if (ray == NULL)
01200         {
01201                 fprintf (stderr,
01202                   (_("Error in %s () a NULL pointer was passed.\n")),
01203                   __FUNCTION__);
01204                 return (NULL);
01205         }
01206         if (color < 0)
01207         {
01208                 fprintf (stderr,
01209                   (_("Warning in %s () a negative value was passed.\n")),
01210                   __FUNCTION__);
01211         }
01212         ray->color = color;
01213 #if DEBUG
01214         DXF_DEBUG_END
01215 #endif
01216         return (ray);
01217 }
01218 
01219 
01225 int
01226 dxf_ray_get_paperspace
01227 (
01228         DxfRay *ray
01230 )
01231 {
01232 #if DEBUG
01233         DXF_DEBUG_BEGIN
01234 #endif
01235         /* Do some basic checks. */
01236         if (ray == NULL)
01237         {
01238                 fprintf (stderr,
01239                   (_("Error in %s () a NULL pointer was passed.\n")),
01240                   __FUNCTION__);
01241                 return (EXIT_FAILURE);
01242         }
01243         if (ray->paperspace < 0)
01244         {
01245                 fprintf (stderr,
01246                   (_("Warning in %s () a negative value was found.\n")),
01247                   __FUNCTION__);
01248         }
01249         if (ray->paperspace > 1)
01250         {
01251                 fprintf (stderr,
01252                   (_("Warning in %s () an out of range value was found.\n")),
01253                   __FUNCTION__);
01254         }
01255 #if DEBUG
01256         DXF_DEBUG_END
01257 #endif
01258         return (ray->paperspace);
01259 }
01260 
01261 
01265 DxfRay *
01266 dxf_ray_set_paperspace
01267 (
01268         DxfRay *ray,
01270         int paperspace
01273 )
01274 {
01275 #if DEBUG
01276         DXF_DEBUG_BEGIN
01277 #endif
01278         /* Do some basic checks. */
01279         if (ray == NULL)
01280         {
01281                 fprintf (stderr,
01282                   (_("Error in %s () a NULL pointer was passed.\n")),
01283                   __FUNCTION__);
01284                 return (NULL);
01285         }
01286         if (paperspace < 0)
01287         {
01288                 fprintf (stderr,
01289                   (_("Error in %s () a negative value was passed.\n")),
01290                   __FUNCTION__);
01291                 return (NULL);
01292         }
01293         if (paperspace > 1)
01294         {
01295                 fprintf (stderr,
01296                   (_("Error in %s () an out of range value was passed.\n")),
01297                   __FUNCTION__);
01298                 return (NULL);
01299         }
01300         ray->paperspace = paperspace;
01301 #if DEBUG
01302         DXF_DEBUG_END
01303 #endif
01304         return (ray);
01305 }
01306 
01307 
01314 int
01315 dxf_ray_get_graphics_data_size
01316 (
01317         DxfRay *ray
01319 )
01320 {
01321 #if DEBUG
01322         DXF_DEBUG_BEGIN
01323 #endif
01324         /* Do some basic checks. */
01325         if (ray == NULL)
01326         {
01327                 fprintf (stderr,
01328                   (_("Error in %s () a NULL pointer was passed.\n")),
01329                   __FUNCTION__);
01330                 return (EXIT_FAILURE);
01331         }
01332         if (ray->graphics_data_size < 0)
01333         {
01334                 fprintf (stderr,
01335                   (_("Warning in %s () a negative value was found.\n")),
01336                   __FUNCTION__);
01337         }
01338         if (ray->graphics_data_size == 0)
01339         {
01340                 fprintf (stderr,
01341                   (_("Warning in %s () a zero value was found.\n")),
01342                   __FUNCTION__);
01343         }
01344 #if DEBUG
01345         DXF_DEBUG_END
01346 #endif
01347         return (ray->graphics_data_size);
01348 }
01349 
01350 
01357 DxfRay *
01358 dxf_ray_set_graphics_data_size
01359 (
01360         DxfRay *ray,
01362         int graphics_data_size
01365 )
01366 {
01367 #if DEBUG
01368         DXF_DEBUG_BEGIN
01369 #endif
01370         /* Do some basic checks. */
01371         if (ray == NULL)
01372         {
01373                 fprintf (stderr,
01374                   (_("Error in %s () a NULL pointer was passed.\n")),
01375                   __FUNCTION__);
01376                 return (NULL);
01377         }
01378         if (graphics_data_size < 0)
01379         {
01380                 fprintf (stderr,
01381                   (_("Error in %s () a negative value was passed.\n")),
01382                   __FUNCTION__);
01383                 return (NULL);
01384         }
01385         if (graphics_data_size == 0)
01386         {
01387                 fprintf (stderr,
01388                   (_("Warning in %s () a zero value was passed.\n")),
01389                   __FUNCTION__);
01390         }
01391         ray->graphics_data_size = graphics_data_size;
01392 #if DEBUG
01393         DXF_DEBUG_END
01394 #endif
01395         return (ray);
01396 }
01397 
01398 
01405 int16_t
01406 dxf_ray_get_shadow_mode
01407 (
01408         DxfRay *ray
01410 )
01411 {
01412 #if DEBUG
01413         DXF_DEBUG_BEGIN
01414 #endif
01415         /* Do some basic checks. */
01416         if (ray == NULL)
01417         {
01418                 fprintf (stderr,
01419                   (_("Error in %s () a NULL pointer was passed.\n")),
01420                   __FUNCTION__);
01421                 return (EXIT_FAILURE);
01422         }
01423         if (ray->shadow_mode < 0)
01424         {
01425                 fprintf (stderr,
01426                   (_("Error in %s () a negative value was found.\n")),
01427                   __FUNCTION__);
01428                 return (EXIT_FAILURE);
01429         }
01430         if (ray->shadow_mode > 3)
01431         {
01432                 fprintf (stderr,
01433                   (_("Error in %s () an out of range value was found.\n")),
01434                   __FUNCTION__);
01435                 return (EXIT_FAILURE);
01436         }
01437 #if DEBUG
01438         DXF_DEBUG_END
01439 #endif
01440         return (ray->shadow_mode);
01441 }
01442 
01443 
01450 DxfRay *
01451 dxf_ray_set_shadow_mode
01452 (
01453         DxfRay *ray,
01455         int16_t shadow_mode
01457 )
01458 {
01459 #if DEBUG
01460         DXF_DEBUG_BEGIN
01461 #endif
01462         /* Do some basic checks. */
01463         if (ray == NULL)
01464         {
01465                 fprintf (stderr,
01466                   (_("Error in %s () a NULL pointer was passed.\n")),
01467                   __FUNCTION__);
01468                 return (NULL);
01469         }
01470         if (shadow_mode < 0)
01471         {
01472                 fprintf (stderr,
01473                   (_("Error in %s () a negative value was passed.\n")),
01474                   __FUNCTION__);
01475                 return (NULL);
01476         }
01477         if (shadow_mode > 3)
01478         {
01479                 fprintf (stderr,
01480                   (_("Error in %s () an out of range value was passed.\n")),
01481                   __FUNCTION__);
01482                 return (NULL);
01483         }
01484         ray->shadow_mode = shadow_mode;
01485 #if DEBUG
01486         DXF_DEBUG_END
01487 #endif
01488         return (ray);
01489 }
01490 
01491 
01500 DxfBinaryGraphicsData *
01501 dxf_ray_get_binary_graphics_data
01502 (
01503         DxfRay *ray
01505 )
01506 {
01507 #if DEBUG
01508         DXF_DEBUG_BEGIN
01509 #endif
01510         /* Do some basic checks. */
01511         if (ray == NULL)
01512         {
01513                 fprintf (stderr,
01514                   (_("Error in %s () a NULL pointer was passed.\n")),
01515                   __FUNCTION__);
01516                 return (NULL);
01517         }
01518         if (ray->binary_graphics_data ==  NULL)
01519         {
01520                 fprintf (stderr,
01521                   (_("Error in %s () a NULL pointer was found.\n")),
01522                   __FUNCTION__);
01523                 return (NULL);
01524         }
01525 #if DEBUG
01526         DXF_DEBUG_END
01527 #endif
01528         return ((DxfBinaryGraphicsData *) ray->binary_graphics_data);
01529 }
01530 
01531 
01536 DxfRay *
01537 dxf_ray_set_binary_graphics_data
01538 (
01539         DxfRay *ray,
01541         DxfBinaryGraphicsData *data
01544 )
01545 {
01546 #if DEBUG
01547         DXF_DEBUG_BEGIN
01548 #endif
01549         /* Do some basic checks. */
01550         if (ray == NULL)
01551         {
01552                 fprintf (stderr,
01553                   (_("Error in %s () a NULL pointer was passed.\n")),
01554                   __FUNCTION__);
01555                 return (NULL);
01556         }
01557         if (data == NULL)
01558         {
01559                 fprintf (stderr,
01560                   (_("Error in %s () a NULL pointer was passed.\n")),
01561                   __FUNCTION__);
01562                 return (NULL);
01563         }
01564         ray->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01565 #if DEBUG
01566         DXF_DEBUG_END
01567 #endif
01568         return (ray);
01569 }
01570 
01571 
01580 char *
01581 dxf_ray_get_dictionary_owner_soft
01582 (
01583         DxfRay *ray
01585 )
01586 {
01587 #if DEBUG
01588         DXF_DEBUG_BEGIN
01589 #endif
01590         /* Do some basic checks. */
01591         if (ray == NULL)
01592         {
01593                 fprintf (stderr,
01594                   (_("Error in %s () a NULL pointer was passed.\n")),
01595                   __FUNCTION__);
01596                 return (NULL);
01597         }
01598         if (ray->dictionary_owner_soft ==  NULL)
01599         {
01600                 fprintf (stderr,
01601                   (_("Error in %s () a NULL pointer was found.\n")),
01602                   __FUNCTION__);
01603                 return (NULL);
01604         }
01605 #if DEBUG
01606         DXF_DEBUG_END
01607 #endif
01608         return (strdup (ray->dictionary_owner_soft));
01609 }
01610 
01611 
01616 DxfRay *
01617 dxf_ray_set_dictionary_owner_soft
01618 (
01619         DxfRay *ray,
01621         char *dictionary_owner_soft
01624 )
01625 {
01626 #if DEBUG
01627         DXF_DEBUG_BEGIN
01628 #endif
01629         /* Do some basic checks. */
01630         if (ray == NULL)
01631         {
01632                 fprintf (stderr,
01633                   (_("Error in %s () a NULL pointer was passed.\n")),
01634                   __FUNCTION__);
01635                 return (NULL);
01636         }
01637         if (dictionary_owner_soft == NULL)
01638         {
01639                 fprintf (stderr,
01640                   (_("Error in %s () a NULL pointer was passed.\n")),
01641                   __FUNCTION__);
01642                 return (NULL);
01643         }
01644         ray->dictionary_owner_soft = strdup (dictionary_owner_soft);
01645 #if DEBUG
01646         DXF_DEBUG_END
01647 #endif
01648         return (ray);
01649 }
01650 
01651 
01660 char *
01661 dxf_ray_get_material
01662 (
01663         DxfRay *ray
01665 )
01666 {
01667 #if DEBUG
01668         DXF_DEBUG_BEGIN
01669 #endif
01670         /* Do some basic checks. */
01671         if (ray == NULL)
01672         {
01673                 fprintf (stderr,
01674                   (_("Error in %s () a NULL pointer was passed.\n")),
01675                   __FUNCTION__);
01676                 return (NULL);
01677         }
01678         if (ray->material ==  NULL)
01679         {
01680                 fprintf (stderr,
01681                   (_("Error in %s () a NULL pointer was found.\n")),
01682                   __FUNCTION__);
01683                 return (NULL);
01684         }
01685 #if DEBUG
01686         DXF_DEBUG_END
01687 #endif
01688         return (strdup (ray->material));
01689 }
01690 
01691 
01698 DxfRay *
01699 dxf_ray_set_material
01700 (
01701         DxfRay *ray,
01703         char *material
01706 )
01707 {
01708 #if DEBUG
01709         DXF_DEBUG_BEGIN
01710 #endif
01711         /* Do some basic checks. */
01712         if (ray == NULL)
01713         {
01714                 fprintf (stderr,
01715                   (_("Error in %s () a NULL pointer was passed.\n")),
01716                   __FUNCTION__);
01717                 return (NULL);
01718         }
01719         if (material == NULL)
01720         {
01721                 fprintf (stderr,
01722                   (_("Error in %s () a NULL pointer was passed.\n")),
01723                   __FUNCTION__);
01724                 return (NULL);
01725         }
01726         ray->material = strdup (material);
01727 #if DEBUG
01728         DXF_DEBUG_END
01729 #endif
01730         return (ray);
01731 }
01732 
01733 
01742 char *
01743 dxf_ray_get_dictionary_owner_hard
01744 (
01745         DxfRay *ray
01747 )
01748 {
01749 #if DEBUG
01750         DXF_DEBUG_BEGIN
01751 #endif
01752         /* Do some basic checks. */
01753         if (ray == NULL)
01754         {
01755                 fprintf (stderr,
01756                   (_("Error in %s () a NULL pointer was passed.\n")),
01757                   __FUNCTION__);
01758                 return (NULL);
01759         }
01760         if (ray->dictionary_owner_hard ==  NULL)
01761         {
01762                 fprintf (stderr,
01763                   (_("Error in %s () a NULL pointer was found.\n")),
01764                   __FUNCTION__);
01765                 return (NULL);
01766         }
01767 #if DEBUG
01768         DXF_DEBUG_END
01769 #endif
01770         return (strdup (ray->dictionary_owner_hard));
01771 }
01772 
01773 
01778 DxfRay *
01779 dxf_ray_set_dictionary_owner_hard
01780 (
01781         DxfRay *ray,
01783         char *dictionary_owner_hard
01786 )
01787 {
01788 #if DEBUG
01789         DXF_DEBUG_BEGIN
01790 #endif
01791         /* Do some basic checks. */
01792         if (ray == NULL)
01793         {
01794                 fprintf (stderr,
01795                   (_("Error in %s () a NULL pointer was passed.\n")),
01796                   __FUNCTION__);
01797                 return (NULL);
01798         }
01799         if (dictionary_owner_hard == NULL)
01800         {
01801                 fprintf (stderr,
01802                   (_("Error in %s () a NULL pointer was passed.\n")),
01803                   __FUNCTION__);
01804                 return (NULL);
01805         }
01806         ray->dictionary_owner_hard = strdup (dictionary_owner_hard);
01807 #if DEBUG
01808         DXF_DEBUG_END
01809 #endif
01810         return (ray);
01811 }
01812 
01813 
01820 int16_t
01821 dxf_ray_get_lineweight
01822 (
01823         DxfRay *ray
01825 )
01826 {
01827 #if DEBUG
01828         DXF_DEBUG_BEGIN
01829 #endif
01830         /* Do some basic checks. */
01831         if (ray == NULL)
01832         {
01833                 fprintf (stderr,
01834                   (_("Error in %s () a NULL pointer was passed.\n")),
01835                   __FUNCTION__);
01836                 return (EXIT_FAILURE);
01837         }
01838 #if DEBUG
01839         DXF_DEBUG_END
01840 #endif
01841         return (ray->lineweight);
01842 }
01843 
01844 
01851 DxfRay *
01852 dxf_ray_set_lineweight
01853 (
01854         DxfRay *ray,
01856         int16_t lineweight
01858 )
01859 {
01860 #if DEBUG
01861         DXF_DEBUG_BEGIN
01862 #endif
01863         /* Do some basic checks. */
01864         if (ray == NULL)
01865         {
01866                 fprintf (stderr,
01867                   (_("Error in %s () a NULL pointer was passed.\n")),
01868                   __FUNCTION__);
01869                 return (NULL);
01870         }
01871         ray->lineweight = lineweight;
01872 #if DEBUG
01873         DXF_DEBUG_END
01874 #endif
01875         return (ray);
01876 }
01877 
01878 
01885 char *
01886 dxf_ray_get_plot_style_name
01887 (
01888         DxfRay *ray
01890 )
01891 {
01892 #if DEBUG
01893         DXF_DEBUG_BEGIN
01894 #endif
01895         /* Do some basic checks. */
01896         if (ray == NULL)
01897         {
01898                 fprintf (stderr,
01899                   (_("Error in %s () a NULL pointer was passed.\n")),
01900                   __FUNCTION__);
01901                 return (NULL);
01902         }
01903         if (ray->plot_style_name ==  NULL)
01904         {
01905                 fprintf (stderr,
01906                   (_("Error in %s () a NULL pointer was found.\n")),
01907                   __FUNCTION__);
01908                 return (NULL);
01909         }
01910 #if DEBUG
01911         DXF_DEBUG_END
01912 #endif
01913         return (strdup (ray->plot_style_name));
01914 }
01915 
01916 
01923 DxfRay *
01924 dxf_ray_set_plot_style_name
01925 (
01926         DxfRay *ray,
01928         char *plot_style_name
01931 )
01932 {
01933 #if DEBUG
01934         DXF_DEBUG_BEGIN
01935 #endif
01936         /* Do some basic checks. */
01937         if (ray == NULL)
01938         {
01939                 fprintf (stderr,
01940                   (_("Error in %s () a NULL pointer was passed.\n")),
01941                   __FUNCTION__);
01942                 return (NULL);
01943         }
01944         if (plot_style_name == NULL)
01945         {
01946                 fprintf (stderr,
01947                   (_("Error in %s () a NULL pointer was passed.\n")),
01948                   __FUNCTION__);
01949                 return (NULL);
01950         }
01951         ray->plot_style_name = strdup (plot_style_name);
01952 #if DEBUG
01953         DXF_DEBUG_END
01954 #endif
01955         return (ray);
01956 }
01957 
01958 
01965 long
01966 dxf_ray_get_color_value
01967 (
01968         DxfRay *ray
01970 )
01971 {
01972 #if DEBUG
01973         DXF_DEBUG_BEGIN
01974 #endif
01975         /* Do some basic checks. */
01976         if (ray == NULL)
01977         {
01978                 fprintf (stderr,
01979                   (_("Error in %s () a NULL pointer was passed.\n")),
01980                   __FUNCTION__);
01981                 return (EXIT_FAILURE);
01982         }
01983 #if DEBUG
01984         DXF_DEBUG_END
01985 #endif
01986         return (ray->color_value);
01987 }
01988 
01989 
01996 DxfRay *
01997 dxf_ray_set_color_value
01998 (
01999         DxfRay *ray,
02001         long color_value
02003 )
02004 {
02005 #if DEBUG
02006         DXF_DEBUG_BEGIN
02007 #endif
02008         /* Do some basic checks. */
02009         if (ray == NULL)
02010         {
02011                 fprintf (stderr,
02012                   (_("Error in %s () a NULL pointer was passed.\n")),
02013                   __FUNCTION__);
02014                 return (NULL);
02015         }
02016         ray->color_value = color_value;
02017 #if DEBUG
02018         DXF_DEBUG_END
02019 #endif
02020         return (ray);
02021 }
02022 
02023 
02030 char *
02031 dxf_ray_get_color_name
02032 (
02033         DxfRay *ray
02035 )
02036 {
02037 #if DEBUG
02038         DXF_DEBUG_BEGIN
02039 #endif
02040         /* Do some basic checks. */
02041         if (ray == NULL)
02042         {
02043                 fprintf (stderr,
02044                   (_("Error in %s () a NULL pointer was passed.\n")),
02045                   __FUNCTION__);
02046                 return (NULL);
02047         }
02048         if (ray->color_name ==  NULL)
02049         {
02050                 fprintf (stderr,
02051                   (_("Error in %s () a NULL pointer was found.\n")),
02052                   __FUNCTION__);
02053                 return (NULL);
02054         }
02055 #if DEBUG
02056         DXF_DEBUG_END
02057 #endif
02058         return (strdup (ray->color_name));
02059 }
02060 
02061 
02068 DxfRay *
02069 dxf_ray_set_color_name
02070 (
02071         DxfRay *ray,
02073         char *color_name
02076 )
02077 {
02078 #if DEBUG
02079         DXF_DEBUG_BEGIN
02080 #endif
02081         /* Do some basic checks. */
02082         if (ray == NULL)
02083         {
02084                 fprintf (stderr,
02085                   (_("Error in %s () a NULL pointer was passed.\n")),
02086                   __FUNCTION__);
02087                 return (NULL);
02088         }
02089         if (color_name == NULL)
02090         {
02091                 fprintf (stderr,
02092                   (_("Error in %s () a NULL pointer was passed.\n")),
02093                   __FUNCTION__);
02094                 return (NULL);
02095         }
02096         ray->color_name = strdup (color_name);
02097 #if DEBUG
02098         DXF_DEBUG_END
02099 #endif
02100         return (ray);
02101 }
02102 
02103 
02110 long
02111 dxf_ray_get_transparency
02112 (
02113         DxfRay *ray
02115 )
02116 {
02117 #if DEBUG
02118         DXF_DEBUG_BEGIN
02119 #endif
02120         /* Do some basic checks. */
02121         if (ray == NULL)
02122         {
02123                 fprintf (stderr,
02124                   (_("Error in %s () a NULL pointer was passed.\n")),
02125                   __FUNCTION__);
02126                 return (EXIT_FAILURE);
02127         }
02128 #if DEBUG
02129         DXF_DEBUG_END
02130 #endif
02131         return (ray->transparency);
02132 }
02133 
02134 
02141 DxfRay *
02142 dxf_ray_set_transparency
02143 (
02144         DxfRay *ray,
02146         long transparency
02148 )
02149 {
02150 #if DEBUG
02151         DXF_DEBUG_BEGIN
02152 #endif
02153         /* Do some basic checks. */
02154         if (ray == NULL)
02155         {
02156                 fprintf (stderr,
02157                   (_("Error in %s () a NULL pointer was passed.\n")),
02158                   __FUNCTION__);
02159                 return (NULL);
02160         }
02161         ray->transparency = transparency;
02162 #if DEBUG
02163         DXF_DEBUG_END
02164 #endif
02165         return (ray);
02166 }
02167 
02168 
02174 DxfPoint *
02175 dxf_ray_get_p0
02176 (
02177         DxfRay *ray
02179 )
02180 {
02181 #ifdef DEBUG
02182         DXF_DEBUG_BEGIN
02183 #endif
02184         /* Do some basic checks. */
02185         if (ray == NULL)
02186         {
02187                 fprintf (stderr,
02188                   (_("Error in %s () a NULL pointer was passed.\n")),
02189                   __FUNCTION__);
02190                 return (NULL);
02191         }
02192         if (ray->p0 == NULL)
02193         {
02194                 fprintf (stderr,
02195                   (_("Error in %s () a NULL pointer was found.\n")),
02196                   __FUNCTION__);
02197                 return (NULL);
02198         }
02199 #if DEBUG
02200         DXF_DEBUG_END
02201 #endif
02202         return (ray->p0);
02203 }
02204 
02205 
02211 DxfRay *
02212 dxf_ray_set_p0
02213 (
02214         DxfRay *ray,
02216         DxfPoint *p0
02218 )
02219 {
02220 #ifdef DEBUG
02221         DXF_DEBUG_BEGIN
02222 #endif
02223         /* Do some basic checks. */
02224         if (ray == NULL)
02225         {
02226                 fprintf (stderr,
02227                   (_("Error in %s () a NULL pointer was passed.\n")),
02228                   __FUNCTION__);
02229                 return (NULL);
02230         }
02231         if (p0 == NULL)
02232         {
02233                 fprintf (stderr,
02234                   (_("Error in %s () a NULL pointer was passed.\n")),
02235                   __FUNCTION__);
02236                 return (NULL);
02237         }
02238         ray->p0 = p0;
02239 #if DEBUG
02240         DXF_DEBUG_END
02241 #endif
02242         return (ray);
02243 }
02244 
02245 
02252 double
02253 dxf_ray_get_x0
02254 (
02255         DxfRay *ray
02257 )
02258 {
02259 #ifdef DEBUG
02260         DXF_DEBUG_BEGIN
02261 #endif
02262 
02263         /* Do some basic checks. */
02264         if (ray == NULL)
02265         {
02266                 fprintf (stderr,
02267                   (_("Error in %s () a NULL pointer was passed.\n")),
02268                   __FUNCTION__);
02269                 return (EXIT_FAILURE);
02270         }
02271         if (ray->p0 == NULL)
02272         {
02273                 fprintf (stderr,
02274                   (_("Error in %s () a NULL pointer was found.\n")),
02275                   __FUNCTION__);
02276                 return (EXIT_FAILURE);
02277         }
02278 #if DEBUG
02279         DXF_DEBUG_END
02280 #endif
02281         return (ray->p0->x0);
02282 }
02283 
02284 
02292 DxfRay *
02293 dxf_ray_set_x0
02294 (
02295         DxfRay *ray,
02297         double x0
02300 )
02301 {
02302 #ifdef DEBUG
02303         DXF_DEBUG_BEGIN
02304 #endif
02305         /* Do some basic checks. */
02306         if (ray == NULL)
02307         {
02308                 fprintf (stderr,
02309                   (_("Error in %s () a NULL pointer was passed.\n")),
02310                   __FUNCTION__);
02311                 return (NULL);
02312         }
02313         if (ray->p0 == NULL)
02314         {
02315                 fprintf (stderr,
02316                   (_("Error in %s () a NULL pointer was found.\n")),
02317                   __FUNCTION__);
02318                 return (NULL);
02319         }
02320         ray->p0->x0 = x0;
02321 #if DEBUG
02322         DXF_DEBUG_END
02323 #endif
02324         return (ray);
02325 }
02326 
02327 
02334 double
02335 dxf_ray_get_y0
02336 (
02337         DxfRay *ray
02339 )
02340 {
02341 #ifdef DEBUG
02342         DXF_DEBUG_BEGIN
02343 #endif
02344 
02345         /* Do some basic checks. */
02346         if (ray == NULL)
02347         {
02348                 fprintf (stderr,
02349                   (_("Error in %s () a NULL pointer was passed.\n")),
02350                   __FUNCTION__);
02351                 return (EXIT_FAILURE);
02352         }
02353         if (ray->p0 == NULL)
02354         {
02355                 fprintf (stderr,
02356                   (_("Error in %s () a NULL pointer was found.\n")),
02357                   __FUNCTION__);
02358                 return (EXIT_FAILURE);
02359         }
02360 #if DEBUG
02361         DXF_DEBUG_END
02362 #endif
02363         return (ray->p0->y0);
02364 }
02365 
02366 
02374 DxfRay *
02375 dxf_ray_set_y0
02376 (
02377         DxfRay *ray,
02379         double y0
02382 )
02383 {
02384 #ifdef DEBUG
02385         DXF_DEBUG_BEGIN
02386 #endif
02387         /* Do some basic checks. */
02388         if (ray == NULL)
02389         {
02390                 fprintf (stderr,
02391                   (_("Error in %s () a NULL pointer was passed.\n")),
02392                   __FUNCTION__);
02393                 return (NULL);
02394         }
02395         if (ray->p0 == NULL)
02396         {
02397                 fprintf (stderr,
02398                   (_("Error in %s () a NULL pointer was found.\n")),
02399                   __FUNCTION__);
02400                 return (NULL);
02401         }
02402         ray->p0->y0 = y0;
02403 #if DEBUG
02404         DXF_DEBUG_END
02405 #endif
02406         return (ray);
02407 }
02408 
02409 
02416 double
02417 dxf_ray_get_z0
02418 (
02419         DxfRay *ray
02421 )
02422 {
02423 #ifdef DEBUG
02424         DXF_DEBUG_BEGIN
02425 #endif
02426 
02427         /* Do some basic checks. */
02428         if (ray == NULL)
02429         {
02430                 fprintf (stderr,
02431                   (_("Error in %s () a NULL pointer was passed.\n")),
02432                   __FUNCTION__);
02433                 return (EXIT_FAILURE);
02434         }
02435         if (ray->p0 == NULL)
02436         {
02437                 fprintf (stderr,
02438                   (_("Error in %s () a NULL pointer was found.\n")),
02439                   __FUNCTION__);
02440                 return (EXIT_FAILURE);
02441         }
02442 #if DEBUG
02443         DXF_DEBUG_END
02444 #endif
02445         return (ray->p0->z0);
02446 }
02447 
02448 
02456 DxfRay *
02457 dxf_ray_set_z0
02458 (
02459         DxfRay *ray,
02461         double z0
02464 )
02465 {
02466 #ifdef DEBUG
02467         DXF_DEBUG_BEGIN
02468 #endif
02469         /* Do some basic checks. */
02470         if (ray == NULL)
02471         {
02472                 fprintf (stderr,
02473                   (_("Error in %s () a NULL pointer was passed.\n")),
02474                   __FUNCTION__);
02475                 return (NULL);
02476         }
02477         if (ray->p0 == NULL)
02478         {
02479                 fprintf (stderr,
02480                   (_("Error in %s () a NULL pointer was found.\n")),
02481                   __FUNCTION__);
02482                 return (NULL);
02483         }
02484         ray->p0->z0 = z0;
02485 #if DEBUG
02486         DXF_DEBUG_END
02487 #endif
02488         return (ray);
02489 }
02490 
02491 
02497 DxfPoint *
02498 dxf_ray_get_p1
02499 (
02500         DxfRay *ray
02502 )
02503 {
02504 #ifdef DEBUG
02505         DXF_DEBUG_BEGIN
02506 #endif
02507         /* Do some basic checks. */
02508         if (ray == NULL)
02509         {
02510                 fprintf (stderr,
02511                   (_("Error in %s () a NULL pointer was passed.\n")),
02512                   __FUNCTION__);
02513                 return (NULL);
02514         }
02515         if (ray->p1 == NULL)
02516         {
02517                 fprintf (stderr,
02518                   (_("Error in %s () a NULL pointer was found.\n")),
02519                   __FUNCTION__);
02520                 return (NULL);
02521         }
02522 #if DEBUG
02523         DXF_DEBUG_END
02524 #endif
02525         return (ray->p1);
02526 }
02527 
02528 
02534 DxfRay *
02535 dxf_ray_set_p1
02536 (
02537         DxfRay *ray,
02539         DxfPoint *p1
02541 )
02542 {
02543 #ifdef DEBUG
02544         DXF_DEBUG_BEGIN
02545 #endif
02546         /* Do some basic checks. */
02547         if (ray == NULL)
02548         {
02549                 fprintf (stderr,
02550                   (_("Error in %s () a NULL pointer was passed.\n")),
02551                   __FUNCTION__);
02552                 return (NULL);
02553         }
02554         if (p1 == NULL)
02555         {
02556                 fprintf (stderr,
02557                   (_("Error in %s () a NULL pointer was passed.\n")),
02558                   __FUNCTION__);
02559                 return (NULL);
02560         }
02561         ray->p1 = p1;
02562 #if DEBUG
02563         DXF_DEBUG_END
02564 #endif
02565         return (ray);
02566 }
02567 
02568 
02575 double
02576 dxf_ray_get_x1
02577 (
02578         DxfRay *ray
02580 )
02581 {
02582 #ifdef DEBUG
02583         DXF_DEBUG_BEGIN
02584 #endif
02585 
02586         /* Do some basic checks. */
02587         if (ray == NULL)
02588         {
02589                 fprintf (stderr,
02590                   (_("Error in %s () a NULL pointer was passed.\n")),
02591                   __FUNCTION__);
02592                 return (EXIT_FAILURE);
02593         }
02594         if (ray->p1 == NULL)
02595         {
02596                 fprintf (stderr,
02597                   (_("Error in %s () a NULL pointer was found.\n")),
02598                   __FUNCTION__);
02599                 return (EXIT_FAILURE);
02600         }
02601 #if DEBUG
02602         DXF_DEBUG_END
02603 #endif
02604         return (ray->p1->x0);
02605 }
02606 
02607 
02615 DxfRay *
02616 dxf_ray_set_x1
02617 (
02618         DxfRay *ray,
02620         double x1
02623 )
02624 {
02625 #ifdef DEBUG
02626         DXF_DEBUG_BEGIN
02627 #endif
02628         /* Do some basic checks. */
02629         if (ray == NULL)
02630         {
02631                 fprintf (stderr,
02632                   (_("Error in %s () a NULL pointer was passed.\n")),
02633                   __FUNCTION__);
02634                 return (NULL);
02635         }
02636         if (ray->p1 == NULL)
02637         {
02638                 fprintf (stderr,
02639                   (_("Error in %s () a NULL pointer was found.\n")),
02640                   __FUNCTION__);
02641                 return (NULL);
02642         }
02643         ray->p1->x0 = x1;
02644 #if DEBUG
02645         DXF_DEBUG_END
02646 #endif
02647         return (ray);
02648 }
02649 
02650 
02657 double
02658 dxf_ray_get_y1
02659 (
02660         DxfRay *ray
02662 )
02663 {
02664 #ifdef DEBUG
02665         DXF_DEBUG_BEGIN
02666 #endif
02667 
02668         /* Do some basic checks. */
02669         if (ray == NULL)
02670         {
02671                 fprintf (stderr,
02672                   (_("Error in %s () a NULL pointer was passed.\n")),
02673                   __FUNCTION__);
02674                 return (EXIT_FAILURE);
02675         }
02676         if (ray->p1 == NULL)
02677         {
02678                 fprintf (stderr,
02679                   (_("Error in %s () a NULL pointer was found.\n")),
02680                   __FUNCTION__);
02681                 return (EXIT_FAILURE);
02682         }
02683 #if DEBUG
02684         DXF_DEBUG_END
02685 #endif
02686         return (ray->p1->y0);
02687 }
02688 
02689 
02697 DxfRay *
02698 dxf_ray_set_y1
02699 (
02700         DxfRay *ray,
02702         double y1
02705 )
02706 {
02707 #ifdef DEBUG
02708         DXF_DEBUG_BEGIN
02709 #endif
02710         /* Do some basic checks. */
02711         if (ray == NULL)
02712         {
02713                 fprintf (stderr,
02714                   (_("Error in %s () a NULL pointer was passed.\n")),
02715                   __FUNCTION__);
02716                 return (NULL);
02717         }
02718         if (ray->p1 == NULL)
02719         {
02720                 fprintf (stderr,
02721                   (_("Error in %s () a NULL pointer was found.\n")),
02722                   __FUNCTION__);
02723                 return (NULL);
02724         }
02725         ray->p1->y0 = y1;
02726 #if DEBUG
02727         DXF_DEBUG_END
02728 #endif
02729         return (ray);
02730 }
02731 
02732 
02739 double
02740 dxf_ray_get_z1
02741 (
02742         DxfRay *ray
02744 )
02745 {
02746 #ifdef DEBUG
02747         DXF_DEBUG_BEGIN
02748 #endif
02749 
02750         /* Do some basic checks. */
02751         if (ray == NULL)
02752         {
02753                 fprintf (stderr,
02754                   (_("Error in %s () a NULL pointer was passed.\n")),
02755                   __FUNCTION__);
02756                 return (EXIT_FAILURE);
02757         }
02758         if (ray->p1 == NULL)
02759         {
02760                 fprintf (stderr,
02761                   (_("Error in %s () a NULL pointer was found.\n")),
02762                   __FUNCTION__);
02763                 return (EXIT_FAILURE);
02764         }
02765 #if DEBUG
02766         DXF_DEBUG_END
02767 #endif
02768         return (ray->p1->z0);
02769 }
02770 
02771 
02779 DxfRay *
02780 dxf_ray_set_z1
02781 (
02782         DxfRay *ray,
02784         double z1
02787 )
02788 {
02789 #ifdef DEBUG
02790         DXF_DEBUG_BEGIN
02791 #endif
02792         /* Do some basic checks. */
02793         if (ray == NULL)
02794         {
02795                 fprintf (stderr,
02796                   (_("Error in %s () a NULL pointer was passed.\n")),
02797                   __FUNCTION__);
02798                 return (NULL);
02799         }
02800         if (ray->p1 == NULL)
02801         {
02802                 fprintf (stderr,
02803                   (_("Error in %s () a NULL pointer was found.\n")),
02804                   __FUNCTION__);
02805                 return (NULL);
02806         }
02807         ray->p1->z0 = z1;
02808 #if DEBUG
02809         DXF_DEBUG_END
02810 #endif
02811         return (ray);
02812 }
02813 
02814 
02823 DxfRay *
02824 dxf_ray_get_next
02825 (
02826         DxfRay *ray
02828 )
02829 {
02830 #if DEBUG
02831         DXF_DEBUG_BEGIN
02832 #endif
02833         /* Do some basic checks. */
02834         if (ray == NULL)
02835         {
02836                 fprintf (stderr,
02837                   (_("Error in %s () a NULL pointer was passed.\n")),
02838                   __FUNCTION__);
02839                 return (NULL);
02840         }
02841         if (ray->next == NULL)
02842         {
02843                 fprintf (stderr,
02844                   (_("Error in %s () a NULL pointer was found.\n")),
02845                   __FUNCTION__);
02846                 return (NULL);
02847         }
02848 #if DEBUG
02849         DXF_DEBUG_END
02850 #endif
02851         return ((DxfRay *) ray->next);
02852 }
02853 
02854 
02859 DxfRay *
02860 dxf_ray_set_next
02861 (
02862         DxfRay *ray,
02864         DxfRay *next
02866 )
02867 {
02868 #if DEBUG
02869         DXF_DEBUG_BEGIN
02870 #endif
02871         /* Do some basic checks. */
02872         if (ray == NULL)
02873         {
02874                 fprintf (stderr,
02875                   (_("Error in %s () a NULL pointer was passed.\n")),
02876                   __FUNCTION__);
02877                 return (NULL);
02878         }
02879         if (next == NULL)
02880         {
02881                 fprintf (stderr,
02882                   (_("Error in %s () a NULL pointer was passed.\n")),
02883                   __FUNCTION__);
02884                 return (NULL);
02885         }
02886         ray->next = (struct DxfRay *) next;
02887 #if DEBUG
02888         DXF_DEBUG_END
02889 #endif
02890         return (ray);
02891 }
02892 
02893 
02902 DxfRay *
02903 dxf_ray_get_last
02904 (
02905         DxfRay *ray
02907 )
02908 {
02909 #if DEBUG
02910         DXF_DEBUG_BEGIN
02911 #endif
02912         /* Do some basic checks. */
02913         if (ray == NULL)
02914         {
02915                 fprintf (stderr,
02916                   (_("Error in %s () a NULL pointer was passed.\n")),
02917                   __FUNCTION__);
02918                 return (NULL);
02919         }
02920         if (ray->next == NULL)
02921         {
02922                 fprintf (stderr,
02923                   (_("Warning in %s () a NULL pointer was found.\n")),
02924                   __FUNCTION__);
02925                 return ((DxfRay *) ray);
02926         }
02927         DxfRay *iter = (DxfRay *) ray->next;
02928         while (iter->next != NULL)
02929         {
02930                 iter = (DxfRay *) iter->next;
02931         }
02932 #if DEBUG
02933         DXF_DEBUG_END
02934 #endif
02935         return ((DxfRay *) iter);
02936 }
02937 
02938 
02939 /* EOF */