54 if(moduleType ==
"nem")
56 if(eventType ==
"location")
65 while(posEnd != std::string::npos)
67 posEnd = args[1].find_first_of(
",",posStart);
69 params.push_back(args[1].substr(posStart, posEnd - posStart));
71 posStart = posEnd + 1;
74 double dLatitudeDegress{};
75 double dLongitudeDegress{};
76 double dAltitudeMeters{};
80 for(
size_t i = 0; i < params.size(); ++i)
97 if(params[i] !=
"msl" && params[i] !=
"agl")
110 std::stringstream sstream;
111 sstream<<
"EELEventGenerator: Parameter conversion error. "<<exp.
what()<<std::ends;
117 Position position{dLatitudeDegress,dLongitudeDegress,dAltitudeMeters};
119 locationEntry.setPosition(position);
122 auto ret = locationEntryMap_.insert(std::make_pair(moduleId,locationEntry));
126 ret.first->second.setPosition(position);
130 ret = locationEntryDeltaMap_.insert(std::make_pair(moduleId,ret.first->second));
135 ret.first->second.setPosition(position);
140 throw FormatException(
"EELLoaderLocation only support 'gps' location type");
143 else if(eventType ==
"orientation")
150 while(posEnd != std::string::npos)
152 posEnd = args[0].find_first_of(
",",posStart);
154 params.push_back(args[0].substr(posStart, posEnd - posStart));
156 posStart = posEnd + 1;
159 double dPitchDegrees{};
160 double dRollDegrees{};
161 double dYawDegrees{};
165 for(
size_t i = 0; i < params.size(); ++i)
182 if(params[i] !=
"degrees" && params[i] !=
"relative")
184 throw FormatException(
"EELLoaderLocation orientation unkown or unsupported keyword. " 185 "Only degrees and relative keywords supported.");
192 std::stringstream sstream;
193 sstream<<
"EELEventGenerator: Parameter conversion error. "<<exp.
what()<<std::ends;
199 Orientation orientation{dRollDegrees,dPitchDegrees,dYawDegrees};
201 locationEntry.setOrientation(orientation);
204 auto ret = locationEntryMap_.insert(std::make_pair(moduleId,locationEntry));
209 ret.first->second.setOrientation(orientation);
213 ret = locationEntryDeltaMap_.insert(std::make_pair(moduleId,ret.first->second));
218 ret.first->second.setOrientation(orientation);
221 else if(eventType ==
"velocity")
228 while(posEnd != std::string::npos)
230 posEnd = args[0].find_first_of(
",",posStart);
232 params.push_back(args[0].substr(posStart, posEnd - posStart));
234 posStart = posEnd + 1;
237 double dAzimuthDegrees{};
238 double dElevationDegrees{};
239 double dMagnitudeMetersPerSecond{};
243 for(
size_t i = 0; i < params.size(); ++i)
260 if(params[i] !=
"degrees" &&
261 params[i] !=
"mps" &&
262 params[i] !=
"azimuth" &&
263 params[i] !=
"relative")
265 throw FormatException(
"EELLoaderLocation velocity unkown or unsupported keyword. " 266 "Only degrees, relative, mps and azimuth keywords supported.");
273 std::stringstream sstream;
274 sstream<<
"EELEventGenerator: Parameter conversion error. "<<exp.
what()<<std::ends;
281 Velocity velocity{dAzimuthDegrees,dElevationDegrees,dMagnitudeMetersPerSecond};
283 locationEntry.setVelocity(velocity);
287 auto ret = locationEntryMap_.insert(std::make_pair(moduleId,locationEntry));
292 ret.first->second.setVelocity(velocity);
297 ret = locationEntryDeltaMap_.insert(std::make_pair(moduleId,ret.first->second));
302 ret.first->second.setVelocity(velocity);
312 LocationEntryMap * pCache = 0;
315 if(!locationEntryDeltaMap_.empty())
319 pCache = &locationEntryDeltaMap_;
323 pCache = &locationEntryMap_;
328 for(
const auto & entry : *pCache)
330 const Position & position = entry.second.getPosition();
331 auto optionalOrientation = entry.second.getOrientation();
332 auto optionalVelocity = entry.second.getVelocity();
334 locations.push_back({entry.first,position,optionalOrientation,optionalVelocity});
337 if(!locations.empty())
344 locationEntryDeltaMap_.clear();
347 return eventInfoList;
EventInfoList getEvents(EventPublishMode mode) override
Holds the velocity elements associated with an NEM's location information.
std::vector< std::string > InputArguments
#define DECLARE_EEL_LOADER_PLUGIN(X)
Parameter conversion exception class.
double toDouble(double dMin=std::numeric_limits< double >::lowest(), double dMax=std::numeric_limits< double >::max()) const
const char * what() const
std::list< Location > Locations
Contains event information to be published.
Holds pitch, yaw and roll.
void load(const ModuleType &modelType, const ModuleId &moduleId, const EventType &eventType, const InputArguments &args) override
std::list< EventInfo > EventInfoList
Parameter conversion class with range checks.
Holds latitude, longitude and altitude.