Mercurial > hg > orthanc-stone
comparison Framework/Radiography/RadiographyScene.cpp @ 571:a29f9628369e
fix build on visual studio 2008
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 18 Apr 2019 16:34:25 +0200 |
parents | 92305ee35b1c |
children | 7a7e36c52d62 |
comparison
equal
deleted
inserted
replaced
569:943f9fb02496 | 571:a29f9628369e |
---|---|
197 | 197 |
198 void RadiographyScene::RemoveLayer(size_t layerIndex) | 198 void RadiographyScene::RemoveLayer(size_t layerIndex) |
199 { | 199 { |
200 LOG(INFO) << "Removing layer: " << layerIndex; | 200 LOG(INFO) << "Removing layer: " << layerIndex; |
201 | 201 |
202 if (layerIndex > countLayers_) | 202 Layers::iterator found = layers_.find(layerIndex); |
203 | |
204 if (found == layers_.end()) | |
203 { | 205 { |
204 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 206 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
205 } | 207 } |
206 delete layers_[layerIndex]; | 208 else |
207 layers_.erase(layerIndex); | 209 { |
208 countLayers_--; | 210 assert(found->second != NULL); |
209 LOG(INFO) << "Removing layer, there are now : " << countLayers_ << " layers"; | 211 delete found->second; |
212 | |
213 layers_.erase(found); | |
214 countLayers_--; | |
215 | |
216 LOG(INFO) << "Removing layer, there are now : " << countLayers_ << " layers"; | |
217 } | |
210 } | 218 } |
211 | 219 |
212 const RadiographyLayer& RadiographyScene::GetLayer(size_t layerIndex) const | 220 const RadiographyLayer& RadiographyScene::GetLayer(size_t layerIndex) const |
213 { | 221 { |
214 if (layerIndex > countLayers_) | 222 Layers::const_iterator found = layers_.find(layerIndex); |
223 | |
224 if (found == layers_.end()) | |
215 { | 225 { |
216 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); | 226 throw Orthanc::OrthancException(Orthanc::ErrorCode_ParameterOutOfRange); |
217 } | 227 } |
218 | 228 else |
219 return *(layers_.at(layerIndex)); | 229 { |
230 assert(found->second != NULL); | |
231 return *found->second; | |
232 } | |
220 } | 233 } |
221 | 234 |
222 bool RadiographyScene::GetWindowing(float& center, | 235 bool RadiographyScene::GetWindowing(float& center, |
223 float& width) const | 236 float& width) const |
224 { | 237 { |