KiCad PCB EDA Suite
Loading...
Searching...
No Matches
odb_component.h
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 The KiCad Developers, see AUTHORS.txt for contributors.
5 * Author: SYSUEric <[email protected]>.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * 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
22#ifndef _ODB_COMPONENT_H_
23#define _ODB_COMPONENT_H_
24
25#include "odb_util.h"
26#include <list>
27#include <set>
28#include <wx/string.h>
29#include "odb_attribute.h"
30#include "odb_eda_data.h"
31
32class ODB_COMPONENT;
33class PCB_IO_ODBPP;
34struct S3DMODEL;
35class FP_3DMODEL;
36
37namespace ODB
38{
39double ModelHeightAboveBoard( const S3DMODEL& aModel, const FP_3DMODEL& aPlacement );
40bool HasShownModel( const FOOTPRINT* aFp );
41}
42
44{
45public:
46 explicit COMPONENTS_MANAGER( PCB_IO_ODBPP* aPlugin ) : m_plugin( aPlugin ) {}
47
48 virtual ~COMPONENTS_MANAGER() { m_compList.clear(); }
49
50 ODB_COMPONENT& AddComponent( const FOOTPRINT* aFp, const EDA_DATA::PACKAGE& aPkg );
51
52 void Write( std::ostream& ost ) const;
53
54private:
57 std::list<ODB_COMPONENT> m_compList;
58 std::set<wxString> m_usedCompNames;
59};
60
61
63{
64public:
65 ODB_COMPONENT( size_t aIndex, size_t r ) : m_index( aIndex ), m_pkg_ref( r ) {}
66
67 const size_t m_index;
68 size_t m_pkg_ref;
69 std::pair<wxString, wxString> m_center;
70 wxString m_rot = wxT( "0" );
71 wxString m_mirror = wxT( "N" );
72
73 wxString m_comp_name;
74
75 wxString
77
78 std::map<wxString, wxString> m_prp; // !< Component Property Record
79
80 struct TOEPRINT
81 {
82 public:
85 {
86 }
87
88 const size_t m_pin_num;
89
90 std::pair<wxString, wxString> m_center;
91
92 wxString m_rot;
94
95 wxString m_mirror;
96
97 size_t m_net_num = 0;
98
99 size_t m_subnet_num = 0;
100
102
103 void Write( std::ostream& ost ) const;
104 };
105
106
107 std::list<TOEPRINT> m_toeprints;
108
109 void Write( std::ostream& ost ) const;
110};
111
112
113#endif // _ODB_COMPONENT_H_
ATTR_MANAGER()=default
ATTR_RECORD_WRITER()=default
PCB_IO_ODBPP * m_plugin
Plugin the export runs under, used for formatting and designator reports.
COMPONENTS_MANAGER(PCB_IO_ODBPP *aPlugin)
std::list< ODB_COMPONENT > m_compList
ODB_COMPONENT & AddComponent(const FOOTPRINT *aFp, const EDA_DATA::PACKAGE &aPkg)
void Write(std::ostream &ost) const
std::set< wxString > m_usedCompNames
virtual ~COMPONENTS_MANAGER()
wxString m_mirror
const size_t m_index
! CMP index number on board to be used in SNT(TOP), 0~n-1
std::list< TOEPRINT > m_toeprints
ODB_COMPONENT(size_t aIndex, size_t r)
std::pair< wxString, wxString > m_center
size_t m_pkg_ref
! package ref number from PKG in eda/data file, 0~n-1
wxString m_part_name
! Part identification is a single string of ASCII characters without spaces
void Write(std::ostream &ost) const
wxString m_comp_name
! Unique reference designator (component name)
std::map< wxString, wxString > m_prp
double ModelHeightAboveBoard(const S3DMODEL &aModel, const FP_3DMODEL &aPlacement)
bool HasShownModel(const FOOTPRINT *aFp)
size_t m_subnet_num
! Number of subnet (SNT record TOP) in the referenced net
std::pair< wxString, wxString > m_center
! Board location of the pin.
TOEPRINT(const EDA_DATA::PIN &pin)
void Write(std::ostream &ost) const
size_t m_net_num
! Number of NET record in the eda/data file.
wxString m_mirror
! equal to CMP m_mirror.
const size_t m_pin_num
! index of PIN record in the eda/data file, 0~n-1.
wxString m_toeprint_name
! Name of the pad in PIN record
Store the a model based on meshes and materials.
Definition c3dmodel.h:111
KIBIS_PIN * pin