1 /*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2015-2020 Mario Luzeiro <mrluzeiro@ua.pt>
5 * Copyright (C) 1992-2021 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, 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 * @file object_2d.cpp
27 */
28
29 #include "object_2d.h"
30 #include <wx/log.h>
31 #include <map>
32
33 OBJECT_2D_STATS *OBJECT_2D_STATS::s_instance = nullptr;
34
35
OBJECT_2D(OBJECT_2D_TYPE aObjType,const BOARD_ITEM & aBoardItem)36 OBJECT_2D::OBJECT_2D( OBJECT_2D_TYPE aObjType, const BOARD_ITEM& aBoardItem )
37 : m_boardItem(aBoardItem)
38 {
39 m_obj_type = aObjType;
40 OBJECT_2D_STATS::Instance().AddOne( aObjType );
41 }
42
43
44 /*
45 * Lookup table for OBJECT_2D_TYPE printed names
46 */
47 // clang-format off
48 const std::map<OBJECT_2D_TYPE, const char*> objectTypeNames
49 {
50 { OBJECT_2D_TYPE::FILLED_CIRCLE, "OBJECT_2D_TYPE::FILLED_CIRCLE" },
51 { OBJECT_2D_TYPE::CSG, "OBJECT_2D_TYPE::CSG" },
52 { OBJECT_2D_TYPE::POLYGON, "OBJECT_2D_TYPE::POLYGON" },
53 { OBJECT_2D_TYPE::DUMMYBLOCK, "OBJECT_2D_TYPE::DUMMYBLOCK" },
54 { OBJECT_2D_TYPE::POLYGON4PT, "OBJECT_2D_TYPE::POLYGON4PT" },
55 { OBJECT_2D_TYPE::RING, "OBJECT_2D_TYPE::RING" },
56 { OBJECT_2D_TYPE::ROUNDSEG, "OBJECT_2D_TYPE::ROUNDSEG" },
57 { OBJECT_2D_TYPE::TRIANGLE, "OBJECT_2D_TYPE::TRIANGLE" },
58 { OBJECT_2D_TYPE::CONTAINER, "OBJECT_2D_TYPE::CONTAINER" },
59 { OBJECT_2D_TYPE::BVHCONTAINER, "OBJECT_2D_TYPE::BVHCONTAINER" },
60 };
61 // clang-format on
62