comparison Applications/Samples/SingleFrameApplication.h @ 90:64e60018943f wasm

fix and observer refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 29 May 2017 11:04:18 +0200
parents f244018a4e4b
children 961ee171d933
comparison
equal deleted inserted replaced
89:f244018a4e4b 90:64e60018943f
92 } 92 }
93 }; 93 };
94 94
95 virtual void NotifyGeometryReady(const ILayerSource& source) 95 virtual void NotifyGeometryReady(const ILayerSource& source)
96 { 96 {
97 const OrthancFrameLayerSource& frame =
98 dynamic_cast<const OrthancFrameLayerSource&>(source);
99
100 if (frame.GetSliceCount() > 0)
101 {
102 widget_->SetSlice(frame.GetSlice(0).GetGeometry());
103 widget_->SetDefaultView();
104 }
97 } 105 }
98 106
99 virtual void NotifyGeometryError(const ILayerSource& source) 107 virtual void NotifyGeometryError(const ILayerSource& source)
100 { 108 {
101 } 109 }
107 virtual void NotifySliceChange(const ILayerSource& source, 115 virtual void NotifySliceChange(const ILayerSource& source,
108 const Slice& slice) 116 const Slice& slice)
109 { 117 {
110 } 118 }
111 119
112 virtual void NotifyLayerReady(ILayerRenderer *layer, 120 virtual void NotifyLayerReady(std::auto_ptr<ILayerRenderer>& layer,
113 const ILayerSource& source, 121 const ILayerSource& source,
114 const Slice& slice) 122 const Slice& slice)
115 { 123 {
116 } 124 }
117 125
160 std::string instance = parameters["instance"].as<std::string>(); 168 std::string instance = parameters["instance"].as<std::string>();
161 int frame = parameters["frame"].as<unsigned int>(); 169 int frame = parameters["frame"].as<unsigned int>();
162 170
163 std::auto_ptr<LayerWidget> widget(new LayerWidget); 171 std::auto_ptr<LayerWidget> widget(new LayerWidget);
164 172
165 #if 1 173 #if 0
166 std::auto_ptr<OrthancFrameLayerSource> layer 174 std::auto_ptr<OrthancFrameLayerSource> layer
167 (new OrthancFrameLayerSource(context.GetWebService(), instance, frame)); 175 (new OrthancFrameLayerSource(context.GetWebService(), instance, frame));
176 layer->Register(*this);
168 widget->AddLayer(layer.release()); 177 widget->AddLayer(layer.release());
169 178
170 if (parameters["smooth"].as<bool>()) 179 if (parameters["smooth"].as<bool>())
171 { 180 {
172 RenderStyle s; 181 RenderStyle s;
176 #else 185 #else
177 // 0178023P** 186 // 0178023P**
178 std::auto_ptr<OrthancFrameLayerSource> ct; 187 std::auto_ptr<OrthancFrameLayerSource> ct;
179 ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0)); 188 ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "c804a1a2-142545c9-33b32fe2-3df4cec0-a2bea6d6", 0));
180 //ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0)); // BAD SLICE 189 //ct.reset(new OrthancFrameLayerSource(context.GetWebService(), "4bd4304f-47478948-71b24af2-51f4f1bc-275b6c1b", 0)); // BAD SLICE
190 ct->Register(*this);
181 widget->AddLayer(ct.release()); 191 widget->AddLayer(ct.release());
182 192
183 std::auto_ptr<OrthancFrameLayerSource> pet; 193 std::auto_ptr<OrthancFrameLayerSource> pet;
184 pet.reset(new OrthancFrameLayerSource(context.GetWebService(), "a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0)); 194 pet.reset(new OrthancFrameLayerSource(context.GetWebService(), "a1c4dc6b-255d27f0-88069875-8daed730-2f5ee5c6", 0));
185 widget->AddLayer(pet.release()); 195 widget->AddLayer(pet.release());