Merge trunk @ 5464

This commit is contained in:
Garth Corral 2015-03-01 17:24:28 -08:00
commit 1af9315006
156 changed files with 2739 additions and 1913 deletions

View File

@ -83,6 +83,18 @@ EDA_3D_CANVAS::EDA_3D_CANVAS( EDA_3D_FRAME* parent, int* attribList ) :
{
m_init = false;
m_shadow_init = false;
// set an invalide value to not yet initialized indexes managing
// textures created to enhance 3D rendering
// (they are dummy values but we do not want uninitialized values)
m_text_pcb = m_text_silk = -1;
m_text_fake_shadow_front = -1;
m_text_fake_shadow_back = -1;
m_text_fake_shadow_board = -1;
// position of the front and back layers
// (will be initialized to a better value later)
m_ZBottom = 0.0;
m_ZTop = 0.0;
// Clear all gl list identifiers:
for( int ii = GL_ID_BEGIN; ii < GL_ID_END; ii++ )

View File

@ -83,9 +83,10 @@ private:
double m_ZBottom; // position of the back layer
double m_ZTop; // position of the front layer
GLuint m_text_pcb;
GLuint m_text_silk;
GLuint m_text_pcb; // an index to the texture generated for pcb texts
GLuint m_text_silk; // an index to the texture generated for silk layers
// Index to the textures generated for shadows
bool m_shadow_init;
GLuint m_text_fake_shadow_front;
GLuint m_text_fake_shadow_back;

View File

@ -66,6 +66,7 @@ INFO3D_VISU::INFO3D_VISU()
m_epoxyThickness = 0;
m_nonCopperLayerThickness = 0;
m_BiuTo3Dunits = 1.0;
zpos_offset = 0.0;
// Set copper color, in realistic mode
#define LUMINANCE 0.7/255.0

View File

@ -41,6 +41,9 @@ VRML1_MODEL_PARSER::VRML1_MODEL_PARSER( S3D_MASTER* aMaster ) :
{
m_model = NULL;
m_file = NULL;
m_Materials = NULL;
m_normalPerVertex = true;
colorPerVertex = true;
}

View File

@ -253,15 +253,14 @@ int VRML2_MODEL_PARSER::read_Transform()
}
/**
* Read the DEF for a Coordinate
*/
int VRML2_MODEL_PARSER::read_DEF_Coordinate()
{
char text[128];
// Get the name of the definition.
GetNextTag( m_file, text, sizeof(text) );
if( !GetNextTag( m_file, text, sizeof(text) ) )
return -1;
std::string coordinateName = text;
while( GetNextTag( m_file, text, sizeof(text) ) )
@ -291,7 +290,8 @@ int VRML2_MODEL_PARSER::read_DEF()
{
char text[128];
GetNextTag( m_file, text, sizeof(text) );
if( !GetNextTag( m_file, text, sizeof(text) ) )
return -1;
while( GetNextTag( m_file, text, sizeof(text) ) )
{
@ -348,7 +348,9 @@ int VRML2_MODEL_PARSER::read_USE()
char text[128];
// Get the name of the definition.
GetNextTag( m_file, text, sizeof(text) );
if( !GetNextTag( m_file, text, sizeof(text) ) )
return -1;
std::string coordinateName = text;
// Look for it in our coordinate map.

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -44,6 +44,7 @@
X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) :
S3D_MODEL_PARSER( aMaster )
{
m_model = NULL;
}
@ -52,7 +53,7 @@ X3D_MODEL_PARSER::~X3D_MODEL_PARSER()
}
void X3D_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3Dunits )
void X3D_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlUnitsTo3DUnits )
{
wxXmlDocument doc;
@ -69,7 +70,7 @@ void X3D_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3Du
}
float vrmlunits_to_3Dunits = aVrmlunits_to_3Dunits;
float vrmlunits_to_3Dunits = aVrmlUnitsTo3DUnits;
glScalef( vrmlunits_to_3Dunits, vrmlunits_to_3Dunits, vrmlunits_to_3Dunits );
glm::vec3 matScale( GetMaster()->m_MatScale.x, GetMaster()->m_MatScale.y,

View File

@ -223,6 +223,11 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
endif()
endif()
# The MinGW compiler can use the microsoft system snprintf as standard and it has a broken
# API with respect to the C99 standard, so make sure we force it to use its own compliant
# snprintf
add_definitions(-D__USE_MINGW_ANSI_STDIO=1)
else()
# We build DLL/DSOs from static libraries, so create position independent
# code for all cases, since we do not have DLL/DSO specific static

View File

@ -64,7 +64,7 @@
/// The install prefix used for KiCad's libraries.
/// These paths are only intended to be reasonable default values that work if
/// the user installs KiCad in the default path for a given platform.
#if defined( APPLE )
#if defined( __APPLE__ )
#define KICAD_DATA_PATH "/Library/Application Support/kicad"
#else
#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@"

View File

@ -58,6 +58,7 @@ BITMAP_BASE::BITMAP_BASE( const wxPoint& pos )
BITMAP_BASE::BITMAP_BASE( const BITMAP_BASE& aSchBitmap )
{
m_Scale = aSchBitmap.m_Scale;
m_ppi = aSchBitmap.m_ppi;
m_pixelScaleFactor = aSchBitmap.m_pixelScaleFactor;
m_image = new wxImage( *aSchBitmap.m_image );
m_bitmap = new wxBitmap( *m_image );

View File

@ -206,7 +206,11 @@ wxString GetAbbreviatedUnitsLabel( EDA_UNITS_T aUnit )
break;
case DEGREES:
wxASSERT( false );
label = _( "deg" );
break;
default:
label = wxT( "??" );
break;
}

View File

@ -2,6 +2,28 @@
* @file common_plotDXF_functions.cpp
* @brief KiCad: Common plot DXF Routines.
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* 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, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <gr_basic.h>

View File

@ -221,6 +221,8 @@ void HPGL_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
paperSize.y *= 10.0 * aIusPerDecimil;
SetDefaultLineWidth( 0 ); // HPGL has pen sizes instead
m_plotMirror = aMirror;
penOverlap = 0;
penDiameter = 0;
}

View File

