KiCad PCB EDA Suite
Loading...
Searching...
No Matches
board_bounding_box.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) 2023 Ethan Chien <[email protected]>
5 * Copyright (C) 2023 KiCad Developers, see AUTHORS.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, see <https://www.gnu.org/licenses/>.
19 */
20
21#include "board_bounding_box.h"
22
23#include <memory>
25
27 EDA_ITEM( KICAD_T::PCB_BOUNDING_BOX_T ),
28 m_boundingBox( std::make_shared<BOX2I>( aBoundingBox ) )
29{
31}
32
38
40{
41 m_parent = aOther.m_parent;
43 return *this;
44}
45
47{
48 return new BOARD_BOUNDING_BOX( *this );
49}
50
54
56{
57 return *m_boundingBox;
58}
59
60void BOARD_BOUNDING_BOX::SetBoundingBox( BOX2I const& aBoundingBox )
61{
62 m_boundingBox = std::make_shared<BOX2I>( aBoundingBox );
63}
64
66{
67 return "BOARD_BOUNDING_BOX";
68}
69
70void BOARD_BOUNDING_BOX::ViewGetLayers( int aLayers[], int& aCount ) const
71{
72 aCount = 1;
73 aLayers[0] = LAYER_BOARD_BOUNDING_BOX;
74}
75
76#if defined( DEBUG )
77
78
79void BOARD_BOUNDING_BOX::Show( int nestLevel, std::ostream& os ) const
80{
81 NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << m_boundingBox->Format()
82 << "/>\n";
83}
84
85#endif
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
BOARD_BOUNDING_BOX(BOX2I const &aBoundingBox)
void SetBoundingBox(BOX2I const &aBoundingBox)
std::shared_ptr< BOX2I > m_boundingBox
BOARD_BOUNDING_BOX & operator=(const BOARD_BOUNDING_BOX &aOther)
const BOX2I GetBoundingBox() const override
Return the orthogonal bounding box of this object for display purposes.
wxString GetClass() const override
Return the class name.
EDA_ITEM * Clone() const override
Create a duplicate of this item with linked list members set to NULL.
void SetFlags(EDA_ITEM_FLAGS aMask)
Definition eda_item.h:152
virtual std::vector< int > ViewGetLayers() const override
Return the all the layers within the VIEW the object is painted on.
Definition eda_item.cpp:377
EDA_ITEM * m_parent
Owner.
Definition eda_item.h:543
EDA_ITEM(EDA_ITEM *parent, KICAD_T idType, bool isSCH_ITEM=false, bool isBOARD_ITEM=false)
Definition eda_item.cpp:37
#define SKIP_STRUCT
flag indicating that the structure should be ignored
STL namespace.
KICAD_T
The set of class identification values stored in EDA_ITEM::m_structType.
Definition typeinfo.h:71