KiCad PCB EDA Suite
Loading...
Searching...
No Matches
model_substitution_helpers.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 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
20#pragma once
21
22#include <unordered_map>
23#include <vector>
24#include <wx/string.h>
25
27
28
36namespace MODEL_SUBSTITUTION
37{
38
40bool IsWrlExtension( const wxString& aFilename );
41
42
50{
51public:
65 void Build( const wxString& aProjectPath, const FILENAME_RESOLVER* aResolver );
66
78 wxString FindMatchFor( const wxString& aMissingWrl ) const;
79
80 bool Empty() const { return m_byStem.empty(); }
81
82private:
84 std::unordered_map<wxString, std::vector<wxString>> m_byStem;
85};
86
87} // namespace MODEL_SUBSTITUTION
Provide an extensible class to resolve 3D model paths.
An index of STEP-family model files keyed by normalised filename stem.
wxString FindMatchFor(const wxString &aMissingWrl) const
Look up the best STEP-family replacement for a missing WRL reference.
void Build(const wxString &aProjectPath, const FILENAME_RESOLVER *aResolver)
Walk the resolver's search paths, the project's 3dshapes/ subdirectory, and the user's COMMON_SETTING...
std::unordered_map< wxString, std::vector< wxString > > m_byStem
Normalised stem → list of absolute STEP-family paths sharing that stem.
Shared helpers for matching obsolete .wrl/.wrz 3D model references against current STEP-family replac...
bool IsWrlExtension(const wxString &aFilename)
True iff aFilename ends in .wrl or .wrz (case-insensitive).