comparison Framework/Layers/DicomStructureSetRendererFactory.cpp @ 381:19bd222283ae

uncoupling LayerReadyMessage from the creation of the renderer
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 06 Nov 2018 15:36:06 +0100
parents ba5ad93f935a
children 17d54c028805
comparison
equal deleted inserted replaced
380:ba5ad93f935a 381:19bd222283ae
124 return true; 124 return true;
125 } 125 }
126 }; 126 };
127 127
128 128
129 class DicomStructureSetRendererFactory::RendererFactory : public LayerReadyMessage::IRendererFactory
130 {
131 private:
132 DicomStructureSet& structureSet_;
133 const CoordinateSystem3D& slice_;
134
135 public:
136 RendererFactory(DicomStructureSet& structureSet,
137 const CoordinateSystem3D& slice) :
138 structureSet_(structureSet),
139 slice_(slice)
140 {
141 }
142
143 virtual ILayerRenderer* CreateRenderer() const
144 {
145 return new Renderer(structureSet_, slice_);
146 }
147 };
148
149
129 void DicomStructureSetRendererFactory::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice) 150 void DicomStructureSetRendererFactory::ScheduleLayerCreation(const CoordinateSystem3D& viewportSlice)
130 { 151 {
131 if (loader_.HasStructureSet()) 152 if (loader_.HasStructureSet())
132 { 153 {
133 NotifyLayerReady(new Renderer(loader_.GetStructureSet(), viewportSlice), viewportSlice); 154 RendererFactory factory(loader_.GetStructureSet(), viewportSlice);
155 NotifyLayerReady(factory, viewportSlice);
134 } 156 }
135 } 157 }
136 } 158 }