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

point.c

Go to the documentation of this file.
00001 
00059 #include "point.h"
00060 
00061 
00067 DxfPoint *
00068 dxf_point_new ()
00069 {
00070 #if DEBUG
00071         DXF_DEBUG_BEGIN
00072 #endif
00073         DxfPoint *point = NULL;
00074         size_t size;
00075 
00076         size = sizeof (DxfPoint);
00077         /* avoid malloc of 0 bytes */
00078         if (size == 0) size = 1;
00079         if ((point = malloc (size)) == NULL)
00080         {
00081                 fprintf (stderr,
00082                   (_("Error in %s () could not allocate memory for a DxfPoint struct.\n")),
00083                   __FUNCTION__);
00084                 point = NULL;
00085         }
00086         else
00087         {
00088                 memset (point, 0, size);
00089         }
00090 #if DEBUG
00091         DXF_DEBUG_END
00092 #endif
00093         return (point);
00094 }
00095 
00096 
00103 DxfPoint *
00104 dxf_point_init
00105 (
00106         DxfPoint *point
00108 )
00109 {
00110 #if DEBUG
00111         DXF_DEBUG_BEGIN
00112 #endif
00113         /* Do some basic checks. */
00114         if (point == NULL)
00115         {
00116                 fprintf (stderr,
00117                   (_("Warning in %s () a NULL pointer was passed.\n")),
00118                   __FUNCTION__);
00119                 point = dxf_point_new ();
00120         }
00121         if (point == NULL)
00122         {
00123                 fprintf (stderr,
00124                   (_("Error in %s () could not allocate memory for a DxfPoint struct.\n")),
00125                   __FUNCTION__);
00126                 return (NULL);
00127         }
00128         point->id_code = 0;
00129         point->linetype = strdup (DXF_DEFAULT_LINETYPE);
00130         point->layer = strdup (DXF_DEFAULT_LAYER);
00131         point->x0 = 0.0;
00132         point->y0 = 0.0;
00133         point->z0 = 0.0;
00134         point->elevation = 0.0;
00135         point->thickness = 0.0;
00136         point->linetype_scale = DXF_DEFAULT_LINETYPE_SCALE;
00137         point->angle_to_X = 0.0;
00138         point->visibility = DXF_DEFAULT_VISIBILITY;
00139         point->color = DXF_COLOR_BYLAYER;
00140         point->paperspace = DXF_MODELSPACE;
00141         point->extr_x0 = 0.0;
00142         point->extr_y0 = 0.0;
00143         point->extr_z0 = 0.0;
00144         point->dictionary_owner_soft = strdup ("");
00145         point->dictionary_owner_hard = strdup ("");
00146         point->next = NULL;
00147 #if DEBUG
00148         DXF_DEBUG_END
00149 #endif
00150         return (point);
00151 }
00152 
00153 
00166 DxfPoint *
00167 dxf_point_read
00168 (
00169         DxfFile *fp,
00171         DxfPoint *point
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 (point == NULL)
00191         {
00192                 fprintf (stderr,
00193                   (_("Warning in %s () a NULL pointer was passed.\n")),
00194                   __FUNCTION__);
00195                 point = dxf_point_new ();
00196                 point = dxf_point_init (point);
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", &point->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", point->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", point->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", &point->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", &point->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", &point->z0);
00252                 }
00253                 else if ((fp->acad_version_number <= AutoCAD_11)
00254                         && (strcmp (temp_string, "38") == 0)
00255                         && (point->elevation != 0.0))
00256                 {
00257                         /* Now follows a string containing the
00258                          * elevation. */
00259                         (fp->line_number)++;
00260                         fscanf (fp->fp, "%lf\n", &point->elevation);
00261                 }
00262                 else if (strcmp (temp_string, "39") == 0)
00263                 {
00264                         /* Now follows a string containing the
00265                          * thickness. */
00266                         (fp->line_number)++;
00267                         fscanf (fp->fp, "%lf\n", &point->thickness);
00268                 }
00269                 else if (strcmp (temp_string, "48") == 0)
00270                 {
00271                         /* Now follows a string containing the linetype
00272                          * scale. */
00273                         (fp->line_number)++;
00274                         fscanf (fp->fp, "%lf\n", &point->linetype_scale);
00275                 }
00276                 else if (strcmp (temp_string, "50") == 0)
00277                 {
00278                         /* Now follows a string containing the
00279                          * start angle. */
00280                         (fp->line_number)++;
00281                         fscanf (fp->fp, "%lf\n", &point->angle_to_X);
00282                 }
00283                 else if (strcmp (temp_string, "60") == 0)
00284                 {
00285                         /* Now follows a string containing the
00286                          * visibility value. */
00287                         (fp->line_number)++;
00288                         fscanf (fp->fp, "%hd\n", &point->visibility);
00289                 }
00290                 else if (strcmp (temp_string, "62") == 0)
00291                 {
00292                         /* Now follows a string containing the
00293                          * color value. */
00294                         (fp->line_number)++;
00295                         fscanf (fp->fp, "%d\n", &point->color);
00296                 }
00297                 else if (strcmp (temp_string, "67") == 0)
00298                 {
00299                         /* Now follows a string containing the
00300                          * paperspace value. */
00301                         (fp->line_number)++;
00302                         fscanf (fp->fp, "%d\n", &point->paperspace);
00303                 }
00304                 else if ((fp->acad_version_number >= AutoCAD_13)
00305                         && (strcmp (temp_string, "100") == 0))
00306                 {
00307                         /* Now follows a string containing the
00308                          * subclass marker value. */
00309                         (fp->line_number)++;
00310                         fscanf (fp->fp, "%s\n", temp_string);
00311                         if ((strcmp (temp_string, "AcDbEntity") != 0)
00312                         && ((strcmp (temp_string, "AcDbPoint") != 0)))
00313                         {
00314                                 fprintf (stderr,
00315                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00316                                   __FUNCTION__, fp->filename, fp->line_number);
00317                         }
00318                 }
00319                 else if (strcmp (temp_string, "210") == 0)
00320                 {
00321                         /* Now follows a string containing the
00322                          * X-value of the extrusion vector. */
00323                         (fp->line_number)++;
00324                         fscanf (fp->fp, "%lf\n", &point->extr_x0);
00325                 }
00326                 else if (strcmp (temp_string, "220") == 0)
00327                 {
00328                         /* Now follows a string containing the
00329                          * Y-value of the extrusion vector. */
00330                         (fp->line_number)++;
00331                         fscanf (fp->fp, "%lf\n", &point->extr_y0);
00332                 }
00333                 else if (strcmp (temp_string, "230") == 0)
00334                 {
00335                         /* Now follows a string containing the
00336                          * Z-value of the extrusion vector. */
00337                         (fp->line_number)++;
00338                         fscanf (fp->fp, "%lf\n", &point->extr_z0);
00339                 }
00340                 else if (strcmp (temp_string, "330") == 0)
00341                 {
00342                         /* Now follows a string containing Soft-pointer
00343                          * ID/handle to owner dictionary. */
00344                         (fp->line_number)++;
00345                         fscanf (fp->fp, "%s\n", point->dictionary_owner_soft);
00346                 }
00347                 else if (strcmp (temp_string, "360") == 0)
00348                 {
00349                         /* Now follows a string containing Hard owner
00350                          * ID/handle to owner dictionary. */
00351                         (fp->line_number)++;
00352                         fscanf (fp->fp, "%s\n", point->dictionary_owner_hard);
00353                 }
00354                 else if (strcmp (temp_string, "999") == 0)
00355                 {
00356                         /* Now follows a string containing a comment. */
00357                         (fp->line_number)++;
00358                         fscanf (fp->fp, "%s\n", temp_string);
00359                         fprintf (stdout, "DXF comment: %s\n", temp_string);
00360                 }
00361                 else
00362                 {
00363                         fprintf (stderr,
00364                           (_("Warning: in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00365                           __FUNCTION__, fp->filename, fp->line_number);
00366                 }
00367         }
00368         /* Handle omitted members and/or illegal values. */
00369         if (strcmp (point->linetype, "") == 0)
00370         {
00371                 point->linetype = strdup (DXF_DEFAULT_LINETYPE);
00372         }
00373         if (strcmp (point->layer, "") == 0)
00374         {
00375                 point->layer = strdup (DXF_DEFAULT_LAYER);
00376         }
00377         /* Clean up. */
00378         free (temp_string);
00379 #if DEBUG
00380         DXF_DEBUG_END
00381 #endif
00382         return (point);
00383 }
00384 
00385 
00392 int
00393 dxf_point_write
00394 (
00395         DxfFile *fp,
00397         DxfPoint *point
00399 )
00400 {
00401 #if DEBUG
00402         DXF_DEBUG_BEGIN
00403 #endif
00404         char *dxf_entity_name = strdup ("POINT");
00405 
00406         /* Do some basic checks. */
00407         if (fp == NULL)
00408         {
00409                 fprintf (stderr,
00410                   (_("Error in %s () a NULL file pointer was passed.\n")),
00411                   __FUNCTION__);
00412                 /* Clean up. */
00413                 free (dxf_entity_name);
00414                 return (EXIT_FAILURE);
00415         }
00416         if (point == NULL)
00417         {
00418                 fprintf (stderr,
00419                   (_("Error in %s () a NULL pointer was passed.\n")),
00420                   __FUNCTION__);
00421                 /* Clean up. */
00422                 free (dxf_entity_name);
00423                 return (EXIT_FAILURE);
00424         }
00425         if (strcmp (point->linetype, "") == 0)
00426         {
00427                 fprintf (stderr,
00428                   (_("Warning in %s () empty linetype string for the %s entity with id-code: %x\n")),
00429                   __FUNCTION__, dxf_entity_name, point->id_code);
00430                 fprintf (stderr,
00431                   (_("\t%s entity is reset to default linetype")),
00432                   dxf_entity_name);
00433                 point->linetype = strdup (DXF_DEFAULT_LINETYPE);
00434         }
00435         if (strcmp (point->layer, "") == 0)
00436         {
00437                 fprintf (stderr,
00438                   (_("Warning in %s () empty layer string for the %s entity with id-code: %x\n")),
00439                   __FUNCTION__, dxf_entity_name,
00440                         point->id_code);
00441                 fprintf (stderr,
00442                   (_("\t%s entity is relocated to layer 0")),
00443                   dxf_entity_name);
00444                 point->layer = strdup (DXF_DEFAULT_LAYER);
00445         }
00446         /* Start writing output. */
00447         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00448         if (point->id_code != -1)
00449         {
00450                 fprintf (fp->fp, "  5\n%x\n", point->id_code);
00451         }
00462         if ((strcmp (point->dictionary_owner_soft, "") != 0)
00463           && (fp->acad_version_number >= AutoCAD_14))
00464         {
00465                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00466                 fprintf (fp->fp, "330\n%s\n", point->dictionary_owner_soft);
00467                 fprintf (fp->fp, "102\n}\n");
00468         }
00469         if ((strcmp (point->dictionary_owner_hard, "") != 0)
00470           && (fp->acad_version_number >= AutoCAD_14))
00471         {
00472                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00473                 fprintf (fp->fp, "360\n%s\n", point->dictionary_owner_hard);
00474                 fprintf (fp->fp, "102\n}\n");
00475         }
00476         if (fp->acad_version_number >= AutoCAD_13)
00477         {
00478                 fprintf (fp->fp, "100\nAcDbEntity\n");
00479         }
00480         if (point->paperspace == DXF_PAPERSPACE)
00481         {
00482                 fprintf (fp->fp, " 67\n%d\n", DXF_PAPERSPACE);
00483         }
00484         fprintf (fp->fp, "  8\n%s\n", point->layer);
00485         if (strcmp (point->linetype, DXF_DEFAULT_LINETYPE) != 0)
00486         {
00487                 fprintf (fp->fp, "  6\n%s\n", point->linetype);
00488         }
00489         if ((fp->acad_version_number <= AutoCAD_11)
00490           && DXF_FLATLAND
00491           && (point->elevation != 0.0))
00492         {
00493                 fprintf (fp->fp, " 38\n%f\n", point->elevation);
00494         }
00495         if (point->color != DXF_COLOR_BYLAYER)
00496         {
00497                 fprintf (fp->fp, " 62\n%d\n", point->color);
00498         }
00499         if (point->linetype_scale != 1.0)
00500         {
00501                 fprintf (fp->fp, " 48\n%f\n", point->linetype_scale);
00502         }
00503         if (point->visibility != 0)
00504         {
00505                 fprintf (fp->fp, " 60\n%d\n", point->visibility);
00506         }
00507         if (fp->acad_version_number >= AutoCAD_13)
00508         {
00509                 fprintf (fp->fp, "100\nAcDbPoint\n");
00510         }
00511         fprintf (fp->fp, " 10\n%f\n", point->x0);
00512         fprintf (fp->fp, " 20\n%f\n", point->y0);
00513         fprintf (fp->fp, " 30\n%f\n", point->z0);
00514         if (point->thickness != 0.0)
00515         {
00516                 fprintf (fp->fp, " 39\n%f\n", point->thickness);
00517         }
00518         if ((fp->acad_version_number >= AutoCAD_12)
00519                 && (point->extr_x0 != 0.0)
00520                 && (point->extr_y0 != 0.0)
00521                 && (point->extr_z0 != 1.0))
00522         {
00523                 fprintf (fp->fp, "210\n%f\n", point->extr_x0);
00524                 fprintf (fp->fp, "220\n%f\n", point->extr_y0);
00525                 fprintf (fp->fp, "230\n%f\n", point->extr_z0);
00526         }
00527         fprintf (fp->fp, " 50\n%f\n", point->angle_to_X);
00528         /* Clean up. */
00529         free (dxf_entity_name);
00530 #if DEBUG
00531         DXF_DEBUG_END
00532 #endif
00533         return (EXIT_SUCCESS);
00534 }
00535 
00536 
00544 int
00545 dxf_point_free
00546 (
00547         DxfPoint *point
00550 )
00551 {
00552 #if DEBUG
00553         DXF_DEBUG_BEGIN
00554 #endif
00555         /* Do some basic checks. */
00556         if (point == NULL)
00557         {
00558                 fprintf (stderr,
00559                   (_("Error in %s () a NULL pointer was passed.\n")),
00560                   __FUNCTION__);
00561                 return (EXIT_FAILURE);
00562         }
00563         if (point->next != NULL)
00564         {
00565                 fprintf (stderr,
00566                   (_("Error in %s () pointer to next was not NULL.\n")),
00567                   __FUNCTION__);
00568                 return (EXIT_FAILURE);
00569         }
00570         free (point->linetype);
00571         free (point->layer);
00572         free (point->dictionary_owner_soft);
00573         free (point->dictionary_owner_hard);
00574         free (point);
00575         point = NULL;
00576 #if DEBUG
00577         DXF_DEBUG_END
00578 #endif
00579         return (EXIT_SUCCESS);
00580 }
00581 
00582 
00587 void
00588 dxf_point_free_chain
00589 (
00590         DxfPoint *points
00592 )
00593 {
00594 #ifdef DEBUG
00595         DXF_DEBUG_BEGIN
00596 #endif
00597         if (points == NULL)
00598         {
00599                 fprintf (stderr,
00600                   (_("Warning in %s () a NULL pointer was passed.\n")),
00601                   __FUNCTION__);
00602         }
00603         while (points != NULL)
00604         {
00605                 struct DxfPoint *iter = points->next;
00606                 dxf_point_free (points);
00607                 points = (DxfPoint *) iter;
00608         }
00609 #if DEBUG
00610         DXF_DEBUG_END
00611 #endif
00612 }
00613 
00614 
00620 int
00621 dxf_point_get_id_code
00622 (
00623         DxfPoint *point
00625 )
00626 {
00627 #if DEBUG
00628         DXF_DEBUG_BEGIN
00629 #endif
00630         int result;
00631 
00632         /* Do some basic checks. */
00633         if (point == NULL)
00634         {
00635                 fprintf (stderr,
00636                   (_("Error in %s () a NULL pointer was passed.\n")),
00637                   __FUNCTION__);
00638                 return (EXIT_FAILURE);
00639         }
00640         if (point->id_code < 0)
00641         {
00642                 fprintf (stderr,
00643                   (_("Error in %s () a negative value was found in the id-code member.\n")),
00644                   __FUNCTION__);
00645                 return (EXIT_FAILURE);
00646         }
00647         result = point->id_code;
00648 #if DEBUG
00649         DXF_DEBUG_END
00650 #endif
00651         return (result);
00652 }
00653 
00654 
00661 DxfPoint *
00662 dxf_point_set_id_code
00663 (
00664         DxfPoint *point,
00666         int id_code
00670 )
00671 {
00672 #if DEBUG
00673         DXF_DEBUG_BEGIN
00674 #endif
00675         /* Do some basic checks. */
00676         if (point == NULL)
00677         {
00678                 fprintf (stderr,
00679                   (_("Error in %s () a NULL pointer was passed.\n")),
00680                   __FUNCTION__);
00681                 return (NULL);
00682         }
00683         if (id_code < 0)
00684         {
00685                 fprintf (stderr,
00686                   (_("Error in %s () a negative id-code value was passed.\n")),
00687                   __FUNCTION__);
00688                 return (NULL);
00689         }
00690         point->id_code = id_code;
00691 #if DEBUG
00692         DXF_DEBUG_END
00693 #endif
00694         return (point);
00695 }
00696 
00697 
00703 char *
00704 dxf_point_get_linetype
00705 (
00706         DxfPoint *point
00708 )
00709 {
00710 #if DEBUG
00711         DXF_DEBUG_BEGIN
00712 #endif
00713         char *result = NULL;
00714 
00715         /* Do some basic checks. */
00716         if (point == NULL)
00717         {
00718                 fprintf (stderr,
00719                   (_("Error in %s () a NULL pointer was passed.\n")),
00720                   __FUNCTION__);
00721                 return (NULL);
00722         }
00723         if (point->linetype ==  NULL)
00724         {
00725                 fprintf (stderr,
00726                   (_("Error in %s () a NULL pointer was found in the linetype member.\n")),
00727                   __FUNCTION__);
00728                 return (NULL);
00729         }
00730         result = strdup (point->linetype);
00731 #if DEBUG
00732         DXF_DEBUG_END
00733 #endif
00734         return (result);
00735 }
00736 
00737 
00744 DxfPoint *
00745 dxf_point_set_linetype
00746 (
00747         DxfPoint *point,
00749         char *linetype
00751 )
00752 {
00753 #if DEBUG
00754         DXF_DEBUG_BEGIN
00755 #endif
00756         /* Do some basic checks. */
00757         if (point == NULL)
00758         {
00759                 fprintf (stderr,
00760                   (_("Error in %s () a NULL pointer was passed.\n")),
00761                   __FUNCTION__);
00762                 return (NULL);
00763         }
00764         if (linetype == NULL)
00765         {
00766                 fprintf (stderr,
00767                   (_("Error in %s () a NULL pointer was passed.\n")),
00768                   __FUNCTION__);
00769                 return (NULL);
00770         }
00771         point->linetype = strdup (linetype);
00772 #if DEBUG
00773         DXF_DEBUG_END
00774 #endif
00775         return (point);
00776 }
00777 
00778 
00784 char *
00785 dxf_point_get_layer
00786 (
00787         DxfPoint *point
00789 )
00790 {
00791 #if DEBUG
00792         DXF_DEBUG_BEGIN
00793 #endif
00794         char *result = NULL;
00795 
00796         /* Do some basic checks. */
00797         if (point == NULL)
00798         {
00799                 fprintf (stderr,
00800                   (_("Error in %s () a NULL pointer was passed.\n")),
00801                   __FUNCTION__);
00802                 return (NULL);
00803         }
00804         if (point->layer ==  NULL)
00805         {
00806                 fprintf (stderr,
00807                   (_("Error in %s () a NULL pointer was found in the layer member.\n")),
00808                   __FUNCTION__);
00809                 return (NULL);
00810         }
00811         result = strdup (point->layer);
00812 #if DEBUG
00813         DXF_DEBUG_END
00814 #endif
00815         return (result);
00816 }
00817 
00818 
00825 DxfPoint *
00826 dxf_point_set_layer
00827 (
00828         DxfPoint *point,
00830         char *layer
00832 )
00833 {
00834 #if DEBUG
00835         DXF_DEBUG_BEGIN
00836 #endif
00837         /* Do some basic checks. */
00838         if (point == NULL)
00839         {
00840                 fprintf (stderr,
00841                   (_("Error in %s () a NULL pointer was passed.\n")),
00842                   __FUNCTION__);
00843                 return (NULL);
00844         }
00845         if (layer == NULL)
00846         {
00847                 fprintf (stderr,
00848                   (_("Error in %s () a NULL pointer was passed.\n")),
00849                   __FUNCTION__);
00850                 return (NULL);
00851         }
00852         point->layer = strdup (layer);
00853 #if DEBUG
00854         DXF_DEBUG_END
00855 #endif
00856         return (point);
00857 }
00858 
00859 
00865 double
00866 dxf_point_get_elevation
00867 (
00868         DxfPoint *point
00870 )
00871 {
00872 #if DEBUG
00873         DXF_DEBUG_BEGIN
00874 #endif
00875         double result;
00876 
00877         /* Do some basic checks. */
00878         if (point == NULL)
00879         {
00880                 fprintf (stderr,
00881                   (_("Error in %s () a NULL pointer was passed.\n")),
00882                   __FUNCTION__);
00883                 return (EXIT_FAILURE);
00884         }
00885         result = point->elevation;
00886 #if DEBUG
00887         DXF_DEBUG_END
00888 #endif
00889         return (result);
00890 }
00891 
00892 
00899 DxfPoint *
00900 dxf_point_set_elevation
00901 (
00902         DxfPoint *point,
00904         double elevation
00906 )
00907 {
00908 #if DEBUG
00909         DXF_DEBUG_BEGIN
00910 #endif
00911         /* Do some basic checks. */
00912         if (point == NULL)
00913         {
00914                 fprintf (stderr,
00915                   (_("Error in %s () a NULL pointer was passed.\n")),
00916                   __FUNCTION__);
00917                 return (NULL);
00918         }
00919         point->elevation = elevation;
00920 #if DEBUG
00921         DXF_DEBUG_END
00922 #endif
00923         return (point);
00924 }
00925 
00926 
00932 double
00933 dxf_point_get_thickness
00934 (
00935         DxfPoint *point
00937 )
00938 {
00939 #if DEBUG
00940         DXF_DEBUG_BEGIN
00941 #endif
00942         double result;
00943 
00944         /* Do some basic checks. */
00945         if (point == NULL)
00946         {
00947                 fprintf (stderr,
00948                   (_("Error in %s () a NULL pointer was passed.\n")),
00949                   __FUNCTION__);
00950                 return (EXIT_FAILURE);
00951         }
00952         if (point->thickness < 0.0)
00953         {
00954                 fprintf (stderr,
00955                   (_("Error in %s () a negative value was found in the thickness member.\n")),
00956                   __FUNCTION__);
00957                 return (EXIT_FAILURE);
00958         }
00959         result = point->thickness;
00960 #if DEBUG
00961         DXF_DEBUG_END
00962 #endif
00963         return (result);
00964 }
00965 
00966 
00973 DxfPoint *
00974 dxf_point_set_thickness
00975 (
00976         DxfPoint *point,
00978         double thickness
00980 )
00981 {
00982 #if DEBUG
00983         DXF_DEBUG_BEGIN
00984 #endif
00985         /* Do some basic checks. */
00986         if (point == NULL)
00987         {
00988                 fprintf (stderr,
00989                   (_("Error in %s () a NULL pointer was passed.\n")),
00990                   __FUNCTION__);
00991                 return (NULL);
00992         }
00993         if (thickness < 0.0)
00994         {
00995                 fprintf (stderr,
00996                   (_("Error in %s () a negative thickness value was passed.\n")),
00997                   __FUNCTION__);
00998                 return (NULL);
00999         }
01000         point->thickness = thickness;
01001 #if DEBUG
01002         DXF_DEBUG_END
01003 #endif
01004         return (point);
01005 }
01006 
01007 
01013 double
01014 dxf_point_get_linetype_scale
01015 (
01016         DxfPoint *point
01018 )
01019 {
01020 #if DEBUG
01021         DXF_DEBUG_BEGIN
01022 #endif
01023         double result;
01024 
01025         /* Do some basic checks. */
01026         if (point == NULL)
01027         {
01028                 fprintf (stderr,
01029                   (_("Error in %s () a NULL pointer was passed.\n")),
01030                   __FUNCTION__);
01031                 return (EXIT_FAILURE);
01032         }
01033         if (point->linetype_scale < 0.0)
01034         {
01035                 fprintf (stderr,
01036                   (_("Error in %s () a negative value was found in the linetype scale member.\n")),
01037                   __FUNCTION__);
01038                 return (EXIT_FAILURE);
01039         }
01040         result = point->linetype_scale;
01041 #if DEBUG
01042         DXF_DEBUG_END
01043 #endif
01044         return (result);
01045 }
01046 
01047 
01054 DxfPoint *
01055 dxf_point_set_linetype_scale
01056 (
01057         DxfPoint *point,
01059         double linetype_scale
01061 )
01062 {
01063 #if DEBUG
01064         DXF_DEBUG_BEGIN
01065 #endif
01066         /* Do some basic checks. */
01067         if (point == NULL)
01068         {
01069                 fprintf (stderr,
01070                   (_("Error in %s () a NULL pointer was passed.\n")),
01071                   __FUNCTION__);
01072                 return (NULL);
01073         }
01074         if (linetype_scale < 0.0)
01075         {
01076                 fprintf (stderr,
01077                   (_("Error in %s () a negative linetype scale value was passed.\n")),
01078                   __FUNCTION__);
01079                 return (NULL);
01080         }
01081         point->linetype_scale = linetype_scale;
01082 #if DEBUG
01083         DXF_DEBUG_END
01084 #endif
01085         return (point);
01086 }
01087 
01088 
01094 int16_t
01095 dxf_point_get_visibility
01096 (
01097         DxfPoint *point
01099 )
01100 {
01101 #if DEBUG
01102         DXF_DEBUG_BEGIN
01103 #endif
01104         int16_t result;
01105 
01106         /* Do some basic checks. */
01107         if (point == NULL)
01108         {
01109                 fprintf (stderr,
01110                   (_("Error in %s () a NULL pointer was passed.\n")),
01111                   __FUNCTION__);
01112                 return (EXIT_FAILURE);
01113         }
01114         if (point->visibility < 0)
01115         {
01116                 fprintf (stderr,
01117                   (_("Error in %s () a negative value was found in the visibility member.\n")),
01118                   __FUNCTION__);
01119                 return (EXIT_FAILURE);
01120         }
01121         if (point->visibility > 1)
01122         {
01123                 fprintf (stderr,
01124                   (_("Error in %s () an out of range value was found in the visibility member.\n")),
01125                   __FUNCTION__);
01126                 return (EXIT_FAILURE);
01127         }
01128         result = point->visibility;
01129 #if DEBUG
01130         DXF_DEBUG_END
01131 #endif
01132         return (result);
01133 }
01134 
01135 
01142 DxfPoint *
01143 dxf_point_set_visibility
01144 (
01145         DxfPoint *point,
01147         int16_t visibility
01149 )
01150 {
01151 #if DEBUG
01152         DXF_DEBUG_BEGIN
01153 #endif
01154         /* Do some basic checks. */
01155         if (point == NULL)
01156         {
01157                 fprintf (stderr,
01158                   (_("Error in %s () a NULL pointer was passed.\n")),
01159                   __FUNCTION__);
01160                 return (NULL);
01161         }
01162         if (visibility < 0)
01163         {
01164                 fprintf (stderr,
01165                   (_("Error in %s () a negative visibility value was passed.\n")),
01166                   __FUNCTION__);
01167                 return (NULL);
01168         }
01169         if (visibility > 1)
01170         {
01171                 fprintf (stderr,
01172                   (_("Error in %s () an out of range visibility value was passed.\n")),
01173                   __FUNCTION__);
01174                 return (NULL);
01175         }
01176         point->visibility = visibility;
01177 #if DEBUG
01178         DXF_DEBUG_END
01179 #endif
01180         return (point);
01181 }
01182 
01183 
01189 int
01190 dxf_point_get_color
01191 (
01192         DxfPoint *point
01194 )
01195 {
01196 #if DEBUG
01197         DXF_DEBUG_BEGIN
01198 #endif
01199         int result;
01200 
01201         /* Do some basic checks. */
01202         if (point == NULL)
01203         {
01204                 fprintf (stderr,
01205                   (_("Error in %s () a NULL pointer was passed.\n")),
01206                   __FUNCTION__);
01207                 return (EXIT_FAILURE);
01208         }
01209         if (point->color < 0)
01210         {
01211                 fprintf (stderr,
01212                   (_("Warning in %s () a negative value was found in the color member.\n")),
01213                   __FUNCTION__);
01214         }
01215         result = point->color;
01216 #if DEBUG
01217         DXF_DEBUG_END
01218 #endif
01219         return (result);
01220 }
01221 
01222 
01229 DxfPoint *
01230 dxf_point_set_color
01231 (
01232         DxfPoint *point,
01234         int color
01236 )
01237 {
01238 #if DEBUG
01239         DXF_DEBUG_BEGIN
01240 #endif
01241         /* Do some basic checks. */
01242         if (point == NULL)
01243         {
01244                 fprintf (stderr,
01245                   (_("Error in %s () a NULL pointer was passed.\n")),
01246                   __FUNCTION__);
01247                 return (NULL);
01248         }
01249         if (color < 0)
01250         {
01251                 fprintf (stderr,
01252                   (_("Warning in %s () a negative color value was passed.\n")),
01253                   __FUNCTION__);
01254                 fprintf (stderr,
01255                   (_("\teffectively turning this entity it's visibility off.\n")));
01256         }
01257         point->color = color;
01258 #if DEBUG
01259         DXF_DEBUG_END
01260 #endif
01261         return (point);
01262 }
01263 
01264 
01270 int
01271 dxf_point_get_paperspace
01272 (
01273         DxfPoint *point
01275 )
01276 {
01277 #if DEBUG
01278         DXF_DEBUG_BEGIN
01279 #endif
01280         int result;
01281 
01282         /* Do some basic checks. */
01283         if (point == NULL)
01284         {
01285                 fprintf (stderr,
01286                   (_("Error in %s () a NULL pointer was passed.\n")),
01287                   __FUNCTION__);
01288                 return (EXIT_FAILURE);
01289         }
01290         if (point->paperspace < 0)
01291         {
01292                 fprintf (stderr,
01293                   (_("Warning in %s () a negative value was found in the paperspace member.\n")),
01294                   __FUNCTION__);
01295         }
01296         if (point->paperspace > 1)
01297         {
01298                 fprintf (stderr,
01299                   (_("Warning in %s () an out of range value was found in the paperspace member.\n")),
01300                   __FUNCTION__);
01301         }
01302         result = point->paperspace;
01303 #if DEBUG
01304         DXF_DEBUG_END
01305 #endif
01306         return (result);
01307 }
01308 
01309 
01316 DxfPoint *
01317 dxf_point_set_paperspace
01318 (
01319         DxfPoint *point,
01321         int paperspace
01323 )
01324 {
01325 #if DEBUG
01326         DXF_DEBUG_BEGIN
01327 #endif
01328         /* Do some basic checks. */
01329         if (point == NULL)
01330         {
01331                 fprintf (stderr,
01332                   (_("Error in %s () a NULL pointer was passed.\n")),
01333                   __FUNCTION__);
01334                 return (NULL);
01335         }
01336         if (paperspace < 0)
01337         {
01338                 fprintf (stderr,
01339                   (_("Error in %s () a negative paperspace value was passed.\n")),
01340                   __FUNCTION__);
01341                 return (NULL);
01342         }
01343         if (paperspace > 1)
01344         {
01345                 fprintf (stderr,
01346                   (_("Error in %s () an out of range paperspace value was passed.\n")),
01347                   __FUNCTION__);
01348                 return (NULL);
01349         }
01350         point->paperspace = paperspace;
01351 #if DEBUG
01352         DXF_DEBUG_END
01353 #endif
01354         return (point);
01355 }
01356 
01357 
01364 int
01365 dxf_point_get_graphics_data_size
01366 (
01367         DxfPoint *point
01369 )
01370 {
01371 #if DEBUG
01372         DXF_DEBUG_BEGIN
01373 #endif
01374         int result;
01375 
01376         /* Do some basic checks. */
01377         if (point == NULL)
01378         {
01379                 fprintf (stderr,
01380                   (_("Error in %s () a NULL pointer was passed.\n")),
01381                   __FUNCTION__);
01382                 return (EXIT_FAILURE);
01383         }
01384         if (point->graphics_data_size < 0)
01385         {
01386                 fprintf (stderr,
01387                   (_("Warning in %s () a negative value was found in the graphics_data_size member.\n")),
01388                   __FUNCTION__);
01389         }
01390         if (point->graphics_data_size == 0)
01391         {
01392                 fprintf (stderr,
01393                   (_("Warning in %s () a zero value was found in the graphics_data_size member.\n")),
01394                   __FUNCTION__);
01395         }
01396         result = point->graphics_data_size;
01397 #if DEBUG
01398         DXF_DEBUG_END
01399 #endif
01400         return (result);
01401 }
01402 
01403 
01410 DxfPoint *
01411 dxf_point_set_graphics_data_size
01412 (
01413         DxfPoint *point,
01415         int graphics_data_size
01418 )
01419 {
01420 #if DEBUG
01421         DXF_DEBUG_BEGIN
01422 #endif
01423         /* Do some basic checks. */
01424         if (point == NULL)
01425         {
01426                 fprintf (stderr,
01427                   (_("Error in %s () a NULL pointer was passed.\n")),
01428                   __FUNCTION__);
01429                 return (NULL);
01430         }
01431         if (graphics_data_size < 0)
01432         {
01433                 fprintf (stderr,
01434                   (_("Error in %s () a negative graphics_data_size value was passed.\n")),
01435                   __FUNCTION__);
01436                 return (NULL);
01437         }
01438         if (graphics_data_size == 0)
01439         {
01440                 fprintf (stderr,
01441                   (_("Error in %s () a zero graphics_data_size value was passed.\n")),
01442                   __FUNCTION__);
01443                 return (NULL);
01444         }
01445         point->graphics_data_size = graphics_data_size;
01446 #if DEBUG
01447         DXF_DEBUG_END
01448 #endif
01449         return (point);
01450 }
01451 
01452 
01459 int16_t
01460 dxf_point_get_shadow_mode
01461 (
01462         DxfPoint *point
01464 )
01465 {
01466 #if DEBUG
01467         DXF_DEBUG_BEGIN
01468 #endif
01469         int16_t result;
01470 
01471         /* Do some basic checks. */
01472         if (point == NULL)
01473         {
01474                 fprintf (stderr,
01475                   (_("Error in %s () a NULL pointer was passed.\n")),
01476                   __FUNCTION__);
01477                 return (EXIT_FAILURE);
01478         }
01479         if (point->shadow_mode < 0)
01480         {
01481                 fprintf (stderr,
01482                   (_("Error in %s () a negative value was found in the shadow_mode member.\n")),
01483                   __FUNCTION__);
01484                 return (EXIT_FAILURE);
01485         }
01486         if (point->shadow_mode > 3)
01487         {
01488                 fprintf (stderr,
01489                   (_("Error in %s () an out of range value was found in the shadow_mode member.\n")),
01490                   __FUNCTION__);
01491                 return (EXIT_FAILURE);
01492         }
01493         result = point->shadow_mode;
01494 #if DEBUG
01495         DXF_DEBUG_END
01496 #endif
01497         return (result);
01498 }
01499 
01500 
01507 DxfPoint *
01508 dxf_point_set_shadow_mode
01509 (
01510         DxfPoint *point,
01512         int16_t shadow_mode
01514 )
01515 {
01516 #if DEBUG
01517         DXF_DEBUG_BEGIN
01518 #endif
01519         /* Do some basic checks. */
01520         if (point == NULL)
01521         {
01522                 fprintf (stderr,
01523                   (_("Error in %s () a NULL pointer was passed.\n")),
01524                   __FUNCTION__);
01525                 return (NULL);
01526         }
01527         if (shadow_mode < 0)
01528         {
01529                 fprintf (stderr,
01530                   (_("Error in %s () a negative shadow_mode value was passed.\n")),
01531                   __FUNCTION__);
01532                 return (NULL);
01533         }
01534         if (shadow_mode > 3)
01535         {
01536                 fprintf (stderr,
01537                   (_("Error in %s () an out of range shadow_mode value was passed.\n")),
01538                   __FUNCTION__);
01539                 return (NULL);
01540         }
01541         point->shadow_mode = shadow_mode;
01542 #if DEBUG
01543         DXF_DEBUG_END
01544 #endif
01545         return (point);
01546 }
01547 
01548 
01558 DxfBinaryGraphicsData *
01559 dxf_point_get_binary_graphics_data
01560 (
01561         DxfPoint *point
01563 )
01564 {
01565 #if DEBUG
01566         DXF_DEBUG_BEGIN
01567 #endif
01568         DxfBinaryGraphicsData *result;
01569 
01570         /* Do some basic checks. */
01571         if (point == NULL)
01572         {
01573                 fprintf (stderr,
01574                   (_("Error in %s () a NULL pointer was passed.\n")),
01575                   __FUNCTION__);
01576                 return (NULL);
01577         }
01578         if (point->binary_graphics_data ==  NULL)
01579         {
01580                 fprintf (stderr,
01581                   (_("Error in %s () a NULL pointer was found in the binary_graphics_data member.\n")),
01582                   __FUNCTION__);
01583                 return (NULL);
01584         }
01585         result = (DxfBinaryGraphicsData *) point->binary_graphics_data;
01586 #if DEBUG
01587         DXF_DEBUG_END
01588 #endif
01589         return (result);
01590 }
01591 
01592 
01600 DxfPoint *
01601 dxf_point_set_binary_graphics_data
01602 (
01603         DxfPoint *point,
01605         DxfBinaryGraphicsData *data
01608 )
01609 {
01610 #if DEBUG
01611         DXF_DEBUG_BEGIN
01612 #endif
01613         /* Do some basic checks. */
01614         if (point == NULL)
01615         {
01616                 fprintf (stderr,
01617                   (_("Error in %s () a NULL pointer was passed.\n")),
01618                   __FUNCTION__);
01619                 return (NULL);
01620         }
01621         if (data == NULL)
01622         {
01623                 fprintf (stderr,
01624                   (_("Error in %s () a NULL pointer was passed.\n")),
01625                   __FUNCTION__);
01626                 return (NULL);
01627         }
01628         point->binary_graphics_data = (DxfBinaryGraphicsData *) data;
01629 #if DEBUG
01630         DXF_DEBUG_END
01631 #endif
01632         return (point);
01633 }
01634 
01635 
01644 char *
01645 dxf_point_get_dictionary_owner_soft
01646 (
01647         DxfPoint *point
01649 )
01650 {
01651 #if DEBUG
01652         DXF_DEBUG_BEGIN
01653 #endif
01654         char *result;
01655 
01656         /* Do some basic checks. */
01657         if (point == NULL)
01658         {
01659                 fprintf (stderr,
01660                   (_("Error in %s () a NULL pointer was passed.\n")),
01661                   __FUNCTION__);
01662                 return (NULL);
01663         }
01664         if (point->dictionary_owner_soft ==  NULL)
01665         {
01666                 fprintf (stderr,
01667                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_soft member.\n")),
01668                   __FUNCTION__);
01669                 return (NULL);
01670         }
01671         result = strdup (point->dictionary_owner_soft);
01672 #if DEBUG
01673         DXF_DEBUG_END
01674 #endif
01675         return (result);
01676 }
01677 
01678 
01686 DxfPoint *
01687 dxf_point_set_dictionary_owner_soft
01688 (
01689         DxfPoint *point,
01691         char *dictionary_owner_soft
01694 )
01695 {
01696 #if DEBUG
01697         DXF_DEBUG_BEGIN
01698 #endif
01699         /* Do some basic checks. */
01700         if (point == NULL)
01701         {
01702                 fprintf (stderr,
01703                   (_("Error in %s () a NULL pointer was passed.\n")),
01704                   __FUNCTION__);
01705                 return (NULL);
01706         }
01707         if (dictionary_owner_soft == NULL)
01708         {
01709                 fprintf (stderr,
01710                   (_("Error in %s () a NULL pointer was passed.\n")),
01711                   __FUNCTION__);
01712                 return (NULL);
01713         }
01714         point->dictionary_owner_soft = strdup (dictionary_owner_soft);
01715 #if DEBUG
01716         DXF_DEBUG_END
01717 #endif
01718         return (point);
01719 }
01720 
01721 
01730 char *
01731 dxf_point_get_material
01732 (
01733         DxfPoint *point
01735 )
01736 {
01737 #if DEBUG
01738         DXF_DEBUG_BEGIN
01739 #endif
01740         char *result;
01741 
01742         /* Do some basic checks. */
01743         if (point == NULL)
01744         {
01745                 fprintf (stderr,
01746                   (_("Error in %s () a NULL pointer was passed.\n")),
01747                   __FUNCTION__);
01748                 return (NULL);
01749         }
01750         if (point->material ==  NULL)
01751         {
01752                 fprintf (stderr,
01753                   (_("Error in %s () a NULL pointer was found in the material member.\n")),
01754                   __FUNCTION__);
01755                 return (NULL);
01756         }
01757         result = strdup (point->material);
01758 #if DEBUG
01759         DXF_DEBUG_END
01760 #endif
01761         return (result);
01762 }
01763 
01764 
01771 DxfPoint *
01772 dxf_point_set_material
01773 (
01774         DxfPoint *point,
01776         char *material
01779 )
01780 {
01781 #if DEBUG
01782         DXF_DEBUG_BEGIN
01783 #endif
01784         /* Do some basic checks. */
01785         if (point == NULL)
01786         {
01787                 fprintf (stderr,
01788                   (_("Error in %s () a NULL pointer was passed.\n")),
01789                   __FUNCTION__);
01790                 return (NULL);
01791         }
01792         if (material == NULL)
01793         {
01794                 fprintf (stderr,
01795                   (_("Error in %s () a NULL pointer was passed.\n")),
01796                   __FUNCTION__);
01797                 return (NULL);
01798         }
01799         point->material = strdup (material);
01800 #if DEBUG
01801         DXF_DEBUG_END
01802 #endif
01803         return (point);
01804 }
01805 
01806 
01815 char *
01816 dxf_point_get_dictionary_owner_hard
01817 (
01818         DxfPoint *point
01820 )
01821 {
01822 #if DEBUG
01823         DXF_DEBUG_BEGIN
01824 #endif
01825         char *result;
01826 
01827         /* Do some basic checks. */
01828         if (point == NULL)
01829         {
01830                 fprintf (stderr,
01831                   (_("Error in %s () a NULL pointer was passed.\n")),
01832                   __FUNCTION__);
01833                 return (NULL);
01834         }
01835         if (point->dictionary_owner_hard ==  NULL)
01836         {
01837                 fprintf (stderr,
01838                   (_("Error in %s () a NULL pointer was found in the dictionary_owner_hard member.\n")),
01839                   __FUNCTION__);
01840                 return (NULL);
01841         }
01842         result = strdup (point->dictionary_owner_hard);
01843 #if DEBUG
01844         DXF_DEBUG_END
01845 #endif
01846         return (result);
01847 }
01848 
01849 
01857 DxfPoint *
01858 dxf_point_set_dictionary_owner_hard
01859 (
01860         DxfPoint *point,
01862         char *dictionary_owner_hard
01865 )
01866 {
01867 #if DEBUG
01868         DXF_DEBUG_BEGIN
01869 #endif
01870         /* Do some basic checks. */
01871         if (point == NULL)
01872         {
01873                 fprintf (stderr,
01874                   (_("Error in %s () a NULL pointer was passed.\n")),
01875                   __FUNCTION__);
01876                 return (NULL);
01877         }
01878         if (dictionary_owner_hard == NULL)
01879         {
01880                 fprintf (stderr,
01881                   (_("Error in %s () a NULL pointer was passed.\n")),
01882                   __FUNCTION__);
01883                 return (NULL);
01884         }
01885         point->dictionary_owner_hard = strdup (dictionary_owner_hard);
01886 #if DEBUG
01887         DXF_DEBUG_END
01888 #endif
01889         return (point);
01890 }
01891 
01892 
01899 int16_t
01900 dxf_point_get_lineweight
01901 (
01902         DxfPoint *point
01904 )
01905 {
01906 #if DEBUG
01907         DXF_DEBUG_BEGIN
01908 #endif
01909         int16_t result;
01910 
01911         /* Do some basic checks. */
01912         if (point == NULL)
01913         {
01914                 fprintf (stderr,
01915                   (_("Error in %s () a NULL pointer was passed.\n")),
01916                   __FUNCTION__);
01917                 return (EXIT_FAILURE);
01918         }
01919         result = point->lineweight;
01920 #if DEBUG
01921         DXF_DEBUG_END
01922 #endif
01923         return (result);
01924 }
01925 
01926 
01933 DxfPoint *
01934 dxf_point_set_lineweight
01935 (
01936         DxfPoint *point,
01938         int16_t lineweight
01940 )
01941 {
01942 #if DEBUG
01943         DXF_DEBUG_BEGIN
01944 #endif
01945         /* Do some basic checks. */
01946         if (point == NULL)
01947         {
01948                 fprintf (stderr,
01949                   (_("Error in %s () a NULL pointer was passed.\n")),
01950                   __FUNCTION__);
01951                 return (NULL);
01952         }
01953         point->lineweight = lineweight;
01954 #if DEBUG
01955         DXF_DEBUG_END
01956 #endif
01957         return (point);
01958 }
01959 
01960 
01967 char *
01968 dxf_point_get_plot_style_name
01969 (
01970         DxfPoint *point
01972 )
01973 {
01974 #if DEBUG
01975         DXF_DEBUG_BEGIN
01976 #endif
01977         char *result = NULL;
01978 
01979         /* Do some basic checks. */
01980         if (point == NULL)
01981         {
01982                 fprintf (stderr,
01983                   (_("Error in %s () a NULL pointer was passed.\n")),
01984                   __FUNCTION__);
01985                 return (NULL);
01986         }
01987         if (point->plot_style_name ==  NULL)
01988         {
01989                 fprintf (stderr,
01990                   (_("Error in %s () a NULL pointer was found in the plot_style_name member.\n")),
01991                   __FUNCTION__);
01992                 return (NULL);
01993         }
01994         result = strdup (point->plot_style_name);
01995 #if DEBUG
01996         DXF_DEBUG_END
01997 #endif
01998         return (result);
01999 }
02000 
02001 
02008 DxfPoint *
02009 dxf_point_set_plot_style_name
02010 (
02011         DxfPoint *point,
02013         char *plot_style_name
02016 )
02017 {
02018 #if DEBUG
02019         DXF_DEBUG_BEGIN
02020 #endif
02021         /* Do some basic checks. */
02022         if (point == NULL)
02023         {
02024                 fprintf (stderr,
02025                   (_("Error in %s () a NULL pointer was passed.\n")),
02026                   __FUNCTION__);
02027                 return (NULL);
02028         }
02029         if (plot_style_name == NULL)
02030         {
02031                 fprintf (stderr,
02032                   (_("Error in %s () a NULL pointer was passed.\n")),
02033                   __FUNCTION__);
02034                 return (NULL);
02035         }
02036         point->plot_style_name = strdup (plot_style_name);
02037 #if DEBUG
02038         DXF_DEBUG_END
02039 #endif
02040         return (point);
02041 }
02042 
02043 
02050 long
02051 dxf_point_get_color_value
02052 (
02053         DxfPoint *point
02055 )
02056 {
02057 #if DEBUG
02058         DXF_DEBUG_BEGIN
02059 #endif
02060         long result;
02061 
02062         /* Do some basic checks. */
02063         if (point == NULL)
02064         {
02065                 fprintf (stderr,
02066                   (_("Error in %s () a NULL pointer was passed.\n")),
02067                   __FUNCTION__);
02068                 return (EXIT_FAILURE);
02069         }
02070         result = point->color_value;
02071 #if DEBUG
02072         DXF_DEBUG_END
02073 #endif
02074         return (result);
02075 }
02076 
02077 
02084 DxfPoint *
02085 dxf_point_set_color_value
02086 (
02087         DxfPoint *point,
02089         long color_value
02091 )
02092 {
02093 #if DEBUG
02094         DXF_DEBUG_BEGIN
02095 #endif
02096         /* Do some basic checks. */
02097         if (point == NULL)
02098         {
02099                 fprintf (stderr,
02100                   (_("Error in %s () a NULL pointer was passed.\n")),
02101                   __FUNCTION__);
02102                 return (NULL);
02103         }
02104         point->color_value = color_value;
02105 #if DEBUG
02106         DXF_DEBUG_END
02107 #endif
02108         return (point);
02109 }
02110 
02111 
02118 char *
02119 dxf_point_get_color_name
02120 (
02121         DxfPoint *point
02123 )
02124 {
02125 #if DEBUG
02126         DXF_DEBUG_BEGIN
02127 #endif
02128         char *result = NULL;
02129 
02130         /* Do some basic checks. */
02131         if (point == NULL)
02132         {
02133                 fprintf (stderr,
02134                   (_("Error in %s () a NULL pointer was passed.\n")),
02135                   __FUNCTION__);
02136                 return (NULL);
02137         }
02138         if (point->color_name ==  NULL)
02139         {
02140                 fprintf (stderr,
02141                   (_("Error in %s () a NULL pointer was found in the color_name member.\n")),
02142                   __FUNCTION__);
02143                 return (NULL);
02144         }
02145         result = strdup (point->color_name);
02146 #if DEBUG
02147         DXF_DEBUG_END
02148 #endif
02149         return (result);
02150 }
02151 
02152 
02159 DxfPoint *
02160 dxf_point_set_color_name
02161 (
02162         DxfPoint *point,
02164         char *color_name
02167 )
02168 {
02169 #if DEBUG
02170         DXF_DEBUG_BEGIN
02171 #endif
02172         /* Do some basic checks. */
02173         if (point == NULL)
02174         {
02175                 fprintf (stderr,
02176                   (_("Error in %s () a NULL pointer was passed.\n")),
02177                   __FUNCTION__);
02178                 return (NULL);
02179         }
02180         if (color_name == NULL)
02181         {
02182                 fprintf (stderr,
02183                   (_("Error in %s () a NULL pointer was passed.\n")),
02184                   __FUNCTION__);
02185                 return (NULL);
02186         }
02187         point->color_name = strdup (color_name);
02188 #if DEBUG
02189         DXF_DEBUG_END
02190 #endif
02191         return (point);
02192 }
02193 
02194 
02201 long
02202 dxf_point_get_transparency
02203 (
02204         DxfPoint *point
02206 )
02207 {
02208 #if DEBUG
02209         DXF_DEBUG_BEGIN
02210 #endif
02211         long result;
02212 
02213         /* Do some basic checks. */
02214         if (point == NULL)
02215         {
02216                 fprintf (stderr,
02217                   (_("Error in %s () a NULL pointer was passed.\n")),
02218                   __FUNCTION__);
02219                 return (EXIT_FAILURE);
02220         }
02221         result = point->transparency;
02222 #if DEBUG
02223         DXF_DEBUG_END
02224 #endif
02225         return (result);
02226 }
02227 
02228 
02235 DxfPoint *
02236 dxf_point_set_transparency
02237 (
02238         DxfPoint *point,
02240         long transparency
02242 )
02243 {
02244 #if DEBUG
02245         DXF_DEBUG_BEGIN
02246 #endif
02247         /* Do some basic checks. */
02248         if (point == NULL)
02249         {
02250                 fprintf (stderr,
02251                   (_("Error in %s () a NULL pointer was passed.\n")),
02252                   __FUNCTION__);
02253                 return (NULL);
02254         }
02255         point->transparency = transparency;
02256 #if DEBUG
02257         DXF_DEBUG_END
02258 #endif
02259         return (point);
02260 }
02261 
02262 
02268 double
02269 dxf_point_get_x0
02270 (
02271         DxfPoint *point
02273 )
02274 {
02275 #if DEBUG
02276         DXF_DEBUG_BEGIN
02277 #endif
02278         double result;
02279 
02280         /* Do some basic checks. */
02281         if (point == NULL)
02282         {
02283                 fprintf (stderr,
02284                   (_("Error in %s () a NULL pointer was passed.\n")),
02285                   __FUNCTION__);
02286                 return (EXIT_FAILURE);
02287         }
02288         result = point->x0;
02289 #if DEBUG
02290         DXF_DEBUG_END
02291 #endif
02292         return (result);
02293 }
02294 
02295 
02302 DxfPoint *
02303 dxf_point_set_x0
02304 (
02305         DxfPoint *point,
02307         double x0
02310 )
02311 {
02312 #if DEBUG
02313         DXF_DEBUG_BEGIN
02314 #endif
02315         /* Do some basic checks. */
02316         if (point == NULL)
02317         {
02318                 fprintf (stderr,
02319                   (_("Error in %s () a NULL pointer was passed.\n")),
02320                   __FUNCTION__);
02321                 return (NULL);
02322         }
02323         point->x0 = x0;
02324 #if DEBUG
02325         DXF_DEBUG_END
02326 #endif
02327         return (point);
02328 }
02329 
02330 
02336 double
02337 dxf_point_get_y0
02338 (
02339         DxfPoint *point
02341 )
02342 {
02343 #if DEBUG
02344         DXF_DEBUG_BEGIN
02345 #endif
02346         double result;
02347 
02348         /* Do some basic checks. */
02349         if (point == NULL)
02350         {
02351                 fprintf (stderr,
02352                   (_("Error in %s () a NULL pointer was passed.\n")),
02353                   __FUNCTION__);
02354                 return (EXIT_FAILURE);
02355         }
02356         result = point->y0;
02357 #if DEBUG
02358         DXF_DEBUG_END
02359 #endif
02360         return (result);
02361 }
02362 
02363 
02370 DxfPoint *
02371 dxf_point_set_y0
02372 (
02373         DxfPoint *point,
02375         double y0
02378 )
02379 {
02380 #if DEBUG
02381         DXF_DEBUG_BEGIN
02382 #endif
02383         /* Do some basic checks. */
02384         if (point == NULL)
02385         {
02386                 fprintf (stderr,
02387                   (_("Error in %s () a NULL pointer was passed.\n")),
02388                   __FUNCTION__);
02389                 return (NULL);
02390         }
02391         point->y0 = y0;
02392 #if DEBUG
02393         DXF_DEBUG_END
02394 #endif
02395         return (point);
02396 }
02397 
02398 
02404 double
02405 dxf_point_get_z0
02406 (
02407         DxfPoint *point
02409 )
02410 {
02411 #if DEBUG
02412         DXF_DEBUG_BEGIN
02413 #endif
02414         double result;
02415 
02416         /* Do some basic checks. */
02417         if (point == NULL)
02418         {
02419                 fprintf (stderr,
02420                   (_("Error in %s () a NULL pointer was passed.\n")),
02421                   __FUNCTION__);
02422                 return (EXIT_FAILURE);
02423         }
02424         result = point->z0;
02425 #if DEBUG
02426         DXF_DEBUG_END
02427 #endif
02428         return (result);
02429 }
02430 
02431 
02438 DxfPoint *
02439 dxf_point_set_z0
02440 (
02441         DxfPoint *point,
02443         double z0
02446 )
02447 {
02448 #if DEBUG
02449         DXF_DEBUG_BEGIN
02450 #endif
02451         /* Do some basic checks. */
02452         if (point == NULL)
02453         {
02454                 fprintf (stderr,
02455                   (_("Error in %s () a NULL pointer was passed.\n")),
02456                   __FUNCTION__);
02457                 return (NULL);
02458         }
02459         point->z0 = z0;
02460 #if DEBUG
02461         DXF_DEBUG_END
02462 #endif
02463         return (point);
02464 }
02465 
02466 
02472 double
02473 dxf_point_get_angle_to_X
02474 (
02475         DxfPoint *point
02477 )
02478 {
02479 #if DEBUG
02480         DXF_DEBUG_BEGIN
02481 #endif
02482         double result;
02483 
02484         /* Do some basic checks. */
02485         if (point == NULL)
02486         {
02487                 fprintf (stderr,
02488                   (_("Error in %s () a NULL pointer was passed.\n")),
02489                   __FUNCTION__);
02490                 return (EXIT_FAILURE);
02491         }
02492         result = point->angle_to_X;
02493 #if DEBUG
02494         DXF_DEBUG_END
02495 #endif
02496         return (result);
02497 }
02498 
02499 
02506 DxfPoint *
02507 dxf_point_set_angle_to_X
02508 (
02509         DxfPoint *point,
02511         double angle_to_X
02513 )
02514 {
02515 #if DEBUG
02516         DXF_DEBUG_BEGIN
02517 #endif
02518         /* Do some basic checks. */
02519         if (point == NULL)
02520         {
02521                 fprintf (stderr,
02522                   (_("Error in %s () a NULL pointer was passed.\n")),
02523                   __FUNCTION__);
02524                 return (NULL);
02525         }
02526         point->angle_to_X = angle_to_X;
02527 #if DEBUG
02528         DXF_DEBUG_END
02529 #endif
02530         return (point);
02531 }
02532 
02533 
02542 DxfPoint *
02543 dxf_point_get_extrusion_vector_as_point
02544 (
02545         DxfPoint *point
02547 )
02548 {
02549 #ifdef DEBUG
02550         DXF_DEBUG_BEGIN
02551 #endif
02552         DxfPoint *result = NULL;
02553 
02554         /* Do some basic checks. */
02555         if (point == NULL)
02556         {
02557                 fprintf (stderr,
02558                   (_("Error in %s () a NULL pointer was passed.\n")),
02559                   __FUNCTION__);
02560                 return (NULL);
02561         }
02562         result = dxf_point_init (result);
02563         if (result == NULL)
02564         {
02565               fprintf (stderr,
02566                   (_("Error in %s () could not allocate memory for a DxfPoint struct.\n")),
02567                 __FUNCTION__);
02568               return (NULL);
02569         }
02570         result->x0 = point->extr_x0;
02571         result->y0 = point->extr_y0;
02572         result->z0 = point->extr_z0;
02573 #if DEBUG
02574         DXF_DEBUG_END
02575 #endif
02576         return (result);
02577 }
02578 
02579 
02586 DxfPoint *
02587 dxf_point_set_extrusion_vector
02588 (
02589         DxfPoint *point,
02591         double extr_x0,
02593         double extr_y0,
02595         double extr_z0
02597 )
02598 {
02599 #if DEBUG
02600         DXF_DEBUG_BEGIN
02601 #endif
02602         /* Do some basic checks. */
02603         if (point == NULL)
02604         {
02605                 fprintf (stderr,
02606                   (_("Error in %s () a NULL pointer was passed.\n")),
02607                   __FUNCTION__);
02608                 return (NULL);
02609         }
02610         point->extr_x0 = extr_x0;
02611         point->extr_y0 = extr_y0;
02612         point->extr_z0 = extr_z0;
02613 #if DEBUG
02614         DXF_DEBUG_END
02615 #endif
02616         return (point);
02617 }
02618 
02619 
02628 DxfPoint *
02629 dxf_point_get_next
02630 (
02631         DxfPoint *point
02633 )
02634 {
02635 #if DEBUG
02636         DXF_DEBUG_BEGIN
02637 #endif
02638         DxfPoint *result;
02639 
02640         /* Do some basic checks. */
02641         if (point == NULL)
02642         {
02643                 fprintf (stderr,
02644                   (_("Error in %s () a NULL pointer was passed.\n")),
02645                   __FUNCTION__);
02646                 return (NULL);
02647         }
02648         if (point->next == NULL)
02649         {
02650                 fprintf (stderr,
02651                   (_("Error in %s () a NULL pointer was found in the next member.\n")),
02652                   __FUNCTION__);
02653                 return (NULL);
02654         }
02655         result = (DxfPoint *) point->next;
02656 #if DEBUG
02657         DXF_DEBUG_END
02658 #endif
02659         return (result);
02660 }
02661 
02662 
02670 DxfPoint *
02671 dxf_point_set_next
02672 (
02673         DxfPoint *point,
02675         DxfPoint *next
02677 )
02678 {
02679 #if DEBUG
02680         DXF_DEBUG_BEGIN
02681 #endif
02682         /* Do some basic checks. */
02683         if (point == NULL)
02684         {
02685                 fprintf (stderr,
02686                   (_("Error in %s () a NULL pointer was passed.\n")),
02687                   __FUNCTION__);
02688                 return (NULL);
02689         }
02690         if (next == NULL)
02691         {
02692                 fprintf (stderr,
02693                   (_("Error in %s () a NULL pointer was passed.\n")),
02694                   __FUNCTION__);
02695                 return (NULL);
02696         }
02697         point->next = (struct DxfPoint *) next;
02698 #if DEBUG
02699         DXF_DEBUG_END
02700 #endif
02701         return (point);
02702 }
02703 
02704 
02713 DxfPoint *
02714 dxf_point_get_last
02715 (
02716         DxfPoint *point
02718 )
02719 {
02720 #if DEBUG
02721         DXF_DEBUG_BEGIN
02722 #endif
02723         /* Do some basic checks. */
02724         if (point == NULL)
02725         {
02726                 fprintf (stderr,
02727                   (_("Error in %s () a NULL pointer was passed.\n")),
02728                   __FUNCTION__);
02729                 return (NULL);
02730         }
02731         if (point->next == NULL)
02732         {
02733                 fprintf (stderr,
02734                   (_("Warning in %s () a NULL pointer was found.\n")),
02735                   __FUNCTION__);
02736                 return ((DxfPoint *) point);
02737         }
02738         DxfPoint *iter = (DxfPoint *) point->next;
02739         while (iter->next != NULL)
02740         {
02741                 iter = (DxfPoint *) iter->next;
02742         }
02743 #if DEBUG
02744         DXF_DEBUG_END
02745 #endif
02746         return ((DxfPoint *) iter);
02747 }
02748 
02749 
02750 /* EOF */