comparison framework/Document.cpp @ 368:f1cab64363d7 warnfix_no_size_t

Merge from branch tony_integration
author Chris Cannam
date Wed, 18 Jun 2014 08:45:13 +0100
parents 0876ea394902 f5c914661f6f
children a4c2a4685cf1
comparison
equal deleted inserted replaced
367:1e4fa2007e61 368:f1cab64363d7
273 m_doc->addAdditionalModel(model); 273 m_doc->addAdditionalModel(model);
274 names.push_back(QString()); 274 names.push_back(QString());
275 } 275 }
276 vector<Layer *> layers = m_doc->createLayersForDerivedModels 276 vector<Layer *> layers = m_doc->createLayersForDerivedModels
277 (models, names); 277 (models, names);
278 m_handler->layersCreated(m_primary, layers); 278 m_handler->layersCreated(this, m_primary, layers);
279 delete this; 279 delete this;
280 } 280 }
281 281
282 void 282 void
283 noMoreModelsAvailable() { 283 noMoreModelsAvailable() {
284 std::cerr << "AdditionalModelConverter::noMoreModelsAvailable" << std::endl; 284 std::cerr << "AdditionalModelConverter::noMoreModelsAvailable" << std::endl;
285 m_handler->layersCreated(m_primary, vector<Layer *>()); 285 m_handler->layersCreated(this, m_primary, vector<Layer *>());
286 delete this; 286 delete this;
287 }
288
289 void cancel() {
290 foreach (Layer *layer, m_primary) {
291 Model *model = layer->getModel();
292 if (model) {
293 model->abandon();
294 }
295 }
287 } 296 }
288 297
289 private: 298 private:
290 Document *m_doc; 299 Document *m_doc;
291 vector<Layer *> m_primary; 300 vector<Layer *> m_primary;
292 Document::LayerCreationHandler *m_handler; //!!! how to handle destruction of this? 301 Document::LayerCreationHandler *m_handler; //!!! how to handle destruction of this?
293 }; 302 };
294 303
295 void 304 Document::LayerCreationAsyncHandle
296 Document::createDerivedLayersAsync(const Transforms &transforms, 305 Document::createDerivedLayersAsync(const Transforms &transforms,
297 const ModelTransformer::Input &input, 306 const ModelTransformer::Input &input,
298 LayerCreationHandler *handler) 307 LayerCreationHandler *handler)
299 { 308 {
300 QString message; 309 QString message;
316 amc->setPrimaryLayers(layers); 325 amc->setPrimaryLayers(layers);
317 326
318 if (newModels.empty()) { 327 if (newModels.empty()) {
319 //!!! This identifier may be wrong! 328 //!!! This identifier may be wrong!
320 emit modelGenerationFailed(transforms[0].getIdentifier(), message); 329 emit modelGenerationFailed(transforms[0].getIdentifier(), message);
330 //!!! what to do with amc?
321 } else if (message != "") { 331 } else if (message != "") {
322 //!!! This identifier may be wrong! 332 //!!! This identifier may be wrong!
323 emit modelGenerationWarning(transforms[0].getIdentifier(), message); 333 emit modelGenerationWarning(transforms[0].getIdentifier(), message);
324 } 334 //!!! what to do with amc?
335 }
336
337 return amc;
338 }
339
340 void
341 Document::cancelAsyncLayerCreation(Document::LayerCreationAsyncHandle h)
342 {
343 AdditionalModelConverter *conv = static_cast<AdditionalModelConverter *>(h);
344 conv->cancel();
325 } 345 }
326 346
327 vector<Layer *> 347 vector<Layer *>
328 Document::createLayersForDerivedModels(vector<Model *> newModels, 348 Document::createLayersForDerivedModels(vector<Model *> newModels,
329 QStringList names) 349 QStringList names)