/* * @file * @brief * @version * @author * @date * @note * @warning * @bug * @copyright * */ #ifndef AREA_BUSINESS_GEOFAULT #define AREA_BUSINESS_GEOFAULT #include"area_business.h" #include #include struct config_file; struct point; struct area; /** * @brief 当采煤机和掘进机有数据点过来的时候,判断当前点与地址断层坐标点的距离d。如d<设置的阈值,则告警,d>阈值则取消。 */ class area_business_geofault:public area_business { public: void on_load_his(const std::shared_ptr&a,const std::shared_ptr&c,std::shared_ptr&ptr); void on_enter(const std::shared_ptr&a,const std::shared_ptr&c,std::shared_ptr&ptr); void on_hover(const std::shared_ptr&a,const std::shared_ptr&c,std::shared_ptr ptr); void on_leave(const std::shared_ptr&a,const std::shared_ptr&c,std::shared_ptr ptr); static void init(config_file& config); static void init_geofault_from_db(); private: static bool _is_near(std::shared_ptr& area_ptr, double x, double y, double& out_dist); static std::vector split(const std::string& str, char tag) { std::vector arr; std::string subStr; for(size_t i = 0; i < str.length(); i++) { if(tag == str[i]) { if(!subStr.empty()) { arr.push_back(subStr); subStr.clear(); } } else { subStr.push_back(str[i]); } } if(!subStr.empty()) { arr.push_back(subStr); } return arr; } static std::string _points2str(std::vector& points); private: //area_id: points static std::unordered_map> _area_geofault_map; static int _geofault_count_limit; }; #endif // AREA_BUSINESS_GEOFAULT