@ -452,7 +452,8 @@ void PDF_PLOTTER::closePdfStream()
{
wxASSERT( workFile );
int stream_len = ftell( workFile );
long stream_len = ftell( workFile );
wxASSERT( stream_len >= 0 );
// Rewind the file, read in the page stream and DEFLATE it
fseek( workFile, 0, SEEK_SET );
@ -468,7 +469,7 @@ void PDF_PLOTTER::closePdfStream()
::wxRemoveFile( workFilename );
// NULL means memos owns the memory, but provide a hint on optimum size needed.
wxMemoryOutputStream memos( NULL, std::max( 2000, stream_len ) ) ;
wxMemoryOutputStream memos( NULL, std::max( 2000l, stream_len ) ) ;
{
/* Somewhat standard parameters to compress in DEFLATE. The PDF spec is

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2007-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -91,22 +91,16 @@ END_EVENT_TABLE()
EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
const wxPoint& pos, const wxSize& size ) :
#if wxCHECK_VERSION( 2, 9, 5 )
wxScrolledWindow( parent, id, pos, size, wxBORDER | wxHSCROLL | wxVSCROLL )
#else
wxScrolledWindow( parent, id, pos, size, wxBORDER | wxHSCROLL | wxVSCROLL | wxALWAYS_SHOW_SB )
#endif
{
wxASSERT( parent );
#if wxCHECK_VERSION( 2, 9, 5 )
#ifndef USE_OSX_MAGNIFY_EVENT
ShowScrollbars( wxSHOW_SB_ALWAYS, wxSHOW_SB_ALWAYS );
#else
ShowScrollbars( wxSHOW_SB_NEVER, wxSHOW_SB_NEVER );
#endif
DisableKeyboardScrolling();
#endif
m_scrollIncrementX = std::min( size.x / 8, 10 );
m_scrollIncrementY = std::min( size.y / 8, 10 );

View File

@ -3,7 +3,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2007-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -50,9 +50,10 @@ void DSNLEXER::init()
specctraMode = false;
space_in_quoted_tokens = false;
commentsAreTokens = false;
curOffset = 0;
#if 1
if( keywordCount > 11 )
{

View File

@ -35,9 +35,9 @@
// Conversion to application internal units defined at build time.
#if defined( PCBNEW )
#include <class_board_item.h>
#include <class_board_item.h> // for FMT_IU
#elif defined( EESCHEMA )
#include <sch_item_struct.h>
#include <sch_item_struct.h> // for FMT_IU
#elif defined( GERBVIEW )
#elif defined( PL_EDITOR )
#include <base_units.h>

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-12 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -701,7 +701,8 @@ const wxString FP_LIB_TABLE::GlobalPathEnvVariableName()
}
bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR )
bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable )
throw (IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception )
{
bool tableExists = true;
wxFileName fn = GetGlobalTableFileName();
@ -761,7 +762,8 @@ void FP_LIB_TABLE::Load( const wxString& aFileName )
}
void FP_LIB_TABLE::Save( const wxString& aFileName ) const throw( IO_ERROR )
void FP_LIB_TABLE::Save( const wxString& aFileName )
const throw( IO_ERROR, boost::interprocess::lock_exception )
{
FILE_OUTPUTFORMATTER sf( aFileName );
Format( &sf, 0 );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -57,7 +57,9 @@ KIWAY_PLAYER::KIWAY_PLAYER( wxWindow* aParent, wxWindowID aId, const wxString& a
EDA_BASE_FRAME( aParent, (FRAME_T) aId, aTitle, aPos, aSize, aStyle, aWdoName ),
KIWAY_HOLDER( 0 ),
m_modal( false ),
m_modal_loop( 0 ), m_modal_resultant_parent( 0 )
m_modal_loop( 0 ),
m_modal_resultant_parent( 0 ),
m_modal_ret_val( false )
{
// DBG( printf("KIWAY_EXPRESS::wxEVENT_ID:%d\n", KIWAY_EXPRESS::wxEVENT_ID );)
}

View File

@ -35,137 +35,6 @@
#include <class_board.h>
#include <3d_viewer.h>
/**
* attempts to set the environment variable given by aKiSys3Dmod to a valid path.
* (typically "KISYS3DMOD" )
* If the environment variable is already set, then it left as is to respect
* the wishes of the user.
*
* The path is determined by attempting to find the path modules/packages3d
* files in kicad tree.
* This may or may not be the best path but it provides the best solution for
* backwards compatibility with the previous 3D shapes search path implementation.
*
* @note This must be called after #SetBinDir() is called at least on Windows.
* Otherwise, the kicad path is not known (Windows specific)
*
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
* @param aProcess = the current process
* @return false if the aKiSys3Dmod path is not valid.
*/
bool Set3DShapesDefaultPath( const wxString& aKiSys3Dmod, const PGM_BASE* aProcess )
{
wxString path;
// Set the KISYS3DMOD environment variable for the current process,
// if it is not already defined in the user's environment and valid.
if( wxGetEnv( aKiSys3Dmod, &path ) && wxFileName::DirExists( path ) )
return true;
#if 1
// Try to find a valid path is standard KiCad paths
SEARCH_STACK& search = Kiface().KifaceSearch();
path = search.FindValidPath( LIB3D_FOLDER );
if( !path.IsEmpty() )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#endif
// Attempt to determine where the 3D shape libraries were installed using the
// legacy path:
// on Unix: /usr/local/kicad/share/modules/packages3d
// oor /usr/local/kicad/share/kicad/modules/packages3d
// or /usr/share/kicad/modules/packages3d
// On Windows: bin../share/modules/packages3d
wxString relpath( wxT( "modules/" ) );
relpath += LIB3D_FOLDER;
// Apple MacOSx
#ifdef __WXMAC__
path = wxT("/Library/Application Support/kicad/modules/packages3d/");
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
path = wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT("/Library/Application Support/kicad/modules/packages3d/");
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#elif defined(__UNIX__) // Linux and non-Apple Unix
// Try the home directory:
path.Empty();
wxGetEnv( wxT("HOME"), &path );
path += wxT("/kicad/share/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
path.Empty();
wxGetEnv( wxT("HOME"), &path );
path += wxT("/kicad/share/kicad/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
// Try the standard install path:
path = wxT("/usr/local/kicad/share/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
// Try the new standard install path:
path = wxT("/usr/local/kicad/share/kicad/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
// Try the official distrib standard install path:
path = wxT("/usr/share/kicad/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#else // Windows
// On Windows, the install path is given by the path of executables
wxFileName fn;
fn.AssignDir( aProcess->GetExecutablePath() );
fn.RemoveLastDir();
path = fn.GetPathWithSep() + wxT("share/") + relpath;
if( wxFileName::DirExists( path ) )
{
wxSetEnv( aKiSys3Dmod, path );
return true;
}
#endif
return false;
}
wxString LayerMaskDescribe( const BOARD *aBoard, LSET aMask )
{

View File

@ -37,6 +37,7 @@
#include <wx/filename.h>
#include <wx/snglinst.h>
#include <wx/stdpaths.h>
#include <wx/sysopt.h>
#include <pgm_base.h>
#include <wxstruct.h>
@ -426,11 +427,15 @@ bool PGM_BASE::initPgm()
// Set locale option for separator used in float numbers
SetLocaleTo_Default();
#ifdef __WXMAC__
// Always show filters on Open dialog to be able to choose plugin
wxSystemOptions::SetOption( wxOSX_FILEDIALOG_ALWAYS_SHOW_TYPES, 1 );
#endif
return true;
}
bool PGM_BASE::setExecutablePath()
{
m_bin_dir = wxStandardPaths::Get().GetExecutablePath();

View File

@ -181,11 +181,6 @@ bool IFACE::OnKifaceStart( PGM_BASE* aProgram, int aCtlBits )
start_common( aCtlBits );
// Set 3D shape path (environment variable KISYS3DMOD (if not defined or valid)
// Currently, called here, but could be moved ( OpenProjectFiles() ? )
// if KISYS3DMOD is defined in a project config file
Set3DShapesDefaultPath( KISYS3DMOD, aProgram );
/* Now that there are no *.mod files in the standard library, this function
has no utility. User should simply set the variable manually.
Looking for *.mod files which do not exist is fruitless.

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -48,7 +48,8 @@
#include <wx/choicdlg.h>
void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfReferences ) throw( IO_ERROR )
void SCH_EDIT_FRAME::backAnnotateFootprints( const std::string& aChangedSetOfReferences )
throw( IO_ERROR, boost::bad_pointer )
{
// Build a flat list of components in schematic:
SCH_REFERENCE_LIST refs;

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2009-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -397,7 +397,12 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{
schitem = (SCH_ITEM*) block->GetItem( ii );
schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
if( schitem->Type() == SCH_COMPONENT_T )
((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
g_XorMode, g_GhostColor, false );
else
schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
}
}
@ -408,7 +413,12 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
for( unsigned ii = 0; ii < block->GetCount(); ii++ )
{
schitem = (SCH_ITEM*) block->GetItem( ii );
schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
if( schitem->Type() == SCH_COMPONENT_T )
((SCH_COMPONENT*)schitem)->Draw( aPanel, aDC, block->GetMoveVector(),
g_XorMode, g_GhostColor, false );
else
schitem->Draw( aPanel, aDC, block->GetMoveVector(), g_XorMode, g_GhostColor );
}
}

View File

@ -442,7 +442,7 @@ void SCH_EDIT_FRAME::RepeatDrawItem( wxDC* DC )
( (SCH_COMPONENT*) my_clone )->SetTimeStamp( GetNewTimeStamp() );
my_clone->Move( pos );
my_clone->Draw( m_canvas, DC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( my_clone, DC );
PrepareMoveItem( my_clone, DC );
}
else
{

View File

@ -245,9 +245,9 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) :
LIB_PART::~LIB_PART()
{
wxLogTrace( traceSchLibMem,
wxT( "%s: destroying part '%s' with alias list count of %u." ),
wxT( "%s: destroying part '%s' with alias list count of %llu." ),
GetChars( wxString::FromAscii( __WXFUNCTION__ ) ), GetChars( GetName() ),
m_aliases.size() );
(long long unsigned) m_aliases.size() );
// If the part is being deleted directly rather than through the library,
// delete all of the aliases.
@ -1697,11 +1697,11 @@ LIB_ALIAS* LIB_PART::RemoveAlias( LIB_ALIAS* aAlias )
bool rename = aAlias->IsRoot();
wxLogTrace( traceSchLibMem,
wxT( "%s: part:'%s', alias:'%s', alias count %u, reference count %d." ),
wxT( "%s: part:'%s', alias:'%s', alias count %llu, reference count %ld." ),
GetChars( wxString::FromAscii( __WXFUNCTION__ ) ),
GetChars( m_name ),
GetChars( aAlias->GetName() ),
m_aliases.size(),
(long long unsigned) m_aliases.size(),
m_me.use_count() );
it = m_aliases.erase( it );

View File

@ -63,6 +63,8 @@ PART_LIB::PART_LIB( int aType, const wxString& aFileName ) :
timeStamp = 0;
isCache = false;
timeStamp = wxDateTime::Now();
versionMajor = 0; // Will be updated after reading the lib file
versionMinor = 0; // Will be updated after reading the lib file
fileName = aFileName;
@ -804,7 +806,8 @@ PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName ) throw( IO_ERROR, bo
}
PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName, PART_LIBS::iterator& aIterator ) throw( IO_ERROR )
PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName, PART_LIBS::iterator& aIterator )
throw( IO_ERROR, boost::bad_pointer )
{
#if 1
// Don't reload the library if it is already loaded.

View File

@ -134,8 +134,8 @@ public:
* @return PART_LIB* - the new PART_LIB, which remains owned by this PART_LIBS container.
* @throw IO_ERROR if there's any problem loading.
*/
PART_LIB* AddLibrary( const wxString& aFileName,
PART_LIBS::iterator& aIterator ) throw( IO_ERROR );
PART_LIB* AddLibrary( const wxString& aFileName, PART_LIBS::iterator& aIterator )
throw( IO_ERROR, boost::bad_pointer );
/**
* Function RemoveLibrary

View File

@ -187,8 +187,6 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
m_staticTextUnitPosX->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
m_staticTextUnitPosY->SetLabel( GetAbbreviatedUnitsLabel( g_UserUnit ) );
copySelectedFieldToPanel();
wxToolTip::Enable( true );
GetSizer()->SetSizeHints( this );
@ -757,6 +755,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
// resume editing at the last row edited, last time dialog was up.
setSelectedFieldNdx( s_SelectedRow );
copySelectedFieldToPanel();
}

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -66,6 +66,7 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
)
{
m_parent = parent;
m_lastMarkerFound = NULL;
Init();
GetSizer()->SetSizeHints( this );

View File

@ -4,11 +4,11 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2012 Jean-Pierre Charras <jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2010 Lorenzo Marcantonio
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -343,7 +343,15 @@ wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName( wxTextCtrl* aOutputDirecto
wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT(".") + aExtension);
EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter );
if( !EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter ) )
{
wxString msg;
msg.Printf( _( "Could not write plot files to folder \"%s\"." ),
GetChars( outputDir.GetPath() ) );
msg << wxT( "\n" );
aReporter->Report( msg );
}
wxFileName fn( plotFileName );
fn.SetPath( outputDir.GetFullPath() );
return fn;

View File

@ -102,7 +102,7 @@ private:
* @param aOldsheetpath the stored old sheet path for the current sheet before the plot started
* @param aMsg the message which is print to the message box
*/
void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH aOldsheetpath,
void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath,
const wxString& aMsg );
// DXF

View File

@ -123,7 +123,7 @@ SCH_TEXT* SCH_EDIT_FRAME::CreateNewText( wxDC* aDC, int aType )
// Prepare display to move the new item
textItem->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( (SCH_ITEM*) textItem, aDC );
PrepareMoveItem( (SCH_ITEM*) textItem, aDC );
return textItem;
}

View File

@ -56,7 +56,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
newitem->SetFlags( IS_NEW );
// Draw the new part, MoveItem() expects it to be already on screen.
newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
MoveItem( newitem, &dc );
PrepareMoveItem( newitem, &dc );
}
break;
@ -69,7 +69,7 @@ void SCH_EDIT_FRAME::OnCopySchematicItemRequest( wxCommandEvent& event )
newitem->SetFlags( IS_NEW );
// Draw the new item, MoveItem() expects it to be already on screen.
newitem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), g_XorMode );
MoveItem( newitem, &dc );
PrepareMoveItem( newitem, &dc );
}
break;

View File

@ -222,7 +222,7 @@ SCH_COMPONENT* SCH_EDIT_FRAME::Load_Component( wxDC* aDC,
SetMsgPanel( items );
component->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
component->SetFlags( IS_NEW );
MoveItem( (SCH_ITEM*) component, aDC );
PrepareMoveItem( (SCH_ITEM*) component, aDC );
return component;
}

View File

@ -56,7 +56,8 @@ class TreeItemData : public wxTreeItemData
{
public:
SCH_SHEET_PATH m_SheetPath;
TreeItemData( SCH_SHEET_PATH sheet ) : wxTreeItemData()
TreeItemData( SCH_SHEET_PATH& sheet ) : wxTreeItemData()
{
m_SheetPath = sheet;
}
@ -70,7 +71,12 @@ private:
wxImageList* imageList;
public:
HIERARCHY_TREE() { }
HIERARCHY_TREE()
{
m_Parent = NULL;
imageList = NULL;
}
HIERARCHY_TREE( HIERARCHY_NAVIG_DLG* parent );
DECLARE_DYNAMIC_CLASS( HIERARCHY_TREE )

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -95,6 +95,9 @@ LIB_ARC::LIB_ARC( LIB_PART* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
m_typeName = _( "Arc" );
m_editState = 0;
m_lastEditState = 0;
m_editCenterDistance = 0.0;
m_editSelectPoint = ARC_STATUS_START;
m_editDirection = 0;
}

View File

@ -1,8 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras at wanadoo.fr
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -1,8 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras at wanadoo.fr
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -1,8 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -834,11 +835,12 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
aColor = GetInvisibleItemColor();
}
LIB_PART* Entry = GetParent();
bool DrawPinText = true;
// aData is used here as bool: if not null, draw pin texts
//(i.e = true to draw pin texts, false to draw only the pin shape, which
// is useful to draw moving component in fast mode)
if( ( aData != NULL ) && ( (bool*) aData == false ) )
DrawPinText = false;
LIB_PART* Entry = GetParent();
bool drawPinText = aData ? true : false;
/* Calculate pin orient taking in account the component orientation. */
int orient = PinDrawOrient( aTransform );
@ -849,7 +851,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
/* Drawing from the pin and the special symbol combination */
DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor );
if( DrawPinText )
if( drawPinText )
{
DrawPinTexts( aPanel, aDC, pos1, orient, Entry->GetPinNameOffset(),
Entry->ShowPinNumbers(), Entry->ShowPinNames(),

View File

@ -1,8 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jaen-pierre.charras at wanadoo.fr
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -98,8 +99,21 @@ class LIB_PIN : public LIB_ITEM
///< "G6", or "12". It is stored as "12\0\0" and does not
///< depend on endian type.
int m_numTextSize;
int m_nameTextSize; /* Pin num and Pin name sizes */
int m_nameTextSize; ///< Pin num and Pin name sizes
/**
* Draw a pin, with or without the pin texts
*
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
* @param aDC Device Context (can be null)
* @param aOffset Offset to draw
* @param aColor -1 to use the normal body item color, or use this color if >= 0
* @param aDrawMode GR_OR, GR_XOR, ...
* @param aData = used here as bool: if not null, draw pin texts
* (i.e = true to draw pin texts, false to draw only the pin shape, which
* is useful to draw moving component in fast mode)
* @param aTransform Transform Matrix (rotation, mirror ..)
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -51,6 +51,7 @@ LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
m_Width = 0;
m_isFillable = true;
m_typeName = _( "PolyLine" );
m_ModifyIndex = 0;
}

View File

@ -48,6 +48,7 @@
#include <xnode.h> // also nests: <wx/xml/xml.h>
#include <build_version.h>
#include <set>
#include <sch_base_frame.h>
#define INTERMEDIATE_NETLIST_EXT wxT( "xml" )
@ -197,12 +198,13 @@ class NETLIST_EXPORT_TOOL
* builds the entire document tree for the generic export. This is factored
* out here so we can write the tree in either S-expression file format
* or in XML if we put the tree built here into a wxXmlDocument.
* @return XNODE* - the root nodes
*/
XNODE* makeGenericRoot();
/**
* Function makeGenericComponents
* returns a sub-tree holding all the schematic components.
* @return XNODE* - returns a sub-tree holding all the schematic components.
*/
XNODE* makeGenericComponents();
@ -216,12 +218,14 @@ class NETLIST_EXPORT_TOOL
/**
* Function makeGenericLibParts
* fills out an XML node with the unique library parts and returns it.
* @return XNODE* - the library parts nodes
*/
XNODE* makeGenericLibParts();
/**
* Function makeGenericListOfNets
* fills out an XML node with a list of nets and returns it.
* @return XNODE* - the list of nets nodes
*/
XNODE* makeGenericListOfNets();
@ -229,6 +233,7 @@ class NETLIST_EXPORT_TOOL
* Function makeGenericLibraries
* fills out an XML node with a list of used libraries and returns it.
* Must have called makeGenericLibParts() before this function.
* @return XNODE* - the library nodes
*/
XNODE* makeGenericLibraries();
@ -637,7 +642,13 @@ static XNODE* node( const wxString& aName, const wxString& aTextualContent = wxE
XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
{
XNODE* xdesign = node( wxT("design") );
SCH_SCREEN* screen;
XNODE* xdesign = node( wxT("design") );
XNODE* xtitleBlock;
XNODE* xsheet;
XNODE* xcomment;
wxString sheetTxt;
wxFileName sourceFileName;
// the root sheet is a special sheet, call it source
xdesign->AddChild( node( wxT( "source" ), g_RootSheet->GetScreen()->GetFileName() ) );
@ -647,27 +658,55 @@ XNODE* NETLIST_EXPORT_TOOL::makeGenericDesignHeader()
// which Eeschema tool
xdesign->AddChild( node( wxT( "tool" ), wxT( "Eeschema " ) + GetBuildVersion() ) );
/* @todo might do a list of schematic pages
<page name="">
<title/>
<revision/>
<company/>
<comments>
<comment>blah</comment> <!-- comment1 -->
<comment>blah</comment> <!-- comment2 -->
</comments>
<pagesize/>
</page>
:
and a sheet hierarchy report here
<sheets>
<sheet name="sheetname1" page="pagenameA">
<sheet name="sheetname2" page="pagenameB"/> use recursion to output?
</sheet>
</sheets>
/*
Export the sheets information
*/
SCH_SHEET_LIST sheetList;
for( SCH_SHEET_PATH* sheet = sheetList.GetFirst(); sheet; sheet = sheetList.GetNext() )
{
screen = sheet->LastScreen();
xdesign->AddChild( xsheet = node( wxT( "sheet" ) ) );
// get the string representation of the sheet index number.
// Note that sheet->GetIndex() is zero index base and we need to increment the number by one to make
// human readable
sheetTxt.Printf( wxT( "%d" ), ( sheetList.GetIndex() + 1 ) );
xsheet->AddAttribute( wxT( "number" ), sheetTxt );
xsheet->AddAttribute( wxT( "name" ), sheet->PathHumanReadable() );
xsheet->AddAttribute( wxT( "tstamps" ), sheet->Path() );
TITLE_BLOCK tb = screen->GetTitleBlock();
xsheet->AddChild( xtitleBlock = node( wxT( "title_block" ) ) );
xtitleBlock->AddChild( node( wxT( "title" ), tb.GetTitle() ) );
xtitleBlock->AddChild( node( wxT( "company" ), tb.GetCompany() ) );
xtitleBlock->AddChild( node( wxT( "rev" ), tb.GetRevision() ) );
xtitleBlock->AddChild( node( wxT( "date" ), tb.GetDate() ) );
// We are going to remove the fileName directories.
sourceFileName = wxFileName( screen->GetFileName() );
xtitleBlock->AddChild( node( wxT( "source" ), sourceFileName.GetFullName() ) );
xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
xcomment->AddAttribute( wxT("number"), wxT("1") );
xcomment->AddAttribute( wxT( "value" ), tb.GetComment1() );
xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
xcomment->AddAttribute( wxT("number"), wxT("2") );
xcomment->AddAttribute( wxT( "value" ), tb.GetComment2() );
xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
xcomment->AddAttribute( wxT("number"), wxT("3") );
xcomment->AddAttribute( wxT( "value" ), tb.GetComment3() );
xtitleBlock->AddChild( xcomment = node( wxT( "comment" ) ) );
xcomment->AddAttribute( wxT("number"), wxT("4") );
xcomment->AddAttribute( wxT( "value" ), tb.GetComment4() );
}
return xdesign;
}

View File

@ -515,8 +515,6 @@ void LIB_EDIT_FRAME::CreateImagePins( LIB_PIN* aPin, int aUnit, int aConvert, bo
void LIB_EDIT_FRAME::GlobalSetPins( LIB_PIN* aMasterPin, int aId )
{
bool selected = aMasterPin->IsSelected();
LIB_PART* part = GetCurPart();
if( !part || !aMasterPin )
@ -527,6 +525,8 @@ void LIB_EDIT_FRAME::GlobalSetPins( LIB_PIN* aMasterPin, int aId )
OnModify( );
bool selected = aMasterPin->IsSelected();
for( LIB_PIN* pin = part->GetNextPin(); pin; pin = part->GetNextPin( pin ) )
{
if( pin->GetConvert() && pin->GetConvert() != m_convert )

View File

@ -139,7 +139,7 @@ void DIALOG_PLOT_SCHEMATIC::createPDFFile( bool aPlotAll, bool aPlotFrameRef )
void DIALOG_PLOT_SCHEMATIC::restoreEnvironment( PDF_PLOTTER* aPlotter,
SCH_SHEET_PATH aOldsheetpath, const wxString& aMsg )
SCH_SHEET_PATH& aOldsheetpath, const wxString& aMsg )
{
aPlotter->EndPlot();
delete aPlotter;

View File

@ -10,6 +10,7 @@ set( xsl_lst
netlist_form_cadstar.xsl
netlist_form_OrcadPcb2.xsl
netlist_form_pads-pcb.xsl
bom_with_title_block_2_csv.xsl
)
install( FILES ${xsl_lst}

View File

@ -0,0 +1,168 @@
<!--
@package
EESCHEMA BOM plugin. Creates BOM CSV files from the project net file.
Based on Stefan Helmert bom2csv.xsl
Note:
The project infomation (i.e title, company and revision) is taken from and the root sheet.
Arthur:
Ronald Sousa HashDefineElectronics.com
Usage:
on Windows:
xsltproc -o "%O.csv" "C:\Program Files (x86)\KiCad\bin\plugins\bom2csv.xsl" "%I"
on Linux:
xsltproc -o "%O.csv" /usr/local/lib/kicad/plugins/bom2csv.xsl "%I"
Ouput Example:
Source,
Kicad Rev, working director and file source
Generated Date, date this file was generated
Title, the project's tile
Company, the project's company
Rev, the project's revision
Date Source, project's issue date
Comment, This is comment 1
Comment, This is comment 2
Comment, This is comment 3
Comment, This is comment 4
Reference, Value, Fields[n], Library, Library Ref
U1, PIC32MX, Fields[n], KicadLib, PIC
-->
<!DOCTYPE xsl:stylesheet [
<!ENTITY nl "&#xd;&#xa;"> <!--new line CR, LF, or LF, your choice -->
]>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<!-- for table head and empty table fields-->
<xsl:key name="headentr" match="field" use="@name"/>
<!-- main part -->
<xsl:template match="/export">
<xsl:text>Source,</xsl:text><xsl:value-of select="design/source"/><xsl:text>&nl;</xsl:text>
<xsl:text>Kicad Rev,</xsl:text><xsl:value-of select="design/tool"/><xsl:text>&nl;</xsl:text>
<xsl:text>Generated Date,</xsl:text><xsl:value-of select="design/date"/><xsl:text>&nl;</xsl:text>
<xsl:text>&nl;</xsl:text>
<!-- Ouput Root sheet project information -->
<xsl:apply-templates select="/export/design/sheet[1]"/>
<xsl:text>&nl;</xsl:text>
<!-- Output table header -->
<xsl:text>Reference,Value,</xsl:text>
<xsl:for-each select="components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]">
<xsl:value-of select="@name"/>
<xsl:text>,</xsl:text>
</xsl:for-each>
<xsl:text>Library,Library Ref</xsl:text>
<xsl:text>&nl;</xsl:text>
<!-- all table entries -->
<xsl:apply-templates select="components/comp"/>
</xsl:template>
<!-- generate the Root sheet project information -->
<xsl:template match="/export/design/sheet[1]">
<xsl:choose>
<xsl:when test="title_block/title !=''">
<xsl:text>Title,</xsl:text><xsl:value-of select="title_block/title"/><xsl:text>&nl;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Title,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="title_block/company !=''">
<xsl:text>Company,</xsl:text><xsl:value-of select="title_block/company"/><xsl:text>&nl;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Company,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="title_block/rev !=''">
<xsl:text>Revision,</xsl:text><xsl:value-of select="title_block/rev"/><xsl:text>&nl;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Revision,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="title_block/date !=''">
<xsl:text>Date Issue,</xsl:text><xsl:value-of select="title_block/date"/><xsl:text>&nl;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:text>Date Issue,Not Set</xsl:text><xsl:text>&nl;</xsl:text>
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="title_block/comment"/>
</xsl:template>
<xsl:template match="title_block/comment">
<xsl:choose>
<xsl:when test="@value !=''">
<xsl:text>Comment,</xsl:text><xsl:value-of select="@value"/><xsl:text>&nl;</xsl:text>
</xsl:when>
</xsl:choose>
</xsl:template>
<!-- the table entries -->
<xsl:template match="components/comp">
<xsl:value-of select="@ref"/><xsl:text>,</xsl:text>
<xsl:value-of select="value"/><xsl:text>,</xsl:text>
<xsl:apply-templates select="fields"/>
<xsl:apply-templates select="libsource"/>
<xsl:text>&nl;</xsl:text>
</xsl:template>
<!-- the library selection -->
<xsl:template match="libsource">
<xsl:value-of select="@lib"/><xsl:text>,</xsl:text>
<xsl:value-of select="@part"/>
</xsl:template>
<!-- table entries with dynamic table head -->
<xsl:template match="fields">
<!-- remember current fields section -->
<xsl:variable name="fieldvar" select="field"/>
<!-- for all existing head entries -->
<xsl:for-each select="/export/components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]">
<xsl:variable name="allnames" select="@name"/>
<!-- for all field entries in the remembered fields section -->
<xsl:for-each select="$fieldvar">
<!-- only if this field entry exists in this fields section -->
<xsl:if test="@name=$allnames">
<!-- content of the field -->
<xsl:value-of select="."/>
</xsl:if>
<!--
If it does not exist, use an empty cell in output for this row.
Every non-blank entry is assigned to its proper column.
-->
</xsl:for-each>
<xsl:text>,</xsl:text>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@ -51,6 +51,14 @@ public:
~SCH_BUS_ENTRY_BASE() { }
/**
* Virtual function IsMovableFromAnchorPoint
* Return true for items which are moved with the anchor point at mouse cursor
* and false for items moved with no reference to anchor
* @return false for a bus entry
*/
bool IsMovableFromAnchorPoint() { return false; }
wxPoint m_End() const;
/**

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 20011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2011-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -255,6 +255,7 @@ public:
SetScanTypes( aScanTypes );
m_foundIndex = 0;
m_forceSearch = false;
m_sheetPath = NULL;
}
void Empty()

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -182,6 +182,7 @@ SCH_COMPONENT::SCH_COMPONENT( LIB_PART& aPart, SCH_SHEET_PATH* sheet, int unit,
SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aComponent ) :
SCH_ITEM( aComponent )
{
m_currentSheetPath = NULL;
m_Parent = aComponent.m_Parent;
m_Pos = aComponent.m_Pos;
m_unit = aComponent.m_unit;
@ -327,23 +328,26 @@ int SCH_COMPONENT::GetUnitCount() const
}
void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE DrawMode, EDA_COLOR_T Color, bool DrawPinText )
void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor,
bool aDrawPinText )
{
if( PART_SPTR part = m_part.lock() )
{
part->Draw( panel, DC, m_Pos + offset, m_unit, m_convert, DrawMode, Color, m_transform, DrawPinText, false );
part->Draw( aPanel, aDC, m_Pos + aOffset, m_unit, m_convert, aDrawMode, aColor,
m_transform, aDrawPinText, false );
}
else // Use dummy() part if the actual cannot be found.
{
dummy()->Draw( panel, DC, m_Pos + offset, 0, 0, DrawMode, Color, m_transform, DrawPinText, false );
dummy()->Draw( aPanel, aDC, m_Pos + aOffset, 0, 0, aDrawMode, aColor,
m_transform, aDrawPinText, false );
}
SCH_FIELD* field = GetField( REFERENCE );
if( field->IsVisible() && !field->IsMoving() )
{
field->Draw( panel, DC, offset, DrawMode );
field->Draw( aPanel, aDC, aOffset, aDrawMode );
}
for( int ii = VALUE; ii < GetFieldCount(); ii++ )
@ -353,26 +357,26 @@ void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset
if( field->IsMoving() )
continue;
field->Draw( panel, DC, offset, DrawMode );
field->Draw( aPanel, aDC, aOffset, aDrawMode );
}
#if 0
// Draw the component bounding box
// Only for testing purposes, draw the component bounding box
{
EDA_RECT boundingBox = GetBoundingBox();
GRRect( panel->GetClipBox(), DC, boundingBox, 0, BROWN );
GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
#if 1
if( GetField( REFERENCE )->IsVisible() )
{
boundingBox = GetField( REFERENCE )->GetBoundingBox();
GRRect( panel->GetClipBox(), DC, boundingBox, 0, BROWN );
GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
}
if( GetField( VALUE )->IsVisible() )
{
boundingBox = GetField( VALUE )->GetBoundingBox();
GRRect( panel->GetClipBox(), DC, boundingBox, 0, BROWN );
GRRect( aPanel->GetClipBox(), aDC, boundingBox, 0, BROWN );
}
#endif
}
@ -414,7 +418,7 @@ wxString SCH_COMPONENT::GetPath( const SCH_SHEET_PATH* sheet ) const
wxString str;
str.Printf( wxT( "%8.8lX" ), m_TimeStamp );
str.Printf( wxT( "%8.8lX" ), (long unsigned) m_TimeStamp );
return sheet->Path() + str;
}
@ -547,8 +551,8 @@ void SCH_COMPONENT::SetTimeStamp( time_t aNewTimeStamp )
{
wxString string_timestamp, string_oldtimestamp;
string_timestamp.Printf( wxT( "%08lX" ), aNewTimeStamp );
string_oldtimestamp.Printf( wxT( "%08lX" ), m_TimeStamp );
string_timestamp.Printf( wxT( "%08lX" ), (long unsigned) aNewTimeStamp );
string_oldtimestamp.Printf( wxT( "%08lX" ), (long unsigned) m_TimeStamp );
EDA_ITEM::SetTimeStamp( aNewTimeStamp );
for( unsigned ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ )

View File

@ -1,8 +1,10 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -133,6 +135,16 @@ public:
return wxT( "SCH_COMPONENT" );
}
/**
* Virtual function IsMovableFromAnchorPoint
* Return true for items which are moved with the anchor point at mouse cursor
* and false for items moved with no reference to anchor
* Usually return true for small items (labels, junctions) and false for
* items which can be large (hierarchical sheets, compoments)
* @return false for a componant
*/
bool IsMovableFromAnchorPoint() { return false; }
void SetPartName( const wxString& aName, PART_LIBS* aLibs=NULL );
const wxString& GetPartName() const { return m_part_name; }
@ -287,21 +299,30 @@ public:
*/
LIB_PIN* GetPin( const wxString& number );
void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
EDA_COLOR_T Color = UNSPECIFIED_COLOR )
/**
* Virtual function, from the base class SCH_ITEM::Draw
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR )
{
Draw( panel, DC, offset, draw_mode, Color, true );
Draw( aPanel, aDC, aOffset, aDrawMode, aColor, true );
}
void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
EDA_COLOR_T Color,
bool DrawPinText );
/**
* Function Draw, specific to components.
* Draw a component, with or without pin texts.
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
* @param aDC Device Context (can be null)
* @param aOffset drawing Offset (usually wxPoint(0,0),
* but can be different when moving an object)
* @param aDrawMode GR_OR, GR_XOR, ...
* @param aColor UNSPECIFIED_COLOR to use the normal body item color, or use this color if >= 0
* @param aDrawPinText = true to draw pin texts, false to draw only the pin shape
* usually false to draw a component when moving it, and true otherwise.
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor,
bool aDrawPinText );
void SwapData( SCH_ITEM* aItem );

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2014 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -114,8 +114,8 @@ int SCH_FIELD::GetPenSize() const
}
void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
const wxPoint& offset, GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
void SCH_FIELD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{
int orient;
EDA_COLOR_T color;
@ -131,14 +131,13 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
LineWidth = GetDefaultLineThickness();
}
// Clip pen size for small texts:
LineWidth = Clamp_Text_PenSize( LineWidth, m_Size, m_Bold );
if( ((m_Attributs & TEXT_NO_VISIBLE) && !m_forceVisible) || IsVoid() )
return;
GRSetDrawMode( DC, DrawMode );
GRSetDrawMode( aDC, aDrawMode );
// Calculate the text orientation according to the component orientation.
orient = m_Orient;
@ -163,7 +162,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
* and use GetBoundaryBox to know the text coordinate considered as centered
*/
EDA_RECT boundaryBox = GetBoundingBox();
textpos = boundaryBox.Centre();
textpos = boundaryBox.Centre() + aOffset;
if( m_forceVisible )
{
@ -179,8 +178,8 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
color = GetLayerColor( LAYER_FIELDS );
}
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
DrawGraphicText( clipbox, DC, textpos, color, GetFullyQualifiedText(), orient, m_Size,
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
DrawGraphicText( clipbox, aDC, textpos, color, GetFullyQualifiedText(), orient, m_Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
LineWidth, m_Italic, m_Bold );
@ -191,7 +190,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
textpos = m_Pos - origin;
textpos = parentComponent->GetScreenCoord( textpos );
textpos += parentComponent->GetPosition();
GRLine( clipbox, DC, origin, textpos, 2, DARKGRAY );
GRLine( clipbox, aDC, origin, textpos, 2, DARKGRAY );
}
/* Enable this to draw the bounding box around the text field to validate
@ -200,7 +199,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
#if 0
// Draw boundary box:
GRRect( panel->GetClipBox(), DC, boundaryBox, 0, BROWN );
GRRect( aPanel->GetClipBox(), aDC, boundaryBox, 0, BROWN );
// Draw the text anchor point
@ -210,9 +209,9 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
textpos = parentComponent->GetScreenCoord( textpos );
textpos += parentComponent->GetPosition();
const int len = 10;
GRLine( clipbox, DC,
GRLine( clipbox, aDC,
textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE );
GRLine( clipbox, DC,
GRLine( clipbox, aDC,
textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE );
#endif
}

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -134,11 +134,8 @@ public:
return (m_Attributs & TEXT_NO_VISIBLE) == 0 ? true : false;
}
void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDrawMode,
EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
bool Save( FILE* aFile ) const;

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -112,8 +112,7 @@ std::string SCH_ITEM::FormatInternalUnits( int aValue )
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
{
// printf( "f: " );
len = snprintf( buf, 49, "%.10f", engUnits );
len = snprintf( buf, sizeof(buf), "%.10f", engUnits );
while( --len > 0 && buf[len] == '0' )
buf[len] = '\0';
@ -122,8 +121,7 @@ std::string SCH_ITEM::FormatInternalUnits( int aValue )
}
else
{
// printf( "g: " );
len = snprintf( buf, 49, "%.10g", engUnits );
len = snprintf( buf, sizeof(buf), "%.10g", engUnits );
}
return std::string( buf, len );
@ -135,7 +133,7 @@ std::string SCH_ITEM::FormatAngle( double aAngle )
char temp[50];
int len;
len = snprintf( temp, 49, "%.10g", aAngle / 10.0 );
len = snprintf( temp, sizeof(temp), "%.10g", aAngle / 10.0 );
return std::string( temp, len );
}

View File

@ -117,6 +117,8 @@ class SCH_ITEM : public EDA_ITEM
protected:
LAYERSCH_ID m_Layer;
EDA_ITEMS m_connections; ///< List of items connected to this item.
wxPoint m_storedPos; ///< a temporary variable used in some move commands
///> to store a initial pos (of the item or mouse cursor)
public:
SCH_ITEM( EDA_ITEM* aParent, KICAD_T aType );
@ -141,6 +143,19 @@ public:
SCH_ITEM* Next() const { return static_cast<SCH_ITEM*>( Pnext ); }
SCH_ITEM* Back() const { return static_cast<SCH_ITEM*>( Pback ); }
/**
* Virtual function IsMovableFromAnchorPoint
* @return true for items which are moved with the anchor point at mouse cursor
* and false for items moved with no reference to anchor
* Usually return true for small items (labels, junctions) and false for
* items which can be large (hierarchical sheets, compoments)
*/
virtual bool IsMovableFromAnchorPoint() { return true; }
wxPoint& GetStoredPos() { return m_storedPos; }
void SetStoredPos( wxPoint aPos ) { m_storedPos = aPos; }
/**
* Function GetLayer
* returns the layer this item is on.
@ -162,12 +177,17 @@ public:
/**
* Function Draw
* Draw a schematic item. Each schematic item should have its own method
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
* @param aDC Device Context (can be null)
* @param aOffset drawing Offset (usually wxPoint(0,0),
* but can be different when moving an object)
* @param aDrawMode GR_OR, GR_XOR, ...
* @param aColor UNSPECIFIED_COLOR to use the normal body item color,
* or force this color if it is a valid color
*/
virtual void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDrawMode,
EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) = 0;
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) = 0;
/**
* Function Move

View File

@ -3,8 +3,8 @@
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -94,6 +94,8 @@ SCH_SCREEN::SCH_SCREEN( KIWAY* aKiway ) :
KIWAY_HOLDER( aKiway ),
m_paper( wxT( "A4" ) )
{
m_modification_sync = 0;
SetZoom( 32 );
for( unsigned i = 0; i < DIM( SchematicZoomList ); i++ )

View File

@ -53,8 +53,8 @@ SCH_SHEET::SCH_SHEET( const wxPoint& pos ) :
m_sheetNameSize = GetDefaultTextSize();
m_fileNameSize = GetDefaultTextSize();
m_screen = NULL;
m_name.Printf( wxT( "Sheet%8.8lX" ), m_TimeStamp );
m_fileName.Printf( wxT( "file%8.8lX.sch" ), m_TimeStamp );
m_name.Printf( wxT( "Sheet%8.8lX" ), (long) m_TimeStamp );
m_fileName.Printf( wxT( "file%8.8lX.sch" ), (long) m_TimeStamp );
}
@ -887,6 +887,14 @@ void SCH_SHEET::MirrorY( int aYaxis_position )
}
}
void SCH_SHEET::SetPosition( const wxPoint& aPosition )
{
// Remember the sheet and all pin sheet positions must be
// modified. So use Move function to do that.
Move( aPosition - m_pos );
}
void SCH_SHEET::Resize( const wxSize& aSize )
{

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -95,11 +95,16 @@ public:
bool operator ==( const SCH_SHEET_PIN* aPin ) const;
void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDraw_mode,
EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
/**
* Virtual function IsMovableFromAnchorPoint
* Return true for items which are moved with the anchor point at mouse cursor
* and false for items moved with no reference to anchor
* @return false for a hierarchical sheet pin
*/
bool IsMovableFromAnchorPoint() { return false; }
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
/**
* Function CreateGraphicShape (virtual)
@ -247,6 +252,15 @@ public:
return wxT( "SCH_SHEET" );
}
/**
* Virtual function IsMovableFromAnchorPoint
* Return true for items which are moved with the anchor point at mouse cursor
* and false for items moved with no reference to anchor
* Usually return true for small items (labels, junctions) and false for
* items which can be large (hierarchical sheets, compoments)
* @return false for a hierarchical sheet
*/
bool IsMovableFromAnchorPoint() { return false; }
wxString GetName() const { return m_name; }
@ -392,11 +406,8 @@ public:
int GetPenSize() const;
void Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDrawMode,
EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR );
EDA_RECT const GetBoundingBox() const;
@ -549,7 +560,7 @@ public:
wxPoint GetPosition() const { return m_pos; }
void SetPosition( const wxPoint& aPosition ) { m_pos = aPosition; }
void SetPosition( const wxPoint& aPosition );
bool HitTest( const wxPoint& aPosition, int aAccuracy ) const;

View File

@ -324,6 +324,12 @@ public:
*/
int GetCount() const { return m_count; }
/**
* Function GetIndex
* @return the last selected screen index.
*/
int GetIndex() const { return m_index; }
/**
* Function GetFirst
* @return the first item (sheet) in m_List and prepare calls to GetNext()

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -131,11 +131,8 @@ public:
*/
virtual wxPoint GetSchematicTextOffset() const;
virtual void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
EDA_COLOR_T Color = UNSPECIFIED_COLOR );
virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE draw_mode, EDA_COLOR_T Color = UNSPECIFIED_COLOR );
/**
* Function CreateGraphicShape
@ -230,11 +227,8 @@ public:
~SCH_LABEL() { }
void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
EDA_COLOR_T Color = UNSPECIFIED_COLOR );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE draw_mode, EDA_COLOR_T Color = UNSPECIFIED_COLOR );
wxString GetClass() const
{
@ -279,11 +273,8 @@ public:
~SCH_GLOBALLABEL() { }
void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
EDA_COLOR_T Color = UNSPECIFIED_COLOR );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE draw_mode, EDA_COLOR_T Color = UNSPECIFIED_COLOR );
wxString GetClass() const
{
@ -332,11 +323,8 @@ public:
~SCH_HIERLABEL() { }
void Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE draw_mode,
EDA_COLOR_T Color = UNSPECIFIED_COLOR );
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
GR_DRAWMODE draw_mode, EDA_COLOR_T Color = UNSPECIFIED_COLOR );
wxString GetClass() const
{

View File

@ -443,21 +443,26 @@ void SCH_EDIT_FRAME::OnMoveItem( wxCommandEvent& aEvent )
case SCH_COMPONENT_T:
case SCH_SHEET_PIN_T:
case SCH_FIELD_T:
MoveItem( item, &dc );
case SCH_SHEET_T:
PrepareMoveItem( item, &dc );
break;
case SCH_BITMAP_T:
// move an image is a special case:
// we cannot undraw/redraw a bitmap just using our xor mode
// the MoveImage function handle this undraw/redraw difficulty
// By redrawing the full bounding box
MoveImage( (SCH_BITMAP*) item, &dc );
break;
case SCH_SHEET_T:
StartMoveSheet( (SCH_SHEET*) item, &dc );
break;
case SCH_MARKER_T:
default:
// Moving a marker has no sense
wxFAIL_MSG( wxString::Format( wxT( "Cannot move item type %s" ),
GetChars( item->GetClass() ) ) );
default:
// Unknown items cannot be moved
wxFAIL_MSG( wxString::Format(
wxT( "Cannot move unknown item type %d" ), item->Type() ) );
break;
}
@ -640,25 +645,44 @@ bool SCH_EDIT_FRAME::DeleteItemAtCrossHair( wxDC* DC )
return false;
}
static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, bool aErase )
// This function is a callback function, called by the mouse cursor movin event
// when an item is currently moved
static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
const wxPoint& aPosition, bool aErase )
{
SCH_SCREEN* screen = (SCH_SCREEN*) aPanel->GetScreen();
SCH_ITEM* item = screen->GetCurItem();
wxCHECK_RET( (item != NULL), wxT( "Cannot move invalid schematic item." ) );
SCH_COMPONENT* cmp = NULL;
if( item->Type() == SCH_COMPONENT_T )
cmp = static_cast< SCH_COMPONENT* >( item );
#ifndef USE_WX_OVERLAY
// Erase the current item at its current position.
if( aErase )
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
{
if( cmp ) // Use fast mode (do not draw pin texts)
cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR, false );
else
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
#endif
item->SetPosition( aPanel->GetParent()->GetCrossHairPosition() );
wxPoint cpos = aPanel->GetParent()->GetCrossHairPosition();
cpos -= item->GetStoredPos();
item->SetPosition( cpos );
// Draw the item item at it's new position.
item->SetWireImage(); // While moving, the item may choose to render differently
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
if( cmp ) // Use fast mode (do not draw pin texts)
cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR, false );
else
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
@ -714,7 +738,7 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
}
void SCH_EDIT_FRAME::MoveItem( SCH_ITEM* aItem, wxDC* aDC )
void SCH_EDIT_FRAME::PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot move invalid schematic item" ) );
@ -729,22 +753,27 @@ void SCH_EDIT_FRAME::MoveItem( SCH_ITEM* aItem, wxDC* aDC )
}
aItem->SetFlags( IS_MOVED );
#ifdef USE_WX_OVERLAY
this->Refresh();
this->Update();
#endif
m_canvas->CrossHairOff( aDC );
if( aItem->Type() != SCH_SHEET_PIN_T )
// For some items, moving the cursor to anchor is not good
// (for instance large hierarchical sheets od componants can have
// the anchor position outside the canvas)
// these items return IsMovableFromAnchorPoint() == false
// For these items, do not wrap the cursor
if( aItem->IsMovableFromAnchorPoint() )
{
SetCrossHairPosition( aItem->GetPosition() );
m_canvas->MoveCursorToCrossHair();
aItem->SetStoredPos( wxPoint( 0,0 ) );
}
else
aItem->SetStoredPos( GetCrossHairPosition() - aItem->GetPosition() );
m_canvas->MoveCursorToCrossHair();
OnModify();
m_canvas->SetMouseCapture( moveItem, abortMoveItem );
m_canvas->SetMouseCapture( moveItemWithMouseCursor, abortMoveItem );
GetScreen()->SetCurItem( aItem );
moveItem( m_canvas, aDC, wxDefaultPosition, true );
m_canvas->CrossHairOn( aDC );
m_canvas->Refresh();
}

View File

@ -203,7 +203,8 @@ protected:
void updateFindReplaceView( wxFindDialogEvent& aEvent );
void backAnnotateFootprints( const std::string& aChangedSetOfReferences ) throw( IO_ERROR );
void backAnnotateFootprints( const std::string& aChangedSetOfReferences )
throw( IO_ERROR, boost::bad_pointer );
public:
SCH_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent );
@ -845,13 +846,13 @@ private:
SCH_JUNCTION* AddJunction( wxDC* aDC, const wxPoint& aPosition, bool aPutInUndoList = false );
/**
* Function MoveItem
* Function PrepareMoveItem
* start moving \a aItem using the mouse.
*
* @param aItem A pointer to an SCH_ITEM to move.
* @param aDC The device context to draw \a aItem.
*/
void MoveItem( SCH_ITEM* aItem, wxDC* aDC );
void PrepareMoveItem( SCH_ITEM* aItem, wxDC* aDC );
// Text, label, glabel
SCH_TEXT* CreateNewText( wxDC* aDC, int aType );
@ -946,8 +947,6 @@ public:
wxPoint GetLastSheetPinPosition() const { return m_lastSheetPinPosition; }
private:
void StartMoveSheet( SCH_SHEET* sheet, wxDC* DC );
/**
* Function CreateSheetPin
* creates a new SCH_SHEET_PIN object and add it to \a aSheet at the current cursor position.

View File

@ -251,9 +251,11 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
/* Move selected sheet with the cursor.
* Callback function use by m_mouseCaptureCallback.
* Callback function used by m_mouseCaptureCallback.
* Note also now this function is aclled only when resizing the sheet
* But the (very small code) relative to sheet move is still present here
*/
static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
static void resizeSheetWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase )
{
wxPoint moveVector;
@ -265,37 +267,29 @@ static void MoveOrResizeSheet( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
wxPoint pos = sheet->GetPosition();
if( sheet->IsResized() )
int width = aPanel->GetParent()->GetCrossHairPosition().x - sheet->GetPosition().x;
int height = aPanel->GetParent()->GetCrossHairPosition().y - sheet->GetPosition().y;
// If the sheet doesn't have any pins, clamp the minimum size to the default values.
width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
height = ( height < MIN_SHEET_HEIGHT ) ? MIN_SHEET_HEIGHT : height;
if( sheet->HasPins() )
{
int width = aPanel->GetParent()->GetCrossHairPosition().x - sheet->GetPosition().x;
int height = aPanel->GetParent()->GetCrossHairPosition().y - sheet->GetPosition().y;
int gridSizeX = KiROUND( screen->GetGridSize().x );
int gridSizeY = KiROUND( screen->GetGridSize().y );
// If the sheet doesn't have any pins, clamp the minimum size to the default values.
width = ( width < MIN_SHEET_WIDTH ) ? MIN_SHEET_WIDTH : width;
height = ( height < MIN_SHEET_HEIGHT ) ? MIN_SHEET_HEIGHT : height;
if( sheet->HasPins() )
{
int gridSizeX = KiROUND( screen->GetGridSize().x );
int gridSizeY = KiROUND( screen->GetGridSize().y );
// If the sheet has pins, use the pin positions to clamp the minimum height.
height = ( height < sheet->GetMinHeight() + gridSizeY ) ?
sheet->GetMinHeight() + gridSizeY : height;
width = ( width < sheet->GetMinWidth() + gridSizeX ) ?
sheet->GetMinWidth() + gridSizeX : width;
}
wxPoint grid = aPanel->GetParent()->GetNearestGridPosition(
wxPoint( pos.x + width, pos.y + height ) );
sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
}
else if( sheet->IsMoving() )
{
moveVector = aPanel->GetParent()->GetCrossHairPosition() - pos;
sheet->Move( moveVector );
// If the sheet has pins, use the pin positions to clamp the minimum height.
height = ( height < sheet->GetMinHeight() + gridSizeY ) ?
sheet->GetMinHeight() + gridSizeY : height;
width = ( width < sheet->GetMinWidth() + gridSizeX ) ?
sheet->GetMinWidth() + gridSizeX : width;
}
wxPoint grid = aPanel->GetParent()->GetNearestGridPosition(
wxPoint( pos.x + width, pos.y + height ) );
sheet->Resize( wxSize( grid.x - pos.x, grid.y - pos.y ) );
sheet->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
@ -360,7 +354,7 @@ SCH_SHEET* SCH_EDIT_FRAME::CreateSheet( wxDC* aDC )
// also need to update the hierarchy, if we are adding
// a sheet to a screen that already has multiple instances (!)
GetScreen()->SetCurItem( sheet );
m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
m_canvas->SetMouseCapture( resizeSheetWithMouseCursor, ExitSheet );
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, false );
m_canvas->CrossHairOff( aDC );
@ -390,28 +384,10 @@ void SCH_EDIT_FRAME::ReSizeSheet( SCH_SHEET* aSheet, wxDC* aDC )
SetUndoItem( aSheet );
aSheet->SetFlags( IS_RESIZED );
m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
m_canvas->SetMouseCapture( resizeSheetWithMouseCursor, ExitSheet );
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, true );
if( aSheet->IsNew() ) // not already in edit, save a copy for undo/redo
SetUndoItem( aSheet );
}
void SCH_EDIT_FRAME::StartMoveSheet( SCH_SHEET* aSheet, wxDC* aDC )
{
if( ( aSheet == NULL ) || ( aSheet->Type() != SCH_SHEET_T ) )
return;
m_canvas->CrossHairOff( aDC );
SetCrossHairPosition( aSheet->GetPosition() );
m_canvas->MoveCursorToCrossHair();
if( !aSheet->IsNew() )
SetUndoItem( aSheet );
aSheet->SetFlags( IS_MOVED );
m_canvas->SetMouseCapture( MoveOrResizeSheet, ExitSheet );
m_canvas->CallMouseCapture( aDC, wxDefaultPosition, true );
m_canvas->CrossHairOn( aDC );
}

