Salome HOME
Updated copyright comment
[modules/gui.git] / src / ImageComposer / ImageComposer_CutOperator.cxx
1 // Copyright (C) 2013-2024  CEA, EDF, OPEN CASCADE
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #include "ImageComposer_CutOperator.h"
21 #include "ImageComposer_MetaTypes.h"
22 #include <QString>
23 #include <QPixmap>
24 #include <QPainter>
25
26 /**
27   Constructor
28 */
29 ImageComposer_CutOperator::ImageComposer_CutOperator()
30   : ImageComposer_Operator()
31 {
32 }
33
34 /**
35 */
36 ImageComposer_CutOperator::~ImageComposer_CutOperator()
37 {
38 }
39
40 /**
41 */
42 QString ImageComposer_CutOperator::name() const
43 {
44   return Type();
45 }
46
47 /**
48 */
49 QRectF ImageComposer_CutOperator::calcResultBoundingRect( const QVariant& theObj1, 
50                                                           const QVariant& ) const
51 {
52   QRectF aResRect;
53   if ( !theObj1.isNull() && theObj1.canConvert<ImageComposer_Image>() )
54   {
55     ImageComposer_Image anImage1 = theObj1.value<ImageComposer_Image>();
56     aResRect = anImage1.boundingRect();
57   }
58   return aResRect;
59 }
60
61 /**
62 */
63 void ImageComposer_CutOperator::drawResult( QPainter&       thePainter,
64                                             const QVariant& theObj1,
65                                             const QVariant& theObj2 ) const
66 {
67   if ( !theObj1.isNull() && theObj1.canConvert<ImageComposer_Image>() )
68   {
69     ImageComposer_Image anImage1 = theObj1.value<ImageComposer_Image>();
70     anImage1.draw( thePainter );
71   }
72
73   if ( !theObj2.isNull() && theObj2.canConvert<ImageComposer_Image>() )
74   {
75     ImageComposer_Image anImage2 = theObj2.value<ImageComposer_Image>();
76     anImage2.draw( thePainter );
77   }
78 }