ObjectSignal.cpp 23 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190
  1. #include "ObjectSignal.h"
  2. #include <iostream>
  3. Object_outlines_outline::Object_outlines_outline()
  4. {
  5. }
  6. Object_outlines::Object_outlines()
  7. {
  8. }
  9. Object_material::Object_material()
  10. {
  11. }
  12. int Object_material::Getsurface(string & surface)
  13. {
  14. if(msurface.size()<1)return 0;
  15. surface = msurface[0];
  16. return 1;
  17. }
  18. int Object_material::Getfriction(double & friction)
  19. {
  20. if(mfriction.size()<1)return 0;
  21. friction = mfriction[0];
  22. return 1;
  23. }
  24. int Object_material::Getroughness(double & roughness)
  25. {
  26. if(mroughness.size()<1)return 0;
  27. roughness = mroughness[0];
  28. return 1;
  29. }
  30. void Object_material::Setsurface(string surface)
  31. {
  32. if(msurface.size()>0)msurface.clear();
  33. msurface.push_back(surface);
  34. }
  35. void Object_material::Setfriction(double friction)
  36. {
  37. if(mfriction.size()>0)mfriction.clear();
  38. mfriction.push_back(friction);
  39. }
  40. void Object_material::Setroughness(double roughness)
  41. {
  42. if(mroughness.size()>0)mroughness.clear();
  43. mroughness.push_back(roughness);
  44. }
  45. Object_repeat::Object_repeat(double s,double length,double distance,double tStart,double tEnd,double heightStart,
  46. double heightEnd,double zOffsetStart,double zOffsetEnd)
  47. {
  48. ms = s;
  49. mlength = length;
  50. mdistance = distance;
  51. mtStart = tStart;
  52. mtEnd = tEnd;
  53. mheightStart = heightStart;
  54. mheightEnd = heightEnd;
  55. mzOffsetStart = zOffsetStart;
  56. mzOffsetEnd = zOffsetEnd;
  57. }
  58. double Object_repeat::Gets()
  59. {
  60. return ms;
  61. }
  62. double Object_repeat::Getlength()
  63. {
  64. return mlength;
  65. }
  66. double Object_repeat::Getdistance()
  67. {
  68. return mdistance;
  69. }
  70. double Object_repeat::GettStart()
  71. {
  72. return mtStart;
  73. }
  74. double Object_repeat::GettEnd()
  75. {
  76. return mtEnd;
  77. }
  78. double Object_repeat::GetheightStart()
  79. {
  80. return mheightStart;
  81. }
  82. double Object_repeat::GetheightEnd()
  83. {
  84. return mheightEnd;
  85. }
  86. double Object_repeat::GetzOffsetStart()
  87. {
  88. return mzOffsetStart;
  89. }
  90. double Object_repeat::GetzOffsetEnd()
  91. {
  92. return mzOffsetEnd;
  93. }
  94. void Object_repeat::Sets(double s)
  95. {
  96. ms = s;
  97. }
  98. void Object_repeat::Setlength(double length)
  99. {
  100. mlength = length;
  101. }
  102. void Object_repeat::Setdistance(double distance)
  103. {
  104. mdistance = distance;
  105. }
  106. void Object_repeat::SettStart(double tStart)
  107. {
  108. mtStart = tStart;
  109. }
  110. void Object_repeat::SettEnd(double tEnd)
  111. {
  112. mtEnd = tEnd;
  113. }
  114. void Object_repeat::SetheightStart(double heightStart)
  115. {
  116. mheightStart = heightStart;
  117. }
  118. void Object_repeat::SetheightEnd(double heightEnd)
  119. {
  120. mheightEnd = heightEnd;
  121. }
  122. void Object_repeat::SetzOffsetStart(double zOffsetStart)
  123. {
  124. mzOffsetStart = zOffsetStart;
  125. }
  126. void Object_repeat::SetzOffsetEnd(double zOffsetEnd)
  127. {
  128. mzOffsetEnd = zOffsetEnd;
  129. }
  130. int Object_repeat::GetwidthStart(double & widthStart)
  131. {
  132. if(mwidthStart.size() <1)return 0;
  133. widthStart = mwidthStart[0];
  134. return 1;
  135. }
  136. int Object_repeat::GetwidthEnd(double & widthEnd)
  137. {
  138. if(mwidthEnd.size() < 1)return 0;
  139. widthEnd = mwidthEnd[0];
  140. return 1;
  141. }
  142. int Object_repeat::GetlengthStart(double & lengthStart)
  143. {
  144. if(mlengthStart.size() < 1)return 0;
  145. lengthStart = mlengthStart[0];
  146. return 1;
  147. }
  148. int Object_repeat::GetlengthEnd(double & lengthEnd)
  149. {
  150. if(mlengthEnd.size() < 1)return 0;
  151. lengthEnd = mlengthEnd[0];
  152. return 1;
  153. }
  154. int Object_repeat::GetradiusStart(double & radiusStart)
  155. {
  156. if(mradiusStart.size() < 1)return 0;
  157. radiusStart = mradiusStart[0];
  158. return 1;
  159. }
  160. int Object_repeat::GetradiusEnd(double & radiusEnd)
  161. {
  162. if(mradiusEnd.size() < 1)return 0;
  163. radiusEnd = mradiusEnd[0];
  164. return 1;
  165. }
  166. void Object_repeat::DeletewidthStart()
  167. {
  168. if(mwidthStart.size() > 0)mwidthStart.clear();
  169. }
  170. void Object_repeat::DeletewidthEnd()
  171. {
  172. if(mwidthEnd.size() > 0)mwidthEnd.clear();
  173. }
  174. void Object_repeat::DeletelengthStart()
  175. {
  176. if(mlengthStart.size() > 0)mlengthStart.clear();
  177. }
  178. void Object_repeat::DeletelengthEnd()
  179. {
  180. if(mlengthEnd.size() > 0)mlengthEnd.clear();
  181. }
  182. void Object_repeat::DeleteradiusStart()
  183. {
  184. if(mradiusStart.size() > 0)mradiusStart.clear();
  185. }
  186. void Object_repeat::DeleteradiusEnd()
  187. {
  188. if(mradiusEnd.size() > 0)mradiusEnd.clear();
  189. }
  190. void Object_repeat::SetwidthStart(double widthStart)
  191. {
  192. if(mwidthStart.size() > 0)mwidthStart.clear();
  193. mwidthStart.push_back(widthStart);
  194. }
  195. void Object_repeat::SetwidthEnd(double widthEnd)
  196. {
  197. if(mwidthEnd.size() > 0)mwidthEnd.clear();
  198. mwidthEnd.push_back(widthEnd);
  199. }
  200. void Object_repeat::SetlengthStart(double lengthStart)
  201. {
  202. if(mlengthStart.size() > 0)mlengthStart.clear();
  203. mlengthStart.push_back(lengthStart);
  204. }
  205. void Object_repeat::SetlengthEnd(double lengthEnd)
  206. {
  207. if(mlengthEnd.size() > 0)mlengthEnd.clear();
  208. mlengthEnd.push_back(lengthEnd);
  209. }
  210. void Object_repeat::SetradiusStart(double radiusStart)
  211. {
  212. if(mradiusStart.size() > 0)mradiusStart.clear();
  213. mradiusStart.push_back(radiusStart);
  214. }
  215. void Object_repeat::SetradiusEnd(double radiusEnd)
  216. {
  217. if(mradiusEnd.size() > 0)mradiusEnd.clear();
  218. mradiusEnd.push_back(radiusEnd);
  219. }
  220. /**
  221. * Check if the tested s-offset is inside the lane offset interval
  222. * @param A double s-offset value that has to be checked
  223. * @return Return true if the s-offset value belongs to current lane section, false otherwise
  224. */
  225. bool Object_repeat::CheckInterval(double s_check)
  226. {
  227. if (s_check>=ms)
  228. return true;
  229. else
  230. return false;
  231. }
  232. Object_parkingSpace::Object_parkingSpace()
  233. {
  234. maccess = "all";
  235. }
  236. void Object_parkingSpace::Setaccess(std::string access)
  237. {
  238. maccess = access;
  239. }
  240. void Object_parkingSpace::Setrestrictions(std::string restrictions)
  241. {
  242. mrestrictions = restrictions;
  243. }
  244. string Object_parkingSpace::Getaccess()
  245. {
  246. return maccess;
  247. }
  248. string Object_parkingSpace::Getrestrictions()
  249. {
  250. return mrestrictions;
  251. }
  252. /**
  253. * Copy constructor
  254. */
  255. Object_parkingSpace::Object_parkingSpace (const Object_parkingSpace& parkingSpace)
  256. {
  257. if(this != &parkingSpace)
  258. {
  259. mrestrictions = parkingSpace.mrestrictions;
  260. maccess = parkingSpace.maccess;
  261. }
  262. }
  263. /**
  264. * Assignment operator overload
  265. */
  266. const Object_parkingSpace& Object_parkingSpace::operator=(const Object_parkingSpace& rhs)
  267. {
  268. if (this!= &rhs)
  269. {
  270. mrestrictions = rhs.mrestrictions;
  271. maccess = rhs.maccess;
  272. }
  273. }
  274. Object::Object(std::string id, double s, double t, double zOffset)
  275. {
  276. mid = id;
  277. ms = s;
  278. mt = t;
  279. mzOffset = zOffset;
  280. }
  281. double Object::Gett()
  282. {
  283. return mt;
  284. }
  285. double Object::GetzOffset()
  286. {
  287. return mzOffset;
  288. }
  289. string Object::Gettype()
  290. {
  291. return mtype;
  292. }
  293. int Object::GetvalidLength(double &validLength)
  294. {
  295. if(mvalidLength.size()<1)return 0;
  296. validLength = mvalidLength[0];
  297. return 1;
  298. }
  299. string Object::Getorientation()
  300. {
  301. return morientation;
  302. }
  303. string Object::Getsubtype()
  304. {
  305. return msubtype;
  306. }
  307. string Object::Getdynamic()
  308. {
  309. return mdynamic;
  310. }
  311. int Object::Gethdg(double &hdg)
  312. {
  313. if(mhdg.size()<1)return 0;
  314. hdg = mhdg[0];
  315. return 1;
  316. }
  317. string Object::Getname()
  318. {
  319. return mname;
  320. }
  321. int Object::Getpitch(double &pitch)
  322. {
  323. if(mpitch.size()<1)return 0;
  324. pitch = mpitch[0];
  325. return 1;
  326. }
  327. string Object::Getid()
  328. {
  329. return mid;
  330. }
  331. int Object::Getroll(double &roll)
  332. {
  333. if(mroll.size()<1)return 0;
  334. roll = mroll[0];
  335. return 1;
  336. }
  337. int Object::Getheight(double &height)
  338. {
  339. if(mheight.size()<1)return 0;
  340. height = mheight[0];
  341. return 1;
  342. }
  343. double Object::Gets()
  344. {
  345. return ms;
  346. }
  347. int Object::Getlength(double &length)
  348. {
  349. if(mlength.size()<1)return 0;
  350. length = mlength[0];
  351. return 1;
  352. }
  353. int Object::Getwidth(double &width)
  354. {
  355. if(mwidth.size()<1)return 0;
  356. width = mwidth[0];
  357. return 1;
  358. }
  359. int Object::Getradius(double &radius)
  360. {
  361. if(mradius.size()<1)return 0;
  362. radius = mradius[0];
  363. return 1;
  364. }
  365. int Object::GetparkingSpace(Object_parkingSpace &parkingSpace)
  366. {
  367. if(mObject_parkingSpace.size()<1)return 0;
  368. parkingSpace = mObject_parkingSpace[0];
  369. return 1;
  370. }
  371. void Object::Sett(double t)
  372. {
  373. mt = t;
  374. }
  375. void Object::SetzOffset(double zOffset)
  376. {
  377. mzOffset = zOffset;
  378. }
  379. void Object::Settype(string type)
  380. {
  381. mtype = type;
  382. }
  383. void Object::SetvalidLength(double validLength)
  384. {
  385. if(mvalidLength.size() > 0)mvalidLength.clear();
  386. mvalidLength.push_back(validLength);
  387. }
  388. void Object::Setorientation(string orientation)
  389. {
  390. morientation = orientation;
  391. }
  392. void Object::Setsubtype(string subtype)
  393. {
  394. msubtype = subtype;
  395. }
  396. void Object::Setdynamic(string dynamic)
  397. {
  398. mdynamic = dynamic;
  399. }
  400. void Object::Sethdg(double hdg)
  401. {
  402. if(mhdg.size()>0)mhdg.clear();
  403. mhdg.push_back(hdg);
  404. }
  405. void Object::Setname(string name)
  406. {
  407. mname = name;
  408. }
  409. void Object::Setpitch(double pitch)
  410. {
  411. if(mpitch.size()>0)mpitch.clear();
  412. mpitch.push_back(pitch);
  413. }
  414. void Object::Setid(string id)
  415. {
  416. mid = id;
  417. }
  418. void Object::Setroll(double roll)
  419. {
  420. if(mroll.size()>0)mroll.clear();
  421. mroll.push_back(roll);
  422. }
  423. void Object::Setheight(double height)
  424. {
  425. if(mheight.size()>0)mheight.clear();
  426. mheight.push_back(height);
  427. }
  428. void Object::Sets(double s)
  429. {
  430. ms = s;
  431. }
  432. void Object::Setlength(double length)
  433. {
  434. if(mlength.size()>0)mlength.clear();
  435. mlength.push_back(length);
  436. }
  437. void Object::Setwidth(double width)
  438. {
  439. if(mwidth.size()>0)mwidth.clear();
  440. mwidth.push_back(width);
  441. }
  442. void Object::Setradius(double radius)
  443. {
  444. if(mradius.size()>0)mradius.clear();
  445. mradius.push_back(radius);
  446. }
  447. void Object::SetparkingSpace(Object_parkingSpace parkingSpace)
  448. {
  449. if(mObject_parkingSpace.size()>0)mObject_parkingSpace.clear();
  450. mObject_parkingSpace.push_back(parkingSpace);
  451. }
  452. vector<Object_repeat> * Object::GetObjectrepeatVector()
  453. {
  454. return &mObject_repeat;
  455. }
  456. Object_repeat* Object::GetObjectrepeat(unsigned int i)
  457. {
  458. if ((mObject_repeat.size()>0)&&(i<(mObject_repeat.size())))
  459. return &(mObject_repeat.at(i));
  460. else
  461. return NULL;
  462. }
  463. unsigned int Object::GetObjectrepeatCount()
  464. {
  465. return mObject_repeat.size();
  466. }
  467. Object_repeat* Object::GetLastObjectrepeat()
  468. {
  469. if (mObject_repeat.size()>0)
  470. return &mObject_repeat.at(mObject_repeat.size()-1);
  471. else
  472. return NULL;
  473. }
  474. Object_repeat* Object::GetLastAddedObjectrepeat()
  475. {
  476. if(mLastAddedObjectrepeat<mObject_repeat.size())
  477. return &mObject_repeat.at(mLastAddedObjectrepeat);
  478. else
  479. return NULL;
  480. }
  481. unsigned int Object::AddObjectrepeat(double s,double length,double distance,double tStart,double tEnd,
  482. double heightStart,double heightEnd,double zOffsetStart,double zOffsetEnd)
  483. {
  484. unsigned int index = CheckObjectrepeatInterval(s)+1;
  485. if(index>=GetObjectrepeatCount()) mObject_repeat.push_back(Object_repeat(s,length,distance,tStart,tEnd,heightStart,heightEnd,zOffsetStart,zOffsetEnd));
  486. else mObject_repeat.insert(mObject_repeat.begin()+index, Object_repeat(s,length,distance,tStart,tEnd,heightStart,heightEnd,zOffsetStart,zOffsetEnd));
  487. mLastAddedObjectrepeat=index;
  488. return index;
  489. }
  490. unsigned int Object::CloneObjectrepeat(unsigned int index)
  491. {
  492. if(index<(mObject_repeat.size()-1))
  493. mObject_repeat.insert(mObject_repeat.begin()+index+1, mObject_repeat[index]);
  494. else if(index==mObject_repeat.size()-1)
  495. mObject_repeat.push_back(mObject_repeat[index]);
  496. mLastAddedObjectrepeat=index+1;
  497. return mLastAddedObjectrepeat;
  498. }
  499. void Object::DeleteObjectrepeat(unsigned int index)
  500. {
  501. mObject_repeat.erase(mObject_repeat.begin()+index);
  502. }
  503. int Object::CheckObjectrepeatInterval(double s_check)
  504. {
  505. int res=-1;
  506. //Go through all the lane section records
  507. for (unsigned int i=0;i<mObject_repeat.size();i++)
  508. {
  509. //check if the s_check belongs to the current record
  510. if (mObject_repeat.at(i).CheckInterval(s_check))
  511. res=i; //assign it to the result id
  512. else
  513. break; //if not, break;
  514. }
  515. return res; //return the result: 0 to MaxInt as the index to the record containing s_check or -1 if nothing found
  516. }
  517. vector<Object_material> * Object::GetObjectmaterialVector()
  518. {
  519. return &mObject_material;
  520. }
  521. Object_material* Object::GetObjectmaterial(unsigned int i)
  522. {
  523. if ((mObject_material.size()>0)&&(i<(mObject_material.size())))
  524. return &(mObject_material.at(i));
  525. else
  526. return NULL;
  527. }
  528. unsigned int Object::GetObjectmaterialCount()
  529. {
  530. return mObject_material.size();
  531. }
  532. Object_material* Object::GetLastObjectmaterial()
  533. {
  534. if (mObject_material.size()>0)
  535. return &mObject_material.at(mObject_material.size()-1);
  536. else
  537. return NULL;
  538. }
  539. Object_material* Object::GetLastAddedObjectmaterial()
  540. {
  541. if(mLastAddedObjectmaterial<mObject_material.size())
  542. return &mObject_material.at(mLastAddedObjectmaterial);
  543. else
  544. return NULL;
  545. }
  546. unsigned int Object::AddObjectmaterial()
  547. {
  548. mObject_material.push_back(Object_material());
  549. mLastAddedObjectmaterial = mObject_material.size()-1;
  550. return mLastAddedObjectmaterial;
  551. }
  552. unsigned int Object::CloneObjectmaterial(unsigned int index)
  553. {
  554. if(index<(mObject_material.size()-1))
  555. mObject_material.insert(mObject_material.begin()+index+1, mObject_material[index]);
  556. else if(index==mObject_material.size()-1)
  557. mObject_material.push_back(mObject_material[index]);
  558. mLastAddedObjectmaterial=index+1;
  559. return mLastAddedObjectmaterial;
  560. }
  561. void Object::DeleteObjectmaterial(unsigned int index)
  562. {
  563. mObject_material.erase(mObject_material.begin()+index);
  564. }
  565. signal_positionRoad::signal_positionRoad(double s, double t, double zOffset, double hOffset, double pitch, double roll)
  566. {
  567. ms = s;
  568. mt = t;
  569. mzOffset = zOffset;
  570. mhOffset = hOffset;
  571. mpitch = pitch;
  572. mroll = roll;
  573. }
  574. double signal_positionRoad::Gets()
  575. {
  576. return ms;
  577. }
  578. double signal_positionRoad::Gett()
  579. {
  580. return mt;
  581. }
  582. double signal_positionRoad::GetzOffset()
  583. {
  584. return mzOffset;
  585. }
  586. double signal_positionRoad::GethOffset()
  587. {
  588. return mhOffset;
  589. }
  590. double signal_positionRoad::Getpitch()
  591. {
  592. return mpitch;
  593. }
  594. double signal_positionRoad::Getroll()
  595. {
  596. return mroll;
  597. }
  598. void signal_positionRoad::Sets(double s)
  599. {
  600. ms = s;
  601. }
  602. void signal_positionRoad::Sett(double t)
  603. {
  604. mt = t;
  605. }
  606. void signal_positionRoad::SetzOffset(double zOffset)
  607. {
  608. mzOffset = zOffset;
  609. }
  610. void signal_positionRoad::SethOffset(double hOffset)
  611. {
  612. mhOffset = hOffset;
  613. }
  614. void signal_positionRoad::Setpitch(double pitch)
  615. {
  616. mpitch = pitch;
  617. }
  618. void signal_positionRoad::Setroll(double roll)
  619. {
  620. mroll = roll;
  621. }
  622. signal_positionInertial::signal_positionInertial(double x, double y,double z, double hdg, double pitch, double roll)
  623. {
  624. mx = x;
  625. my = y;
  626. mz = z;
  627. mhdg = hdg;
  628. mpitch = pitch;
  629. mroll = roll;
  630. }
  631. double signal_positionInertial::Getx()
  632. {
  633. return mx;
  634. }
  635. double signal_positionInertial::Gety()
  636. {
  637. return my;
  638. }
  639. double signal_positionInertial::Getz()
  640. {
  641. return mz;
  642. }
  643. double signal_positionInertial::Gethdg()
  644. {
  645. return mhdg;
  646. }
  647. double signal_positionInertial::Getpitch()
  648. {
  649. return mpitch;
  650. }
  651. double signal_positionInertial::Getroll()
  652. {
  653. return mroll;
  654. }
  655. void signal_positionInertial::Setx(double x)
  656. {
  657. mx = x;
  658. }
  659. void signal_positionInertial::Sety(double y)
  660. {
  661. my = y;
  662. }
  663. void signal_positionInertial::Setz(double z)
  664. {
  665. mz = z;
  666. }
  667. void signal_positionInertial::Sethdg(double hdg)
  668. {
  669. mhdg = hdg;
  670. }
  671. void signal_positionInertial::Setpitch(double pitch)
  672. {
  673. mpitch = pitch;
  674. }
  675. void signal_positionInertial::Setroll(double roll)
  676. {
  677. mroll = roll;
  678. }
  679. signal_laneValidity::signal_laneValidity(int fromLane,int toLane)
  680. {
  681. mfromLane = fromLane;
  682. mtoLane = toLane;
  683. }
  684. int signal_laneValidity::GetfromLane()
  685. {
  686. return mfromLane;
  687. }
  688. int signal_laneValidity::GettoLane()
  689. {
  690. return mtoLane;
  691. }
  692. void signal_laneValidity::SetfromLane(int fromLane)
  693. {
  694. mfromLane = fromLane;
  695. }
  696. void signal_laneValidity::SettoLane(int toLane)
  697. {
  698. mtoLane = toLane;
  699. }
  700. Signal::Signal(double s, double t, std::string id, std::string name, bool dynamic,string orientation,
  701. double zOffset, string type, std::string country, std::string countryRevision,
  702. string subtype, double hOffset, double pitch, double roll, double height, double width)
  703. {
  704. ms = s;
  705. mt = t;
  706. mid = id;
  707. mname = name;
  708. mdynamic = dynamic;
  709. morientation = orientation;
  710. mzOffset = zOffset;
  711. mtype = type;
  712. mcountry = country;
  713. mcountryRevision = countryRevision;
  714. msubtype = subtype;
  715. mhOffset = hOffset;
  716. mpitch = pitch;
  717. mroll = roll;
  718. mheight = height;
  719. mwidth = width;
  720. mpsignal_laneValidity = 0;
  721. mpsignal_positionInertial = 0;
  722. mpsignal_positionRoad = new signal_positionRoad(s,t,zOffset,hOffset,pitch,roll);
  723. }
  724. Signal::Signal()
  725. {
  726. mpsignal_positionInertial = 0;
  727. mpsignal_positionRoad = 0;
  728. mpsignal_laneValidity = 0;
  729. }
  730. Signal::~Signal()
  731. {
  732. if(mpsignal_laneValidity != 0)delete mpsignal_laneValidity;
  733. if(mpsignal_positionInertial != 0)delete mpsignal_positionInertial;
  734. if(mpsignal_positionRoad != 0)delete mpsignal_positionRoad;
  735. }
  736. Signal& Signal::operator=(const Signal& x)
  737. {
  738. if (this != &x)
  739. {
  740. this->ms = x.ms;
  741. this->mt = x.mt;
  742. this->mid = x.mid;
  743. this->mname = x.mname;
  744. this->mdynamic = x.mdynamic;
  745. this->morientation = x.morientation;
  746. this->mzOffset = x.mzOffset;
  747. this->mtype = x.mtype;
  748. this->mcountry = x.mcountry;
  749. this->mcountryRevision = x.mcountryRevision;
  750. this->msubtype = x.msubtype;
  751. this->mhOffset = x.mhOffset;
  752. this->mpitch = x.mpitch;
  753. this->mroll = x.mroll;
  754. this->mheight = x.mheight;
  755. this->mwidth = x.mwidth;
  756. this->mpsignal_positionInertial = 0;
  757. if(x.mpsignal_positionInertial != 0)
  758. {
  759. this->mpsignal_positionInertial = new signal_positionInertial(x.mpsignal_positionInertial->Getx(),
  760. x.mpsignal_positionInertial->Gety(),
  761. x.mpsignal_positionInertial->Getz(),
  762. x.mpsignal_positionInertial->Gethdg(),
  763. x.mpsignal_positionInertial->Getpitch(),
  764. x.mpsignal_positionInertial->Getroll());
  765. }
  766. this->mpsignal_laneValidity = 0;
  767. if(x.mpsignal_laneValidity != 0)
  768. {
  769. this->mpsignal_laneValidity = new signal_laneValidity(x.mpsignal_laneValidity->GetfromLane(),
  770. x.mpsignal_laneValidity->GettoLane());
  771. }
  772. this->mpsignal_positionRoad = new signal_positionRoad(ms,mt,mzOffset,mhOffset,mpitch,mroll);
  773. }
  774. return *this;
  775. }
  776. Signal::Signal(const Signal &x)
  777. {
  778. ms = x.ms;
  779. mt = x.mt;
  780. mid = x.mid;
  781. mname = x.mname;
  782. mdynamic = x.mdynamic;
  783. morientation = x.morientation;
  784. mzOffset = x.mzOffset;
  785. mtype = x.mtype;
  786. mcountry = x.mcountry;
  787. mcountryRevision = x.mcountryRevision;
  788. msubtype = x.msubtype;
  789. mhOffset = x.mhOffset;
  790. mpitch = x.mpitch;
  791. mroll = x.mroll;
  792. mheight = x.mheight;
  793. mwidth = x.mwidth;
  794. this->mpsignal_positionInertial = 0;
  795. if(x.mpsignal_positionInertial != 0)
  796. {
  797. this->mpsignal_positionInertial = new signal_positionInertial(x.mpsignal_positionInertial->Getx(),
  798. x.mpsignal_positionInertial->Gety(),
  799. x.mpsignal_positionInertial->Getz(),
  800. x.mpsignal_positionInertial->Gethdg(),
  801. x.mpsignal_positionInertial->Getpitch(),
  802. x.mpsignal_positionInertial->Getroll());
  803. }
  804. this->mpsignal_laneValidity = 0;
  805. if(x.mpsignal_laneValidity != 0)
  806. {
  807. this->mpsignal_laneValidity = new signal_laneValidity(x.mpsignal_laneValidity->GetfromLane(),
  808. x.mpsignal_laneValidity->GettoLane());
  809. }
  810. mpsignal_positionRoad = new signal_positionRoad(ms,mt,mzOffset,mhOffset,mpitch,mroll);
  811. }
  812. double Signal::Gets()
  813. {
  814. return ms;
  815. }
  816. double Signal::Gett()
  817. {
  818. return mt;
  819. }
  820. string Signal::Getid()
  821. {
  822. return mid;
  823. }
  824. string Signal::Getname()
  825. {
  826. return mname;
  827. }
  828. bool Signal::Getdynamic()
  829. {
  830. return mdynamic;
  831. }
  832. string Signal::Getorientation()
  833. {
  834. return morientation;
  835. }
  836. double Signal::GetzOffset()
  837. {
  838. return mzOffset;
  839. }
  840. string Signal::Gettype()
  841. {
  842. return mtype;
  843. }
  844. string Signal::Getcountry()
  845. {
  846. return mcountry;
  847. }
  848. string Signal::GetcountryRevision()
  849. {
  850. return mcountryRevision;
  851. }
  852. string Signal::Getsubtype()
  853. {
  854. return msubtype;
  855. }
  856. double Signal::GethOffset()
  857. {
  858. return mhOffset;
  859. }
  860. double Signal::Getpitch()
  861. {
  862. return mpitch;
  863. }
  864. double Signal::Getroll()
  865. {
  866. return mroll;
  867. }
  868. double Signal::Getheight()
  869. {
  870. return mheight;
  871. }
  872. double Signal::Getwidth()
  873. {
  874. return mwidth;
  875. }
  876. signal_positionRoad * Signal::GetpositionRoad()
  877. {
  878. return mpsignal_positionRoad;
  879. }
  880. signal_positionInertial * Signal::GetpositionInertial()
  881. {
  882. return mpsignal_positionInertial;
  883. }
  884. void Signal::Sets(double s)
  885. {
  886. ms = s;
  887. }
  888. void Signal::Sett(double t)
  889. {
  890. mt = t;
  891. }
  892. void Signal::Setid(std::string id)
  893. {
  894. mid = id;
  895. }
  896. void Signal::Setname(std::string name)
  897. {
  898. mname = name;
  899. }
  900. void Signal::Setdynamic(bool dynamic)
  901. {
  902. mdynamic = dynamic;
  903. }
  904. void Signal::Setorientation(std::string orientation)
  905. {
  906. morientation = orientation;
  907. }
  908. void Signal::SetzOffset(double zOffset)
  909. {
  910. mzOffset = zOffset;
  911. }
  912. void Signal::Settype(string type)
  913. {
  914. mtype = type;
  915. }
  916. void Signal::Setcountry(std::string country)
  917. {
  918. mcountry = country;
  919. }
  920. void Signal::SetcountryRevision(std::string countryRevision)
  921. {
  922. mcountryRevision = countryRevision;
  923. }
  924. void Signal::Setsubtype(string subtype)
  925. {
  926. msubtype = subtype;
  927. }
  928. void Signal::SethOffset(double hOffset)
  929. {
  930. mhOffset = hOffset;
  931. }
  932. void Signal::Setpitch(double pitch)
  933. {
  934. mpitch = pitch;
  935. }
  936. void Signal::Setroll(double roll)
  937. {
  938. mroll = roll;
  939. }
  940. void Signal::Setheight(double height)
  941. {
  942. mheight = height;
  943. }
  944. void Signal::Setwidth(double width)
  945. {
  946. mwidth = width;
  947. }
  948. void Signal::SetlaneValidity(int fromLane, int toLane)
  949. {
  950. if(mpsignal_laneValidity == 0)
  951. {
  952. mpsignal_laneValidity = new signal_laneValidity(fromLane,toLane);
  953. }
  954. else
  955. {
  956. mpsignal_laneValidity->SetfromLane(fromLane);
  957. mpsignal_laneValidity->SettoLane(toLane);
  958. }
  959. }
  960. void Signal::SetpositionRoad(double s, double t, double zOffset, double hOffset, double pitch,double roll)
  961. {
  962. if(mpsignal_positionRoad == 0)
  963. {
  964. mpsignal_positionRoad = new signal_positionRoad(s,t,zOffset,hOffset,pitch,roll);
  965. }
  966. else
  967. {
  968. mpsignal_positionRoad->Sets(s);
  969. mpsignal_positionRoad->Sett(t);
  970. mpsignal_positionRoad->SetzOffset(zOffset);
  971. mpsignal_positionRoad->SethOffset(hOffset);
  972. mpsignal_positionRoad->Setpitch(pitch);
  973. mpsignal_positionRoad->Setroll(roll);
  974. }
  975. }
  976. void Signal::SetpositionInertial(double x, double y, double z, double hdg, double pitch, double roll)
  977. {
  978. if(mpsignal_positionInertial == 0)
  979. {
  980. mpsignal_positionInertial = new signal_positionInertial(x,y,z,hdg,pitch,roll);
  981. }
  982. else
  983. {
  984. mpsignal_positionInertial->Setx(x);
  985. mpsignal_positionInertial->Sety(y);
  986. mpsignal_positionInertial->Setz(z);
  987. mpsignal_positionInertial->Sethdg(hdg);
  988. mpsignal_positionInertial->Setpitch(pitch);
  989. mpsignal_positionInertial->Setroll(roll);
  990. }
  991. }
  992. signal_laneValidity * Signal::GetlaneValidity()
  993. {
  994. return mpsignal_laneValidity;
  995. }