#include <HYDROData_Document.h>
#include <gp_Pnt.hxx>
+#include <QMessageBox>
+#include <QApplication>
+#include <QDesktopWidget>
HYDROGUI_ShapeImage::HYDROGUI_ShapeImage( const Handle(AIS_InteractiveContext)& theContext,
const Handle(HYDROData_Image)& theImage,
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() )
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 );
}
protected:
virtual QList<Handle(AIS_InteractiveObject)> 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;
};