libDXF 0.0.1
A library with DXF related functions written in C.
Data Structures | Typedefs | Functions

layer_index.h File Reference

Header file for a DXF layer index object (LAYER_INDEX). More...

#include "global.h"
#include "layer_name.h"
Include dependency graph for layer_index.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  dxf_layer_index_struct
 DXF definition of an AutoCAD idbuffer object (LAYER_INDEX). More...

Typedefs

typedef struct
dxf_layer_index_struct 
DxfLayerIndex
 DXF definition of an AutoCAD idbuffer object (LAYER_INDEX).

Functions

DxfLayerIndexdxf_layer_index_new ()
 Allocate memory for a DxfLayerIndex.
DxfLayerIndexdxf_layer_index_init (DxfLayerIndex *layer_index)
 Allocate memory and initialize data fields in a LAYER_INDEX object.
DxfLayerIndexdxf_layer_index_read (DxfFile *fp, DxfLayerIndex *layer_index)
 Read data from a DXF file into a DXF LAYER_INDEX object.
int dxf_layer_index_write (DxfFile *fp, DxfLayerIndex *layer_index)
 Write DXF output to a file for a DXF LAYER_INDEX object.
int dxf_layer_index_free (DxfLayerIndex *layer_index)
 Free the allocated memory for a DXF LAYER_INDEX and all it's data fields.
void dxf_layer_index_free_chain (DxfLayerIndex *layer_indices)
 Free the allocated memory for a chain of DXF LAYER_INDEX objects and all their data fields.
int dxf_layer_index_get_id_code (DxfLayerIndex *layer_index)
 Get the ID code from a DXF LAYER_INDEX object.
DxfLayerIndexdxf_layer_index_set_id_code (DxfLayerIndex *layer_index, int id_code)
 Set the ID code for a DXF LAYER_INDEX object.
char * dxf_layer_index_get_dictionary_owner_soft (DxfLayerIndex *layer_index)
 Get the soft pointer to the dictionary owner from a DXF LAYER_INDEX object.
DxfLayerIndexdxf_layer_index_set_dictionary_owner_soft (DxfLayerIndex *layer_index, char *dictionary_owner_soft)
 Set the pointer to the dictionary_owner_soft for a DXF LAYER_INDEX object.
char * dxf_layer_index_get_dictionary_owner_hard (DxfLayerIndex *layer_index)
 Get the hard pointer to the dictionary owner from a DXF LAYER_INDEX object.
DxfLayerIndexdxf_layer_index_set_dictionary_owner_hard (DxfLayerIndex *layer_index, char *dictionary_owner_hard)
 Set the pointer to the dictionary_owner_hard for a DXF LAYER_INDEX object.
double dxf_layer_index_get_time_stamp (DxfLayerIndex *layer_index)
 Get the time_stamp from a DXF LAYER_INDEX object.
DxfLayerIndexdxf_layer_index_set_time_stamp (DxfLayerIndex *layer_index, double time_stamp)
 Set the radius for a DXF LAYER_INDEX object.
DxfLayerIndexdxf_layer_index_get_next (DxfLayerIndex *layer_index)
 Get the pointer to the next LAYER_INDEX object from a DXF LAYER_INDEX object.
DxfLayerIndexdxf_layer_index_set_next (DxfLayerIndex *layer_index, DxfLayerIndex *next)
 Set the pointer to the next LAYER_INDEX object for a DXF LAYER_INDEX object.
DxfLayerIndexdxf_layer_index_get_last (DxfLayerIndex *layer_index)
 Get the pointer to the last LAYER_INDEX object from a linked list of DXF LAYER_INDEX object.

Detailed Description

Header file for a DXF layer index object (LAYER_INDEX).

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

A layer index is a list showing which objects are on which layers.

This list is used when the program is referencing the drawing in conjunction with demand loading to determine which objects need to be read in and displayed.

Objects on frozen layers in a referenced drawing are not read in if the referenced drawing has a layer index and is being demand loaded.

Layer indexes are best used in drawings that will be used as xrefs in other drawings where demand loading is enabled.

Drawings that are not going to be used as xrefs or partially opened will not benefit from layer and spatial indexing or demand loading.

Note:
To receive the maximum benefit of demand loading, it is recommended that you save any drawings that are used as xrefs with layer and spatial indexes.
Since:
The LAYER_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 layer_index.h.


Typedef Documentation

DXF definition of an AutoCAD idbuffer object (LAYER_INDEX).


Function Documentation

DxfLayerIndex* dxf_layer_index_new ( )

Allocate memory for a DxfLayerIndex.

Fill the memory contents with zeros.

Definition at line 71 of file layer_index.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_layer_index_init(), and dxf_layer_index_read().

DxfLayerIndex* dxf_layer_index_init ( DxfLayerIndex layer_index)

Allocate memory and initialize data fields in a LAYER_INDEX object.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Parameters:
layer_indexDXF LAYER_INDEX object.

Definition at line 109 of file layer_index.c.

References _, dxf_layer_index_struct::dictionary_owner_hard, dxf_layer_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_layer_index_new(), dxf_layer_name_init(), dxf_layer_name_new(), DXF_MAX_PARAM, dxf_layer_index_struct::hard_owner_reference, dxf_layer_index_struct::id_code, dxf_layer_index_struct::layer_name, dxf_layer_name_struct::name, dxf_layer_index_struct::next, dxf_layer_index_struct::number_of_entries, and dxf_layer_index_struct::time_stamp.

Referenced by dxf_layer_index_read().

