Mercurial > hg > orthanc-stone
comparison Framework/Deprecated/Layers/DicomStructureSetSlicer.cpp @ 1006:4f28d9459e31 toa2019092001
Fixed unit tests and deprecated classes according to last API changes. UT all run ok.
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Fri, 20 Sep 2019 12:13:10 +0200 |
parents | 35ed6812d639 |
children | e713f1a99861 287ec78f63b4 |
comparison
equal
deleted
inserted
replaced
1005:7e861cfd142d | 1006:4f28d9459e31 |
---|---|
27 { | 27 { |
28 private: | 28 private: |
29 class Structure | 29 class Structure |
30 { | 30 { |
31 private: | 31 private: |
32 bool visible_; | 32 bool visible_; |
33 uint8_t red_; | 33 uint8_t red_; |
34 uint8_t green_; | 34 uint8_t green_; |
35 uint8_t blue_; | 35 uint8_t blue_; |
36 std::string name_; | 36 std::string name_; |
37 std::vector< std::vector<OrthancStone::DicomStructureSet::PolygonPoint2D> > polygons_; | 37 std::vector< std::pair<OrthancStone::Point2D, OrthancStone::Point2D> > segments_; |
38 | 38 |
39 public: | 39 public: |
40 Structure(OrthancStone::DicomStructureSet& structureSet, | 40 Structure(OrthancStone::DicomStructureSet& structureSet, |
41 const OrthancStone::CoordinateSystem3D& plane, | 41 const OrthancStone::CoordinateSystem3D& plane, |
42 size_t index) : | 42 size_t index) : |
43 name_(structureSet.GetStructureName(index)) | 43 name_(structureSet.GetStructureName(index)) |
44 { | 44 { |
45 structureSet.GetStructureColor(red_, green_, blue_, index); | 45 structureSet.GetStructureColor(red_, green_, blue_, index); |
46 visible_ = structureSet.ProjectStructure(polygons_, index, plane); | 46 visible_ = structureSet.ProjectStructure(segments_, index, plane); |
47 } | 47 } |
48 | 48 |
49 void Render(OrthancStone::CairoContext& context) | 49 void Render(OrthancStone::CairoContext& context) |
50 { | 50 { |
51 if (visible_) | 51 if (visible_) |
52 { | 52 { |
53 cairo_t* cr = context.GetObject(); | 53 cairo_t* cr = context.GetObject(); |
54 | 54 |
55 context.SetSourceColor(red_, green_, blue_); | 55 context.SetSourceColor(red_, green_, blue_); |
56 | 56 |
57 for (size_t i = 0; i < polygons_.size(); i++) | 57 for (size_t i = 0; i < segments_.size(); i++) |
58 { | 58 { |
59 cairo_move_to(cr, polygons_[i][0].first, polygons_[i][0].second); | 59 cairo_move_to(cr, segments_[i].first.x, segments_[i].first.y); |
60 | 60 cairo_move_to(cr, segments_[i].second.x, segments_[i].second.y); |
61 for (size_t j = 1; j < polygons_[i].size(); j++) | |
62 { | |
63 cairo_line_to(cr, polygons_[i][j].first, polygons_[i][j].second); | |
64 } | |
65 | |
66 cairo_line_to(cr, polygons_[i][0].first, polygons_[i][0].second); | |
67 cairo_stroke(cr); | 61 cairo_stroke(cr); |
68 } | 62 } |
69 } | 63 } |
70 } | 64 } |
71 }; | 65 }; |