123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- #ifndef VEHICLE_DRIVER_ALARM_H
- #define VEHICLE_DRIVER_ALARM_H
- #include <vector>
- #include "tr_tool.h"
- #include "struct_def.h"
- #include <memory>
- const int ET_COALING_DRIVING_DRIVER=37;//工作面(采煤面和掘进面)司机与车卡告警;
- //司机的求和坐标
- struct DriverPos
- {
- DriverPos()
- :isOn(false)
- ,PointNum(0)
- ,dept_id(0)
- ,Sum_x(0.)
- ,Sum_y(0.)
- {
- }
- //开始时间
- time_t starttime;
- //车或者对应的车是否开机
- bool isOn;
- //定位点个数
- int PointNum;
- //部门
- uint32_t dept_id;
- //x坐标和
- double Sum_x;
- //y坐标和
- double Sum_y;
- void reset_vehicle_driver_pos();
- void calc_vehicle_driver_pos(double x,double y);
- bool calc_vehicle_driver_distance( double mean_vx,double mean_vy,double& distance);
- void on_vehicle_state_changed(bool m_bOpen);
- };
- //采煤机、挖掘机的求和坐标
- struct VehiclePos:public DriverPos
- {
- VehiclePos()
- :workface_id(0)
- {
- }
- // 工作面
- int workface_id;
- std::vector<uint32_t> m_drivelist;//司机列表
- };
- //工作面相关参数告警参数
- struct WorkfaceParam
- {
- //告警距离
- double dist;
- //告警时间
- int dist_time;
- };
- struct SDeal_Card_Pos
- {
- double x; // located x
- double y; // located y
- double z; // located z
- uint64_t type; // card type
- int dentifier_type;
- int identifier_id; // staff id or 工作面ID
- uint32_t dpt_id; //部门ID
- int work_type_id;
- int id;
- void Copy(const card_pos & pos)
- {
- x = pos.x;
- y = pos.y;
- z = pos.z;
- id = pos.id;
- type = pos.type;
- dentifier_type = 0;
- dpt_id = pos.dpt_id;
- work_type_id = pos.work_type_id;
- }
- };
- typedef std::map<uint32_t, std::shared_ptr<WorkfaceParam>> WorkfaceParamMap;
- typedef std::map<uint32_t,std::shared_ptr<DriverPos>> DriverPosMap;
- typedef std::map<uint32_t,std::shared_ptr<VehiclePos>> VehiclePosMap;
- class vehicle_driver_alarm
- {
- public:
- vehicle_driver_alarm();
- ~vehicle_driver_alarm(){};
- public:
- /*
- * 初始化参数
- */
- void init();
- void deal_vehicle_driver_alarm(SDeal_Card_Pos & cp);
- public:
- void init_coalface_driver_warningparam();
- void init_driving_driver_warningparam(const std::string & sz_drivingface_id = "-1");
- protected:
- void add_driver_to_vehicle(SDeal_Card_Pos &cp, std::shared_ptr<DriverPos> driverPos);
- void add_driver_to_vehicle(VehiclePosMap& vehiclePosMap, SDeal_Card_Pos &cp,std::shared_ptr<DriverPos> driverPos);
- public:
- void set_send_callback(const SendCallBack &cb)
- {
- m_send_callback = move(cb);
- }
- private:
- std::shared_ptr<VehiclePos> get_vehicle_pos(int _id,int _type);
- private:
- WorkfaceParamMap m_WorkfaceParamMap;//工作面告警的计算参数
- VehiclePosMap m_DrivingVehiclePosMap;//掘进机的平均位置
- VehiclePosMap m_CoalVehiclePosMap;//采煤机的平均位置
- DriverPosMap m_DriverPosMap;//司机的平均位置
- SendCallBack m_send_callback;
- };
- #endif
|