LCOV - code coverage report
Current view: top level - OdbDesignLib/FileModel/Design - ContourPolygon.cpp (source / functions) Coverage Total Hit
Test: OdbDesign Test Coverage Lines: 94.6 % 37 35
Test Date: 2026-11-19 04:56:22 Functions: 100.0 % 4 4
Legend: Lines: hit not hit

            Line data    Source code
       1              : #include "ContourPolygon.h"
       2              : 
       3              : namespace Odb::Lib::FileModel::Design
       4              : {
       5       489359 :         std::unique_ptr<Odb::Lib::Protobuf::ContourPolygon> ContourPolygon::to_protobuf() const
       6              :         {
       7       489359 :                 std::unique_ptr<Odb::Lib::Protobuf::ContourPolygon> pContourPolygonMessage(new Odb::Lib::Protobuf::ContourPolygon);
       8       489359 :                 pContourPolygonMessage->set_type((Odb::Lib::Protobuf::ContourPolygon::Type) type);
       9       489359 :                 pContourPolygonMessage->set_xstart(xStart);
      10       489359 :                 pContourPolygonMessage->set_ystart(yStart);
      11      5701280 :                 for (const auto& pPolygonPart : m_polygonParts)
      12              :                 {
      13      5211921 :                         pContourPolygonMessage->add_polygonparts()->CopyFrom(*pPolygonPart->to_protobuf());
      14              :                 }
      15       489359 :                 return pContourPolygonMessage;
      16            0 :         }
      17              : 
      18        28221 :         void ContourPolygon::from_protobuf(const Odb::Lib::Protobuf::ContourPolygon& message)
      19              :         {
      20        28221 :                 type = (Type) message.type();
      21        28221 :                 xStart = message.xstart();
      22        28221 :                 yStart = message.ystart();
      23       334255 :                 for (const auto& polygonPartMessage : message.polygonparts())
      24              :                 {
      25       306034 :                         std::shared_ptr<PolygonPart> pPolygonPart(new PolygonPart);
      26       306034 :                         pPolygonPart->from_protobuf(polygonPartMessage);
      27       306034 :                         m_polygonParts.push_back(pPolygonPart);
      28       306034 :                 }
      29        28221 :         }
      30              : 
      31              :         // Inherited via IProtoBuffable
      32      5211921 :         std::unique_ptr<Odb::Lib::Protobuf::ContourPolygon::PolygonPart> ContourPolygon::PolygonPart::to_protobuf() const
      33              :         {
      34      5211921 :                 std::unique_ptr<Odb::Lib::Protobuf::ContourPolygon::PolygonPart> pPolygonPartMessage(new Odb::Lib::Protobuf::ContourPolygon::PolygonPart);
      35      5211921 :                 pPolygonPartMessage->set_endx(endX);
      36      5211921 :                 pPolygonPartMessage->set_endy(endY);
      37      5211921 :                 pPolygonPartMessage->set_xcenter(xCenter);
      38      5211921 :                 pPolygonPartMessage->set_ycenter(yCenter);
      39      5211921 :                 pPolygonPartMessage->set_isclockwise(isClockwise);
      40      5211921 :                 pPolygonPartMessage->set_type(static_cast<Odb::Lib::Protobuf::ContourPolygon::PolygonPart::Type>(type));
      41      5211921 :                 return pPolygonPartMessage;
      42            0 :         }
      43              : 
      44       306034 :         void ContourPolygon::PolygonPart::from_protobuf(const Odb::Lib::Protobuf::ContourPolygon::PolygonPart& message)
      45              :         {
      46       306034 :                 endX = message.endx();
      47       306034 :                 endY = message.endy();
      48       306034 :                 xCenter = message.xcenter();
      49       306034 :                 yCenter = message.ycenter();
      50       306034 :                 isClockwise = message.isclockwise();
      51              : 
      52              :                 // the wire type is the proto enum's integer value; map it back to the
      53              :                 // FileModel enum so part-type-dependent logic sees the right variant
      54       306034 :                 type = static_cast<Type>(message.type());
      55       306034 :         }
      56              : }
        

Generated by: LCOV version 2.0-1