View File

@ -128,7 +128,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
sheetPin->SetPosition( GetCrossHairPosition() );
sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( (SCH_ITEM*) sheetPin, aDC );
PrepareMoveItem( (SCH_ITEM*) sheetPin, aDC );
OnModify();
return sheetPin;
@ -174,7 +174,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::ImportSheetPin( SCH_SHEET* aSheet, wxDC* aDC )
sheetPin->SetPosition( GetCrossHairPosition() );
sheetPin->Draw( m_canvas, aDC, wxPoint( 0, 0 ), g_XorMode );
MoveItem( (SCH_ITEM*) sheetPin, aDC );
PrepareMoveItem( (SCH_ITEM*) sheetPin, aDC );
return sheetPin;
}

View File

@ -208,8 +208,6 @@ void LIB_VIEW_FRAME::SelectAndViewLibraryPart( int option )
void LIB_VIEW_FRAME::ViewOneLibraryContent( PART_LIB* Lib, int Flag )
{
int NumOfParts = 0;
LIB_ALIAS* entry;
wxString CmpName;
if( Lib )
NumOfParts = Lib->GetCount();
@ -220,8 +218,8 @@ void LIB_VIEW_FRAME::ViewOneLibraryContent( PART_LIB* Lib, int Flag )
return;
}
if( Lib == NULL )
return;
LIB_ALIAS* entry;
wxString CmpName;
if( Flag == NEW_PART )
DisplayListComponentsInLib( Lib, CmpName, m_entryName );

View File

@ -200,11 +200,16 @@ void GERBER_IMAGE::ResetDefaultValues()
m_PreviousPos.x = m_PreviousPos.y = 0; // last specified coord
m_IJPos.x = m_IJPos.y = 0; // current centre coord for
// plot arcs & circles
m_Current_File = NULL; // Gerger file to read
m_Current_File = NULL; // Gerber file to read
m_FilesPtr = 0;
m_PolygonFillMode = false;
m_PolygonFillModeState = 0;
m_Selected_Tool = FIRST_DCODE;
m_Last_Pen_Command = 0;
m_Exposure = false;
for( unsigned ii = 0; ii < DIM( m_FilesList ); ii++ )
m_FilesList[ii] = NULL;
}
/* Function HasNegativeItems
@ -455,7 +460,7 @@ const wxString GERBER_IMAGE_LIST::GetDisplayName( int aIdx )
if( aIdx >= 0 && aIdx < (int)m_GERBER_List.size() )
gerber = m_GERBER_List[aIdx];
if( IsUsed(aIdx ) )
if( gerber && IsUsed(aIdx ) )
{
if( gerber->m_FileFunction )
name.Printf( _( "Layer %d (%s, %s)" ), aIdx + 1,

View File

@ -225,10 +225,9 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
m_FineAdjustYscaleOpt->SetValue( msg );
bool enable = (s_Parameters.m_PrintScale == 1.0);
if( m_FineAdjustXscaleOpt )
m_FineAdjustXscaleOpt->Enable(enable);
if( m_FineAdjustYscaleOpt )
m_FineAdjustYscaleOpt->Enable(enable);
m_FineAdjustXscaleOpt->Enable(enable);
m_FineAdjustYscaleOpt->Enable(enable);
}
int DIALOG_PRINT_USING_PRINTER::SetLayerSetFromListSelection()

View File

@ -2,8 +2,8 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Jean-Pierre Charras, jpierre.charras at wanadoo
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -46,6 +46,8 @@
void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
bool aPrintMirrorMode, void* aData )
{
wxCHECK_RET( aData != NULL, wxT( "aDate cannot be NULL." ) );
// Save current draw options, because print mode has specific options:
GBR_DISPLAY_OPTIONS imgDisplayOptions = m_DisplayOptions;
std::bitset <GERBER_DRAWLAYERS_COUNT> printLayersMask = GetGerberLayout()->GetPrintableLayers();
@ -63,7 +65,7 @@ void GERBVIEW_FRAME::PrintPage( wxDC* aDC, LSET aPrintMasklayer,
printCurrLayerMask.set(printParameters->m_Flags); // m_Flags contains the draw layer number
GetGerberLayout()->SetPrintableLayers( printCurrLayerMask );
m_canvas->SetPrintMirrored( aPrintMirrorMode );
bool printBlackAndWhite = printParameters && printParameters->m_Print_Black_and_White;
bool printBlackAndWhite = printParameters->m_Print_Black_and_White;
GetGerberLayout()->Draw( m_canvas, aDC, UNSPECIFIED_DRAWMODE,
wxPoint( 0, 0 ), printBlackAndWhite );

View File

@ -71,6 +71,7 @@ public:
m_DisplayPolarCood = false;
m_DisplayDCodes = true;
m_IsPrinting = false;
m_DisplayNegativeObjects = false;
}
};

View File

@ -2,7 +2,7 @@
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 2007-2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2007-2015 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2010-12 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010-2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2012-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -538,7 +538,8 @@ public:
* @throw IO_ERROR if an error occurs attempting to load the footprint library
* table.
*/
static bool LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARSE_ERROR );
static bool LoadGlobalTable( FP_LIB_TABLE& aTable )
throw (IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception );
/**
* Function GetGlobalTableFileName
@ -581,7 +582,8 @@ public:
* writes this table to aFileName in s-expression form.
* @param aFileName is the name of the file to write to.
*/
void Save( const wxString& aFileName ) const throw( IO_ERROR );
void Save( const wxString& aFileName ) const
throw( IO_ERROR, boost::interprocess::lock_exception );
protected:

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011-2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -69,11 +69,19 @@ public:
m_Color( aColor ),
m_Pad( aPad )
{
m_X = 0;
m_UpperY = 0;
m_LowerY = 0;
}
MSG_PANEL_ITEM() :
m_Pad( MSG_PANEL_DEFAULT_PAD )
{
m_X = 0;
m_UpperY = 0;
m_LowerY = 0;
m_Color = UNSPECIFIED_COLOR;
}
void SetUpperText( const wxString& aUpperText ) { m_UpperText = aUpperText; }

View File

@ -30,26 +30,6 @@
class PGM_BASE;
/**
* attempts to set (when not set or valid) the environment variable given by aKiSys3Dmod
* (typically "KISYS3DMOD" ) to a valid path.
* If the environment variable is already set, then it left as is to respect
* the wishes of the user.
*
* The path is determined by attempting to find the path modules/packages3d
* files in kicad tree.
* This may or may not be the best path but it provides the best solution for
* backwards compatibility with the previous 3D shapes search path implementation.
*
* @note This must be called after #SetBinDir() is called at least on Windows.
* Otherwise, the kicad path is not known (Windows specific)
*
* @param aKiSys3Dmod = the value of environment variable, typically "KISYS3DMOD"
* @param aProcess = the current process
* @return false if the aKiSys3Dmod path is not valid.
*/
bool Set3DShapesDefaultPath( const wxString& aKiSys3Dmod, const PGM_BASE* aProcess );
/// Utility for comma separated lists
inline void AccumulateDescription( wxString &aDesc, const wxString &aItem )

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -671,6 +671,8 @@ class PDF_PLOTTER : public PSLIKE_PLOTTER
public:
PDF_PLOTTER() : pageStreamHandle( 0 ), workFile( NULL )
{
// Avoid non initialized variables:
pageStreamHandle = streamLengthHandle = fontResDictHandle = 0;
}
virtual PlotFormat GetPlotterType() const
@ -986,6 +988,8 @@ class DXF_PLOTTER : public PLOTTER
public:
DXF_PLOTTER() : textAsLines( false )
{
textAsLines = true;
m_currentColor = BLACK;
}
virtual PlotFormat GetPlotterType() const

View File

@ -30,9 +30,5 @@
<key>LSRequiresCarbon</key> <true/>
<key>NSHumanReadableCopyright</key> <string></string>
<key>NSHighResolutionCapable</key> <string>True</string>
<key>LSEnvironment</key>
<dict>
<key>KIGITHUB</key> <string>https://github.com/kicad</string>
</dict>
</dict>
</plist>

View File

