1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include<HYDROData_OperationsFactory.h>
21 #include<HYDROData_Document.h>
22 #include<HYDROData_Iterator.h>
24 #include<ImageComposer_ColorMaskOperator.h>
25 #include<ImageComposer_CropOperator.h>
26 #include<ImageComposer_CutOperator.h>
27 #include<ImageComposer_FuseOperator.h>
32 HYDROData_OperationsFactory* FACTORY = 0;
34 HYDROData_OperationsFactory* HYDROData_OperationsFactory::Factory()
37 FACTORY = new HYDROData_OperationsFactory;
39 REGISTER_HYDRO_OPERATION(ImageComposer_ColorMaskOperator)
40 REGISTER_HYDRO_OPERATION(ImageComposer_CropOperator)
41 REGISTER_HYDRO_OPERATION(ImageComposer_CutOperator)
42 REGISTER_HYDRO_OPERATION(ImageComposer_FuseOperator)
47 void HYDROData_OperationsFactory::Register(
48 ImageComposer_Operator* theOperator)
53 FACTORY->myOps[ theOperator->name() ] = theOperator;
56 HYDROData_OperationsFactory::HYDROData_OperationsFactory()
60 ImageComposer_Operator* HYDROData_OperationsFactory::Operator(
61 Handle(HYDROData_Image) theImage ) const
63 // retreive operator instance by name
64 ImageComposer_Operator* anOp = Operator( theImage->OperatorName() );
68 // fill arguments of the operator from theImage
69 anOp->setBinArgs( theImage->Args() );
74 ImageComposer_Operator* HYDROData_OperationsFactory::Operator(const QString theName) const
76 return myOps.contains( theName ) ? myOps[ theName ] : NULL;
79 Handle(HYDROData_Image) HYDROData_OperationsFactory::CreateImage(
80 Handle(HYDROData_Document) theDoc, const ImageComposer_Operator* theOperator)
83 Handle(HYDROData_Image) anImage =
84 Handle(HYDROData_Image)::DownCast(theDoc->CreateObject(KIND_IMAGE));
85 // get data from operation
87 anImage->SetOperatorName( theOperator->name() );
88 anImage->SetArgs( theOperator->getBinArgs() );