2019-03-11 21:32:05 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 CERN
|
2019-04-22 10:14:47 +00:00
|
|
|
* Copyright (C) 2019 KiCad Developers, see change_log.txt for contributors.
|
2019-03-11 21:32:05 +00:00
|
|
|
* @author Jon Evans <jon@craftyjon.com>
|
|
|
|
*
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _SCH_PIN_CONNECTION_H
|
|
|
|
#define _SCH_PIN_CONNECTION_H
|
|
|
|
|
2019-06-25 23:39:58 +00:00
|
|
|
#include <lib_pin.h>
|
|
|
|
#include <msgpanel.h>
|
2019-05-10 19:57:24 +00:00
|
|
|
#include <sch_item.h>
|
2019-03-11 21:32:05 +00:00
|
|
|
#include <sch_sheet_path.h>
|
|
|
|
|
2019-04-10 05:29:00 +00:00
|
|
|
#include <mutex>
|
|
|
|
#include <map>
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
class SCH_COMPONENT;
|
|
|
|
|
2019-04-03 09:14:36 +00:00
|
|
|
class SCH_PIN : public SCH_ITEM
|
2019-03-11 21:32:05 +00:00
|
|
|
{
|
2019-04-22 10:14:47 +00:00
|
|
|
LIB_PIN* m_libPin;
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2020-08-21 15:54:24 +00:00
|
|
|
wxString m_number;
|
|
|
|
wxString m_alt;
|
2019-04-03 09:14:36 +00:00
|
|
|
wxPoint m_position;
|
|
|
|
bool m_isDangling;
|
|
|
|
|
|
|
|
/// The name that this pin connection will drive onto a net
|
2020-08-15 01:41:11 +00:00
|
|
|
std::recursive_mutex m_netmap_mutex;
|
2019-04-03 09:14:36 +00:00
|
|
|
std::map<const SCH_SHEET_PATH, wxString> m_net_name_map;
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
public:
|
2019-04-03 09:14:36 +00:00
|
|
|
SCH_PIN( LIB_PIN* aLibPin, SCH_COMPONENT* aParentComponent );
|
|
|
|
|
|
|
|
SCH_PIN( const SCH_PIN& aPin );
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2019-04-22 10:14:47 +00:00
|
|
|
SCH_PIN& operator=( const SCH_PIN& aPin );
|
|
|
|
|
2019-08-29 14:59:36 +00:00
|
|
|
static inline bool ClassOf( const EDA_ITEM* aItem )
|
|
|
|
{
|
|
|
|
return aItem && SCH_PIN_T == aItem->Type();
|
|
|
|
}
|
|
|
|
|
2019-03-11 21:32:05 +00:00
|
|
|
wxString GetClass() const override
|
|
|
|
{
|
2019-04-03 09:14:36 +00:00
|
|
|
return wxT( "SCH_PIN" );
|
2019-03-11 21:32:05 +00:00
|
|
|
}
|
|
|
|
|
2019-04-22 10:14:47 +00:00
|
|
|
SCH_COMPONENT* GetParentComponent() const;
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2019-04-22 10:14:47 +00:00
|
|
|
LIB_PIN* GetLibPin() const { return m_libPin; }
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2020-08-13 21:30:30 +00:00
|
|
|
void ClearDefaultNetName( const SCH_SHEET_PATH* aPath );
|
2019-03-11 21:32:05 +00:00
|
|
|
wxString GetDefaultNetName( const SCH_SHEET_PATH aPath );
|
|
|
|
|
2020-08-21 15:54:24 +00:00
|
|
|
wxString GetAlt() const { return m_alt; }
|
|
|
|
void SetAlt( const wxString& aAlt ) { m_alt = aAlt; }
|
|
|
|
|
2019-12-20 14:11:39 +00:00
|
|
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override;
|
2020-04-24 13:36:10 +00:00
|
|
|
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) override;
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2020-04-14 12:25:00 +00:00
|
|
|
void Print( RENDER_SETTINGS* aSettings, const wxPoint& aOffset ) override {}
|
2019-03-11 21:32:05 +00:00
|
|
|
|
|
|
|
void Move( const wxPoint& aMoveVector ) override {}
|
|
|
|
|
|
|
|
void MirrorY( int aYaxis_position ) override {}
|
|
|
|
void MirrorX( int aXaxis_position ) override {}
|
|
|
|
|
|
|
|
void Rotate( wxPoint aPosition ) override {}
|
|
|
|
|
2020-05-27 14:01:07 +00:00
|
|
|
wxPoint GetPosition() const override { return GetTransformedPosition(); }
|
2020-04-24 13:36:10 +00:00
|
|
|
const wxPoint GetLocalPosition() const { return m_position; }
|
2019-04-03 09:14:36 +00:00
|
|
|
void SetPosition( const wxPoint& aPosition ) override { m_position = aPosition; }
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2019-04-22 10:14:47 +00:00
|
|
|
const EDA_RECT GetBoundingBox() const override;
|
2019-05-05 10:33:34 +00:00
|
|
|
bool HitTest( const wxPoint& aPosition, int aAccuracy = 0 ) const override;
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2019-04-22 10:14:47 +00:00
|
|
|
bool IsDangling() const override { return m_isDangling; }
|
2019-04-03 09:14:36 +00:00
|
|
|
void SetIsDangling( bool isDangling ) { m_isDangling = isDangling; }
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2019-04-04 02:40:14 +00:00
|
|
|
/// Returns the pin's position in global coordinates
|
|
|
|
wxPoint GetTransformedPosition() const;
|
|
|
|
|
2019-05-30 13:39:31 +00:00
|
|
|
bool Matches( wxFindReplaceData& aSearchData, void* aAuxData ) override;
|
2019-03-11 21:32:05 +00:00
|
|
|
|
2020-08-03 21:12:29 +00:00
|
|
|
bool Replace( wxFindReplaceData& aSearchData, void* aAuxData ) override;
|
|
|
|
|
2019-04-03 09:14:36 +00:00
|
|
|
/*
|
|
|
|
* While many of these are currently simply covers for the equivalent LIB_PIN methods,
|
|
|
|
* the new EESchema file format will soon allow us to override them at the SCH level.
|
|
|
|
*/
|
2019-04-22 10:14:47 +00:00
|
|
|
bool IsVisible() const { return m_libPin->IsVisible(); }
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2020-08-21 15:54:24 +00:00
|
|
|
wxString GetName() const;
|
|
|
|
|
|
|
|
wxString GetNumber() const
|
|
|
|
{
|
|
|
|
if( m_libPin )
|
|
|
|
return m_libPin->GetNumber();
|
|
|
|
else
|
|
|
|
return m_number;
|
|
|
|
}
|
|
|
|
void SetNumber( const wxString& aNumber ) { m_number = aNumber; }
|
|
|
|
|
|
|
|
ELECTRICAL_PINTYPE GetType() const;
|
|
|
|
|
|
|
|
GRAPHIC_PINSHAPE GetShape() const;
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2020-08-21 15:54:24 +00:00
|
|
|
int GetOrientation() const;
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2020-08-21 15:54:24 +00:00
|
|
|
int GetLength() const;
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2019-04-22 10:14:47 +00:00
|
|
|
bool IsPowerConnection() const { return m_libPin->IsPowerConnection(); }
|
2019-04-03 09:14:36 +00:00
|
|
|
|
2020-07-07 00:10:08 +00:00
|
|
|
bool ConnectionPropagatesTo( const EDA_ITEM* aItem ) const override;
|
|
|
|
|
2019-04-03 09:14:36 +00:00
|
|
|
|
|
|
|
#if defined(DEBUG)
|
|
|
|
void Show( int nestLevel, std::ostream& os ) const override {}
|
|
|
|
#endif
|
2019-03-11 21:32:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|