Clean up some more MODULE terms.

This commit is contained in:
Jeff Young 2020-11-14 19:16:42 +00:00
parent 7bd31d5237
commit 666c11965a
23 changed files with 96 additions and 163 deletions

View File

@ -86,35 +86,7 @@ const KICAD_T GENERAL_COLLECTOR::BoardLevelItems[] = {
};
const KICAD_T GENERAL_COLLECTOR::AllButZones[] = {
PCB_MARKER_T,
PCB_TEXT_T,
PCB_SHAPE_T,
PCB_DIM_ALIGNED_T,
PCB_DIM_ORTHOGONAL_T,
PCB_DIM_CENTER_T,
PCB_DIM_LEADER_T,
PCB_TARGET_T,
PCB_VIA_T,
PCB_TRACE_T,
PCB_ARC_T,
PCB_PAD_T,
PCB_FP_TEXT_T,
PCB_FOOTPRINT_T,
PCB_GROUP_T,
PCB_ZONE_T, // if it is visible on screen, it should be selectable
EOT
};
const KICAD_T GENERAL_COLLECTOR::Modules[] = {
PCB_FOOTPRINT_T,
EOT
};
const KICAD_T GENERAL_COLLECTOR::PadsOrModules[] = {
PCB_PAD_T,
const KICAD_T GENERAL_COLLECTOR::Footprints[] = {
PCB_FOOTPRINT_T,
EOT
};
@ -129,18 +101,7 @@ const KICAD_T GENERAL_COLLECTOR::PadsOrTracks[] = {
};
const KICAD_T GENERAL_COLLECTOR::ModulesAndTheirItems[] = {
PCB_FOOTPRINT_T,
PCB_FP_TEXT_T,
PCB_FP_SHAPE_T,
PCB_PAD_T,
PCB_FP_ZONE_T,
PCB_GROUP_T,
EOT
};
const KICAD_T GENERAL_COLLECTOR::ModuleItems[] = {
const KICAD_T GENERAL_COLLECTOR::FootprintItems[] = {
PCB_FP_TEXT_T,
PCB_FP_SHAPE_T,
PCB_PAD_T,

View File

@ -267,11 +267,6 @@ public:
*/
static const KICAD_T AllBoardItems[];
/**
* A scan list for all editable board items, except zones
*/
static const KICAD_T AllButZones[];
/**
* A scan list for zones outlines only
*/
@ -284,14 +279,9 @@ public:
static const KICAD_T BoardLevelItems[];
/**
* A scan list for only MODULEs
* A scan list for only FOOTPRINTs
*/
static const KICAD_T Modules[];
/**
* A scan list for PADs or MODULEs
*/
static const KICAD_T PadsOrModules[];
static const KICAD_T Footprints[];
/**
* A scan list for PADs, TRACKs, or VIAs
@ -299,14 +289,9 @@ public:
static const KICAD_T PadsOrTracks[];
/**
* A scan list for MODULEs and their items (for Modedit)
* A scan list for primary footprint items.
*/
static const KICAD_T ModulesAndTheirItems[];
/**
* A scan list for primary module items.
*/
static const KICAD_T ModuleItems[];
static const KICAD_T FootprintItems[];
/**
* A scan list for only TRACKs

View File

@ -819,7 +819,7 @@ LSEQ PANEL_SETUP_LAYERS::getNonRemovableLayers()
if( !alg::contains( newLayerSeq, layer_id ) )
{
collector.SetLayerId( layer_id );
collector.Collect( m_pcb, GENERAL_COLLECTOR::ModuleItems );
collector.Collect( m_pcb, GENERAL_COLLECTOR::FootprintItems );
if( collector.GetCount() != 0 )
inUseLayers.push_back( layer_id );

View File

@ -1797,9 +1797,9 @@ bool FOOTPRINT::cmp_pads::operator()( const PAD* aFirst, const PAD* aSecond ) co
}
static struct MODULE_DESC
static struct FOOTPRINT_DESC
{
MODULE_DESC()
FOOTPRINT_DESC()
{
ENUM_MAP<PCB_LAYER_ID>& layerEnum = ENUM_MAP<PCB_LAYER_ID>::Instance();
@ -1850,4 +1850,4 @@ static struct MODULE_DESC
PROPERTY_DISPLAY::DISTANCE ) );
// TODO zone connection, FPID?
}
} _MODULE_DESC;
} _FOOTPRINT_DESC;

View File

@ -42,9 +42,9 @@ class CLIPBOARD_PARSER : public PCB_PARSER
public:
CLIPBOARD_PARSER( LINE_READER* aReader = NULL ): PCB_PARSER( aReader ) {};
FOOTPRINT* parseMODULE( wxArrayString* aInitialComments )
FOOTPRINT* parseFOOTPRINT( wxArrayString* aInitialComments )
{
return PCB_PARSER::parseMODULE( aInitialComments );
return PCB_PARSER::parseFOOTPRINT( aInitialComments );
}
};

View File

@ -919,7 +919,7 @@ void EAGLE_PLUGIN::loadLibrary( wxXmlNode* aLib, const wxString* aLibName )
// Create a FOOTPRINT for all the eagle packages, for use later via a copy constructor
// to instantiate needed footprints in our BOARD. Save the FOOTPRINT templates in
// a MODULE_MAP using a single lookup key consisting of libname+pkgname.
// a FOOTPRINT_MAP using a single lookup key consisting of libname+pkgname.
// Get the first package and iterate
wxXmlNode* package = packages->GetChildren();

View File

@ -28,7 +28,6 @@
*/
#include <wildcards_and_files_ext.h>
#include <filter_reader.h>
#include <trace_helpers.h>
#include <math/util.h> // for KiROUND
@ -58,7 +57,7 @@ static inline long parseInt( const wxString& aValue, double aScalar )
* the previous format.
*
* Distinction between the even older format (mils, 1000 units per inch)
* and the pre-2011 format is done in ::parseMODULE already; the
* and the pre-2011 format is done in ::parseFOOTPRINT already; the
* distinction is by wether an object definition opens with '(' or '['.
* All values with explicite unit open with a '[' so there's no need to
* consider this distinction when parsing them.
@ -126,8 +125,6 @@ GPCB_FPL_CACHE_ITEM::GPCB_FPL_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENA
typedef boost::ptr_map< std::string, GPCB_FPL_CACHE_ITEM > FOOTPRINT_MAP;
typedef FOOTPRINT_MAP::iterator MODULE_ITER;
typedef FOOTPRINT_MAP::const_iterator MODULE_CITER;
class GPCB_FPL_CACHE
@ -141,7 +138,7 @@ class GPCB_FPL_CACHE
long long m_cache_timestamp; ///< A hash of the timestamps for all the footprint
///< files.
FOOTPRINT* parseMODULE( LINE_READER* aLineReader );
FOOTPRINT* parseFOOTPRINT( LINE_READER* aLineReader );
/**
* Function testFlags
@ -253,7 +250,7 @@ void GPCB_FPL_CACHE::Load()
// reader now owns fp, will close on exception or return
FILE_LINE_READER reader( fn.GetFullPath() );
std::string name = TO_UTF8( fn.GetName() );
FOOTPRINT* footprint = parseMODULE( &reader );
FOOTPRINT* footprint = parseFOOTPRINT( &reader );
// The footprint name is the file name without the extension.
footprint->SetFPID( LIB_ID( wxEmptyString, fn.GetName() ) );
@ -277,7 +274,7 @@ void GPCB_FPL_CACHE::Remove( const wxString& aFootprintName )
{
std::string footprintName = TO_UTF8( aFootprintName );
MODULE_CITER it = m_footprints.find( footprintName );
FOOTPRINT_MAP::const_iterator it = m_footprints.find( footprintName );
if( it == m_footprints.end() )
{
@ -309,7 +306,7 @@ long long GPCB_FPL_CACHE::GetTimestamp( const wxString& aLibPath )
}
FOOTPRINT* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
FOOTPRINT* GPCB_FPL_CACHE::parseFOOTPRINT( LINE_READER* aLineReader )
{
#define TEXT_DEFAULT_SIZE ( 40*IU_PER_MILS )
#define OLD_GPCB_UNIT_CONV IU_PER_MILS
@ -896,8 +893,8 @@ void GPCB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wxSt
// Some of the files may have been parsed correctly so we want to add the valid files to
// the library.
for( MODULE_CITER it = m_cache->GetFootprints().begin(); it != m_cache->GetFootprints().end(); ++it )
aFootprintNames.Add( FROM_UTF8( it->first.c_str() ) );
for( const auto& footprint : m_cache->GetFootprints() )
aFootprintNames.Add( FROM_UTF8( footprint.first.c_str() ) );
if( !errorMsg.IsEmpty() && !aBestEfforts )
THROW_IO_ERROR( errorMsg );
@ -917,12 +914,10 @@ const FOOTPRINT* GPCB_PLUGIN::getFootprint( const wxString& aLibraryPath,
const FOOTPRINT_MAP& mods = m_cache->GetFootprints();
MODULE_CITER it = mods.find( TO_UTF8( aFootprintName ) );
FOOTPRINT_MAP::const_iterator it = mods.find( TO_UTF8( aFootprintName ) );
if( it == mods.end() )
{
return NULL;
}
return it->second->GetFootprint();
}

View File

@ -78,8 +78,6 @@ FP_CACHE_ITEM::FP_CACHE_ITEM( FOOTPRINT* aFootprint, const WX_FILENAME& aFileNam
typedef boost::ptr_map< wxString, FP_CACHE_ITEM > FOOTPRINT_MAP;
typedef FOOTPRINT_MAP::iterator MODULE_ITER;
typedef FOOTPRINT_MAP::const_iterator MODULE_CITER;
class FP_CACHE
@ -173,7 +171,7 @@ void FP_CACHE::Save( FOOTPRINT* aFootprint )
m_lib_raw_path ) );
}
for( MODULE_ITER it = m_modules.begin(); it != m_modules.end(); ++it )
for( FOOTPRINT_MAP::iterator it = m_modules.begin(); it != m_modules.end(); ++it )
{
if( aFootprint && aFootprint != it->second->GetModule() )
continue;
@ -286,7 +284,7 @@ void FP_CACHE::Load()
void FP_CACHE::Remove( const wxString& aFootprintName )
{
MODULE_CITER it = m_modules.find( aFootprintName );
FOOTPRINT_MAP::const_iterator it = m_modules.find( aFootprintName );
if( it == m_modules.end() )
{
@ -2158,8 +2156,8 @@ void PCB_IO::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString&
// Some of the files may have been parsed correctly so we want to add the valid files to
// the library.
for( MODULE_CITER it = m_cache->GetFootprints().begin(); it != m_cache->GetFootprints().end(); ++it )
aFootprintNames.Add( it->first );
for( const auto& footprint : m_cache->GetFootprints() )
aFootprintNames.Add( footprint.first );
if( !errorMsg.IsEmpty() && !aBestEfforts )
THROW_IO_ERROR( errorMsg );
@ -2184,11 +2182,10 @@ const FOOTPRINT* PCB_IO::getFootprint( const wxString& aLibraryPath,
// do nothing with the error
}
const FOOTPRINT_MAP& mods = m_cache->GetFootprints();
FOOTPRINT_MAP& footprints = m_cache->GetFootprints();
FOOTPRINT_MAP::const_iterator it = footprints.find( aFootprintName );
MODULE_CITER it = mods.find( aFootprintName );
if( it == mods.end() )
if( it == footprints.end() )
return nullptr;
return it->second->GetModule();
@ -2263,7 +2260,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFoot
wxString footprintName = aFootprint->GetFPID().GetLibItemName();
FOOTPRINT_MAP& mods = m_cache->GetFootprints();
FOOTPRINT_MAP& footprints = m_cache->GetFootprints();
// Quietly overwrite module and delete module file from path for any by same name.
wxFileName fn( aLibraryPath, aFootprint->GetFPID().GetLibItemName(),
@ -2299,12 +2296,12 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFoot
wxString fullPath = fn.GetFullPath();
wxString fullName = fn.GetFullName();
MODULE_CITER it = mods.find( footprintName );
FOOTPRINT_MAP::const_iterator it = footprints.find( footprintName );
if( it != mods.end() )
if( it != footprints.end() )
{
wxLogTrace( traceKicadPcbPlugin, wxT( "Removing footprint file '%s'." ), fullPath );
mods.erase( footprintName );
footprints.erase( footprintName );
wxRemoveFile( fullPath );
}
@ -2326,7 +2323,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const FOOTPRINT* aFoot
}
wxLogTrace( traceKicadPcbPlugin, wxT( "Creating s-expr footprint file '%s'." ), fullPath );
mods.insert( footprintName, new FP_CACHE_ITEM( footprint, WX_FILENAME( fn.GetPath(), fullName ) ) );
footprints.insert( footprintName, new FP_CACHE_ITEM( footprint, WX_FILENAME( fn.GetPath(), fullName ) ) );
m_cache->Save( footprint );
}

View File

@ -510,7 +510,7 @@ BOARD_ITEM* PCB_PARSER::Parse()
break;
case T_module:
item = (BOARD_ITEM*) parseMODULE( initial_comments.release() );
item = (BOARD_ITEM*) parseFOOTPRINT( initial_comments.release());
break;
default:
@ -615,7 +615,7 @@ BOARD* PCB_PARSER::parseBOARD_unchecked()
break;
case T_module:
m_board->Add( parseMODULE(), ADD_MODE::APPEND );
m_board->Add( parseFOOTPRINT(), ADD_MODE::APPEND );
break;
case T_segment:
@ -2794,11 +2794,11 @@ DIMENSION_BASE* PCB_PARSER::parseDIMENSION()
}
FOOTPRINT* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments )
FOOTPRINT* PCB_PARSER::parseFOOTPRINT( wxArrayString* aInitialComments )
{
try
{
return parseMODULE_unchecked( aInitialComments );
return parseFOOTPRINT_unchecked( aInitialComments );
}
catch( const PARSE_ERROR& parse_error )
{
@ -2810,7 +2810,7 @@ FOOTPRINT* PCB_PARSER::parseMODULE( wxArrayString* aInitialComments )
}
FOOTPRINT* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
FOOTPRINT* PCB_PARSER::parseFOOTPRINT_unchecked( wxArrayString* aInitialComments )
{
wxCHECK_MSG( CurTok() == T_module, NULL,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as FOOTPRINT." ) );

View File

@ -162,10 +162,10 @@ class PCB_PARSER : public PCB_LEXER
DIMENSION_BASE* parseDIMENSION();
/**
* Function parseMODULE_unchecked
* Function parseFOOTPRINT_unchecked
* Parse a module, but do not replace PARSE_ERROR with FUTURE_FORMAT_ERROR automatically.
*/
FOOTPRINT* parseMODULE_unchecked( wxArrayString* aInitialComments = 0 );
FOOTPRINT* parseFOOTPRINT_unchecked( wxArrayString* aInitialComments = 0 );
FP_TEXT* parseFP_TEXT();
FP_SHAPE* parseFP_SHAPE();
PAD* parsePAD( FOOTPRINT* aParent = NULL );
@ -378,12 +378,12 @@ public:
BOARD_ITEM* Parse();
/**
* Function parseMODULE
* Function parseFOOTPRINT
* @param aInitialComments may be a pointer to a heap allocated initial comment block
* or NULL. If not NULL, then caller has given ownership of a wxArrayString to
* this function and care must be taken to delete it even on exception.
*/
FOOTPRINT* parseMODULE( wxArrayString* aInitialComments = 0 );
FOOTPRINT* parseFOOTPRINT( wxArrayString* aInitialComments = 0 );
/**
* Return whether a version number, if any was parsed, was too recent

View File

@ -3088,8 +3088,6 @@ void LEGACY_PLUGIN::SaveFP3DModels( const FOOTPRINT* aFootprint ) const
#include <wx/filename.h>
typedef boost::ptr_map< std::string, FOOTPRINT > FOOTPRINT_MAP;
typedef FOOTPRINT_MAP::iterator MODULE_ITER;
typedef FOOTPRINT_MAP::const_iterator MODULE_CITER;
/**
@ -3269,14 +3267,14 @@ void LP_CACHE::LoadModules( LINE_READER* aReader )
*/
MODULE_CITER it = m_footprints.find( footprintName );
FOOTPRINT_MAP::const_iterator it = m_footprints.find( footprintName );
if( it == m_footprints.end() ) // footprintName is not present in cache yet.
{
std::pair<MODULE_ITER, bool> r = m_footprints.insert( footprintName, fp );
wxASSERT_MSG( r.second, wxT( "error doing cache insert using guaranteed unique name" ) );
(void) r;
if( !m_footprints.insert( footprintName, fp ).second )
{
wxFAIL_MSG( "error doing cache insert using guaranteed unique name" );
}
}
// Bad library has a duplicate of this footprintName, generate a
@ -3302,10 +3300,11 @@ void LP_CACHE::LoadModules( LINE_READER* aReader )
nameOK = true;
fp->SetFPID( LIB_ID( wxEmptyString, newName ) );
std::pair<MODULE_ITER, bool> r = m_footprints.insert( newName, fp );
wxASSERT_MSG( r.second, wxT( "error doing cache insert using guaranteed unique name" ) );
(void) r;
if( !m_footprints.insert( newName, fp ).second )
{
wxFAIL_MSG( "error doing cache insert using guaranteed unique name" );
}
}
}
}
@ -3353,8 +3352,8 @@ void LEGACY_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wx
// Some of the files may have been parsed correctly so we want to add the valid files to
// the library.
for( MODULE_CITER it = m_cache->m_footprints.begin(); it != m_cache->m_footprints.end(); ++it )
aFootprintNames.Add( FROM_UTF8( it->first.c_str() ) );
for( const auto& footprint : m_cache->m_footprints )
aFootprintNames.Add( FROM_UTF8( footprint.first.c_str() ) );
if( !errorMsg.IsEmpty() && !aBestEfforts )
THROW_IO_ERROR( errorMsg );
@ -3372,8 +3371,7 @@ FOOTPRINT* LEGACY_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
cacheLib( aLibraryPath );
const FOOTPRINT_MAP& footprints = m_cache->m_footprints;
MODULE_CITER it = footprints.find( TO_UTF8( aFootprintName ) );
FOOTPRINT_MAP::const_iterator it = footprints.find( TO_UTF8( aFootprintName ) );
if( it == footprints.end() )
{

View File

@ -86,7 +86,7 @@ void EditToolSelectionFilter( GENERAL_COLLECTOR& aCollector, int aFlags,
}
// case 2: selection contains both the module and its pads - remove the pads
if( !( aFlags & INCLUDE_PADS_AND_MODULES ) && fp && aCollector.HasItem( fp ) )
if( !( aFlags & INCLUDE_PADS_AND_FOOTPRINTS ) && fp && aCollector.HasItem( fp ) )
aCollector.Remove( item );
}
else if( item->Type() == PCB_PAD_T )
@ -108,7 +108,7 @@ void EditToolSelectionFilter( GENERAL_COLLECTOR& aCollector, int aFlags,
}
// case 2: selection contains both the module and its pads - remove the pads
if( !( aFlags & INCLUDE_PADS_AND_MODULES ) && fp && aCollector.HasItem( fp ) )
if( !( aFlags & INCLUDE_PADS_AND_FOOTPRINTS ) && fp && aCollector.HasItem( fp ) )
aCollector.Remove( item );
}
else if( ( aFlags & EXCLUDE_TRANSIENTS ) && item->Type() == PCB_MARKER_T )