@ -8,7 +8,7 @@
*
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 CERN (www.cern.ch)
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -8,7 +8,7 @@
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -79,13 +79,13 @@ static const wxChar* s_allowedExtensionsToList[] =
wxT( "^.*\\.odt$" ),
wxT( "^.*\\.htm$" ),
wxT( "^.*\\.html$" ),
wxT( "^.*\\.rpt$" ), // Report files
wxT( "^.*\\.csv$" ), // Report files in comma separateed format
wxT( "^.*\\.pos$" ), // Footprint position files
wxT( "^.*\\.cmp$" ), // Cvpcb cmp/footprint link files
wxT( "^.*\\.drl$" ), // Excellon drill files
wxT( "^.*\\.svg$" ), // SVG print/plot files
NULL // end of list
wxT( "^.*\\.rpt$" ), // Report files
wxT( "^.*\\.csv$" ), // Report files in comma separated format
wxT( "^.*\\.pos$" ), // Footprint position files
wxT( "^.*\\.cmp$" ), // Cvpcb cmp/footprint link files
wxT( "^.*\\.drl$" ), // Excellon drill files
wxT( "^.*\\.svg$" ), // SVG print/plot files
NULL // end of list
};
@ -110,13 +110,13 @@ const wxChar TextFileWildcard[] = wxT( "Text files (*.txt)|*.txt" );
BEGIN_EVENT_TABLE( TREE_PROJECT_FRAME, wxSashLayoutWindow )
EVT_TREE_ITEM_ACTIVATED( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnSelect )
EVT_TREE_ITEM_EXPANDED( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnExpand )
EVT_TREE_ITEM_RIGHT_CLICK( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnRight )
EVT_MENU( ID_PROJECT_TXTEDIT, TREE_PROJECT_FRAME::OnOpenSelectedFileWithTextEditor )
EVT_MENU( ID_PROJECT_NEWDIR, TREE_PROJECT_FRAME::OnCreateNewDirectory )
EVT_MENU( ID_PROJECT_DELETE, TREE_PROJECT_FRAME::OnDeleteFile )
EVT_MENU( ID_PROJECT_RENAME, TREE_PROJECT_FRAME::OnRenameFile )
EVT_TREE_ITEM_ACTIVATED( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnSelect )
EVT_TREE_ITEM_EXPANDED( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnExpand )
EVT_TREE_ITEM_RIGHT_CLICK( ID_PROJECT_TREE, TREE_PROJECT_FRAME::OnRight )
EVT_MENU( ID_PROJECT_TXTEDIT, TREE_PROJECT_FRAME::OnOpenSelectedFileWithTextEditor )
EVT_MENU( ID_PROJECT_NEWDIR, TREE_PROJECT_FRAME::OnCreateNewDirectory )
EVT_MENU( ID_PROJECT_DELETE, TREE_PROJECT_FRAME::OnDeleteFile )
EVT_MENU( ID_PROJECT_RENAME, TREE_PROJECT_FRAME::OnRenameFile )
END_EVENT_TABLE()
@ -125,7 +125,7 @@ TREE_PROJECT_FRAME::TREE_PROJECT_FRAME( KICAD_MANAGER_FRAME* parent ) :
ID_LEFT_FRAME,
wxDefaultPosition,
wxDefaultSize,
wxNO_BORDER | wxSW_3D )
wxNO_BORDER | wxSW_3D | wxTAB_TRAVERSAL )
{
m_Parent = parent;
m_TreeProject = NULL;
@ -752,7 +752,7 @@ void TREE_PROJECT_FRAME::OnRenameFile( wxCommandEvent& )
wxTextEntryDialog dlg( this, msg, _( "Change filename" ), buffer );
if( dlg.ShowModal() != wxID_OK )
return; // cancelled by user
return; // canceled by user
buffer = dlg.GetValue();
buffer.Trim( true );
@ -793,6 +793,7 @@ void TREE_PROJECT_FRAME::OnExpand( wxTreeEvent& Event )
wxTreeItemId kid = m_TreeProject->GetFirstChild( itemId, cookie );
bool subdir_populated = false;
for( ; kid.IsOk(); kid = m_TreeProject->GetNextChild( itemId, cookie ) )
{
TREEPROJECT_ITEM* itemData = GetItemIdData( kid );
@ -866,6 +867,7 @@ wxTreeItemId TREE_PROJECT_FRAME::findSubdirTreeItem( const wxString& aSubDir )
std::stack < wxTreeItemId > subdirs_id;
wxTreeItemId kid = m_TreeProject->GetFirstChild( root_id, cookie );
while( 1 )
{
if( ! kid.IsOk() )
@ -1018,6 +1020,7 @@ void TREE_PROJECT_FRAME::FileWatcherReset()
std::stack < wxTreeItemId > subdirs_id;
wxTreeItemId kid = m_TreeProject->GetFirstChild( root_id, cookie );
while( 1 )
{
if( !kid.IsOk() )

View File

@ -13,7 +13,7 @@
#ifndef DRW_BASE_H
#define DRW_BASE_H
#define DRW_VERSION "0.5.11"
#define DRW_VERSION "0.5.13"
#include <string>
#include <cmath>
@ -42,7 +42,8 @@
namespace DRW {
// ! Version numbers for the DXF Format.
enum Version {
enum Version
{
UNKNOWNV, /*!< UNKNOWN VERSION. */
AC1006, /*!< R10. */
AC1009, /*!< R11 & R12. */
@ -54,7 +55,8 @@ enum Version {
AC1024 /*!< ACAD 2010. */
};
enum error {
enum error
{
BAD_NONE, /*!< No error. */
BAD_UNKNOWN, /*!< UNKNOWN. */
BAD_OPEN, /*!< error opening file. */
@ -76,7 +78,7 @@ enum error {
class DRW_Coord
{
public:
DRW_Coord() { x = 0; y = 0; z = 0; }
DRW_Coord(): x(0), y(0), z(0) {}
DRW_Coord( double ix, double iy, double iz )
{
x = ix; y = iy; z = iz;
@ -121,15 +123,15 @@ public:
DRW_Vertex2D()
{
// eType = DRW::LWPOLYLINE;
stawidth = endwidth = bulge = 0;
x = y = stawidth = endwidth = bulge = 0.0;
}
DRW_Vertex2D( double sx, double sy, double b )
{
stawidth = endwidth = 0;
x = sx;
y = sy;
bulge = b;
x = sx;
y = sy;
bulge = b;
}
public:
@ -149,7 +151,8 @@ public:
class DRW_Variant
{
public:
enum TYPE {
enum TYPE
{
STRING,
INTEGER,
DOUBLE,
@ -160,48 +163,66 @@ public:
DRW_Variant()
{
type = INVALID;
code = 0;
}
DRW_Variant( const DRW_Variant& d )
{
code = d.code;
type = d.type;
if( d.type == COORD ) vdata = d.vdata;
if( d.type == STRING ) sdata = d.sdata;
content = d.content;
}
DRW_Variant( int c, UTF8STRING s ) { addString( s ); code = c; }
DRW_Variant( int c, int i ) { addInt( i ); code = c; }
DRW_Variant( int c, double d ) { addDouble( d ); code = c; }
DRW_Variant( int c, double x, double y, double z )
{
setType( COORD ); vdata.x = x; vdata.y = y;
vdata.z = z; content.v = &vdata; code = c;
}
~DRW_Variant()
{
if( type == COORD )
delete content.v;
}
enum TYPE type;
void addString( UTF8STRING s ) { setType( STRING ); data = s; content.s = &data; }
void addString( UTF8STRING s ) { setType( STRING ); sdata = s; content.s = &sdata; }
void addInt( int i ) { setType( INTEGER ); content.i = i; }
void addDouble( double d ) { setType( DOUBLE ); content.d = d; }
void addCoord( DRW_Coord* v ) { setType( COORD ); content.v = v; }
void setType( enum TYPE t )
void addCoord()
{
if( type == COORD )
delete content.v;
type = t;
setType( COORD ); vdata.x = 0.0; vdata.y = 0.0; vdata.z = 0.0; content.v =
&vdata;
}
void setCoordX( double d ) { if( type == COORD ) content.v->x = d; }
void setCoordY( double d ) { if( type == COORD ) content.v->y = d; }
void setCoordZ( double d ) { if( type == COORD ) content.v->z = d; }
void addCoord( DRW_Coord v ) { setType( COORD ); vdata = v; content.v = &vdata; }
void setType( enum TYPE t ) { type = t; }
void setCoordX( double d ) { if( type == COORD ) vdata.x = d; }
void setCoordY( double d ) { if( type == COORD ) vdata.y = d; }
void setCoordZ( double d ) { if( type == COORD ) vdata.z = d; }
private:
typedef union
{
UTF8STRING* s;
int i;
double d;
DRW_Coord* v;
int i;
double d;
DRW_Coord* v;
} DRW_VarContent;
public:
DRW_VarContent content;
public:
int code;
// string version;
// string codepage;
DRW_VarContent content;
enum TYPE type;
int code; /*!< dxf code of this value*/
private:
// DRW_VarContent content;
std::string data;
std::string sdata;
DRW_Coord vdata;
};
@ -215,7 +236,8 @@ private:
class DRW_LW_Conv
{
public:
enum lineWidth {
enum lineWidth
{
width00 = 0, /*!< 0.00mm (dxf 0)*/
width01 = 1, /*!< 0.05mm (dxf 5)*/
width02 = 2, /*!< 0.09mm (dxf 9)*/

View File

@ -22,23 +22,33 @@
*/
void DRW_Entity::calculateAxis( DRW_Coord extPoint )
{
// Follow the arbitrary DXF definitions for extrusion axes.
if( fabs( extPoint.x ) < 0.015625 && fabs( extPoint.y ) < 0.015625 )
{
// If we get here, implement Ax = Wy x N where Wy is [0,1,0] per the DXF spec.
// The cross product works out to Wy.y*N.z-Wy.z*N.y, Wy.z*N.x-Wy.x*N.z, Wy.x*N.y-Wy.y*N.x
// Factoring in the fixed values for Wy gives N.z,0,-N.x
extAxisX.x = extPoint.z;
extAxisX.y = 0;
extAxisX.z = -extPoint.x;
}
else
{
// Otherwise, implement Ax = Wz x N where Wz is [0,0,1] per the DXF spec.
// The cross product works out to Wz.y*N.z-Wz.z*N.y, Wz.z*N.x-Wz.x*N.z, Wz.x*N.y-Wz.y*N.x
// Factoring in the fixed values for Wz gives -N.y,N.x,0.
extAxisX.x = -extPoint.y;
extAxisX.y = extPoint.x;
extAxisX.z = 0;
}
extAxisX.unitize();
// Ay = N x Ax
extAxisY.x = (extPoint.y * extAxisX.z) - (extAxisX.y * extPoint.z);
extAxisY.y = (extPoint.z * extAxisX.x) - (extAxisX.z * extPoint.x);
extAxisY.z = (extPoint.x * extAxisX.y) - (extAxisX.x * extPoint.y);
extAxisY.unitize();
}
@ -110,6 +120,58 @@ void DRW_Entity::parseCode( int code, dxfReader* reader )
space = reader->getInt32();
break;
case 1000:
case 1001:
case 1002:
case 1003:
case 1004:
case 1005:
extData.push_back( new DRW_Variant( code, reader->getString() ) );
break;
case 1010:
case 1011:
case 1012:
case 1013:
curr = new DRW_Variant();
curr->addCoord();
curr->setCoordX( reader->getDouble() );
curr->code = code;
extData.push_back( curr );
break;
case 1020:
case 1021:
case 1022:
case 1023:
if( curr )
curr->setCoordY( reader->getDouble() );
break;
case 1030:
case 1031:
case 1032:
case 1033:
if( curr )
curr->setCoordZ( reader->getDouble() );
curr = NULL;
break;
case 1040:
case 1041:
case 1042:
extData.push_back( new DRW_Variant( code, reader->getDouble() ) );
break;
case 1070:
case 1071:
extData.push_back( new DRW_Variant( code, reader->getInt32() ) );
break;
default:
break;
}
@ -137,8 +199,8 @@ void DRW_Point::parseCode( int code, dxfReader* reader )
break;
case 210:
haveExtrusion = true;
extPoint.x = reader->getDouble();
haveExtrusion = true;
extPoint.x = reader->getDouble();
break;
case 220:
@ -183,6 +245,8 @@ void DRW_Circle::applyExtrusion()
{
if( haveExtrusion )
{
// NOTE: Commenting these out causes the the arcs being tested to be located
// on the other side of the y axis (all x dimensions are negated).
calculateAxis( extPoint );
extrudePoint( extPoint, &basePoint );
}
@ -204,6 +268,30 @@ void DRW_Circle::parseCode( int code, dxfReader* reader )
}
void DRW_Arc::applyExtrusion()
{
DRW_Circle::applyExtrusion();
if( haveExtrusion )
{
// If the extrusion vector has a z value less than 0, the angles for the arc
// have to be mirrored since DXF files use the right hand rule.
// Note that the following code only handles the special case where there is a 2D
// drawing with the z axis heading into the paper (or rather screen). An arbitrary
// extrusion axis (with x and y values greater than 1/64) may still have issues.
if( fabs( extPoint.x ) < 0.015625 && fabs( extPoint.y ) < 0.015625 && extPoint.z < 0.0 )
{
staangle = M_PI - staangle;
endangle = M_PI - endangle;
double temp = staangle;
staangle = endangle;
endangle = temp;
}
}
}
void DRW_Arc::parseCode( int code, dxfReader* reader )
{
switch( code )
@ -309,9 +397,9 @@ void DRW_Ellipse::toPolyline( DRW_Polyline* pol, int parts )
radMajor = sqrt( secPoint.x * secPoint.x + secPoint.y * secPoint.y );
radMinor = radMajor * ratio;
// calculate sin & cos of included angle
incAngle = atan2( secPoint.y, secPoint.x );
cosRot = cos( incAngle );
sinRot = sin( incAngle );
incAngle = atan2( secPoint.y, secPoint.x );
cosRot = cos( incAngle );
sinRot = sin( incAngle );
incAngle = M_PIx2 / parts;
curAngle = staparam;
int i = curAngle / incAngle;
@ -336,9 +424,9 @@ void DRW_Ellipse::toPolyline( DRW_Polyline* pol, int parts )
pol->flags = 1;
}
pol->layer = this->layer;
pol->lineType = this->lineType;
pol->color = this->color;
pol->layer = this->layer;
pol->lineType = this->lineType;
pol->color = this->color;
pol->lWeight = this->lWeight;
pol->extPoint = this->extPoint;
}
@ -487,8 +575,8 @@ void DRW_LWPolyline::applyExtrusion()
for( unsigned int i = 0; i<vertlist.size(); i++ )
{
DRW_Vertex2D* vert = vertlist.at( i );
DRW_Coord v( vert->x, vert->y, elevation );
DRW_Vertex2D* vert = vertlist.at( i );
DRW_Coord v( vert->x, vert->y, elevation );
extrudePoint( extPoint, &v );
vert->x = v.x;
vert->y = v.y;
@ -502,12 +590,12 @@ void DRW_LWPolyline::parseCode( int code, dxfReader* reader )
switch( code )
{
case 10:
{
vertex = new DRW_Vertex2D();
vertlist.push_back( vertex );
vertex->x = reader->getDouble();
break;
}
{
vertex = new DRW_Vertex2D();
vertlist.push_back( vertex );
vertex->x = reader->getDouble();
break;
}
case 20:
@ -559,8 +647,8 @@ void DRW_LWPolyline::parseCode( int code, dxfReader* reader )
break;
case 210:
haveExtrusion = true;
extPoint.x = reader->getDouble();
haveExtrusion = true;
extPoint.x = reader->getDouble();
break;
case 220:
@ -779,19 +867,19 @@ void DRW_Hatch::parseCode( int code, dxfReader* reader )
{
break;
}
else if( reader->getInt32() == 1 ) // line
else if( reader->getInt32() == 1 ) // line
{
addLine();
}
else if( reader->getInt32() == 2 ) // arc
else if( reader->getInt32() == 2 ) // arc
{
addArc();
}
else if( reader->getInt32() == 3 ) // elliptic arc
else if( reader->getInt32() == 3 ) // elliptic arc
{
addEllipse();
}
else if( reader->getInt32() == 4 ) // spline
else if( reader->getInt32() == 4 ) // spline
{
addSpline();
}
@ -804,8 +892,8 @@ void DRW_Hatch::parseCode( int code, dxfReader* reader )
pt->basePoint.x = reader->getDouble();
else if( pline )
{
plvert = pline->addVertex();
plvert->x = reader->getDouble();
plvert = pline->addVertex();
plvert->x = reader->getDouble();
}
break;
@ -1018,12 +1106,12 @@ void DRW_Spline::parseCode( int code, dxfReader* reader )
break;
case 10:
{
controlpoint = new DRW_Coord();
controllist.push_back( controlpoint );
controlpoint->x = reader->getDouble();
break;
}
{
controlpoint = new DRW_Coord();
controllist.push_back( controlpoint );
controlpoint->x = reader->getDouble();
break;
}
case 20:
@ -1040,12 +1128,12 @@ void DRW_Spline::parseCode( int code, dxfReader* reader )
break;
case 11:
{
fitpoint = new DRW_Coord();
fitlist.push_back( fitpoint );
fitpoint->x = reader->getDouble();
break;
}
{
fitpoint = new DRW_Coord();
fitlist.push_back( fitpoint );
fitpoint->x = reader->getDouble();
break;
}
case 21:
@ -1312,12 +1400,12 @@ void DRW_Leader::parseCode( int code, dxfReader* reader )
break;
case 10:
{
vertexpoint = new DRW_Coord();
vertexlist.push_back( vertexpoint );
vertexpoint->x = reader->getDouble();
break;
}
{
vertexpoint = new DRW_Coord();
vertexlist.push_back( vertexpoint );
vertexpoint->x = reader->getDouble();
break;
}
case 20:
@ -1413,10 +1501,10 @@ void DRW_Viewport::parseCode( int code, dxfReader* reader )
break;
case 12:
{
centerPX = reader->getDouble();
break;
}
{
centerPX = reader->getDouble();
break;
}
case 22:
centerPY = reader->getDouble();

View File

@ -23,7 +23,8 @@ class DRW_Polyline;
namespace DRW {
// ! Entity's type.
enum ETYPE {
enum ETYPE
{
POINT,
LINE,
CIRCLE,
@ -72,61 +73,73 @@ public:
// initializes default values
DRW_Entity()
{
eType = DRW::UNKNOWN;
lineType = "BYLAYER";
color = 256; // default BYLAYER (256)
ltypeScale = 1.0;
visible = true;
layer = "0";
lWeight = DRW_LW_Conv::widthByLayer; // default BYLAYER (dxf -1, dwg 29)
handleBlock = space = 0; // default ModelSpace (0) & handleBlock = no handle (0)
haveExtrusion = false;
color24 = -1; // default -1 not set
eType = DRW::UNKNOWN;
lineType = "BYLAYER";
color = 256; // default BYLAYER (256)
ltypeScale = 1.0;
visible = true;
layer = "0";
lWeight = DRW_LW_Conv::widthByLayer; // default BYLAYER (dxf -1, dwg 29)
handleBlock = space = 0; // default ModelSpace (0) & handleBlock = no handle (0)
haveExtrusion = false;
color24 = -1; // default -1 not set
handle = 0;
curr = NULL;
}
virtual ~DRW_Entity() {}
virtual ~DRW_Entity()
{
for( std::vector<DRW_Variant*>::iterator it = extData.begin(); it!=extData.end(); ++it )
delete *it;
extData.clear();
}
DRW_Entity( const DRW_Entity& d )
{
eType = d.eType;
handle = d.handle;
handleBlock = d.handleBlock;
layer = d.layer;
lineType = d.lineType;
color = d.color;
color24 = d.color24;
colorName = d.colorName;
ltypeScale = d.ltypeScale;
visible = d.visible;
lWeight = d.lWeight;
space = d.space;
haveExtrusion = d.haveExtrusion;
layer = d.layer;
lineType = d.lineType;
color = d.color;
color24 = d.color24;
colorName = d.colorName;
ltypeScale = d.ltypeScale;
visible = d.visible;
lWeight = d.lWeight;
space = d.space;
haveExtrusion = d.haveExtrusion;
curr = NULL;
}
virtual void applyExtrusion() = 0;
virtual void applyExtrusion() = 0;
protected:
void parseCode( int code, dxfReader* reader );
void calculateAxis( DRW_Coord extPoint );
void extrudePoint( DRW_Coord extPoint, DRW_Coord* point );
void parseCode( int code, dxfReader* reader );
void calculateAxis( DRW_Coord extPoint );
void extrudePoint( DRW_Coord extPoint, DRW_Coord* point );
public:
enum DRW::ETYPE eType; /*!< enum: entity type, code 0 */
int handle; /*!< entity identifier, code 5 */
int handleBlock; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
UTF8STRING layer; /*!< layer name, code 8 */
UTF8STRING lineType; /*!< line type, code 6 */
int color; /*!< entity color, code 62 */
enum DRW_LW_Conv::lineWidth lWeight; /*!< entity lineweight, code 370 */
double ltypeScale; /*!< linetype scale, code 48 */
bool visible; /*!< entity visibility, code 60 */
int color24; /*!< 24-bit color, code 420 */
std::string colorName; /*!< color name, code 430 */
int space; /*!< space indicator 0 = model, 1 paper, code 67*/
bool haveExtrusion; /*!< set to true if the entity have extrusion*/
enum DRW::ETYPE eType; /*!< enum: entity type, code 0 */
int handle; /*!< entity identifier, code 5 */
int handleBlock; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
UTF8STRING layer; /*!< layer name, code 8 */
UTF8STRING lineType; /*!< line type, code 6 */
int color; /*!< entity color, code 62 */
enum DRW_LW_Conv::lineWidth lWeight; /*!< entity lineweight, code 370 */
double ltypeScale; /*!< linetype scale, code 48 */
bool visible; /*!< entity visibility, code 60 */
int color24; /*!< 24-bit color, code 420 */
std::string colorName; /*!< color name, code 430 */
int space; /*!< space indicator 0 = model, 1 paper, code 67*/
bool haveExtrusion; /*!< set to true if the entity have extrusion*/
std::vector<DRW_Variant*> extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
private:
DRW_Coord extAxisX;
DRW_Coord extAxisY;
DRW_Coord extAxisX;
DRW_Coord extAxisY;
DRW_Variant* curr;
};
@ -143,7 +156,7 @@ public:
eType = DRW::POINT;
basePoint.z = extPoint.x = extPoint.y = 0;
extPoint.z = 1;
thickness = 0;
thickness = 0;
}
virtual void applyExtrusion() {}
@ -151,9 +164,9 @@ public:
void parseCode( int code, dxfReader* reader );
public:
DRW_Coord basePoint; /*!< base point, code 10, 20 & 30 */
double thickness; /*!< thickness, code 39 */
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
DRW_Coord basePoint; /*!< base point, code 10, 20 & 30 */
double thickness; /*!< thickness, code 39 */
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
};
// ! Class to handle line entity
@ -216,6 +229,7 @@ public:
DRW_Circle()
{
eType = DRW::CIRCLE;
radious = 0.0;
}
virtual void applyExtrusion();
@ -237,15 +251,17 @@ public:
{
eType = DRW::ARC;
isccw = 1;
staangle = 0.0;
endangle = 0.0;
}
virtual void applyExtrusion() { DRW_Circle::applyExtrusion(); }
void parseCode( int code, dxfReader* reader );
virtual void applyExtrusion();
void parseCode( int code, dxfReader* reader );
public:
double staangle; /*!< start angle, code 50 in radians*/
double endangle; /*!< end angle, code 51 in radians */
int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
};
// ! Class to handle ellipse entity
@ -262,6 +278,8 @@ public:
{
eType = DRW::ELLIPSE;
isccw = 1;
ratio = 1.0;
staparam = endparam = 0;
}
void parseCode( int code, dxfReader* reader );
@ -273,7 +291,7 @@ public:
double ratio; /*!< ratio, code 40 */
double staparam; /*!< start parameter, code 41, 0.0 for full ellipse*/
double endparam; /*!< end parameter, code 42, 2*PI for full ellipse */
int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
};
// ! Class to handle trace entity
@ -356,8 +374,8 @@ public:
void parseCode( int code, dxfReader* reader );
public:
UTF8STRING name; /*!< block name, code 2 */
int flags; /*!< block type, code 70 */
UTF8STRING name; /*!< block name, code 2 */
int flags; /*!< block type, code 70 */
};
@ -371,11 +389,11 @@ class DRW_Insert : public DRW_Point
public:
DRW_Insert()
{
eType = DRW::INSERT;
xscale = 1;
yscale = 1;
zscale = 1;
angle = 0;
eType = DRW::INSERT;
xscale = 1;
yscale = 1;
zscale = 1;
angle = 0;
colcount = 1;
rowcount = 1;
colspace = 0;
@ -386,15 +404,15 @@ public:
void parseCode( int code, dxfReader* reader );
public:
UTF8STRING name; /*!< block name, code 2 */
double xscale; /*!< x scale factor, code 41 */
double yscale; /*!< y scale factor, code 42 */
double zscale; /*!< z scale factor, code 43 */
double angle; /*!< rotation angle, code 50 */
int colcount; /*!< column count, code 70 */
int rowcount; /*!< row count, code 71 */
double colspace; /*!< column space, code 44 */
double rowspace; /*!< row space, code 45 */
UTF8STRING name; /*!< block name, code 2 */
double xscale; /*!< x scale factor, code 41 */
double yscale; /*!< y scale factor, code 42 */
double zscale; /*!< z scale factor, code 43 */
double angle; /*!< rotation angle, code 50 */
int colcount; /*!< column count, code 70 */
int rowcount; /*!< row count, code 71 */
double colspace; /*!< column space, code 44 */
double rowspace; /*!< row space, code 45 */
};
// ! Class to handle lwpolyline entity
@ -407,12 +425,13 @@ class DRW_LWPolyline : public DRW_Entity
public:
DRW_LWPolyline()
{
eType = DRW::LWPOLYLINE;
elevation = thickness = width = 0.0;
flags = 0;
eType = DRW::LWPOLYLINE;
elevation = thickness = width = 0.0;
flags = 0;
extPoint.x = extPoint.y = 0;
extPoint.z = 1;
vertex = NULL;
vertex = NULL;
vertexnum = 0;
}
~DRW_LWPolyline()
@ -433,7 +452,7 @@ public:
vert->y = v.y;
vert->stawidth = v.stawidth;
vert->endwidth = v.endwidth;
vert->bulge = v.bulge;
vert->bulge = v.bulge;
vertlist.push_back( vert );
}
@ -443,7 +462,7 @@ public:
vert->stawidth = 0;
vert->endwidth = 0;
vert->bulge = 0;
vert->bulge = 0;
vertlist.push_back( vert );
return vert;
}
@ -451,13 +470,13 @@ public:
void parseCode( int code, dxfReader* reader );
public:
int vertexnum; /*!< number of vertex, code 90 */
int flags; /*!< polyline flag, code 70, default 0 */
double width; /*!< constant width, code 43 */
double elevation; /*!< elevation, code 38 */
double thickness; /*!< thickness, code 39 */
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
DRW_Vertex2D* vertex; /*!< current vertex to add data */
int vertexnum; /*!< number of vertex, code 90 */
int flags; /*!< polyline flag, code 70, default 0 */
double width; /*!< constant width, code 43 */
double elevation; /*!< elevation, code 38 */
double thickness; /*!< thickness, code 39 */
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
DRW_Vertex2D* vertex; /*!< current vertex to add data */
std::vector<DRW_Vertex2D*> vertlist; /*!< vertex list */
};
@ -470,7 +489,8 @@ class DRW_Text : public DRW_Line
{
public:
// ! Vertical alignments.
enum VAlign {
enum VAlign
{
VBaseLine = 0, /*!< Top = 0 */
VBottom, /*!< Bottom = 1 */
VMiddle, /*!< Middle = 2 */
@ -478,7 +498,8 @@ public:
};
// ! Horizontal alignments.
enum HAlign {
enum HAlign
{
HLeft = 0, /*!< Left = 0 */
HCenter, /*!< Centered = 1 */
HRight, /*!< Right = 2 */
@ -491,25 +512,26 @@ public:
{
eType = DRW::TEXT;
angle = 0;
widthscale = 1;
oblique = 0;
style = "STANDARD";
widthscale = 1;
oblique = 0;
style = "STANDARD";
textgen = 0;
alignH = HLeft;
alignV = VBaseLine;
height = 0.0;
}
virtual void applyExtrusion() {} // RLZ TODO
void parseCode( int code, dxfReader* reader );
public:
double height; /*!< height text, code 40 */
UTF8STRING text; /*!< text string, code 1 */
double angle; /*!< rotation angle in degrees (360), code 50 */
double widthscale; /*!< width factor, code 41 */
double oblique; /*!< oblique angle, code 51 */
UTF8STRING style; /*!< style name, code 7 */
int textgen; /*!< text generation, code 71 */
double height; /*!< height text, code 40 */
UTF8STRING text; /*!< text string, code 1 */
double angle; /*!< rotation angle in degrees (360), code 50 */
double widthscale; /*!< width factor, code 41 */
double oblique; /*!< oblique angle, code 51 */
UTF8STRING style; /*!< style name, code 7 */
int textgen; /*!< text generation, code 71 */
enum HAlign alignH; /*!< horizontal align, code 72 */
enum VAlign alignV; /*!< vertical align, code 73 */
};
@ -523,7 +545,8 @@ class DRW_MText : public DRW_Text
{
public:
// ! Attachments.
enum Attach {
enum Attach
{
TopLeft = 1,
TopCenter,
TopRight,
@ -537,20 +560,21 @@ public:
DRW_MText()
{
eType = DRW::MTEXT;
interlin = 1;
alignV = (VAlign) TopLeft;
textgen = 1;
haveXAxis = false; // if true needed to recalculate angle
eType = DRW::MTEXT;
interlin = 1;
alignV = (VAlign) TopLeft;
textgen = 1;
haveXAxis = false; // if true needed to recalculate angle
}
void parseCode( int code, dxfReader* reader );
void updateAngle(); // recalculate angle if 'haveXAxis' is true
public:
double interlin; /*!< width factor, code 44 */
double interlin; /*!< width factor, code 44 */
private:
bool haveXAxis;
bool haveXAxis;
};
// ! Class to handle vertex
@ -563,21 +587,23 @@ class DRW_Vertex : public DRW_Point
public:
DRW_Vertex()
{
eType = DRW::VERTEX;
eType = DRW::VERTEX;
stawidth = endwidth = bulge = 0;
vindex1 = vindex2 = vindex3 = vindex4 = 0;
flags = identifier = 0;
flags = identifier = 0;
tgdir = 0.0;
}
DRW_Vertex( double sx, double sy, double sz, double b )
{
stawidth = endwidth = 0;
vindex1 = vindex2 = vindex3 = vindex4 = 0;
flags = identifier = 0;
flags = identifier = 0;
basePoint.x = sx;
basePoint.y = sy;
basePoint.z = sz;
bulge = b;
bulge = b;
tgdir = 0.0;
}
void parseCode( int code, dxfReader* reader );
@ -587,13 +613,13 @@ public:
double endwidth; /*!< End width, code 41 */
double bulge; /*!< bulge, code 42 */
int flags; /*!< vertex flag, code 70, default 0 */
double tgdir; /*!< curve fit tangent direction, code 50 */
int vindex1; /*!< polyface mesh vertex index, code 71, default 0 */
int vindex2; /*!< polyface mesh vertex index, code 72, default 0 */
int vindex3; /*!< polyface mesh vertex index, code 73, default 0 */
int vindex4; /*!< polyface mesh vertex index, code 74, default 0 */
int identifier; /*!< vertex identifier, code 91, default 0 */
int flags; /*!< vertex flag, code 70, default 0 */
double tgdir; /*!< curve fit tangent direction, code 50 */
int vindex1; /*!< polyface mesh vertex index, code 71, default 0 */
int vindex2; /*!< polyface mesh vertex index, code 72, default 0 */
int vindex3; /*!< polyface mesh vertex index, code 73, default 0 */
int vindex4; /*!< polyface mesh vertex index, code 74, default 0 */
int identifier; /*!< vertex identifier, code 91, default 0 */
};
// ! Class to handle polyline entity
@ -609,7 +635,7 @@ public:
eType = DRW::POLYLINE;
defstawidth = defendwidth = 0.0;
basePoint.x = basePoint.y = 0.0;
flags = vertexcount = facecount = 0;
flags = vertexcount = facecount = 0;
smoothM = smoothN = curvetype = 0;
}
@ -628,8 +654,8 @@ public:
vert->basePoint.x = v.basePoint.x;
vert->basePoint.y = v.basePoint.y;
vert->basePoint.z = v.basePoint.z;
vert->stawidth = v.stawidth;
vert->endwidth = v.endwidth;
vert->stawidth = v.stawidth;
vert->endwidth = v.endwidth;
vert->bulge = v.bulge;
vertlist.push_back( vert );
}
@ -642,14 +668,14 @@ public:
void parseCode( int code, dxfReader* reader );
public:
int flags; /*!< polyline flag, code 70, default 0 */
int flags; /*!< polyline flag, code 70, default 0 */
double defstawidth; /*!< Start width, code 40, default 0 */
double defendwidth; /*!< End width, code 41, default 0 */
int vertexcount; /*!< polygon mesh M vertex or polyface vertex num, code 71, default 0 */
int facecount; /*!< polygon mesh N vertex or polyface face num, code 72, default 0 */
int smoothM; /*!< smooth surface M density, code 73, default 0 */
int smoothN; /*!< smooth surface M density, code 74, default 0 */
int curvetype; /*!< curves & smooth surface type, code 75, default 0 */
int vertexcount; /*!< polygon mesh M vertex or polyface vertex num, code 71, default 0 */
int facecount; /*!< polygon mesh N vertex or polyface face num, code 72, default 0 */
int smoothM; /*!< smooth surface M density, code 73, default 0 */
int smoothN; /*!< smooth surface M density, code 74, default 0 */
int curvetype; /*!< curves & smooth surface type, code 75, default 0 */
std::vector<DRW_Vertex*> vertlist; /*!< vertex list */
};
@ -667,9 +693,13 @@ public:
{
eType = DRW::SPLINE;
flags = nknots = ncontrol = nfit = 0;
ex = ey = 0.0;
ez = 1.0;
ex = ey = 0.0;
ez = 1.0;
tolknot = tolcontrol = tolfit = 0.0000001;
tgsx = tgsy = tgsz = tgex = tgey = tgez = 0.0;
degree = 0;
controlpoint = 0;
fitpoint = 0;
}
~DRW_Spline()
@ -699,21 +729,22 @@ public:
double tgex; /*!< end tangent x coordinate, code 13 */
double tgey; /*!< end tangent y coordinate, code 23 */
double tgez; /*!< end tangent z coordinate, code 33 */
int flags; /*!< spline flag, code 70 */
int degree; /*!< degree of the spline, code 71 */
int nknots; /*!< number of knots, code 72, default 0 */
int ncontrol; /*!< number of control points, code 73, default 0 */
int nfit; /*!< number of fit points, code 74, default 0 */
int flags; /*!< spline flag, code 70 */
int degree; /*!< degree of the spline, code 71 */
int nknots; /*!< number of knots, code 72, default 0 */
int ncontrol; /*!< number of control points, code 73, default 0 */
int nfit; /*!< number of fit points, code 74, default 0 */
double tolknot; /*!< knot tolerance, code 42, default 0.0000001 */
double tolcontrol; /*!< control point tolerance, code 43, default 0.0000001 */
double tolfit; /*!< fit point tolerance, code 44, default 0.0000001 */
std::vector<double> knotslist; /*!< knots list, code 40 */
std::vector<double> knotslist; /*!< knots list, code 40 */
std::vector<DRW_Coord*> controllist; /*!< control points list, code 10, 20 & 30 */
std::vector<DRW_Coord*> fitlist; /*!< fit points list, code 11, 21 & 31 */
private:
DRW_Coord* controlpoint; /*!< current control point to add data */
DRW_Coord* fitpoint; /*!< current fit point to add data */
DRW_Coord* controlpoint; /*!< current control point to add data */
DRW_Coord* fitpoint; /*!< current fit point to add data */
};
// ! Class to handle hatch loop
@ -726,8 +757,8 @@ class DRW_HatchLoop
public:
DRW_HatchLoop( int t )
{
type = t;
numedges = 0;
type = t;
numedges = 0;
}
~DRW_HatchLoop()
@ -768,11 +799,12 @@ public:
eType = DRW::HATCH;
angle = scale = 0.0;
basePoint.x = basePoint.y = basePoint.z = 0.0;
loopsnum = hstyle = associative = 0;
solid = hpattern = 1;
deflines = doubleflag = 0;
loop = NULL;
loopsnum = hstyle = associative = 0;
solid = hpattern = 1;
deflines = doubleflag = 0;
loop = NULL;
clearEntities();
ispol = false;
}
~DRW_Hatch()
@ -792,24 +824,25 @@ public:
void parseCode( int code, dxfReader* reader );
public:
UTF8STRING name; /*!< hatch pattern name, code 2 */
int solid; /*!< solid fill flag, code 70, solid=1, pattern=0 */
int associative; /*!< associativity, code 71, associatve=1, non-assoc.=0 */
int hstyle; /*!< hatch style, code 75 */
int hpattern; /*!< hatch pattern type, code 76 */
int doubleflag; /*!< hatch pattern double flag, code 77, double=1, single=0 */
int loopsnum; /*!< namber of boundary paths (loops), code 91 */
double angle; /*!< hatch pattern angle, code 52 */
double scale; /*!< hatch pattern scale, code 41 */
int deflines; /*!< number of pattern definition lines, code 78 */
UTF8STRING name; /*!< hatch pattern name, code 2 */
int solid; /*!< solid fill flag, code 70, solid=1, pattern=0 */
int associative; /*!< associativity, code 71, associatve=1, non-assoc.=0 */
int hstyle; /*!< hatch style, code 75 */
int hpattern; /*!< hatch pattern type, code 76 */
int doubleflag; /*!< hatch pattern double flag, code 77, double=1, single=0 */
int loopsnum; /*!< namber of boundary paths (loops), code 91 */
double angle; /*!< hatch pattern angle, code 52 */
double scale; /*!< hatch pattern scale, code 41 */
int deflines; /*!< number of pattern definition lines, code 78 */
std::vector<DRW_HatchLoop*> looplist; /*!< polyline list */
private:
void clearEntities()
{
pt = line = NULL;
pline = NULL;
arc = NULL;
pt = line = NULL;
pline = NULL;
arc = NULL;
ellipse = NULL;
spline = NULL;
plvert = NULL;
@ -854,21 +887,21 @@ private:
if( loop )
{
pt = NULL;
spline = new DRW_Spline;
pt = NULL;
spline = new DRW_Spline;
loop->objlist.push_back( spline );
}
}
DRW_HatchLoop* loop; /*!< current loop to add data */
DRW_Line* line;
DRW_Arc* arc;
DRW_HatchLoop* loop; /*!< current loop to add data */
DRW_Line* line;
DRW_Arc* arc;
DRW_Ellipse* ellipse;
DRW_Spline* spline;
DRW_LWPolyline* pline;
DRW_Point* pt;
DRW_Vertex2D* plvert;
bool ispol;
DRW_Point* pt;
DRW_Vertex2D* plvert;
bool ispol;
};
// ! Class to handle image entity
@ -881,25 +914,26 @@ class DRW_Image : public DRW_Line
public:
DRW_Image()
{
eType = DRW::IMAGE;
vz = fade = clip = 0;
eType = DRW::IMAGE;
vz = fade = clip = 0;
brightness = contrast = 50;
vx = vy = sizeu = sizev = dz = 0.0;
}
void parseCode( int code, dxfReader* reader );
public:
std::string ref; /*!< Hard reference to imagedef object, code 340 */
double vx; /*!< V-vector of single pixel, x coordinate, code 12 */
double vy; /*!< V-vector of single pixel, y coordinate, code 22 */
double vz; /*!< V-vector of single pixel, z coordinate, code 32 */
double sizeu; /*!< image size in pixels, U value, code 13 */
double sizev; /*!< image size in pixels, V value, code 23 */
double dz; /*!< z coordinate, code 33 */
int clip; /*!< Clipping state, code 280, 0=off 1=on */
int brightness; /*!< Brightness value, code 281, (0-100) default 50 */
int contrast; /*!< Brightness value, code 282, (0-100) default 50 */
int fade; /*!< Brightness value, code 283, (0-100) default 0 */
double vx; /*!< V-vector of single pixel, x coordinate, code 12 */
double vy; /*!< V-vector of single pixel, y coordinate, code 22 */
double vz; /*!< V-vector of single pixel, z coordinate, code 32 */
double sizeu; /*!< image size in pixels, U value, code 13 */
double sizev; /*!< image size in pixels, V value, code 23 */
double dz; /*!< z coordinate, code 33 */
int clip; /*!< Clipping state, code 280, 0=off 1=on */
int brightness; /*!< Brightness value, code 281, (0-100) default 50 */
int contrast; /*!< Brightness value, code 282, (0-100) default 50 */
int fade; /*!< Brightness value, code 283, (0-100) default 0 */
};
@ -913,39 +947,41 @@ class DRW_Dimension : public DRW_Entity
public:
DRW_Dimension()
{
eType = DRW::DIMENSION;
linesty = 1;
linefactor = extPoint.z = 1.0;
angle = oblique = rot = 0.0;
align = 5;
style = "STANDARD";
eType = DRW::DIMENSION;
linesty = 1;
linefactor = extPoint.z = 1.0;
angle = oblique = rot = 0.0;
align = 5;
style = "STANDARD";
defPoint.z = extPoint.x = extPoint.y = 0;
textPoint.z = rot = 0;
clonePoint.x = clonePoint.y = clonePoint.z = 0;
type = 0;
length = 0.0;
}
DRW_Dimension( const DRW_Dimension& d ) : DRW_Entity( d )
{
eType = DRW::DIMENSION;
type = d.type;
name = d.name;
eType = DRW::DIMENSION;
type = d.type;
name = d.name;
defPoint = d.defPoint;
textPoint = d.textPoint;
text = d.text;
style = d.style;
align = d.align;
linesty = d.linesty;
linefactor = d.linefactor;
text = d.text;
style = d.style;
align = d.align;
linesty = d.linesty;
linefactor = d.linefactor;
rot = d.rot;
extPoint = d.extPoint;
clonePoint = d.clonePoint;
def1 = d.def1;
def2 = d.def2;
angle = d.angle;
extPoint = d.extPoint;
clonePoint = d.clonePoint;
def1 = d.def1;
def2 = d.def2;
angle = d.angle;
oblique = d.oblique;
arcPoint = d.arcPoint;
circlePoint = d.circlePoint;
length = d.length;
length = d.length;
}
virtual ~DRW_Dimension() {}
@ -955,68 +991,71 @@ public:
virtual void applyExtrusion() {}
DRW_Coord getDefPoint() const { return defPoint; } /*!< Definition point, code 10, 20 & 30 */
void setDefPoint( const DRW_Coord p ) { defPoint = p; }
void setDefPoint( const DRW_Coord& p ) { defPoint = p; }
DRW_Coord getTextPoint() const { return textPoint; } /*!< Middle point of text, code 11, 21 & 31 */
void setTextPoint( const DRW_Coord p ) { textPoint = p; }
void setTextPoint( const DRW_Coord& p ) { textPoint = p; }
std::string getStyle() const { return style; } /*!< Dimension style, code 3 */
void setStyle( const std::string s ) { style = s; }
void setStyle( const std::string& s ) { style = s; }
int getAlign() const { return align; } /*!< attachment point, code 71 */
void setAlign( const int a ) { align = a; }
int getTextLineStyle() const { return linesty; } /*!< Dimension text line spacing style, code 72, default 1 */
void setTextLineStyle( const int l ) { linesty = l; }
std::string getText() const { return text; } /*!< Dimension text explicitly entered by the user, code 1 */
void setText( const std::string t ) { text = t; }
void setText( const std::string& t ) { text = t; }
double getTextLineFactor() const { return linefactor; } /*!< Dimension text line spacing factor, code 41, default 1? */
void setTextLineFactor( const double l ) { linefactor = l; }
double getDir() const { return rot; } /*!< rotation angle of the dimension text, code 53 (optional) default 0 */
void setDir( const double d ) { rot = d; }
DRW_Coord getExtrusion() { return extPoint; } /*!< extrusion, code 210, 220 & 230 */
void setExtrusion( const DRW_Coord p ) { extPoint = p; }
void setExtrusion( const DRW_Coord& p ) { extPoint = p; }
std::string getName() { return name; } /*!< Name of the block that contains the entities, code 2 */
void setName( const std::string s ) { name = s; }
void setName( const std::string& s ) { name = s; }
// int getType(){ return type;} /*!< Dimension type, code 70 */
protected:
DRW_Coord getPt2() const { return clonePoint; }
void setPt2( const DRW_Coord p ) { clonePoint = p; }
void setPt2( const DRW_Coord& p ) { clonePoint = p; }
DRW_Coord getPt3() const { return def1; }
void setPt3( const DRW_Coord p ) { def1 = p; }
void setPt3( const DRW_Coord& p ) { def1 = p; }
DRW_Coord getPt4() const { return def2; }
void setPt4( const DRW_Coord p ) { def2 = p; }
void setPt4( const DRW_Coord& p ) { def2 = p; }
DRW_Coord getPt5() const { return circlePoint; }
void setPt5( const DRW_Coord p ) { circlePoint = p; }
void setPt5( const DRW_Coord& p ) { circlePoint = p; }
DRW_Coord getPt6() const { return arcPoint; }
void setPt6( const DRW_Coord p ) { arcPoint = p; }
void setPt6( const DRW_Coord& p ) { arcPoint = p; }
double getAn50() const { return angle; } /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
void setAn50( const double d ) { angle = d; }
double getOb52() const { return oblique; } /*!< oblique angle, code 52 */
void setOb52( const double d ) { oblique = d; }
double getRa40() const { return length; } /*!< Leader length, code 40 */
void setRa40( const double d ) { length = d; }
public:
int type; /*!< Dimension type, code 70 */
int type; /*!< Dimension type, code 70 */
private:
std::string name; /*!< Name of the block that contains the entities, code 2 */
DRW_Coord defPoint; /*!< definition point, code 10, 20 & 30 (WCS) */
DRW_Coord textPoint; /*!< Middle point of text, code 11, 21 & 31 (OCS) */
UTF8STRING text; /*!< Dimension text explicitly entered by the user, code 1 */
UTF8STRING style; /*!< Dimension style, code 3 */
int align; /*!< attachment point, code 71 */
int linesty; /*!< Dimension text line spacing style, code 72, default 1 */
double linefactor; /*!< Dimension text line spacing factor, code 41, default 1? (value range 0.25 to 4.00*/
double rot; /*!< rotation angle of the dimension text, code 53 */
DRW_Coord extPoint; /*!< extrusion normal vector, code 210, 220 & 230 */
int align; /*!< attachment point, code 71 */
int linesty; /*!< Dimension text line spacing style, code 72, default 1 */
double linefactor; /*!< Dimension text line spacing factor, code 41, default 1? (value range 0.25 to 4.00*/
double rot; /*!< rotation angle of the dimension text, code 53 */
DRW_Coord extPoint; /*!< extrusion normal vector, code 210, 220 & 230 */
// double hdir; /*!< horizontal direction for the dimension, code 51, default ? */
DRW_Coord clonePoint; /*!< Insertion point for clones (Baseline & Continue), code 12, 22 & 32 (OCS) */
DRW_Coord def1; /*!< Definition point 1for linear & angular, code 13, 23 & 33 (WCS) */
DRW_Coord def2; /*!< Definition point 2, code 14, 24 & 34 (WCS) */
double angle; /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
double oblique; /*!< oblique angle, code 52 */
double angle; /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
double oblique; /*!< oblique angle, code 52 */
DRW_Coord circlePoint; /*!< Definition point for diameter, radius & angular dims code 15, 25 & 35 (WCS) */
DRW_Coord arcPoint; /*!< Point defining dimension arc, x coordinate, code 16, 26 & 36 (OCS) */
double length; /*!< Leader length, code 40 */
double length; /*!< Leader length, code 40 */
};
@ -1039,14 +1078,14 @@ public:
}
DRW_Coord getClonepoint() const { return getPt2(); } /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */
void setClonePoint( DRW_Coord c ) { setPt2( c ); }
void setClonePoint( DRW_Coord& c ) { setPt2( c ); }
DRW_Coord getDimPoint() const { return getDefPoint(); } /*!< dim line location point, code 10, 20 & 30 */
void setDimPoint( const DRW_Coord p ) { setDefPoint( p ); }
void setDimPoint( const DRW_Coord& p ) { setDefPoint( p ); }
DRW_Coord getDef1Point() const { return getPt3(); } /*!< Definition point 1, code 13, 23 & 33 */
void setDef1Point( const DRW_Coord p ) { setPt3( p ); }
void setDef1Point( const DRW_Coord& p ) { setPt3( p ); }
DRW_Coord getDef2Point() const { return getPt4(); } /*!< Definition point 2, code 14, 24 & 34 */
void setDef2Point( const DRW_Coord p ) { setPt4( p ); }
void setDef2Point( const DRW_Coord& p ) { setPt4( p ); }
};
// ! Class to handle linear or rotated dimension entity
@ -1092,9 +1131,9 @@ public:
}
DRW_Coord getCenterPoint() const { return getDefPoint(); } /*!< center point, code 10, 20 & 30 */
void setCenterPoint( const DRW_Coord p ) { setDefPoint( p ); }
void setCenterPoint( const DRW_Coord& p ) { setDefPoint( p ); }
DRW_Coord getDiameterPoint() const { return getPt5(); } /*!< Definition point for radius, code 15, 25 & 35 */
void setDiameterPoint( const DRW_Coord p ) { setPt5( p ); }
void setDiameterPoint( const DRW_Coord& p ) { setPt5( p ); }
double getLeaderLength() const { return getRa40(); } /*!< Leader length, code 40 */
void setLeaderLength( const double d ) { setRa40( d ); }
};
@ -1118,9 +1157,9 @@ public:
}
DRW_Coord getDiameter1Point() const { return getPt5(); } /*!< First definition point for diameter, code 15, 25 & 35 */
void setDiameter1Point( const DRW_Coord p ) { setPt5( p ); }
void setDiameter1Point( const DRW_Coord& p ) { setPt5( p ); }
DRW_Coord getDiameter2Point() const { return getDefPoint(); } /*!< Oposite point for diameter, code 10, 20 & 30 */
void setDiameter2Point( const DRW_Coord p ) { setDefPoint( p ); }
void setDiameter2Point( const DRW_Coord& p ) { setDefPoint( p ); }
double getLeaderLength() const { return getRa40(); } /*!< Leader length, code 40 */
void setLeaderLength( const double d ) { setRa40( d ); }
};
@ -1144,15 +1183,15 @@ public:
}
DRW_Coord getFirstLine1() const { return getPt3(); } /*!< Definition point line 1-1, code 13, 23 & 33 */
void setFirstLine1( const DRW_Coord p ) { setPt3( p ); }
void setFirstLine1( const DRW_Coord& p ) { setPt3( p ); }
DRW_Coord getFirstLine2() const { return getPt4(); } /*!< Definition point line 1-2, code 14, 24 & 34 */
void setFirstLine2( const DRW_Coord p ) { setPt4( p ); }
void setFirstLine2( const DRW_Coord& p ) { setPt4( p ); }
DRW_Coord getSecondLine1() const { return getPt5(); } /*!< Definition point line 2-1, code 15, 25 & 35 */
void setSecondLine1( const DRW_Coord p ) { setPt5( p ); }
void setSecondLine1( const DRW_Coord& p ) { setPt5( p ); }
DRW_Coord getSecondLine2() const { return getDefPoint(); } /*!< Definition point line 2-2, code 10, 20 & 30 */
void setSecondLine2( const DRW_Coord p ) { setDefPoint( p ); }
void setSecondLine2( const DRW_Coord& p ) { setDefPoint( p ); }
DRW_Coord getDimPoint() const { return getPt6(); } /*!< Dimension definition point, code 16, 26 & 36 */
void setDimPoint( const DRW_Coord p ) { setPt6( p ); }
void setDimPoint( const DRW_Coord& p ) { setPt6( p ); }
};
@ -1175,13 +1214,13 @@ public:
}
DRW_Coord getFirstLine() const { return getPt3(); } /*!< Definition point line 1, code 13, 23 & 33 */
void setFirstLine( const DRW_Coord p ) { setPt3( p ); }
void setFirstLine( const DRW_Coord& p ) { setPt3( p ); }
DRW_Coord getSecondLine() const { return getPt4(); } /*!< Definition point line 2, code 14, 24 & 34 */
void setSecondLine( const DRW_Coord p ) { setPt4( p ); }
void setSecondLine( const DRW_Coord& p ) { setPt4( p ); }
DRW_Coord getVertexPoint() const { return getPt5(); } /*!< Vertex point, code 15, 25 & 35 */
void SetVertexPoint( const DRW_Coord p ) { setPt5( p ); }
void SetVertexPoint( const DRW_Coord& p ) { setPt5( p ); }
DRW_Coord getDimPoint() const { return getDefPoint(); } /*!< Dimension definition point, code 10, 20 & 30 */
void setDimPoint( const DRW_Coord p ) { setDefPoint( p ); }
void setDimPoint( const DRW_Coord& p ) { setDefPoint( p ); }
};
// ! Class to handle ordinate dimension entity
@ -1203,11 +1242,11 @@ public:
}
DRW_Coord getOriginPoint() const { return getDefPoint(); } /*!< Origin definition point, code 10, 20 & 30 */
void setOriginPoint( const DRW_Coord p ) { setDefPoint( p ); }
void setOriginPoint( const DRW_Coord& p ) { setDefPoint( p ); }
DRW_Coord getFirstLine() const { return getPt3(); } /*!< Feature location point, code 13, 23 & 33 */
void setFirstLine( const DRW_Coord p ) { setPt3( p ); }
void setFirstLine( const DRW_Coord& p ) { setPt3( p ); }
DRW_Coord getSecondLine() const { return getPt4(); } /*!< Leader end point, code 14, 24 & 34 */
void setSecondLine( const DRW_Coord p ) { setPt4( p ); }
void setSecondLine( const DRW_Coord& p ) { setPt4( p ); }
};
@ -1221,12 +1260,16 @@ class DRW_Leader : public DRW_Entity
public:
DRW_Leader()
{
eType = DRW::LEADER;
flag = 3;
hookflag = vertnum = leadertype = 0;
eType = DRW::LEADER;
flag = 3;
hookflag = vertnum = leadertype = 0;
extrusionPoint.x = extrusionPoint.y = 0.0;
arrow = 1;
extrusionPoint.z = 1.0;
hookline = 0;
textheight = textwidth = 0.0;
coloruse = 0;
vertexpoint = NULL;
}
~DRW_Leader()
@ -1241,25 +1284,26 @@ public:
void parseCode( int code, dxfReader* reader );
public:
UTF8STRING style; /*!< Dimension style name, code 3 */
int arrow; /*!< Arrowhead flag, code 71, 0=Disabled; 1=Enabled */
int leadertype; /*!< Leader path type, code 72, 0=Straight line segments; 1=Spline */
int flag; /*!< Leader creation flag, code 73, default 3 */
int hookline; /*!< Hook line direction flag, code 74, default 1 */
int hookflag; /*!< Hook line flag, code 75 */
double textheight; /*!< Text annotation height, code 40 */
double textwidth; /*!< Text annotation width, code 41 */
int vertnum; /*!< Number of vertices, code 76 */
int coloruse; /*!< Color to use if leader's DIMCLRD = BYBLOCK, code 77 */
std::string handle; /*!< Hard reference to associated annotation, code 340 */
DRW_Coord extrusionPoint; /*!< Normal vector, code 210, 220 & 230 */
DRW_Coord horizdir; /*!< "Horizontal" direction for leader, code 211, 221 & 231 */
DRW_Coord offsetblock; /*!< Offset of last leader vertex from block, code 212, 222 & 232 */
DRW_Coord offsettext; /*!< Offset of last leader vertex from annotation, code 213, 223 & 233 */
UTF8STRING style; /*!< Dimension style name, code 3 */
int arrow; /*!< Arrowhead flag, code 71, 0=Disabled; 1=Enabled */
int leadertype; /*!< Leader path type, code 72, 0=Straight line segments; 1=Spline */
int flag; /*!< Leader creation flag, code 73, default 3 */
int hookline; /*!< Hook line direction flag, code 74, default 1 */
int hookflag; /*!< Hook line flag, code 75 */
double textheight; /*!< Text annotation height, code 40 */
double textwidth; /*!< Text annotation width, code 41 */
int vertnum; /*!< Number of vertices, code 76 */
int coloruse; /*!< Color to use if leader's DIMCLRD = BYBLOCK, code 77 */
std::string handle; /*!< Hard reference to associated annotation, code 340 */
DRW_Coord extrusionPoint; /*!< Normal vector, code 210, 220 & 230 */
DRW_Coord horizdir; /*!< "Horizontal" direction for leader, code 211, 221 & 231 */
DRW_Coord offsetblock; /*!< Offset of last leader vertex from block, code 212, 222 & 232 */
DRW_Coord offsettext; /*!< Offset of last leader vertex from annotation, code 213, 223 & 233 */
std::vector<DRW_Coord*> vertexlist; /*!< vertex points list, code 10, 20 & 30 */
std::vector<DRW_Coord*> vertexlist; /*!< vertex points list, code 10, 20 & 30 */
private:
DRW_Coord* vertexpoint; /*!< current control point to add data */
DRW_Coord* vertexpoint; /*!< current control point to add data */
};
// ! Class to handle viewport entity
@ -1272,8 +1316,8 @@ class DRW_Viewport : public DRW_Point
public:
DRW_Viewport()
{
eType = DRW::VIEWPORT;
vpstatus = 0;
eType = DRW::VIEWPORT;
vpID = vpstatus = 0;
pswidth = 205;
psheight = 156;
centerPX = 128.5;
@ -1286,8 +1330,8 @@ public:
public:
double pswidth; /*!< Width in paper space units, code 40 */
double psheight; /*!< Height in paper space units, code 41 */
int vpstatus; /*!< Viewport status, code 68 */
int vpID; /*!< Viewport ID, code 69 */
int vpstatus; /*!< Viewport status, code 68 */
int vpID; /*!< Viewport ID, code 69 */
double centerPX; /*!< view center piont X, code 12 */
double centerPY; /*!< view center piont Y, code 22 */
};

