Repository navigation
Expand file tree
/
Copy pathItemNet.h
More file actions
60 lines (54 loc) · 2.12 KB
/
Copy pathItemNet.h
File metadata and controls
60 lines (54 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//-----------------------------------------------------------------------------
// This file is part of the the QParser2 project. You can find the complete
// project here: https://github.com/robdunn4/QSpice/
//-----------------------------------------------------------------------------
/*
* ItemNet.h -- Net item class.
*
* Expecting: "net" (P1) P2 P3 P4 P5 P6
* Example: "net (-1700,-800) 1 13 0 "GND" "Description""
*
* Analysis:
* P1 -- Endpoint coordinate
* P2 -- Font size (different values from text sizes -- see GUI menu)
* P3 -- Alignment only; rotation appears to be disallowed in GUI
* P4 -- Net type (net = 0, port = 1)
* P5 -- Net name
* P6 -- Descriptive text (optional)
*
* Construction: use ItemNet::makePtr(...). Constructors are protected.
*/
#pragma once
#include "ArgUtils2.h"
#include "ItemBase.h"
class ItemNet;
typedef std::shared_ptr<ItemNet> ItemNetPtr;
class ItemNet : public ItemBaseT<ItemNet> {
public:
static ItemNetPtr makePtr() { return ItemNetPtr(new ItemNet()); }
static ItemNetPtr makePtr(const ArgPoint &pt1, const ArgFontSize &fontSize,
const ArgRotAlign &rotateAlign,
const ArgInt &netType, const ArgString &netName,
const ArgString &netDesc = "") {
return ItemNetPtr(
new ItemNet(pt1, fontSize, rotateAlign, netType, netName, netDesc));
}
bool parseItem(const std::string &argStr) override;
std::string toString() const override;
ArgPoint pt1;
ArgFontSize fontSize;
ArgRotAlign rotateAlign;
ArgInt netType;
ArgString netName;
ArgString netDesc; // optional description
protected:
ItemNet() : ItemBaseT(QPI::NET) {}
ItemNet(const ItemNet &other) = default;
ItemNet(const ArgPoint &pt1, const ArgFontSize &fontSize,
const ArgRotAlign &rotateAlign, const ArgInt &netType,
const ArgString &netName, const ArgString &netDesc)
: ItemBaseT(QPI::NET), pt1(pt1), fontSize(fontSize),
rotateAlign(rotateAlign), netType(netType), netName(netName.quote()),
netDesc(netDesc.quote()) {}
friend class ItemBaseT<ItemNet>;
};