Eeschema Eagle Import: Use bounding box for sheet position and size.
This commit is contained in:
parent
13abec84ef
commit
3919b79777
|
@ -512,16 +512,21 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode )
|
|||
plainNode = plainNode->GetNext();
|
||||
}
|
||||
|
||||
wxSize targetSheetSize( (sheetTopRight.x - sheetBottomLeft.x) * 1.5,
|
||||
-( sheetTopRight.y - sheetBottomLeft.y) * 1.5 );
|
||||
|
||||
|
||||
wxPoint itemsCentre( (sheetTopRight.x - sheetBottomLeft.x) / 2,
|
||||
(sheetTopRight.y - sheetBottomLeft.y) / 2 );
|
||||
|
||||
SCH_ITEM* item = m_currentSheet->GetScreen()->GetDrawItems();
|
||||
wxSize pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU();
|
||||
sheetBoundingBox = item->GetBoundingBox();
|
||||
item = item->Next();
|
||||
while( item )
|
||||
{
|
||||
sheetBoundingBox.Merge( item->GetBoundingBox() );
|
||||
item = item->Next();
|
||||
}
|
||||
|
||||
wxSize targetSheetSize = sheetBoundingBox.GetSize();
|
||||
targetSheetSize.IncBy(1500,1500);
|
||||
|
||||
wxPoint itemsCentre = sheetBoundingBox.Centre();
|
||||
|
||||
wxSize pageSizeIU = m_currentSheet->GetScreen()->GetPageSettings().GetSizeIU();
|
||||
PAGE_INFO pageInfo = m_currentSheet->GetScreen()->GetPageSettings();
|
||||
|
||||
if( pageSizeIU.x<targetSheetSize.x )
|
||||
|
@ -539,9 +544,11 @@ void SCH_EAGLE_PLUGIN::loadSheet( wxXmlNode* aSheetNode )
|
|||
wxPoint translation = sheetcentre- itemsCentre;
|
||||
translation.x = translation.x - translation.x%100;
|
||||
translation.y = translation.y - translation.y%100;
|
||||
|
||||
item = m_currentSheet->GetScreen()->GetDrawItems();
|
||||
while( item )
|
||||
{
|
||||
item->SetPosition( item->GetPosition() +translation);
|
||||
item->SetPosition( item->GetPosition()+translation );
|
||||
item = item->Next();
|
||||
}
|
||||
}
|
||||
|
@ -645,18 +652,6 @@ SCH_LINE* SCH_EAGLE_PLUGIN::loadSignalWire( wxXmlNode* aWireNode )
|
|||
wire->SetStartPoint( begin );
|
||||
wire->SetEndPoint( end );
|
||||
|
||||
if( begin.x > sheetTopRight.x) sheetTopRight.x = begin.x;
|
||||
if( begin.y < sheetTopRight.y) sheetTopRight.y = begin.y;
|
||||
|
||||
if( end.x > sheetTopRight.x) sheetTopRight.x = end.x;
|
||||
if( end.y < sheetTopRight.y) sheetTopRight.y = end.y;
|
||||
|
||||
if( begin.x < sheetBottomLeft.x) sheetBottomLeft.x = begin.x;
|
||||
if( begin.y > sheetBottomLeft.y) sheetBottomLeft.y = begin.y;
|
||||
|
||||
if( end.x < sheetBottomLeft.x) sheetBottomLeft.x = end.x;
|
||||
if( end.y > sheetBottomLeft.y) sheetBottomLeft.y = end.y;
|
||||
|
||||
return wire.release();
|
||||
}
|
||||
|
||||
|
@ -670,12 +665,6 @@ SCH_JUNCTION* SCH_EAGLE_PLUGIN::loadJunction( wxXmlNode* aJunction )
|
|||
|
||||
junction->SetPosition( pos );
|
||||
|
||||
if( pos.x > sheetTopRight.x) sheetTopRight.x = pos.x;
|
||||
if( pos.y < sheetTopRight.y) sheetTopRight.y = pos.y;
|
||||
|
||||
if( pos.x < sheetBottomLeft.x) sheetBottomLeft.x = pos.x;
|
||||
if( pos.y > sheetBottomLeft.y) sheetBottomLeft.y = pos.y;
|
||||
|
||||
return junction.release();
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ private:
|
|||
void loadInstance( wxXmlNode* aInstanceNode );
|
||||
void loadModuleinst( wxXmlNode* aModuleinstNode );
|
||||
EAGLE_LIBRARY* loadLibrary( wxXmlNode* aLibraryNode );
|
||||
void addBusEntries();
|
||||
|
||||
void loadSegments( wxXmlNode* aSegmentsNode, const wxString& aNetName,
|
||||
const wxString& aNetClass );
|
||||
|
@ -159,8 +160,7 @@ private:
|
|||
EPART_LIST m_partlist;
|
||||
std::map<std::string, EAGLE_LIBRARY*> m_eaglelibraries;
|
||||
|
||||
wxPoint sheetTopRight;
|
||||
wxPoint sheetBottomLeft;
|
||||
EDA_RECT sheetBoundingBox;
|
||||
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in New Issue