79 const BOX2D& aViewport,
bool aCurved )
85 if( aSource == aTarget )
91 bounds.
Merge( target );
115 std::unique_lock<KISPINLOCK> lock(
m_data->GetLock(), std::try_to_lock );
143 std::set<int> highlightedNets = rs->GetHighlightNetCodes();
144 const std::set<int>& hiddenNets = rs->GetHiddenNets();
149 const bool dimStatic =
m_data->GetLocalRatsnest().size() > 0 || highlightedNets.size() > 0;
151 std::map<int, KIGFX::COLOR4D>& netColors = rs->GetNetColorMap();
160 visibleLayers.
set( rs->GetPrimaryHighContrastLayer() );
168 visibleLayers.
set( layer );
173 [&](
COLOR4D& color_base,
double brightnessDelta,
double alpha )
178 return color_base.
Darkened( brightnessDelta ).
WithAlpha( std::min( alpha, 1.0 ) );
195 if( widthFilter > 0.0 )
198 return (
VECTOR2D( aTarget ) -
VECTOR2D( aSource ) ).EuclideanNorm() / 512.0;
208 static const std::vector<RN_DYNAMIC_LINE> noLines;
213 if( hiddenNets.count( l.netCode ) )
222 if(
m_data->HasNetNameForNetCode( l.netCode ) )
224 const wxString& netName =
m_data->GetNetNameForNetCode( l.netCode );
230 if( colorByNet && netColors.count( l.netCode ) )
231 color = netColors.at( l.netCode );
235 color = defaultColor;
238 color = defaultColor;
262 for(
int i = 1 ; i < netCount; ++i )
264 if( hiddenNets.count( i ) )
269 if( !net ||
m_data->GetConnectivityAlgo()->IsNetDirty( i ) )
275 if(
m_data->HasNetNameForNetCode( i ) )
277 const wxString& netName =
m_data->GetNetNameForNetCode( i );
283 if( colorByNet && netColors.count( i ) )
284 color = netColors.at( i );
288 color = defaultColor;
291 color = defaultColor;
294 color = adjustColor( color, 0.0, color.
a / 2 );
297 if( highlightedNets.count( i ) )
306 if( !edge.IsVisible() )
309 const std::shared_ptr<const CN_ANCHOR>& sourceNode = edge.GetSourceNode();
310 const std::shared_ptr<const CN_ANCHOR>& targetNode = edge.GetTargetNode();
312 if( !sourceNode || sourceNode->Dirty() || !targetNode || targetNode->Dirty() )
316 const VECTOR2I target( targetNode->Pos() );
321 bool enable = !sourceNode->GetNoLine() && !targetNode->GetNoLine();
330 show = sourceNode->Parent()->GetLocalRatsnestVisible() &&
331 targetNode->Parent()->GetLocalRatsnestVisible();
335 show = sourceNode->Parent()->GetLocalRatsnestVisible() ||
336 targetNode->Parent()->GetLocalRatsnestVisible();
339 if( onlyVisibleLayers && show )
341 LSET sourceLayers = sourceNode->Parent()->GetLayerSet();
342 LSET targetLayers = targetNode->Parent()->GetLayerSet();
344 if( !( sourceLayers & visibleLayers ).
any() ||
345 !( targetLayers & visibleLayers ).
any() )
351 if ( enable && show )
392 hash_combine( seed, !
m_data->GetLocalRatsnest().empty(),
static_cast<int>( rs->GetNetColorMode() ),
393 static_cast<int>( rs->m_ContrastModeDisplay ),
static_cast<int>( rs->GetPrimaryHighContrastLayer() ),
397 for(
int net : rs->GetHighlightNetCodes() )
403 for(
int net : rs->GetHiddenNets() )
414 return std::exchange(
m_boardInputs, seed ) != seed || skipped;
@ HIDDEN
Inactive layers are hidden.
@ OFF
Net (and netclass) colors are not shown.
@ VISIBLE
Ratsnest lines are drawn to items on visible layers only.
BASE_SET & set(size_t pos)
constexpr void SetMaximum()
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr bool Intersects(const BOX2< Vec > &aRect) const
CN_EDGE represents a point-to-point connection, whether realized or unrealized (ie: tracks etc.
static const COLOR4D UNSPECIFIED
For legacy support; used as a value to indicate color hasn't been set yet.
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
APP_SETTINGS_BASE * KifaceSettings() const
A color representation with 4 components: red, green, blue, alpha.
COLOR4D WithAlpha(double aAlpha) const
Return a color with the same color, but the given alpha.
COLOR4D Darkened(double aFactor) const
Return a color that is darker by a given factor, without modifying object.
COLOR4D Brightened(double aFactor) const
Return a color that is brighter by a given factor, without modifying object.
Abstract interface for drawing on a 2D-surface.
virtual void SetIsFill(bool aIsFillEnabled)
Enable/disable fill.
virtual bool SupportsStrokePixelPad() const
Tell whether strokes can carry part of their width in pixels, see SetStrokePixelPad().
virtual void SetLineWidth(float aLineWidth)
Set the line width.
virtual void SetStrokeColor(const COLOR4D &aColor)
Set the stroke color.
virtual void SetIsStroke(bool aIsStrokeEnabled)
Enable/disable stroked outlines.
virtual void DrawLine(const VECTOR2D &aStartPoint, const VECTOR2D &aEndPoint)
Draw a line.
virtual void DrawCurve(const VECTOR2D &startPoint, const VECTOR2D &controlPointA, const VECTOR2D &controlPointB, const VECTOR2D &endPoint, double aFilterValue=0.0)
Draw a cubic bezier spline.
float GetLineWidth() const
Get the line width.
double GetWorldScale() const
Get the world scale.
virtual void SetStrokePixelPad(double aPixels)
Widen every stroke, circle and pad drawn from now on by aPixels.
PCB specific render settings.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
BOX2D GetViewport() const
Return the current viewport visible area rectangle.
GAL * GetGAL() const
Return the GAL this view is using to draw graphical primitives.
bool IsLayerVisible(int aLayer) const
Return information about visibility of a particular layer.
PAINTER * GetPainter() const
Return the painter object used by the view for drawing VIEW_ITEM objects.
LSET is a set of PCB_LAYER_IDs.
static const LSET & AllCuMask()
return AllCuMask( MAX_CU_LAYERS );
void RunOnLayers(const std::function< void(PCB_LAYER_ID)> &aFunction) const
Execute a function on each layer of the LSET.
A collection of nets and the parameters used to route or test these nets.
COLOR4D GetPcbColor(bool aIsForSave=false) const
NET_SETTINGS stores various net-related settings in a project context.
bool HasEffectiveNetClass(const wxString &aNetName) const
Determines if an effective netclass for the given net name has been cached.
std::shared_ptr< NETCLASS > GetCachedEffectiveNetClass(const wxString &aNetName) const
Returns an already cached effective netclass for the given net name.
DISPLAY_OPTIONS m_Display
RATSNEST_VIEW_ITEM(std::shared_ptr< CONNECTIVITY_DATA > aData, PART aPart=PART::ALL)
bool BoardInputsChanged(KIGFX::VIEW *aView)
Return true when an input to the board's lines other than connectivity has changed since the last cal...
const BOX2I ViewBBox() const override
Return the bounding box of the item covering all its layers.
PART
The lines an item draws.
static bool LineInViewport(const VECTOR2I &aSource, const VECTOR2I &aTarget, const BOX2D &aViewport, bool aCurved)
Return true when a ratsnest line between aSource and aTarget can contribute to aViewport.
static VECTOR2D CurveControlPoint(const VECTOR2D &aSource, const VECTOR2D &aTarget)
Return the doubled Bezier control point used to bow a curved ratsnest line.
std::shared_ptr< CONNECTIVITY_DATA > m_data
Object containing ratsnest data.
static constexpr int LOCAL_LAYER
The local part is drawn on a UI layer, which every canvas keeps on its overlay.
void ViewDraw(int aLayer, KIGFX::VIEW *aView) const override
Draw the parts of the object belonging to layer aLayer.
size_t m_boardInputs
see BoardInputsChanged()
std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Describe ratsnest for a single net.
const std::vector< CN_EDGE > & GetUnsortedEdges() const
Return the ratsnest edges in no particular order.
A type-safe container of any type.
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static constexpr void hash_combine(std::size_t &seed)
This is a dummy function to take the final case of hash_combine below.
@ LAYER_PCB_BACKGROUND
PCB background color.
PCB_LAYER_ID
A quick note on layer IDs:
Class that computes missing connections on a PCB.
static void drawCross(KIGFX::GAL *aGal, const VECTOR2D &aPos)
static constexpr double CURVE_BOW
static constexpr int CROSS_SIZE
Class that draws missing connections on a PCB.
RATSNEST_MODE m_RatsnestMode
bool m_DisplayRatsnestLinesCurved
bool m_ShowGlobalRatsnest
double m_RatsnestThickness
@ NOT_USED
the 3d code uses this value
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D