Commit 40f4304b authored by Alexander Lunef's avatar Alexander Lunef Committed by jean-pierre charras

Pcbnew: Add pcad2kicad pcb plugin, to import PCAD boards ( .pcb ASCII data...

Pcbnew: Add pcad2kicad pcb plugin, to import PCAD boards ( .pcb ASCII data file PCad 2000 format ) from Alexander Lunef
parent 7c86749c
...@@ -349,6 +349,7 @@ add_subdirectory(eeschema) ...@@ -349,6 +349,7 @@ add_subdirectory(eeschema)
add_subdirectory(gerbview) add_subdirectory(gerbview)
add_subdirectory(kicad) add_subdirectory(kicad)
add_subdirectory(pcbnew) add_subdirectory(pcbnew)
add_subdirectory(pcbnew/pcad2kicadpcb_plugin)
add_subdirectory(polygon) add_subdirectory(polygon)
add_subdirectory(potrace) add_subdirectory(potrace)
add_subdirectory(bitmap2component) add_subdirectory(bitmap2component)
......
...@@ -70,6 +70,7 @@ const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); ...@@ -70,6 +70,7 @@ const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) ); const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) );
const wxString PCadPcbFileWildcard( _( "P-Cad 2002/2004 ASCII PCB files (*.pcb)|*.pcb" ) );
const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) ); const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) );
const wxString KiCadFootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) ); const wxString KiCadFootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) );
const wxString KiCadFootprintLibPathWildcard( _( "KiCad footprint s-expre library path (*.pretty)|*.pretty" ) ); const wxString KiCadFootprintLibPathWildcard( _( "KiCad footprint s-expre library path (*.pretty)|*.pretty" ) );
......
...@@ -95,6 +95,7 @@ endif(APPLE) ...@@ -95,6 +95,7 @@ endif(APPLE)
target_link_libraries(cvpcb target_link_libraries(cvpcb
3d-viewer 3d-viewer
pcbcommon pcbcommon
pcad2kicadpcb
common common
bitmaps bitmaps
polygon polygon
......
...@@ -212,7 +212,7 @@ protected: ...@@ -212,7 +212,7 @@ protected:
/** /**
* Function expandCapacity * Function expandCapacity
* will exand the capacity of @a line up to maxLineLength but not greater, so * will expand the capacity of @a line up to maxLineLength but not greater, so
* be careful about making assumptions of @a capacity after calling this. * be careful about making assumptions of @a capacity after calling this.
*/ */
void expandCapacity( unsigned newsize ); void expandCapacity( unsigned newsize );
......
...@@ -79,6 +79,7 @@ extern const wxString GerberFileWildcard; ...@@ -79,6 +79,7 @@ extern const wxString GerberFileWildcard;
extern const wxString LegacyPcbFileWildcard; extern const wxString LegacyPcbFileWildcard;
extern const wxString PcbFileWildcard; extern const wxString PcbFileWildcard;
extern const wxString EaglePcbFileWildcard; extern const wxString EaglePcbFileWildcard;
extern const wxString PCadPcbFileWildcard;
extern const wxString PdfFileWildcard; extern const wxString PdfFileWildcard;
extern const wxString PSFileWildcard; extern const wxString PSFileWildcard;
extern const wxString MacrosFileWildcard; extern const wxString MacrosFileWildcard;
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
class XNODE : public wxXmlNode class XNODE : public wxXmlNode
{ {
public: public:
//-----<overloads>---------------------------------------------------------
XNODE() : XNODE() :
wxXmlNode() wxXmlNode()
{ {
...@@ -62,6 +63,22 @@ public: ...@@ -62,6 +63,22 @@ public:
{ {
} }
XNODE* GetChildren() const
{
return (XNODE* )wxXmlNode::GetChildren();
}
XNODE* GetNext() const
{
return (XNODE* )wxXmlNode::GetNext();
}
XNODE* GetParent() const
{
return (XNODE* )wxXmlNode::GetParent();
}
//-----</overloads>--------------------------------------------------------
/** /**
* Function Format * Function Format
* writes this object as UTF8 out to an OUTPUTFORMATTER as an S-expression. * writes this object as UTF8 out to an OUTPUTFORMATTER as an S-expression.
......
...@@ -416,6 +416,7 @@ target_link_libraries(pcbnew ...@@ -416,6 +416,7 @@ target_link_libraries(pcbnew
common common
bitmaps bitmaps
polygon polygon
pcad2kicadpcb
${wxWidgets_LIBRARIES} ${wxWidgets_LIBRARIES}
${OPENGL_LIBRARIES} ${OPENGL_LIBRARIES}
${GDI_PLUS_LIBRARIES} ${GDI_PLUS_LIBRARIES}
......
...@@ -190,6 +190,7 @@ the changes?" ) ) ) ...@@ -190,6 +190,7 @@ the changes?" ) ) )
{ PcbFileWildcard, IO_MGR::KICAD }, { PcbFileWildcard, IO_MGR::KICAD },
{ LegacyPcbFileWildcard, IO_MGR::LEGACY }, { LegacyPcbFileWildcard, IO_MGR::LEGACY },
{ EaglePcbFileWildcard, IO_MGR::EAGLE }, { EaglePcbFileWildcard, IO_MGR::EAGLE },
{ PCadPcbFileWildcard, IO_MGR::PCAD },
}; };
if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog ) if( !fileName.IsOk() || !fileName.FileExists() || aForceFileDialog )
...@@ -326,13 +327,28 @@ the changes?" ) ) ) ...@@ -326,13 +327,28 @@ the changes?" ) ) )
GetBoard()->SetFileName( new_filename ); GetBoard()->SetFileName( new_filename );
} }
// Fix the directory separator on Windows // Fix the directory separator on Windows and
wxString fn( GetBoard()->GetFileName() ); // force the new file format for not Kicad boards,
// to ensure the right format when saving the board
bool converted = pluginType != IO_MGR::LEGACY && pluginType != IO_MGR::KICAD;
wxString fn;
if( converted )
fn = GetBoard()->GetFileName().BeforeLast( '.' );
else
fn = GetBoard()->GetFileName();
fn.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP ); fn.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
if( converted )
fn += wxT( "." ) + PcbFileExtension;
GetBoard()->SetFileName( fn ); GetBoard()->SetFileName( fn );
UpdateTitle(); UpdateTitle();
UpdateFileHistory( GetBoard()->GetFileName() );
if( !converted )
UpdateFileHistory( GetBoard()->GetFileName() );
// Rebuild the new pad list (for drc and ratsnet control ...) // Rebuild the new pad list (for drc and ratsnet control ...)
GetBoard()->m_Status_Pcb = 0; GetBoard()->m_Status_Pcb = 0;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <legacy_plugin.h> #include <legacy_plugin.h>
#include <kicad_plugin.h> #include <kicad_plugin.h>
#include <eagle_plugin.h> #include <eagle_plugin.h>
#include <pcad2kicadpcb_plugin/pcad_plugin.h>
#include <gpcb_plugin.h> #include <gpcb_plugin.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
...@@ -66,6 +67,9 @@ PLUGIN* IO_MGR::PluginFind( PCB_FILE_T aFileType ) ...@@ -66,6 +67,9 @@ PLUGIN* IO_MGR::PluginFind( PCB_FILE_T aFileType )
case EAGLE: case EAGLE:
return new EAGLE_PLUGIN(); return new EAGLE_PLUGIN();
case PCAD:
return new PCAD_PLUGIN();
case GEDA_PCB: case GEDA_PCB:
return new GPCB_PLUGIN(); return new GPCB_PLUGIN();
} }
...@@ -104,6 +108,9 @@ const wxString IO_MGR::ShowType( PCB_FILE_T aType ) ...@@ -104,6 +108,9 @@ const wxString IO_MGR::ShowType( PCB_FILE_T aType )
case EAGLE: case EAGLE:
return wxString( wxT( "Eagle" ) ); return wxString( wxT( "Eagle" ) );
case PCAD:
return wxString( wxT( "P-Cad" ) );
case GEDA_PCB: case GEDA_PCB:
return wxString( wxT( "Geda-PCB" ) ); return wxString( wxT( "Geda-PCB" ) );
} }
...@@ -125,6 +132,9 @@ IO_MGR::PCB_FILE_T IO_MGR::EnumFromStr( const wxString& aType ) ...@@ -125,6 +132,9 @@ IO_MGR::PCB_FILE_T IO_MGR::EnumFromStr( const wxString& aType )
if( aType == wxT( "Eagle" ) ) if( aType == wxT( "Eagle" ) )
return EAGLE; return EAGLE;
if( aType == wxT( "P-Cad" ) )
return PCAD;
if( aType == wxT( "Geda-PCB" ) ) if( aType == wxT( "Geda-PCB" ) )
return GEDA_PCB; return GEDA_PCB;
......
...@@ -51,6 +51,7 @@ public: ...@@ -51,6 +51,7 @@ public:
LEGACY, //< Legacy Pcbnew file formats prior to s-expression. LEGACY, //< Legacy Pcbnew file formats prior to s-expression.
KICAD, //< S-expression Pcbnew file format. KICAD, //< S-expression Pcbnew file format.
EAGLE, EAGLE,
PCAD,
GEDA_PCB, //< Geda PCB file formats. GEDA_PCB, //< Geda PCB file formats.
// add your type here. // add your type here.
......
add_definitions(-DPCBNEW)
include_directories(BEFORE ${INC_BEFORE})
include_directories(
../../include
../../pcbnew
../../polygon
${INC_AFTER}
)
set(PCAD2PCBNEW_SRCS
pcad2kicad_common.cpp
pcad_plugin.cpp
pcb.cpp
pcb_arc.cpp
pcb_component.cpp
pcb_copper_pour.cpp
pcb_cutout.cpp
pcb_keepout.cpp
pcb_line.cpp
pcb_module.cpp
pcb_net.cpp
pcb_pad.cpp
pcb_pad_shape.cpp
pcb_plane.cpp
pcb_polygon.cpp
pcb_text.cpp
pcb_via.cpp
pcb_via_shape.cpp
s_expr_loader.cpp
)
add_library(pcad2kicadpcb STATIC ${PCAD2PCBNEW_SRCS})
This diff is collapsed.
Examples description
====================
CK1202_V1.pcb - provided by author Andrey Manin <pcadbegin[at]rambler.ru>,
downloaded from http://www.pcadbegin.webtm.ru/schetchik.php?scach=1
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcad2kicad_common.h
*/
#ifndef PCAD2KICAD_COMMON_H_
#define PCAD2KICAD_COMMON_H_
#include <wx/wx.h>
#include <wx/xml/xml.h>
#include <xnode.h>
namespace PCAD2KICAD
{
#define PCAD2KICAD_SCALE_SCH_TO_INCH_GRID
typedef struct _TTEXTVALUE
{
wxString text;
int textPositionX, textPositionY,
textRotation, textHeight, textstrokeWidth;
int textIsVisible, mirror, textUnit;
int correctedPositionX, correctedPositionY;
} TTEXTVALUE;
extern wxString GetWord( wxString* aStr );
extern XNODE* FindPinMap( XNODE* aNode );
extern int StrToIntUnits( wxString aStr, char aAxe, wxString aActualConversion );
extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr,
wxString aDefaultMeasurementUnit );
extern int StrToInt1Units( wxString aStr );
extern wxString ValidateName( wxString aName );
extern void SetWidth( wxString aStr,
wxString aDefaultMeasurementUnit,
int* aWidth,
wxString aActualConversion );
extern void SetPosition( wxString aStr,
wxString aDefaultMeasurementUnit,
int* aX,
int* aY,
wxString aActualConversion );
extern void SetDoublePrecisionPosition( wxString aStr,
wxString aDefaultMeasurementUnit,
double* aX,
double* aY,
wxString aActualConversion );
extern void SetTextParameters( XNODE* aNode,
TTEXTVALUE* aTextValue,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
extern void SetFontProperty( XNODE* aNode,
TTEXTVALUE* aTextValue,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
extern void CorrectTextPosition( TTEXTVALUE* aValue, int aRotation );
extern XNODE* FindNode( XNODE* aChild, wxString aTag );
extern wxString FindNodeGetContent( XNODE* aChild, wxString aTag );
extern void InitTTextValue( TTEXTVALUE* aTextValue );
} // namespace PCAD2KICAD
#endif // PCAD2KICAD_COMMON_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcad_plugin.cpp
* @brief Pcbnew PLUGIN for P-Cad 2002/2004 ASCII *.pcb format.
*/
#include <errno.h>
#include <wx/string.h>
#include <wx/filename.h>
#include <wx/xml/xml.h>
#include <pcad_plugin.h>
#include <s_expr_loader.h>
#include <pcb.h>
#include <common.h>
#include <macros.h>
#include <fctsys.h>
using namespace PCAD2KICAD;
PCAD_PLUGIN::PCAD_PLUGIN()
{
m_board = NULL;
m_props = NULL;
}
PCAD_PLUGIN::~PCAD_PLUGIN()
{
}
const wxString& PCAD_PLUGIN::PluginName() const
{
static const wxString name = wxT( "P-Cad" );
return name;
}
const wxString& PCAD_PLUGIN::GetFileExtension() const
{
static const wxString extension = wxT( "pcb" );
return extension;
}
BOARD* PCAD_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, PROPERTIES* aProperties )
{
wxXmlDocument xmlDoc;
m_props = aProperties;
m_board = aAppendToMe ? aAppendToMe : new BOARD();
// Give the filename to the board if it's new
if( !aAppendToMe )
m_board->SetFileName( aFileName );
PCB pcb( m_board );
LOCALE_IO toggle; // toggles on, then off, the C locale.
LoadInputFile( aFileName, &xmlDoc );
pcb.Parse( NULL, &xmlDoc, wxT( "PCB" ) );
pcb.AddToBoard();
return m_board;
}
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcad_plugin.h
* @brief Pcbnew PLUGIN for P-Cad 2002/2004 ASCII *.pcb format.
*/
#ifndef PCAD_PLUGIN_H_
#define PCAD_PLUGIN_H_
#include <io_mgr.h>
class PCAD_PLUGIN : public PLUGIN
{
public:
// -----<PUBLIC PLUGIN API>--------------------------------------------------
const wxString& PluginName() const;
BOARD* Load( const wxString& aFileName,
BOARD* aAppendToMe,
PROPERTIES* aProperties = NULL );
const wxString& GetFileExtension() const;
// -----</PUBLIC PLUGIN API>-------------------------------------------------
PCAD_PLUGIN();
~PCAD_PLUGIN();
private:
PROPERTIES* m_props;
BOARD* m_board;
};
#endif // PCAD_PLUGIN_H_
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb.h
*/
#ifndef pcb_H_
#define pcb_H_
#include <wx/wx.h>
#include <xnode.h>
#include <pcb_module.h>
#include <pcb_net.h>
namespace PCAD2KICAD {
class PCB : public PCB_MODULE, public PCB_CALLBACKS
{
public:
PCB_COMPONENTS_ARRAY m_pcbComponents; // PCB Modules,Lines,Routes,Texts, .... and so on
PCB_NETS_ARRAY m_pcbNetlist; // net objects collection
wxString m_defaultMeasurementUnit;
TLAYER m_layersMap[NB_LAYERS]; // flexible layers mapping
int m_sizeX;
int m_sizeY;
PCB( BOARD* aBoard );
~PCB();
int GetKiCadLayer( int aPCadLayer );
LAYER_TYPE_T GetLayerType( int aPCadLayer );
wxString GetLayerNetNameRef( int aPCadLayer );
int GetNewTimestamp();
int GetNetCode( wxString aNetName );
void Parse( wxStatusBar* aStatusBar,
wxXmlDocument* aXmlDoc,
wxString aActualConversion );
virtual void WriteToFile( wxString aFileName );
void AddToBoard();
private:
int m_timestamp_cnt;
wxArrayString m_layersStackup;
XNODE* FindCompDefName( XNODE* aNode, wxString aName );
void SetTextProperty( XNODE* aNode,
TTEXTVALUE* aTextValue,
wxString aPatGraphRefName,
wxString aXmlName,
wxString aActualConversion );
void DoPCBComponents( XNODE* aNode,
wxXmlDocument* aXmlDoc,
wxString aActualConversion,
wxStatusBar* aStatusBar );
void ConnectPinToNet( wxString aCr, wxString aPr, wxString aNetName );
int FindLayer( wxString aLayerName );
void MapLayer( XNODE* aNode );
int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint );
double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 );
void GetBoardOutline( wxXmlDocument* aXmlDoc, wxString aActualConversion );
};
} // namespace PCAD2KICAD
#endif // pcb_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_arc.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <common.h>
#include <trigo.h>
#include <pcb_arc.h>
namespace PCAD2KICAD {
PCB_ARC::PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard )
{
m_objType = wxT( 'A' );
m_startX = 0;
m_startY = 0;
m_angle = 0;
m_width = 0;
}
PCB_ARC::~PCB_ARC()
{
}
void PCB_ARC::Parse( XNODE* aNode,
int aLayer,
wxString aDefaultMeasurementUnit,
wxString aActualConversion )
{
XNODE* lNode;
double r = 0.0, a = 0.0;
int endPointX, endPointY;
m_PCadLayer = aLayer;
m_KiCadLayer = GetKiCadLayer();
if( FindNode( aNode, wxT( "width" ) ) )
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(),
aDefaultMeasurementUnit, &m_width, aActualConversion );
if( aNode->GetName() == wxT( "triplePointArc" ) )
{
// center point
lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&m_positionX, &m_positionY, aActualConversion );
// start point
lNode = lNode->GetNext();
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&m_startX, &m_startY, aActualConversion );
// end point
lNode = lNode->GetNext();
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&endPointX, &endPointY, aActualConversion );
int alpha1 = ArcTangente( m_startY - m_positionY, m_startX - m_positionX );
int alpha2 = ArcTangente( endPointY - m_positionY, endPointX - m_positionX );
m_angle = alpha1 - alpha2;
if( m_angle < 0 )
m_angle = 3600 + m_angle;
}
if( aNode->GetName() == wxT( "arc" ) )
{
lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&m_positionX, &m_positionY, aActualConversion );
lNode = FindNode( aNode, wxT( "radius" ) );
if( lNode)
r = StrToIntUnits( lNode->GetNodeContent(), wxT( ' ' ), aActualConversion );
lNode = FindNode( aNode, wxT( "startAngle" ) );
if( lNode )
a = StrToInt1Units( lNode->GetNodeContent() );
m_startX = KiROUND( m_positionX + r * sin( (a - 900.0) * M_PI / 1800.0 ) );
m_startY = KiROUND( m_positionY - r * cos( (a - 900.0) * M_PI / 1800.0 ) );
lNode = FindNode( aNode, wxT( "sweepAngle" ) );
if( lNode )
m_angle = StrToInt1Units( lNode->GetNodeContent() );
}
}
void PCB_ARC::WriteToFile( wxFile* aFile, char aFileType )
{
/*
* DC ox oy fx fy w DC is a Draw Circle DC Xcentre Ycentre Xpoint Ypoint Width Layer
* DA x0 y0 x1 y1 angle width layer DA is a Draw ArcX0,y0 = Start point x1,y1 = end point
*/
if( aFileType == wxT( 'L' ) ) // Library component
{
aFile->Write( wxString::Format( wxT( "DA %d %d %d %d %d %d %d\n" ),
m_positionX, m_positionY, m_startX,
m_startY, m_angle, m_width,
m_KiCadLayer ) ); // ValueString
}
}
void PCB_ARC::SetPosOffset( int aX_offs, int aY_offs )
{
PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
m_startX += aX_offs;
m_startY += aY_offs;
}
void PCB_ARC::AddToModule( MODULE* aModule )
{
if( IsValidNonCopperLayerIndex( m_KiCadLayer ) )
{
EDGE_MODULE* arc = new EDGE_MODULE( aModule, S_ARC );
aModule->m_Drawings.PushBack( arc );
arc->SetAngle( -m_angle );
arc->m_Start0 = wxPoint( m_positionX, m_positionY );
arc->m_End0 = wxPoint( m_startX, m_startY );
arc->SetWidth( m_width );
arc->SetLayer( m_KiCadLayer );
arc->SetDrawCoord();
}
}
void PCB_ARC::AddToBoard()
{
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_APPEND );
dseg->SetShape( S_ARC );
dseg->SetTimeStamp( m_timestamp );
dseg->SetLayer( m_KiCadLayer );
dseg->SetStart( wxPoint( m_positionX, m_positionY ) );
dseg->SetEnd( wxPoint( m_startX, m_startY ) );
dseg->SetAngle( -m_angle );
dseg->SetWidth( m_width );
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_arc.h
*/
#ifndef PCB_ARC_H_
#define PCB_ARC_H_
#include <wx/wx.h>
#include <pcb_component.h>
namespace PCAD2KICAD {
class PCB_ARC : public PCB_COMPONENT
{
public:
int m_startX;
int m_startY;
int m_angle;
int m_width;
PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_ARC();
virtual void Parse( XNODE* aNode, int aLayer,
wxString aDefaultMeasurementUnit, wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void SetPosOffset( int aX_offs, int aY_offs );
void AddToModule( MODULE* aModule );
void AddToBoard();
};
} // namespace PCAD2KICAD
#endif // PCB_ARC_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_callbacks.h
*/
#ifndef PCB_CALLBACKS_H_
#define PCB_CALLBACKS_H_
#include <wx/wx.h>
enum LAYER_TYPE_T
{
LAYER_TYPE_SIGNAL,
LAYER_TYPE_NONSIGNAL,
LAYER_TYPE_PLANE
};
typedef struct _TLAYER
{
int KiCadLayer;
LAYER_TYPE_T layerType;
wxString netNameRef;
} TLAYER;
namespace PCAD2KICAD
{
class PCB_CALLBACKS
{
public:
virtual int GetKiCadLayer( int aPCadLayer ) = 0;
virtual LAYER_TYPE_T GetLayerType( int aPCadLayer ) = 0;
virtual wxString GetLayerNetNameRef( int aPCadLayer ) = 0;
virtual int GetNewTimestamp() = 0;
virtual int GetNetCode( wxString netName ) = 0;
};
}
#endif // PCB_CALLBACKS_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_component.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <common.h>
#include <pcb_component.h>
namespace PCAD2KICAD {
PCB_COMPONENT::PCB_COMPONENT( PCB_CALLBACKS* aCallbacks,
BOARD* aBoard ) : m_callbacks( aCallbacks ),
m_board( aBoard )
{
m_tag = 0;
m_objType = wxT( '?' );
m_PCadLayer = 0;
m_KiCadLayer = 0;
m_timestamp = 0;
m_positionX = 0;
m_positionY = 0;
m_rotation = 0;
InitTTextValue( &m_name );
m_net = wxEmptyString;
m_netCode = 0;
m_compRef = wxEmptyString;
m_patGraphRefName = wxEmptyString;
}
PCB_COMPONENT::~PCB_COMPONENT()
{
}
void PCB_COMPONENT::WriteToFile( wxFile* aFile, char aFileType )
{
}
void PCB_COMPONENT::AddToModule( MODULE* aModule )
{
}
void PCB_COMPONENT::SetPosOffset( int aX_offs, int aY_offs )
{
m_positionX += aX_offs;
m_positionY += aY_offs;
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_component.h
*/
#ifndef PCB_COMPONENT_H_
#define PCB_COMPONENT_H_
#include <wx/wx.h>
#include <wx/file.h>
#include <pcad2kicad_common.h>
#include <pcb_callbacks.h>
#include <class_board.h>
#include <class_module.h>
#include <class_track.h>
#include <class_edge_mod.h>
#include <class_zone.h>
#include <class_pcb_text.h>
namespace PCAD2KICAD {
// basic parent class for PCB objects
class PCB_COMPONENT : public wxObject
{
public:
int m_tag;
char m_objType;
int m_PCadLayer;
int m_KiCadLayer;
int m_timestamp;
int m_positionX;
int m_positionY;
int m_rotation;
TTEXTVALUE m_name; // name has also privete positions, rotations nand so on....
wxString m_net;
int m_netCode;
wxString m_compRef; // internal ussage for XL parsing
wxString m_patGraphRefName; // internal ussage for XL parsing
PCB_COMPONENT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_COMPONENT();
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void SetPosOffset( int aX_offs, int aY_offs );
virtual void AddToModule( MODULE* aModule );
virtual void AddToBoard() = 0;
int GetKiCadLayer() { return m_callbacks->GetKiCadLayer( m_PCadLayer ); }
int GetNewTimestamp() { return m_callbacks->GetNewTimestamp(); }
int GetNetCode( wxString aNetName ) { return m_callbacks->GetNetCode( aNetName ); }
protected:
PCB_CALLBACKS* m_callbacks;
BOARD* m_board;
};
WX_DEFINE_ARRAY( PCB_COMPONENT*, PCB_COMPONENTS_ARRAY );
WX_DEFINE_ARRAY( wxRealPoint*, VERTICES_ARRAY );
} // namespace PCAD2KICAD
#endif // PCB_COMPONENT_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_copper_pour.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <common.h>
#include <pcb_copper_pour.h>
namespace PCAD2KICAD {
PCB_COPPER_POUR::PCB_COPPER_POUR( PCB_CALLBACKS* aCallbacks,
BOARD* aBoard,
int aPCadLayer ) :
PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
{
}
PCB_COPPER_POUR::~PCB_COPPER_POUR()
{
}
bool PCB_COPPER_POUR::Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion,
wxStatusBar* aStatusBar )
{
XNODE* lNode;
wxString pourType, str, propValue;
int pourSpacing, thermalWidth;
// aStatusBar->SetStatusText( aStatusBar->GetStatusText() + wxT( " CooperPour..." ) );
//str = FindNode( aNode, wxT( "pourType" ) )->GetNodeContent();
//str.Trim( false );
//pourType = str.MakeUpper();
lNode = FindNode( aNode, wxT( "netNameRef" ) );
if( lNode )
{
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
}
if( FindNode( aNode, wxT( "width" ) ) )
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(),
aDefaultMeasurementUnit, &m_width, aActualConversion );
if( FindNode( aNode, wxT( "pourSpacing" ) ) )
SetWidth( FindNode( aNode, wxT( "pourSpacing" ) )->GetNodeContent(),
aDefaultMeasurementUnit, &pourSpacing, aActualConversion );
if( FindNode( aNode, wxT( "thermalWidth" ) ) )
SetWidth( FindNode( aNode, wxT( "thermalWidth" ) )->GetNodeContent(),
aDefaultMeasurementUnit, &thermalWidth, aActualConversion );
lNode = FindNode( aNode, wxT( "pcbPoly" ) );
if( lNode )
{
// retrieve copper pour outline
FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
}
else
{
return false;
}
return true;
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_copper_pour.h
*/
#ifndef PCB_COPPER_POUR_H_
#define PCB_COPPER_POUR_H_
#include <wx/wx.h>
#include <pcb_polygon.h>
namespace PCAD2KICAD {
class PCB_COPPER_POUR : public PCB_POLYGON
{
public:
PCB_COPPER_POUR( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_COPPER_POUR();
virtual bool Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion,
wxStatusBar* aStatusBar );
};
} // namespace PCAD2KICAD
#endif // PCB_COPPER_POUR_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_cutout.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <pcb_cutout.h>
namespace PCAD2KICAD {
PCB_CUTOUT::PCB_CUTOUT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer ) :
PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
{
m_objType = wxT( 'C' );
}
PCB_CUTOUT::~PCB_CUTOUT()
{
}
bool PCB_CUTOUT::Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion )
{
XNODE* lNode;
lNode = FindNode( aNode, wxT( "pcbPoly" ) );
if( lNode )
{
// retrieve cutout outline
FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
}
else
{
return false;
}
return true;
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_cutout.h
*/
#ifndef PCB_CUTOUT_H_
#define PCB_CUTOUT_H_
#include <wx/wx.h>
#include <pcb_polygon.h>
namespace PCAD2KICAD {
class PCB_CUTOUT : public PCB_POLYGON
{
public:
PCB_CUTOUT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_CUTOUT();
virtual bool Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString actualConversion );
};
} // namespace PCAD2KICAD
#endif // PCB_CUTOUT_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_keepout.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <common.h>
#include <pcb_keepout.h>
namespace PCAD2KICAD {
PCB_KEEPOUT::PCB_KEEPOUT( PCB_CALLBACKS* aCallbacks,
BOARD* aBoard,
int aPCadLayer ) :
PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
{
m_objType = wxT( 'K' );
}
PCB_KEEPOUT::~PCB_KEEPOUT()
{
}
bool PCB_KEEPOUT::Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion )
{
XNODE* lNode;
lNode = FindNode( aNode, wxT( "pcbPoly" ) );
if( lNode )
{
// retrieve keepOut outline
FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
}
else
{
return false;
}
return true;
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_keepout.h
*/
#ifndef PCB_KEEPOUT_H_
#define PCB_KEEPOUT_H_
#include <wx/wx.h>
#include <pcb_polygon.h>
namespace PCAD2KICAD {
class PCB_KEEPOUT : public PCB_POLYGON
{
public:
PCB_KEEPOUT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_KEEPOUT();
virtual bool Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
};
} // namespace PCAD2KICAD
#endif // PCB_KEEPOUT_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_line.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <common.h>
#include <pcb_line.h>
namespace PCAD2KICAD {
PCB_LINE::PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard ) : PCB_COMPONENT( aCallbacks,
aBoard )
{
m_width = 0;
m_toX = 0;
m_toY = 0;
m_objType = wxT( 'L' );
}
PCB_LINE::~PCB_LINE()
{
}
void PCB_LINE::Parse( XNODE* aNode,
int aLayer,
wxString aDefaultMeasurementUnit,
wxString aActualConversion )
{
XNODE* lNode;
wxString propValue;
m_PCadLayer = aLayer;
m_KiCadLayer = GetKiCadLayer();
m_positionX = 0;
m_positionY = 0;
m_toX = 0;
m_toY = 0;
m_width = 0;
lNode = FindNode( aNode, wxT( "pt" ) );
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&m_positionX, &m_positionY, aActualConversion );
lNode = lNode->GetNext();
if( lNode )
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&m_toX, &m_toY, aActualConversion );
lNode = FindNode( aNode, wxT( "width" ) );
if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width, aActualConversion );
lNode = FindNode( aNode, wxT( "netNameRef" ) );
if( lNode )
{
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
}
}
void PCB_LINE::SetPosOffset( int aX_offs, int aY_offs )
{
PCB_COMPONENT::SetPosOffset( aX_offs, aY_offs );
m_toX += aX_offs;
m_toY += aY_offs;
}
void PCB_LINE::WriteToFile( wxFile* aFile, char aFileType )
{
if( aFileType == wxT( 'L' ) ) // Library
{
aFile->Write( wxString::Format( wxT( "DS %d %d %d %d %d %d\n" ), m_positionX, m_positionY,
m_toX, m_toY, m_width, m_KiCadLayer ) ); // Position
}
}
void PCB_LINE::AddToModule( MODULE* aModule )
{
if( IsValidNonCopperLayerIndex( m_KiCadLayer ) )
{
EDGE_MODULE* segment = new EDGE_MODULE( aModule, S_SEGMENT );
aModule->m_Drawings.PushBack( segment );
segment->m_Start0 = wxPoint( m_positionX, m_positionY );
segment->m_End0 = wxPoint( m_toX, m_toY );
segment->SetWidth( m_width );
segment->SetLayer( m_KiCadLayer );
segment->SetDrawCoord();
}
}
void PCB_LINE::AddToBoard()
{
if( IsValidCopperLayerIndex( m_KiCadLayer ) )
{
TRACK* track = new TRACK( m_board );
m_board->m_Track.Append( track );
track->SetTimeStamp( m_timestamp );
track->SetPosition( wxPoint( m_positionX, m_positionY ) );
track->SetEnd( wxPoint( m_toX, m_toY ) );
track->SetWidth( m_width );
track->SetLayer( m_KiCadLayer );
track->SetNet( m_netCode );
}
else
{
DRAWSEGMENT* dseg = new DRAWSEGMENT( m_board );
m_board->Add( dseg, ADD_APPEND );
dseg->SetTimeStamp( m_timestamp );
dseg->SetLayer( m_KiCadLayer );
dseg->SetStart( wxPoint( m_positionX, m_positionY ) );
dseg->SetEnd( wxPoint( m_toX, m_toY ) );
dseg->SetWidth( m_width );
}
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_line.h
*/
#ifndef PCB_LINE_H_
#define PCB_LINE_H_
#include <wx/wx.h>
#include <pcb_component.h>
namespace PCAD2KICAD {
// Line , routes and drawings
class PCB_LINE : public PCB_COMPONENT
{
public:
int m_width;
int m_toX;
int m_toY;
PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_LINE();
virtual void Parse( XNODE* aNode,
int aLayer,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void SetPosOffset( int aX_offs, int aY_offs );
void AddToModule( MODULE* aModule );
void AddToBoard();
};
} // namespace PCAD2KICAD
#endif // PCB_LINE_H_
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_module.h
*/
#ifndef PCB_MODULE_H_
#define PCB_MODULE_H_
#include <wx/wx.h>
#include <pcad2kicad_common.h>
#include <pcb_component.h>
namespace PCAD2KICAD {
class PCB_MODULE : public PCB_COMPONENT
{
public:
TTEXTVALUE m_value; // has reference (Name from parent) and value
PCB_COMPONENTS_ARRAY m_moduleObjects; // set of objects like PCB_LINE, PCB_PAD, PCB_VIA,....
int m_mirror;
VERTICES_ARRAY m_boardOutline;
PCB_MODULE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_MODULE();
XNODE* FindModulePatternDefName( XNODE* aNode, wxString aName );
void DoLayerContentsObjects( XNODE* aNode,
PCB_MODULE* aPCBModule,
PCB_COMPONENTS_ARRAY* aList,
wxStatusBar* aStatusBar,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
void SetPadName( wxString aPin, wxString aName );
virtual void Parse( XNODE* aNode, wxStatusBar* aStatusBar,
wxString aDefaultMeasurementUnit, wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType );
virtual void Flip();
void AddToBoard();
private:
XNODE* FindPatternMultilayerSection( XNODE* aNode, wxString* aPatGraphRefName );
wxString ModuleLayer( int aMirror );
int FlipLayers( int aLayer );
};
} // namespace PCAD2KICAD
#endif // PCB_MODULE_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_net.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <pcb_net.h>
namespace PCAD2KICAD {
PCB_NET_NODE::PCB_NET_NODE()
{
m_compRef = wxEmptyString;
m_pinRef = wxEmptyString;
}
PCB_NET_NODE::~PCB_NET_NODE()
{
}
PCB_NET::PCB_NET( int aNetCode ) : m_netCode( aNetCode )
{
m_name = wxEmptyString;
}
PCB_NET::~PCB_NET()
{
int i;
for( i = 0; i < (int) m_netNodes.GetCount(); i++ )
{
delete m_netNodes[i];
}
}
void PCB_NET::Parse( XNODE* aNode )
{
wxString propValue, s1, s2;
PCB_NET_NODE* netNode;
XNODE* lNode;
aNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_name = propValue;
lNode = FindNode( aNode, wxT( "node" ) );
while( lNode )
{
lNode->GetAttribute( wxT( "Name" ), &s2 );
s2.Trim( false );
s1 = wxEmptyString;
while( s2.Len() > 0 && s2[0] != wxT( ' ' ) )
{
s1 = s1 + s2[0];
s2 = s2.Mid( 1 );
}
netNode = new PCB_NET_NODE;
s1.Trim( false );
s1.Trim( true );
netNode->m_compRef = s1;
s2.Trim( false );
s2.Trim( true );
netNode->m_pinRef = s2;
m_netNodes.Add( netNode );
lNode = lNode->GetNext();
}
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_net.h
*/
#ifndef PCB_NET_H_
#define PCB_NET_H_
#include <wx/wx.h>
#include <pcad2kicad_common.h>
namespace PCAD2KICAD {
class PCB_NET_NODE : public wxObject
{
public:
wxString m_compRef;
wxString m_pinRef;
PCB_NET_NODE();
~PCB_NET_NODE();
};
WX_DEFINE_ARRAY( PCB_NET_NODE*, PCB_NET_NODES_ARRAY );
class PCB_NET : public wxObject
{
public:
wxString m_name;
int m_netCode;
PCB_NET_NODES_ARRAY m_netNodes;
PCB_NET( int aNetCode );
~PCB_NET();
void Parse( XNODE* aNode );
};
WX_DEFINE_ARRAY( PCB_NET*, PCB_NETS_ARRAY );
} // namespace PCAD2KICAD
#endif // PCB_NET_H_
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_pad.h
*/
#ifndef PCB_PAD_H_
#define PCB_PAD_H_
#include <wx/wx.h>
#include <pcb_component.h>
#include <pcb_pad_shape.h>
namespace PCAD2KICAD {
class PCB_PAD : public PCB_COMPONENT
{
public:
int m_number;
int m_hole;
bool m_isHolePlated;
PCB_PAD_SHAPES_ARRAY m_shapes;
PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_PAD();
virtual void Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
virtual void WriteToFile( wxFile* aFile, char aFileType, int aRotation );
void AddToModule( MODULE* aModule, int aRotation );
void AddToBoard();
};
} // namespace PCAD2KICAD
#endif // PCB_PAD_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_pad_shape.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <common.h>
#include <pcb_pad_shape.h>
namespace PCAD2KICAD {
PCB_PAD_SHAPE::PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks,
BOARD* aBoard ) : PCB_COMPONENT( aCallbacks, aBoard )
{
m_shape = wxEmptyString;
m_width = 0;
m_height = 0;
}
PCB_PAD_SHAPE::~PCB_PAD_SHAPE()
{
}
void PCB_PAD_SHAPE::Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion )
{
wxString str, s;
long num;
int minX, maxX, minY, maxY, x, y;
XNODE* lNode;
lNode = FindNode( aNode, wxT( "padShapeType" ) );
if( lNode )
{
str = lNode->GetNodeContent();
str.Trim( false );
m_shape = str;
}
lNode = FindNode( aNode, wxT( "layerNumRef" ) );
if( lNode )
{
lNode->GetNodeContent().ToLong( &num );
m_PCadLayer = (int) num;
}
m_KiCadLayer = GetKiCadLayer();
if( m_shape == wxT( "Oval" )
|| m_shape == wxT( "Rect" )
|| m_shape == wxT( "Ellipse" )
|| m_shape == wxT( "MtHole" )
|| m_shape == wxT( "RndRect" ) )
{
lNode = FindNode( aNode, wxT( "shapeWidth" ) );
if( lNode )
SetWidth( lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_width,
aActualConversion );
lNode = FindNode( aNode, wxT( "shapeHeight" ) );
if( lNode )
SetWidth(
lNode->GetNodeContent(), aDefaultMeasurementUnit, &m_height, aActualConversion );
}
else if( m_shape == wxT( "Polygon" ) )
{
// aproximation to simplier pad shape .....
lNode = FindNode( aNode, wxT( "shapeOutline" ) );
if( lNode )
lNode = FindNode( lNode, wxT( "pt" ) );
minX = 0;
maxX = 0;
minY = 0;
maxY = 0;
while( lNode )
{
s = lNode->GetNodeContent();
SetPosition( s, aDefaultMeasurementUnit, &x, &y, aActualConversion );
if( minX > x )
minX = x;
if( maxX < x )
maxX = x;
if( minY > y )
minY = y;
if( maxY < y )
maxY = y;
lNode = lNode->GetNext();
}
m_width = maxX - minX;
m_height = maxY - minY;
}
}
void PCB_PAD_SHAPE::AddToBoard()
{
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_pad_shape.h
*/
#ifndef PCB_PAD_SHAPE_H_
#define PCB_PAD_SHAPE_H_
#include <wx/wx.h>
#include <wx/dynarray.h>
#include <pcb_component.h>
namespace PCAD2KICAD {
class PCB_PAD_SHAPE : public PCB_COMPONENT
{
public:
wxString m_shape;
int m_width;
int m_height;
PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_PAD_SHAPE();
virtual void Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
void AddToBoard();
};
WX_DEFINE_ARRAY( PCB_PAD_SHAPE*, PCB_PAD_SHAPES_ARRAY );
} // namespace PCAD2KICAD
#endif // PCB_PAD_SHAPE_H_
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_plane.cpp
*/
#include <wx/wx.h>
#include <wx/config.h>
#include <common.h>
#include <pcb_plane.h>
namespace PCAD2KICAD {
PCB_PLANE::PCB_PLANE( PCB_CALLBACKS* aCallbacks,
BOARD* aBoard,
int aPCadLayer ) :
PCB_POLYGON( aCallbacks, aBoard, aPCadLayer )
{
m_priority = 1;
}
PCB_PLANE::~PCB_PLANE()
{
}
bool PCB_PLANE::Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion,
wxStatusBar* aStatusBar )
{
XNODE* lNode;
wxString pourType, str, propValue;
// aStatusBar->SetStatusText( aStatusBar->GetStatusText() + wxT( " Plane..." ) );
lNode = FindNode( aNode, wxT( "netNameRef" ) );
if( lNode )
{
lNode->GetAttribute( wxT( "Name" ), &propValue );
propValue.Trim( false );
propValue.Trim( true );
m_net = propValue;
m_netCode = GetNetCode( m_net );
}
if( FindNode( aNode, wxT( "width" ) ) )
SetWidth( FindNode( aNode, wxT( "width" ) )->GetNodeContent(),
aDefaultMeasurementUnit, &m_width, aActualConversion );
lNode = FindNode( aNode, wxT( "pcbPoly" ) );
if( lNode )
{
// retrieve plane outline
FormPolygon( lNode, &m_outline, aDefaultMeasurementUnit, aActualConversion );
m_positionX = m_outline[0]->x;
m_positionY = m_outline[0]->y;
}
else
{
return false;
}
return true;
}
} // namespace PCAD2KICAD
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_plane.h
*/
#ifndef PCB_PLANE_H_
#define PCB_PLANE_H_
#include <wx/wx.h>
#include <pcb_polygon.h>
namespace PCAD2KICAD {
class PCB_PLANE : public PCB_POLYGON
{
public:
PCB_PLANE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_PLANE();
virtual bool Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion,
wxStatusBar* aStatusBar );
};
} // namespace PCAD2KICAD
#endif // PCB_PLANE_H_
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007, 2008 Lubo Racko <developer@lura.sk>
* Copyright (C) 2007, 2008, 2012 Alexander Lunev <al.lunev@yahoo.com>
* Copyright (C) 2012 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
*/
/**
* @file pcb_via_shape.h
*/
#ifndef PCB_VIA_SHAPE_H_
#define PCB_VIA_SHAPE_H_
#include <wx/wx.h>
#include <pcb_pad_shape.h>
namespace PCAD2KICAD {
class PCB_VIA_SHAPE : public PCB_PAD_SHAPE
{
public:
PCB_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_VIA_SHAPE();
virtual void Parse( XNODE* aNode,
wxString aDefaultMeasurementUnit,
wxString aActualConversion );
};
} // namespace PCAD2KICAD
#endif // PCB_VIA_SHAPE_H_
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment