You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

50 lines
1.2 KiB

#ifndef BUSBAR_CONFIG_HPP
#define BUSBAR_CONFIG_HPP
#include "busbar_types.hpp"
#include <array>
class BusbarConfig {
private:
float width_;
float thickness_;
float clearance_;
std::array<bool, 7> allowed_segments_;
public:
// 弯曲/扭转系数
float flat_bend_factor;
float vertical_bend_factor;
float twist_factor;
float bend_45_factor;
BusbarConfig(float w = 2.0f, float h = 1.0f, float c = 0.5f)
: width_(w), thickness_(h), clearance_(c),
flat_bend_factor(2.0f),
vertical_bend_factor(2.0f),
twist_factor(3.0f),
bend_45_factor(2.0f) {
// 默认所有段类型都允许
allowed_segments_.fill(true);
}
// 访问器
float width() const { return width_; }
float thickness() const { return thickness_; }
float clearance() const { return clearance_; }
// 段类型控制
void enableSegment(SegmentType type) {
allowed_segments_[static_cast<int>(type)] = true;
}
void disableSegment(SegmentType type) {
allowed_segments_[static_cast<int>(type)] = false;
}
bool isSegmentAllowed(SegmentType type) const {
return allowed_segments_[static_cast<int>(type)];
}
};
#endif