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>
36#include <sch_tool_base.h>
38#include <trigo.h>
39#include <view/view.h>
40#include "ee_grid_helper.h"
41
44{
45}
46
47
50{
51 if( !m_toolMgr )
52 return;
53
54 KIGFX::VIEW* view = m_toolMgr->GetView();
55
56 m_viewAxis.SetSize( 20000 );
58 m_viewAxis.SetColor( COLOR4D( 0.0, 0.1, 0.4, 0.8 ) );
60 view->Add( &m_viewAxis );
61 view->SetVisible( &m_viewAxis, false );
62
64 m_viewSnapPoint.SetColor( COLOR4D( 0.0, 0.1, 0.4, 1.0 ) );
66 view->Add( &m_viewSnapPoint );
67 view->SetVisible( &m_viewSnapPoint, false );
68}
69
70
72{
73 if( !m_toolMgr )
74 return;
75
76 KIGFX::VIEW* view = m_toolMgr->GetView();
77
78 view->Remove( &m_viewAxis );
79 view->Remove( &m_viewSnapPoint );
80}
81
82
84 const SCH_SELECTION& aItems )
85{
87
88 // If we're working with any connectable objects, skip non-connectable objects
89 // since they are often off-grid, e.g. text anchors
90 bool hasConnectables = false;
91
92 for( EDA_ITEM* item : aItems )
93 {
94 GRID_HELPER_GRIDS grid = GetItemGrid( static_cast<SCH_ITEM*>( item ) );
96 {
97 hasConnectables = true;
98 break;
99 }
100 }
101
102 for( EDA_ITEM* item : aItems )
103 computeAnchors( static_cast<SCH_ITEM*>( item ), aMousePos, true, !hasConnectables );
104
105 double worldScale = m_toolMgr->GetView()->GetGAL()->GetWorldScale();
106 double lineSnapMinCornerDistance = 50.0 / worldScale;
107
108 ANCHOR* nearestOutline = nearestAnchor( aMousePos, OUTLINE, aGrid );
109 ANCHOR* nearestCorner = nearestAnchor( aMousePos, CORNER, aGrid );
110 ANCHOR* nearestOrigin = nearestAnchor( aMousePos, ORIGIN, aGrid );
111 ANCHOR* best = nullptr;
112 double minDist = std::numeric_limits<double>::max();
113
114 if( nearestOrigin )
115 {
116 minDist = nearestOrigin->Distance( aMousePos );
117 best = nearestOrigin;
118 }
119
120 if( nearestCorner )
121 {
122 double dist = nearestCorner->Distance( aMousePos );
123
124 if( dist < minDist )
125 {
126 minDist = dist;
127 best = nearestCorner;
128 }
129 }
130
131 if( nearestOutline )
132 {
133 double dist = nearestOutline->Distance( aMousePos );
134
135 if( minDist > lineSnapMinCornerDistance && dist < minDist )
136 best = nearestOutline;
137 }
138
139 return best ? best->pos : aMousePos;
140}
141
142
144 SCH_ITEM* aSkip )
145{
146 SCH_SELECTION skipItems;
147 skipItems.Add( aSkip );
148
149 return BestSnapAnchor( aOrigin, aGrid, skipItems );
150}
151
152
154 const SCH_SELECTION& aSkip )
155{
156 constexpr int snapRange = SNAP_RANGE * schIUScale.IU_PER_MILS;
157
158 VECTOR2I pt = aOrigin;
159 VECTOR2I snapDist( snapRange, snapRange );
160 bool snapLineX = false;
161 bool snapLineY = false;
162 bool snapPoint = false;
163 bool gridChecked = false;
164
165 BOX2I bb( VECTOR2I( aOrigin.x - snapRange / 2, aOrigin.y - snapRange / 2 ),
166 VECTOR2I( snapRange, snapRange ) );
167
168 clearAnchors();
169 m_snapItem = std::nullopt;
170
171 for( SCH_ITEM* item : queryVisible( bb, aSkip ) )
172 computeAnchors( item, aOrigin );
173
174 ANCHOR* nearest = nearestAnchor( aOrigin, SNAPPABLE, aGrid );
175 VECTOR2I nearestGrid = Align( aOrigin, aGrid );
176
178 {
179 ad->ClearAnchors();
180 for( const ANCHOR& a : m_anchors )
181 ad->AddAnchor( a.pos );
182
183 ad->SetNearest( nearest ? OPT_VECTOR2I( nearest->pos ) : std::nullopt );
185 }
186
188
190 std::optional<VECTOR2I> snapLineOrigin = snapLineManager.GetSnapLineOrigin();
191
192 if( m_enableSnapLine && m_snapItem && snapLineOrigin.has_value()
193 && m_skipPoint != *snapLineOrigin )
194 {
195 if( std::abs( snapLineOrigin->x - aOrigin.x ) < snapDist.x )
196 {
197 pt.x = snapLineOrigin->x;
198 snapDist.x = std::abs( pt.x - aOrigin.x );
199 snapLineX = true;
200 }
201
202 if( std::abs( snapLineOrigin->y - aOrigin.y ) < snapDist.y )
203 {
204 pt.y = snapLineOrigin->y;
205 snapDist.y = std::abs( pt.y - aOrigin.y );
206 snapLineY = true;
207 }
208
209 if( canUseGrid() && std::abs( nearestGrid.x - aOrigin.x ) < snapDist.x )
210 {
211 pt.x = nearestGrid.x;
212 snapDist.x = std::abs( nearestGrid.x - aOrigin.x );
213 snapLineX = false;
214 }
215
216 if( canUseGrid() && std::abs( nearestGrid.y - aOrigin.y ) < snapDist.y )
217 {
218 pt.y = nearestGrid.y;
219 snapDist.y = std::abs( nearestGrid.y - aOrigin.y );
220 snapLineY = false;
221 }
222
223 gridChecked = true;
224 }
225
226 if( m_enableSnap && nearest && nearest->Distance( aOrigin ) < snapDist.EuclideanNorm() )
227 {
228
229 if( canUseGrid() && ( nearestGrid - aOrigin ).EuclideanNorm() < snapDist.EuclideanNorm() )
230 {
231 pt = nearestGrid;
232 snapDist.x = std::abs( nearestGrid.x - aOrigin.x );
233 snapDist.y = std::abs( nearestGrid.y - aOrigin.y );
234 snapPoint = false;
235 }
236 else
237 {
238 pt = nearest->pos;
239 snapDist.x = std::abs( nearest->pos.x - aOrigin.x );
240 snapDist.y = std::abs( nearest->pos.y - aOrigin.y );
241 snapPoint = true;
242 }
243
244 snapLineX = false;
245 snapLineY = false;
246 gridChecked = true;
247 }
248
249 if( canUseGrid() && !gridChecked )
250 pt = nearestGrid;
251
252 if( snapLineX || snapLineY )
253 {
254 snapLineManager.SetSnapLineEnd( pt );
255 }
256 else if( snapPoint )
257 {
258 m_snapItem = *nearest;
260
261 snapLineManager.SetSnapLineOrigin( pt );
262
265 else
267 }
268 else
269 {
270 snapLineManager.ClearSnapLine();
272 }
273
274 return pt;
275}
276
277
279{
281 int idx = -1;
282
284
285 if( !grid.overrides_enabled )
286 return g;
287
288 switch( aGrid )
289 {
290 case GRID_CONNECTABLE:
291 if( grid.override_connected )
292 idx = grid.override_connected_idx;
293
294 break;
295
296 case GRID_WIRES:
297 if( grid.override_wires )
298 idx = grid.override_wires_idx;
299
300 break;
301
302 case GRID_TEXT:
303 if( grid.override_text )
304 idx = grid.override_text_idx;
305
306 break;
307
308 case GRID_GRAPHICS:
309 if( grid.override_graphics )
310 idx = grid.override_graphics_idx;
311
312 break;
313
314 default:
315 break;
316 }
317
318 if( idx >= 0 && idx < (int) grid.grids.size() )
319 g = grid.grids[idx].ToDouble( schIUScale );
320
321 return g;
322}
323
324
326{
327 if( !m_snapItem )
328 return nullptr;
329
330 if( m_snapItem->items.empty() )
331 return nullptr;
332
333 return static_cast<SCH_ITEM*>( m_snapItem->items[0] );
334}
335
336
337std::set<SCH_ITEM*> EE_GRID_HELPER::queryVisible( const BOX2I& aArea,
338 const SCH_SELECTION& aSkipList ) const
339{
340 std::set<SCH_ITEM*> items;
341 std::vector<KIGFX::VIEW::LAYER_ITEM_PAIR> selectedItems;
342
343 EDA_DRAW_FRAME* frame = dynamic_cast<EDA_DRAW_FRAME*>( m_toolMgr->GetToolHolder() );
344 KIGFX::VIEW* view = m_toolMgr->GetView();
345
346 view->Query( aArea, selectedItems );
347
348 for( const KIGFX::VIEW::LAYER_ITEM_PAIR& it : selectedItems )
349 {
350 if( !it.first->IsSCH_ITEM() )
351 continue;
352
353 SCH_ITEM* item = static_cast<SCH_ITEM*>( it.first );
354
355 if( frame && frame->IsType( FRAME_SCH_SYMBOL_EDITOR ) )
356 {
357 // If we are in the symbol editor, don't use the symbol itself
358 if( item->Type() == LIB_SYMBOL_T )
359 continue;
360 }
361 else
362 {
363 // If we are not in the symbol editor, don't use symbol-editor-private items
364 if( item->IsPrivate() )
365 continue;
366 }
367
368 // The item must be visible and on an active layer
369 if( view->IsVisible( item ) && item->ViewGetLOD( it.second, view ) < view->GetScale() )
370 items.insert ( item );
371 }
372
373 for( EDA_ITEM* skipItem : aSkipList )
374 items.erase( static_cast<SCH_ITEM*>( skipItem ) );
375
376 return items;
377}
378
379
381{
382 GRID_HELPER_GRIDS grid = GetItemGrid( aSelection.Front() );
383
384 // Find the largest grid of all the items and use that
385 for( EDA_ITEM* item : aSelection )
386 {
387 GRID_HELPER_GRIDS itemGrid = GetItemGrid( item );
388
389 if( GetGridSize( itemGrid ) > GetGridSize( grid ) )
390 grid = itemGrid;
391 }
392
393 return grid;
394}
395
396
398{
399 if( !aItem )
400 return GRID_CURRENT;
401
402 switch( aItem->Type() )
403 {
404 case LIB_SYMBOL_T:
405 case SCH_SYMBOL_T:
406 case SCH_PIN_T:
407 case SCH_SHEET_PIN_T:
408 case SCH_SHEET_T:
409 case SCH_NO_CONNECT_T:
411 case SCH_HIER_LABEL_T:
412 case SCH_LABEL_T:
414 case SCH_RULE_AREA_T:
415 return GRID_CONNECTABLE;
416
417 case SCH_FIELD_T:
418 case SCH_TEXT_T:
419 return GRID_TEXT;
420
421 case SCH_SHAPE_T:
422 // The text box's border lines are what need to be on the graphic grid
423 case SCH_TEXTBOX_T:
424 case SCH_BITMAP_T:
425 return GRID_GRAPHICS;
426
427 case SCH_JUNCTION_T:
428 return GRID_WIRES;
429
430 case SCH_LINE_T:
431 if( static_cast<const SCH_LINE*>( aItem )->IsConnectable() )
432 return GRID_WIRES;
433 else
434 return GRID_GRAPHICS;
435
438 return GRID_WIRES;
439
440 // Groups need to get the grid of their children
441 case SCH_GROUP_T:
442 {
443 const SCH_GROUP* group = static_cast<const SCH_GROUP*>( aItem );
444
445 // Shouldn't happen
446 if( group->GetItems().empty() )
447 return GRID_CURRENT;
448
449 GRID_HELPER_GRIDS grid = GetItemGrid( *group->GetItems().begin() );
450
451 for( EDA_ITEM* item : static_cast<const SCH_GROUP*>( aItem )->GetItems() )
452 {
453 GRID_HELPER_GRIDS itemGrid = GetItemGrid( item );
454
455 if( GetGridSize( itemGrid ) > GetGridSize( grid ) )
456 grid = itemGrid;
457 }
458
459 return grid;
460 }
461
462 default:
463 return GRID_CURRENT;
464 }
465}
466
467
468void EE_GRID_HELPER::computeAnchors( SCH_ITEM *aItem, const VECTOR2I &aRefPos, bool aFrom,
469 bool aIncludeText )
470{
471 bool isGraphicLine =
472 aItem->Type() == SCH_LINE_T && static_cast<SCH_LINE*>( aItem )->IsGraphicLine();
473
474 switch( aItem->Type() )
475 {
476 case SCH_TEXT_T:
477 case SCH_FIELD_T:
478 {
479 if( aIncludeText )
480 addAnchor( aItem->GetPosition(), ORIGIN, aItem );
481
482 break;
483 }
484
485 case SCH_TABLE_T:
486 {
487 if( aIncludeText )
488 {
489 addAnchor( aItem->GetPosition(), SNAPPABLE | CORNER, aItem );
490 addAnchor( static_cast<SCH_TABLE*>( aItem )->GetEnd(), SNAPPABLE | CORNER, aItem );
491 }
492
493 break;
494 }
495
496 case SCH_TEXTBOX_T:
497 case SCH_TABLECELL_T:
498 {
499 if( aIncludeText )
500 {
501 addAnchor( aItem->GetPosition(), SNAPPABLE | CORNER, aItem );
502 addAnchor( static_cast<SCH_SHAPE*>( aItem )->GetEnd(), SNAPPABLE | CORNER, aItem );
503 }
504
505 break;
506 }
507
508 case SCH_SYMBOL_T:
509 case SCH_SHEET_T:
510 addAnchor( aItem->GetPosition(), ORIGIN, aItem );
512
513 case SCH_JUNCTION_T:
514 case SCH_NO_CONNECT_T:
515 case SCH_LINE_T:
516 // Don't add anchors for graphic lines unless we're including text,
517 // they may be on a non-connectable grid
518 if( isGraphicLine && !aIncludeText )
519 break;
520
523 case SCH_HIER_LABEL_T:
524 case SCH_LABEL_T:
527 case SCH_SHEET_PIN_T:
528 {
529 std::vector<VECTOR2I> pts = aItem->GetConnectionPoints();
530
531 for( const VECTOR2I& pt : pts )
532 addAnchor( VECTOR2I( pt ), SNAPPABLE | CORNER, aItem );
533
534 break;
535 }
536 case SCH_PIN_T:
537 {
538 SCH_PIN* pin = static_cast<SCH_PIN*>( aItem );
539 addAnchor( pin->GetPosition(), SNAPPABLE | ORIGIN, aItem );
540 break;
541 }
542
543 case SCH_GROUP_T:
544 for( EDA_ITEM* item : static_cast<SCH_GROUP*>( aItem )->GetItems() )
545 {
546 computeAnchors( static_cast<SCH_ITEM*>( item ), aRefPos, aFrom, aIncludeText );
547 }
548
549 break;
550
551 default:
552 break;
553 }
554
555 // Don't add anchors for graphic lines unless we're including text,
556 // they may be on a non-connectable grid
557 if( aItem->Type() == SCH_LINE_T && ( aIncludeText || !isGraphicLine ) )
558 {
559 SCH_LINE* line = static_cast<SCH_LINE*>( aItem );
560 VECTOR2I pt = Align( aRefPos );
561
562 if( line->GetStartPoint().x == line->GetEndPoint().x )
563 {
564 VECTOR2I possible( line->GetStartPoint().x, pt.y );
565
566 if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
567 addAnchor( possible, SNAPPABLE | VERTICAL, aItem );
568 }
569 else if( line->GetStartPoint().y == line->GetEndPoint().y )
570 {
571 VECTOR2I possible( pt.x, line->GetStartPoint().y );
572
573 if( TestSegmentHit( possible, line->GetStartPoint(), line->GetEndPoint(), 0 ) )
574 addAnchor( possible, SNAPPABLE | HORIZONTAL, aItem );
575 }
576 }
577}
578
579
581 GRID_HELPER_GRIDS aGrid )
582{
583 double minDist = std::numeric_limits<double>::max();
584 ANCHOR* best = nullptr;
585
586 for( ANCHOR& a : m_anchors )
587 {
588 if( ( aFlags & a.flags ) != aFlags )
589 continue;
590
591 // A "virtual" anchor with no real items associated shouldn't be filtered out
592 if( !a.items.empty() )
593 {
594 // Filter using the first item
595 SCH_ITEM* item = static_cast<SCH_ITEM*>( a.items[0] );
596
597 if( aGrid == GRID_CONNECTABLE && !item->IsConnectable() )
598 continue;
599 else if( aGrid == GRID_GRAPHICS && item->IsConnectable() )
600 continue;
601 }
602
603 double dist = a.Distance( aPos );
604
605 if( dist < minDist )
606 {
607 minDist = dist;
608 best = &a;
609 }
610 }
611
612 return best;
613}
constexpr EDA_IU_SCALE schIUScale
Definition: base_units.h:114
WINDOW_SETTINGS m_Window
Definition: app_settings.h:233
bool IsType(FRAME_T aType) const
The base class for create windows for drawing purpose.
A base class for most all the KiCad significant classes used in schematics and boards.
Definition: eda_item.h:98
virtual VECTOR2I GetPosition() const
Definition: eda_item.h:272
KICAD_T Type() const
Returns the type of object.
Definition: eda_item.h:110
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),...
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:185
SNAP_MANAGER & getSnapManager()
Definition: grid_helper.h:214
VECTOR2I m_skipPoint
Definition: grid_helper.h:237
void showConstructionGeometry(bool aShow)
TOOL_MANAGER * m_toolMgr
Definition: grid_helper.h:227
bool m_enableSnapLine
Definition: grid_helper.h:234
bool m_enableSnap
Definition: grid_helper.h:232
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:198
std::optional< ANCHOR > m_snapItem
Definition: grid_helper.h:235
KIGFX::ANCHOR_DEBUG * enableAndGetAnchorDebug()
Enable the anchor debug if permitted and return it.
KIGFX::SNAP_INDICATOR m_viewSnapPoint
Definition: grid_helper.h:239
virtual VECTOR2I Align(const VECTOR2I &aPoint, GRID_HELPER_GRIDS aGrid) const
Definition: grid_helper.h:74
KIGFX::ORIGIN_VIEWITEM m_viewAxis
Definition: grid_helper.h:240
std::vector< ANCHOR > m_anchors
Definition: grid_helper.h:225
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:155
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:66
double GetScale() const
Definition: view.h:276
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
Definition: view.cpp:298
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
Definition: view.cpp:341
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:420
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:1685
GAL * GetGAL() const
Return the #GAL this view is using to draw graphical primitives.
Definition: view.h:202
std::pair< VIEW_ITEM *, int > LAYER_ITEM_PAIR
Definition: view.h:70
bool IsVisible(const VIEW_ITEM *aItem) const
Return information if the item is visible (or not).
Definition: view.cpp:1655
void SetVisible(VIEW_ITEM *aItem, bool aIsVisible=true)
Set the item visibility.
Definition: view.cpp:1612
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:168
virtual bool IsConnectable() const
Definition: sch_item.h:498
bool IsPrivate() const
Definition: sch_item.h:254
virtual std::vector< VECTOR2I > GetConnectionPoints() const
Add all the connection points for this item to aPoints.
Definition: sch_item.h:513
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:42
VECTOR2I GetEndPoint() const
Definition: sch_line.h:144
VECTOR2I GetStartPoint() const
Definition: sch_line.h:139
virtual void Add(EDA_ITEM *aItem)
Definition: selection.cpp:42
EDA_ITEM * Front() const
Definition: selection.h:177
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
TOOLS_HOLDER * GetToolHolder() const
Definition: tool_manager.h:406
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
@ FRAME_SCH_SYMBOL_EDITOR
Definition: frame_type.h:35
GRID_HELPER_GRIDS
Definition: grid_helper.h:43
@ GRID_TEXT
Definition: grid_helper.h:50
@ GRID_CURRENT
Definition: grid_helper.h:45
@ GRID_GRAPHICS
Definition: grid_helper.h:51
@ GRID_CONNECTABLE
Definition: grid_helper.h:47
@ GRID_WIRES
Definition: grid_helper.h:48
@ LAYER_SCHEMATIC_ANCHOR
Definition: layer_ids.h:489
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:400
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:174
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:174
@ SCH_TABLE_T
Definition: typeinfo.h:166
@ SCH_LINE_T
Definition: typeinfo.h:164
@ LIB_SYMBOL_T
Definition: typeinfo.h:149
@ SCH_NO_CONNECT_T
Definition: typeinfo.h:161
@ SCH_SYMBOL_T
Definition: typeinfo.h:173
@ SCH_TABLECELL_T
Definition: typeinfo.h:167
@ SCH_FIELD_T
Definition: typeinfo.h:151
@ SCH_DIRECTIVE_LABEL_T
Definition: typeinfo.h:172
@ SCH_LABEL_T
Definition: typeinfo.h:168
@ SCH_SHEET_T
Definition: typeinfo.h:176
@ SCH_SHAPE_T
Definition: typeinfo.h:150
@ SCH_RULE_AREA_T
Definition: typeinfo.h:171
@ SCH_HIER_LABEL_T
Definition: typeinfo.h:170
@ SCH_BUS_BUS_ENTRY_T
Definition: typeinfo.h:163
@ SCH_SHEET_PIN_T
Definition: typeinfo.h:175
@ SCH_TEXT_T
Definition: typeinfo.h:152
@ SCH_BUS_WIRE_ENTRY_T
Definition: typeinfo.h:162
@ SCH_BITMAP_T
Definition: typeinfo.h:165
@ SCH_TEXTBOX_T
Definition: typeinfo.h:153
@ SCH_GLOBAL_LABEL_T
Definition: typeinfo.h:169
@ SCH_JUNCTION_T
Definition: typeinfo.h:160
@ SCH_PIN_T
Definition: typeinfo.h:154
VECTOR2< int32_t > VECTOR2I
Definition: vector2d.h:695