1 // Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include "ImageComposer_FuseOperator.h"
21 #include "ImageComposer_MetaTypes.h"
29 ImageComposer_FuseOperator::ImageComposer_FuseOperator()
30 : ImageComposer_Operator()
36 ImageComposer_FuseOperator::~ImageComposer_FuseOperator()
42 QString ImageComposer_FuseOperator::name() const
49 QRectF ImageComposer_FuseOperator::calcResultBoundingRect( const QVariant& theObj1,
50 const QVariant& theObj2 ) const
53 if ( !theObj1.isNull() && theObj1.canConvert<ImageComposer_Image>() &&
54 !theObj2.isNull() && theObj2.canConvert<ImageComposer_Image>() )
56 ImageComposer_Image anImage1 = theObj1.value<ImageComposer_Image>();
57 ImageComposer_Image anImage2 = theObj2.value<ImageComposer_Image>();
59 aResRect = anImage1.boundingRect().united( anImage2.boundingRect() );
66 void ImageComposer_FuseOperator::drawResult( QPainter& thePainter,
67 const QVariant& theObj1,
68 const QVariant& theObj2 ) const
70 if ( !theObj1.isNull() && theObj1.canConvert<ImageComposer_Image>() )
72 ImageComposer_Image anImage1 = theObj1.value<ImageComposer_Image>();
73 anImage1.draw( thePainter );
76 if ( !theObj2.isNull() && theObj2.canConvert<ImageComposer_Image>() )
78 ImageComposer_Image anImage2 = theObj2.value<ImageComposer_Image>();
79 anImage2.draw( thePainter );