View File

@ -50,10 +50,10 @@ namespace KIGFX {
* optionally excludes locked items and/or transient items (such as markers).
*/
#define EXCLUDE_LOCKED 0x0001
#define EXCLUDE_LOCKED_PADS 0x0002
#define EXCLUDE_TRANSIENTS 0x0004
#define INCLUDE_PADS_AND_MODULES 0x0008
#define EXCLUDE_LOCKED 0x0001
#define EXCLUDE_LOCKED_PADS 0x0002
#define EXCLUDE_TRANSIENTS 0x0004
#define INCLUDE_PADS_AND_FOOTPRINTS 0x0008
void EditToolSelectionFilter( GENERAL_COLLECTOR& aCollector, int aFlags, SELECTION_TOOL* sTool );

View File

@ -22,8 +22,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef MODULE_EDITOR_TOOLS_H
#define MODULE_EDITOR_TOOLS_H
#ifndef FOOTPRINT_EDITOR_TOOLS_H
#define FOOTPRINT_EDITOR_TOOLS_H
#include <tools/pcb_tool_base.h>

View File

@ -494,7 +494,7 @@ int PCBNEW_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
collector.m_Threshold = KiROUND( getView()->ToWorld( HITTEST_THRESHOLD_PIXELS ) );
if( m_isFootprintEditor )
collector.Collect( board, GENERAL_COLLECTOR::ModuleItems, (wxPoint) aPos, guide );
collector.Collect( board, GENERAL_COLLECTOR::FootprintItems, (wxPoint) aPos, guide );
else
collector.Collect( board, GENERAL_COLLECTOR::BoardLevelItems, (wxPoint) aPos, guide );

View File

@ -140,9 +140,11 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
const PCBNEW_SELECTION& sel = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool ) {
EditToolSelectionFilter(
aCollector, EXCLUDE_TRANSIENTS | INCLUDE_PADS_AND_MODULES, sTool );
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, SELECTION_TOOL* sTool )
{
EditToolSelectionFilter( aCollector,
EXCLUDE_TRANSIENTS | INCLUDE_PADS_AND_FOOTPRINTS,
sTool );
} );
if( sel.Empty() )

