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

viewport.h File Reference

Header file for a DXF viewport entity (VIEWPORT). More...

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

Go to the source code of this file.

Data Structures

struct  dxf_viewport
 DXF definition of an AutoCAD viewport entity (VIEWPORT). More...

Typedefs

typedef struct dxf_viewport DxfViewport
 DXF definition of an AutoCAD viewport entity (VIEWPORT).

Functions

DxfViewportdxf_viewport_new ()
 Allocate memory for a DxfViewport.
DxfViewportdxf_viewport_init (DxfViewport *viewport)
 Allocate memory and initialize data fields in a VIEWPORT entity.
DxfViewportdxf_viewport_read (DxfFile *fp, DxfViewport *viewport)
 Read data from a DXF file into an VIEWPORT entity.
int dxf_viewport_write (DxfFile *fp, DxfViewport *viewport)
 Write DXF output for a viewport entity ( VIEWPORT ).
int dxf_viewport_free (DxfViewport *viewport)
 Free the allocated memory for a DXF VIEWPORT and all it's data fields.
void dxf_viewport_free_chain (DxfViewport *viewports)
 Free the allocated memory for a chain of DXF VIEWPORT entities and all their data fields.

Detailed Description

Header file for a DXF viewport entity (VIEWPORT).

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

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 viewport.h.


Typedef Documentation

typedef struct dxf_viewport DxfViewport

DXF definition of an AutoCAD viewport entity (VIEWPORT).

In addition, the extended entity data groups in the following struct apply to viewports.

Warning:
In contrast to normal entity data, the same extended entity group code can appear multiple times, and so order is important.
Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12.
According to DXF R13.
According to DXF R14.

Function Documentation

DxfViewport* dxf_viewport_new ( )

Allocate memory for a DxfViewport.

Fill the memory contents with zeros.

Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12.
According to DXF R13.
According to DXF R14.

Definition at line 50 of file viewport.c.

References _, DXF_DEBUG_BEGIN, and DXF_DEBUG_END.

Referenced by dxf_viewport_init(), and dxf_viewport_read().

DxfViewport* dxf_viewport_init ( DxfViewport viewport)

Allocate memory and initialize data fields in a VIEWPORT entity.

Returns:
NULL when no memory was allocated, a pointer to the allocated memory when succesful.
Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12.
According to DXF R13.
According to DXF R14.

Todo:
Implement the number of layers in a more efficient way. A lot of memory is consumed by reserving for DXF_MAX_LAYERS instead of the actual existing number of layers. Maybe this can be solved by dynamically allocating a reasonable number of layers during compile time, and (re-allocating) shrinking when the actual number of layers is known during run time.

Parameters:
viewporta pointer to the DXF VIEWPORT entity.

Definition at line 94 of file viewport.c.

References _, dxf_viewport::app_name, dxf_viewport::back_plane_offset, dxf_viewport::circle_zoom_percent, dxf_viewport::color, dxf_viewport::dictionary_owner_hard, dxf_viewport::dictionary_owner_soft, DXF_COLOR_BYLAYER, DXF_DEBUG_BEGIN, DXF_DEBUG_END, DXF_DEFAULT_LAYER, DXF_DEFAULT_LINETYPE, DXF_DEFAULT_LINETYPE_SCALE, DXF_DEFAULT_VISIBILITY, DXF_MAX_LAYERS, DXF_PAPERSPACE, dxf_viewport_new(), dxf_viewport::elevation, dxf_viewport::extended_entity_data_version, dxf_viewport::fast_zoom_setting, dxf_viewport::front_plane_offset, dxf_viewport::frozen_layer_list_begin, dxf_viewport::frozen_layer_list_end, dxf_viewport::frozen_layers, dxf_viewport::grid_on, dxf_viewport::height, dxf_viewport::id, dxf_viewport::id_code, dxf_viewport::layer, dxf_viewport::linetype, dxf_viewport::linetype_scale, dxf_viewport::next, dxf_viewport::paperspace, dxf_viewport::perspective_lens_length, dxf_viewport::plot_flag, dxf_viewport::snap_isopair, dxf_viewport::snap_on, dxf_viewport::snap_rotation_angle, dxf_viewport::snap_style, dxf_viewport::status, dxf_viewport::thickness, dxf_viewport::UCSICON_setting, dxf_viewport::view_height, dxf_viewport::view_mode, dxf_viewport::view_twist_angle, dxf_viewport::viewport_data, dxf_viewport::visibility, dxf_viewport::width, dxf_viewport::window_descriptor_begin, dxf_viewport::window_descriptor_end, dxf_viewport::x0, dxf_viewport::x_center, dxf_viewport::x_direction, dxf_viewport::x_grid_spacing, dxf_viewport::x_snap_base, dxf_viewport::x_snap_spacing, dxf_viewport::x_target, dxf_viewport::y0, dxf_viewport::y_center, dxf_viewport::y_direction, dxf_viewport::y_grid_spacing, dxf_viewport::y_snap_base, dxf_viewport::y_snap_spacing, dxf_viewport::y_target, dxf_viewport::z0, dxf_viewport::z_direction, and dxf_viewport::z_target.

