From: asl Date: Mon, 30 Oct 2017 07:04:49 +0000 (+0300) Subject: size of image is limited by 7000 pixels X-Git-Tag: v2.1~67^2~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=90c2fe17cb7db610122200702a86b66d8c4f1112;p=modules%2Fhydro.git size of image is limited by 7000 pixels --- diff --git a/src/HYDROGUI/HYDROGUI_ShapeImage.cxx b/src/HYDROGUI/HYDROGUI_ShapeImage.cxx index d57f726d..765e75d6 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeImage.cxx +++ b/src/HYDROGUI/HYDROGUI_ShapeImage.cxx @@ -25,6 +25,9 @@ #include #include +#include +#include +#include HYDROGUI_ShapeImage::HYDROGUI_ShapeImage( const Handle(AIS_InteractiveContext)& theContext, const Handle(HYDROData_Image)& theImage, @@ -55,14 +58,17 @@ QList HYDROGUI_ShapeImage::createShape() const Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast( getObject() ); if ( !anImageObj.IsNull() ) { - aPrs = new HYDROGUI_ImagePrs( imagePixMap( anImageObj ), imageContour( anImageObj ) ); + QString aMsg; + aPrs = new HYDROGUI_ImagePrs( imagePixMap( anImageObj, aMsg ), imageContour( anImageObj ) ); + if( !aMsg.isEmpty() ) + QMessageBox::warning( qApp->desktop(), "Warning", aMsg ); shapes.append( aPrs ); } return shapes; } -Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Image)& theImageObj ) const +Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Image)& theImageObj, QString& theMessage ) const { Handle(Image_PixMap) aPix; if ( !theImageObj.IsNull() ) @@ -79,7 +85,14 @@ Handle(Image_PixMap) HYDROGUI_ShapeImage::imagePixMap( const Handle(HYDROData_Im if ( aDelta > 0 ) aTrsfWidth += ( 4 - aDelta ); + const int maxWidth = 7000; + if( aTrsfWidth>maxWidth ) + { + aTrsfWidth = maxWidth; + theMessage = QString( "The size of image is scaled to %0" ).arg( aTrsfWidth ); + } anImage = anImage.scaledToWidth( aTrsfWidth ); + int pix = anImage.width() * anImage.height(); aPix = HYDROGUI_Tool::Pixmap( anImage ); } diff --git a/src/HYDROGUI/HYDROGUI_ShapeImage.h b/src/HYDROGUI/HYDROGUI_ShapeImage.h index 17c6dec0..71941262 100644 --- a/src/HYDROGUI/HYDROGUI_ShapeImage.h +++ b/src/HYDROGUI/HYDROGUI_ShapeImage.h @@ -37,7 +37,7 @@ public: protected: virtual QList createShape() const; - Handle(Image_PixMap) imagePixMap( const Handle(HYDROData_Image)& ) const; + Handle(Image_PixMap) imagePixMap( const Handle(HYDROData_Image)&, QString& theMessage ) const; QPolygonF imageContour( const Handle(HYDROData_Image)& ) const; };