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

spatial_index.c File Reference

Functions for a DXF spatial_index object (SPATIAL_INDEX). More...

#include "spatial_index.h"
Include dependency graph for spatial_index.c:

Go to the source code of this file.

Functions

DxfSpatialIndexdxf_spatial_index_new ()
 Allocate memory for a DxfSpatialIndex.
DxfSpatialIndexdxf_spatial_index_init (DxfSpatialIndex *spatial_index)
 Allocate memory and initialize data fields in a SPATIAL_INDEX object.
DxfSpatialIndexdxf_spatial_index_read (DxfFile *fp, DxfSpatialIndex *spatial_index)
 Read data from a DXF file into a DXF SPATIAL_INDEX object.
int dxf_spatial_index_write (DxfFile *fp, DxfSpatialIndex *spatial_index)
 Write DXF output to a file for a DXF SPATIAL_INDEX object.
int dxf_spatial_index_free (DxfSpatialIndex *spatial_index)
 Free the allocated memory for a DXF SPATIAL_INDEX and all it's data fields.
void dxf_spatial_index_free_chain (DxfSpatialIndex *spatial_indices)
 Free the allocated memory for a chain of DXF SPATIAL_INDEX objects and all their data fields.
int dxf_spatial_index_get_id_code (DxfSpatialIndex *spatial_index)
 Get the id_code from a DXF SPATIAL_INDEX object.
DxfSpatialIndexdxf_spatial_index_set_id_code (DxfSpatialIndex *spatial_index, int id_code)
 Set the id_code for a DXF SPATIAL_INDEX object.
char * dxf_spatial_index_get_dictionary_owner_soft (DxfSpatialIndex *spatial_index)
 Get the pointer to the dictionary_owner_soft from a DXF SPATIAL_INDEX object.
