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, you may find one here:
18 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
19 * or you may write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 */
22
23#pragma once
24
25#include <unordered_map>
26#include <vector>
27#include <wx/string.h>
28
30
31
39namespace MODEL_SUBSTITUTION
40{
41
43bool IsWrlExtension( const wxString& aFilename );
44
45
53{
54public:
68 void Build( const wxString& aProjectPath, const FILENAME_RESOLVER* aResolver );
69
81 wxString FindMatchFor( const wxString& aMissingWrl ) const;
82
83 bool Empty() const { return m_byStem.empty(); }
84
85private:
87 std::unordered_map<wxString, std::vector<wxString>> m_byStem;
88};
89
90} // 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).