Eeschema Eagle Import: Shift convertTextSize to common eagle parser.

This commit is contained in:
Russell Oliver 2017-08-25 02:42:42 +10:00 committed by Maciej Suminski
parent 433aa653fe
commit a8fa64f158
4 changed files with 29 additions and 30 deletions

View File

@ -237,6 +237,30 @@ int parseAlignment(wxString alignment)
return DEFAULT_ALIGNMENT;
}
// convert textsize method.
wxSize convertTextSize(ETEXT& etext ) {
wxSize textsize;
if(etext.font){
wxString font = etext.font.Get();
if(font == "vector")
{
textsize = wxSize( etext.size * EUNIT_TO_MIL, etext.size * EUNIT_TO_MIL );
}
else if ( font == "fixed")
{
textsize = wxSize( etext.size * EUNIT_TO_MIL, etext.size * EUNIT_TO_MIL*0.80 );
}
}
else
{
textsize = wxSize( etext.size * EUNIT_TO_MIL*0.85, etext.size * EUNIT_TO_MIL );
}
return textsize;
}
EWIRE::EWIRE( wxXmlNode* aWire )
{

View File

@ -53,9 +53,6 @@
using std::string;
// Eagle schematic internal units are millimeters
// Kicad schematic units are thousandths of an inch
constexpr double EUNIT_TO_MIL = 1000.0 / 25.4;
// Eagle schematic axes are aligned with x increasing left to right and Y increasing bottom to top
// Kicad schematic axes are aligned with x increasing left to rigth and Y increasing top to bottom.
@ -1815,32 +1812,6 @@ LIB_TEXT* SCH_EAGLE_PLUGIN::loadSymboltext( std::unique_ptr< LIB_PART >& aPart,
return libtext.release();
}
// convert text method.
wxSize SCH_EAGLE_PLUGIN::convertTextSize(ETEXT& etext ) {
wxSize textsize;
if(etext.font){
wxString font = etext.font.Get();
if(font == "vector")
{
textsize = wxSize( etext.size * EUNIT_TO_MIL, etext.size * EUNIT_TO_MIL );
}
else if ( font == "fixed")
{
textsize = wxSize( etext.size * EUNIT_TO_MIL, etext.size * EUNIT_TO_MIL*0.80 );
}
}
else
{
textsize = wxSize( etext.size * EUNIT_TO_MIL*0.85, etext.size * EUNIT_TO_MIL );
}
return textsize;
}
SCH_TEXT* SCH_EAGLE_PLUGIN::loadplaintext( wxXmlNode* aSchText )
{
std::unique_ptr<SCH_TEXT> schtext( new SCH_TEXT() );

View File

@ -142,7 +142,6 @@ private:
void moveLabels( SCH_ITEM* wire, wxPoint newendpoint);
void addBusEntries();
static wxString fixNetName( const wxString& aNetName );
static wxSize convertTextSize(ETEXT& etext );
SCH_LAYER_ID kicadLayer( int aEagleLayer );
wxPoint findNearestLinePoint(wxPoint aPoint, const DLIST< SCH_LINE >& lines);

View File

@ -41,6 +41,9 @@
#include <trigo.h>
#include <kicad_string.h>
// Eagle schematic internal units are millimeters
// Kicad schematic units are thousandths of an inch
constexpr double EUNIT_TO_MIL = 1000.0 / 25.4;
using std::string;
@ -607,6 +610,8 @@ struct ETEXT
ETEXT( wxXmlNode* aText );
};
/// Calculate text size based on font type and size;
wxSize convertTextSize(ETEXT& etext );
/// Eagle thru hol pad
struct EPAD