KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
eda_3d_viewer_settings.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 (C) 2020 Jon Evans <jon@craftyjon.com>
5 * Copyright (C) 2023 CERN
6 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
7 *
8 * This program is free software: you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation, either version 3 of the License, or (at your
11 * option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License along
19 * with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
22#ifndef EDA_3D_VIEWER_SETTINGS_H_
23#define EDA_3D_VIEWER_SETTINGS_H_
24
25#include <3d_enums.h>
28#include <settings/parameters.h>
30#include "render_settings.h"
31
32#define FOLLOW_PCB wxT( "follow_pcb_editor" )
33#define FOLLOW_PLOT_SETTINGS wxT( "follow_plot_settings" )
34#define LEGACY_PRESET_FLAG wxT( "legacy_preset_flag" )
35
36enum class ANTIALIASING_MODE;
37
38
40{
41 LAYER_PRESET_3D( const wxString& aName = wxEmptyString );
42
43 LAYER_PRESET_3D( const wxString& aName, const std::bitset<LAYER_3D_END>& aLayers,
44 const std::map<int, KIGFX::COLOR4D>& aColors ) :
45 name( aName ),
46 layers( aLayers ),
47 colors( aColors )
48 {
49 }
50
51 wxString name;
52 std::bitset<LAYER_3D_END> layers;
53 std::map<int, KIGFX::COLOR4D> colors;
54};
55
56
57class PARAM_LAYER_PRESET_3D : public PARAM_LAMBDA<nlohmann::json>
58{
59public:
60 PARAM_LAYER_PRESET_3D( const std::string& aPath, std::vector<LAYER_PRESET_3D>* aPresetList );
61
62private:
63 nlohmann::json presetsToJson();
64
65 void jsonToPresets( const nlohmann::json& aJson );
66
67private:
68 std::vector<LAYER_PRESET_3D>* m_presets;
69
70 std::map<int, wxString> m_layerToLayerNameMap;
71 std::map<wxString, int> m_layerNameToLayerMap;
72};
73
74
76{
77public:
79 {
82 };
83
85 {
90
101
109
113
117
120
124 std::vector<KIGFX::COLOR4D> raytrace_lightColor;
125 std::vector<int> raytrace_lightElevation; // -90 .. 90
126 std::vector<int> raytrace_lightAzimuth; // 0 .. 359
127
135 bool show_user[45];
157
163 {
164 if( engine == RENDER_ENGINE::OPENGL && use_board_editor_copper_colors )
165 return false;
166
168 }
169 };
170
172 {
177 };
178
180
182
183 LAYER_PRESET_3D* FindPreset( const wxString& aName );
184
185 virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
186
187public:
191
193 std::vector<LAYER_PRESET_3D> m_LayerPresets;
195
196protected:
197 virtual std::string getLegacyFrameName() const override { return "Viewer3DFrameName"; }
198
199private:
200 bool migrateSchema0to1();
201};
202
203
204#endif
declared enumerations and flags
GRID3D_TYPE
Grid types.
Definition: 3d_enums.h:54
MATERIAL_MODE
Render 3d model shape materials mode.
Definition: 3d_enums.h:71
RENDER_ENGINE
Render engine mode.
Definition: 3d_enums.h:64
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
virtual bool MigrateFromLegacy(wxConfigBase *aLegacyConfig) override
Migrates from wxConfig to JSON-based configuration.
virtual std::string getLegacyFrameName() const override
LAYER_PRESET_3D * FindPreset(const wxString &aName)
std::vector< LAYER_PRESET_3D > m_LayerPresets
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:104
Like a normal param, but with custom getter and setter functions.
Definition: parameters.h:295
std::vector< LAYER_PRESET_3D > * m_presets
void jsonToPresets(const nlohmann::json &aJson)
std::map< int, wxString > m_layerToLayerNameMap
std::map< wxString, int > m_layerNameToLayerMap
ANTIALIASING_MODE
Anti-aliasing options.
Definition: ogl_attr_list.h:37
std::vector< KIGFX::COLOR4D > raytrace_lightColor
bool DifferentiatePlatedCopper()
return true if platted copper aeras and non platted copper areas must be drawn using a different colo...
wxString name
A name for this layer set.
LAYER_PRESET_3D(const wxString &aName, const std::bitset< LAYER_3D_END > &aLayers, const std::map< int, KIGFX::COLOR4D > &aColors)
std::bitset< LAYER_3D_END > layers
std::map< int, KIGFX::COLOR4D > colors