Commit 4ac27702 authored by Maciej Suminski's avatar Maciej Suminski

Code formatting.

parent 77d8b2d8
...@@ -67,13 +67,13 @@ DXF2BRD_CONVERTER::~DXF2BRD_CONVERTER() ...@@ -67,13 +67,13 @@ DXF2BRD_CONVERTER::~DXF2BRD_CONVERTER()
// coordinate conversions from dxf to internal units // coordinate conversions from dxf to internal units
int DXF2BRD_CONVERTER::mapX( double aDxfCoordX ) int DXF2BRD_CONVERTER::mapX( double aDxfCoordX )
{ {
return Millimeter2iu( m_xOffset + (aDxfCoordX * m_Dfx2mm) ); return Millimeter2iu( m_xOffset + ( aDxfCoordX * m_Dfx2mm ) );
} }
int DXF2BRD_CONVERTER::mapY( double aDxfCoordY ) int DXF2BRD_CONVERTER::mapY( double aDxfCoordY )
{ {
return Millimeter2iu( m_yOffset - (aDxfCoordY * m_Dfx2mm) ); return Millimeter2iu( m_yOffset - ( aDxfCoordY * m_Dfx2mm ) );
} }
...@@ -95,23 +95,22 @@ bool DXF2BRD_CONVERTER::ImportDxfFile( const wxString& aFile, BOARD* aBoard ) ...@@ -95,23 +95,22 @@ bool DXF2BRD_CONVERTER::ImportDxfFile( const wxString& aFile, BOARD* aBoard )
return success; return success;
} }
// Add aItem the the board
// this item is also added to the list of new items void DXF2BRD_CONVERTER::appendToBoard( BOARD_ITEM* aItem )
// (for undo command for instance)
void DXF2BRD_CONVERTER::appendToBoard( BOARD_ITEM * aItem )
{ {
m_brd->Add( aItem ); m_brd->Add( aItem );
m_newItemsList.push_back( aItem ); m_newItemsList.push_back( aItem );
} }
/* /*
* Implementation of the method which handles layers. * Implementation of the method which handles layers.
*/ */
void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& data ) void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& aData )
{ {
// Not yet useful in Pcbnew. // Not yet useful in Pcbnew.
#if 0 #if 0
wxString name = wxString::FromUTF8( data.name.c_str() ); wxString name = wxString::FromUTF8( aData.name.c_str() );
wxLogMessage( name ); wxLogMessage( name );
#endif #endif
} }
...@@ -120,25 +119,20 @@ void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& data ) ...@@ -120,25 +119,20 @@ void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& data )
/* /*
* Import line entities. * Import line entities.
*/ */
void DXF2BRD_CONVERTER::addLine( const DRW_Line& data ) void DXF2BRD_CONVERTER::addLine( const DRW_Line& aData )
{ {
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
wxPoint start( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
wxPoint start( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
segm->SetStart( start ); segm->SetStart( start );
wxPoint end( mapX( aData.secPoint.x ), mapY( aData.secPoint.y ) );
wxPoint end( mapX( data.secPoint.x ), mapY( data.secPoint.y ) );
segm->SetEnd( end ); segm->SetEnd( end );
segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness : data.thickness ) );
appendToBoard( segm ); appendToBoard( segm );
} }
void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data ) void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& aData )
{ {
// Currently, Pcbnew does not know polylines, for boards. // Currently, Pcbnew does not know polylines, for boards.
// So we have to convert a polyline to a set of segments. // So we have to convert a polyline to a set of segments.
...@@ -146,9 +140,9 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data ) ...@@ -146,9 +140,9 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data )
wxPoint startpoint; wxPoint startpoint;
for( unsigned ii = 0; ii < data.vertlist.size(); ii++ ) for( unsigned ii = 0; ii < aData.vertlist.size(); ii++ )
{ {
DRW_Vertex* vertex = data.vertlist[ii]; DRW_Vertex* vertex = aData.vertlist[ii];
if( ii == 0 ) if( ii == 0 )
{ {
...@@ -163,14 +157,14 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data ) ...@@ -163,14 +157,14 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& data )
segm->SetStart( startpoint ); segm->SetStart( startpoint );
wxPoint endpoint( mapX( vertex->basePoint.x ), mapY( vertex->basePoint.y ) ); wxPoint endpoint( mapX( vertex->basePoint.x ), mapY( vertex->basePoint.y ) );
segm->SetEnd( endpoint ); segm->SetEnd( endpoint );
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness
: data.thickness ) ); : aData.thickness ) );
appendToBoard( segm ); appendToBoard( segm );
startpoint = endpoint; startpoint = endpoint;
} }
} }
void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data ) void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& aData )
{ {
// Currently, Pcbnew does not know polylines, for boards. // Currently, Pcbnew does not know polylines, for boards.
// So we have to convert a polyline to a set of segments. // So we have to convert a polyline to a set of segments.
...@@ -179,9 +173,9 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data ) ...@@ -179,9 +173,9 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data )
// the variable width of each vertex (when exists) is not used. // the variable width of each vertex (when exists) is not used.
wxPoint startpoint; wxPoint startpoint;
for( unsigned ii = 0; ii < data.vertlist.size(); ii++ ) for( unsigned ii = 0; ii < aData.vertlist.size(); ii++ )
{ {
DRW_Vertex2D* vertex = data.vertlist[ii]; DRW_Vertex2D* vertex = aData.vertlist[ii];
if( ii == 0 ) if( ii == 0 )
{ {
...@@ -196,8 +190,8 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data ) ...@@ -196,8 +190,8 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data )
segm->SetStart( startpoint ); segm->SetStart( startpoint );
wxPoint endpoint( mapX( vertex->x ), mapY( vertex->y ) ); wxPoint endpoint( mapX( vertex->x ), mapY( vertex->y ) );
segm->SetEnd( endpoint ); segm->SetEnd( endpoint );
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness
: data.thickness ) ); : aData.thickness ) );
appendToBoard( segm ); appendToBoard( segm );
startpoint = endpoint; startpoint = endpoint;
} }
...@@ -206,19 +200,17 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data ) ...@@ -206,19 +200,17 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& data )
/* /*
* Import Circle entities. * Import Circle entities.
*/ */
void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& data ) void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& aData )
{ {
DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd ); DRAWSEGMENT* segm = new DRAWSEGMENT( m_brd );
segm->SetLayer( ToLAYER_ID( m_brdLayer ) ); segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
segm->SetShape( S_CIRCLE ); segm->SetShape( S_CIRCLE );
wxPoint center( mapX( data.basePoint.x ), mapY( data.basePoint.y ) ); wxPoint center( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
segm->SetCenter( center ); segm->SetCenter( center );
wxPoint circle_start( mapX( data.basePoint.x + data.radious ), wxPoint circle_start( mapX( aData.basePoint.x + aData.radious ), mapY( aData.basePoint.y ) );
mapY( data.basePoint.y ) );
segm->SetArcStart( circle_start ); segm->SetArcStart( circle_start );
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness segm->SetWidth( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
: data.thickness ) );
appendToBoard( segm ); appendToBoard( segm );
} }
...@@ -256,25 +248,24 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data ) ...@@ -256,25 +248,24 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
segm->SetAngle( angle ); segm->SetAngle( angle );
segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness segm->SetWidth( mapDim( data.thickness == 0 ? m_defaultThickness : data.thickness ) );
: data.thickness ) );
appendToBoard( segm ); appendToBoard( segm );
} }
/** /**
* Import texts (TEXT). * Import texts (TEXT).
*/ */
void DXF2BRD_CONVERTER::addText(const DRW_Text& data) void DXF2BRD_CONVERTER::addText( const DRW_Text& aData )
{ {
TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd ); TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd );
pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) ); pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) );
wxPoint refPoint( mapX(data.basePoint.x), mapY(data.basePoint.y) ); wxPoint refPoint( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
wxPoint secPoint( mapX(data.secPoint.x), mapY(data.secPoint.y) ); wxPoint secPoint( mapX( aData.secPoint.x ), mapY( aData.secPoint.y ) );
if (data.alignV !=0 || data.alignH !=0 ||data.alignH ==DRW_Text::HMiddle) if( aData.alignV != 0 || aData.alignH != 0 || aData.alignH == DRW_Text::HMiddle )
{ {
if (data.alignH !=DRW_Text::HAligned && data.alignH !=DRW_Text::HFit) if( aData.alignH != DRW_Text::HAligned && aData.alignH != DRW_Text::HFit )
{ {
wxPoint tmp = secPoint; wxPoint tmp = secPoint;
secPoint = refPoint; secPoint = refPoint;
...@@ -282,7 +273,7 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data) ...@@ -282,7 +273,7 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
} }
} }
switch( data.alignV ) switch( aData.alignV )
{ {
case DRW_Text::VBaseLine: case DRW_Text::VBaseLine:
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
...@@ -301,7 +292,7 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data) ...@@ -301,7 +292,7 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
break; break;
} }
switch( data.alignH ) switch( aData.alignH )
{ {
case DRW_Text::HLeft: case DRW_Text::HLeft:
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
...@@ -332,13 +323,13 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data) ...@@ -332,13 +323,13 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
} }
#if 0 #if 0
wxString sty = wxString::FromUTF8(data.style.c_str()); wxString sty = wxString::FromUTF8(aData.style.c_str());
sty=sty.ToLower(); sty=sty.ToLower();
if (data.textgen==2) if (aData.textgen==2)
{ {
// Text dir = left to right; // Text dir = left to right;
} else if (data.textgen==4) } else if (aData.textgen==4)
{ {
/ Text dir = top to bottom; / Text dir = top to bottom;
} else } else
...@@ -346,15 +337,14 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data) ...@@ -346,15 +337,14 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
} }
#endif #endif
wxString text = toNativeString( wxString::FromUTF8( data.text.c_str() ) ); wxString text = toNativeString( wxString::FromUTF8( aData.text.c_str() ) );
pcb_text->SetTextPosition( refPoint ); pcb_text->SetTextPosition( refPoint );
pcb_text->SetOrientation( data.angle * 10 ); pcb_text->SetOrientation( aData.angle * 10 );
// The 0.8 factor gives a better height/width ratio with our font // The 0.8 factor gives a better height/width ratio with our font
pcb_text->SetWidth( mapDim( data.height * 0.8 ) ); pcb_text->SetWidth( mapDim( aData.height * 0.8 ) );
pcb_text->SetHeight( mapDim( data.height ) ); pcb_text->SetHeight( mapDim( aData.height ) );
pcb_text->SetThickness( mapDim( data.thickness == 0 ? m_defaultThickness pcb_text->SetThickness( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
: data.thickness ) );
pcb_text->SetText( text ); pcb_text->SetText( text );
appendToBoard( pcb_text ); appendToBoard( pcb_text );
...@@ -364,9 +354,9 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data) ...@@ -364,9 +354,9 @@ void DXF2BRD_CONVERTER::addText(const DRW_Text& data)
/** /**
* Import multi line texts (MTEXT). * Import multi line texts (MTEXT).
*/ */
void DXF2BRD_CONVERTER::addMText( const DRW_MText& data ) void DXF2BRD_CONVERTER::addMText( const DRW_MText& aData )
{ {
wxString text = toNativeString( wxString::FromUTF8( data.text.c_str() ) ); wxString text = toNativeString( wxString::FromUTF8( aData.text.c_str() ) );
wxString attrib, tmp; wxString attrib, tmp;
/* Some texts start by '\' and have formating chars (font name, font option...) /* Some texts start by '\' and have formating chars (font name, font option...)
...@@ -396,23 +386,21 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data ) ...@@ -396,23 +386,21 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd ); TEXTE_PCB* pcb_text = new TEXTE_PCB( m_brd );
pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) ); pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) );
wxPoint textpos( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
wxPoint textpos( mapX( data.basePoint.x ), mapY( data.basePoint.y ) );
pcb_text->SetTextPosition( textpos ); pcb_text->SetTextPosition( textpos );
pcb_text->SetOrientation( data.angle * 10 ); pcb_text->SetOrientation( aData.angle * 10 );
// The 0.8 factor gives a better height/width ratio with our font // The 0.8 factor gives a better height/width ratio with our font
pcb_text->SetWidth( mapDim( data.height * 0.8 ) ); pcb_text->SetWidth( mapDim( aData.height * 0.8 ) );
pcb_text->SetHeight( mapDim( data.height ) ); pcb_text->SetHeight( mapDim( aData.height ) );
pcb_text->SetThickness( mapDim( data.thickness == 0 ? m_defaultThickness pcb_text->SetThickness( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
: data.thickness ) );
pcb_text->SetText( text ); pcb_text->SetText( text );
// Initialize text justifications: // Initialize text justifications:
if( data.textgen <= 3 ) if( aData.textgen <= 3 )
{ {
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_TOP ); pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
} }
else if( data.textgen <= 6 ) else if( aData.textgen <= 6 )
{ {
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER ); pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
} }
...@@ -421,11 +409,11 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data ) ...@@ -421,11 +409,11 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM ); pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
} }
if( data.textgen % 3 == 1 ) if( aData.textgen % 3 == 1 )
{ {
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT ); pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
} }
else if( data.textgen % 3 == 2 ) else if( aData.textgen % 3 == 2 )
{ {
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER ); pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
} }
...@@ -448,7 +436,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data ) ...@@ -448,7 +436,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& data )
// use ByStyle; // use ByStyle;
} }
if( data.alignV==1 ) if( aData.alignV==1 )
{ {
// use AtLeast; // use AtLeast;
} }
...@@ -490,24 +478,24 @@ void DXF2BRD_CONVERTER::addHeader( const DRW_Header* data ) ...@@ -490,24 +478,24 @@ void DXF2BRD_CONVERTER::addHeader( const DRW_Header* data )
* - %%%d for a degree sign * - %%%d for a degree sign
* - %%%p for a plus/minus sign * - %%%p for a plus/minus sign
*/ */
wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str ) wxString DXF2BRD_CONVERTER::toDxfString( const wxString& aStr )
{ {
wxString res; wxString res;
int j = 0; int j = 0;
for( unsigned i = 0; i<str.length(); ++i ) for( unsigned i = 0; i<aStr.length(); ++i )
{ {
int c = str[i]; int c = aStr[i];
if( c>175 || c<11 ) if( c > 175 || c < 11 )
{ {
res.append( str.Mid( j, i - j ) ); res.append( aStr.Mid( j, i - j ) );
j = i; j = i;
switch( c ) switch( c )
{ {
case 0x0A: case 0x0A:
res += wxT("\\P"); res += wxT( "\\P" );
break; break;
// diameter: // diameter:
...@@ -517,17 +505,17 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str ) ...@@ -517,17 +505,17 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str )
#else #else
case 0x2205: case 0x2205:
#endif #endif
res += wxT("%%C"); res += wxT( "%%C" );
break; break;
// degree: // degree:
case 0x00B0: case 0x00B0:
res += wxT("%%D"); res += wxT( "%%D" );
break; break;
// plus/minus // plus/minus
case 0x00B1: case 0x00B1:
res += wxT("%%P"); res += wxT( "%%P" );
break; break;
default: default:
...@@ -539,7 +527,7 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str ) ...@@ -539,7 +527,7 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str )
} }
} }
res.append( str.Mid( j ) ); res.append( aStr.Mid( j ) );
return res; return res;
} }
...@@ -547,26 +535,26 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str ) ...@@ -547,26 +535,26 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& str )
/** /**
* Converts a DXF encoded string into a native Unicode string. * Converts a DXF encoded string into a native Unicode string.
*/ */
wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data ) wxString DXF2BRD_CONVERTER::toNativeString( const wxString& aData )
{ {
wxString res; wxString res;
// Ignore font tags: // Ignore font tags:
int j = 0; int j = 0;
for( unsigned i = 0; i<data.length(); ++i ) for( unsigned i = 0; i < aData.length(); ++i )
{ {
if( data[ i ] == 0x7B ) // is '{' ? if( aData[ i ] == 0x7B ) // is '{' ?
{ {
if( data[ i + 1 ] == 0x5c && data[ i + 2 ] == 0x66 ) // is "\f" ? if( aData[ i + 1 ] == 0x5c && aData[ i + 2 ] == 0x66 ) // is "\f" ?
{ {
// found font tag, append parsed part // found font tag, append parsed part
res.append( data.Mid( j, i - j ) ); res.append( aData.Mid( j, i - j ) );
// skip to ';' // skip to ';'
for( unsigned k = i + 3; k < data.length(); ++k ) for( unsigned k = i + 3; k < aData.length(); ++k )
{ {
if( data[ k ] == 0x3B ) if( aData[ k ] == 0x3B )
{ {
i = j = ++k; i = j = ++k;
break; break;
...@@ -574,11 +562,11 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data ) ...@@ -574,11 +562,11 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data )
} }
// add to '}' // add to '}'
for( unsigned k = i; k<data.length(); ++k ) for( unsigned k = i; k < aData.length(); ++k )
{ {
if( data[ k ] == 0x7D ) if( aData[ k ] == 0x7D )
{ {
res.append( data.Mid( i, k - i ) ); res.append( aData.Mid( i, k - i ) );
i = j = ++k; i = j = ++k;
break; break;
} }
...@@ -587,7 +575,7 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data ) ...@@ -587,7 +575,7 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data )
} }
} }
res.append( data.Mid( j ) ); res.append( aData.Mid( j ) );
#if 1 #if 1
wxRegEx regexp; wxRegEx regexp;
...@@ -621,7 +609,7 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data ) ...@@ -621,7 +609,7 @@ wxString DXF2BRD_CONVERTER::toNativeString( const wxString& data )
} }
void DXF2BRD_CONVERTER::addTextStyle( const DRW_Textstyle& data ) void DXF2BRD_CONVERTER::addTextStyle( const DRW_Textstyle& aData )
{ {
// TODO // TODO
} }
...@@ -41,16 +41,15 @@ class BOARD_ITEM; ...@@ -41,16 +41,15 @@ class BOARD_ITEM;
class DXF2BRD_CONVERTER : public DRW_Interface class DXF2BRD_CONVERTER : public DRW_Interface
{ {
private: private:
std::vector<BOARD_ITEM*> m_newItemsList; // The list of new items added std::vector<BOARD_ITEM*> m_newItemsList; // The list of new items added to the board
// to the board BOARD* m_brd;
BOARD * m_brd;
double m_xOffset; // X coord offset for conversion (in mm) double m_xOffset; // X coord offset for conversion (in mm)
double m_yOffset; // Y coord offset for conversion (in mm) double m_yOffset; // Y coord offset for conversion (in mm)
double m_defaultThickness; // default line thickness for conversion (in mm) double m_defaultThickness; // default line thickness for conversion (in mm)
double m_Dfx2mm; // The scale factor to convert DXF units to mm double m_Dfx2mm; // The scale factor to convert DXF units to mm
// Seems DRW_Interface always converts DXF coordinates in mm // Seems DRW_Interface always converts DXF coordinates in mm
// (to be confirmed) // (to be confirmed)
int m_brdLayer; // The board layer to place imported dfx items int m_brdLayer; // The board layer to place imported dfx items
int m_version; // the dxf version, not used here int m_version; // the dxf version, not used here
std::string m_codePage; // The code page, not used here std::string m_codePage; // The code page, not used here
...@@ -85,7 +84,7 @@ public: ...@@ -85,7 +84,7 @@ public:
* @param aFile = the full filename. * @param aFile = the full filename.
* @param aBoard = where to store the graphical items and text * @param aBoard = where to store the graphical items and text
*/ */
bool ImportDxfFile( const wxString& aFile, BOARD * aBoard ); bool ImportDxfFile( const wxString& aFile, BOARD* aBoard );
/** /**
* @return the list of new BOARD_ITEM * @return the list of new BOARD_ITEM
...@@ -104,65 +103,65 @@ private: ...@@ -104,65 +103,65 @@ private:
// Add aItem the the board // Add aItem the the board
// this item is also added to the list of new items // this item is also added to the list of new items
// (for undo command for instance) // (for undo command for instance)
void appendToBoard( BOARD_ITEM * aItem ); void appendToBoard( BOARD_ITEM* aItem );
// Methods from DRW_CreationInterface: // Methods from DRW_CreationInterface:
// They are "call back" fonctions, called when the corresponding object // They are "call back" fonctions, called when the corresponding object
// is read in dxf file // is read in dxf file
// Depending of the application, they can do something or not // Depending of the application, they can do something or not
virtual void addHeader( const DRW_Header* data ); virtual void addHeader( const DRW_Header* aData );
virtual void addLType( const DRW_LType& data ){} virtual void addLType( const DRW_LType& aData ) {}
virtual void addLayer( const DRW_Layer& data ); virtual void addLayer( const DRW_Layer& aData );
virtual void addDimStyle( const DRW_Dimstyle& data ){} virtual void addDimStyle( const DRW_Dimstyle& aData ) {}
virtual void addBlock(const DRW_Block& data ){} virtual void addBlock( const DRW_Block& aData ) {}
virtual void endBlock(){} virtual void endBlock() {}
virtual void addPoint(const DRW_Point& data ){} virtual void addPoint( const DRW_Point& aData ) {}
virtual void addLine(const DRW_Line& data); virtual void addLine( const DRW_Line& aData);
virtual void addRay(const DRW_Ray& data ){} virtual void addRay( const DRW_Ray& aData ) {}
virtual void addXline(const DRW_Xline& data ){} virtual void addXline( const DRW_Xline& aData ) {}
virtual void addCircle(const DRW_Circle& data ); virtual void addCircle( const DRW_Circle& aData );
virtual void addArc(const DRW_Arc& data ); virtual void addArc( const DRW_Arc& aData );
virtual void addEllipse(const DRW_Ellipse& data ){} virtual void addEllipse( const DRW_Ellipse& aData ) {}
virtual void addLWPolyline(const DRW_LWPolyline& data ); virtual void addLWPolyline( const DRW_LWPolyline& aData );
virtual void addText(const DRW_Text& data ); virtual void addText( const DRW_Text& aData );
virtual void addPolyline(const DRW_Polyline& data ); virtual void addPolyline( const DRW_Polyline& aData );
virtual void addSpline(const DRW_Spline* data ){} virtual void addSpline( const DRW_Spline* aData ) {}
virtual void addKnot(const DRW_Entity&) {} virtual void addKnot( const DRW_Entity&) {}
virtual void addInsert(const DRW_Insert& data ){} virtual void addInsert( const DRW_Insert& aData ){}
virtual void addTrace(const DRW_Trace& data ){} virtual void addTrace( const DRW_Trace& aData ){}
virtual void addSolid(const DRW_Solid& data ){} virtual void addSolid( const DRW_Solid& aData ){}
virtual void addMText(const DRW_MText& data); virtual void addMText( const DRW_MText& aData);
virtual void addDimAlign(const DRW_DimAligned *data ){} virtual void addDimAlign( const DRW_DimAligned* aData ) {}
virtual void addDimLinear(const DRW_DimLinear *data ){} virtual void addDimLinear( const DRW_DimLinear* aData ) {}
virtual void addDimRadial(const DRW_DimRadial *data ){} virtual void addDimRadial( const DRW_DimRadial* aData ) {}
virtual void addDimDiametric(const DRW_DimDiametric *data ){} virtual void addDimDiametric( const DRW_DimDiametric* aData ) {}
virtual void addDimAngular(const DRW_DimAngular *data ){} virtual void addDimAngular( const DRW_DimAngular* aData ) {}
virtual void addDimAngular3P(const DRW_DimAngular3p *data ){} virtual void addDimAngular3P( const DRW_DimAngular3p* aData ) {}
virtual void addDimOrdinate(const DRW_DimOrdinate *data ){} virtual void addDimOrdinate( const DRW_DimOrdinate* aData ) {}
virtual void addLeader(const DRW_Leader *data ){} virtual void addLeader( const DRW_Leader* aData ) {}
virtual void addHatch(const DRW_Hatch* data ){} virtual void addHatch( const DRW_Hatch* aData ) {}
virtual void addImage(const DRW_Image* data ){} virtual void addImage( const DRW_Image* aData ) {}
virtual void linkImage(const DRW_ImageDef* data ){} virtual void linkImage( const DRW_ImageDef* aData ) {}
virtual void add3dFace(const DRW_3Dface& data ){} virtual void add3dFace( const DRW_3Dface& aData ) {}
virtual void addComment(const char*){} virtual void addComment( const char*) {}
virtual void addVport(const DRW_Vport& data) {} virtual void addVport( const DRW_Vport& aData ) {}
virtual void addTextStyle(const DRW_Textstyle& data); virtual void addTextStyle( const DRW_Textstyle& aData );
virtual void addViewport(const DRW_Viewport& data) {} virtual void addViewport( const DRW_Viewport& aData ) {}
virtual void setBlock(const int handle) {} virtual void setBlock( const int aHandle ) {}
static wxString toDxfString(const wxString& str); static wxString toDxfString( const wxString& aStr );
static wxString toNativeString(const wxString& data); static wxString toNativeString( const wxString& aData );
// These functions are not used in Kicad. // These functions are not used in Kicad.
// But because they are virtual pure in DRW_Interface, they should be defined // But because they are virtual pure in DRW_Interface, they should be defined
virtual void writeTextstyles() {} virtual void writeTextstyles() {}
virtual void writeVports() {} virtual void writeVports() {}
virtual void writeHeader(DRW_Header& data) {} virtual void writeHeader( DRW_Header& aData ) {}
virtual void writeEntities() {} virtual void writeEntities() {}
virtual void writeLTypes() {} virtual void writeLTypes() {}
virtual void writeLayers() {} virtual void writeLayers() {}
...@@ -172,7 +171,6 @@ private: ...@@ -172,7 +171,6 @@ private:
void writeLine(); void writeLine();
void writeMtext(); void writeMtext();
}; };
#endif // FILTERDXFRW_H #endif // FILTERDXFRW_H
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