Here is the call graph for this function:

DxfLayerIndex* dxf_layer_index_read ( DxfFile fp,
DxfLayerIndex layer_index 
)

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

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

Returns:
a pointer to layer_index.

Todo:
Check for overrun of array index.

Parameters:
fpDXF file pointer to an input file (or device).
layer_indexDXF LAYER_INDEX object.

Definition at line 167 of file layer_index.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_layer_index_struct::dictionary_owner_hard, dxf_layer_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_layer_index_init(), dxf_layer_index_new(), dxf_layer_name_init(), dxf_file_struct::filename, dxf_file_struct::fp, dxf_layer_index_struct::hard_owner_reference, dxf_layer_index_struct::id_code, dxf_layer_index_struct::layer_name, dxf_file_struct::line_number, dxf_layer_name_struct::name, dxf_layer_name_struct::next, dxf_layer_index_struct::number_of_entries, and dxf_layer_index_struct::time_stamp.

Here is the call graph for this function:

int dxf_layer_index_write ( DxfFile fp,
DxfLayerIndex layer_index 
)

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

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.

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.
Todo:
Check for overrun of array index.

Parameters:
fpDXF file pointer to an output file (or device).
layer_indexDXF LAYER_INDEX object.

Definition at line 333 of file layer_index.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_13, AutoCAD_14, dxf_layer_index_struct::dictionary_owner_hard, dxf_layer_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_file_struct::fp, dxf_layer_index_struct::hard_owner_reference, dxf_layer_index_struct::id_code, dxf_layer_index_struct::layer_name, dxf_layer_name_struct::name, dxf_layer_name_struct::next, dxf_layer_index_struct::number_of_entries, and dxf_layer_index_struct::time_stamp.

int dxf_layer_index_free ( DxfLayerIndex layer_index)

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

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

Definition at line 441 of file layer_index.c.

References _, dxf_layer_index_struct::dictionary_owner_hard, dxf_layer_index_struct::dictionary_owner_soft, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_layer_name_free_chain(), DXF_MAX_PARAM, dxf_layer_index_struct::hard_owner_reference, dxf_layer_index_struct::layer_name, and dxf_layer_index_struct::next.

Referenced by dxf_layer_index_free_chain().

Here is the call graph for this function:

void dxf_layer_index_free_chain ( DxfLayerIndex layer_indices)

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

Parameters:
layer_indicespointer to the chain of DXF LAYER_INDEX objects.

Definition at line 489 of file layer_index.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_layer_index_free(), and dxf_layer_index_struct::next.

Here is the call graph for this function:

int dxf_layer_index_get_id_code ( DxfLayerIndex layer_index)

Get the ID code from a DXF LAYER_INDEX object.

Returns:
ID code.
Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.

Definition at line 522 of file layer_index.c.

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

DxfLayerIndex* dxf_layer_index_set_id_code ( DxfLayerIndex layer_index,
int  id_code 
)

Set the ID code for a DXF LAYER_INDEX object.

Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.
id_codeIdentification number for the object.
This is to be an unique (sequential) number in the DXF file.

Definition at line 557 of file layer_index.c.

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

char* dxf_layer_index_get_dictionary_owner_soft ( DxfLayerIndex layer_index)

Get the soft pointer to the dictionary owner from a DXF LAYER_INDEX object.

Returns:
soft pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.

Definition at line 602 of file layer_index.c.

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

DxfLayerIndex* dxf_layer_index_set_dictionary_owner_soft ( DxfLayerIndex layer_index,
char *  dictionary_owner_soft 
)

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

Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.
dictionary_owner_softa string containing the pointer to the dictionary_owner_soft for the entity.

Definition at line 638 of file layer_index.c.

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

char* dxf_layer_index_get_dictionary_owner_hard ( DxfLayerIndex layer_index)

Get the hard pointer to the dictionary owner from a DXF LAYER_INDEX object.

Returns:
hard pointer to the dictionary owner.
Warning:
No checks are performed on the returned pointer (string).
Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.

Definition at line 682 of file layer_index.c.

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

DxfLayerIndex* dxf_layer_index_set_dictionary_owner_hard ( DxfLayerIndex layer_index,
char *  dictionary_owner_hard 
)

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

Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.
dictionary_owner_harda string containing the pointer to the dictionary_owner_hard for the entity.

Definition at line 718 of file layer_index.c.

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

double dxf_layer_index_get_time_stamp ( DxfLayerIndex layer_index)

Get the time_stamp from a DXF LAYER_INDEX object.

Returns:
time_stamp.
Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.

Definition at line 759 of file layer_index.c.

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

DxfLayerIndex* dxf_layer_index_set_time_stamp ( DxfLayerIndex layer_index,
double  time_stamp 
)

Set the radius for a DXF LAYER_INDEX object.

Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.
time_stampthe time_stamp to be set for the object.

Definition at line 794 of file layer_index.c.

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

DxfLayerIndex* dxf_layer_index_get_next ( DxfLayerIndex layer_index)

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

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

Definition at line 837 of file layer_index.c.

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

DxfLayerIndex* dxf_layer_index_set_next ( DxfLayerIndex layer_index,
DxfLayerIndex next 
)

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

Parameters:
layer_indexa pointer to a DXF LAYER_INDEX object.
nexta pointer to the next LAYER_INDEX object for the object.

Definition at line 873 of file layer_index.c.

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

DxfLayerIndex* dxf_layer_index_get_last ( DxfLayerIndex layer_index)

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

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

Definition at line 917 of file layer_index.c.

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