LCOV - code coverage report
Current view: top level - src/PointCloud - Object.cpp (source / functions) Hit Total Coverage
Test: HLR Lines: 27 27 100.0 %
Date: 2018-01-24 13:29:27 Functions: 6 6 100.0 %

          Line data    Source code
       1             : #include "Object.hpp"
       2             : #include <CGAL/IO/io.h>
       3             : 
       4             : namespace HLR
       5             : {
       6             : namespace PointCloud
       7             : {
       8             : namespace
       9             : {
      10             : bool is_same_polyhedron(
      11             :     const CGAL::Surface_mesh<CGAL::Simple_cartesian<double>::Point_3>& lhs,
      12             :     const CGAL::Surface_mesh<CGAL::Simple_cartesian<double>::Point_3>& rhs);
      13             : }
      14             : 
      15           1 : Object::operator HLR::Object() const
      16             : {
      17           1 :     HLR::Object object;
      18           1 :     object.id = id;
      19           1 :     if (speed)
      20             :     {
      21           1 :         object.velocity.x = speed->x();
      22           1 :         object.velocity.y = speed->y();
      23           1 :         object.velocity.z = speed->z();
      24           1 :         object.flags |= HLR::Object::HAS_SPEED;
      25             :     }
      26           1 :     object.position.x = middlepoint.x();
      27           1 :     object.position.y = middlepoint.y();
      28           1 :     object.position.z = middlepoint.z();
      29           1 :     object.flags |= static_cast<std::uint8_t>(is_cup ? HLR::Object::IS_CUP : 0);
      30           2 :     object.flags |=
      31           1 :         static_cast<std::uint8_t>(is_deleted ? HLR::Object::IS_DELETED : 0);
      32             : 
      33           2 :     std::ostringstream serialization_stream;
      34           1 :     serialization_stream << polyhedron;
      35           1 :     object.polyhedron = serialization_stream.str();
      36             : 
      37           2 :     return object;
      38             : }
      39             : 
      40           4 : bool Object::operator==(const Object& rhs) const
      41             : {
      42           8 :     return id == rhs.id && is_same_polyhedron(polyhedron, rhs.polyhedron)
      43           4 :            && speed == rhs.speed && is_cup == rhs.is_cup
      44           6 :            && is_deleted == rhs.is_deleted && middlepoint == rhs.middlepoint;
      45             : }
      46             : 
      47           3 : bool Object::operator!=(const Object& rhs) const
      48             : {
      49           3 :     return !(*this == rhs);
      50             : }
      51             : 
      52             : namespace
      53             : {
      54           4 : bool is_same_polyhedron(const CGAL::Surface_mesh<
      55             :                             CGAL::Simple_cartesian<double>::Point_3>& /* lhs */,
      56             :                         const CGAL::Surface_mesh<
      57             :                             CGAL::Simple_cartesian<double>::Point_3>& /* rhs */)
      58             : {
      59             :     // TODO: Actually implement this
      60           4 :     return true;
      61             : }
      62             : } // namespace
      63             : 
      64             : } // namespace PointCloud
      65           3 : } // namespace HLR

Generated by: LCOV version 1.12