29using namespace std::placeholders;
121 wxCHECK( aRectangle.
GetShape() == SHAPE_T::RECTANGLE, );
129 if( aPoints.
SwapX() )
130 std::swap( topLeft.
x, botRight.
x );
132 if( aPoints.
SwapY() )
133 std::swap( topLeft.
y, botRight.
y );
184 PinEditedCorner( aEditedPoint, aPoints, topLeft, topRight, botLeft, botRight );
192 setLeft( topLeft.
x );
193 setRight( botRight.
x );
194 setBottom( botRight.
y );
200 aRectangle.
Move( moveVector );
208 setLeft( topLeft.
x );
212 setBottom( botRight.
y );
216 setRight( botRight.
x );
219 for(
unsigned i = 0; i < aPoints.
LinesSize(); ++i )
238 if( aPoints.
SwapX() )
239 std::swap( topLeft.
x, botRight.
x );
241 if( aPoints.
SwapY() )
242 std::swap( topLeft.
y, botRight.
y );
263 std::vector<EDA_ITEM*>& aUpdatedItems )
override
284 const VECTOR2I& aHoleSize = { 0, 0 } )
294 aTopLeft.
x = std::min( aTopLeft.
x, aHole.x - aHoleSize.
x / 2 - minWidth );
295 aTopLeft.
y = std::min( aTopLeft.
y, aHole.y - aHoleSize.
y / 2 - minHeight );
300 aTopLeft.
x = std::min( aTopLeft.
x, aBotRight.
x - minWidth );
301 aTopLeft.
y = std::min( aTopLeft.
y, aBotRight.
y - minHeight );
305 aTopRight.
y = aTopLeft.
y;
306 aBotLeft.
x = aTopLeft.
x;
313 aTopRight.
x = std::max( aTopRight.
x, aHole.x + aHoleSize.
x / 2 + minWidth );
314 aTopRight.
y = std::min( aTopRight.
y, aHole.y - aHoleSize.
y / 2 - minHeight );
319 aTopRight.
x = std::max( aTopRight.
x, aBotLeft.
x + minWidth );
320 aTopRight.
y = std::min( aTopRight.
y, aBotLeft.
y - minHeight );
324 aTopLeft.
y = aTopRight.
y;
325 aBotRight.
x = aTopRight.
x;
332 aBotLeft.
x = std::min( aBotLeft.
x, aHole.x - aHoleSize.
x / 2 - minWidth );
333 aBotLeft.
y = std::max( aBotLeft.
y, aHole.y + aHoleSize.
y / 2 + minHeight );
338 aBotLeft.
x = std::min( aBotLeft.
x, aTopRight.
x - minWidth );
339 aBotLeft.
y = std::max( aBotLeft.
y, aTopRight.
y + minHeight );
343 aBotRight.
y = aBotLeft.
y;
344 aTopLeft.
x = aBotLeft.
x;
351 aBotRight.
x = std::max( aBotRight.
x, aHole.x + aHoleSize.
x / 2 + minWidth );
352 aBotRight.
y = std::max( aBotRight.
y, aHole.y + aHoleSize.
y / 2 + minHeight );
357 aBotRight.
x = std::max( aBotRight.
x, aTopLeft.
x + minWidth );
358 aBotRight.
y = std::max( aBotRight.
y, aTopLeft.
y + minHeight );
362 aBotLeft.
y = aBotRight.
y;
363 aTopRight.
x = aBotRight.
x;
367 aTopLeft.
y = std::min( aTopLeft.
y, aBotRight.
y - minHeight );
371 aTopLeft.
x = std::min( aTopLeft.
x, aBotRight.
x - minWidth );
375 aBotRight.
y = std::max( aBotRight.
y, aTopLeft.
y + minHeight );
379 aBotRight.
x = std::max( aBotRight.
x, aTopLeft.
x + minWidth );
428 std::vector<EDA_ITEM*>& aUpdatedItems )
override
439 if(
m_arcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION )
453 if(
m_arcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION )
463 if(
m_arcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION )
490 bool arcValid =
true;
502 else if( aEnd != aArc.
GetEnd() )
537 double det = u1.
x * u2.
y - u2.
x * u1.
y;
544 double tmpx =
v1.
x * u2.
y -
v1.
y * u2.
x;
545 double tmpy = -
v1.
x * u1.
y +
v1.
y * u1.
x;
557 bool transformCircle =
false;
594 transformCircle =
true;
606 if( !std::isfinite(
delta ) )
617 center =
v4 + aCenter;
638 const int c_snapEpsilon_sq = 4;
640 VECTOR2I m = ( aStart / 2 + aEnd / 2 );
641 VECTOR2I perp = ( aEnd - aStart ).Perpendicular().
Resize( INT_MAX / 2 );
643 SEG legal( m - perp, m + perp );
645 const SEG testSegments[] = {
SEG( aCenter, aCenter +
VECTOR2( 1, 0 ) ),
648 std::vector<VECTOR2I> points = { legal.
A, legal.
B };
650 for(
const SEG& seg : testSegments )
655 points.push_back( *vec );
664 SEG::ecoord d_sq = ( pt - aCenter ).SquaredEuclideanNorm();
666 if( d_sq < min_d_sq - c_snapEpsilon_sq )
709 if( p1.
x == 0 && p1.
y == 0 )
710 p1 = prev_p1 - aCenter;
712 if( p2.
x == 0 && p2.
y == 0 )
717 if( radius < minRadius )
720 p1 = aCenter + p1.
Resize( radius );
721 p2 = aCenter + p2.
Resize( radius );
745 SEG chord( aStart, aEnd );
752 double radius = ( aCursor - aCenter ).EuclideanNorm();
754 if( radius < minRadius )
757 start = start.
Resize( radius );
758 end = end.
Resize( radius );
760 start = start + aCenter;
778 const int JUST_OFF = ( aStart - aEnd ).EuclideanNorm() / 100;
802 std::vector<EDA_ITEM*>& aUpdatedItems )
override
865 std::vector<EDA_ITEM*>& aUpdatedItems )
override
881 const VECTOR2I newOffset = xfrmOrigin - ( topLeft + botRight ) / 2;
896 oldCorner -= oldSize / 2;
900 newCorner = topRight;
901 oldCorner -=
VECTOR2I( -oldSize.
x, oldSize.
y ) / 2;
906 oldCorner -=
VECTOR2I( oldSize.
x, -oldSize.
y ) / 2;
910 newCorner = botRight;
911 oldCorner += oldSize / 2;
917 *newCorner -= xfrmOrigin;
918 oldCorner -= oldOrigin;
921 if(
sign( newCorner->x ) !=
sign( oldCorner.
x )
922 ||
sign( newCorner->y ) !=
sign( oldCorner.
y ) )
927 const double newLength = newCorner->EuclideanNorm();
930 double ratio = oldLength > 0 ? ( newLength / oldLength ) : 1.0;
936 ratio = std::min( newWidth / oldSize.
x, newHeight / oldSize.
y );
958 std::vector<EDA_ITEM*>& aUpdatedItems )
override
964 aUpdatedItems.push_back( &table );
1016 case PAD_SHAPE::CIRCLE:
1020 case PAD_SHAPE::OVAL:
1021 case PAD_SHAPE::TRAPEZOID:
1022 case PAD_SHAPE::RECTANGLE:
1023 case PAD_SHAPE::ROUNDRECT:
1024 case PAD_SHAPE::CHAMFERED_RECT:
1030 std::swap( halfSize.
x, halfSize.
y );
1033 aPoints.
AddPoint( shapePos - halfSize );
1035 aPoints.
AddPoint( shapePos + halfSize );
1054 case PAD_SHAPE::CIRCLE:
1056 int target =
locked ? 0 : 1;
1064 else if( target == 1 )
1066 shapePos.
x += halfSize.
x;
1072 case PAD_SHAPE::OVAL:
1073 case PAD_SHAPE::TRAPEZOID:
1074 case PAD_SHAPE::RECTANGLE:
1075 case PAD_SHAPE::ROUNDRECT:
1076 case PAD_SHAPE::CHAMFERED_RECT:
1086 else if( target == 4 )
1089 std::swap( halfSize.
x, halfSize.
y );
1094 VECTOR2I( shapePos.
x + halfSize.
x, shapePos.
y - halfSize.
y ) );
1098 VECTOR2I( shapePos.
x - halfSize.
x, shapePos.
y + halfSize.
y ) );
1110 std::vector<EDA_ITEM*>& aUpdatedItems )
override
1114 case PAD_SHAPE::CIRCLE:
1123 case PAD_SHAPE::OVAL:
1124 case PAD_SHAPE::TRAPEZOID:
1125 case PAD_SHAPE::RECTANGLE:
1126 case PAD_SHAPE::ROUNDRECT:
1127 case PAD_SHAPE::CHAMFERED_RECT:
1137 topRight, botLeft, botRight, holeCenter,
1152 dist[0] = center.
x - topLeft.
x;
1153 dist[1] = center.
y - topLeft.
y;
1154 dist[2] = botRight.
x - center.
x;
1155 dist[3] = botRight.
y - center.
y;
1159 dist[0] = center.
x - botLeft.
x;
1160 dist[1] = center.
y - topRight.
y;
1161 dist[2] = topRight.
x - center.
x;
1162 dist[3] = botLeft.
y - center.
y;
1165 VECTOR2I padSize( dist[0] + dist[2], dist[1] + dist[3] );
1166 VECTOR2I deltaOffset( padSize.
x / 2 - dist[2], padSize.
y / 2 - dist[3] );
1169 std::swap( padSize.
x, padSize.
y );
1188 bottom = botRight.
y;
1201 std::swap( padSize.
x, padSize.
y );
1240 std::vector<EDA_ITEM*>& aUpdatedItems )
override
1263 m_oldCrossBar(
SEG{ aDimension.GetCrossbarStart(), aDimension.GetCrossbarEnd() } )
1283 if( oldJustify == GR_TEXT_H_ALIGN_T::GR_TEXT_H_ALIGN_LEFT
1284 || oldJustify == GR_TEXT_H_ALIGN_T::GR_TEXT_H_ALIGN_RIGHT )
1287 const VECTOR2I newProject = newCrossBar.LineProject( newTextPos );
1289 const VECTOR2I oldProjectedOffset =
1291 const VECTOR2I newProjectedOffset = newProject - newCrossBar.NearestPoint( newProject );
1293 const bool textWasLeftOf = oldProjectedOffset.
x < 0
1294 || ( oldProjectedOffset.
x == 0 && oldProjectedOffset.
y > 0 );
1295 const bool textIsLeftOf = newProjectedOffset.
x < 0
1296 || ( newProjectedOffset.
x == 0 && newProjectedOffset.
y > 0 );
1298 if( textWasLeftOf != textIsLeftOf )
1302 ( oldJustify == GR_TEXT_H_ALIGN_T::GR_TEXT_H_ALIGN_LEFT )
1303 ? GR_TEXT_H_ALIGN_T::GR_TEXT_H_ALIGN_RIGHT
1304 : GR_TEXT_H_ALIGN_T::GR_TEXT_H_ALIGN_LEFT );
1319 const EDA_ANGLE rotation = oldAngle - newAngle;
1324 const VECTOR2I cbNearestEndToText =
1326 const VECTOR2I rotTextOffsetFromCbCenter =
1328 const VECTOR2I rotTextOffsetFromCbEnd =
1333 const bool startIsInOffsetDirection =
1335 rotTextOffsetFromCbCenter, newCrossBar.Center() );
1341 return newCbRefPt + rotTextOffsetFromCbEnd;
1348 const double oldRatio =
1356 const VECTOR2I newProjected = newCrossBar.A + ( newCrossBar.B - newCrossBar.A ) * oldRatio;
1357 return newProjected + rotCbNormalToText;
1411 std::vector<EDA_ITEM*>& aUpdatedItems )
override
1449 if( featureLine.
Cross( crossBar ) > 0 )
1461 if( featureLine.
Cross( crossBar ) > 0 )
1521 VECTOR2I direction = ( directionA < directionB ) ? directionA : directionB;
1527 if( !bounds.
Contains( cursorPos ) )
1603 std::vector<EDA_ITEM*>& aUpdatedItems )
override
1621 return std::nullopt;
1666 std::vector<EDA_ITEM*>& aUpdatedItems )
override
1720 return std::nullopt;
1758 std::vector<EDA_ITEM*>& aUpdatedItems )
override
1812 ? TEXTBOX_POINT_COUNT::WHEN_RECTANGLE
1813 : TEXTBOX_POINT_COUNT::WHEN_POLYGON;
1835 std::vector<EDA_ITEM*>& aUpdatedItems )
override
1850 m_selectionTool( nullptr ), m_editedPoint( nullptr ),
1851 m_hoveredPoint( nullptr ), m_original(
VECTOR2I( 0, 0 ) ),
1853 m_altConstrainer(
VECTOR2I( 0, 0 ) ), m_inPointEditorTool( false )
1860 m_frame = getEditFrame<PCB_BASE_FRAME>();
1872 wxASSERT_MSG(
m_selectionTool, wxT(
"pcbnew.InteractiveSelection tool is not available" ) );
1886 std::shared_ptr<EDIT_POINTS> points = std::make_shared<EDIT_POINTS>( aItem );
1894 switch( aItem->
Type() )
1899 m_editorBehavior = std::make_unique<REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR>( refImage );
1905 m_editorBehavior = std::make_unique<TEXTBOX_POINT_EDIT_BEHAVIOR>( textbox );
1914 case SHAPE_T::SEGMENT:
1915 m_editorBehavior = std::make_unique<EDA_SEGMENT_POINT_EDIT_BEHAVIOR>( *shape );
1917 case SHAPE_T::RECTANGLE:
1918 m_editorBehavior = std::make_unique<RECTANGLE_POINT_EDIT_BEHAVIOR>( *shape );
1925 case SHAPE_T::CIRCLE:
1926 m_editorBehavior = std::make_unique<EDA_CIRCLE_POINT_EDIT_BEHAVIOR>( *shape );
1930 m_editorBehavior = std::make_unique<EDA_POLYGON_POINT_EDIT_BEHAVIOR>( *shape );
1933 case SHAPE_T::BEZIER:
1934 m_editorBehavior = std::make_unique<EDA_BEZIER_POINT_EDIT_BEHAVIOR>( *shape );
1947 m_editorBehavior = std::make_unique<PCB_TABLECELL_POINT_EDIT_BEHAVIOR>( *cell );
1970 ZONE& zone =
static_cast<ZONE&
>( *aItem );
1978 m_editorBehavior = std::make_unique<GENERATOR_POINT_EDIT_BEHAVIOR>( *generator );
1986 m_editorBehavior = std::make_unique<ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR>( dimension );
1993 m_editorBehavior = std::make_unique<DIM_CENTER_POINT_EDIT_BEHAVIOR>( dimension );
2000 m_editorBehavior = std::make_unique<DIM_RADIAL_POINT_EDIT_BEHAVIOR>( dimension );
2007 m_editorBehavior = std::make_unique<DIM_LEADER_POINT_EDIT_BEHAVIOR>( dimension );
2092 std::vector<std::unique_ptr<BOARD_ITEM>> clones;
2107 bool inDrag =
false;
2108 bool useAltContraint =
false;
2116 grid.SetUseGrid(
getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
2147 frame()->UndoRedoBlock(
true );
2166 for(
size_t ii = 0; ii <
m_editPoints->PointsSize(); ++ii )
2179 clones.emplace_back( clone );
2180 grid.AddConstructionItems( { clone },
false, true );
2196 if(
grid.GetUseGrid() )
2203 VECTOR2I deltaGrid = gridPt -
grid.BestSnapAnchor( last, {},
2204 grid.GetItemGrid( item ),
2207 if( abs(
delta.x ) >
grid.GetGrid().x / 2 )
2208 pos.
x = last.
x + deltaGrid.
x;
2212 if( abs(
delta.y ) >
grid.GetGrid().y / 2 )
2213 pos.
y = last.
y + deltaGrid.
y;
2222 if( useAltContraint )
2234 grid.GetItemGrid( item ),
2246 for(
size_t ii = 0; ii <
m_editPoints->PointsSize(); ++ii )
2256 else if( inDrag && evt->IsMouseUp(
BUT_LEFT ) )
2275 commit.
Push(
_(
"Resize Table Cells" ) );
2279 commit.
Push(
_(
"Move Point" ) );
2283 frame()->UndoRedoBlock(
false );
2288 else if( evt->IsCancelInteractive() || evt->IsActivate() )
2300 frame()->UndoRedoBlock(
false );
2306 if( evt->IsActivate() && !evt->IsMoveTool() )
2325 evt->SetPassEvent();
2360 title =
_(
"Move Midpoint to Location" );
2361 msg =
_(
"Move Midpoint" );
2365 title =
_(
"Move Corner to Location" );
2366 msg =
_(
"Move Corner" );
2392 std::vector<EDA_ITEM*> updatedItems = { item };
2403 switch( item->
Type() )
2414 if(
pad->IsEntered() )
2421 textBox->ClearRenderCache();
2437 for(
EDA_ITEM* previewItem : generatorItem->GetPreviewItems( generatorTool,
frame(),
2451 for(
EDA_ITEM* updatedItem : updatedItems )
2456 frame()->SetMsgPanel( item );
2484 frame()->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
2490 if(
frame()->ToolStackIsEmpty() )
2508 switch( parent->
Type() )
2515 isPoly =
static_cast<PCB_SHAPE*
>( parent )->GetShape() == SHAPE_T::POLY;
2523 if( line && isPoly )
2560 const auto type = aItem.
Type();
2570 return shapeType == SHAPE_T::SEGMENT || shapeType == SHAPE_T::POLY
2571 || shapeType == SHAPE_T::ARC;
2580 if( aSelection.
Size() != 1 )
2590static std::pair<bool, SHAPE_POLY_SET::VERTEX_INDEX>
2595 auto vertexIdx = it.GetIndex();
2598 return std::make_pair(
true, vertexIdx );
2616 switch( item->
Type() )
2619 polyset =
static_cast<ZONE*
>( item )->Outline();
2677 unsigned int nearestIdx = 0;
2678 unsigned int nextNearestIdx = 0;
2679 unsigned int nearestDist = INT_MAX;
2680 unsigned int firstPointInContour = 0;
2685 ZONE* zone =
static_cast<ZONE*
>( item );
2686 zoneOutline = zone->
Outline();
2705 for( ; iterator; iterator++, curr_idx++ )
2707 int jj = curr_idx+1;
2711 jj = firstPointInContour;
2712 firstPointInContour = curr_idx+1;
2715 SEG curr_segment( zoneOutline->
CVertex( curr_idx ), zoneOutline->
CVertex( jj ) );
2722 nearestIdx = curr_idx;
2723 nextNearestIdx = jj;
2730 SEG nearestSide( sideOrigin, sideEnd );
2735 if( nearestPoint == sideOrigin || nearestPoint == sideEnd )
2736 nearestPoint = ( sideOrigin + sideEnd ) / 2;
2738 zoneOutline->
InsertVertex( nextNearestIdx, nearestPoint );
2744 commit.
Push(
_(
"Add Zone Corner" ) );
2746 else if( graphicItem )
2750 case SHAPE_T::SEGMENT:
2752 commit.
Modify( graphicItem );
2758 graphicItem->
SetEnd( nearestPoint );
2764 newSegment->
SetStart( nearestPoint );
2767 commit.
Add( newSegment );
2768 commit.
Push(
_(
"Split Segment" ) );
2773 commit.
Modify( graphicItem );
2776 graphicItem->
GetEnd(), 0 );
2780 graphicItem->
SetEnd( nearestPoint );
2789 commit.
Add( newArc );
2790 commit.
Push(
_(
"Split Arc" ) );
2818 ZONE* zone =
static_cast<ZONE*
>( item );
2826 if( shape->
GetShape() == SHAPE_T::POLY )
2839 const auto& vertexIdx = vertex.second;
2840 auto& outline = polygon->
Polygon( vertexIdx.m_polygon )[vertexIdx.m_contour];
2842 if( outline.PointCount() > 3 )
2851 if( vertexIdx.m_contour > 0 )
2867 commit.
Push(
_(
"Remove Zone Corner" ) );
2869 commit.
Push(
_(
"Remove Polygon Corner" ) );
2873 static_cast<ZONE*
>( item )->HatchBorder();
2896 ZONE* zone =
static_cast<ZONE*
>( item );
2904 if( shape->
GetShape() == SHAPE_T::POLY )
2917 unsigned int nearestIdx = 0;
2918 unsigned int nearestDist = INT_MAX;
2926 for( ; iterator; iterator++, curr_idx++ )
2933 nearestIdx = curr_idx;
2937 int prevIdx, nextIdx;
2945 setback = std::min( setback, (
int) ( segA.Length() * 0.8 ) );
2946 setback = std::min( setback, (
int) ( segB.Length() * 0.8 ) );
2950 std::optional<CHAMFER_RESULT> chamferResult =
2953 if( chamferResult && chamferResult->m_updated_seg_a && chamferResult->m_updated_seg_b )
2959 polygon->
InsertVertex( nearestIdx, chamferResult->m_updated_seg_b->B );
2960 polygon->
InsertVertex( nearestIdx, chamferResult->m_updated_seg_a->B );
2967 commit.
Push(
_(
"Break Zone Corner" ) );
2969 commit.
Push(
_(
"Break Polygon Corner" ) );
2973 static_cast<ZONE*
>( item )->HatchBorder();
3001 case ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS:
3002 m_arcEditMode = ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
3004 case ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION:
3005 m_arcEditMode = ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
ARC_EDIT_MODE
Settings for arc editing.
@ KEEP_CENTER_ADJUST_ANGLE_RADIUS
constexpr EDA_IU_SCALE pcbIUScale
static TOOL_ACTION cycleArcEditMode
static TOOL_ACTION activatePointEditor
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
This covers both aligned and the orthogonal sub-type.
PCB_DIM_ALIGNED & m_dimension
void updateOrthogonalDimension(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints)
Update orthogonal dimension points.
ALIGNED_DIMENSION_POINT_EDIT_BEHAVIOR(PCB_DIM_ALIGNED &aDimension)
void updateAlignedDimension(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints)
Update non-orthogonal dimension points.
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
OPT_VECTOR2I Get45DegreeConstrainer(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints) const override
Get the 45-degree constrainer for the item, when the given point is moved.
void editArcMidKeepCenter(PCB_SHAPE &aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor)
Move the mid point of the arc, while keeping the two endpoints.
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
static void editArcEndpointKeepCenter(PCB_SHAPE &aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor)
Move an end point of the arc around the circumference.
static void editArcCenterKeepEndpoints(PCB_SHAPE &aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Move the arc center but keep endpoint locations.
static void editArcMidKeepEndpoints(PCB_SHAPE &aArc, const VECTOR2I &aStart, const VECTOR2I &aEnd, const VECTOR2I &aCursor)
Move the mid point of the arc, while keeping the angle.
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
KIGFX::VIEW_CONTROLS & m_viewControls
OPT_VECTOR2I Get45DegreeConstrainer(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints) const override
Get the 45-degree constrainer for the item, when the given point is moved.
const ARC_EDIT_MODE & m_arcEditMode
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
ARC_POINT_EDIT_BEHAVIOR(PCB_SHAPE &aArc, const ARC_EDIT_MODE &aArcEditMode, KIGFX::VIEW_CONTROLS &aViewContols)
static void editArcEndpointKeepTangent(PCB_SHAPE &aArc, const VECTOR2I &aCenter, const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd, const VECTOR2I &aCursor)
Move an end point of the arc, while keeping the tangent at the other endpoint.
virtual void Push(const wxString &aMessage=wxEmptyString, int aCommitFlags=0) override
Revert the commit by restoring the modified items state.
COMMIT & Stage(EDA_ITEM *aItem, CHANGE_TYPE aChangeType, BASE_SCREEN *aScreen=nullptr) override
virtual void Revert() override
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
void SetParentGroup(PCB_GROUP *aGroup)
virtual BOARD_ITEM * Duplicate() const
Create a copy of this BOARD_ITEM.
FOOTPRINT * GetParentFootprint() const
virtual LSET GetLayerSet() const
Return a std::bitset of all layers on which the item physically resides.
virtual bool IsLocked() const
BOARD_ITEM_CONTAINER * GetParent() const
constexpr size_type GetWidth() const
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr bool Contains(const Vec &aPoint) const
constexpr coord_type GetRight() const
constexpr coord_type GetTop() const
constexpr coord_type GetBottom() const
Represent a set of changes (additions, deletions or modifications) of a data model (e....
COMMIT & Remove(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been removed.
COMMIT & Modify(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Create an undo entry for an item that has been already modified.
COMMIT & Add(EDA_ITEM *aItem, BASE_SCREEN *aScreen=nullptr)
Notify observers that aItem has been added.
Class to help update the text position of a dimension when the crossbar changes.
DIM_ALIGNED_TEXT_UPDATER(PCB_DIM_ALIGNED &aDimension)
VECTOR2I getDimensionNewTextPosition()
PCB_DIM_ALIGNED & m_dimension
const VECTOR2I m_originalTextPos
void UpdateTextAfterChange()
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
PCB_DIM_CENTER & m_dimension
OPT_VECTOR2I Get45DegreeConstrainer(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints) const override
Get the 45-degree constrainer for the item, when the given point is moved.
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
DIM_CENTER_POINT_EDIT_BEHAVIOR(PCB_DIM_CENTER &aDimension)
DIM_LEADER_POINT_EDIT_BEHAVIOR(PCB_DIM_LEADER &aDimension)
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
PCB_DIM_LEADER & m_dimension
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
DIM_RADIAL_POINT_EDIT_BEHAVIOR(PCB_DIM_RADIAL &aDimension)
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
OPT_VECTOR2I Get45DegreeConstrainer(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints) const override
Get the 45-degree constrainer for the item, when the given point is moved.
PCB_DIM_RADIAL & m_dimension
EDIT_CONSTRAINT that imposes a constraint that two points have to be located at angle of 45 degree mu...
EDIT_CONSTRAINT for 3 segments: dragged and two adjacent ones, enforcing to keep their slopes and all...
EDIT_CONSTRAINT that imposes a constraint that a point has to lie on a line (determined by 2 points).
EDIT_CONSTRAINT for a EDIT_LINE, that constrains the line to move perpendicular to the line itself.
bool IsType(FRAME_T aType) const
A base class for most all the KiCad significant classes used in schematics and boards.
EDA_ITEM_FLAGS GetEditFlags() const
KICAD_T Type() const
Returns the type of object.
virtual void SetParent(EDA_ITEM *aParent)
virtual EDA_ITEM * Clone() const
Create a duplicate of this item with linked list members set to NULL.
void SetCenter(const VECTOR2I &aCenter)
virtual VECTOR2I GetTopLeft() const
int GetRectangleWidth() const
SHAPE_POLY_SET & GetPolyShape()
virtual VECTOR2I GetBotRight() const
virtual void SetBottom(int val)
virtual void SetTop(int val)
const VECTOR2I & GetEnd() const
Return the ending point of the graphic.
void SetStart(const VECTOR2I &aStart)
const VECTOR2I & GetStart() const
Return the starting point of the graphic.
void SetEnd(const VECTOR2I &aEnd)
void SetArcGeometry(const VECTOR2I &aStart, const VECTOR2I &aMid, const VECTOR2I &aEnd)
Set the three controlling points for an arc.
virtual void SetLeft(int val)
int GetRectangleHeight() const
virtual void SetRight(int val)
VECTOR2I GetArcMid() const
"Standard" table-cell editing behavior.
const VECTOR2I & GetTextPos() const
void SetTextPos(const VECTOR2I &aPoint)
GR_TEXT_H_ALIGN_T GetHorizJustify() const
void SetHorizJustify(GR_TEXT_H_ALIGN_T aType)
Describe constraints between two edit handles.
Represent a line connecting two EDIT_POINTs.
void SetConstraint(EDIT_CONSTRAINT< EDIT_LINE > *aConstraint)
Set a constraint for and EDIT_POINT.
EDIT_POINTS is a VIEW_ITEM that manages EDIT_POINTs and EDIT_LINEs and draws them.
unsigned int PointsSize() const
Return number of stored EDIT_POINTs.
void AddPoint(const EDIT_POINT &aPoint)
Add an EDIT_POINT.
void SetSwapY(bool aSwap)
void Clear()
Clear all stored EDIT_POINTs and EDIT_LINEs.
EDIT_LINE & Line(unsigned int aIndex)
void AddIndicatorLine(EDIT_POINT &aOrigin, EDIT_POINT &aEnd)
Adds an EDIT_LINE that is shown as an indicator, rather than an editable line (no center point drag,...
void SetSwapX(bool aSwap)
unsigned int LinesSize() const
Return number of stored EDIT_LINEs.
EDIT_POINT & Point(unsigned int aIndex)
void AddLine(const EDIT_LINE &aLine)
Adds an EDIT_LINE.
Represent a single point that can be used for modifying items.
int GetY() const
Return Y coordinate of an EDIT_POINT.
SNAP_CONSTRAINT_TYPE GetSnapConstraint() const
virtual void SetPosition(const VECTOR2I &aPosition)
Set new coordinates for an EDIT_POINT.
virtual VECTOR2I GetPosition() const
Return coordinates of an EDIT_POINT.
void SetSnapConstraint(SNAP_CONSTRAINT_TYPE aConstraint)
virtual void ApplyConstraint(const GRID_HELPER &aGrid)
Correct coordinates of an EDIT_POINT by applying previously set constraint.
void SetHover(bool aHover=true)
bool IsConstrained() const
Check if point is constrained.
void SetConstraint(EDIT_CONSTRAINT< EDIT_POINT > *aConstraint)
Set a constraint for and EDIT_POINT.
int GetX() const
Return X coordinate of an EDIT_POINT.
void SetActive(bool aActive=true)
GRID_CONSTRAINT_TYPE GetGridConstraint() const
static const TOOL_EVENT InhibitSelectionEditing
static const TOOL_EVENT SelectedEvent
static const TOOL_EVENT SelectedItemsModified
Selected items were moved, this can be very high frequency on the canvas, use with care.
static const TOOL_EVENT UninhibitSelectionEditing
Used to inform tool that it should display the disambiguation menu.
static const TOOL_EVENT PointSelectedEvent
static const TOOL_EVENT SelectedItemsMoved
Used to inform tools that the selection should temporarily be non-editable.
static const TOOL_EVENT UnselectedEvent
Point editor behavior for the PCB_GENERATOR class.
PCB_GENERATOR & m_generator
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
GENERATOR_POINT_EDIT_BEHAVIOR(PCB_GENERATOR &aGenerator)
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
An interface for classes handling user events controlling the view behavior such as zooming,...
virtual void ForceCursorPosition(bool aEnabled, const VECTOR2D &aPosition=VECTOR2D(0, 0))
Place the cursor immediately at a given point.
virtual void ShowCursor(bool aEnabled)
Enable or disables display of cursor.
VECTOR2D GetCursorPosition() const
Return the current cursor position in world coordinates.
virtual void SetAutoPan(bool aEnabled)
Turn on/off auto panning (this feature is used when there is a tool active (eg.
void FreeItems()
Free all the items that were added to the group.
virtual void Add(VIEW_ITEM *aItem, int aDrawPriority=-1)
Add a VIEW_ITEM to the view.
virtual void Remove(VIEW_ITEM *aItem)
Remove a VIEW_ITEM from the view.
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...
LSET is a set of PCB_LAYER_IDs.
static LSET AllLayersMask()
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
PAD_POINT_EDIT_BEHAVIOR(PAD &aPad, PCB_LAYER_ID aLayer)
const VECTOR2I & GetDrillSize() const
bool IsLocked() const override
VECTOR2I GetPosition() const override
PAD_SHAPE GetShape(PCB_LAYER_ID aLayer) const
void SetOffset(PCB_LAYER_ID aLayer, const VECTOR2I &aOffset)
void SetPosition(const VECTOR2I &aPos) override
const VECTOR2I & GetOffset(PCB_LAYER_ID aLayer) const
EDA_ANGLE GetOrientation() const
Return the rotation angle of the pad.
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
VECTOR2I ShapePos(PCB_LAYER_ID aLayer) const
const VECTOR2I & GetSize(PCB_LAYER_ID aLayer) const
ARC_EDIT_MODE m_ArcEditMode
static TOOL_ACTION pointEditorArcKeepCenter
static TOOL_ACTION layerChanged
static TOOL_ACTION pointEditorMoveMidpoint
static TOOL_ACTION genPushEdit
static TOOL_ACTION genStartEdit
static TOOL_ACTION selectionClear
Clear the current selection.
static TOOL_ACTION pointEditorMoveCorner
static TOOL_ACTION genUpdateEdit
static TOOL_ACTION pointEditorArcKeepEndpoint
static TOOL_ACTION pointEditorChamferCorner
static TOOL_ACTION pointEditorRemoveCorner
static TOOL_ACTION pointEditorAddCorner
static TOOL_ACTION reselectItem
static TOOL_ACTION genRevertEdit
Common, abstract interface for edit frames.
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
ORIGIN_TRANSFORMS & GetOriginTransforms() override
Return a reference to the default ORIGIN_TRANSFORMS object.
PCBNEW_SETTINGS * GetPcbNewSettings() const
virtual PCB_LAYER_ID GetActiveLayer() const
virtual MAGNETIC_SETTINGS * GetMagneticItemsSettings()
FOOTPRINT_EDITOR_SETTINGS * GetFootprintEditorSettings() const
void Update()
Update the dimension's cached text and geometry.
void SetTextPositionMode(DIM_TEXT_POSITION aMode)
virtual const VECTOR2I & GetStart() const
The dimension's origin is the first feature point for the dimension.
virtual void SetEnd(const VECTOR2I &aPoint)
virtual void SetStart(const VECTOR2I &aPoint)
virtual const VECTOR2I & GetEnd() const
For better understanding of the points that make a dimension:
const VECTOR2I & GetCrossbarStart() const
const VECTOR2I & GetCrossbarEnd() const
void SetHeight(int aHeight)
Set the distance from the feature points to the crossbar line.
Mark the center of a circle or arc with a cross shape.
A leader is a dimension-like object pointing to a specific point.
An orthogonal dimension is like an aligned dimension, but the extension lines are locked to the X or ...
void SetOrientation(DIR aOrientation)
Set the orientation of the dimension line (so, perpendicular to the feature lines).
DIR GetOrientation() const
A radial dimension indicates either the radius or diameter of an arc or circle.
void SetLeaderLength(int aLength)
virtual bool UpdateFromEditPoints(EDIT_POINTS &aEditPoints)
virtual bool MakeEditPoints(EDIT_POINTS &aEditPoints) const
virtual bool UpdateEditPoints(EDIT_POINTS &aEditPoints)
int changeArcEditMode(const TOOL_EVENT &aEvent)
void updateItem(BOARD_COMMIT &aCommit)
Update edit points with item's points.
int OnSelectionChange(const TOOL_EVENT &aEvent)
Change selection event handler.
void setAltConstraint(bool aEnabled)
Return a point that should be used as a constrainer for 45 degrees mode.
static const unsigned int COORDS_PADDING
bool removeCornerCondition(const SELECTION &aSelection)
EDIT_POINT * m_hoveredPoint
int addCorner(const TOOL_EVENT &aEvent)
bool HasPoint()
Indicate the cursor is over an edit point.
EDIT_POINT m_original
Original pos for the current drag point.
EDIT_POINT get45DegConstrainer() const
Condition to display "Create corner" context menu entry.
int modifiedSelection(const TOOL_EVENT &aEvent)
Change the edit method for arcs.
void Reset(RESET_REASON aReason) override
Bring the tool to a known, initial state.
std::unique_ptr< POINT_EDIT_BEHAVIOR > m_editorBehavior
int removeCorner(const TOOL_EVENT &aEvent)
static bool canAddCorner(const EDA_ITEM &aItem)
Condition to display "Remove corner" context menu entry.
bool Init() override
Init() is called once upon a registration of the tool.
int movePoint(const TOOL_EVENT &aEvent)
TOOL_ACTION handlers.
void setEditedPoint(EDIT_POINT *aPoint)
EDIT_POINT m_altConstrainer
ARC_EDIT_MODE m_arcEditMode
EDIT_POINT * m_editedPoint
void updateEditedPoint(const TOOL_EVENT &aEvent)
Set the current point being edited. NULL means none.
std::shared_ptr< EDIT_CONSTRAINT< EDIT_POINT > > m_altConstraint
void updatePoints()
Update which point is being edited.
int chamferCorner(const TOOL_EVENT &aEvent)
static bool addCornerCondition(const SELECTION &aSelection)
Determine if the tool can currently add a corner to the given item.
void setTransitions() override
< Set up handlers for various events.
std::shared_ptr< EDIT_POINTS > m_editPoints
std::shared_ptr< EDIT_POINTS > makePoints(EDA_ITEM *aItem)
Update item's points with edit points.
PCB_SELECTION_TOOL * m_selectionTool
Object to handle a bitmap image that can be inserted in a PCB.
VECTOR2I GetPosition() const override
Get the position of the image (this is the center of the image).
REFERENCE_IMAGE & GetReferenceImage()
VECTOR2I GetCenter() const override
This defaults to the center of the bounding box if not overridden.
bool IsProxyItem() const override
void Move(const VECTOR2I &aMoveVector) override
Move this object.
PCB_TABLECELL_POINT_EDIT_BEHAVIOR(PCB_TABLECELL &aCell)
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
void SetColWidth(int aCol, int aWidth)
void Normalize() override
Perform any normalization required after a user rotate and/or flip.
int GetColWidth(int aCol) const
void SetRowHeight(int aRow, int aHeight)
int GetRowHeight(int aRow) const
A helper class interface to manage the edit points for a single item.
static bool isModified(const EDIT_POINT &aEditedPoint, const EDIT_POINT &aPoint)
Checks if two points are the same instance - which means the point is being edited.
Class that implements "standard" polygon editing behavior.
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
static void UpdateItem(SCH_SHAPE &aRect, const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints)
static void UpdatePoints(SCH_SHAPE &aRect, EDIT_POINTS &aPoints)
static void PinEditedCorner(const EDIT_POINT &aEditedPoint, const EDIT_POINTS &aPoints, int minWidth, int minHeight, VECTOR2I &topLeft, VECTOR2I &topRight, VECTOR2I &botLeft, VECTOR2I &botRight)
Update the coordinates of 4 corners of a rectangle, according to constraints and the moved corner.
static void UpdatePoints(PCB_SHAPE &aRectangle, EDIT_POINTS &aPoints)
static void PinEditedCorner(const EDIT_POINT &aEditedPoint, const EDIT_POINTS &aEditPoints, VECTOR2I &aTopLeft, VECTOR2I &aTopRight, VECTOR2I &aBotLeft, VECTOR2I &aBotRight, const VECTOR2I &aHole={ 0, 0 }, const VECTOR2I &aHoleSize={ 0, 0 })
Update the coordinates of 4 corners of a rectangle, according to pad constraints and the moved corner...
static void MakePoints(SCH_SHAPE &aRect, EDIT_POINTS &aPoints)
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
static void MakePoints(const PCB_SHAPE &aRectangle, EDIT_POINTS &aPoints)
Standard rectangle points construction utility (other shapes may use this as well)
static void UpdateItem(PCB_SHAPE &aRectangle, const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints)
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
RECTANGLE_POINT_EDIT_BEHAVIOR(PCB_SHAPE &aRectangle)
REFERENCE_IMAGE_POINT_EDIT_BEHAVIOR(PCB_REFERENCE_IMAGE &aRefImage)
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
PCB_REFERENCE_IMAGE & m_refImage
A REFERENCE_IMAGE is a wrapper around a BITMAP_IMAGE that is displayed in an editor as a reference fo...
void SetTransformOriginOffset(const VECTOR2I &aCenter)
VECTOR2I GetTransformOriginOffset() const
Get the center of scaling, etc, relative to the image center (GetPosition()).
VECTOR2I GetPosition() const
double GetImageScale() const
void SetImageScale(double aScale)
Set the image "zoom" value.
void Move(const VECTOR2I &aOffset) override
Move the item by aMoveVector to a new position.
VECTOR2I GetCenter() const
ecoord SquaredDistance(const SEG &aSeg) const
VECTOR2I::extended_type ecoord
const VECTOR2I NearestPoint(const VECTOR2I &aP) const
Compute a point on the segment (this) that is closest to point aP.
OPT_VECTOR2I IntersectLines(const SEG &aSeg) const
Compute the intersection point of lines passing through ends of (this) and aSeg.
int Distance(const SEG &aSeg) const
Compute minimum Euclidean distance to segment aSeg.
VECTOR2I LineProject(const VECTOR2I &aP) const
Compute the perpendicular projection point of aP on a line passing through ends of the segment.
virtual void Add(EDA_ITEM *aItem)
int Size() const
Returns the number of selected parts.
VECTOR2I NearestPoint(const VECTOR2I &aP) const
const VECTOR2I & GetP1() const
Base class for iterating over all vertices in a given SHAPE_POLY_SET.
bool IsEndContour() const
Represent a set of closed polygons.
ITERATOR IterateWithHoles(int aOutline)
void InsertVertex(int aGlobalIndex, const VECTOR2I &aNewVertex)
Adds a vertex in the globally indexed position aGlobalIndex.
POLYGON & Polygon(int aIndex)
Return the aIndex-th subpolygon in the set.
void RemoveVertex(int aGlobalIndex)
Delete the aGlobalIndex-th vertex.
void RemoveContour(int aContourIdx, int aPolygonIdx=-1)
Delete the aContourIdx-th contour of the aPolygonIdx-th polygon in the set.
bool GetNeighbourIndexes(int aGlobalIndex, int *aPrevious, int *aNext) const
Return the global indexes of the previous and the next corner of the aGlobalIndex-th corner of a cont...
ITERATOR Iterate(int aFirst, int aLast, bool aIterateHoles=false)
Return an object to iterate through the points of the polygons between aFirst and aLast.
const VECTOR2I & CVertex(int aIndex, int aOutline, int aHole) const
Return the index-th vertex in a given hole outline within a given outline.
int OutlineCount() const
Return the number of outlines in the set.
A textbox is edited as a rectnagle when it is orthogonally aligned.
TEXTBOX_POINT_EDIT_BEHAVIOR(PCB_TEXTBOX &aTextbox)
void MakePoints(EDIT_POINTS &aPoints) override
Construct the initial set of edit points for the item and append to the given list.
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
void UpdatePoints(EDIT_POINTS &aPoints) override
Update the list of the edit points for the item.
constexpr extended_type Cross(const VECTOR2< T > &aVector) const
Compute cross product of self with aVector.
double Distance(const VECTOR2< extended_type > &aVector) const
Compute the distance between two vectors.
static constexpr extended_type ECOORD_MAX
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
VECTOR2< T > Resize(T aNewLength) const
Return a vector of the same direction, but length specified in aNewLength.
T EuclideanNorm() const
Compute the Euclidean norm of the vector, which is defined as sqrt(x ** 2 + y ** 2).
VECTOR2I GetValue()
Returns the value in internal units.
ZONE_POINT_EDIT_BEHAVIOR(ZONE &aZone)
void UpdateItem(const EDIT_POINT &aEditedPoint, EDIT_POINTS &aPoints, COMMIT &aCommit, std::vector< EDA_ITEM * > &aUpdatedItems) override
Update the item with the new positions of the edit points.
Handle a list of polygons defining a copper zone.
void SetNeedRefill(bool aNeedRefill)
bool UnFill()
Removes the zone filling.
void HatchBorder()
Compute the hatch lines depending on the hatch parameters and stores it in the zone's attribute m_bor...
SHAPE_POLY_SET * Outline()
This file is part of the common library.
std::optional< CHAMFER_RESULT > ComputeChamferPoints(const SEG &aSegA, const SEG &aSegB, const CHAMFER_PARAMS &aChamferParams)
Compute the chamfer points for a given line pair and chamfer parameters.
static constexpr EDA_ANGLE ANGLE_90
static constexpr EDA_ANGLE ANGLE_270
a few functions useful in geometry calculations.
double m_DrawArcCenterMaxAngle
When drawing an arc, the angle ( center - start ) - ( start - end ) can be limited to avoid extremely...
bool IsFrontLayer(PCB_LAYER_ID aLayerId)
Layer classification: check if it's a front layer.
bool IsCopperLayer(int aLayerId)
Tests whether a layer is a copper layer.
PCB_LAYER_ID
A quick note on layer IDs:
constexpr int Mils2IU(const EDA_IU_SCALE &aIuScale, int mils)
bool PointProjectsOntoSegment(const VECTOR2I &aPoint, const SEG &aSeg)
Determine if a point projects onto a segment.
double GetLengthRatioFromStart(const VECTOR2I &aPoint, const SEG &aSeg)
Get the ratio of the vector to a point from the segment's start, compared to the segment's length.
const VECTOR2I & GetNearestEndpoint(const SEG &aSeg, const VECTOR2I &aPoint)
Get the nearest end of a segment to a point.
bool PointIsInDirection(const VECTOR2< T > &aPoint, const VECTOR2< T > &aDirection, const VECTOR2< T > &aFrom)
EDA_ANGLE abs(const EDA_ANGLE &aAngle)
#define STATUS_ITEMS_ONLY
static std::pair< bool, SHAPE_POLY_SET::VERTEX_INDEX > findVertex(SHAPE_POLY_SET &aPolySet, const EDIT_POINT &aPoint)
#define CHECK_POINT_COUNT(aPoints, aExpected)
#define CHECK_POINT_COUNT_GE(aPoints, aExpected)
static float distance(const SFVEC2UI &a, const SFVEC2UI &b)
std::optional< VECTOR2I > OPT_VECTOR2I
Parameters that define a simple chamfer operation.
constexpr int mmToIU(double mm) const
Structure to hold the necessary information in order to index a vertex on a SHAPE_POLY_SET object: th...
VECTOR2I GetRotated(const VECTOR2I &aVector, const EDA_ANGLE &aAngle)
Return a new VECTOR2I that is the result of rotating aVector by aAngle.
void RotatePoint(int *pX, int *pY, const EDA_ANGLE &aAngle)
Calculate the new point of coord coord pX, pY, for a rotation center 0, 0.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
@ PCB_ZONE_T
class ZONE, a copper pour area
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
@ PCB_TABLECELL_T
class PCB_TABLECELL, PCB_TEXTBOX for use in tables
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
@ PCB_PAD_T
class PAD, a pad in a footprint
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
constexpr int sign(T val)
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
Supplemental functions for working with vectors and simple objects that interact with vectors.