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

spatial_filter.c

Go to the documentation of this file.
00001 
00043 #include "spatial_filter.h"
00044 
00045 
00051 DxfSpatialFilter *
00052 dxf_spatial_filter_new ()
00053 {
00054 #if DEBUG
00055         DXF_DEBUG_BEGIN
00056 #endif
00057         DxfSpatialFilter *spatial_filter = NULL;
00058         size_t size;
00059 
00060         size = sizeof (DxfSpatialFilter);
00061         /* avoid malloc of 0 bytes */
00062         if (size == 0) size = 1;
00063         if ((spatial_filter = malloc (size)) == NULL)
00064         {
00065                 fprintf (stderr,
00066                   (_("Error in %s () could not allocate memory for a DxfSpatialFilter struct.\n")),
00067                   __FUNCTION__);
00068                 spatial_filter = NULL;
00069         }
00070         else
00071         {
00072                 memset (spatial_filter, 0, size);
00073         }
00074 #if DEBUG
00075         DXF_DEBUG_END
00076 #endif
00077         return (spatial_filter);
00078 }
00079 
00080 
00088 DxfSpatialFilter *
00089 dxf_spatial_filter_init
00090 (
00091         DxfSpatialFilter *spatial_filter
00093 )
00094 {
00095 #if DEBUG
00096         DXF_DEBUG_BEGIN
00097 #endif
00098         int i;
00099 
00100         /* Do some basic checks. */
00101         if (spatial_filter == NULL)
00102         {
00103                 fprintf (stderr,
00104                   (_("Warning in %s () a NULL pointer was passed.\n")),
00105                   __FUNCTION__);
00106                 spatial_filter = dxf_spatial_filter_new ();
00107         }
00108         if (spatial_filter == NULL)
00109         {
00110                 fprintf (stderr,
00111                   (_("Error in %s () could not allocate memory for a DxfSpatialFilter struct.\n")),
00112                   __FUNCTION__);
00113                 return (NULL);
00114         }
00115         spatial_filter->id_code = 0;
00116         spatial_filter->dictionary_owner_soft = strdup ("");
00117         spatial_filter->dictionary_owner_hard = strdup ("");
00118         spatial_filter->p0 = dxf_point_new ();
00119         spatial_filter->p0 = dxf_point_init (spatial_filter->p0);
00120         spatial_filter->p0->x0 = 0.0;
00121         spatial_filter->p0->y0 = 0.0;
00122         spatial_filter->p1 = dxf_point_new ();
00123         spatial_filter->p1 = dxf_point_init (spatial_filter->p1);
00124         spatial_filter->p1->x0 = 0.0;
00125         spatial_filter->p1->y0 = 0.0;
00126         spatial_filter->p1->z0 = 0.0;
00127         for (i = 0; i < 12; i++)
00128         {
00129                 spatial_filter->inverse_block_transformation[i] = 0.0;
00130                 spatial_filter->block_transformation[i] = 0.0;
00131         }
00132         spatial_filter->front_clipping_plane_distance = 0.0;
00133         spatial_filter->back_clipping_plane_distance = 0.0;
00134         spatial_filter->number_of_points = 0;
00135         spatial_filter->clip_boundary_display_flag = 0;
00136         spatial_filter->front_clipping_plane_flag = 0;
00137         spatial_filter->back_clipping_plane_flag = 0;
00138         spatial_filter->extr_x0 = 0.0;
00139         spatial_filter->extr_y0 = 0.0;
00140         spatial_filter->extr_z0 = 0.0;
00141         spatial_filter->next = NULL;
00142 #if DEBUG
00143         DXF_DEBUG_END
00144 #endif
00145         return (spatial_filter);
00146 }
00147 
00148 
00160 DxfSpatialFilter *
00161 dxf_spatial_filter_read
00162 (
00163         DxfFile *fp,
00165         DxfSpatialFilter *spatial_filter
00167 )
00168 {
00169 #if DEBUG
00170         DXF_DEBUG_BEGIN
00171 #endif
00172         char *temp_string = NULL;
00173         int i;
00174         int j;
00175         int k;
00176         DxfPoint *iter_p0 = NULL;
00177 
00178         /* Do some basic checks. */
00179         if (fp == NULL)
00180         {
00181                 fprintf (stderr,
00182                   (_("Error in %s () a NULL file pointer was passed.\n")),
00183                   __FUNCTION__);
00184                 /* Clean up. */
00185                 free (temp_string);
00186                 return (NULL);
00187         }
00188         if (fp->acad_version_number < AutoCAD_14)
00189         {
00190                 fprintf (stderr,
00191                   (_("Warning in %s () illegal DXF version for this entity.\n")),
00192                   __FUNCTION__);
00193         }
00194         if (spatial_filter == NULL)
00195         {
00196                 fprintf (stderr,
00197                   (_("Warning in %s () a NULL pointer was passed.\n")),
00198                   __FUNCTION__);
00199                 spatial_filter = dxf_spatial_filter_new ();
00200                 spatial_filter = dxf_spatial_filter_init (spatial_filter);
00201         }
00202         i = 0;
00203         j = 0;
00204         k = 0;
00205         iter_p0 = (DxfPoint *) spatial_filter->p0;
00206         (fp->line_number)++;
00207         fscanf (fp->fp, "%[^\n]", temp_string);
00208         while (strcmp (temp_string, "0") != 0)
00209         {
00210                 if (ferror (fp->fp))
00211                 {
00212                         fprintf (stderr,
00213                           (_("Error in %s () while reading from: %s in line: %d.\n")),
00214                           __FUNCTION__, fp->filename, fp->line_number);
00215                         /* Clean up. */
00216                         free (temp_string);
00217                         fclose (fp->fp);
00218                         return (NULL);
00219                 }
00220                 if (strcmp (temp_string, "5") == 0)
00221                 {
00222                         /* Now follows a string containing a sequential
00223                          * id number. */
00224                         (fp->line_number)++;
00225                         fscanf (fp->fp, "%x\n", &spatial_filter->id_code);
00226                 }
00227                 else if (strcmp (temp_string, "10") == 0)
00228                 {
00229                         /* Now follows a string containing the
00230                          * X-value of the clip boundary definition point. */
00231                         (fp->line_number)++;
00232                         fscanf (fp->fp, "%lf\n", &iter_p0->x0);
00233                 }
00234                 else if (strcmp (temp_string, "20") == 0)
00235                 {
00236                         /* Now follows a string containing the
00237                          * Y-value of the clip boundary definition point. */
00238                         (fp->line_number)++;
00239                         fscanf (fp->fp, "%lf\n", &iter_p0->y0);
00240                         iter_p0->next = (struct DxfPoint *) dxf_point_init ((DxfPoint *) iter_p0->next);
00241                         iter_p0 = (DxfPoint *) iter_p0->next;
00242                 }
00243                 else if (strcmp (temp_string, "11") == 0)
00244                 {
00245                         /* Now follows a string containing the X-value
00246                          * of the origin used to define the local
00247                          * coordinate system of the clip boundary. */
00248                         (fp->line_number)++;
00249                         fscanf (fp->fp, "%lf\n", &spatial_filter->p1->x0);
00250                 }
00251                 else if (strcmp (temp_string, "21") == 0)
00252                 {
00253                         /* Now follows a string containing the Y-value
00254                          * of the origin used to define the local
00255                          * coordinate system of the clip boundary. */
00256                         (fp->line_number)++;
00257                         fscanf (fp->fp, "%lf\n", &spatial_filter->p1->y0);
00258                 }
00259                 else if (strcmp (temp_string, "31") == 0)
00260                 {
00261                         /* Now follows a string containing the Z-value
00262                          * of the origin used to define the local
00263                          * coordinate system of the clip boundary. */
00264                         (fp->line_number)++;
00265                         fscanf (fp->fp, "%lf\n", &spatial_filter->p1->z0);
00266                 }
00267                 else if ((strcmp (temp_string, "40") == 0)
00268                   && (k == 0)
00269                   && (spatial_filter->front_clipping_plane_flag == 1))
00270                 {
00271                         /* Now follows a string containing the front
00272                          * clipping plane distance. */
00273                         (fp->line_number)++;
00274                         fscanf (fp->fp, "%lf\n", &spatial_filter->front_clipping_plane_distance);
00275                         k++;
00276                 }
00277                 else if ((strcmp (temp_string, "40") == 0)
00278                   && (k > 0)
00279                   && (k < 13)) /* k = 1 ... 12. */
00280                 {
00281                         /* Now follows a string containing an element of
00282                          * the 4x3 inverse transformation matrix. */
00283                         (fp->line_number)++;
00284                         fscanf (fp->fp, "%lf\n", &spatial_filter->inverse_block_transformation[(k - 1)]);
00285                         k++;
00286                 }
00287                 else if ((strcmp (temp_string, "40") == 0)
00288                   && (k >= 13)) /* k = 13 ...25. */
00289                 {
00290                         /* Now follows a string containing an element of
00291                          * the 4x3 transformation matrix. */
00292                         (fp->line_number)++;
00293                         fscanf (fp->fp, "%lf\n", &spatial_filter->block_transformation[(k - 13)]);
00294                         k++;
00295                 }
00296                 else if ((strcmp (temp_string, "41") == 0)
00297                   && (spatial_filter->back_clipping_plane_flag == 1))
00298                 {
00299                         /* Now follows a string containing the back
00300                          * clipping plane distance. */
00301                         (fp->line_number)++;
00302                         fscanf (fp->fp, "%lf\n", &spatial_filter->back_clipping_plane_distance);
00303                         i++;
00304                 }
00305                 else if (strcmp (temp_string, "70") == 0)
00306                 {
00307                         /* Now follows a string containing the
00308                          * number of points. */
00309                         (fp->line_number)++;
00310                         fscanf (fp->fp, "%d\n", &spatial_filter->number_of_points);
00311                 }
00312                 else if (strcmp (temp_string, "71") == 0)
00313                 {
00314                         /* Now follows a string containing the clip
00315                          * boundary display enabled flag. */
00316                         (fp->line_number)++;
00317                         fscanf (fp->fp, "%d\n", &spatial_filter->clip_boundary_display_flag);
00318                 }
00319                 else if (strcmp (temp_string, "72") == 0)
00320                 {
00321                         /* Now follows a string containing the front
00322                          * clipping plane flag. */
00323                         (fp->line_number)++;
00324                         fscanf (fp->fp, "%d\n", &spatial_filter->front_clipping_plane_flag);
00325                 }
00326                 else if (strcmp (temp_string, "73") == 0)
00327                 {
00328                         /* Now follows a string containing the back
00329                          * clipping plane flag. */
00330                         (fp->line_number)++;
00331                         fscanf (fp->fp, "%d\n", &spatial_filter->back_clipping_plane_flag);
00332                 }
00333                 else if ((fp->acad_version_number >= AutoCAD_13)
00334                         && (strcmp (temp_string, "100") == 0))
00335                 {
00336                         /* Now follows a string containing the
00337                          * subclass marker value. */
00338                         (fp->line_number)++;
00339                         fscanf (fp->fp, "%s\n", temp_string);
00340                         if ((strcmp (temp_string, "AcDbFilter") != 0)
00341                           && (strcmp (temp_string, "AcDbSpatialFilter") != 0))
00342                         {
00343                                 fprintf (stderr,
00344                                   (_("Warning in %s () found a bad subclass marker in: %s in line: %d.\n")),
00345                                   __FUNCTION__, fp->filename, fp->line_number);
00346                         }
00347                 }
00348                 else if (strcmp (temp_string, "210") == 0)
00349                 {
00350                         /* Now follows a string containing the X-value
00351                          * of the normal to the plane containing the
00352                          * clip boundary. */
00353                         (fp->line_number)++;
00354                         fscanf (fp->fp, "%lf\n", &spatial_filter->extr_x0);
00355                 }
00356                 else if (strcmp (temp_string, "220") == 0)
00357                 {
00358                         /* Now follows a string containing the Y-value
00359                          * of the normal to the plane containing the
00360                          * clip boundary. */
00361                         (fp->line_number)++;
00362                         fscanf (fp->fp, "%lf\n", &spatial_filter->extr_y0);
00363                 }
00364                 else if (strcmp (temp_string, "230") == 0)
00365                 {
00366                         /* Now follows a string containing the
00367                          * Z-value of the extrusion vector. */
00368                         (fp->line_number)++;
00369                         fscanf (fp->fp, "%lf\n", &spatial_filter->extr_z0);
00370                 }
00371                 else if (strcmp (temp_string, "330") == 0)
00372                 {
00373                         /* Now follows a string containing the Z-value
00374                          * of the normal to the plane containing the
00375                          * clip boundary. */
00376                         (fp->line_number)++;
00377                         fscanf (fp->fp, "%s\n", spatial_filter->dictionary_owner_soft);
00378                         i++;
00379                 }
00380                 else if (strcmp (temp_string, "360") == 0)
00381                 {
00382                         /* Now follows a string containing Hard owner
00383                          * ID/handle to owner dictionary. */
00384                         (fp->line_number)++;
00385                         fscanf (fp->fp, "%s\n", spatial_filter->dictionary_owner_hard);
00386                 }
00387                 else if (strcmp (temp_string, "999") == 0)
00388                 {
00389                         /* Now follows a string containing a comment. */
00390                         (fp->line_number)++;
00391                         fscanf (fp->fp, "%s\n", temp_string);
00392                         fprintf (stdout, (_("DXF comment: %s\n")), temp_string);
00393                 }
00394                 else
00395                 {
00396                         fprintf (stderr,
00397                           (_("Warning in %s () unknown string tag found while reading from: %s in line: %d.\n")),
00398                           __FUNCTION__, fp->filename, fp->line_number);
00399                 }
00400         }
00401         /* Clean up. */
00402         free (temp_string);
00403 #if DEBUG
00404         DXF_DEBUG_END
00405 #endif
00406         return (spatial_filter);
00407 }
00408 
00409 
00416 int
00417 dxf_spatial_filter_write
00418 (
00419         DxfFile *fp,
00421         DxfSpatialFilter *spatial_filter
00423 )
00424 {
00425 #if DEBUG
00426         DXF_DEBUG_BEGIN
00427 #endif
00428         char *dxf_entity_name = strdup ("SPATIAL_FILTER");
00429         int i;
00430         DxfPoint *iter_p0 = NULL;
00431 
00432         /* Do some basic checks. */
00433         if (fp == NULL)
00434         {
00435                 fprintf (stderr,
00436                   (_("Error in %s () a NULL file pointer was passed.\n")),
00437                   __FUNCTION__);
00438                 /* Clean up. */
00439                 free (dxf_entity_name);
00440                 return (EXIT_FAILURE);
00441         }
00442         if (spatial_filter == NULL)
00443         {
00444                 fprintf (stderr,
00445                   (_("Error in %s () a NULL pointer was passed.\n")),
00446                   __FUNCTION__);
00447                 /* Clean up. */
00448                 free (dxf_entity_name);
00449                 return (EXIT_FAILURE);
00450         }
00451         if (spatial_filter->number_of_points < 2)
00452         {
00453                 fprintf (stderr,
00454                   (_("Error in %s () number of the clip boundary definition points is too small.\n")),
00455                   __FUNCTION__);
00456                 fprintf (stderr,
00457                   (_("\tThe %s object with id-code %x is dropped from output.\n")),
00458                   dxf_entity_name, spatial_filter->id_code);
00459                 /* Clean up. */
00460                 free (dxf_entity_name);
00461                 return (EXIT_FAILURE);
00462         }
00463         if (fp->acad_version_number < AutoCAD_14)
00464         {
00465                 fprintf (stderr,
00466                   (_("Warning in %s () illegal DXF version for this %s entity with id-code: %x.\n")),
00467                   __FUNCTION__, dxf_entity_name, spatial_filter->id_code);
00468         }
00469         /* Start writing output. */
00470         fprintf (fp->fp, "  0\n%s\n", dxf_entity_name);
00471         if (spatial_filter->id_code != -1)
00472         {
00473                 fprintf (fp->fp, "  5\n%x\n", spatial_filter->id_code);
00474         }
00485         if ((strcmp (spatial_filter->dictionary_owner_soft, "") != 0)
00486           && (fp->acad_version_number >= AutoCAD_14))
00487         {
00488                 fprintf (fp->fp, "102\n{ACAD_REACTORS\n");
00489                 fprintf (fp->fp, "330\n%s\n", spatial_filter->dictionary_owner_soft);
00490                 fprintf (fp->fp, "102\n}\n");
00491         }
00492         if ((strcmp (spatial_filter->dictionary_owner_hard, "") != 0)
00493           && (fp->acad_version_number >= AutoCAD_14))
00494         {
00495                 fprintf (fp->fp, "102\n{ACAD_XDICTIONARY\n");
00496                 fprintf (fp->fp, "360\n%s\n", spatial_filter->dictionary_owner_hard);
00497                 fprintf (fp->fp, "102\n}\n");
00498         }
00499         if (fp->acad_version_number >= AutoCAD_13)
00500         {
00501                 fprintf (fp->fp, "100\nAcDbFilter\n");
00502                 fprintf (fp->fp, "100\nAcDbSpatialFilter\n");
00503         }
00504         fprintf (fp->fp, " 70\n%d\n", spatial_filter->number_of_points);
00505         if (spatial_filter->p0 != NULL)
00506         {
00507                 iter_p0 = (DxfPoint*) spatial_filter->p0;
00508                 while (iter_p0 != NULL)
00509                 {
00510                         fprintf (fp->fp, " 10\n%f\n", iter_p0->x0);
00511                         fprintf (fp->fp, " 20\n%f\n", iter_p0->y0);
00512                         iter_p0 = (DxfPoint*) iter_p0->next;
00513                 }
00514         }
00515         if ((fp->acad_version_number >= AutoCAD_12)
00516                 && (spatial_filter->extr_x0 != 0.0)
00517                 && (spatial_filter->extr_y0 != 0.0)
00518                 && (spatial_filter->extr_z0 != 1.0))
00519         {
00520                 fprintf (fp->fp, "210\n%f\n", spatial_filter->extr_x0);
00521                 fprintf (fp->fp, "220\n%f\n", spatial_filter->extr_y0);
00522                 fprintf (fp->fp, "230\n%f\n", spatial_filter->extr_z0);
00523         }
00524         fprintf (fp->fp, " 11\n%f\n", spatial_filter->p1->x0);
00525         fprintf (fp->fp, " 21\n%f\n", spatial_filter->p1->y0);
00526         fprintf (fp->fp, " 31\n%f\n", spatial_filter->p1->z0);
00527         fprintf (fp->fp, " 71\n%d\n", spatial_filter->clip_boundary_display_flag);
00528         fprintf (fp->fp, " 72\n%d\n", spatial_filter->front_clipping_plane_flag);
00529         if (spatial_filter->front_clipping_plane_flag)
00530         {
00531                 fprintf (fp->fp, " 40\n%f\n", spatial_filter->front_clipping_plane_distance);
00532         }
00533         fprintf (fp->fp, " 73\n%d\n", spatial_filter->back_clipping_plane_flag);
00534         if (spatial_filter->back_clipping_plane_flag)
00535         {
00536                 fprintf (fp->fp, " 41\n%f\n", spatial_filter->back_clipping_plane_distance);
00537         }
00538         for (i = 0; i < 12; i++)
00539         {
00540                 fprintf (fp->fp, " 40\n%f\n", spatial_filter->inverse_block_transformation[i]);
00541         }
00542         for (i = 0; i < 12; i++)
00543         {
00544                 fprintf (fp->fp, " 40\n%f\n", spatial_filter->block_transformation[i]);
00545         }
00546         /* Clean up. */
00547         free (dxf_entity_name);
00548 #if DEBUG
00549         DXF_DEBUG_END
00550 #endif
00551         return (EXIT_SUCCESS);
00552 }
00553 
00554 
00562 int
00563 dxf_spatial_filter_free
00564 (
00565         DxfSpatialFilter *spatial_filter
00568 )
00569 {
00570 #if DEBUG
00571         DXF_DEBUG_BEGIN
00572 #endif
00573         /* Do some basic checks. */
00574         if (spatial_filter == NULL)
00575         {
00576                 fprintf (stderr,
00577                   (_("Error in %s () a NULL pointer was passed.\n")),
00578                   __FUNCTION__);
00579                 return (EXIT_FAILURE);
00580         }
00581         if (spatial_filter->next != NULL)
00582         {
00583                 fprintf (stderr,
00584                   (_("Error in %s () pointer to next was not NULL.\n")),
00585                   __FUNCTION__);
00586                 return (EXIT_FAILURE);
00587         }
00588         free (spatial_filter->dictionary_owner_soft);
00589         free (spatial_filter->dictionary_owner_hard);
00590         free (spatial_filter);
00591         spatial_filter = NULL;
00592 #if DEBUG
00593         DXF_DEBUG_END
00594 #endif
00595         return (EXIT_SUCCESS);
00596 }
00597 
00598 
00603 void
00604 dxf_spatial_filter_free_chain
00605 (
00606         DxfSpatialFilter *spatial_filters
00608 )
00609 {
00610 #ifdef DEBUG
00611         DXF_DEBUG_BEGIN
00612 #endif
00613         if (spatial_filters == NULL)
00614         {
00615                 fprintf (stderr,
00616                   (_("Warning in %s () a NULL pointer was passed.\n")),
00617                   __FUNCTION__);
00618         }
00619         while (spatial_filters != NULL)
00620         {
00621                 struct DxfSpatialFilter *iter = spatial_filters->next;
00622                 dxf_spatial_filter_free (spatial_filters);
00623                 spatial_filters = (DxfSpatialFilter *) iter;
00624         }
00625 #if DEBUG
00626         DXF_DEBUG_END
00627 #endif
00628 }
00629 
00630 
00636 int
00637 dxf_spatial_filter_get_id_code
00638 (
00639         DxfSpatialFilter *spatial_filter
00641 )
00642 {
00643 #if DEBUG
00644         DXF_DEBUG_BEGIN
00645 #endif
00646         /* Do some basic checks. */
00647         if (spatial_filter == NULL)
00648         {
00649                 fprintf (stderr,
00650                   (_("Error in %s () a NULL pointer was passed.\n")),
00651                   __FUNCTION__);
00652                 return (EXIT_FAILURE);
00653         }
00654         if (spatial_filter->id_code < 0)
00655         {
00656                 fprintf (stderr,
00657                   (_("Warning in %s () a negative value was found.\n")),
00658                   __FUNCTION__);
00659         }
00660 #if DEBUG
00661         DXF_DEBUG_END
00662 #endif
00663         return (spatial_filter->id_code);
00664 }
00665 
00666 
00670 DxfSpatialFilter *
00671 dxf_spatial_filter_set_id_code
00672 (
00673         DxfSpatialFilter *spatial_filter,
00675         int id_code
00679 )
00680 {
00681 #if DEBUG
00682         DXF_DEBUG_BEGIN
00683 #endif
00684         /* Do some basic checks. */
00685         if (spatial_filter == NULL)
00686         {
00687                 fprintf (stderr,
00688                   (_("Error in %s () a NULL pointer was passed.\n")),
00689                   __FUNCTION__);
00690                 return (NULL);
00691         }
00692         if (id_code < 0)
00693         {
00694                 fprintf (stderr,
00695                   (_("Warning in %s () a negative value was passed.\n")),
00696                   __FUNCTION__);
00697         }
00698         spatial_filter->id_code = id_code;
00699 #if DEBUG
00700         DXF_DEBUG_END
00701 #endif
00702         return (spatial_filter);
00703 }
00704 
00705 
00714 char *
00715 dxf_spatial_filter_get_dictionary_owner_soft
00716 (
00717         DxfSpatialFilter *spatial_filter
00719 )
00720 {
00721 #if DEBUG
00722         DXF_DEBUG_BEGIN
00723 #endif
00724         /* Do some basic checks. */
00725         if (spatial_filter == NULL)
00726         {
00727                 fprintf (stderr,
00728                   (_("Error in %s () a NULL pointer was passed.\n")),
00729                   __FUNCTION__);
00730                 return (NULL);
00731         }
00732         if (spatial_filter->dictionary_owner_soft ==  NULL)
00733         {
00734                 fprintf (stderr,
00735                   (_("Error in %s () a NULL pointer was found.\n")),
00736                   __FUNCTION__);
00737                 return (NULL);
00738         }
00739 #if DEBUG
00740         DXF_DEBUG_END
00741 #endif
00742         return (strdup (spatial_filter->dictionary_owner_soft));
00743 }
00744 
00745 
00750 DxfSpatialFilter *
00751 dxf_spatial_filter_set_dictionary_owner_soft
00752 (
00753         DxfSpatialFilter *spatial_filter,
00755         char *dictionary_owner_soft
00758 )
00759 {
00760 #if DEBUG
00761         DXF_DEBUG_BEGIN
00762 #endif
00763         /* Do some basic checks. */
00764         if (spatial_filter == NULL)
00765         {
00766                 fprintf (stderr,
00767                   (_("Error in %s () a NULL pointer was passed.\n")),
00768                   __FUNCTION__);
00769                 return (NULL);
00770         }
00771         if (dictionary_owner_soft == NULL)
00772         {
00773                 fprintf (stderr,
00774                   (_("Error in %s () a NULL pointer was passed.\n")),
00775                   __FUNCTION__);
00776                 return (NULL);
00777         }
00778         spatial_filter->dictionary_owner_soft = strdup (dictionary_owner_soft);
00779 #if DEBUG
00780         DXF_DEBUG_END
00781 #endif
00782         return (spatial_filter);
00783 }
00784 
00785 
00794 char *
00795 dxf_spatial_filter_get_dictionary_owner_hard
00796 (
00797         DxfSpatialFilter *spatial_filter
00799 )
00800 {
00801 #if DEBUG
00802         DXF_DEBUG_BEGIN
00803 #endif
00804         /* Do some basic checks. */
00805         if (spatial_filter == NULL)
00806         {
00807                 fprintf (stderr,
00808                   (_("Error in %s () a NULL pointer was passed.\n")),
00809                   __FUNCTION__);
00810                 return (NULL);
00811         }
00812         if (spatial_filter->dictionary_owner_hard ==  NULL)
00813         {
00814                 fprintf (stderr,
00815                   (_("Error in %s () a NULL pointer was found.\n")),
00816                   __FUNCTION__);
00817                 return (NULL);
00818         }
00819 #if DEBUG
00820         DXF_DEBUG_END
00821 #endif
00822         return (strdup (spatial_filter->dictionary_owner_hard));
00823 }
00824 
00825 
00830 DxfSpatialFilter *
00831 dxf_spatial_filter_set_dictionary_owner_hard
00832 (
00833         DxfSpatialFilter *spatial_filter,
00835         char *dictionary_owner_hard
00838 )
00839 {
00840 #if DEBUG
00841         DXF_DEBUG_BEGIN
00842 #endif
00843         /* Do some basic checks. */
00844         if (spatial_filter == NULL)
00845         {
00846                 fprintf (stderr,
00847                   (_("Error in %s () a NULL pointer was passed.\n")),
00848                   __FUNCTION__);
00849                 return (NULL);
00850         }
00851         if (dictionary_owner_hard == NULL)
00852         {
00853                 fprintf (stderr,
00854                   (_("Error in %s () a NULL pointer was passed.\n")),
00855                   __FUNCTION__);
00856                 return (NULL);
00857         }
00858         spatial_filter->dictionary_owner_hard = strdup (dictionary_owner_hard);
00859 #if DEBUG
00860         DXF_DEBUG_END
00861 #endif
00862         return (spatial_filter);
00863 }
00864 
00865 
00872 DxfPoint *
00873 dxf_spatial_filter_get_p0
00874 (
00875         DxfSpatialFilter *spatial_filter
00877 )
00878 {
00879 #ifdef DEBUG
00880         DXF_DEBUG_BEGIN
00881 #endif
00882         /* Do some basic checks. */
00883         if (spatial_filter == NULL)
00884         {
00885                 fprintf (stderr,
00886                   (_("Error in %s () a NULL pointer was passed.\n")),
00887                   __FUNCTION__);
00888                 return (NULL);
00889         }
00890         if (spatial_filter->p0 == NULL)
00891         {
00892                 fprintf (stderr,
00893                   (_("Error in %s () a NULL pointer was found.\n")),
00894                   __FUNCTION__);
00895                 return (NULL);
00896         }
00897 #if DEBUG
00898         DXF_DEBUG_END
00899 #endif
00900         return (spatial_filter->p0);
00901 }
00902 
00903 
00910 DxfSpatialFilter *
00911 dxf_spatial_filter_set_p0
00912 (
00913         DxfSpatialFilter *spatial_filter,
00915         DxfPoint *p0
00917 )
00918 {
00919 #ifdef DEBUG
00920         DXF_DEBUG_BEGIN
00921 #endif
00922         /* Do some basic checks. */
00923         if (spatial_filter == NULL)
00924         {
00925                 fprintf (stderr,
00926                   (_("Error in %s () a NULL pointer was passed.\n")),
00927                   __FUNCTION__);
00928                 return (NULL);
00929         }
00930         if (p0 == NULL)
00931         {
00932                 fprintf (stderr,
00933                   (_("Error in %s () a NULL pointer was passed.\n")),
00934                   __FUNCTION__);
00935                 return (NULL);
00936         }
00937         spatial_filter->p0 = p0;
00938 #if DEBUG
00939         DXF_DEBUG_END
00940 #endif
00941         return (spatial_filter);
00942 }
00943 
00944 
00951 double
00952 dxf_spatial_filter_get_x0
00953 (
00954         DxfSpatialFilter *spatial_filter
00956 )
00957 {
00958 #ifdef DEBUG
00959         DXF_DEBUG_BEGIN
00960 #endif
00961 
00962         /* Do some basic checks. */
00963         if (spatial_filter == NULL)
00964         {
00965                 fprintf (stderr,
00966                   (_("Error in %s () a NULL pointer was passed.\n")),
00967                   __FUNCTION__);
00968                 return (EXIT_FAILURE);
00969         }
00970         if (spatial_filter->p0 == NULL)
00971         {
00972                 fprintf (stderr,
00973                   (_("Error in %s () a NULL pointer was found.\n")),
00974                   __FUNCTION__);
00975                 return (EXIT_FAILURE);
00976         }
00977 #if DEBUG
00978         DXF_DEBUG_END
00979 #endif
00980         return (spatial_filter->p0->x0);
00981 }
00982 
00983 
00991 DxfSpatialFilter *
00992 dxf_spatial_filter_set_x0
00993 (
00994         DxfSpatialFilter *spatial_filter,
00996         double x0
00999 )
01000 {
01001 #ifdef DEBUG
01002         DXF_DEBUG_BEGIN
01003 #endif
01004         /* Do some basic checks. */
01005         if (spatial_filter == NULL)
01006         {
01007                 fprintf (stderr,
01008                   (_("Error in %s () a NULL pointer was passed.\n")),
01009                   __FUNCTION__);
01010                 return (NULL);
01011         }
01012         if (spatial_filter->p0 == NULL)
01013         {
01014                 fprintf (stderr,
01015                   (_("Error in %s () a NULL pointer was found.\n")),
01016                   __FUNCTION__);
01017                 return (NULL);
01018         }
01019         spatial_filter->p0->x0 = x0;
01020 #if DEBUG
01021         DXF_DEBUG_END
01022 #endif
01023         return (spatial_filter);
01024 }
01025 
01026 
01033 double
01034 dxf_spatial_filter_get_y0
01035 (
01036         DxfSpatialFilter *spatial_filter
01038 )
01039 {
01040 #ifdef DEBUG
01041         DXF_DEBUG_BEGIN
01042 #endif
01043 
01044         /* Do some basic checks. */
01045         if (spatial_filter == NULL)
01046         {
01047                 fprintf (stderr,
01048                   (_("Error in %s () a NULL pointer was passed.\n")),
01049                   __FUNCTION__);
01050                 return (EXIT_FAILURE);
01051         }
01052         if (spatial_filter->p0 == NULL)
01053         {
01054                 fprintf (stderr,
01055                   (_("Error in %s () a NULL pointer was found.\n")),
01056                   __FUNCTION__);
01057                 return (EXIT_FAILURE);
01058         }
01059 #if DEBUG
01060         DXF_DEBUG_END
01061 #endif
01062         return (spatial_filter->p0->y0);
01063 }
01064 
01065 
01073 DxfSpatialFilter *
01074 dxf_spatial_filter_set_y0
01075 (
01076         DxfSpatialFilter *spatial_filter,
01078         double y0
01081 )
01082 {
01083 #ifdef DEBUG
01084         DXF_DEBUG_BEGIN
01085 #endif
01086         /* Do some basic checks. */
01087         if (spatial_filter == NULL)
01088         {
01089                 fprintf (stderr,
01090                   (_("Error in %s () a NULL pointer was passed.\n")),
01091                   __FUNCTION__);
01092                 return (NULL);
01093         }
01094         if (spatial_filter->p0 == NULL)
01095         {
01096                 fprintf (stderr,
01097                   (_("Error in %s () a NULL pointer was found.\n")),
01098                   __FUNCTION__);
01099                 return (NULL);
01100         }
01101         spatial_filter->p0->y0 = y0;
01102 #if DEBUG
01103         DXF_DEBUG_END
01104 #endif
01105         return (spatial_filter);
01106 }
01107 
01108 
01117 DxfPoint *
01118 dxf_spatial_filter_get_p0_next
01119 (
01120         DxfPoint *p0
01122 )
01123 {
01124 #ifdef DEBUG
01125         DXF_DEBUG_BEGIN
01126 #endif
01127 
01128         /* Do some basic checks. */
01129         if (p0 == NULL)
01130         {
01131                 fprintf (stderr,
01132                   (_("Error in %s () a NULL pointer was passed.\n")),
01133                   __FUNCTION__);
01134                 return (NULL);
01135         }
01136         if (p0->next == NULL)
01137         {
01138                 fprintf (stderr,
01139                   (_("Error in %s () a NULL pointer was found.\n")),
01140                   __FUNCTION__);
01141                 return (NULL);
01142         }
01143 #if DEBUG
01144         DXF_DEBUG_END
01145 #endif
01146         return ((DxfPoint *) p0->next);
01147 }
01148 
01149 
01159 DxfPoint *
01160 dxf_spatial_filter_set_p0_next
01161 (
01162         DxfPoint *p0,
01164         DxfPoint *next
01167 )
01168 {
01169 #ifdef DEBUG
01170         DXF_DEBUG_BEGIN
01171 #endif
01172         /* Do some basic checks. */
01173         if (p0 == NULL)
01174         {
01175                 fprintf (stderr,
01176                   (_("Error in %s () a NULL pointer was passed.\n")),
01177                   __FUNCTION__);
01178                 return (NULL);
01179         }
01180         if (next == NULL)
01181         {
01182                 fprintf (stderr,
01183                   (_("Error in %s () a NULL pointer was passed.\n")),
01184                   __FUNCTION__);
01185                 return (NULL);
01186         }
01187         p0->next = (struct DxfPoint *) next;
01188 #if DEBUG
01189         DXF_DEBUG_END
01190 #endif
01191         return (p0);
01192 }
01193 
01194 
01201 DxfPoint *
01202 dxf_spatial_filter_get_p1
01203 (
01204         DxfSpatialFilter *spatial_filter
01206 )
01207 {
01208 #ifdef DEBUG
01209         DXF_DEBUG_BEGIN
01210 #endif
01211         /* Do some basic checks. */
01212         if (spatial_filter == NULL)
01213         {
01214                 fprintf (stderr,
01215                   (_("Error in %s () a NULL pointer was passed.\n")),
01216                   __FUNCTION__);
01217                 return (NULL);
01218         }
01219         if (spatial_filter->p1 == NULL)
01220         {
01221                 fprintf (stderr,
01222                   (_("Error in %s () a NULL pointer was found.\n")),
01223                   __FUNCTION__);
01224                 return (NULL);
01225         }
01226 #if DEBUG
01227         DXF_DEBUG_END
01228 #endif
01229         return (spatial_filter->p1);
01230 }
01231 
01232 
01239 DxfSpatialFilter *
01240 dxf_spatial_filter_set_p1
01241 (
01242         DxfSpatialFilter *spatial_filter,
01244         DxfPoint *p1
01246 )
01247 {
01248 #ifdef DEBUG
01249         DXF_DEBUG_BEGIN
01250 #endif
01251         /* Do some basic checks. */
01252         if (spatial_filter == NULL)
01253         {
01254                 fprintf (stderr,
01255                   (_("Error in %s () a NULL pointer was passed.\n")),
01256                   __FUNCTION__);
01257                 return (NULL);
01258         }
01259         if (p1 == NULL)
01260         {
01261                 fprintf (stderr,
01262                   (_("Error in %s () a NULL pointer was passed.\n")),
01263                   __FUNCTION__);
01264                 return (NULL);
01265         }
01266         spatial_filter->p1 = p1;
01267 #if DEBUG
01268         DXF_DEBUG_END
01269 #endif
01270         return (spatial_filter);
01271 }
01272 
01273 
01282 double
01283 dxf_spatial_filter_get_x1
01284 (
01285         DxfSpatialFilter *spatial_filter
01287 )
01288 {
01289 #ifdef DEBUG
01290         DXF_DEBUG_BEGIN
01291 #endif
01292 
01293         /* Do some basic checks. */
01294         if (spatial_filter == NULL)
01295         {
01296                 fprintf (stderr,
01297                   (_("Error in %s () a NULL pointer was passed.\n")),
01298                   __FUNCTION__);
01299                 return (EXIT_FAILURE);
01300         }
01301         if (spatial_filter->p1 == NULL)
01302         {
01303                 fprintf (stderr,
01304                   (_("Error in %s () a NULL pointer was found.\n")),
01305                   __FUNCTION__);
01306                 return (EXIT_FAILURE);
01307         }
01308 #if DEBUG
01309         DXF_DEBUG_END
01310 #endif
01311         return (spatial_filter->p1->x0);
01312 }
01313 
01314 
01323 DxfSpatialFilter *
01324 dxf_spatial_filter_set_x1
01325 (
01326         DxfSpatialFilter *spatial_filter,
01328         double x1
01332 )
01333 {
01334 #ifdef DEBUG
01335         DXF_DEBUG_BEGIN
01336 #endif
01337         /* Do some basic checks. */
01338         if (spatial_filter == NULL)
01339         {
01340                 fprintf (stderr,
01341                   (_("Error in %s () a NULL pointer was passed.\n")),
01342                   __FUNCTION__);
01343                 return (NULL);
01344         }
01345         if (spatial_filter->p1 == NULL)
01346         {
01347                 fprintf (stderr,
01348                   (_("Error in %s () a NULL pointer was found.\n")),
01349                   __FUNCTION__);
01350                 return (NULL);
01351         }
01352         spatial_filter->p1->x0 = x1;
01353 #if DEBUG
01354         DXF_DEBUG_END
01355 #endif
01356         return (spatial_filter);
01357 }
01358 
01359 
01368 double
01369 dxf_spatial_filter_get_y1
01370 (
01371         DxfSpatialFilter *spatial_filter
01373 )
01374 {
01375 #ifdef DEBUG
01376         DXF_DEBUG_BEGIN
01377 #endif
01378 
01379         /* Do some basic checks. */
01380         if (spatial_filter == NULL)
01381         {
01382                 fprintf (stderr,
01383                   (_("Error in %s () a NULL pointer was passed.\n")),
01384                   __FUNCTION__);
01385                 return (EXIT_FAILURE);
01386         }
01387         if (spatial_filter->p1 == NULL)
01388         {
01389                 fprintf (stderr,
01390                   (_("Error in %s () a NULL pointer was found.\n")),
01391                   __FUNCTION__);
01392                 return (EXIT_FAILURE);
01393         }
01394 #if DEBUG
01395         DXF_DEBUG_END
01396 #endif
01397         return (spatial_filter->p1->y0);
01398 }
01399 
01400 
01409 DxfSpatialFilter *
01410 dxf_spatial_filter_set_y1
01411 (
01412         DxfSpatialFilter *spatial_filter,
01414         double y1
01418 )
01419 {
01420 #ifdef DEBUG
01421         DXF_DEBUG_BEGIN
01422 #endif
01423         /* Do some basic checks. */
01424         if (spatial_filter == NULL)
01425         {
01426                 fprintf (stderr,
01427                   (_("Error in %s () a NULL pointer was passed.\n")),
01428                   __FUNCTION__);
01429                 return (NULL);
01430         }
01431         if (spatial_filter->p1 == NULL)
01432         {
01433                 fprintf (stderr,
01434                   (_("Error in %s () a NULL pointer was found.\n")),
01435                   __FUNCTION__);
01436                 return (NULL);
01437         }
01438         spatial_filter->p1->y0 = y1;
01439 #if DEBUG
01440         DXF_DEBUG_END
01441 #endif
01442         return (spatial_filter);
01443 }
01444 
01445 
01454 double
01455 dxf_spatial_filter_get_z1
01456 (
01457         DxfSpatialFilter *spatial_filter
01459 )
01460 {
01461 #ifdef DEBUG
01462         DXF_DEBUG_BEGIN
01463 #endif
01464 
01465         /* Do some basic checks. */
01466         if (spatial_filter == NULL)
01467         {
01468                 fprintf (stderr,
01469                   (_("Error in %s () a NULL pointer was passed.\n")),
01470                   __FUNCTION__);
01471                 return (EXIT_FAILURE);
01472         }
01473         if (spatial_filter->p1 == NULL)
01474         {
01475                 fprintf (stderr,
01476                   (_("Error in %s () a NULL pointer was found.\n")),
01477                   __FUNCTION__);
01478                 return (EXIT_FAILURE);
01479         }
01480 #if DEBUG
01481         DXF_DEBUG_END
01482 #endif
01483         return (spatial_filter->p1->z0);
01484 }
01485 
01486 
01495 DxfSpatialFilter *
01496 dxf_spatial_filter_set_z1
01497 (
01498         DxfSpatialFilter *spatial_filter,
01500         double z1
01504 )
01505 {
01506 #ifdef DEBUG
01507         DXF_DEBUG_BEGIN
01508 #endif
01509         /* Do some basic checks. */
01510         if (spatial_filter == NULL)
01511         {
01512                 fprintf (stderr,
01513                   (_("Error in %s () a NULL pointer was passed.\n")),
01514                   __FUNCTION__);
01515                 return (NULL);
01516         }
01517         if (spatial_filter->p1 == NULL)
01518         {
01519                 fprintf (stderr,
01520                   (_("Error in %s () a NULL pointer was found.\n")),
01521                   __FUNCTION__);
01522                 return (NULL);
01523         }
01524         spatial_filter->p1->z0 = z1;
01525 #if DEBUG
01526         DXF_DEBUG_END
01527 #endif
01528         return (spatial_filter);
01529 }
01530 
01531 
01559 double
01560 dxf_spatial_filter_get_front_clipping_plane_distance
01561 (
01562         DxfSpatialFilter *spatial_filter
01564 )
01565 {
01566 #ifdef DEBUG
01567         DXF_DEBUG_BEGIN
01568 #endif
01569 
01570         /* Do some basic checks. */
01571         if (spatial_filter == NULL)
01572         {
01573                 fprintf (stderr,
01574                   (_("Error in %s () a NULL pointer was passed.\n")),
01575                   __FUNCTION__);
01576                 return (EXIT_FAILURE);
01577         }
01578 #if DEBUG
01579         DXF_DEBUG_END
01580 #endif
01581         return (spatial_filter->front_clipping_plane_distance);
01582 }
01583 
01584 
01592 DxfSpatialFilter *
01593 dxf_spatial_filter_set_front_clipping_plane_distance
01594 (
01595         DxfSpatialFilter *spatial_filter,
01597         double front_clipping_plane_distance
01601 )
01602 {
01603 #ifdef DEBUG
01604         DXF_DEBUG_BEGIN
01605 #endif
01606         /* Do some basic checks. */
01607         if (spatial_filter == NULL)
01608         {
01609                 fprintf (stderr,
01610                   (_("Error in %s () a NULL pointer was passed.\n")),
01611                   __FUNCTION__);
01612                 return (NULL);
01613         }
01614         spatial_filter->front_clipping_plane_distance = front_clipping_plane_distance;
01615 #if DEBUG
01616         DXF_DEBUG_END
01617 #endif
01618         return (spatial_filter);
01619 }
01620 
01621 
01629 double
01630 dxf_spatial_filter_get_back_clipping_plane_distance
01631 (
01632         DxfSpatialFilter *spatial_filter
01634 )
01635 {
01636 #ifdef DEBUG
01637         DXF_DEBUG_BEGIN
01638 #endif
01639 
01640         /* Do some basic checks. */
01641         if (spatial_filter == NULL)
01642         {
01643                 fprintf (stderr,
01644                   (_("Error in %s () a NULL pointer was passed.\n")),
01645                   __FUNCTION__);
01646                 return (EXIT_FAILURE);
01647         }
01648 #if DEBUG
01649         DXF_DEBUG_END
01650 #endif
01651         return (spatial_filter->back_clipping_plane_distance);
01652 }
01653 
01654 
01662 DxfSpatialFilter *
01663 dxf_spatial_filter_set_back_clipping_plane_distance
01664 (
01665         DxfSpatialFilter *spatial_filter,
01667         double back_clipping_plane_distance
01671 )
01672 {
01673 #ifdef DEBUG
01674         DXF_DEBUG_BEGIN
01675 #endif
01676         /* Do some basic checks. */
01677         if (spatial_filter == NULL)
01678         {
01679                 fprintf (stderr,
01680                   (_("Error in %s () a NULL pointer was passed.\n")),
01681                   __FUNCTION__);
01682                 return (NULL);
01683         }
01684         spatial_filter->back_clipping_plane_distance = back_clipping_plane_distance;
01685 #if DEBUG
01686         DXF_DEBUG_END
01687 #endif
01688         return (spatial_filter);
01689 }
01690 
01691 
01698 int
01699 dxf_spatial_filter_get_number_of_points
01700 (
01701         DxfSpatialFilter *spatial_filter
01703 )
01704 {
01705 #if DEBUG
01706         DXF_DEBUG_BEGIN
01707 #endif
01708         /* Do some basic checks. */
01709         if (spatial_filter == NULL)
01710         {
01711                 fprintf (stderr,
01712                   (_("Error in %s () a NULL pointer was passed.\n")),
01713                   __FUNCTION__);
01714                 return (EXIT_FAILURE);
01715         }
01716         if (spatial_filter->number_of_points < 0)
01717         {
01718                 fprintf (stderr,
01719                   (_("Warning in %s () a negative value was found.\n")),
01720                   __FUNCTION__);
01721         }
01722 #if DEBUG
01723         DXF_DEBUG_END
01724 #endif
01725         return (spatial_filter->number_of_points);
01726 }
01727 
01728 
01732 DxfSpatialFilter *
01733 dxf_spatial_filter_set_number_of_points
01734 (
01735         DxfSpatialFilter *spatial_filter,
01737         int number_of_points
01739 )
01740 {
01741 #if DEBUG
01742         DXF_DEBUG_BEGIN
01743 #endif
01744         /* Do some basic checks. */
01745         if (spatial_filter == NULL)
01746         {
01747                 fprintf (stderr,
01748                   (_("Error in %s () a NULL pointer was passed.\n")),
01749                   __FUNCTION__);
01750                 return (NULL);
01751         }
01752         if (number_of_points < 0)
01753         {
01754                 fprintf (stderr,
01755                   (_("Warning in %s () a negative value was passed.\n")),
01756                   __FUNCTION__);
01757         }
01758         spatial_filter->number_of_points = number_of_points;
01759 #if DEBUG
01760         DXF_DEBUG_END
01761 #endif
01762         return (spatial_filter);
01763 }
01764 
01765 
01772 int
01773 dxf_spatial_filter_get_clip_boundary_display_flag
01774 (
01775         DxfSpatialFilter *spatial_filter
01777 )
01778 {
01779 #if DEBUG
01780         DXF_DEBUG_BEGIN
01781 #endif
01782         /* Do some basic checks. */
01783         if (spatial_filter == NULL)
01784         {
01785                 fprintf (stderr,
01786                   (_("Error in %s () a NULL pointer was passed.\n")),
01787                   __FUNCTION__);
01788                 return (EXIT_FAILURE);
01789         }
01790         if (spatial_filter->clip_boundary_display_flag < 0)
01791         {
01792                 fprintf (stderr,
01793                   (_("Warning in %s () a negative value was found.\n")),
01794                   __FUNCTION__);
01795         }
01796         if (spatial_filter->clip_boundary_display_flag > 1)
01797         {
01798                 fprintf (stderr,
01799                   (_("Warning in %s () an out of range value was found.\n")),
01800                   __FUNCTION__);
01801         }
01802 #if DEBUG
01803         DXF_DEBUG_END
01804 #endif
01805         return (spatial_filter->clip_boundary_display_flag);
01806 }
01807 
01808 
01813 DxfSpatialFilter *
01814 dxf_spatial_filter_set_clip_boundary_display_flag
01815 (
01816         DxfSpatialFilter *spatial_filter,
01818         int clip_boundary_display_flag
01821 )
01822 {
01823 #if DEBUG
01824         DXF_DEBUG_BEGIN
01825 #endif
01826         /* Do some basic checks. */
01827         if (spatial_filter == NULL)
01828         {
01829                 fprintf (stderr,
01830                   (_("Error in %s () a NULL pointer was passed.\n")),
01831                   __FUNCTION__);
01832                 return (NULL);
01833         }
01834         if (clip_boundary_display_flag < 0)
01835         {
01836                 fprintf (stderr,
01837                   (_("Warning in %s () a negative value was passed.\n")),
01838                   __FUNCTION__);
01839         }
01840         if (clip_boundary_display_flag > 1)
01841         {
01842                 fprintf (stderr,
01843                   (_("Warning in %s () an out of range value was passed.\n")),
01844                   __FUNCTION__);
01845         }
01846         spatial_filter->clip_boundary_display_flag = clip_boundary_display_flag;
01847 #if DEBUG
01848         DXF_DEBUG_END
01849 #endif
01850         return (spatial_filter);
01851 }
01852 
01853 
01860 int
01861 dxf_spatial_filter_get_front_clipping_plane_flag
01862 (
01863         DxfSpatialFilter *spatial_filter
01865 )
01866 {
01867 #if DEBUG
01868         DXF_DEBUG_BEGIN
01869 #endif
01870         /* Do some basic checks. */
01871         if (spatial_filter == NULL)
01872         {
01873                 fprintf (stderr,
01874                   (_("Error in %s () a NULL pointer was passed.\n")),
01875                   __FUNCTION__);
01876                 return (EXIT_FAILURE);
01877         }
01878         if (spatial_filter->front_clipping_plane_flag < 0)
01879         {
01880                 fprintf (stderr,
01881                   (_("Warning in %s () a negative value was found.\n")),
01882                   __FUNCTION__);
01883         }
01884         if (spatial_filter->front_clipping_plane_flag > 1)
01885         {
01886                 fprintf (stderr,
01887                   (_("Warning in %s () an out of range value was found.\n")),
01888                   __FUNCTION__);
01889         }
01890 #if DEBUG
01891         DXF_DEBUG_END
01892 #endif
01893         return (spatial_filter->front_clipping_plane_flag);
01894 }
01895 
01896 
01901 DxfSpatialFilter *
01902 dxf_spatial_filter_set_front_clipping_plane_flag
01903 (
01904         DxfSpatialFilter *spatial_filter,
01906         int front_clipping_plane_flag
01909 )
01910 {
01911 #if DEBUG
01912         DXF_DEBUG_BEGIN
01913 #endif
01914         /* Do some basic checks. */
01915         if (spatial_filter == NULL)
01916         {
01917                 fprintf (stderr,
01918                   (_("Error in %s () a NULL pointer was passed.\n")),
01919                   __FUNCTION__);
01920                 return (NULL);
01921         }
01922         if (front_clipping_plane_flag < 0)
01923         {
01924                 fprintf (stderr,
01925                   (_("Warning in %s () a negative value was passed.\n")),
01926                   __FUNCTION__);
01927         }
01928         if (front_clipping_plane_flag > 1)
01929         {
01930                 fprintf (stderr,
01931                   (_("Warning in %s () an out of range value was passed.\n")),
01932                   __FUNCTION__);
01933         }
01934         spatial_filter->front_clipping_plane_flag = front_clipping_plane_flag;
01935 #if DEBUG
01936         DXF_DEBUG_END
01937 #endif
01938         return (spatial_filter);
01939 }
01940 
01941 
01948 int
01949 dxf_spatial_filter_get_back_clipping_plane_flag
01950 (
01951         DxfSpatialFilter *spatial_filter
01953 )
01954 {
01955 #if DEBUG
01956         DXF_DEBUG_BEGIN
01957 #endif
01958         /* Do some basic checks. */
01959         if (spatial_filter == NULL)
01960         {
01961                 fprintf (stderr,
01962                   (_("Error in %s () a NULL pointer was passed.\n")),
01963                   __FUNCTION__);
01964                 return (EXIT_FAILURE);
01965         }
01966         if (spatial_filter->back_clipping_plane_flag < 0)
01967         {
01968                 fprintf (stderr,
01969                   (_("Warning in %s () a negative value was found.\n")),
01970                   __FUNCTION__);
01971         }
01972         if (spatial_filter->back_clipping_plane_flag > 1)
01973         {
01974                 fprintf (stderr,
01975                   (_("Warning in %s () an out of range value was found.\n")),
01976                   __FUNCTION__);
01977         }
01978 #if DEBUG
01979         DXF_DEBUG_END
01980 #endif
01981         return (spatial_filter->back_clipping_plane_flag);
01982 }
01983 
01984 
01989 DxfSpatialFilter *
01990 dxf_spatial_filter_set_back_clipping_plane_flag
01991 (
01992         DxfSpatialFilter *spatial_filter,
01994         int back_clipping_plane_flag
01997 )
01998 {
01999 #if DEBUG
02000         DXF_DEBUG_BEGIN
02001 #endif
02002         /* Do some basic checks. */
02003         if (spatial_filter == NULL)
02004         {
02005                 fprintf (stderr,
02006                   (_("Error in %s () a NULL pointer was passed.\n")),
02007                   __FUNCTION__);
02008                 return (NULL);
02009         }
02010         if (back_clipping_plane_flag < 0)
02011         {
02012                 fprintf (stderr,
02013                   (_("Warning in %s () a negative value was passed.\n")),
02014                   __FUNCTION__);
02015         }
02016         if (back_clipping_plane_flag > 1)
02017         {
02018                 fprintf (stderr,
02019                   (_("Warning in %s () an out of range value was passed.\n")),
02020                   __FUNCTION__);
02021         }
02022         spatial_filter->back_clipping_plane_flag = back_clipping_plane_flag;
02023 #if DEBUG
02024         DXF_DEBUG_END
02025 #endif
02026         return (spatial_filter);
02027 }
02028 
02029 
02038 DxfPoint *
02039 dxf_spatial_filter_get_extrusion_vector_as_point
02040 (
02041         DxfSpatialFilter *spatial_filter
02043 )
02044 {
02045 #ifdef DEBUG
02046         DXF_DEBUG_BEGIN
02047 #endif
02048         DxfPoint *point = NULL;
02049 
02050         /* Do some basic checks. */
02051         if (spatial_filter == NULL)
02052         {
02053                 fprintf (stderr,
02054                   (_("Error in %s () a NULL pointer was passed.\n")),
02055                   __FUNCTION__);
02056                 return (NULL);
02057         }
02058         point = dxf_point_init (point);
02059         if (point == NULL)
02060         {
02061               fprintf (stderr,
02062                   (_("Error in %s () could not allocate memory.\n")),
02063                 __FUNCTION__);
02064               return (NULL);
02065         }
02066         point->x0 = spatial_filter->extr_x0;
02067         point->y0 = spatial_filter->extr_y0;
02068         point->z0 = spatial_filter->extr_z0;
02069 #if DEBUG
02070         DXF_DEBUG_END
02071 #endif
02072         return (point);
02073 }
02074 
02075 
02082 double
02083 dxf_spatial_filter_get_extr_x0
02084 (
02085         DxfSpatialFilter *spatial_filter
02087 )
02088 {
02089 #ifdef DEBUG
02090         DXF_DEBUG_BEGIN
02091 #endif
02092 
02093         /* Do some basic checks. */
02094         if (spatial_filter == NULL)
02095         {
02096                 fprintf (stderr,
02097                   (_("Error in %s () a NULL pointer was passed.\n")),
02098                   __FUNCTION__);
02099                 return (EXIT_FAILURE);
02100         }
02101 #if DEBUG
02102         DXF_DEBUG_END
02103 #endif
02104         return (spatial_filter->extr_x0);
02105 }
02106 
02107 
02115 DxfSpatialFilter *
02116 dxf_spatial_filter_set_extr_x0
02117 (
02118         DxfSpatialFilter *spatial_filter,
02120         double extr_x0
02123 )
02124 {
02125 #ifdef DEBUG
02126         DXF_DEBUG_BEGIN
02127 #endif
02128         /* Do some basic checks. */
02129         if (spatial_filter == NULL)
02130         {
02131                 fprintf (stderr,
02132                   (_("Error in %s () a NULL pointer was passed.\n")),
02133                   __FUNCTION__);
02134                 return (NULL);
02135         }
02136         spatial_filter->extr_x0 = extr_x0;
02137 #if DEBUG
02138         DXF_DEBUG_END
02139 #endif
02140         return (spatial_filter);
02141 }
02142 
02143 
02150 double
02151 dxf_spatial_filter_get_extr_y0
02152 (
02153         DxfSpatialFilter *spatial_filter
02155 )
02156 {
02157 #ifdef DEBUG
02158         DXF_DEBUG_BEGIN
02159 #endif
02160 
02161         /* Do some basic checks. */
02162         if (spatial_filter == NULL)
02163         {
02164                 fprintf (stderr,
02165                   (_("Error in %s () a NULL pointer was passed.\n")),
02166                   __FUNCTION__);
02167                 return (EXIT_FAILURE);
02168         }
02169 #if DEBUG
02170         DXF_DEBUG_END
02171 #endif
02172         return (spatial_filter->extr_y0);
02173 }
02174 
02175 
02183 DxfSpatialFilter *
02184 dxf_spatial_filter_set_extr_y0
02185 (
02186         DxfSpatialFilter *spatial_filter,
02188         double extr_y0
02191 )
02192 {
02193 #ifdef DEBUG
02194         DXF_DEBUG_BEGIN
02195 #endif
02196         /* Do some basic checks. */
02197         if (spatial_filter == NULL)
02198         {
02199                 fprintf (stderr,
02200                   (_("Error in %s () a NULL pointer was passed.\n")),
02201                   __FUNCTION__);
02202                 return (NULL);
02203         }
02204         spatial_filter->extr_y0 = extr_y0;
02205 #if DEBUG
02206         DXF_DEBUG_END
02207 #endif
02208         return (spatial_filter);
02209 }
02210 
02211 
02218 double
02219 dxf_spatial_filter_get_extr_z0
02220 (
02221         DxfSpatialFilter *spatial_filter
02223 )
02224 {
02225 #ifdef DEBUG
02226         DXF_DEBUG_BEGIN
02227 #endif
02228 
02229         /* Do some basic checks. */
02230         if (spatial_filter == NULL)
02231         {
02232                 fprintf (stderr,
02233                   (_("Error in %s () a NULL pointer was passed.\n")),
02234                   __FUNCTION__);
02235                 return (EXIT_FAILURE);
02236         }
02237 #if DEBUG
02238         DXF_DEBUG_END
02239 #endif
02240         return (spatial_filter->extr_z0);
02241 }
02242 
02243 
02251 DxfSpatialFilter *
02252 dxf_spatial_filter_set_extr_z0
02253 (
02254         DxfSpatialFilter *spatial_filter,
02256         double extr_z0
02259 )
02260 {
02261 #ifdef DEBUG
02262         DXF_DEBUG_BEGIN
02263 #endif
02264         /* Do some basic checks. */
02265         if (spatial_filter == NULL)
02266         {
02267                 fprintf (stderr,
02268                   (_("Error in %s () a NULL pointer was passed.\n")),
02269                   __FUNCTION__);
02270                 return (NULL);
02271         }
02272         spatial_filter->extr_z0 = extr_z0;
02273 #if DEBUG
02274         DXF_DEBUG_END
02275 #endif
02276         return (spatial_filter);
02277 }
02278 
02279 
02288 DxfSpatialFilter *
02289 dxf_spatial_filter_get_next
02290 (
02291         DxfSpatialFilter *spatial_filter
02293 )
02294 {
02295 #if DEBUG
02296         DXF_DEBUG_BEGIN
02297 #endif
02298         /* Do some basic checks. */
02299         if (spatial_filter == NULL)
02300         {
02301                 fprintf (stderr,
02302                   (_("Error in %s () a NULL pointer was passed.\n")),
02303                   __FUNCTION__);
02304                 return (NULL);
02305         }
02306         if (spatial_filter->next == NULL)
02307         {
02308                 fprintf (stderr,
02309                   (_("Error in %s () a NULL pointer was found.\n")),
02310                   __FUNCTION__);
02311                 return (NULL);
02312         }
02313 #if DEBUG
02314         DXF_DEBUG_END
02315 #endif
02316         return ((DxfSpatialFilter *) spatial_filter->next);
02317 }
02318 
02319 
02324 DxfSpatialFilter *
02325 dxf_spatial_filter_set_next
02326 (
02327         DxfSpatialFilter *spatial_filter,
02329         DxfSpatialFilter *next
02332 )
02333 {
02334 #if DEBUG
02335         DXF_DEBUG_BEGIN
02336 #endif
02337         /* Do some basic checks. */
02338         if (spatial_filter == NULL)
02339         {
02340                 fprintf (stderr,
02341                   (_("Error in %s () a NULL pointer was passed.\n")),
02342                   __FUNCTION__);
02343                 return (NULL);
02344         }
02345         if (next == NULL)
02346         {
02347                 fprintf (stderr,
02348                   (_("Error in %s () a NULL pointer was passed.\n")),
02349                   __FUNCTION__);
02350                 return (NULL);
02351         }
02352         spatial_filter->next = (struct DxfSpatialFilter *) next;
02353 #if DEBUG
02354         DXF_DEBUG_END
02355 #endif
02356         return (spatial_filter);
02357 }
02358 
02359 
02368 DxfSpatialFilter *
02369 dxf_spatial_filter_get_last
02370 (
02371         DxfSpatialFilter *spatial_filter
02373 )
02374 {
02375 #if DEBUG
02376         DXF_DEBUG_BEGIN
02377 #endif
02378         /* Do some basic checks. */
02379         if (spatial_filter == NULL)
02380         {
02381                 fprintf (stderr,
02382                   (_("Error in %s () a NULL pointer was passed.\n")),
02383                   __FUNCTION__);
02384                 return (NULL);
02385         }
02386         if (spatial_filter->next == NULL)
02387         {
02388                 fprintf (stderr,
02389                   (_("Warning in %s () a NULL pointer was found.\n")),
02390                   __FUNCTION__);
02391                 return ((DxfSpatialFilter *) spatial_filter);
02392         }
02393         DxfSpatialFilter *iter = (DxfSpatialFilter *) spatial_filter->next;
02394         while (iter->next != NULL)
02395         {
02396                 iter = (DxfSpatialFilter *) iter->next;
02397         }
02398 #if DEBUG
02399         DXF_DEBUG_END
02400 #endif
02401         return ((DxfSpatialFilter *) iter);
02402 }
02403 
02404 
02405 /* EOF*/