eeschema: add SCH_SHEET_PIN_T in ParentItems collector, convert sch_collectors.* to native unix format
This commit is contained in:
parent
90dbf5a94a
commit
9a51dc7593
|
@ -1,298 +1,299 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 2004-2011 Kicad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-2011 Kicad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, you may find one here:
|
* along with this program; if not, you may find one here:
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* 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 search the http://www.gnu.org website for the version 2 license,
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "general.h"
|
#include "general.h"
|
||||||
#include "transform.h"
|
#include "transform.h"
|
||||||
#include "sch_collectors.h"
|
#include "sch_collectors.h"
|
||||||
#include "sch_component.h"
|
#include "sch_component.h"
|
||||||
#include "sch_line.h"
|
#include "sch_line.h"
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::AllItems[] = {
|
const KICAD_T SCH_COLLECTOR::AllItems[] = {
|
||||||
SCH_MARKER_T,
|
SCH_MARKER_T,
|
||||||
SCH_JUNCTION_T,
|
SCH_JUNCTION_T,
|
||||||
SCH_NO_CONNECT_T,
|
SCH_NO_CONNECT_T,
|
||||||
SCH_BUS_ENTRY_T,
|
SCH_BUS_ENTRY_T,
|
||||||
SCH_LINE_T,
|
SCH_LINE_T,
|
||||||
SCH_POLYLINE_T,
|
SCH_POLYLINE_T,
|
||||||
SCH_TEXT_T,
|
SCH_TEXT_T,
|
||||||
SCH_LABEL_T,
|
SCH_LABEL_T,
|
||||||
SCH_GLOBAL_LABEL_T,
|
SCH_GLOBAL_LABEL_T,
|
||||||
SCH_HIERARCHICAL_LABEL_T,
|
SCH_HIERARCHICAL_LABEL_T,
|
||||||
SCH_FIELD_T,
|
SCH_FIELD_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
LIB_PIN_T,
|
LIB_PIN_T,
|
||||||
SCH_SHEET_PIN_T,
|
SCH_SHEET_PIN_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_T,
|
||||||
EOT
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::AllItemsButPins[] = {
|
const KICAD_T SCH_COLLECTOR::AllItemsButPins[] = {
|
||||||
SCH_MARKER_T,
|
SCH_MARKER_T,
|
||||||
SCH_JUNCTION_T,
|
SCH_JUNCTION_T,
|
||||||
SCH_NO_CONNECT_T,
|
SCH_NO_CONNECT_T,
|
||||||
SCH_BUS_ENTRY_T,
|
SCH_BUS_ENTRY_T,
|
||||||
SCH_LINE_T,
|
SCH_LINE_T,
|
||||||
SCH_POLYLINE_T,
|
SCH_POLYLINE_T,
|
||||||
SCH_TEXT_T,
|
SCH_TEXT_T,
|
||||||
SCH_LABEL_T,
|
SCH_LABEL_T,
|
||||||
SCH_GLOBAL_LABEL_T,
|
SCH_GLOBAL_LABEL_T,
|
||||||
SCH_HIERARCHICAL_LABEL_T,
|
SCH_HIERARCHICAL_LABEL_T,
|
||||||
SCH_FIELD_T,
|
SCH_FIELD_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
SCH_SHEET_PIN_T,
|
SCH_SHEET_PIN_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_T,
|
||||||
EOT
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::EditableItems[] = {
|
const KICAD_T SCH_COLLECTOR::EditableItems[] = {
|
||||||
SCH_TEXT_T,
|
SCH_TEXT_T,
|
||||||
SCH_LABEL_T,
|
SCH_LABEL_T,
|
||||||
SCH_GLOBAL_LABEL_T,
|
SCH_GLOBAL_LABEL_T,
|
||||||
SCH_HIERARCHICAL_LABEL_T,
|
SCH_HIERARCHICAL_LABEL_T,
|
||||||
SCH_FIELD_T,
|
SCH_FIELD_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
SCH_SHEET_PIN_T,
|
SCH_SHEET_PIN_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_T,
|
||||||
EOT
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::MovableItems[] = {
|
const KICAD_T SCH_COLLECTOR::MovableItems[] = {
|
||||||
SCH_MARKER_T,
|
SCH_MARKER_T,
|
||||||
// SCH_JUNCTION_T,
|
// SCH_JUNCTION_T,
|
||||||
SCH_NO_CONNECT_T,
|
SCH_NO_CONNECT_T,
|
||||||
SCH_BUS_ENTRY_T,
|
SCH_BUS_ENTRY_T,
|
||||||
// SCH_LINE_T,
|
// SCH_LINE_T,
|
||||||
SCH_POLYLINE_T,
|
SCH_POLYLINE_T,
|
||||||
SCH_TEXT_T,
|
SCH_TEXT_T,
|
||||||
SCH_LABEL_T,
|
SCH_LABEL_T,
|
||||||
SCH_GLOBAL_LABEL_T,
|
SCH_GLOBAL_LABEL_T,
|
||||||
SCH_HIERARCHICAL_LABEL_T,
|
SCH_HIERARCHICAL_LABEL_T,
|
||||||
SCH_FIELD_T,
|
SCH_FIELD_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
SCH_SHEET_PIN_T,
|
SCH_SHEET_PIN_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_T,
|
||||||
EOT
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::DraggableItems[] = {
|
const KICAD_T SCH_COLLECTOR::DraggableItems[] = {
|
||||||
SCH_JUNCTION_T,
|
SCH_JUNCTION_T,
|
||||||
SCH_BUS_ENTRY_T,
|
SCH_BUS_ENTRY_T,
|
||||||
SCH_LINE_T,
|
SCH_LINE_T,
|
||||||
SCH_POLYLINE_T,
|
SCH_POLYLINE_T,
|
||||||
SCH_GLOBAL_LABEL_T,
|
SCH_GLOBAL_LABEL_T,
|
||||||
SCH_HIERARCHICAL_LABEL_T,
|
SCH_HIERARCHICAL_LABEL_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_T,
|
||||||
EOT
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::RotatableItems[] = {
|
const KICAD_T SCH_COLLECTOR::RotatableItems[] = {
|
||||||
SCH_TEXT_T,
|
SCH_TEXT_T,
|
||||||
SCH_LABEL_T,
|
SCH_LABEL_T,
|
||||||
SCH_GLOBAL_LABEL_T,
|
SCH_GLOBAL_LABEL_T,
|
||||||
SCH_HIERARCHICAL_LABEL_T,
|
SCH_HIERARCHICAL_LABEL_T,
|
||||||
SCH_FIELD_T,
|
SCH_FIELD_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_T,
|
||||||
EOT
|
EOT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::ParentItems[] = {
|
const KICAD_T SCH_COLLECTOR::ParentItems[] = {
|
||||||
SCH_MARKER_T,
|
SCH_MARKER_T,
|
||||||
SCH_JUNCTION_T,
|
SCH_JUNCTION_T,
|
||||||
SCH_NO_CONNECT_T,
|
SCH_NO_CONNECT_T,
|
||||||
SCH_BUS_ENTRY_T,
|
SCH_BUS_ENTRY_T,
|
||||||
SCH_LINE_T,
|
SCH_LINE_T,
|
||||||
SCH_POLYLINE_T,
|
SCH_POLYLINE_T,
|
||||||
SCH_TEXT_T,
|
SCH_TEXT_T,
|
||||||
SCH_LABEL_T,
|
SCH_LABEL_T,
|
||||||
SCH_GLOBAL_LABEL_T,
|
SCH_GLOBAL_LABEL_T,
|
||||||
SCH_HIERARCHICAL_LABEL_T,
|
SCH_HIERARCHICAL_LABEL_T,
|
||||||
SCH_COMPONENT_T,
|
SCH_COMPONENT_T,
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_PIN_T,
|
||||||
EOT
|
SCH_SHEET_T,
|
||||||
};
|
EOT
|
||||||
|
};
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::ComponentsOnly[] = {
|
|
||||||
SCH_COMPONENT_T,
|
const KICAD_T SCH_COLLECTOR::ComponentsOnly[] = {
|
||||||
EOT
|
SCH_COMPONENT_T,
|
||||||
};
|
EOT
|
||||||
|
};
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::SheetsOnly[] = {
|
|
||||||
SCH_SHEET_T,
|
const KICAD_T SCH_COLLECTOR::SheetsOnly[] = {
|
||||||
EOT
|
SCH_SHEET_T,
|
||||||
};
|
EOT
|
||||||
|
};
|
||||||
|
|
||||||
const KICAD_T SCH_COLLECTOR::SheetsAndSheetLabels[] = {
|
|
||||||
SCH_SHEET_PIN_T,
|
const KICAD_T SCH_COLLECTOR::SheetsAndSheetLabels[] = {
|
||||||
SCH_SHEET_T,
|
SCH_SHEET_PIN_T,
|
||||||
EOT
|
SCH_SHEET_T,
|
||||||
};
|
EOT
|
||||||
|
};
|
||||||
|
|
||||||
SEARCH_RESULT SCH_COLLECTOR::Inspect( EDA_ITEM* aItem, const void* aTestData )
|
|
||||||
{
|
SEARCH_RESULT SCH_COLLECTOR::Inspect( EDA_ITEM* aItem, const void* aTestData )
|
||||||
if( aItem->Type() != LIB_PIN_T && !aItem->HitTest( m_RefPos ) )
|
{
|
||||||
return SEARCH_CONTINUE;
|
if( aItem->Type() != LIB_PIN_T && !aItem->HitTest( m_RefPos ) )
|
||||||
|
return SEARCH_CONTINUE;
|
||||||
// Pins have special hit testing requirements that are relative to their parent
|
|
||||||
// SCH_COMPONENT item.
|
// Pins have special hit testing requirements that are relative to their parent
|
||||||
if( aItem->Type() == LIB_PIN_T )
|
// SCH_COMPONENT item.
|
||||||
{
|
if( aItem->Type() == LIB_PIN_T )
|
||||||
wxCHECK_MSG( aTestData && ( (EDA_ITEM*) aTestData )->Type() == SCH_COMPONENT_T,
|
{
|
||||||
SEARCH_CONTINUE, wxT( "Cannot inspect invalid data. Bad programmer!" ) );
|
wxCHECK_MSG( aTestData && ( (EDA_ITEM*) aTestData )->Type() == SCH_COMPONENT_T,
|
||||||
|
SEARCH_CONTINUE, wxT( "Cannot inspect invalid data. Bad programmer!" ) );
|
||||||
// Pin hit testing is relative to the components position and orientation in the
|
|
||||||
// schematic. The hit test position must be converted to library coordinates.
|
// Pin hit testing is relative to the components position and orientation in the
|
||||||
SCH_COMPONENT* component = (SCH_COMPONENT*) aTestData;
|
// schematic. The hit test position must be converted to library coordinates.
|
||||||
TRANSFORM transform = component->GetTransform().InverseTransform();
|
SCH_COMPONENT* component = (SCH_COMPONENT*) aTestData;
|
||||||
wxPoint position = transform.TransformCoordinate( m_RefPos - component->m_Pos );
|
TRANSFORM transform = component->GetTransform().InverseTransform();
|
||||||
|
wxPoint position = transform.TransformCoordinate( m_RefPos - component->m_Pos );
|
||||||
position.y *= -1; // Y axis polarity in schematic is inverted from library.
|
|
||||||
|
position.y *= -1; // Y axis polarity in schematic is inverted from library.
|
||||||
if( !aItem->HitTest( position ) )
|
|
||||||
return SEARCH_CONTINUE;
|
if( !aItem->HitTest( position ) )
|
||||||
}
|
return SEARCH_CONTINUE;
|
||||||
|
}
|
||||||
Append( aItem );
|
|
||||||
|
Append( aItem );
|
||||||
return SEARCH_CONTINUE;
|
|
||||||
}
|
return SEARCH_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
void SCH_COLLECTOR::Collect( SCH_ITEM* aItem, const KICAD_T aFilterList[],
|
|
||||||
const wxPoint& aPosition )
|
void SCH_COLLECTOR::Collect( SCH_ITEM* aItem, const KICAD_T aFilterList[],
|
||||||
{
|
const wxPoint& aPosition )
|
||||||
Empty(); // empty the collection just in case
|
{
|
||||||
|
Empty(); // empty the collection just in case
|
||||||
SetScanTypes( aFilterList );
|
|
||||||
|
SetScanTypes( aFilterList );
|
||||||
// remember where the snapshot was taken from and pass refPos to the Inspect() function.
|
|
||||||
SetRefPos( aPosition );
|
// remember where the snapshot was taken from and pass refPos to the Inspect() function.
|
||||||
|
SetRefPos( aPosition );
|
||||||
EDA_ITEM::IterateForward( aItem, this, NULL, m_ScanTypes );
|
|
||||||
}
|
EDA_ITEM::IterateForward( aItem, this, NULL, m_ScanTypes );
|
||||||
|
}
|
||||||
|
|
||||||
bool SCH_COLLECTOR::IsCorner() const
|
|
||||||
{
|
bool SCH_COLLECTOR::IsCorner() const
|
||||||
if( GetCount() != 2 )
|
{
|
||||||
return false;
|
if( GetCount() != 2 )
|
||||||
|
return false;
|
||||||
if( (m_List[0]->Type() == SCH_LINE_T) && (m_List[1]->Type() == SCH_LINE_T) )
|
|
||||||
return true;
|
if( (m_List[0]->Type() == SCH_LINE_T) && (m_List[1]->Type() == SCH_LINE_T) )
|
||||||
|
return true;
|
||||||
if( (m_List[0]->Type() == SCH_LINE_T) && (m_List[1]->Type() == SCH_BUS_ENTRY_T) )
|
|
||||||
return true;
|
if( (m_List[0]->Type() == SCH_LINE_T) && (m_List[1]->Type() == SCH_BUS_ENTRY_T) )
|
||||||
|
return true;
|
||||||
if( (m_List[0]->Type() == SCH_BUS_ENTRY_T) && (m_List[1]->Type() == SCH_LINE_T) )
|
|
||||||
return true;
|
if( (m_List[0]->Type() == SCH_BUS_ENTRY_T) && (m_List[1]->Type() == SCH_LINE_T) )
|
||||||
|
return true;
|
||||||
return false;
|
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool SCH_COLLECTOR::IsNode( bool aIncludePins ) const
|
|
||||||
{
|
bool SCH_COLLECTOR::IsNode( bool aIncludePins ) const
|
||||||
for( size_t i = 0; i < m_List.size(); i++ )
|
{
|
||||||
{
|
for( size_t i = 0; i < m_List.size(); i++ )
|
||||||
SCH_ITEM* item = (SCH_ITEM*) m_List[ i ];
|
{
|
||||||
KICAD_T type = item->Type();
|
SCH_ITEM* item = (SCH_ITEM*) m_List[ i ];
|
||||||
|
KICAD_T type = item->Type();
|
||||||
if( type == SCH_JUNCTION_T )
|
|
||||||
continue;
|
if( type == SCH_JUNCTION_T )
|
||||||
|
continue;
|
||||||
if( type == SCH_LINE_T )
|
|
||||||
{
|
if( type == SCH_LINE_T )
|
||||||
if( item->GetLayer() != LAYER_WIRE )
|
{
|
||||||
return false;
|
if( item->GetLayer() != LAYER_WIRE )
|
||||||
|
return false;
|
||||||
continue;
|
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
if( type == LIB_PIN_T )
|
|
||||||
{
|
if( type == LIB_PIN_T )
|
||||||
if( !aIncludePins )
|
{
|
||||||
return false;
|
if( !aIncludePins )
|
||||||
|
return false;
|
||||||
continue;
|
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
// Any other item types indicate that this collection is not a node.
|
|
||||||
return false;
|
// Any other item types indicate that this collection is not a node.
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
return true;
|
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool SCH_COLLECTOR::IsDraggableJunction() const
|
|
||||||
{
|
bool SCH_COLLECTOR::IsDraggableJunction() const
|
||||||
int wireEndCount = 0;
|
{
|
||||||
int wireMidPoint = 0;
|
int wireEndCount = 0;
|
||||||
int junctionCount = 0;
|
int wireMidPoint = 0;
|
||||||
|
int junctionCount = 0;
|
||||||
for( size_t i = 0; i < m_List.size(); i++ )
|
|
||||||
{
|
for( size_t i = 0; i < m_List.size(); i++ )
|
||||||
SCH_ITEM* item = (SCH_ITEM*) m_List[ i ];
|
{
|
||||||
KICAD_T type = item->Type();
|
SCH_ITEM* item = (SCH_ITEM*) m_List[ i ];
|
||||||
|
KICAD_T type = item->Type();
|
||||||
if( type == SCH_JUNCTION_T )
|
|
||||||
{
|
if( type == SCH_JUNCTION_T )
|
||||||
junctionCount++;
|
{
|
||||||
continue;
|
junctionCount++;
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
if( type == SCH_LINE_T )
|
|
||||||
{
|
if( type == SCH_LINE_T )
|
||||||
if( item->GetLayer() != LAYER_WIRE )
|
{
|
||||||
return false;
|
if( item->GetLayer() != LAYER_WIRE )
|
||||||
|
return false;
|
||||||
SCH_LINE* line = (SCH_LINE*) item;
|
|
||||||
|
SCH_LINE* line = (SCH_LINE*) item;
|
||||||
if( line->IsEndPoint( m_RefPos ) )
|
|
||||||
wireEndCount++;
|
if( line->IsEndPoint( m_RefPos ) )
|
||||||
else
|
wireEndCount++;
|
||||||
wireMidPoint++;
|
else
|
||||||
|
wireMidPoint++;
|
||||||
continue;
|
|
||||||
}
|
continue;
|
||||||
|
}
|
||||||
// Any other item types indicate that this collection is not a draggable junction.
|
|
||||||
return false;
|
// Any other item types indicate that this collection is not a draggable junction.
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
return (wireEndCount >= 3) || ((wireEndCount >= 1) && (wireMidPoint == 1))
|
|
||||||
|| ((wireMidPoint >= 2) && (junctionCount == 1));
|
return (wireEndCount >= 3) || ((wireEndCount >= 1) && (wireMidPoint == 1))
|
||||||
}
|
|| ((wireMidPoint >= 2) && (junctionCount == 1));
|
||||||
|
}
|
||||||
|
|
|
@ -1,169 +1,169 @@
|
||||||
/*
|
/*
|
||||||
* This program source code file is part of KICAD, a free EDA CAD application.
|
* This program source code file is part of KICAD, a free EDA CAD application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 2004-20011 Kicad Developers, see change_log.txt for contributors.
|
* Copyright (C) 2004-20011 Kicad Developers, see change_log.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
* as published by the Free Software Foundation; either version 2
|
* as published by the Free Software Foundation; either version 2
|
||||||
* of the License, or (at your option) any later version.
|
* of the License, or (at your option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, you may find one here:
|
* along with this program; if not, you may find one here:
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
* 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 search the http://www.gnu.org website for the version 2 license,
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCH_COLLECTORS_H_
|
#ifndef _SCH_COLLECTORS_H_
|
||||||
#define _SCH_COLLECTORS_H_
|
#define _SCH_COLLECTORS_H_
|
||||||
|
|
||||||
|
|
||||||
#include "class_collector.h"
|
#include "class_collector.h"
|
||||||
#include "sch_item_struct.h"
|
#include "sch_item_struct.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class SCH_COLLECTOR
|
* Class SCH_COLLECTOR
|
||||||
*/
|
*/
|
||||||
class SCH_COLLECTOR : public COLLECTOR
|
class SCH_COLLECTOR : public COLLECTOR
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for all schematic items.
|
* A scan list for all schematic items.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T AllItems[];
|
static const KICAD_T AllItems[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for all editable schematic items.
|
* A scan list for all editable schematic items.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T EditableItems[];
|
static const KICAD_T EditableItems[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for all movable schematic items.
|
* A scan list for all movable schematic items.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T MovableItems[];
|
static const KICAD_T MovableItems[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for all draggable schematic items.
|
* A scan list for all draggable schematic items.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T DraggableItems[];
|
static const KICAD_T DraggableItems[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for all rotatable schematic items.
|
* A scan list for all rotatable schematic items.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T RotatableItems[];
|
static const KICAD_T RotatableItems[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for only parent schematic items.
|
* A scan list for only parent schematic items.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T ParentItems[];
|
static const KICAD_T ParentItems[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for all schematic items except pins.
|
* A scan list for all schematic items except pins.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T AllItemsButPins[];
|
static const KICAD_T AllItemsButPins[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for schematic component items only.
|
* A scan list for schematic component items only.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T ComponentsOnly[];
|
static const KICAD_T ComponentsOnly[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for schematic sheet items only.
|
* A scan list for schematic sheet items only.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T SheetsOnly[];
|
static const KICAD_T SheetsOnly[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A scan list for schematic sheet and sheet label items.
|
* A scan list for schematic sheet and sheet label items.
|
||||||
*/
|
*/
|
||||||
static const KICAD_T SheetsAndSheetLabels[];
|
static const KICAD_T SheetsAndSheetLabels[];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor SCH_COLLECTOR
|
* Constructor SCH_COLLECTOR
|
||||||
*/
|
*/
|
||||||
SCH_COLLECTOR( const KICAD_T* aScanTypes = SCH_COLLECTOR::AllItems )
|
SCH_COLLECTOR( const KICAD_T* aScanTypes = SCH_COLLECTOR::AllItems )
|
||||||
{
|
{
|
||||||
SetScanTypes( aScanTypes );
|
SetScanTypes( aScanTypes );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Operator []
|
* Operator []
|
||||||
* overloads COLLECTOR::operator[](int) to return a SCH_ITEM* instead of
|
* overloads COLLECTOR::operator[](int) to return a SCH_ITEM* instead of
|
||||||
* an EDA_ITEM* type.
|
* an EDA_ITEM* type.
|
||||||
* @param aIndex The index into the list.
|
* @param aIndex The index into the list.
|
||||||
* @return SCH_ITEM* at \a aIndex or NULL.
|
* @return SCH_ITEM* at \a aIndex or NULL.
|
||||||
*/
|
*/
|
||||||
SCH_ITEM* operator[]( int aIndex ) const
|
SCH_ITEM* operator[]( int aIndex ) const
|
||||||
{
|
{
|
||||||
if( (unsigned)aIndex < (unsigned)GetCount() )
|
if( (unsigned)aIndex < (unsigned)GetCount() )
|
||||||
return (SCH_ITEM*) m_List[ aIndex ];
|
return (SCH_ITEM*) m_List[ aIndex ];
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Inspect
|
* Function Inspect
|
||||||
* is the examining function within the INSPECTOR which is passed to the
|
* is the examining function within the INSPECTOR which is passed to the
|
||||||
* Iterate function.
|
* Iterate function.
|
||||||
*
|
*
|
||||||
* @param aItem An EDA_ITEM to examine.
|
* @param aItem An EDA_ITEM to examine.
|
||||||
* @param aTestData is not used in this class.
|
* @param aTestData is not used in this class.
|
||||||
* @return SEARCH_RESULT #SEARCH_QUIT if the iterator is to stop the scan,
|
* @return SEARCH_RESULT #SEARCH_QUIT if the iterator is to stop the scan,
|
||||||
* else #SEARCH_CONTINUE;
|
* else #SEARCH_CONTINUE;
|
||||||
*/
|
*/
|
||||||
SEARCH_RESULT Inspect( EDA_ITEM* aItem, const void* aTestData = NULL );
|
SEARCH_RESULT Inspect( EDA_ITEM* aItem, const void* aTestData = NULL );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Collect
|
* Function Collect
|
||||||
* scans a SCH_ITEM using this class's Inspector method, which does the collection.
|
* scans a SCH_ITEM using this class's Inspector method, which does the collection.
|
||||||
* @param aItem A SCH_ITEM to scan.
|
* @param aItem A SCH_ITEM to scan.
|
||||||
* @param aFilterList A list of #KICAD_T types with a terminating #EOT, that determines
|
* @param aFilterList A list of #KICAD_T types with a terminating #EOT, that determines
|
||||||
* what is to be collected and the priority order of the resulting
|
* what is to be collected and the priority order of the resulting
|
||||||
* collection.
|
* collection.
|
||||||
* @param aPosition A wxPoint to use in hit-testing.
|
* @param aPosition A wxPoint to use in hit-testing.
|
||||||
*/
|
*/
|
||||||
void Collect( SCH_ITEM* aItem, const KICAD_T aFilterList[], const wxPoint& aPosition );
|
void Collect( SCH_ITEM* aItem, const KICAD_T aFilterList[], const wxPoint& aPosition );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsCorner
|
* Function IsCorner
|
||||||
* tests if the collected items forms as corner of two line segments.
|
* tests if the collected items forms as corner of two line segments.
|
||||||
* @return True if the collected items form a corner of two line segments.
|
* @return True if the collected items form a corner of two line segments.
|
||||||
*/
|
*/
|
||||||
bool IsCorner() const;
|
bool IsCorner() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsNode
|
* Function IsNode
|
||||||
* tests if the collected items form a node.
|
* tests if the collected items form a node.
|
||||||
*
|
*
|
||||||
* @param aIncludePins Indicate if component pin items should be included in the test.
|
* @param aIncludePins Indicate if component pin items should be included in the test.
|
||||||
* @return True if the collected items form a node.
|
* @return True if the collected items form a node.
|
||||||
*/
|
*/
|
||||||
bool IsNode( bool aIncludePins = true ) const;
|
bool IsNode( bool aIncludePins = true ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsDraggableJunction
|
* Function IsDraggableJunction
|
||||||
* tests to see if the collected items form a draggable junction.
|
* tests to see if the collected items form a draggable junction.
|
||||||
* <p>
|
* <p>
|
||||||
* Daggable juntions are defined as:
|
* Daggable juntions are defined as:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> The intersection of three or more wire end points. </li>
|
* <li> The intersection of three or more wire end points. </li>
|
||||||
* <li> The intersection of one or more wire end point and one wire mid point. </li>
|
* <li> The intersection of one or more wire end point and one wire mid point. </li>
|
||||||
* <li> The crossing of two or more wire mid points and a junction. </li>
|
* <li> The crossing of two or more wire mid points and a junction. </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* </p>
|
* </p>
|
||||||
* @return True if the collection is a draggable junction.
|
* @return True if the collection is a draggable junction.
|
||||||
*/
|
*/
|
||||||
bool IsDraggableJunction() const;
|
bool IsDraggableJunction() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _SCH_COLLECTORS_H_
|
#endif // _SCH_COLLECTORS_H_
|
||||||
|
|
Loading…
Reference in New Issue