DxfSpatialIndexdxf_spatial_index_set_dictionary_owner_soft (DxfSpatialIndex *spatial_index, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DXF SPATIAL_INDEX object.
char * dxf_spatial_index_get_dictionary_owner_hard (DxfSpatialIndex *spatial_index)
 Get the pointer to the dictionary_owner_hard from a DXF SPATIAL_INDEX object.
DxfSpatialIndexdxf_spatial_index_set_dictionary_owner_hard (DxfSpatialIndex *spatial_index, char *dictionary_owner_hard)
 Set the pointer to the dictionary_owner_hard for a DXF SPATIAL_INDEX object.
double dxf_spatial_index_get_time_stamp (DxfSpatialIndex *spatial_index)
 Get the time stamp time_stamp of a DXF SPATIAL_INDEX object.
DxfSpatialIndexdxf_spatial_index_set_time_stamp (DxfSpatialIndex *spatial_index, double time_stamp)
 Set the time stamp time_stamp of a DXF SPATIAL_INDEX object.
DxfSpatialIndexdxf_spatial_index_get_next (DxfSpatialIndex *spatial_index)
 Get the pointer to the next SPATIAL_INDEX object from a DXF SPATIAL_INDEX object.
DxfSpatialIndexdxf_spatial_index_set_next (DxfSpatialIndex *spatial_index, DxfSpatialIndex *next)
 Set the pointer to the next SPATIAL_INDEX object for a DXF SPATIAL_INDEX object.
DxfSpatialIndexdxf_spatial_index_get_last (DxfSpatialIndex *spatial_index)
 Get the pointer to the last SPATIAL_INDEX object from a linked list of DXF SPATIAL_INDEX objects.

Detailed Description

Functions for a DXF spatial_index object (SPATIAL_INDEX).

Author:
Copyright (C) 2015, 2017 by Bert Timmerman <bert.timmerman@xs4all.nl>.

The SPATIAL_INDEX is always written out empty to a DXF file.
This object can be ignored.

Since:
The SPATIAL_INDEX object was introduced in DXF R14.
Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12 (backward compatibility).
According to DXF R13 (backward compatibility).
According to DXF R14.

Copyright Notices.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to:
Free Software Foundation, Inc.,
59 Temple Place,
Suite 330,
Boston,
MA 02111 USA.

Drawing eXchange Format (DXF) is a defacto industry standard for the exchange of drawing files between various Computer Aided Drafting programs.
DXF is an industry standard designed by Autodesk(TM).
For more details see http://www.autodesk.com.


Definition in file spatial_index.c.


Function Documentation

DxfSpatialIndex* dxf_spatial_index_new ( )

Allocate memory for a DxfSpatialIndex.

Fill the memory contents with zeros.

Definition at line 55 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_spatial_index_init(), and dxf_spatial_index_read().

DxfSpatialIndex* dxf_spatial_index_init ( DxfSpatialIndex spatial_index)

Allocate memory and initialize data fields in a SPATIAL_INDEX object.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
spatial_indexa pointer to the DXF SPATIAL_INDEX object.

Definition at line 93 of file spatial_index.c.

References _, dxf_spatial_index_struct::dictionary_owner_hard, dxf_spatial_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_spatial_index_new(), dxf_spatial_index_struct::id_code, dxf_spatial_index_struct::next, and dxf_spatial_index_struct::time_stamp.

Referenced by dxf_spatial_index_read().

Here is the call graph for this function:

DxfSpatialIndex* dxf_spatial_index_read ( DxfFile fp,
DxfSpatialIndex spatial_index 
)

Read data from a DXF file into a DXF SPATIAL_INDEX object.

The last line read from file contained the string "SPATIAL_INDEX".
Now follows some data for the SPATIAL_INDEX, to be terminated with a " 0" string announcing the following object, or the end of the OBJECTS section marker ENDSEC.
While parsing the DXF file store data in spatial_index.

Returns:
a pointer to spatial_index.
Parameters:
fpDXF file pointer to an input file (or device).
spatial_indexa pointer to the DXF SPATIAL_INDEX object.

Definition at line 155 of file spatial_index.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_spatial_index_struct::dictionary_owner_hard, dxf_spatial_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_spatial_index_init(), dxf_spatial_index_new(), dxf_file_struct::filename, dxf_file_struct::fp, dxf_spatial_index_struct::id_code, dxf_file_struct::line_number, and dxf_spatial_index_struct::time_stamp.

Here is the call graph for this function:

int dxf_spatial_index_write ( DxfFile fp,
DxfSpatialIndex spatial_index 
)

Write DXF output to a file for a DXF SPATIAL_INDEX object.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Warning:
The SPATIAL_INDEX is always written out empty to a DXF file.
This object can be ignored.

Todo:
for version R14.
Implementing the start of application-defined group "{application_name", with Group code 102.
For example: "{ACAD_REACTORS" indicates the start of the AutoCAD persistent reactors group.

application-defined codes: Group codes and values within the 102 groups are application defined (optional).

End of group, "}" (optional), with Group code 102.

Parameters:
fpDXF file pointer to an output file (or device).
spatial_indexa pointer to the DXF SPATIAL_INDEX object.

Definition at line 282 of file spatial_index.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_spatial_index_struct::dictionary_owner_hard, dxf_spatial_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_file_struct::fp, dxf_spatial_index_struct::id_code, and dxf_spatial_index_struct::time_stamp.

int dxf_spatial_index_free ( DxfSpatialIndex spatial_index)

Free the allocated memory for a DXF SPATIAL_INDEX and all it's data fields.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Parameters:
spatial_indexa pointer to the memory occupied by the DXF SPATIAL_INDEX object.

Definition at line 376 of file spatial_index.c.

References _, dxf_spatial_index_struct::dictionary_owner_hard, dxf_spatial_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_spatial_index_struct::next.

Referenced by dxf_spatial_index_free_chain().

void dxf_spatial_index_free_chain ( DxfSpatialIndex spatial_indices)

Free the allocated memory for a chain of DXF SPATIAL_INDEX objects and all their data fields.

Parameters:
spatial_indicesa pointer to the chain of DXF SPATIAL_INDEX objects.

Definition at line 417 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_spatial_index_free(), and dxf_spatial_index_struct::next.

Here is the call graph for this function:

int dxf_spatial_index_get_id_code ( DxfSpatialIndex spatial_index)

Get the id_code from a DXF SPATIAL_INDEX object.

Returns:
id_code.
Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.

Definition at line 451 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_spatial_index_struct::id_code.

DxfSpatialIndex* dxf_spatial_index_set_id_code ( DxfSpatialIndex spatial_index,
int  id_code 
)

Set the id_code for a DXF SPATIAL_INDEX object.

Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.
id_codethe id_code to be set for the object.
This is to be an unique (sequential) number in the DXF file.

Definition at line 485 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_spatial_index_struct::id_code.

char* dxf_spatial_index_get_dictionary_owner_soft ( DxfSpatialIndex spatial_index)

Get the pointer to the dictionary_owner_soft from a DXF SPATIAL_INDEX object.

Returns:
pointer to the dictionary_owner_soft.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.

Definition at line 529 of file spatial_index.c.

References _, dxf_spatial_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

DxfSpatialIndex* dxf_spatial_index_set_dictionary_owner_soft ( DxfSpatialIndex spatial_index,
char *  dictionary_owner_soft 
)

Set the pointer to the dictionary_owner_soft for a DXF SPATIAL_INDEX object.

Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the object.

Definition at line 565 of file spatial_index.c.

References _, dxf_spatial_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

char* dxf_spatial_index_get_dictionary_owner_hard ( DxfSpatialIndex spatial_index)

Get the pointer to the dictionary_owner_hard from a DXF SPATIAL_INDEX object.

Returns:
pointer to the dictionary_owner_hard.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.

Definition at line 609 of file spatial_index.c.

References _, dxf_spatial_index_struct::dictionary_owner_hard, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

DxfSpatialIndex* dxf_spatial_index_set_dictionary_owner_hard ( DxfSpatialIndex spatial_index,
char *  dictionary_owner_hard 
)

Set the pointer to the dictionary_owner_hard for a DXF SPATIAL_INDEX object.

Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.
dictionary_owner_harda string containing the pointer to the dictionary_owner_hard for the object.

Definition at line 645 of file spatial_index.c.

References _, dxf_spatial_index_struct::dictionary_owner_hard, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

double dxf_spatial_index_get_time_stamp ( DxfSpatialIndex spatial_index)

Get the time stamp time_stamp of a DXF SPATIAL_INDEX object.

Returns:
the time stamp time_stamp.
Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.

Definition at line 687 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_spatial_index_struct::time_stamp.

DxfSpatialIndex* dxf_spatial_index_set_time_stamp ( DxfSpatialIndex spatial_index,
double  time_stamp 
)

Set the time stamp time_stamp of a DXF SPATIAL_INDEX object.

Returns:
a pointer to spatial_index when successful, or NULL when an error occurred.
Parameters:
spatial_indexa pointer to a DXF SPATIAL_FILTER object.
time_stampthe time stamp time_stamp to be set for a DXF SPATIAL_INDEX object.

Definition at line 720 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_spatial_index_struct::time_stamp.

DxfSpatialIndex* dxf_spatial_index_get_next ( DxfSpatialIndex spatial_index)

Get the pointer to the next SPATIAL_INDEX object from a DXF SPATIAL_INDEX object.

Returns:
pointer to the next SPATIAL_INDEX object.
Warning:
No checks are performed on the returned pointer.
Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.

Definition at line 757 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_spatial_index_struct::next.

DxfSpatialIndex* dxf_spatial_index_set_next ( DxfSpatialIndex spatial_index,
DxfSpatialIndex next 
)

Set the pointer to the next SPATIAL_INDEX object for a DXF SPATIAL_INDEX object.

Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.
nexta pointer to the next SPATIAL_INDEX object for the object.

Definition at line 793 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_spatial_index_struct::next.

DxfSpatialIndex* dxf_spatial_index_get_last ( DxfSpatialIndex spatial_index)

Get the pointer to the last SPATIAL_INDEX object from a linked list of DXF SPATIAL_INDEX objects.

Returns:
pointer to the last SPATIAL_INDEX object.
Warning:
No checks are performed on the returned pointer.
Parameters:
spatial_indexa pointer to a DXF SPATIAL_INDEX object.

Definition at line 837 of file spatial_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, and dxf_spatial_index_struct::next.