KiCad PCB EDA Suite
eeschema/autoplace_fields.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) 2015 Chris Pavlina <pavlina.chris@gmail.com>
5  * Copyright (C) 2015, 2019 KiCad Developers, see change_log.txt for contributors.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, you may find one here:
19  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
20  * or you may search the http://www.gnu.org website for the version 2 license,
21  * or you may write to the Free Software Foundation, Inc.,
22  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24 
25 /******************************************************************************
26  * Field autoplacer: Tries to find an optimal place for component fields, and
27  * places them there. There are two modes: "auto"-autoplace, and "manual" autoplace.
28  * Auto mode is for when the process is run automatically, like when rotating parts,
29  * and it avoids doing things that would be helpful for the final positioning but
30  * annoying if they happened without permission.
31  * Short description of the process:
32  *
33  * 1. Compute the dimensions of the fields' bounding box ::ComputeFBoxSize
34  * 2. Determine which side the fields will go on. ::choose_side_for_fields
35  * 1. Sort the four sides in preference order,
36  * depending on the component's shape and
37  * orientation ::get_preferred_sides
38  * 2. If in manual mode, sift out the sides that would
39  * cause fields to overlap other items ::get_colliding_sides
40  * 3. If any remaining sides have zero pins there,
41  * choose the highest zero-pin side according to
42  * preference order.
43  * 4. If all sides have pins, choose the side with the
44  * fewest pins.
45  * 3. Compute the position of the fields' bounding box ::field_box_placement
46  * 4. In manual mode, shift the box vertically if possible
47  * to fit fields between adjacent wires ::fit_fields_between_wires
48  * 5. Move all fields to their final positions
49  * 1. Re-justify fields if options allow that ::justify_field
50  * 2. Round to a 50-mil grid coordinate if desired
51  */
52 
53 #include <boost/range/adaptor/reversed.hpp>
54 
55 #include <sch_edit_frame.h>
56 #include <hotkeys_basic.h>
57 #include <sch_component.h>
58 #include <sch_line.h>
59 #include <lib_pin.h>
60 #include <sch_draw_panel.h>
61 #include <class_libentry.h>
62 #include <eeschema_config.h>
63 #include <kiface_i.h>
64 #include <vector>
65 #include <algorithm>
66 #include <tool/tool_manager.h>
68 
69 #define FIELD_PADDING Mils2iu( 10 ) // arbitrarily chosen for aesthetics
70 #define FIELD_PADDING_ALIGNED Mils2iu( 18 ) // aligns 50 mil text to a 100 mil grid
71 #define WIRE_V_SPACING Mils2iu( 100 )
72 #define HPADDING Mils2iu( 25 )
73 #define VPADDING Mils2iu( 25 )
74 
78 template<typename T> T round_n( const T& value, const T& n, bool aRoundUp )
79 {
80  if( value % n )
81  return n * (value / n + (aRoundUp ? 1 : 0));
82  else
83  return value;
84 }
85 
86 
91 {
92  return static_cast<EDA_TEXT_HJUSTIFY_T>( x );
93 }
94 
95 
97 {
100  std::vector<SCH_FIELD*> m_fields;
101  std::vector<SCH_ITEM*> m_colliders;
103  wxSize m_fbox_size;
106 
107 public:
108  typedef wxPoint SIDE;
111 
113  {
115  unsigned pins;
116  };
117 
119  {
122  };
123 
124 
125  AUTOPLACER( SCH_COMPONENT* aComponent, SCH_SCREEN* aScreen )
126  :m_screen( aScreen ), m_component( aComponent )
127  {
128  m_component->GetFields( m_fields, /* aVisibleOnly */ true );
131 
133  m_fbox_size = ComputeFBoxSize( /* aDynamic */ true );
134 
136 
137  if( aScreen )
139  }
140 
141 
147  void DoAutoplace( bool aManual )
148  {
149  bool force_wire_spacing = false;
150  SIDE field_side = choose_side_for_fields( aManual );
151  wxPoint fbox_pos = field_box_placement( field_side );
152  EDA_RECT field_box( fbox_pos, m_fbox_size );
153 
154  if( aManual )
155  force_wire_spacing = fit_fields_between_wires( &field_box, field_side );
156 
157  // Move the fields
158  int last_y_coord = field_box.GetTop();
159  for( unsigned field_idx = 0; field_idx < m_fields.size(); ++field_idx )
160  {
161  SCH_FIELD* field = m_fields[field_idx];
162 
163  if( m_allow_rejustify )
164  justify_field( field, field_side );
165 
166  wxPoint pos(
167  field_horiz_placement( field, field_box ),
168  field_vert_placement( field, field_box, &last_y_coord, !force_wire_spacing ) );
169 
170  if( m_align_to_grid )
171  {
172  pos.x = round_n( pos.x, Mils2iu( 50 ), field_side.x >= 0 );
173  pos.y = round_n( pos.y, Mils2iu( 50 ), field_side.y == 1 );
174  }
175 
176  field->SetPosition( pos );
177  }
178  }
179 
180 
181 protected:
186  wxSize ComputeFBoxSize( bool aDynamic )
187  {
188  int max_field_width = 0;
189  int total_height = 0;
190 
191  for( SCH_FIELD* field : m_fields )
192  {
193  int field_width;
194  int field_height;
195 
196  if( m_component->GetTransform().y1 )
197  {
198  field->SetTextAngle( TEXT_ANGLE_VERT );
199  }
200  else
201  {
202  field->SetTextAngle( TEXT_ANGLE_HORIZ );
203  }
204 
205  field_width = field->GetBoundingBox().GetWidth();
206  field_height = field->GetBoundingBox().GetHeight();
207 
208  max_field_width = std::max( max_field_width, field_width );
209 
210  if( aDynamic )
211  total_height += field_height + get_field_padding();
212  else
213  total_height += WIRE_V_SPACING;
214 
215  }
216 
217  return wxSize( max_field_width, total_height );
218  }
219 
220 
225  {
226  int pin_orient = aPin->PinDrawOrient( m_component->GetTransform() );
227  switch( pin_orient )
228  {
229  case PIN_RIGHT: return SIDE_LEFT;
230  case PIN_LEFT: return SIDE_RIGHT;
231  case PIN_UP: return SIDE_BOTTOM;
232  case PIN_DOWN: return SIDE_TOP;
233  default:
234  wxFAIL_MSG( "Invalid pin orientation" );
235  return SIDE_LEFT;
236  }
237  }
238 
239 
243  unsigned pins_on_side( SIDE aSide )
244  {
245  unsigned pin_count = 0;
246 
247  std::vector<LIB_PIN*> pins;
248  m_component->GetPins( pins );
249 
250  for( LIB_PIN* each_pin : pins )
251  {
252  if( !each_pin->IsVisible() && !m_power_symbol )
253  continue;
254  if( get_pin_side( each_pin ) == aSide )
255  ++pin_count;
256  }
257 
258  return pin_count;
259  }
260 
261 
267  void get_possible_colliders( std::vector<SCH_ITEM*>& aItems )
268  {
269  wxCHECK_RET( m_screen, "get_possible_colliders() with null m_screen" );
270 
271  for( auto item : m_screen->Items().Overlapping( m_component->GetBoundingBox() ) )
272  {
273  if( SCH_COMPONENT* comp = dynamic_cast<SCH_COMPONENT*>( item ) )
274  {
275  if( comp == m_component )
276  continue;
277 
278  std::vector<SCH_FIELD*> fields;
279  comp->GetFields( fields, /* aVisibleOnly */ true );
280  for( SCH_FIELD* field : fields )
281  aItems.push_back( field );
282  }
283 
284  aItems.push_back( item );
285  }
286  }
287 
288 
293  std::vector<SCH_ITEM*> filtered_colliders( const EDA_RECT& aRect )
294  {
295  std::vector<SCH_ITEM*> filtered;
296  for( SCH_ITEM* item : m_colliders )
297  {
298  EDA_RECT item_box;
299  if( SCH_COMPONENT* item_comp = dynamic_cast<SCH_COMPONENT*>( item ) )
300  item_box = item_comp->GetBodyBoundingBox();
301  else
302  item_box = item->GetBoundingBox();
303 
304  if( item_box.Intersects( aRect ) )
305  filtered.push_back( item );
306  }
307  return filtered;
308  }
309 
310 
315  std::vector<SIDE_AND_NPINS> get_preferred_sides()
316  {
317  SIDE_AND_NPINS sides_init[] = {
322  };
323  std::vector<SIDE_AND_NPINS> sides( sides_init, sides_init + arrayDim( sides_init ) );
324 
325  int orient = m_component->GetOrientation();
326  int orient_angle = orient & 0xff; // enum is a bitmask
327  bool h_mirrored = ( ( orient & CMP_MIRROR_X )
328  && ( orient_angle == CMP_ORIENT_0 || orient_angle == CMP_ORIENT_180 ) );
329  double w = double( m_comp_bbox.GetWidth() );
330  double h = double( m_comp_bbox.GetHeight() );
331 
332  // The preferred-sides heuristics are a bit magical. These were determined mostly
333  // by trial and error.
334 
335  if( m_power_symbol )
336  {
337  // For power symbols, we generally want the label at the top first.
338  switch( orient_angle )
339  {
340  case CMP_ORIENT_0:
341  std::swap( sides[0], sides[1] );
342  std::swap( sides[1], sides[3] );
343  // TOP, BOTTOM, RIGHT, LEFT
344  break;
345  case CMP_ORIENT_90:
346  std::swap( sides[0], sides[2] );
347  std::swap( sides[1], sides[2] );
348  // LEFT, RIGHT, TOP, BOTTOM
349  break;
350  case CMP_ORIENT_180:
351  std::swap( sides[0], sides[3] );
352  // BOTTOM, TOP, LEFT, RIGHT
353  break;
354  case CMP_ORIENT_270:
355  std::swap( sides[1], sides[2] );
356  // RIGHT, LEFT, TOP, BOTTOM
357  break;
358  }
359  }
360  else
361  {
362  // If the component is horizontally mirrored, swap left and right
363  if( h_mirrored )
364  {
365  std::swap( sides[0], sides[2] );
366  }
367 
368  // If the component is very long or is a power symbol, swap H and V
369  if( w/h > 3.0 )
370  {
371  std::swap( sides[0], sides[1] );
372  std::swap( sides[1], sides[3] );
373  }
374  }
375 
376  return sides;
377  }
378 
379 
383  std::vector<SIDE_AND_COLL> get_colliding_sides()
384  {
385  SIDE sides_init[] = { SIDE_RIGHT, SIDE_TOP, SIDE_LEFT, SIDE_BOTTOM };
386  std::vector<SIDE> sides( sides_init, sides_init + arrayDim( sides_init ) );
387  std::vector<SIDE_AND_COLL> colliding;
388 
389  // Iterate over all sides and find the ones that collide
390  for( SIDE side : sides )
391  {
392  EDA_RECT box( field_box_placement( side ), m_fbox_size );
393 
394  COLLISION collision = COLLIDE_NONE;
395  for( SCH_ITEM* collider : filtered_colliders( box ) )
396  {
397  SCH_LINE* line = dynamic_cast<SCH_LINE*>( collider );
398  if( line && !side.x )
399  {
400  wxPoint start = line->GetStartPoint(), end = line->GetEndPoint();
401  if( start.y == end.y && collision != COLLIDE_OBJECTS )
402  collision = COLLIDE_H_WIRES;
403  else
404  collision = COLLIDE_OBJECTS;
405  }
406  else
407  collision = COLLIDE_OBJECTS;
408  }
409 
410  if( collision != COLLIDE_NONE )
411  colliding.push_back( { side, collision } );
412  }
413 
414  return colliding;
415  }
416 
417 
422  SIDE_AND_NPINS choose_side_filtered( std::vector<SIDE_AND_NPINS>& aSides,
423  const std::vector<SIDE_AND_COLL>& aCollidingSides, COLLISION aCollision,
424  SIDE_AND_NPINS aLastSelection)
425  {
426  SIDE_AND_NPINS sel = aLastSelection;
427 
428  std::vector<SIDE_AND_NPINS>::iterator it = aSides.begin();
429  while( it != aSides.end() )
430  {
431  bool collide = false;
432  for( SIDE_AND_COLL collision : aCollidingSides )
433  {
434  if( collision.side == it->side && collision.collision == aCollision )
435  collide = true;
436  }
437  if( !collide )
438  ++it;
439  else
440  {
441  if( it->pins <= sel.pins )
442  {
443  sel.pins = it->pins;
444  sel.side = it->side;
445  }
446  it = aSides.erase( it );
447  }
448  }
449  return sel;
450  }
451 
452 
458  SIDE choose_side_for_fields( bool aAvoidCollisions )
459  {
460  std::vector<SIDE_AND_NPINS> sides = get_preferred_sides();
461 
462  std::reverse( sides.begin(), sides.end() );
463  SIDE_AND_NPINS side = { wxPoint( 1, 0 ), UINT_MAX };
464 
465  if( aAvoidCollisions )
466  {
467  std::vector<SIDE_AND_COLL> colliding_sides = get_colliding_sides();
468  side = choose_side_filtered( sides, colliding_sides, COLLIDE_OBJECTS, side );
469  side = choose_side_filtered( sides, colliding_sides, COLLIDE_H_WIRES, side );
470  }
471 
472  for( SIDE_AND_NPINS& each_side : sides | boost::adaptors::reversed )
473  {
474  if( !each_side.pins ) return each_side.side;
475  }
476 
477  for( SIDE_AND_NPINS& each_side : sides )
478  {
479  if( each_side.pins <= side.pins )
480  {
481  side.pins = each_side.pins;
482  side.side = each_side.side;
483  }
484  }
485 
486  return side.side;
487  }
488 
489 
495  void justify_field( SCH_FIELD* aField, SIDE aFieldSide )
496  {
497  // Justification is set twice to allow IsHorizJustifyFlipped() to work correctly.
498  aField->SetHorizJustify( TO_HJUSTIFY( -aFieldSide.x ) );
499  aField->SetHorizJustify( TO_HJUSTIFY( -aFieldSide.x *
500  ( aField->IsHorizJustifyFlipped() ? -1 : 1 ) ) );
502  }
503 
504 
509  {
510  wxPoint fbox_center = m_comp_bbox.Centre();
511  int offs_x = ( m_comp_bbox.GetWidth() + m_fbox_size.GetWidth() ) / 2 + HPADDING;
512  int offs_y = ( m_comp_bbox.GetHeight() + m_fbox_size.GetHeight() ) / 2 + VPADDING;
513 
514  fbox_center.x += aFieldSide.x * offs_x;
515  fbox_center.y += aFieldSide.y * offs_y;
516 
517  wxPoint fbox_pos(
518  fbox_center.x - m_fbox_size.GetWidth() / 2,
519  fbox_center.y - m_fbox_size.GetHeight() / 2 );
520 
521  return fbox_pos;
522  }
523 
524 
530  {
531  if( aSide != SIDE_TOP && aSide != SIDE_BOTTOM )
532  return false;
533 
534  std::vector<SCH_ITEM*> colliders = filtered_colliders( *aBox );
535  if( colliders.empty() )
536  return false;
537 
538  // Find the offset of the wires for proper positioning
539  int offset = 0;
540 
541  for( SCH_ITEM* item : colliders )
542  {
543  SCH_LINE* line = dynamic_cast<SCH_LINE*>( item );
544  if( !line )
545  return false;
546  wxPoint start = line->GetStartPoint(), end = line->GetEndPoint();
547  if( start.y != end.y )
548  return false;
549 
550  int this_offset = (3 * WIRE_V_SPACING / 2) - ( start.y % WIRE_V_SPACING );
551  if( offset == 0 )
552  offset = this_offset;
553  else if( offset != this_offset )
554  return false;
555  }
556 
557  // At this point we are recomputing the field box size. Do not
558  // return false after this point.
559  m_fbox_size = ComputeFBoxSize( /* aDynamic */ false );
560 
561  wxPoint pos = aBox->GetPosition();
562 
563  // Remove the existing padding to get a bit more space to work with
564  if( aSide == SIDE_BOTTOM )
565  {
567  }
568  else
569  {
571  }
572 
573  pos.y = round_n( pos.y, WIRE_V_SPACING, aSide == SIDE_BOTTOM );
574 
575  aBox->SetOrigin( pos );
576  return true;
577  }
578 
579 
588  int field_horiz_placement( SCH_FIELD *aField, const EDA_RECT &aFieldBox )
589  {
590  int field_hjust;
591  int field_xcoord;
592 
593  if( aField->IsHorizJustifyFlipped() )
594  field_hjust = -aField->GetHorizJustify();
595  else
596  field_hjust = aField->GetHorizJustify();
597 
598  switch( field_hjust )
599  {
601  field_xcoord = aFieldBox.GetLeft();
602  break;
604  field_xcoord = aFieldBox.Centre().x;
605  break;
607  field_xcoord = aFieldBox.GetRight();
608  break;
609  default:
610  wxFAIL_MSG( "Unexpected value for SCH_FIELD::GetHorizJustify()" );
611  field_xcoord = aFieldBox.Centre().x; // Most are centered
612  }
613 
614  return field_xcoord;
615  }
616 
628  int field_vert_placement( SCH_FIELD *aField, const EDA_RECT &aFieldBox, int *aPosAccum,
629  bool aDynamic )
630  {
631  int field_height;
632  int padding;
633 
634  if( aDynamic )
635  {
636  field_height = aField->GetBoundingBox().GetHeight();
637 
638  padding = get_field_padding();
639  }
640  else
641  {
642  field_height = WIRE_V_SPACING / 2;
643  padding = WIRE_V_SPACING / 2;
644  }
645 
646  int placement = *aPosAccum + padding / 2 + field_height / 2;
647 
648  *aPosAccum += padding + field_height;
649 
650  return placement;
651  }
652 
657  {
658  if( m_align_to_grid )
659  return FIELD_PADDING_ALIGNED;
660  else
661  return FIELD_PADDING;
662  }
663 
664 };
665 
670 
671 
672 void SCH_COMPONENT::AutoplaceFields( SCH_SCREEN* aScreen, bool aManual )
673 {
674  if( aManual )
675  wxASSERT_MSG( aScreen, "A SCH_SCREEN pointer must be given for manual autoplacement" );
676  AUTOPLACER autoplacer( this, aScreen );
677  autoplacer.DoAutoplace( aManual );
679 }
#define TEXT_ANGLE_HORIZ
void justify_field(SCH_FIELD *aField, SIDE aFieldSide)
Set the justification of a field based on the side it's supposed to be on, taking into account whethe...
SCH_FIELD instances are attached to a component and provide a place for the component's value,...
Definition: sch_field.h:52
wxSize ComputeFBoxSize(bool aDynamic)
Compute and return the size of the fields' bounding box.
unsigned pins_on_side(SIDE aSide)
Count the number of pins on a side of the component.
std::vector< SCH_FIELD * > m_fields
EDA_TEXT_HJUSTIFY_T
Definition: eda_text.h:44
std::vector< SIDE_AND_COLL > get_colliding_sides()
Return a list of the sides where a field set would collide with another item.
int GetOrientation()
Get the display symbol orientation.
wxPoint GetStartPoint() const
Definition: sch_line.h:97
#define TEXT_ANGLE_VERT
bool collide(T aObject, U aAnotherObject, int aMinDistance)
collide template method
Definition: shape_index.h:92
int GetTop() const
Definition: eda_rect.h:123
int GetLeft() const
Definition: eda_rect.h:122
#define WIRE_V_SPACING
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
EE_TYPE Overlapping(const EDA_RECT &aRect)
Definition: sch_rtree.h:224
SCH_COMPONENT * m_component
#define VPADDING
int GetWidth() const
Definition: eda_rect.h:119
SIDE_AND_NPINS choose_side_filtered(std::vector< SIDE_AND_NPINS > &aSides, const std::vector< SIDE_AND_COLL > &aCollidingSides, COLLISION aCollision, SIDE_AND_NPINS aLastSelection)
Choose a side for the fields, filtered on only one side collision type.
bool IsInNetlist() const
wxPoint field_box_placement(SIDE aFieldSide)
Return the position of the field bounding box.
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:131
Definition: lib_pin.h:55
int PinDrawOrient(const TRANSFORM &aTransform) const
Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT), according to its orientation...
Definition: lib_pin.cpp:1200
#define HPADDING
void GetFields(std::vector< SCH_FIELD * > &aVector, bool aVisibleOnly)
Populates a std::vector with SCH_FIELDs.
int GetBottom() const
Definition: eda_rect.h:124
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
bool fit_fields_between_wires(EDA_RECT *aBox, SIDE aSide)
Shift a field box up or down a bit to make the fields fit between some wires.
int field_horiz_placement(SCH_FIELD *aField, const EDA_RECT &aFieldBox)
Place a field horizontally, taking into account the field width and justification.
int y1
Definition: transform.h:49
static const SIDE SIDE_LEFT
EDA_TEXT_HJUSTIFY_T GetHorizJustify() const
Definition: eda_text.h:183
const wxChar AutoplaceAlignEntry[]
std::vector< SCH_ITEM * > m_colliders
TRANSFORM & GetTransform() const
EDA_RECT GetBodyBoundingBox() const
Return a bounding box for the symbol body but not the fields.
Class LIB_PIN definition.
int field_vert_placement(SCH_FIELD *aField, const EDA_RECT &aFieldBox, int *aPosAccum, bool aDynamic)
Place a field vertically.
EDA_TEXT_HJUSTIFY_T TO_HJUSTIFY(int x)
Convert an integer to a horizontal justification; neg=L zero=C pos=R.
void SetVertJustify(EDA_TEXT_VJUSTIFY_T aType)
Definition: eda_text.h:187
const wxPoint GetPosition() const
Definition: eda_rect.h:115
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
int GetRight() const
Definition: eda_rect.h:121
int GetHeight() const
Definition: eda_rect.h:120
static const SIDE SIDE_RIGHT
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Definition: macros.h:108
SIDE get_pin_side(LIB_PIN *aPin)
Return the side that a pin is on.
T round_n(const T &value, const T &n, bool aRoundUp)
Round up/down to the nearest multiple of n.
void GetPins(std::vector< LIB_PIN * > &aPinsList)
Populate a vector with all the pins from the library object.
void AutoplaceFields(SCH_SCREEN *aScreen, bool aManual)
Automatically orient all the fields in the component.
Segment description base class to describe items which have 2 end points (track, wire,...
Definition: sch_line.h:38
const EDA_RECT GetBoundingBox() const override
Function GetBoundingBox returns the orthogonal, bounding box of this object for display purposes.
Definition: sch_field.cpp:194
void SetHorizJustify(EDA_TEXT_HJUSTIFY_T aType)
Definition: eda_text.h:186
static const SIDE SIDE_BOTTOM
int get_field_padding()
Return the desired padding between fields.
EE_RTREE & Items()
Definition: sch_screen.h:127
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
SCH_COMPONENT describes a real schematic component.
Definition: sch_component.h:89
wxPoint Centre() const
Definition: eda_rect.h:62
bool IsHorizJustifyFlipped() const
Function IsHorizJustifyFlipped Returns whether the field will be rendered with the horizontal justifi...
Definition: sch_field.cpp:240
bool Intersects(const EDA_RECT &aRect) const
Function Intersects tests for a common area between rectangles.
#define FIELD_PADDING
SIDE choose_side_for_fields(bool aAvoidCollisions)
Look where a component's pins are to pick a side to put the fields on.
void DoAutoplace(bool aManual)
Do the actual autoplacement.
#define FIELD_PADDING_ALIGNED
static const SIDE SIDE_TOP
std::vector< SIDE_AND_NPINS > get_preferred_sides()
Return a list with the preferred field sides for the component, in decreasing order of preference.
AUTOPLACER(SCH_COMPONENT *aComponent, SCH_SCREEN *aScreen)
AUTOPLACED m_fieldsAutoplaced
indicates status of field autoplacement
void get_possible_colliders(std::vector< SCH_ITEM * > &aItems)
Populate a list of all drawing items that may collide with the fields.
void SetPosition(const wxPoint &aPosition) override
Function SetPosition set the schematic item position to aPosition.
Definition: sch_field.cpp:479
SCH_ITEM is a base class for any item which can be embedded within the SCHEMATIC container class,...
Definition: sch_item.h:136
const wxChar AutoplaceJustifyEntry[]
std::vector< SCH_ITEM * > filtered_colliders(const EDA_RECT &aRect)
Filter a list of possible colliders to include only those that actually collide with a given rectangl...
wxPoint GetEndPoint() const
Definition: sch_line.h:100