KiCad PCB EDA Suite
Loading...
Searching...
No Matches
ee_grid_helper.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2014 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 * @author Tomasz Wlostowski <[email protected]>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, you may find one here:
20 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
21 * or you may search the http://www.gnu.org website for the version 2 license,
22 * or you may write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
24 */
25
26#include <functional>
27#include <macros.h>
29#include <sch_group.h>
30#include <sch_item.h>
31#include <sch_line.h>
32#include <sch_table.h>
33#include <sch_tablecell.h>
34#include <sch_painter.h>
35#include <tool/tool_manager.h>
37#include <trigo.h>
38#include <view/view.h>
39#include "ee_grid_helper.h"
40
41
44{
45 KIGFX::VIEW* view = m_toolMgr->GetView();
46
47 m_viewAxis.SetSize( 20000 );
49 m_viewAxis.SetColor( COLOR4D( 0.0, 0.1, 0.4, 0.8 ) );
51 view->Add( &m_viewAxis );
52 view->SetVisible( &m_viewAxis, false );
53
55 m_viewSnapPoint.SetColor( COLOR4D( 0.0, 0.1, 0.4, 1.0 ) );
57 view->Add( &m_viewSnapPoint );
58 view->SetVisible( &m_viewSnapPoint, false );
59}
60
61
63{
64 KIGFX::VIEW* view = m_toolMgr->GetView();
65
66 view->Remove( &m_viewAxis );
67 view->Remove( &m_viewSnapPoint );
68}
69
70
72 const SCH_SELECTION& aItems )
73{
75
76 // If we're working with any connectable objects, skip non-connectable objects
77 // since they are often off-grid, e.g. text anchors
78 bool hasConnectables = false;
79
80 for( EDA_ITEM* item : aItems )
81 {
82 GRID_HELPER_GRIDS grid = GetItemGrid( static_cast<SCH_ITEM*>( item ) );
84 {
85 hasConnectables = true;
86 break;
87 }
88 }
89
90 for( EDA_ITEM* item : aItems )
91 computeAnchors( static_cast<SCH_ITEM*>( item ), aMousePos, true, !hasConnectables );
92
93 double worldScale = m_toolMgr->GetView()->GetGAL()->GetWorldScale();
94 double lineSnapMinCornerDistance = 50.0 / worldScale;
95
96 ANCHOR* nearestOutline = nearestAnchor( aMousePos, OUTLINE, aGrid );
97 ANCHOR* nearestCorner = nearestAnchor( aMousePos, CORNER, aGrid );
98 ANCHOR* nearestOrigin = nearestAnchor( aMousePos, ORIGIN, aGrid );
99 ANCHOR* best = nullptr;
100 double minDist = std::numeric_limits<double>::max();
101
102 if( nearestOrigin )
103 {
104 minDist = nearestOrigin->Distance( aMousePos );
105 best = nearestOrigin;
106 }
107
108 if( nearestCorner )
109 {
110 double dist = nearestCorner->Distance( aMousePos );
111
112 if( dist < minDist )
113 {
114 minDist = dist;
115 best = nearestCorner;
116 }
117 }
118
119 if( nearestOutline )
120 {
121 double dist = nearestOutline->Distance( aMousePos );
122
123 if( minDist > lineSnapMinCornerDistance && dist < minDist )
124 best = nearestOutline;
125 }
126
127 return best ? best->pos : aMousePos;
128}
129
130
132 SCH_ITEM* aSkip )
133{
134 SCH_SELECTION skipItems;
135 skipItems.Add( aSkip );
136
137 return BestSnapAnchor( aOrigin, aGrid, skipItems );
138}
139
140
142 const SCH_SELECTION& aSkip )
143{
144 constexpr int snapRange = SNAP_RANGE * schIUScale.IU_PER_MILS;
145
146 VECTOR2I pt = aOrigin;
147 VECTOR2I snapDist( snapRange, snapRange );
148 bool snapLineX = false;
149 bool snapLineY = false;
150 bool snapPoint = false;
151 bool gridChecked = false;
152
153 BOX2I bb( VECTOR2I( aOrigin.x - snapRange / 2, aOrigin.y - snapRange / 2 ),
154 VECTOR2I( snapRange, snapRange ) );
155
156 clearAnchors();
157
158 for( SCH_ITEM* item : queryVisible( bb, aSkip ) )
159 computeAnchors( item, aOrigin );
160
161 ANCHOR* nearest = nearestAnchor( aOrigin, SNAPPABLE, aGrid );
162 VECTOR2I nearestGrid = Align( aOrigin, aGrid );
163
165 {
166 ad->ClearAnchors();
167 for( const ANCHOR& a : m_anchors )
168 ad->AddAnchor( a.pos );
169
170 ad->SetNearest( nearest ? OPT_VECTOR2I( nearest->pos ) : std::nullopt );
172 }
173
175
177 std::optional<VECTOR2I> snapLineOrigin = snapLineManager.GetSnapLineOrigin();
178
179 if( m_enableSnapLine && m_snapItem && snapLineOrigin.has_value()
180 && m_skipPoint != *snapLineOrigin )
181 {
182 if( std::abs( snapLineOrigin->x - aOrigin.x ) < snapDist.x )
183 {
184 pt.x = snapLineOrigin->x;
185 snapDist.x = std::abs( pt.x - aOrigin.x );
186 snapLineX = true;
187 }
188
189 if( std::abs( snapLineOrigin->y - aOrigin.y ) < snapDist.y )
190 {
191 pt.y = snapLineOrigin->y;
192 snapDist.y = std::abs( pt.y - aOrigin.y );
193 snapLineY = true;
194 }
195
196 if( canUseGrid() && std::abs( nearestGrid.x - aOrigin.x ) < snapDist.x )
197 {
198 pt.x = nearestGrid.x;
199 snapDist.x = std::abs( nearestGrid.x - aOrigin.x );
200 snapLineX = false;
201 }
202
203 if( canUseGrid() && std::abs( nearestGrid.y - aOrigin.y ) < snapDist.y )
204 {
205 pt.y = nearestGrid.y;
206 snapDist.y = std::abs( nearestGrid.y - aOrigin.y );
207 snapLineY = false;
208 }
209
210 gridChecked = true;
211 }
212
213 if( m_enableSnap && nearest && nearest->Distance( aOrigin ) < snapDist.EuclideanNorm() )
214 {
215
216 if( canUseGrid() && ( nearestGrid - aOrigin ).EuclideanNorm() < snapDist.EuclideanNorm() )
217 {
218 pt = nearestGrid;
219 snapDist.x = std::abs( nearestGrid.x - aOrigin.x );
220 snapDist.y = std::abs( nearestGrid.y - aOrigin.y );
221 snapPoint = false;
222 }
223 else
224 {
225 pt = nearest->pos;
226 snapDist.x = std::abs( nearest->pos.x - aOrigin.x );
227 snapDist.y = std::abs( nearest->pos.y - aOrigin.y );
228 snapPoint = true;
229 }
230
231 snapLineX = false;
232 snapLineY = false;
233 gridChecked = true;
234 }
235
236 if( canUseGrid() && !gridChecked )
237 pt = nearestGrid;
238
239 if( snapLineX || snapLineY )
240 {
241 snapLineManager.SetSnapLineEnd( pt );
242 }
243 else if( snapPoint )
244 {
245 m_snapItem = *nearest;
247
248 snapLineManager.SetSnapLineOrigin( pt );
249
252 else
254 }
255 else
256 {
257 snapLineManager.ClearSnapLine();
259 }
260
261 return pt;
262}
263
264
266{
268 int idx = -1;
269
271
272 if( !grid.overrides_enabled )
273 return g;
274
275 switch( aGrid )
276 {
277 case GRID_CONNECTABLE:
278 if( grid.override_connected )
279 idx = grid.override_connected_idx;
280
281 break;
282
283 case GRID_WIRES:
284 if( grid.override_wires )
285 idx = grid.override_wires_idx;
286
287 break;
288
289 case GRID_TEXT:
290 if( grid.override_text )
291 idx = grid.override_text_idx;
292
293 break;
294
295 case GRID_GRAPHICS:
296 if( grid.override_graphics )
297 idx = grid.override_graphics_idx;
298
299 break;
300
301 default:
302 break;
303 }
304
305 if( idx >= 0 && idx < (int) grid.grids.size() )
306 g = grid.grids[idx].ToDouble( schIUScale );
307
308 return g;
309}
310
311
313{
314 if( !m_snapItem )
315 return nullptr;
316
317 if( m_snapItem->items.empty() )
318 return nullptr;
319
320 return static_cast<SCH_ITEM*>( m_snapItem->items[0] );
321}
322
323
324std::set<SCH_ITEM*> EE_GRID_HELPER::queryVisible( const BOX2I& aArea,
325 const SCH_SELECTION& aSkipList ) const
326{
327 std::set<SCH_ITEM*> items;
328 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
329
330 KIGFX::VIEW* view = m_toolMgr->GetView();
331
332 view->Query( aArea, selectedItems );
333
334 for( const KIGFX::VIEW::LAYER_ITEM_PAIR& it : selectedItems )
335 {
336 SCH_ITEM* item = static_cast<SCH_ITEM*>( it.first );
337
338 // The item must be visible and on an active layer
339 if( view->IsVisible( item ) && item->ViewGetLOD( it.second, view ) < view->GetScale() )
340 items.insert ( item );
341 }
342
343 for( EDA_ITEM* skipItem : aSkipList )
344 items.erase( static_cast<SCH_ITEM*>( skipItem ) );
345
346 return items;
347}
348
349
351{
352 GRID_HELPER_GRIDS grid = GetItemGrid( aSelection.Front() );
353
354 // Find the largest grid of all the items and use that
355 for( EDA_ITEM* item : aSelection )
356 {
357 GRID_HELPER_GRIDS itemGrid = GetItemGrid( item );
358
359 if( GetGridSize( itemGrid ) > GetGridSize( grid ) )
360 grid = itemGrid;
361 }
362
363 return grid;
364}
365
366
368{
369 if( !aItem )
370 return GRID_CURRENT;
371
372 switch( aItem->Type() )
373 {
374 case LIB_SYMBOL_T:
375 case SCH_SYMBOL_T:
376 case SCH_PIN_T:
377 case SCH_SHEET_PIN_T:
378 case SCH_SHEET_T:
379 case SCH_NO_CONNECT_T:
381 case SCH_HIER_LABEL_T:
382 case SCH_LABEL_T:
384 case SCH_RULE_AREA_T:
385 return GRID_CONNECTABLE;
386
387 case SCH_FIELD_T:
388 case SCH_TEXT_T:
389 return GRID_TEXT;
390
391 case SCH_SHAPE_T:
392 // The text box's border lines are what need to be on the graphic grid
393 case SCH_TEXTBOX_T:
394 case SCH_BITMAP_T:
395 return GRID_GRAPHICS;
396
397 case SCH_JUNCTION_T:
398 return GRID_WIRES;
399
400 case SCH_LINE_T:
401 if( static_cast<const SCH_LINE*>( aItem )->IsConnectable() )
402 return GRID_WIRES;
403 else
404 return GRID_GRAPHICS;
405
408 return GRID_WIRES;
409
410 // Groups need to get the grid of their children
411 case SCH_GROUP_T:
412 {
413 const SCH_GROUP* group = static_cast<const SCH_GROUP*>( aItem );
414
415 // Shouldn't happen
416 if( group->GetItems().empty() )
417 return GRID_CURRENT;
418
419 GRID_HELPER_GRIDS grid = GetItemGrid( *group->GetItems().begin() );
420
421 for( EDA_ITEM* item : static_cast<const SCH_GROUP*>( aItem )->GetItems() )
422 {
423 GRID_HELPER_GRIDS itemGrid = GetItemGrid( item );
424
425 if( GetGridSize( itemGrid ) > GetGridSize( grid ) )
426 grid = itemGrid;
427 }
428
429 return grid;
430 }
431
432 default:
433 return GRID_CURRENT;
434 }
435}
436
437
438void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom,
439 bool aIncludeText )
440{
441 bool isGraphicLine =
442 aItem->Type() == SCH_LINE_T && static_cast<SCH_LINE*>( aItem )->IsGraphicLine();
443
444 switch( aItem->Type() )
445 {
446 case SCH_TEXT_T:
447 case SCH_FIELD_T:
448 {
449 if( aIncludeText )
450 addAnchor( aItem->GetPosition(), ORIGIN, aItem );
451
452 break;
453 }
454
455 case SCH_TABLE_T:
456 {
457 if( aIncludeText )
458 {
459 addAnchor( aItem->GetPosition(), SNAPPABLE | CORNER, aItem );
460 addAnchor( static_cast<SCH_TABLE*>( aItem )->GetEnd(), SNAPPABLE | CORNER, aItem );
461 }
462
463 break;
464 }
465
466 case SCH_TEXTBOX_T:
467 case SCH_TABLECELL_T:
468 {
469 if( aIncludeText )
470 {
471 addAnchor( aItem->GetPosition(), SNAPPABLE | CORNER, aItem );
472 addAnchor( dynamic_cast<SCH_SHAPE*>( aItem )->GetEnd(), SNAPPABLE | CORNER, aItem );
473 }
474
475 break;
476 }
477
478 case SCH_SYMBOL_T:
479 case SCH_SHEET_T:
480 addAnchor( aItem->GetPosition(), ORIGIN, aItem );
482
483 case SCH_JUNCTION_T:
484 case SCH_NO_CONNECT_T:
485 case SCH_LINE_T:
486 // Don't add anchors for graphic lines unless we're including text,
487 // they may be on a non-connectable grid
488 if( isGraphicLine && !aIncludeText )
489 break;
490
493 case SCH_HIER_LABEL_T:
494 case SCH_LABEL_T:
497 case SCH_SHEET_PIN_T:
498 {
499 std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();
500
501 for( const VECTOR2I& pt : pts )
502 addAnchor( VECTOR2I( pt ), SNAPPABLE | CORNER, aItem );
503
504 break;
505 }
506 case SCH_PIN_T:
507 {
508 SCH_PIN* pin = static_cast<SCH_PIN*>( aItem );
509 addAnchor( pin->GetPosition(), SNAPPABLE | ORIGIN, aItem );
510 break;
511 }
512
513 case SCH_GROUP_T:
514 for( EDA_ITEM* item : static_cast<SCH_GROUP*>( aItem )->GetItems() )
515 {
516 computeAnchors( static_cast<SCH_ITEM*>( item ), aRefPos, aFrom, aIncludeText );
517 }
518
519 break;
520
521 default:
522 break;
523 }
524
525 // Don't add anchors for graphic lines unless we're including text,
526 // they may be on a non-connectable grid
527 if( aItem->Type() == SCH_LINE_T && ( aIncludeText || !isGraphicLine ) )
528 {
529 SCH_LINE* line = static_cast<SCH_LINE*>( aItem );
530 VECTOR2I pt = Align( aRefPos );
531
532 if( line->GetStartPoint().x == line->GetEndPoint().x )
533 {
534 VECTOR2I possible( line->GetStartPoint().x, pt.y );
535
536 if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
537 addAnchor( possible, SNAPPABLE | VERTICAL, aItem );
538 }
539 else if( line->GetStartPoint().y == line->GetEndPoint().y )
540 {
541 VECTOR2I possible( pt.x, line->GetStartPoint().y );
542
543 if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
544 addAnchor( possible, SNAPPABLE | HORIZONTAL, aItem );
545 }
546 }
547}
548
549
551 GRID_HELPER_GRIDS aGrid )
552{
553 double minDist = std::numeric_limits<double>::max();
554 ANCHOR* best = nullptr;
555
556 for( ANCHOR& a : m_anchors )
557 {
558 if( ( aFlags & a.flags ) != aFlags )
559 continue;
560
561 // A "virtual" anchor with no real items associated shouldn't be filtered out
562 if( !a.items.empty() )
563 {
564 // Filter using the first item
565 SCH_ITEM* item = static_cast<SCH_ITEM*>( a.items[0] );
566
567 if( aGrid == GRID_CONNECTABLE && !item->IsConnectable() )
568 continue;
569 else if( aGrid == GRID_GRAPHICS && item->IsConnectable() )
570 continue;
571 }
572
573 double dist = a.Distance( aPos );
574
575 if( dist < minDist )
576 {
577 minDist = dist;
578 best = &a;
579 }
580 }
581
582 return best;
583}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:112
WINDOW_SETTINGS m_Window
Definition: app_settings.h:232
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:96
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:256
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:108
GRID_HELPER_GRIDS GetSelectionGrid(const SELECTION &aItem) const override
Gets the coarsest grid that applies to a selecion of items.
~EE_GRID_HELPER() override
GRID_HELPER_GRIDS GetItemGrid(const EDA_ITEM *aItem) const override
Get the coarsest grid that applies to an item.
VECTOR2I BestDragOrigin(const VECTOR2I &aMousePos, GRID_HELPER_GRIDS aGrid, const SCH_SELECTION &aItems)
std::set< SCH_ITEM * > queryVisible(const BOX2I &aArea, const SCH_SELECTION &aSkipList) const
VECTOR2I BestSnapAnchor(const VECTOR2I &aOrigin, GRID_HELPER_GRIDS aGrid, SCH_ITEM *aSkip)
ANCHOR * nearestAnchor(const VECTOR2I &aPos, int aFlags, GRID_HELPER_GRIDS aGrid)
VECTOR2D GetGridSize(GRID_HELPER_GRIDS aGrid) const override
Return the size of the specified grid.
SCH_ITEM * GetSnapped() const
Function GetSnapped If the EE_GRID_HELPER has highlighted a snap point (target shown),...
EE_GRID_HELPER(TOOL_MANAGER *aToolMgr)
void computeAnchors(SCH_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom=false, bool aIncludeText=false)
Insert the local anchor points in to the grid helper for the specified schematic item,...
void addAnchor(const VECTOR2I &aPos, int aFlags, EDA_ITEM *aItem, int aPointTypes=POINT_TYPE::PT_NONE)
Definition: grid_helper.h:178
SNAP_MANAGER & getSnapManager()
Definition: grid_helper.h:208
VECTOR2I m_skipPoint
Definition: grid_helper.h:231
void showConstructionGeometry(bool aShow)
TOOL_MANAGER * m_toolMgr
Definition: grid_helper.h:221
bool m_enableSnapLine
Definition: grid_helper.h:228
bool m_enableSnap
Definition: grid_helper.h:226
bool canUseGrid() const
Check whether it is possible to use the grid – this depends both on local grid helper settings and gl...
void clearAnchors()
Definition: grid_helper.h:191
std::optional< ANCHOR > m_snapItem
Definition: grid_helper.h:229
KIGFX::ANCHOR_DEBUG * enableAndGetAnchorDebug()
Enable the anchor debug if permitted and return it.
Definition: grid_helper.cpp:88
KIGFX::SNAP_INDICATOR m_viewSnapPoint
Definition: grid_helper.h:233
virtual VECTOR2I Align(const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
Definition: grid_helper.h:65
KIGFX::ORIGIN_VIEWITEM m_viewAxis
Definition: grid_helper.h:234
std::vector< ANCHOR > m_anchors
Definition: grid_helper.h:219
View item to draw debug items for anchors.
Definition: anchor_debug.h:45
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
const VECTOR2D & GetGridSize() const
Return the grid size.
double GetWorldScale() const
Get the world scale.
void SetPosition(const VECTOR2I &aPosition) override
void SetColor(const KIGFX::COLOR4D &aColor)
void SetStyle(MARKER_STYLE aStyle)
void SetSize(int aSize)
void SetDrawAtZero(bool aDrawFlag)
Set the draw at zero flag.
virtual double ViewGetLOD(int aLayer, const VIEW *aView) const
Return the level of detail (LOD) of the item.
Definition: view_item.h:149
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
double GetScale() const
Definition: view.h:272
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:297
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:332
int Query(const BOX2I &aRect, std::vector< LAYER_ITEM_PAIR > &aResult) const
Find all visible items that touch or are within the rectangle aRect.
Definition: view.cpp:410
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
Definition: view.cpp:1673
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:198
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition: view.h:71
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
Definition: view.cpp:1643
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1600
A set of SCH_ITEMs (i.e., without duplicates).
Definition: sch_group.h:52
Base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:167
virtual bool IsConnectable() const
Definition: sch_item.h:475
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:490
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:41
VECTOR2I GetEndPoint() const
Definition: sch_line.h:143
VECTOR2I GetStartPoint() const
Definition: sch_line.h:138
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:42
EDA_ITEM * Front() const
Definition: selection.h:172
A class that manages the geometry of a "snap line".
void ClearSnapLine()
Clear the snap line origin and end points.
void SetSnapLineOrigin(const VECTOR2I &aOrigin)
The snap point is a special point that is located at the last point the cursor snapped to.
void SetSnapLineEnd(const OPT_VECTOR2I &aSnapPoint)
Set the end point of the snap line.
const OPT_VECTOR2I & GetSnapLineOrigin() const
SNAP_LINE_MANAGER & GetSnapLineManager()
Master controller class:
Definition: tool_manager.h:62
APP_SETTINGS_BASE * GetSettings() const
Definition: tool_manager.h:404
KIGFX::VIEW * GetView() const
Definition: tool_manager.h:395
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
Definition: vector2d.h:283
#define SNAP_RANGE
GRID_HELPER_GRIDS
Definition: grid_helper.h:42
@ GRID_TEXT
Definition: grid_helper.h:49
@ GRID_CURRENT
Definition: grid_helper.h:44
@ GRID_GRAPHICS
Definition: grid_helper.h:50
@ GRID_CONNECTABLE
Definition: grid_helper.h:46
@ GRID_WIRES
Definition: grid_helper.h:47
@ LAYER_SCHEMATIC_ANCHOR
Definition: layer_ids.h:488
This file contains miscellaneous commonly used macros and functions.
#define KI_FALLTHROUGH
The KI_FALLTHROUGH macro is to be used when switch statement cases should purposely fallthrough from ...
Definition: macros.h:83
@ GEOMETRY
Position or shape has changed.
Definition: view_item.h:55
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
Definition: eda_angle.h:393
Class to handle a set of SCH_ITEMs.
std::optional< VECTOR2I > OPT_VECTOR2I
Definition: seg.h:39
const double IU_PER_MILS
Definition: base_units.h:77
double Distance(const VECTOR2I &aP) const
Definition: grid_helper.h:167
GRID_SETTINGS grid
Definition: app_settings.h:97
bool TestSegmentHit(const VECTOR2I &aRefPoint, const VECTOR2I &aStart, const VECTOR2I &aEnd, int aDist)
Test if aRefPoint is with aDistance on the line defined by aStart and aEnd.
Definition: trigo.cpp:175
@ SCH_GROUP_T
Definition: typeinfo.h:173
@ SCH_TABLE_T
Definition: typeinfo.h:165
@ SCH_LINE_T
Definition: typeinfo.h:163
@ LIB_SYMBOL_T
Definition: typeinfo.h:148
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:160
@ SCH_SYMBOL_T
Definition: typeinfo.h:172
@ SCH_TABLECELL_T
Definition: typeinfo.h:166
@ SCH_FIELD_T
Definition: typeinfo.h:150
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:171
@ SCH_LABEL_T
Definition: typeinfo.h:167
@ SCH_SHEET_T
Definition: typeinfo.h:175
@ SCH_SHAPE_T
Definition: typeinfo.h:149
@ SCH_RULE_AREA_T
Definition: typeinfo.h:170
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:169
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:162
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:174
@ SCH_TEXT_T
Definition: typeinfo.h:151
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:161
@ SCH_BITMAP_T
Definition: typeinfo.h:164
@ SCH_TEXTBOX_T
Definition: typeinfo.h:152
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:168
@ SCH_JUNCTION_T
Definition: typeinfo.h:159
@ SCH_PIN_T
Definition: typeinfo.h:153
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695