Referenced by dxf_viewport_read().

Here is the call graph for this function:

DxfViewport* dxf_viewport_read ( DxfFile fp,
DxfViewport viewport 
)

Read data from a DXF file into an VIEWPORT entity.

The last line read from file contained the string "VIEWPORT".
Now follows some data for the VIEWPORT, 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 viewport.

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
fpDXF file pointer to an input file (or device).
viewporta pointer to the DXF VIEWPORT entity.

Definition at line 212 of file viewport.c.

References _, dxf_file_struct::acad_version_number, dxf_viewport::app_name, AutoCAD_11, dxf_viewport::back_plane_offset, dxf_viewport::circle_zoom_percent, dxf_viewport::color, DXF_DEBUG_BEGIN, DXF_DEBUG_END, DXF_DEFAULT_LAYER, DXF_DEFAULT_LINETYPE, DXF_MAX_LAYERS, dxf_viewport_init(), dxf_viewport_new(), dxf_viewport::extended_entity_data_version, dxf_viewport::fast_zoom_setting, dxf_file_struct::filename, dxf_file_struct::fp, dxf_viewport::front_plane_offset, dxf_viewport::frozen_layer_list_begin, dxf_viewport::frozen_layer_list_end, dxf_viewport::frozen_layers, dxf_viewport::grid_on, dxf_viewport::height, dxf_viewport::id, dxf_viewport::id_code, dxf_viewport::layer, dxf_file_struct::line_number, dxf_viewport::linetype, dxf_viewport::linetype_scale, dxf_viewport::paperspace, dxf_viewport::perspective_lens_length, dxf_viewport::plot_flag, dxf_viewport::snap_isopair, dxf_viewport::snap_on, dxf_viewport::snap_rotation_angle, dxf_viewport::snap_style, dxf_viewport::status, dxf_viewport::thickness, dxf_viewport::UCSICON_setting, dxf_viewport::view_height, dxf_viewport::view_mode, dxf_viewport::view_twist_angle, dxf_viewport::viewport_data, dxf_viewport::visibility, dxf_viewport::width, dxf_viewport::window_descriptor_begin, dxf_viewport::window_descriptor_end, dxf_viewport::x0, dxf_viewport::x_center, dxf_viewport::x_direction, dxf_viewport::x_snap_base, dxf_viewport::x_snap_spacing, dxf_viewport::x_target, dxf_viewport::y0, dxf_viewport::y_center, dxf_viewport::y_direction, dxf_viewport::y_snap_base, dxf_viewport::y_snap_spacing, dxf_viewport::y_target, dxf_viewport::z0, dxf_viewport::z_direction, and dxf_viewport::z_target.

Here is the call graph for this function:

int dxf_viewport_write ( DxfFile fp,
DxfViewport viewport 
)

Write DXF output for a viewport entity ( VIEWPORT ).

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12.
According to DXF R13.
According to DXF R14.

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).
viewporta pointer to the DXF VIEWPORT entity.

