Formatting.
This commit is contained in:
parent
ce21da8cbb
commit
1434988bf8
|
@ -2,7 +2,7 @@
|
||||||
* 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) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.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
|
||||||
|
@ -22,10 +22,6 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* @file sch_junction.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <sch_draw_panel.h>
|
#include <sch_draw_panel.h>
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
@ -38,7 +34,6 @@
|
||||||
#include <sch_connection.h>
|
#include <sch_connection.h>
|
||||||
#include <schematic.h>
|
#include <schematic.h>
|
||||||
#include <settings/color_settings.h>
|
#include <settings/color_settings.h>
|
||||||
#include <advanced_config.h>
|
|
||||||
#include <connection_graph.h>
|
#include <connection_graph.h>
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,14 +85,19 @@ SHAPE_CIRCLE SCH_JUNCTION::getEffectiveShape() const
|
||||||
else
|
else
|
||||||
m_lastResolvedDiameter = Mils2iu( DEFAULT_JUNCTION_DIAM );
|
m_lastResolvedDiameter = Mils2iu( DEFAULT_JUNCTION_DIAM );
|
||||||
|
|
||||||
if( m_lastResolvedDiameter != 1 ) // Diameter 1 means users doesn't want to draw junction dots
|
if( m_lastResolvedDiameter != 1 ) // Diameter 1 means user doesn't want to draw junctions
|
||||||
{
|
{
|
||||||
|
// If we know what we're connected to, then enforce a minimum size of 170% of the
|
||||||
|
// connected wire width:
|
||||||
if( !IsConnectivityDirty() )
|
if( !IsConnectivityDirty() )
|
||||||
{
|
{
|
||||||
NETCLASSPTR netclass = NetClass();
|
NETCLASSPTR netclass = NetClass();
|
||||||
|
|
||||||
if( netclass )
|
if( netclass )
|
||||||
m_lastResolvedDiameter = std::max( m_lastResolvedDiameter, KiROUND( netclass->GetWireWidth() * 1.7 ) );
|
{
|
||||||
|
m_lastResolvedDiameter = std::max( m_lastResolvedDiameter,
|
||||||
|
KiROUND( netclass->GetWireWidth() * 1.7 ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,11 +213,9 @@ bool SCH_JUNCTION::HitTest( const EDA_RECT& aRect, bool aContained, int aAccurac
|
||||||
|
|
||||||
if( aContained )
|
if( aContained )
|
||||||
{
|
{
|
||||||
EDA_RECT selRect = aRect;
|
EDA_RECT selRect( aRect );
|
||||||
|
|
||||||
selRect.Inflate( aAccuracy );
|
return selRect.Inflate( aAccuracy ).Contains( GetBoundingBox() );
|
||||||
|
|
||||||
return selRect.Contains( GetBoundingBox() );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -240,8 +238,8 @@ void SCH_JUNCTION::Plot( PLOTTER* aPlotter, bool aBackground ) const
|
||||||
if( aBackground )
|
if( aBackground )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto* settings = static_cast<KIGFX::SCH_RENDER_SETTINGS*>( aPlotter->RenderSettings() );
|
RENDER_SETTINGS* settings = aPlotter->RenderSettings();
|
||||||
COLOR4D color = GetJunctionColor();
|
COLOR4D color = GetJunctionColor();
|
||||||
|
|
||||||
if( color == COLOR4D::UNSPECIFIED )
|
if( color == COLOR4D::UNSPECIFIED )
|
||||||
color = settings->GetLayerColor( GetLayer() );
|
color = settings->GetLayerColor( GetLayer() );
|
||||||
|
@ -266,7 +264,7 @@ bool SCH_JUNCTION::operator <( const SCH_ITEM& aItem ) const
|
||||||
if( GetLayer() != aItem.GetLayer() )
|
if( GetLayer() != aItem.GetLayer() )
|
||||||
return GetLayer() < aItem.GetLayer();
|
return GetLayer() < aItem.GetLayer();
|
||||||
|
|
||||||
auto junction = static_cast<const SCH_JUNCTION*>( &aItem );
|
const SCH_JUNCTION* junction = static_cast<const SCH_JUNCTION*>( &aItem );
|
||||||
|
|
||||||
if( GetPosition().x != junction->GetPosition().x )
|
if( GetPosition().x != junction->GetPosition().x )
|
||||||
return GetPosition().x < junction->GetPosition().x;
|
return GetPosition().x < junction->GetPosition().x;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* 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) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||||
* Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.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
|
||||||
|
@ -22,8 +22,8 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SCH_JUNCTION_H_
|
#ifndef SCH_JUNCTION_H
|
||||||
#define _SCH_JUNCTION_H_
|
#define SCH_JUNCTION_H
|
||||||
|
|
||||||
|
|
||||||
#include <sch_item.h>
|
#include <sch_item.h>
|
||||||
|
@ -88,9 +88,8 @@ public:
|
||||||
|
|
||||||
bool CanConnect( const SCH_ITEM* aItem ) const override
|
bool CanConnect( const SCH_ITEM* aItem ) const override
|
||||||
{
|
{
|
||||||
return ( aItem->Type() == SCH_LINE_T &&
|
return aItem->IsConnectable() && ( aItem->Type() == SCH_LINE_T
|
||||||
( aItem->GetLayer() == LAYER_WIRE || aItem->GetLayer() == LAYER_BUS ) ) ||
|
|| aItem->Type() == SCH_SYMBOL_T );
|
||||||
aItem->Type() == SCH_SYMBOL_T;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
wxString GetSelectMenuText( EDA_UNITS aUnits ) const override
|
||||||
|
@ -133,16 +132,17 @@ private:
|
||||||
|
|
||||||
SHAPE_CIRCLE getEffectiveShape() const;
|
SHAPE_CIRCLE getEffectiveShape() const;
|
||||||
|
|
||||||
VECTOR2I m_pos; ///< Position of the junction.
|
private:
|
||||||
int m_diameter; ///< Diameter of the junction. Zero is user default.
|
VECTOR2I m_pos;
|
||||||
COLOR4D m_color; ///< Color of the junction. #COLOR4D::UNSPECIFIED is user default.
|
int m_diameter; ///< Zero is user default.
|
||||||
|
COLOR4D m_color; ///< #COLOR4D::UNSPECIFIED is user default.
|
||||||
|
|
||||||
// If real-time connectivity gets disabled (due to being too slow on a particular
|
// If real-time connectivity gets disabled (due to being too slow on a particular design),
|
||||||
// design), we can no longer rely on getting the NetClass to find netclass-specific
|
// we can no longer rely on getting the NetClass to find netclass-specific linestyles,
|
||||||
// linestyles, linewidths and colors.
|
// linewidths and colors.
|
||||||
mutable int m_lastResolvedDiameter;
|
mutable int m_lastResolvedDiameter;
|
||||||
mutable COLOR4D m_lastResolvedColor;
|
mutable COLOR4D m_lastResolvedColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif // _SCH_JUNCTION_H_
|
#endif // SCH_JUNCTION_H
|
||||||
|
|
Loading…
Reference in New Issue