Mercurial > hg > orthanc-stone
comparison Framework/Layers/DicomStructureSetRendererFactory.cpp @ 125:44fc253d4876 wasm
refactoring
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 08 Nov 2017 16:13:55 +0100 |
parents | ed0003f6102c |
children | c9e88e7935a4 |
comparison
equal
deleted
inserted
replaced
124:5099aaa53bd0 | 125:44fc253d4876 |
---|---|
47 const ViewportGeometry& view) | 47 const ViewportGeometry& view) |
48 { | 48 { |
49 if (visible_) | 49 if (visible_) |
50 { | 50 { |
51 cairo_set_line_width(context.GetObject(), 3.0f / view.GetZoom()); | 51 cairo_set_line_width(context.GetObject(), 3.0f / view.GetZoom()); |
52 structureSet_.Render(context, slice_); | 52 |
53 cairo_t* cr = context.GetObject(); | |
54 | |
55 for (size_t k = 0; k < structureSet_.GetStructureCount(); k++) | |
56 { | |
57 std::vector< std::vector<DicomStructureSet::PolygonPoint> > polygons; | |
58 | |
59 if (structureSet_.ProjectStructure(polygons, k, slice_)) | |
60 { | |
61 uint8_t red, green, blue; | |
62 structureSet_.GetStructureColor(red, green, blue, k); | |
63 context.SetSourceColor(red, green, blue); | |
64 | |
65 for (size_t i = 0; i < polygons.size(); i++) | |
66 { | |
67 cairo_move_to(cr, polygons[i][0].first, polygons[i][0].second); | |
68 | |
69 for (size_t j = 1; j < polygons[i].size(); j++) | |
70 { | |
71 cairo_line_to(cr, polygons[i][j].first, polygons[i][j].second); | |
72 } | |
73 | |
74 cairo_line_to(cr, polygons[i][0].first, polygons[i][0].second); | |
75 cairo_stroke(cr); | |
76 } | |
77 } | |
78 } | |
53 } | 79 } |
54 | 80 |
55 return true; | 81 return true; |
56 } | 82 } |
57 | 83 |
197 } | 223 } |
198 | 224 |
199 | 225 |
200 void DicomStructureSetRendererFactory::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice) | 226 void DicomStructureSetRendererFactory::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice) |
201 { | 227 { |
202 bool isOpposite; | 228 if (structureSet_.get() != NULL) |
203 if (structureSet_.get() != NULL && | |
204 GeometryToolbox::IsParallelOrOpposite(isOpposite, | |
205 viewportSlice.GetNormal(), | |
206 structureSet_->GetNormal())) | |
207 { | 229 { |
208 NotifyLayerReady(new Renderer(*structureSet_, viewportSlice), viewportSlice, false); | 230 NotifyLayerReady(new Renderer(*structureSet_, viewportSlice), viewportSlice, false); |
209 } | 231 } |
210 } | 232 } |
211 } | 233 } |