📄 line.c
字号:
/****************************************************************/
/* COPYRIGHT NOTICE */
/* ---------------- */
/* All software in this listing remain the strict copyright */
/* of Ilija Kovacevic and cannot be copied or used in any way */
/* except by written permission of Ilija Kovacevic. */
/* */
/* Copyright (c) 1992 Ilija Kovacevic */
/* www.kov.com email ilija@kov.com */
/****************************************************************/
#include "dwgin.h"
PUBLIC AcadLine *AcadLine__create( void )
{
return( ( AcadLine * )get_memory( sizeof( AcadLine ) ) );
}
PUBLIC void AcadLine__delete( AcadLine *me )
{
free( ( char * )me );
}
PUBLIC int AcadLine__length( AcadLine *me )
{
return( me->common.size );
}
PUBLIC void AcadLine__read( AcadLine *me )
{
AcadEntity__read_elevation_etc( &me->common,!__drawing->acad10 AND !__drawing->acad11,true );
get_DOUBLE( &me->x1 );
get_DOUBLE( &me->y1 );
me->z1 = me->z2 = 0.0;
if ( ( __drawing->acad10 OR __drawing->acad11 ) AND !(me->common.info&0x4) )
{
get_DOUBLE( &me->z1 );
}
get_DOUBLE( &me->x2 );
get_DOUBLE( &me->y2 );
if ( __drawing->acad10 OR __drawing->acad11 )
{
if ( !(me->common.info&0x4) ) get_DOUBLE( &me->z2 );
if ( me->common.pflags&0x1 ) AcadEntity__get_ucs_directions( &me->common );
}
}
PUBLIC void AcadLine__dump_to_debug_file( AcadLine *me )
{
dprintf( "LINE\n" );
dprintf( "\tfrom %lf,%lf,%lf to %lf,%lf,%lf\n",me->x1,me->y1,me->z1,me->x2,me->y2,me->z2 );
}
PUBLIC void AcadLine__dxfout( AcadLine *me )
{
dxf_string( 0,"LINE" );
AcadEntity__dxfout( &me->common );
dxf_DOUBLE( 10,me->x1 );
dxf_DOUBLE( 20,me->y1 );
if ( __drawing->header->flatland OR __drawing->acad11 ) dxf_DOUBLE( 30,me->z1 );
dxf_DOUBLE( 11,me->x2 );
dxf_DOUBLE( 21,me->y2 );
if ( __drawing->header->flatland OR __drawing->acad11 ) dxf_DOUBLE( 31,me->z2 );
AcadEntity__dxfout_ucs( &me->common );
}
PUBLIC void AcadLine__write( AcadLine *me )
{
int size;
put_UINT8( 1 ); /* LINE TYPE */
size = sizeof( DOUBLE )*4+1;
if ( me->common.ucs ) size += sizeof( DOUBLE )*3;
if ( !(me->common.info&0x4) ) size += sizeof( DOUBLE )*2;
AcadEntity__write_elevation_etc( &me->common,false,true,size );
if ( debugger ) dprintf( "\tline entity\n" );
put_DOUBLE( me->x1 );
put_DOUBLE( me->y1 );
if ( !(me->common.info&0x4) ) put_DOUBLE( me->z1 );
put_DOUBLE( me->x2 );
put_DOUBLE( me->y2 );
if ( !(me->common.info&0x4) ) put_DOUBLE( me->z2 );
if ( me->common.ucs ) AcadEntity__put_ucs_directions( &me->common );
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -