renderer_common::renderer_common(Map const &m, unsigned offset_x, unsigned offset_y, unsigned width, unsigned height, double scale_factor, std::shared_ptr<label_collision_detector4> detector) : renderer_common(width, height, scale_factor, CoordTransform(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), detector) {}
PPETask::PPETask(DjiPoint _startSprayingPosition,double _sprayingDirection, double _sprayingWidth, int _droneNum, bool _isUseCoordTransform) { if (!(_sprayingDirection <= 360 && _sprayingDirection >= 0 && _sprayingWidth>0 && _sprayingWidth<=MAX_SPRAY_WIDTH_METER)) { printLog("WaypointTask init input error", true); } if (_isUseCoordTransform) { if (!isLegalLatLong(_startSprayingPosition)) { printLog("_startSprayingPosition is illegal LatLong", true); } } if (_droneNum<1) { printLog("inupt error droneNum<1", true); } isUseCoordTransform = _isUseCoordTransform; //all the latitude_longtitude data will be transformed into plane coordinate (the unit is metre) tran = isUseCoordTransform ? CoordTransform(_startSprayingPosition) : CoordTransform(); homePoint = isUseCoordTransform ? tran.latlong2plane(_startSprayingPosition) : _startSprayingPosition; droneNum = _droneNum; forwardVec = CoordTransform::dirSouthEastFromNorthAngle(_sprayingDirection); forwardVec = forwardVec / molMat(forwardVec); //rotate clockwise 90 degree sideVec.x = forwardVec.y; sideVec.y = -forwardVec.x; sprayWidth = _sprayingWidth; printLog(" "); printPoint("startSprayingPosition: ", _startSprayingPosition); printLog("sprayingDirection: " + double2string(_sprayingDirection)); printLog("sprayingWidth: " + double2string(sprayWidth)); printLog("droneNum: " + int2string(droneNum)); initDefaultValues(); }
renderer_common::renderer_common(request const &req, unsigned offset_x, unsigned offset_y, unsigned width, unsigned height, double scale_factor) : renderer_common(width, height, scale_factor, CoordTransform(req.width(),req.height(),req.extent(),offset_x,offset_y), std::make_shared<label_collision_detector4>( box2d<double>(-req.buffer_size(), -req.buffer_size(), req.width() + req.buffer_size() ,req.height() + req.buffer_size()))) {}
renderer_common::renderer_common(Map const &m, unsigned offset_x, unsigned offset_y, unsigned width, unsigned height, double scale_factor) : renderer_common(width, height, scale_factor, CoordTransform(m.width(),m.height(),m.get_current_extent(),offset_x,offset_y), std::make_shared<label_collision_detector4>( box2d<double>(-m.buffer_size(), -m.buffer_size(), m.width() + m.buffer_size() ,m.height() + m.buffer_size()))) {}
CoordTransform Map::view_transform() const { return CoordTransform(width_,height_,current_extent_); }