1 #include<HYDROData_OperationsFactory.h>
3 #include<HYDROData_Document.h>
4 #include<HYDROData_Iterator.h>
6 #include<ImageComposer_ColorMaskOperator.h>
7 #include<ImageComposer_CropOperator.h>
8 #include<ImageComposer_CutOperator.h>
9 #include<ImageComposer_FuseOperator.h>
14 HYDROData_OperationsFactory* FACTORY = 0;
16 HYDROData_OperationsFactory* HYDROData_OperationsFactory::Factory()
19 FACTORY = new HYDROData_OperationsFactory;
21 REGISTER_HYDRO_OPERATION(ImageComposer_ColorMaskOperator)
22 REGISTER_HYDRO_OPERATION(ImageComposer_CropOperator)
23 REGISTER_HYDRO_OPERATION(ImageComposer_CutOperator)
24 REGISTER_HYDRO_OPERATION(ImageComposer_FuseOperator)
29 void HYDROData_OperationsFactory::Register(
30 ImageComposer_Operator* theOperator)
35 FACTORY->myOps[ theOperator->name() ] = theOperator;
38 HYDROData_OperationsFactory::HYDROData_OperationsFactory()
42 ImageComposer_Operator* HYDROData_OperationsFactory::Operator(
43 Handle(HYDROData_Image) theImage ) const
45 // retreive operator instance by name
46 ImageComposer_Operator* anOp = Operator( theImage->OperatorName() );
50 // fill arguments of the operator from theImage
51 anOp->setBinArgs( theImage->Args() );
56 ImageComposer_Operator* HYDROData_OperationsFactory::Operator(const QString theName) const
58 return myOps.contains( theName ) ? myOps[ theName ] : NULL;
61 Handle(HYDROData_Image) HYDROData_OperationsFactory::CreateImage(
62 Handle(HYDROData_Document) theDoc, const ImageComposer_Operator* theOperator)
65 Handle(HYDROData_Image) anImage =
66 Handle(HYDROData_Image)::DownCast(theDoc->CreateObject(KIND_IMAGE));
67 // get data from operation
69 anImage->SetOperatorName( theOperator->name() );
70 anImage->SetArgs( theOperator->getBinArgs() );