View File

@ -40,22 +40,25 @@ public:
}
/** Called when header is parsed. */
virtual void addHeader( const DRW_Header* data ) = 0;
virtual void addHeader( const DRW_Header* data ) = 0;
/** Called for every line Type. */
virtual void addLType( const DRW_LType& data ) = 0;
virtual void addLType( const DRW_LType& data ) = 0;
/** Called for every layer. */
virtual void addLayer( const DRW_Layer& data ) = 0;
virtual void addLayer( const DRW_Layer& data ) = 0;
/** Called for every dim style. */
virtual void addDimStyle( const DRW_Dimstyle& data ) = 0;
virtual void addDimStyle( const DRW_Dimstyle& data ) = 0;
/** Called for every VPORT table. */
virtual void addVport( const DRW_Vport& data ) = 0;
virtual void addVport( const DRW_Vport& data ) = 0;
/** Called for every text style. */
virtual void addTextStyle( const DRW_Textstyle& data ) = 0;
virtual void addTextStyle( const DRW_Textstyle& data ) = 0;
/** Called for every AppId entry. */
virtual void addAppId( const DRW_AppId& data ) = 0;
/**
* Called for every block. Note: all entities added after this
@ -63,7 +66,7 @@ public:
*
* @see endBlock()
*/
virtual void addBlock( const DRW_Block& data ) = 0;
virtual void addBlock( const DRW_Block& data ) = 0;
/**
* In DWG called when the following entities corresponding to a
@ -72,127 +75,127 @@ public:
*
* int handle are the value of DRW_Block::handleBlock added with addBlock()
*/
virtual void setBlock( const int handle ) = 0;
virtual void setBlock( const int handle ) = 0;
/** Called to end the current block */
virtual void endBlock() = 0;
virtual void endBlock() = 0;
/** Called for every point */
virtual void addPoint( const DRW_Point& data ) = 0;
virtual void addPoint( const DRW_Point& data ) = 0;
/** Called for every line */
virtual void addLine( const DRW_Line& data ) = 0;
virtual void addLine( const DRW_Line& data ) = 0;
/** Called for every ray */
virtual void addRay( const DRW_Ray& data ) = 0;
virtual void addRay( const DRW_Ray& data ) = 0;
/** Called for every xline */
virtual void addXline( const DRW_Xline& data ) = 0;
virtual void addXline( const DRW_Xline& data ) = 0;
/** Called for every arc */
virtual void addArc( const DRW_Arc& data ) = 0;
virtual void addArc( const DRW_Arc& data ) = 0;
/** Called for every circle */
virtual void addCircle( const DRW_Circle& data ) = 0;
virtual void addCircle( const DRW_Circle& data ) = 0;
/** Called for every ellipse */
virtual void addEllipse( const DRW_Ellipse& data ) = 0;
virtual void addEllipse( const DRW_Ellipse& data ) = 0;
/** Called for every lwpolyline */
virtual void addLWPolyline( const DRW_LWPolyline& data ) = 0;
virtual void addLWPolyline( const DRW_LWPolyline& data ) = 0;
/** Called for every polyline start */
virtual void addPolyline( const DRW_Polyline& data ) = 0;
virtual void addPolyline( const DRW_Polyline& data ) = 0;
/** Called for every spline */
virtual void addSpline( const DRW_Spline* data ) = 0;
virtual void addSpline( const DRW_Spline* data ) = 0;
/** Called for every spline knot value */
virtual void addKnot( const DRW_Entity& data ) = 0;
virtual void addKnot( const DRW_Entity& data ) = 0;
/** Called for every insert. */
virtual void addInsert( const DRW_Insert& data ) = 0;
virtual void addInsert( const DRW_Insert& data ) = 0;
/** Called for every trace start */
virtual void addTrace( const DRW_Trace& data ) = 0;
virtual void addTrace( const DRW_Trace& data ) = 0;
/** Called for every 3dface start */
virtual void add3dFace( const DRW_3Dface& data ) = 0;
virtual void add3dFace( const DRW_3Dface& data ) = 0;
/** Called for every solid start */
virtual void addSolid( const DRW_Solid& data ) = 0;
virtual void addSolid( const DRW_Solid& data ) = 0;
/** Called for every Multi Text entity. */
virtual void addMText( const DRW_MText& data ) = 0;
virtual void addMText( const DRW_MText& data ) = 0;
/** Called for every Text entity. */
virtual void addText( const DRW_Text& data ) = 0;
virtual void addText( const DRW_Text& data ) = 0;
/**
* Called for every aligned dimension entity.
*/
virtual void addDimAlign( const DRW_DimAligned* data ) = 0;
virtual void addDimAlign( const DRW_DimAligned* data ) = 0;
/**
* Called for every linear or rotated dimension entity.
*/
virtual void addDimLinear( const DRW_DimLinear* data ) = 0;
virtual void addDimLinear( const DRW_DimLinear* data ) = 0;
/**
* Called for every radial dimension entity.
*/
virtual void addDimRadial( const DRW_DimRadial* data ) = 0;
virtual void addDimRadial( const DRW_DimRadial* data ) = 0;
/**
* Called for every diametric dimension entity.
*/
virtual void addDimDiametric( const DRW_DimDiametric* data ) = 0;
virtual void addDimDiametric( const DRW_DimDiametric* data ) = 0;
/**
* Called for every angular dimension (2 lines version) entity.
*/
virtual void addDimAngular( const DRW_DimAngular* data ) = 0;
virtual void addDimAngular( const DRW_DimAngular* data ) = 0;
/**
* Called for every angular dimension (3 points version) entity.
*/
virtual void addDimAngular3P( const DRW_DimAngular3p* data ) = 0;
virtual void addDimAngular3P( const DRW_DimAngular3p* data ) = 0;
/**
* Called for every ordinate dimension entity.
*/
virtual void addDimOrdinate( const DRW_DimOrdinate* data ) = 0;
virtual void addDimOrdinate( const DRW_DimOrdinate* data ) = 0;
/**
* Called for every leader start.
*/
virtual void addLeader( const DRW_Leader* data ) = 0;
virtual void addLeader( const DRW_Leader* data ) = 0;
/**
* Called for every hatch entity.
*/
virtual void addHatch( const DRW_Hatch* data ) = 0;
virtual void addHatch( const DRW_Hatch* data ) = 0;
/**
* Called for every viewport entity.
*/
virtual void addViewport( const DRW_Viewport& data ) = 0;
virtual void addViewport( const DRW_Viewport& data ) = 0;
/**
* Called for every image entity.
*/
virtual void addImage( const DRW_Image* data ) = 0;
virtual void addImage( const DRW_Image* data ) = 0;
/**
* Called for every image definition.
*/
virtual void linkImage( const DRW_ImageDef* data ) = 0;
virtual void linkImage( const DRW_ImageDef* data ) = 0;
/**
* Called for every comment in the DXF file (code 999).
*/
virtual void addComment( const char* comment ) = 0;
virtual void addComment( const char* comment ) = 0;
/** Sets the current attributes for entities. */
/* void setExtrusion(double dx, double dy, double dz, double elevation) {
@ -208,12 +211,13 @@ public:
virtual void writeHeader( DRW_Header& data ) = 0;
virtual void writeBlocks() = 0;
virtual void writeBlockRecords() = 0;
virtual void writeEntities() = 0;
virtual void writeLTypes() = 0;
virtual void writeLayers() = 0;
virtual void writeTextstyles() = 0;
virtual void writeVports() = 0;
virtual void writeDimstyles() = 0;
virtual void writeEntities() = 0;
virtual void writeLTypes() = 0;
virtual void writeLayers() = 0;
virtual void writeTextstyles() = 0;
virtual void writeVports() = 0;
virtual void writeDimstyles() = 0;
virtual void writeAppId() = 0;
protected:
// DL_Attributes attributes;

View File

@ -41,6 +41,58 @@ void DRW_TableEntry::parseCode( int code, dxfReader* reader )
flags = reader->getInt32();
break;
case 1000:
case 1001:
case 1002:
case 1003:
case 1004:
case 1005:
extData.push_back( new DRW_Variant( code, reader->getString() ) );
break;
case 1010:
case 1011:
case 1012:
case 1013:
curr = new DRW_Variant();
curr->addCoord();
curr->setCoordX( reader->getDouble() );
curr->code = code;
extData.push_back( curr );
break;
case 1020:
case 1021:
case 1022:
case 1023:
if( curr )
curr->setCoordY( reader->getDouble() );
break;
case 1030:
case 1031:
case 1032:
case 1033:
if( curr )
curr->setCoordZ( reader->getDouble() );
curr = NULL;
break;
case 1040:
case 1041:
case 1042:
extData.push_back( new DRW_Variant( code, reader->getDouble() ) );
break;
case 1070:
case 1071:
extData.push_back( new DRW_Variant( code, reader->getInt32() ) );
break;
default:
break;
}
@ -747,7 +799,7 @@ void DRW_Header::parseCode( int code, dxfReader* reader )
break;
case 10:
curr->addCoord( new DRW_Coord() );
curr->addCoord();
curr->setCoordX( reader->getDouble() );
curr->code = code;
break;
@ -815,8 +867,8 @@ void DRW_Header::parseCode( int code, dxfReader* reader )
void DRW_Header::write( dxfWriter* writer, DRW::Version ver )
{
/*RLZ: TODO complete all vars to AC1024*/
double varDouble;
int varInt;
double varDouble;
int varInt;
std::string varStr;
DRW_Coord varCoord;
@ -970,6 +1022,8 @@ void DRW_Header::write( dxfWriter* writer, DRW::Version ver )
writer->writeUtf8String( 7, varStr );
else
writer->writeString( 7, "STANDARD" );
@ -982,6 +1036,8 @@ void DRW_Header::write( dxfWriter* writer, DRW::Version ver )
writer->writeUtf8String( 8, varStr );
else
writer->writeString( 8, "0" );
@ -1082,6 +1138,8 @@ void DRW_Header::write( dxfWriter* writer, DRW::Version ver )
writer->writeUtf8String( 2, varStr );
else
writer->writeString( 2, "STANDARD" );
@ -1235,7 +1293,7 @@ void DRW_Header::write( dxfWriter* writer, DRW::Version ver )
#ifdef DRW_DBG
std::map<std::string, DRW_Variant*>::const_iterator it;
for( it = vars.begin(); it != vars.end(); it++ )
for( it = vars.begin(); it != vars.end(); ++it )
{
// QString key = QString::fromStdString((*it).first);
std::cerr << (*it).first << std::endl;
@ -1245,6 +1303,42 @@ void DRW_Header::write( dxfWriter* writer, DRW::Version ver )
}
void DRW_Header::addDouble( std::string key, double value, int code )
{
curr = new DRW_Variant();
curr->addDouble( value );
curr->code = code;
vars[key] = curr;
}
void DRW_Header::addInt( std::string key, int value, int code )
{
curr = new DRW_Variant();
curr->addInt( value );
curr->code = code;
vars[key] = curr;
}
void DRW_Header::addStr( std::string key, std::string value, int code )
{
curr = new DRW_Variant();
curr->addString( value );
curr->code = code;
vars[key] = curr;
}
void DRW_Header::addCoord( std::string key, DRW_Coord value, int code )
{
curr = new DRW_Variant();
curr->addCoord( value );
curr->code = code;
vars[key] = curr;
}
bool DRW_Header::getDouble( std::string key, double* varDouble )
{
bool result = false;
@ -1258,8 +1352,8 @@ bool DRW_Header::getDouble( std::string key, double* varDouble )
if( var->type == DRW_Variant::DOUBLE )
{
*varDouble = var->content.d;
result = true;
*varDouble = var->content.d;
result = true;
}
vars.erase( it );
@ -1330,8 +1424,8 @@ bool DRW_Header::getCoord( std::string key, DRW_Coord* varCoord )
if( var->type == DRW_Variant::COORD )
{
*varCoord = *var->content.v;
result = true;
*varCoord = *var->content.v;
result = true;
}
vars.erase( it );

View File

@ -24,14 +24,16 @@ class dxfWriter;
namespace DRW {
// ! Table entries type.
enum TTYPE {
enum TTYPE
{
UNKNOWNT,
LTYPE,
LAYER,
STYLE,
DIMSTYLE,
VPORT,
BLOCK_RECORD
BLOCK_RECORD,
APPID
};
}
@ -48,18 +50,42 @@ public:
{
tType = DRW::UNKNOWNT;
flags = 0;
curr = NULL;
handle = 0;
handleBlock = 0;
}
virtual ~DRW_TableEntry()
{
for( std::vector<DRW_Variant*>::iterator it = extData.begin(); it!=extData.end(); ++it )
delete *it;
extData.clear();
}
virtual ~DRW_TableEntry() {}
protected:
void parseCode( int code, dxfReader* reader );
void reset()
{
flags = 0;
for( std::vector<DRW_Variant*>::iterator it = extData.begin(); it!=extData.end(); ++it )
delete *it;
extData.clear();
}
public:
enum DRW::TTYPE tType; /*!< enum: entity type, code 0 */
int handle; /*!< entity identifier, code 5 */
int handleBlock; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
UTF8STRING name; /*!< entry name, code 2 */
int flags; /*!< Flags relevant to entry, code 70 */
enum DRW::TTYPE tType; /*!< enum: entity type, code 0 */
int handle; /*!< entity identifier, code 5 */
int handleBlock; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
UTF8STRING name; /*!< entry name, code 2 */
int flags; /*!< Flags relevant to entry, code 70 */
std::vector<DRW_Variant*> extData; /*!< FIFO list of extended data, codes 1000 to 1071*/
private:
DRW_Variant* curr;
};
@ -75,27 +101,28 @@ public:
void reset()
{
tType = DRW::DIMSTYLE;
dimasz = dimtxt = dimexe = 0.18;
dimexo = 0.0625;
dimgap = dimcen = 0.09;
tType = DRW::DIMSTYLE;
dimasz = dimtxt = dimexe = 0.18;
dimexo = 0.0625;
dimgap = dimcen = 0.09;
dimtxsty = "Standard";
dimscale = dimlfac = dimtfac = 1.0;
dimdli = 0.38;
dimrnd = dimdle = dimtp = dimtm = dimtsz = dimtvp = 0.0;
dimaltf = 25.4;
dimtol = dimlim = dimse1 = dimse2 = dimtad = dimzin = 0;
dimtoh = dimtolj = 1;
dimalt = dimtofl = dimsah = dimtix = dimsoxd = 0;
dimaltd = dimunit = dimaltu = dimalttd = dimlunit = 2;
dimclrd = dimclre = dimclrt = dimjust = dimupt = 0;
dimazin = dimaltz = dimaltttz = dimtzin = dimfrac = 0;
dimtih = dimadec = dimaunit = dimsd1 = dimsd2 = dimtmove = 0;
dimaltrnd = 0.0;
dimdec = dimtdec = 4;
dimfit = dimatfit = 3;
dimdsep = '.';
dimlwd = dimlwe = -2;
dimdli = 0.38;
dimrnd = dimdle = dimtp = dimtm = dimtsz = dimtvp = 0.0;
dimaltf = 25.4;
dimtol = dimlim = dimse1 = dimse2 = dimtad = dimzin = 0;
dimtoh = dimtolj = 1;
dimalt = dimtofl = dimsah = dimtix = dimsoxd = 0;
dimaltd = dimunit = dimaltu = dimalttd = dimlunit = 2;
dimclrd = dimclre = dimclrt = dimjust = dimupt = 0;
dimazin = dimaltz = dimaltttz = dimtzin = dimfrac = 0;
dimtih = dimadec = dimaunit = dimsd1 = dimsd2 = dimtmove = 0;
dimaltrnd = 0.0;
dimdec = dimtdec = 4;
dimfit = dimatfit = 3;
dimdsep = '.';
dimlwd = dimlwe = -2;
DRW_TableEntry::reset();
}
void parseCode( int code, dxfReader* reader );
@ -108,67 +135,67 @@ public:
UTF8STRING dimblk; /*!< code 5, code 342 V2000+ */
UTF8STRING dimblk1; /*!< code 6, code 343 V2000+ */
UTF8STRING dimblk2; /*!< code 7, code 344 V2000+ */
double dimscale; /*!< code 40 */
double dimasz; /*!< code 41 */
double dimexo; /*!< code 42 */
double dimdli; /*!< code 43 */
double dimexe; /*!< code 44 */
double dimrnd; /*!< code 45 */
double dimdle; /*!< code 46 */
double dimtp; /*!< code 47 */
double dimtm; /*!< code 48 */
double dimtxt; /*!< code 140 */
double dimcen; /*!< code 141 */
double dimtsz; /*!< code 142 */
double dimaltf; /*!< code 143 */
double dimlfac; /*!< code 144 */
double dimtvp; /*!< code 145 */
double dimtfac; /*!< code 146 */
double dimgap; /*!< code 147 */
double dimaltrnd; /*!< code 148 V2000+ */
int dimtol; /*!< code 71 */
int dimlim; /*!< code 72 */
int dimtih; /*!< code 73 */
int dimtoh; /*!< code 74 */
int dimse1; /*!< code 75 */
int dimse2; /*!< code 76 */
int dimtad; /*!< code 77 */
int dimzin; /*!< code 78 */
int dimazin; /*!< code 79 V2000+ */
int dimalt; /*!< code 170 */
int dimaltd; /*!< code 171 */
int dimtofl; /*!< code 172 */
int dimsah; /*!< code 173 */
int dimtix; /*!< code 174 */
int dimsoxd; /*!< code 175 */
int dimclrd; /*!< code 176 */
int dimclre; /*!< code 177 */
int dimclrt; /*!< code 178 */
int dimadec; /*!< code 179 V2000+ */
int dimunit; /*!< code 270 R13+ (obsolete 2000+, use dimlunit & dimfrac) */
int dimdec; /*!< code 271 R13+ */
int dimtdec; /*!< code 272 R13+ */
int dimaltu; /*!< code 273 R13+ */
int dimalttd; /*!< code 274 R13+ */
int dimaunit; /*!< code 275 R13+ */
int dimfrac; /*!< code 276 V2000+ */
int dimlunit; /*!< code 277 V2000+ */
int dimdsep; /*!< code 278 V2000+ */
int dimtmove; /*!< code 279 V2000+ */
int dimjust; /*!< code 280 R13+ */
int dimsd1; /*!< code 281 R13+ */
int dimsd2; /*!< code 282 R13+ */
int dimtolj; /*!< code 283 R13+ */
int dimtzin; /*!< code 284 R13+ */
int dimaltz; /*!< code 285 R13+ */
int dimaltttz; /*!< code 286 R13+ */
int dimfit; /*!< code 287 R13+ (obsolete 2000+, use dimatfit & dimtmove)*/
int dimupt; /*!< code 288 R13+ */
int dimatfit; /*!< code 289 V2000+ */
double dimscale; /*!< code 40 */
double dimasz; /*!< code 41 */
double dimexo; /*!< code 42 */
double dimdli; /*!< code 43 */
double dimexe; /*!< code 44 */
double dimrnd; /*!< code 45 */
double dimdle; /*!< code 46 */
double dimtp; /*!< code 47 */
double dimtm; /*!< code 48 */
double dimtxt; /*!< code 140 */
double dimcen; /*!< code 141 */
double dimtsz; /*!< code 142 */
double dimaltf; /*!< code 143 */
double dimlfac; /*!< code 144 */
double dimtvp; /*!< code 145 */
double dimtfac; /*!< code 146 */
double dimgap; /*!< code 147 */
double dimaltrnd; /*!< code 148 V2000+ */
int dimtol; /*!< code 71 */
int dimlim; /*!< code 72 */
int dimtih; /*!< code 73 */
int dimtoh; /*!< code 74 */
int dimse1; /*!< code 75 */
int dimse2; /*!< code 76 */
int dimtad; /*!< code 77 */
int dimzin; /*!< code 78 */
int dimazin; /*!< code 79 V2000+ */
int dimalt; /*!< code 170 */
int dimaltd; /*!< code 171 */
int dimtofl; /*!< code 172 */
int dimsah; /*!< code 173 */
int dimtix; /*!< code 174 */
int dimsoxd; /*!< code 175 */
int dimclrd; /*!< code 176 */
int dimclre; /*!< code 177 */
int dimclrt; /*!< code 178 */
int dimadec; /*!< code 179 V2000+ */
int dimunit; /*!< code 270 R13+ (obsolete 2000+, use dimlunit & dimfrac) */
int dimdec; /*!< code 271 R13+ */
int dimtdec; /*!< code 272 R13+ */
int dimaltu; /*!< code 273 R13+ */
int dimalttd; /*!< code 274 R13+ */
int dimaunit; /*!< code 275 R13+ */
int dimfrac; /*!< code 276 V2000+ */
int dimlunit; /*!< code 277 V2000+ */
int dimdsep; /*!< code 278 V2000+ */
int dimtmove; /*!< code 279 V2000+ */
int dimjust; /*!< code 280 R13+ */
int dimsd1; /*!< code 281 R13+ */
int dimsd2; /*!< code 282 R13+ */
int dimtolj; /*!< code 283 R13+ */
int dimtzin; /*!< code 284 R13+ */
int dimaltz; /*!< code 285 R13+ */
int dimaltttz; /*!< code 286 R13+ */
int dimfit; /*!< code 287 R13+ (obsolete 2000+, use dimatfit & dimtmove)*/
int dimupt; /*!< code 288 R13+ */
int dimatfit; /*!< code 289 V2000+ */
UTF8STRING dimtxsty; /*!< code 340 R13+ */
UTF8STRING dimldrblk; /*!< code 341 V2000+ */
int dimlwd; /*!< code 371 V2000+ */
int dimlwe; /*!< code 372 V2000+ */
int dimlwd; /*!< code 371 V2000+ */
int dimlwe; /*!< code 372 V2000+ */
};
@ -190,24 +217,22 @@ public:
size = 0;
length = 0.0;
pathIdx = 0;
/* color = 256; // default BYLAYER (256)
* plotF = true; // default TRUE (plot yes)
* lWeight = -1; // default BYLAYER (-1)*/
// align = 65; //always 65
DRW_TableEntry::reset();
}
void parseCode( int code, dxfReader* reader );
void update();
public:
UTF8STRING desc; /*!< descriptive string, code 3 */
UTF8STRING desc; /*!< descriptive string, code 3 */
// int align; /*!< align code, always 65 ('A') code 72 */
int size; /*!< element number, code 73 */
double length; /*!< total length of pattern, code 40 */
int size; /*!< element number, code 73 */
double length; /*!< total length of pattern, code 40 */
// int haveShape; /*!< complex linetype type, code 74 */
std::vector<double> path; /*!< trace, point or space length sequence, code 49 */
private:
int pathIdx;
int pathIdx;
};
@ -223,21 +248,22 @@ public:
void reset()
{
tType = DRW::LAYER;
lineType = "CONTINUOUS";
color = 7; // default BYLAYER (256)
plotF = true; // default TRUE (plot yes)
lWeight = DRW_LW_Conv::widthDefault; // default BYDEFAULT (dxf -3, dwg 31)
color24 = -1; // default -1 not set
tType = DRW::LAYER;
lineType = "CONTINUOUS";
color = 7; // default BYLAYER (256)
plotF = true; // default TRUE (plot yes)
lWeight = DRW_LW_Conv::widthDefault; // default BYDEFAULT (dxf -3, dwg 31)
color24 = -1; // default -1 not set
DRW_TableEntry::reset();
}
void parseCode( int code, dxfReader* reader );
public:
UTF8STRING lineType; /*!< line type, code 6 */
int color; /*!< layer color, code 62 */
int color24; /*!< 24-bit color, code 420 */
bool plotF; /*!< Plot flag, code 290 */
UTF8STRING lineType; /*!< line type, code 6 */
int color; /*!< layer color, code 62 */
int color24; /*!< 24-bit color, code 420 */
bool plotF; /*!< Plot flag, code 290 */
enum DRW_LW_Conv::lineWidth lWeight; /*!< layer lineweight, code 370 */
std::string handlePlotS; /*!< Hard-pointer ID/handle of plotstyle, code 390 */
std::string handlePlotM; /*!< Hard-pointer ID/handle of materialstyle, code 347 */
@ -255,25 +281,26 @@ public:
void reset()
{
tType = DRW::STYLE;
height = oblique = 0.0;
width = lastHeight = 1.0;
font = "txt";
genFlag = 0; // 2= X mirror, 4= Y mirror
fontFamily = 0;
tType = DRW::STYLE;
height = oblique = 0.0;
width = lastHeight = 1.0;
font = "txt";
genFlag = 0; // 2= X mirror, 4= Y mirror
fontFamily = 0;
DRW_TableEntry::reset();
}
void parseCode( int code, dxfReader* reader );
public:
double height; /*!< Fixed text height (0 not set), code 40 */
double width; /*!< Width factor, code 41 */
double oblique; /*!< Oblique angle, code 50 */
int genFlag; /*!< Text generation flags, code 71 */
double lastHeight; /*!< Last height used, code 42 */
double height; /*!< Fixed text height (0 not set), code 40 */
double width; /*!< Width factor, code 41 */
double oblique; /*!< Oblique angle, code 50 */
int genFlag; /*!< Text generation flags, code 71 */
double lastHeight; /*!< Last height used, code 42 */
UTF8STRING font; /*!< primary font file name, code 3 */
UTF8STRING bigFont; /*!< bigfont file name or blank if none, code 4 */
int fontFamily; /*!< ttf font family, italic and bold flags, code 1071 */
int fontFamily; /*!< ttf font family, italic and bold flags, code 1071 */
};
// ! Class to handle vport entries
@ -290,19 +317,20 @@ public:
{
UpperRight.x = UpperRight.y = 1.0;
snapSpacing.x = snapSpacing.y = 10.0;
gridSpacing = snapSpacing;
center.x = 0.651828;
center.y = -0.16;
viewDir.z = 1;
height = 5.13732;
ratio = 2.4426877;
lensHeight = 50;
frontClip = backClip = snapAngle = twistAngle = 0.0;
viewMode = snap = grid = snapStyle = snapIsopair = 0;
fastZoom = 1;
circleZoom = 100;
ucsIcon = 3;
gridBehavior = 7;
gridSpacing = snapSpacing;
center.x = 0.651828;
center.y = -0.16;
viewDir.z = 1;
height = 5.13732;
ratio = 2.4426877;
lensHeight = 50;
frontClip = backClip = snapAngle = twistAngle = 0.0;
viewMode = snap = grid = snapStyle = snapIsopair = 0;
fastZoom = 1;
circleZoom = 100;
ucsIcon = 3;
gridBehavior = 7;
DRW_TableEntry::reset();
}
void parseCode( int code, dxfReader* reader );
@ -316,22 +344,22 @@ public:
DRW_Coord gridSpacing; /*!< grid Spacing, code 15 & 25 */
DRW_Coord viewDir; /*!< view direction from target point, code 16, 26 & 36 */
DRW_Coord viewTarget; /*!< view target point, code 17, 27 & 37 */
double height; /*!< view height, code 40 */
double ratio; /*!< viewport aspect ratio, code 41 */
double lensHeight; /*!< lens height, code 42 */
double frontClip; /*!< front clipping plane, code 43 */
double backClip; /*!< back clipping plane, code 44 */
double snapAngle; /*!< snap rotation angle, code 50 */
double twistAngle; /*!< view twist angle, code 51 */
int viewMode; /*!< view mode, code 71 */
int circleZoom; /*!< circle zoom percent, code 72 */
int fastZoom; /*!< fast zoom setting, code 73 */
int ucsIcon; /*!< UCSICON setting, code 74 */
int snap; /*!< snap on/off, code 75 */
int grid; /*!< grid on/off, code 76 */
int snapStyle; /*!< snap style, code 77 */
int snapIsopair; /*!< snap isopair, code 78 */
int gridBehavior; /*!< grid behavior, code 60, undocummented */
double height; /*!< view height, code 40 */
double ratio; /*!< viewport aspect ratio, code 41 */
double lensHeight; /*!< lens height, code 42 */
double frontClip; /*!< front clipping plane, code 43 */
double backClip; /*!< back clipping plane, code 44 */
double snapAngle; /*!< snap rotation angle, code 50 */
double twistAngle; /*!< view twist angle, code 51 */
int viewMode; /*!< view mode, code 71 */
int circleZoom; /*!< circle zoom percent, code 72 */
int fastZoom; /*!< fast zoom setting, code 73 */
int ucsIcon; /*!< UCSICON setting, code 74 */
int snap; /*!< snap on/off, code 75 */
int grid; /*!< grid on/off, code 76 */
int snapStyle; /*!< snap style, code 77 */
int snapIsopair; /*!< snap isopair, code 78 */
int gridBehavior; /*!< grid behavior, code 60, undocummented */
/** code 60, bit coded possible value are
* bit 1 (1) show out of limits
* bit 2 (2) adaptive grid
@ -352,6 +380,9 @@ public:
DRW_ImageDef()
{
version = 0;
u = v = up = vp = 0.0;
loaded = 0;
resolution = 0;
}
void parseCode( int code, dxfReader* reader );
@ -359,13 +390,13 @@ public:
public:
std::string handle; /*!< entity identifier, code 5 */
UTF8STRING name; /*!< File name of image, code 1 */
int version; /*!< class version, code 90, 0=R14 version */
double u; /*!< image size in pixels U value, code 10 */
double v; /*!< image size in pixels V value, code 20 */
double up; /*!< default size of one pixel U value, code 11 */
double vp; /*!< default size of one pixel V value, code 12 really is 21*/
int loaded; /*!< image is loaded flag, code 280, 0=unloaded, 1=loaded */
int resolution; /*!< resolution units, code 281, 0=no, 2=centimeters, 5=inch */
int version; /*!< class version, code 90, 0=R14 version */
double u; /*!< image size in pixels U value, code 10 */
double v; /*!< image size in pixels V value, code 20 */
double up; /*!< default size of one pixel U value, code 11 */
double vp; /*!< default size of one pixel V value, code 12 really is 21*/
int loaded; /*!< image is loaded flag, code 280, 0=unloaded, 1=loaded */
int resolution; /*!< resolution units, code 281, 0=no, 2=centimeters, 5=inch */
std::map<std::string, std::string> reactors;
};
@ -373,7 +404,9 @@ public:
// ! Class to handle header entries
/*!
* Class to handle layer symbol table entries
* Class to handle header vars, to read iterate over "std::map vars"
* to write add a DRW_Variant* into "std::map vars" (do not delete it, are cleared in dtor)
* or use add* helper functions.
* @author Rallaz
*/
class DRW_Header
@ -381,18 +414,29 @@ class DRW_Header
public:
DRW_Header()
{
version = 0;
curr = 0;
}
~DRW_Header()
{
for( std::map<std::string, DRW_Variant*>::iterator it = vars.begin(); it!=vars.end(); ++it )
delete it->second;
vars.clear();
}
void addDouble( std::string key, double value, int code );
void addInt( std::string key, int value, int code );
void addStr( std::string key, std::string value, int code );
void addCoord( std::string key, DRW_Coord value, int code );
std::string getComments() const { return comments; }
void parseCode( int code, dxfReader* reader );
void write( dxfWriter* writer, DRW::Version ver );
void addComment( std::string c );
std::string getComments() const { return comments; }
private:
bool getDouble( std::string key, double* varDouble );
bool getInt( std::string key, int* varInt );
@ -401,11 +445,32 @@ private:
public:
std::map<std::string, DRW_Variant*> vars;
private:
std::string comments;
std::string name;
DRW_Variant* curr;
int version; // to use on read
std::string comments;
std::string name;
DRW_Variant* curr;
int version; // to use on read
};
// ! Class to handle AppId entries
/*!
* Class to handle AppId symbol table entries
* @author Rallaz
*/
class DRW_AppId : public DRW_TableEntry
{
public:
DRW_AppId() { reset(); }
void reset()
{
tType = DRW::APPID;
flags = 0;
name = "";
}
void parseCode( int code, dxfReader* reader ) { DRW_TableEntry::parseCode( code, reader ); }
};
namespace DRW {

View File

@ -12,7 +12,7 @@
DRW_TextCodec::DRW_TextCodec()
{
version = DRW::AC1021;
conv = new DRW_Converter( NULL, 0 );
conv = new DRW_Converter( NULL, 0 );
}
@ -62,16 +62,16 @@ void DRW_TextCodec::setCodePage( std::string* c )
conv = new DRW_ConvTable( DRW_Table874, CPLENGHTCOMMON );
else if( cp == "ANSI_932" )
conv = new DRW_Conv932Table( DRW_Table932, DRW_LeadTable932,
DRW_DoubleTable932, CPLENGHT932 );
DRW_DoubleTable932, CPLENGHT932 );
else if( cp == "ANSI_936" )
conv = new DRW_ConvDBCSTable( DRW_Table936, DRW_LeadTable936,
DRW_DoubleTable936, CPLENGHT936 );
DRW_DoubleTable936, CPLENGHT936 );
else if( cp == "ANSI_949" )
conv = new DRW_ConvDBCSTable( DRW_Table949, DRW_LeadTable949,
DRW_DoubleTable949, CPLENGHT949 );
DRW_DoubleTable949, CPLENGHT949 );
else if( cp == "ANSI_950" )
conv = new DRW_ConvDBCSTable( DRW_Table950, DRW_LeadTable950,
DRW_DoubleTable950, CPLENGHT950 );
DRW_DoubleTable950, CPLENGHT950 );
else if( cp == "ANSI_1250" )
conv = new DRW_ConvTable( DRW_Table1250, CPLENGHTCOMMON );
else if( cp == "ANSI_1251" )
@ -117,9 +117,9 @@ std::string DRW_TextCodec::fromUtf8( std::string s )
std::string DRW_Converter::toUtf8( std::string* s )
{
std::string result;
int j = 0;
unsigned int i = 0;
std::string result;
int j = 0;
unsigned int i = 0;
for( i = 0; i < s->length(); i++ )
{
@ -127,8 +127,7 @@ std::string DRW_Converter::toUtf8( std::string* s )
if( c < 0x80 ) // ascii check for /U+????
{
if( c == '\\' && i + 6 < s->length() && s->at( i + 1 ) == 'U' && s->at( i + 2 ) ==
'+' )
if( c == '\\' && i + 6 < s->length() && s->at( i + 1 ) == 'U' && s->at( i + 2 ) == '+' )
{
result += s->substr( j, i - j );
result += encodeText( s->substr( i, 7 ) );
@ -159,10 +158,10 @@ std::string DRW_Converter::toUtf8( std::string* s )
std::string DRW_ConvTable::fromUtf8( std::string* s )
{
std::string result;
bool notFound;
int code;
bool notFound;
int code;
int j = 0;
int j = 0;
for( unsigned int i = 0; i < s->length(); i++ )
{
@ -172,17 +171,17 @@ std::string DRW_ConvTable::fromUtf8( std::string* s )
{
result += s->substr( j, i - j );
std::string part1 = s->substr( i, 4 );
int l;
int l;
code = decodeNum( part1, &l );
j = i + l;
i = j - 1;
j = i + l;
i = j - 1;
notFound = true;
for( int k = 0; k<cpLenght; k++ )
{
if( table[k] == code )
{
result += CPOFFSET + k; // translate from table
result += CPOFFSET + k; // translate from table
notFound = false;
break;
}
@ -201,10 +200,10 @@ std::string DRW_ConvTable::fromUtf8( std::string* s )
std::string DRW_ConvTable::toUtf8( std::string* s )
{
std::string res;
std::string::iterator it;
std::string res;
std::string::iterator it;
for( it = s->begin(); it < s->end(); it++ )
for( it = s->begin(); it < s->end(); ++it )
{
unsigned char c = *it;
@ -313,21 +312,21 @@ std::string DRW_Converter::encodeNum( int c )
**/
int DRW_Converter::decodeNum( std::string s, int* b )
{
int code = 0;
unsigned char c = s.at( 0 );
int code = 0;
unsigned char c = s.at( 0 );
if( (c & 0xE0) == 0xC0 ) // 2 bytes
{
code = ( c & 0x1F) << 6;
code = (s.at( 1 ) & 0x3F) | code;
*b = 2;
*b = 2;
}
else if( (c & 0xF0) == 0xE0 ) // 3 bytes
{
code = ( c & 0x0F) << 12;
code = ( (s.at( 1 ) & 0x3F) << 6 ) | code;
code = (s.at( 2 ) & 0x3F) | code;
*b = 3;
*b = 3;
}
else if( (c & 0xF8) == 0xF0 ) // 4 bytes
{
@ -335,7 +334,7 @@ int DRW_Converter::decodeNum( std::string s, int* b )
code = ( (s.at( 1 ) & 0x3F) << 12 ) | code;
code = ( (s.at( 2 ) & 0x3F) << 6 ) | code;
code = (s.at( 3 ) & 0x3F) | code;
*b = 4;
*b = 4;
}
return code;
@ -345,10 +344,10 @@ int DRW_Converter::decodeNum( std::string s, int* b )
std::string DRW_ConvDBCSTable::fromUtf8( std::string* s )
{
std::string result;
bool notFound;
int code;
bool notFound;
int code;
int j = 0;
int j = 0;
for( unsigned int i = 0; i < s->length(); i++ )
{
@ -358,21 +357,21 @@ std::string DRW_ConvDBCSTable::fromUtf8( std::string* s )
{
result += s->substr( j, i - j );
std::string part1 = s->substr( i, 4 );
int l;
int l;
code = decodeNum( part1, &l );
j = i + l;
i = j - 1;
j = i + l;
i = j - 1;
notFound = true;
for( int k = 0; k<cpLenght; k++ )
{
if( doubleTable[k][1] == code )
{
int data = doubleTable[k][0];
char d[3];
d[0] = data >> 8;
d[1] = data & 0xFF;
d[2] = '\0';
int data = doubleTable[k][0];
char d[3];
d[0] = data >> 8;
d[1] = data & 0xFF;
d[2] = '\0';
result += d; // translate from table
notFound = false;
break;
@ -392,13 +391,13 @@ std::string DRW_ConvDBCSTable::fromUtf8( std::string* s )
std::string DRW_ConvDBCSTable::toUtf8( std::string* s )
{
std::string res;
std::string::iterator it;
std::string res;
std::string::iterator it;
for( it = s->begin(); it < s->end(); it++ )
for( it = s->begin(); it < s->end(); ++it )
{
bool notFound = true;
unsigned char c = *it;
bool notFound = true;
unsigned char c = *it;
if( c < 0x80 )
{
@ -455,10 +454,10 @@ std::string DRW_ConvDBCSTable::toUtf8( std::string* s )
std::string DRW_Conv932Table::fromUtf8( std::string* s )
{
std::string result;
bool notFound;
int code;
bool notFound;
int code;
int j = 0;
int j = 0;
for( unsigned int i = 0; i < s->length(); i++ )
{
@ -468,16 +467,16 @@ std::string DRW_Conv932Table::fromUtf8( std::string* s )
{
result += s->substr( j, i - j );
std::string part1 = s->substr( i, 4 );
int l;
int l;
code = decodeNum( part1, &l );
j = i + l;
i = j - 1;
j = i + l;
i = j - 1;
notFound = true;
// 1 byte table
if( code > 0xff60 && code < 0xFFA0 )
{
result += code - CPOFFSET932; // translate from table
result += code - CPOFFSET932; // translate from table
notFound = false;
}
@ -488,12 +487,12 @@ std::string DRW_Conv932Table::fromUtf8( std::string* s )
{
if( doubleTable[k][1] == code )
{
int data = doubleTable[k][0];
char d[3];
d[0] = data >> 8;
d[1] = data & 0xFF;
d[2] = '\0';
result += d; // translate from table
int data = doubleTable[k][0];
char d[3];
d[0] = data >> 8;
d[1] = data & 0xFF;
d[2] = '\0';
result += d; // translate from table
notFound = false;
break;
}
@ -513,13 +512,13 @@ std::string DRW_Conv932Table::fromUtf8( std::string* s )
std::string DRW_Conv932Table::toUtf8( std::string* s )
{
std::string res;
std::string::iterator it;
std::string res;
std::string::iterator it;
for( it = s->begin(); it < s->end(); it++ )
for( it = s->begin(); it < s->end(); ++it )
{
bool notFound = true;
unsigned char c = *it;
bool notFound = true;
unsigned char c = *it;
if( c < 0x80 )
{
@ -661,7 +660,7 @@ std::string DRW_TextCodec::correctCodePage( const std::string& s )
}
else if( cp=="ANSI_936" || cp=="GBK" || cp=="GB2312" || cp=="CHINESE" || cp=="CN-GB"
|| cp=="CSGB2312" || cp=="CSGB231280" || cp=="CSISO58BG231280"
|| cp=="GB_2312-80" || cp=="GB231280" || cp=="GB2312-80" || cp=="GBK"
|| cp=="GB_2312-80" || cp=="GB231280" || cp=="GB2312-80"
|| cp=="ISO-IR-58" || cp=="GB18030" )
{
return "ANSI_936";

View File

@ -14,20 +14,21 @@ public:
std::string toUtf8( std::string s );
int getVersion() { return version; }
void setVersion( std::string* v );
void setVersion( std::string* v );
void setVersion( int v ) { version = v; }
void setCodePage( std::string* c );
void setCodePage( std::string* c );
void setCodePage( std::string c ) { setCodePage( &c ); }
std::string getCodePage() { return cp; }
private:
std::string correctCodePage( const std::string& s );
private:
int version;
std::string cp;
DRW_Converter* conv;
int version;
std::string cp;
DRW_Converter* conv;
};
class DRW_Converter
@ -47,8 +48,8 @@ public:
std::string encodeNum( int c );
int decodeNum( std::string s, int* b );
const int* table;
int cpLenght;
const int* table;
int cpLenght;
};
class DRW_ConvTable : public DRW_Converter
@ -63,9 +64,9 @@ class DRW_ConvDBCSTable : public DRW_Converter
{
public:
DRW_ConvDBCSTable( const int* t, const int* lt, const int dt[][2], int l ) : DRW_Converter( t,
l )
l )
{
leadTable = lt;
leadTable = lt;
doubleTable = dt;
}
@ -81,9 +82,9 @@ class DRW_Conv932Table : public DRW_Converter
{
public:
DRW_Conv932Table( const int* t, const int* lt, const int dt[][2], int l ) : DRW_Converter( t,
l )
l )
{
leadTable = lt;
leadTable = lt;
doubleTable = dt;
}

View File

@ -127,7 +127,7 @@ int dxfReader::getHandleString()
bool dxfReaderBinary::readCode( int* code )
{
unsigned short* int16p;
char buffer[2];
char buffer[2];
filestr->read( buffer, 2 );
int16p = (unsigned short*) buffer;
@ -179,8 +179,8 @@ bool dxfReaderBinary::readInt()
bool dxfReaderBinary::readInt32()
{
unsigned int* int32p;
char buffer[4];
unsigned int* int32p;
char buffer[4];
filestr->read( buffer, 4 );
int32p = (unsigned int*) buffer;
@ -206,11 +206,11 @@ bool dxfReaderBinary::readInt64()
bool dxfReaderBinary::readDouble()
{
double* result;
char buffer[8];
char buffer[8];
filestr->read( buffer, 8 );
result = (double*) buffer;
doubleData = *result;
result = (double*) buffer;
doubleData = *result;
DBG( doubleData ); DBG( "\n" );
return filestr->good();
}

View File

@ -21,6 +21,9 @@ public:
dxfReader( std::ifstream* stream )
{
filestr = stream;
doubleData = 0.0;
intData = 0;
int64 = 0;
#ifdef DRW_DBG
count = 0;
#endif
@ -31,14 +34,14 @@ public:
virtual bool readString( std::string* text ) = 0;
virtual bool readString() = 0;
bool readRec( int* code, bool skip );
virtual bool readInt() = 0;
virtual bool readInt() = 0;
virtual bool readInt32() = 0;
virtual bool readInt64() = 0;
virtual bool readDouble() = 0;
virtual bool readBool() = 0;
virtual bool readBool() = 0;
std::string getString() { return strData; }
int getHandleString(); // Convert hex string to int
int getHandleString(); // Convert hex string to int
std::string toUtf8String( std::string t ) { return decoder.toUtf8( t ); }
std::string getUtf8String() { return decoder.toUtf8( strData ); }
@ -51,22 +54,24 @@ public:
void setCodePage( std::string* c ) { decoder.setCodePage( c ); }
std::string getCodePage() { return decoder.getCodePage(); }
#ifdef DRW_DBG
int count; // DBG
int count; // DBG
#endif
protected:
std::ifstream* filestr;
std::string strData;
double doubleData;
signed int intData; // 32 bits integer
unsigned long long int int64; // 64 bits integer
std::ifstream* filestr;
std::string strData;
double doubleData;
signed int intData; // 32 bits integer
unsigned long long int int64; // 64 bits integer
private:
DRW_TextCodec decoder;
DRW_TextCodec decoder;
};
class dxfReaderBinary : public dxfReader
{
public:
dxfReaderBinary( std::ifstream* stream ) : dxfReader( stream ) { }
dxfReaderBinary( std::ifstream* stream ) : dxfReader( stream ) {}
virtual ~dxfReaderBinary() {}
virtual bool readCode( int* code );
virtual bool readString( std::string* text );
@ -81,7 +86,7 @@ public:
class dxfReaderAscii : public dxfReader
{
public:
dxfReaderAscii( std::ifstream* stream ) : dxfReader( stream ) { }
dxfReaderAscii( std::ifstream* stream ) : dxfReader( stream ) {}
virtual ~dxfReaderAscii() {}
virtual bool readCode( int* code );
virtual bool readString( std::string* text );

View File

@ -28,22 +28,24 @@ public:
virtual bool writeInt16( int code, int data ) = 0;
virtual bool writeInt32( int code, int data ) = 0;
virtual bool writeInt64( int code, unsigned long long int data ) = 0;
virtual bool writeDouble( int code, double data ) = 0;
virtual bool writeBool( int code, bool data ) = 0;
virtual bool writeDouble( int code, double data ) = 0;
virtual bool writeBool( int code, bool data ) = 0;
void setVersion( std::string* v ) { encoder.setVersion( v ); }
void setCodePage( std::string* c ) { encoder.setCodePage( c ); }
std::string getCodePage() { return encoder.getCodePage(); }
protected:
std::ofstream* filestr;
std::ofstream* filestr;
private:
DRW_TextCodec encoder;
DRW_TextCodec encoder;
};
class dxfWriterBinary : public dxfWriter
{
public:
dxfWriterBinary( std::ofstream* stream ) : dxfWriter( stream ) { }
dxfWriterBinary( std::ofstream* stream ) : dxfWriter( stream ) {}
virtual ~dxfWriterBinary() {}
virtual bool writeString( int code, std::string text );
virtual bool writeInt16( int code, int data );
@ -56,7 +58,7 @@ public:
class dxfWriterAscii : public dxfWriter
{
public:
dxfWriterAscii( std::ofstream* stream ) : dxfWriter( stream ) { }
dxfWriterAscii( std::ofstream* stream ) : dxfWriter( stream ) {}
virtual ~dxfWriterAscii() {}
virtual bool writeString( int code, std::string text );
virtual bool writeInt16( int code, int data );

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@ public:
* @param ext should the extrusion be applied to convert in 2D?
* @return true for success
*/
bool read( DRW_Interface* interface_, bool ext );
bool read( DRW_Interface* interface_, bool ext );
void setBinary( bool b ) { binary = b; }
@ -45,6 +45,7 @@ public:
bool writeDimstyle( DRW_Dimstyle* ent );
bool writeTextstyle( DRW_Textstyle* ent );
bool writeVport( DRW_Vport* ent );
bool writeAppId( DRW_AppId* ent );
bool writePoint( DRW_Point* ent );
bool writeLine( DRW_Line* ent );
bool writeRay( DRW_Ray* ent );
@ -70,74 +71,77 @@ public:
bool writeDimension( DRW_Dimension* ent );
void setEllipseParts( int parts ) { elParts = parts; } /*!< set parts munber when convert ellipse to polyline */
private:
/// used by read() to parse the content of the file
bool processDxf();
bool processHeader();
bool processTables();
bool processBlocks();
bool processBlock();
bool processEntities( bool isblock );
bool processObjects();
bool processDxf();
bool processHeader();
bool processTables();
bool processBlocks();
bool processBlock();
bool processEntities( bool isblock );
bool processObjects();
bool processLType();
bool processLayer();
bool processDimStyle();
bool processTextStyle();
bool processVports();
bool processLType();
bool processLayer();
bool processDimStyle();
bool processTextStyle();
bool processVports();
bool processAppId();
bool processPoint();
bool processLine();
bool processRay();
bool processXline();
bool processCircle();
bool processArc();
bool processEllipse();
bool processTrace();
bool processSolid();
bool processInsert();
bool processLWPolyline();
bool processPolyline();
bool processVertex( DRW_Polyline* pl );
bool processText();
bool processMText();
bool processHatch();
bool processSpline();
bool process3dface();
bool processViewport();
bool processImage();
bool processImageDef();
bool processDimension();
bool processLeader();
bool processPoint();
bool processLine();
bool processRay();
bool processXline();
bool processCircle();
bool processArc();
bool processEllipse();
bool processTrace();
bool processSolid();
bool processInsert();
bool processLWPolyline();
bool processPolyline();
bool processVertex( DRW_Polyline* pl );
bool processText();
bool processMText();
bool processHatch();
bool processSpline();
bool process3dface();
bool processViewport();
bool processImage();
bool processImageDef();
bool processDimension();
bool processLeader();
// bool writeHeader();
bool writeEntity( DRW_Entity* ent );
bool writeTables();
bool writeBlocks();
bool writeObjects();
std::string toHexStr( int n );
bool writeEntity( DRW_Entity* ent );
bool writeTables();
bool writeBlocks();
bool writeObjects();
bool writeExtData( const std::vector<DRW_Variant*>& ed );
std::string toHexStr( int n );
private:
DRW::Version version;
std::string fileName;
std::string codePage;
bool binary;
dxfReader* reader;
dxfWriter* writer;
DRW_Interface* iface;
DRW_Header header;
DRW::Version version;
std::string fileName;
std::string codePage;
bool binary;
dxfReader* reader;
dxfWriter* writer;
DRW_Interface* iface;
DRW_Header header;
// int section;
std::string nextentity;
int entCount;
bool wlayer0;
bool dimstyleStd;
bool applyExt;
bool writingBlock;
int elParts; /*!< parts munber when convert ellipse to polyline */
std::string nextentity;
int entCount;
bool wlayer0;
bool dimstyleStd;
bool applyExt;
bool writingBlock;
int elParts; /*!< parts munber when convert ellipse to polyline */
std::map<std::string, int> blockMap;
std::vector<DRW_ImageDef*> imageDef; /*!< imageDef list */
int currHandle;
int currHandle;
};
#endif // LIBDXFRW_H

View File

@ -119,6 +119,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
case ID_NO_TOOL_SELECTED:
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
break;
case ID_SELECT_PAGE_NUMBER:
m_canvas->Refresh();

View File

@ -709,6 +709,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
// because the locate requirements are very basic.
std::vector <WS_DRAW_ITEM_BASE*> list;
drawList.Locate( list, aPosition );
if( list.size() == 0 )
return NULL;

View File

@ -33,9 +33,5 @@
<key>LSRequiresCarbon</key> <true/>
<key>NSHumanReadableCopyright</key> <string></string>
<key>NSHighResolutionCapable</key> <string>True</string>
<key>LSEnvironment</key>
<dict>
<key>KIGITHUB</key> <string>https://github.com/kicad</string>
</dict>
</dict>
</plist>

View File

@ -26,7 +26,7 @@ public:
{
int x, y;
TPos() { }
TPos() : x( 0 ), y( 0 ) { }
TPos( int _x, int _y ) : x( _x ), y( _y ) { }
bool operator ==( const TPos& p ) const { return x == p.x && y == p.y; }
@ -36,7 +36,7 @@ public:
{
int w, h;
TRect() { }
TRect() : w( 0 ), h( 0 ) { }
TRect( int _x, int _y, int _w, int _h ) : TPos( _x, _y ), w( _w > 0 ? _w : 0 ), h(
_h > 0 ? _h : 0 ) { }

View File

@ -5,7 +5,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -47,13 +47,17 @@
MATRIX_ROUTING_HEAD::MATRIX_ROUTING_HEAD()
{
m_BoardSide[0] = m_BoardSide[1] = NULL;
m_DistSide[0] = m_DistSide[1] = NULL;
m_DirSide[0] = m_DirSide[1] = NULL;
m_InitMatrixDone = false;
m_Nrows = m_Ncols = 0;
m_MemSize = 0;
m_BoardSide[0] = m_BoardSide[1] = NULL;
m_DistSide[0] = m_DistSide[1] = NULL;
m_DirSide[0] = m_DirSide[1] = NULL;
m_opWriteCell = NULL;
m_InitMatrixDone = false;
m_Nrows = 0;
m_Ncols = 0;
m_MemSize = 0;
m_RoutingLayersCount = 1;
m_GridRouting = 0;
m_RouteCount = 0;
}
@ -96,7 +100,6 @@ bool MATRIX_ROUTING_HEAD::ComputeMatrixSize( BOARD* aPcb, bool aUseBoardEdgesOnl
}
int MATRIX_ROUTING_HEAD::InitRoutingMatrix()
{
if( m_Nrows <= 0 || m_Ncols <= 0 )

View File

@ -5,7 +5,7 @@
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
*
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -51,7 +51,11 @@ struct TSubRect : public CRectPlacement::TRect
{
int n; // Original index of this subrect, before sorting
TSubRect() { }
TSubRect() : TRect(),
n( 0 )
{
}
TSubRect( int _w, int _h, int _n ) :
TRect( 0, 0, _w, _h ), n( _n ) { }
};

View File

@ -182,7 +182,7 @@ bool FOOTPRINT_EDIT_FRAME::HandleBlockEnd( wxDC* DC )
DIALOG_MOVE_EXACT dialog( this, translation, rotation );
int ret = dialog.ShowModal();
if( ret == DIALOG_MOVE_EXACT::MOVE_OK )
if( ret == wxID_OK )
{
SaveCopyInUndoList( currentModule, UR_MODEDIT );
const wxPoint blockCentre = GetScreen()->m_BlockLocate.Centre();
@ -662,12 +662,12 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
if( !pad->IsSelected() && !force_all )
continue;
wxPoint pos = pad->GetPosition();
wxPoint pos = pad->GetPos0();
ROTATE( pos );
pad->SetPosition( pos );
pad->SetPos0( pad->GetPosition() );
pad->SetPos0( pos );
pad->SetOrientation( pad->GetOrientation() + 900 );
pad->SetDrawCoord();
}
for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
@ -681,15 +681,15 @@ void RotateMarkedItems( MODULE* module, wxPoint offset, bool force_all )
{
EDGE_MODULE* em = (EDGE_MODULE*) item;
wxPoint tmp = em->GetStart();
wxPoint tmp = em->GetStart0();
ROTATE( tmp );
em->SetStart( tmp );
em->SetStart0( tmp );
tmp = em->GetEnd();
tmp = em->GetEnd0();
ROTATE( tmp );
em->SetEnd( tmp );
em->SetEnd0( tmp );
em->SetDrawCoord();
}
break;

View File

@ -132,7 +132,7 @@ void PCB_EDIT_FRAME::RecreateBOMFileFromBoard( wxCommandEvent& aEvent )
bool valExist = false;
// try to find component in existing list
for( iter = list.begin(); iter != list.end(); iter++ )
for( iter = list.begin(); iter != list.end(); ++iter )
{
cmp* current = *iter;

View File

@ -233,7 +233,8 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LSET aLayerMask, TRACK_PTRS*
* if > 1 segment:
* end of track (more than 2 segment connected at this location)
*/
segment = m_Track; candidate = NULL;
segment = m_Track;
candidate = NULL;
NbSegm = 0;
while( ( segment = ::GetTrack( segment, NULL, aPosition, aLayerMask ) ) != NULL )
@ -280,8 +281,6 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, LSET aLayerMask, TRACK_PTRS*
aPosition = candidate->GetStart();
}
segment = m_Track; /* restart list of tracks to analyze */
/* flag this item an push it in list of selected items */
aList->push_back( candidate );
candidate->SetState( BUSY, true );

View File

@ -242,7 +242,7 @@ int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue()
int clearance = m_NetClasses.GetDefault()->GetClearance();
//Read list of Net Classes
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); ++nc )
{
NETCLASSPTR netclass = nc->second;
clearance = std::max( clearance, netclass->GetClearance() );
@ -257,7 +257,7 @@ int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue()
int clearance = m_NetClasses.GetDefault()->GetClearance();
//Read list of Net Classes
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); ++nc )
{
NETCLASSPTR netclass = nc->second;
clearance = std::min( clearance, netclass->GetClearance() );

View File

@ -49,6 +49,7 @@ DIMENSION::DIMENSION( BOARD_ITEM* aParent ) :
m_Width( Millimeter2iu( 0.2 ) ), m_Unit( INCHES ), m_Value( 0 ), m_Height( 0 ), m_Text( this )
{
m_Layer = Dwgs_User;
m_Shape = 0;
}

Some files were not shown because too many files have changed in this diff Show More