-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
portedbox.h
52 lines (43 loc) · 1.36 KB
/
portedbox.h
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
#ifndef PORTEDBOX_H
#define PORTEDBOX_H
#include <QDomElement>
#include <QDomDocument>
#include <QRectF>
#include <QPainter>
#include "sealedbox.h"
#define K 0.732 /* correction factor for a half flanged disposed port */
class PortedBox : public Box
{
public:
PortedBox(double volume = 0.01, double resfreq = 1, unsigned int portnum = 1, double portdiam = 0, double portlen = 0);
void setBoxVolume(double vol);
void setPortNum(unsigned int value);
void setPortLen(double len);
void setPortDiam(double diam);
void setSlotWidth(double width);
void setResFreq(double value);
void setSlotPortActivated(bool enable);
double getBoxVolume(void) const;
unsigned int getPortNum() const;
double getPortLen(void) const;
double getPortDiam(void) const;
bool getSlotPortActivated(void) const;
double getSlotWidth() const;
double getSlotHeight() const;
double getResFreq() const;
void updateSlots();
void updatePorts(double sd, double xmax);
void updatePortsLength();
QDomElement toDomElement(QDomDocument& doc) const;
void fromDomElement(const QDomElement& e);
void render(QPainter *painter, const QRectF& area) const;
private:
SealedBox box;
double resFreq;
unsigned int portNum;
double portLen;
double portDiam;
double slotWidth;
bool slotActivated;
};
#endif // PORTEDBOX_H