if( !aViewPort )
return;
- aViewPort->removeItem( myRefPreviewPrs );
+ if( myPreviewPrs )
+ myPreviewPrs->setCaption( QString() );
+
+ if( myRefPreviewPrs )
+ {
+ myRefPreviewPrs->setCaption( QString() );
+ aViewPort->removeItem( myRefPreviewPrs );
- delete myRefPreviewPrs;
- myRefPreviewPrs = 0;
+ delete myRefPreviewPrs;
+ myRefPreviewPrs = 0;
+ }
QImage anImage;
Handle(HYDROData_Image) anImageObj = Handle(HYDROData_Image)::DownCast(
// vertically shift the reference prs relatively to the main prs
if( myPreviewPrs )
{
+ myPreviewPrs->setCaption( tr( "IMPORTED_IMAGE" ) );
+
QImage anImage = myPreviewPrs->getImage();
- myRefPreviewPrs->moveBy( 0, anImage.height() + 20 );
+ myRefPreviewPrs->moveBy( 0, anImage.height() + 60 );
+ myRefPreviewPrs->setCaption( tr( "REFERENCE_IMAGE" ) );
}
aViewPort->addItem( myRefPreviewPrs );
HYDROGUI_PrsImage::HYDROGUI_PrsImage( const Handle(HYDROData_Object)& theObject )
: HYDROGUI_Prs( theObject ),
myPixmapItem( 0 ),
+ myCaptionItem( 0 ),
myPrsImageFrame( 0 ),
myIsTransformationPointPreview( false ),
myTransformationPointType( None )
return myImage;
}
+//================================================================
+// Function : setCaption
+// Purpose :
+//================================================================
+void HYDROGUI_PrsImage::setCaption( const QString& theCaption )
+{
+ if( myCaptionItem )
+ {
+ myCaptionItem->setText( theCaption );
+ myCaptionItem->setVisible( !theCaption.isEmpty() );
+ }
+}
+
+//================================================================
+// Function : getCaption
+// Purpose :
+//================================================================
+QString HYDROGUI_PrsImage::getCaption() const
+{
+ if( myCaptionItem )
+ return myCaptionItem->text();
+ return QString();
+}
+
//================================================================
// Function : setIsTransformationPointPreview
// Purpose :
myPixmapItem = new QGraphicsPixmapItem( this );
addToGroup( myPixmapItem );
}
+ if( !myCaptionItem )
+ {
+ myCaptionItem = new QGraphicsSimpleTextItem( this );
+
+ QFont aFont = myCaptionItem->font();
+ aFont.setPointSize( 14 );
+ myCaptionItem->setFont( aFont );
+
+ addToGroup( myCaptionItem );
+ }
if( !myPrsImageFrame )
{
myPrsImageFrame = new HYDROGUI_PrsImageFrame( this );
addToGroup( myPrsImageFrame );
}
+
myPixmapItem->setPixmap( QPixmap::fromImage( myImage ) );
+
+ myCaptionItem->setPos( 0, -30 );
+ myCaptionItem->setVisible( false );
+
myPrsImageFrame->compute();
}
void setImage( const QImage& theImage );
QImage getImage() const;
+ void setCaption( const QString& theCaption );
+ QString getCaption() const;
+
void setIsTransformationPointPreview( const bool theState );
bool getIsTransformationPointPreview() const;
QImage myImage;
QGraphicsPixmapItem* myPixmapItem;
+ QGraphicsSimpleTextItem* myCaptionItem;
HYDROGUI_PrsImageFrame* myPrsImageFrame;
bool myIsTransformationPointPreview;
<source>IMPORT_IMAGE</source>
<translation>Import image</translation>
</message>
+ <message>
+ <source>IMPORTED_IMAGE</source>
+ <translation>Imported image</translation>
+ </message>
<message>
<source>TRANSFORM_IMAGE</source>
<translation>Transform image</translation>
<source>REFERENCE_POINTS_A_B_C_BELONG_TO_SINGLE_LINE</source>
<translation>Reference points A, B, C belong to a single line.</translation>
</message>
+ <message>
+ <source>REFERENCE_IMAGE</source>
+ <translation>Reference image</translation>
+ </message>
<message>
<source>TRANSFORMATION_MATRIX_CANNOT_BE_COMPUTED</source>
<translation>Transformation matrix cannot be computed.</translation>