KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 <[email protected]>
5 * Copyright (C) 2023 CERN
6 * Copyright (C) 2020-2023 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>
29#include <settings/parameters.h>
31#include "render_settings.h"
32
33#define FOLLOW_PCB wxT( "follow_pcb_editor" )
34#define FOLLOW_PLOT_SETTINGS wxT( "follow_plot_settings" )
35#define LEGACY_PRESET_FLAG wxT( "legacy_preset_flag" )
36
37
39{
40 LAYER_PRESET_3D( const wxString& aName = wxEmptyString );
41
42 LAYER_PRESET_3D( const wxString& aName, const std::bitset<LAYER_3D_END>& aLayers,
43 const std::map<int, KIGFX::COLOR4D>& aColors ) :
44 name( aName ),
45 layers( aLayers ),
46 colors( aColors )
47 {
48 }
49
50 wxString name;
51 std::bitset<LAYER_3D_END> layers;
52 std::map<int, KIGFX::COLOR4D> colors;
53};
54
55
56class PARAM_LAYER_PRESET_3D : public PARAM_LAMBDA<nlohmann::json>
57{
58public:
59 PARAM_LAYER_PRESET_3D( const std::string& aPath, std::vector<LAYER_PRESET_3D>* aPresetList );
60
61private:
62 nlohmann::json presetsToJson();
63
64 void jsonToPresets( const nlohmann::json& aJson );
65
66 std::vector<LAYER_PRESET_3D>* m_presets;
67};
68
69
71{
72public:
74 {
77 };
78
80 {
85
96
104
108
112
115
119 std::vector<KIGFX::COLOR4D> raytrace_lightColor;
120 std::vector<int> raytrace_lightElevation; // -90 .. 90
121 std::vector<int> raytrace_lightAzimuth; // 0 .. 359
122
149 };
150
152 {
157 };
158
160
162
163 LAYER_PRESET_3D* FindPreset( const wxString& aName );
164
165 virtual bool MigrateFromLegacy( wxConfigBase* aLegacyConfig ) override;
166
167public:
171
172 std::vector<LAYER_PRESET_3D> m_LayerPresets;
174
175protected:
176 virtual std::string getLegacyFrameName() const override { return "Viewer3DFrameName"; }
177
178private:
179 bool migrateSchema0to1();
180};
181
182
183#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:291
std::vector< LAYER_PRESET_3D > * m_presets
void jsonToPresets(const nlohmann::json &aJson)
Declaration of the cogl_att_list class.
ANTIALIASING_MODE
Anti-aliasing options.
Definition: ogl_attr_list.h:35
std::vector< KIGFX::COLOR4D > raytrace_lightColor
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