View File

@ -534,7 +534,7 @@ bool SELECTION_TOOL::selectPoint( const VECTOR2I& aWhere, bool aOnDrag,
ExitGroup();
}
collector.Collect( board(), m_isFootprintEditor ? GENERAL_COLLECTOR::ModuleItems
collector.Collect( board(), m_isFootprintEditor ? GENERAL_COLLECTOR::FootprintItems
: GENERAL_COLLECTOR::AllBoardItems,
(wxPoint) aWhere, guide );
@ -1622,7 +1622,7 @@ void SELECTION_TOOL::RebuildSelection()
return SEARCH_RESULT::CONTINUE;
};
board()->Visit( inspector, nullptr, m_isFootprintEditor ? GENERAL_COLLECTOR::ModuleItems
board()->Visit( inspector, nullptr, m_isFootprintEditor ? GENERAL_COLLECTOR::FootprintItems
: GENERAL_COLLECTOR::AllBoardItems );
}

View File

@ -57,7 +57,7 @@ typedef void (*CLIENT_SELECTION_FILTER)( const VECTOR2I&, GENERAL_COLLECTOR&, SE
* - pick single objects (click LMB)
* - add objects to existing selection (Shift+LMB)
* - draw selection box (drag LMB)
* - handles MODULEs properly (i.e. selects either FOOTPRINT or its PADs, TEXTs, etc.)
* - handles FOOTPRINTs properly (i.e. selects either FOOTPRINT or its PADs, TEXTs, etc.)
* - takes into account high-contrast & layer visibility settings
* - invokes InteractiveEdit tool when user starts to drag selected items
*/

View File

@ -9,7 +9,7 @@ set( KS2_LIB_FILES
pcb/3d_resolver.cpp
pcb/base.cpp
pcb/kicadmodel.cpp
pcb/kicadmodule.cpp
pcb/kicadfootprint.cpp
pcb/kicadpad.cpp
pcb/kicadpcb.cpp
pcb/kicadcurve.cpp

View File

@ -22,7 +22,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "kicadmodule.h"
#include "kicadfootprint.h"
#include "3d_resolver.h"
#include "kicadcurve.h"
@ -40,7 +40,7 @@
#include <Standard_Failure.hxx>
KICADMODULE::KICADMODULE( KICADPCB* aParent )
KICADFOOTPRINT::KICADFOOTPRINT( KICADPCB* aParent )
{
m_parent = aParent;
m_side = LAYER_NONE;
@ -51,7 +51,7 @@ KICADMODULE::KICADMODULE( KICADPCB* aParent )
}
KICADMODULE::~KICADMODULE()
KICADFOOTPRINT::~KICADFOOTPRINT()
{
for( auto i : m_pads )
delete i;
@ -66,7 +66,7 @@ KICADMODULE::~KICADMODULE()
}
bool KICADMODULE::Read( SEXPR::SEXPR* aEntry )
bool KICADFOOTPRINT::Read( SEXPR::SEXPR* aEntry )
{
if( NULL == aEntry )
return false;
@ -149,7 +149,7 @@ bool KICADMODULE::Read( SEXPR::SEXPR* aEntry )
}
bool KICADMODULE::parseModel( SEXPR::SEXPR* data )
bool KICADFOOTPRINT::parseModel( SEXPR::SEXPR* data )
{
KICADMODEL* mp = new KICADMODEL();
@ -168,7 +168,7 @@ bool KICADMODULE::parseModel( SEXPR::SEXPR* data )
}
bool KICADMODULE::parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType )
bool KICADFOOTPRINT::parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType )
{
KICADCURVE* mp = new KICADCURVE();
@ -190,7 +190,7 @@ bool KICADMODULE::parseCurve( SEXPR::SEXPR* data, CURVE_TYPE aCurveType )
}
bool KICADMODULE::parseLayer( SEXPR::SEXPR* data )
bool KICADFOOTPRINT::parseLayer( SEXPR::SEXPR* data )
{
SEXPR::SEXPR* val = data->GetChild( 1 );
std::string layername;
@ -219,13 +219,13 @@ bool KICADMODULE::parseLayer( SEXPR::SEXPR* data )
}
bool KICADMODULE::parsePosition( SEXPR::SEXPR* data )
bool KICADFOOTPRINT::parsePosition( SEXPR::SEXPR* data )
{
return Get2DPositionAndRotation( data, m_position, m_rotation );
}
bool KICADMODULE::parseAttribute( SEXPR::SEXPR* data )
bool KICADFOOTPRINT::parseAttribute( SEXPR::SEXPR* data )
{
if( data->GetNumberOfChildren() < 2 )
{
@ -251,7 +251,7 @@ bool KICADMODULE::parseAttribute( SEXPR::SEXPR* data )
}
bool KICADMODULE::parseText( SEXPR::SEXPR* data )
bool KICADFOOTPRINT::parseText( SEXPR::SEXPR* data )
{
// we're only interested in the Reference Designator
if( data->GetNumberOfChildren() < 3 )
@ -280,7 +280,7 @@ bool KICADMODULE::parseText( SEXPR::SEXPR* data )
}
bool KICADMODULE::parsePad( SEXPR::SEXPR* data )
bool KICADFOOTPRINT::parsePad( SEXPR::SEXPR* data )
{
KICADPAD* mp = new KICADPAD();
@ -303,8 +303,8 @@ bool KICADMODULE::parsePad( SEXPR::SEXPR* data )
}
bool KICADMODULE::ComposePCB( class PCBMODEL* aPCB, S3D_RESOLVER* resolver,
DOUBLET aOrigin, bool aComposeVirtual )
bool KICADFOOTPRINT::ComposePCB( class PCBMODEL* aPCB, S3D_RESOLVER* resolver,
DOUBLET aOrigin, bool aComposeVirtual )
{
// translate pads and curves to final position and append to PCB.
double dlim = (double)std::numeric_limits< float >::epsilon();

View File

@ -21,13 +21,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file kicadmodule.h
* declares the PCB Component object.
*/
#ifndef KICADMODULE_H
#define KICADMODULE_H
#ifndef KICADFOOTPRINT_H
#define KICADFOOTPRINT_H
#include "base.h"
#include "kicadpcb.h"
@ -46,7 +41,7 @@ class KICADMODEL;
class PCBMODEL;
class S3D_RESOLVER;
class KICADMODULE
class KICADFOOTPRINT
{
private:
bool parseModel( SEXPR::SEXPR* data );
@ -57,7 +52,7 @@ private:
bool parseText( SEXPR::SEXPR* data );
bool parsePad( SEXPR::SEXPR* data );
KICADPCB* m_parent; // The parent KICADPCB, to know layer names
KICADPCB* m_parent; // The parent KICADPCB, to know layer names
LAYERS m_side;
std::string m_refdes;
@ -70,8 +65,8 @@ private:
std::vector< KICADMODEL* > m_models;
public:
KICADMODULE( KICADPCB* aParent );
virtual ~KICADMODULE();
KICADFOOTPRINT( KICADPCB* aParent );
virtual ~KICADFOOTPRINT();
bool Read( SEXPR::SEXPR* aEntry );
@ -79,4 +74,4 @@ public:
DOUBLET aOrigin, bool aComposeVirtual = true );
};
#endif // KICADMODULE_H
#endif // KICADFOOTPRINT_H

View File

@ -24,7 +24,7 @@
#include "kicadpcb.h"
#include "kicadcurve.h"
#include "kicadmodule.h"
#include "kicadfootprint.h"
#include "oce_utils.h"
#include <sexpr/sexpr.h>
@ -368,7 +368,7 @@ bool KICADPCB::parseSetup( SEXPR::SEXPR* data )
bool KICADPCB::parseModule( SEXPR::SEXPR* data )
{
KICADMODULE* mp = new KICADMODULE( this );
KICADFOOTPRINT* mp = new KICADFOOTPRINT( this );
if( !mp->Read( data ) )
{

View File

@ -46,7 +46,7 @@ namespace SEXPR
class SEXPR;
}
class KICADMODULE;
class KICADFOOTPRINT;
class KICADCURVE;
class PCBMODEL;
@ -71,7 +71,7 @@ private:
// PCB parameters/entities
double m_thickness;
std::vector< KICADMODULE* > m_modules;
std::vector< KICADFOOTPRINT* > m_modules;
std::vector< KICADCURVE* > m_curves;
bool parsePCB( SEXPR::SEXPR* data );