Definition at line 1033 of file viewport.c.

References _, dxf_file_struct::acad_version_number, AutoCAD_11, AutoCAD_13, AutoCAD_14, dxf_viewport::back_plane_offset, dxf_viewport::circle_zoom_percent, dxf_viewport::color, dxf_viewport::dictionary_owner_hard, dxf_viewport::dictionary_owner_soft, DXF_COLOR_BYLAYER, DXF_DEBUG_BEGIN, DXF_DEBUG_END, DXF_DEFAULT_LAYER, DXF_DEFAULT_LINETYPE, DXF_FLATLAND, DXF_MAX_LAYERS, DXF_PAPERSPACE, DXF_VIEWPORT_APP_NAME, DXF_VIEWPORT_DATA, DXF_VIEWPORT_FROZEN_LAYER_LIST_BEGIN, DXF_VIEWPORT_FROZEN_LAYER_LIST_END, DXF_VIEWPORT_WINDOW_BEGIN, DXF_VIEWPORT_WINDOW_END, dxf_viewport::elevation, dxf_viewport::extended_entity_data_version, dxf_viewport::fast_zoom_setting, dxf_file_struct::fp, dxf_viewport::front_plane_offset, dxf_viewport::frozen_layers, dxf_viewport::grid_on, dxf_viewport::height, dxf_viewport::id, dxf_viewport::id_code, dxf_viewport::layer, dxf_viewport::linetype, dxf_viewport::linetype_scale, dxf_viewport::paperspace, dxf_viewport::perspective_lens_length, dxf_viewport::plot_flag, dxf_viewport::snap_isopair, dxf_viewport::snap_on, dxf_viewport::snap_rotation_angle, dxf_viewport::snap_style, dxf_viewport::status, dxf_viewport::thickness, dxf_viewport::UCSICON_setting, dxf_viewport::view_height, dxf_viewport::view_mode, dxf_viewport::view_twist_angle, dxf_viewport::visibility, dxf_viewport::width, dxf_viewport::x0, dxf_viewport::x_center, dxf_viewport::x_direction, dxf_viewport::x_grid_spacing, dxf_viewport::x_snap_base, dxf_viewport::x_snap_spacing, dxf_viewport::x_target, dxf_viewport::y0, dxf_viewport::y_center, dxf_viewport::y_direction, dxf_viewport::y_grid_spacing, dxf_viewport::y_snap_base, dxf_viewport::y_snap_spacing, dxf_viewport::y_target, dxf_viewport::z0, dxf_viewport::z_direction, and dxf_viewport::z_target.

int dxf_viewport_free ( DxfViewport viewport)

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

Returns:
EXIT_SUCCESS when done, or EXIT_FAILURE when an error occurred.
Version:
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
viewporta pointer to the memory occupied by the DXF VIEWPORT entity.

Definition at line 1227 of file viewport.c.

References _, dxf_viewport::app_name, DXF_DEBUG_BEGIN, DXF_DEBUG_END, DXF_MAX_LAYERS, dxf_viewport::frozen_layer_list_begin, dxf_viewport::frozen_layer_list_end, dxf_viewport::frozen_layers, dxf_viewport::layer, dxf_viewport::linetype, dxf_viewport::next, dxf_viewport::viewport_data, dxf_viewport::window_descriptor_begin, and dxf_viewport::window_descriptor_end.

Referenced by dxf_viewport_free_chain().

void dxf_viewport_free_chain ( DxfViewport viewports)

Free the allocated memory for a chain of DXF VIEWPORT entities and all their data fields.

Version:
According to DXF R10 (backward compatibility).
According to DXF R11 (backward compatibility).
According to DXF R12.
According to DXF R13.
According to DXF R14.
Parameters:
viewportsa pointer to the chain of DXF VIEWPORT entities.

Definition at line 1289 of file viewport.c.

References _, DXF_DEBUG_BEGIN, DXF_DEBUG_END, dxf_viewport_free(), and dxf_viewport::next.

Here is the call graph for this function: