KiCad PCB EDA Suite
Loading...
Searching...
No Matches
teardrop_parameters.cpp
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) 2021 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU 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#include "teardrop_parameters.h"
22
23#define TARGET_NAME_ROUND "td_round_shape"
24#define TARGET_NAME_RECT "td_rect_shape"
25#define TARGET_NAME_TRACK "td_track_end"
26
28{
29 // return the canonical name of the target aTdType
30 std::string name;
31
32 switch( aTdType )
33 {
34 case TARGET_ROUND: name = TARGET_NAME_ROUND; break;
35 case TARGET_RECT: name = TARGET_NAME_RECT; break;
36 case TARGET_TRACK: name = TARGET_NAME_TRACK; break;
37 default: break;
38 }
39
40 return name;
41}
42
43
44TARGET_TD GetTeardropTargetTypeFromCanonicalName( const std::string& aTargetName )
45{
46 // return the target type from the canonical name
47
48 if( aTargetName == TARGET_NAME_ROUND )
49 return TARGET_ROUND;
50
51 if( aTargetName == TARGET_NAME_RECT )
52 return TARGET_RECT;
53
54 if( aTargetName == TARGET_NAME_TRACK )
55 return TARGET_TRACK;
56
57 return TARGET_UNKNOWN;
58}
const char * name
#define TARGET_NAME_TRACK
std::string GetTeardropTargetCanonicalName(TARGET_TD aTdType)
TARGET_TD GetTeardropTargetTypeFromCanonicalName(const std::string &aTargetName)
#define TARGET_NAME_RECT
#define TARGET_NAME_ROUND
@ TARGET_UNKNOWN
@ TARGET_ROUND
@ TARGET_RECT
@ TARGET_TRACK