1 // Copyright (C) 2014-2015 EDF-R&D
2 // This library is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU Lesser General Public
4 // License as published by the Free Software Foundation; either
5 // version 2.1 of the License, or (at your option) any later version.
7 // This library is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 // Lesser General Public License for more details.
12 // You should have received a copy of the GNU Lesser General Public
13 // License along with this library; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #include "HYDROGUI_Tool.h"
21 #include "HYDROGUI_DataModel.h"
22 #include "HYDROGUI_DataObject.h"
23 #include "HYDROGUI_Module.h"
24 #include "HYDROGUI_Prs.h"
26 #include <HYDROData_Document.h>
27 #include <HYDROData_Iterator.h>
28 #include <HYDROData_ImmersibleZone.h>
29 #include <HYDROData_Tool.h>
30 #include <HYDROData_Profile.h>
34 #include <GraphicsView_Viewer.h>
36 #include <SalomeApp_Study.h>
38 #include <LightApp_Application.h>
39 #include <LightApp_DataOwner.h>
40 #include <LightApp_SelectionMgr.h>
42 #include <OCCViewer_ViewModel.h>
43 #include <OCCViewer_ViewFrame.h>
45 #include <QtxWorkstack.h>
46 #include <QtxActionToolMgr.h>
48 #include <STD_TabDesktop.h>
50 #include <SUIT_Session.h>
51 #include <SUIT_Study.h>
52 #include <SUIT_ViewManager.h>
53 #include <SUIT_ViewWindow.h>
55 #include <SALOMEDSClient.hxx>
57 #include <SVTK_ViewModel.h>
61 #include <QDockWidget>
64 // Definition of this id allows to use 'latin1' (Qt alias for 'ISO-8859-1')
65 // encoding instead of default 'System'
66 #define USE_LATIN1_ENCODING
68 // #define DEB_GROUPS 1
70 QString HYDROGUI_Tool::ToQString( const TCollection_AsciiString& src )
72 #ifdef USE_LATIN1_ENCODING
73 QTextCodec* codec = QTextCodec::codecForName( "latin1" ); // alias for ISO-8859-1
75 QTextCodec* codec = QTextCodec::codecForLocale();
79 res = codec ? codec->toUnicode( (char*)src.ToCString(), src.Length() ) :
80 QString( (char*)src.ToCString() );
84 QString HYDROGUI_Tool::ToQString( const TCollection_ExtendedString& src )
86 return QString( (QChar*)src.ToExtString(), src.Length() );
89 QString HYDROGUI_Tool::ToQString( const Handle(TCollection_HAsciiString)& src )
94 return ToQString( src->String() );
97 QString HYDROGUI_Tool::ToQString( const Handle(TCollection_HExtendedString)& src )
101 return ToQString( src->String() );
104 TCollection_AsciiString HYDROGUI_Tool::ToAsciiString( const QString& src )
106 TCollection_AsciiString res;
109 #ifdef USE_LATIN1_ENCODING
110 QTextCodec* codec = QTextCodec::codecForName( "latin1" ); // alias for ISO-8859-1
112 QTextCodec* codec = QTextCodec::codecForLocale();
116 QByteArray str = codec->fromUnicode( src );
117 res = TCollection_AsciiString( (Standard_CString)str.constData() );
120 res = TCollection_AsciiString( src.toLatin1().data() );
125 TCollection_ExtendedString HYDROGUI_Tool::ToExtString( const QString& src )
128 return TCollection_ExtendedString();
130 Standard_Integer len = src.length();
131 Standard_ExtString extStr = new Standard_ExtCharacter[ ( len + 1 ) * 2 ];
132 memcpy( (void*)extStr, src.unicode(), len * 2 );
133 ((short*)extStr)[ len ] = 0;
135 TCollection_ExtendedString trg( extStr );
140 Handle(TCollection_HAsciiString) HYDROGUI_Tool::ToHAsciiString( const QString& src )
142 return new TCollection_HAsciiString( ToAsciiString( src ) );
145 Handle(TCollection_HExtendedString) HYDROGUI_Tool::ToHExtString( const QString& src )
147 return new TCollection_HExtendedString( ToExtString( src ) );
150 int HYDROGUI_Tool::GetActiveStudyId()
152 if( SUIT_Session* aSession = SUIT_Session::session() )
153 if( SUIT_Application* anApp = aSession->activeApplication() )
154 if( SUIT_Study* aStudy = anApp->activeStudy() )
159 QString HYDROGUI_Tool::GetTempDir( const bool theToCreate )
163 char* tmpdir = getenv ( "HYDRO_TMP_DIR" );
166 // try to create folder if it does not exist
167 QFileInfo fi( tmpdir );
168 if ( !fi.exists() && theToCreate )
170 if ( QDir().mkdir( tmpdir ) )
171 QFile::setPermissions( tmpdir, (QFile::Permissions)0x4FFFF );
172 QFileInfo fi( tmpdir );
173 if ( !fi.exists() || !fi.isWritable() )
178 tmpdir = getenv ( "TEMP" );
180 tmpdir = getenv ( "TMP" );
191 QFileInfo fi( aRes );
192 if ( !fi.exists() || !fi.isWritable() )
193 aRes = QString::null;
198 void HYDROGUI_Tool::SetActiveViewManager( HYDROGUI_Module* theModule,
199 SUIT_ViewManager* theViewManager )
202 if( SUIT_ViewWindow* aViewWindow = theViewManager->getActiveView() )
203 if( STD_TabDesktop* aTabDesktop = dynamic_cast<STD_TabDesktop*>( theModule->getApp()->desktop() ) )
204 if( QtxWorkstack* aWorkstack = aTabDesktop->workstack() )
205 aWorkstack->setActiveWindow( aViewWindow );
208 bool HYDROGUI_Tool::IsObjectHasPresentation( const Handle(HYDROData_Entity)& theObject,
209 const QString& theViewerType )
212 if ( theObject.IsNull() )
215 ObjectKind anObjectKind = theObject->GetKind();
216 if ( theViewerType.isEmpty() || theViewerType == OCCViewer_Viewer::Type() )
218 if ( anObjectKind == KIND_IMAGE ||
219 anObjectKind == KIND_POLYLINEXY ||
220 anObjectKind == KIND_POLYLINE ||
221 anObjectKind == KIND_IMMERSIBLE_ZONE ||
222 anObjectKind == KIND_REGION ||
223 anObjectKind == KIND_ZONE ||
224 anObjectKind == KIND_OBSTACLE ||
225 anObjectKind == KIND_PROFILE ||
226 anObjectKind == KIND_STREAM ||
227 anObjectKind == KIND_CHANNEL ||
228 anObjectKind == KIND_DIGUE ||
229 anObjectKind == KIND_DUMMY_3D ||
230 anObjectKind == KIND_BATHYMETRY
232 || anObjectKind == KIND_SHAPES_GROUP ||
233 anObjectKind == KIND_SPLITTED_GROUP
241 if ( theViewerType.isEmpty() || theViewerType == SVTK_Viewer::Type() )
243 if ( anObjectKind == KIND_BATHYMETRY )
247 if ( theViewerType.isEmpty() || theViewerType == GraphicsView_Viewer::Type() )
249 if ( anObjectKind == KIND_IMAGE ||
250 anObjectKind == KIND_POLYLINEXY )
257 void HYDROGUI_Tool::GetPrsSubObjects( HYDROGUI_Module* theModule,
258 HYDROData_SequenceOfObjects& theSeq )
260 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
261 if( !aDocument.IsNull() )
263 HYDROData_Iterator anIterator( aDocument );
264 for( ; anIterator.More(); anIterator.Next() )
266 Handle(HYDROData_Entity) anObject = anIterator.Current();
267 if ( !IsObjectHasPresentation( anObject ) )
270 theSeq.Append( anObject );
275 HYDROGUI_Prs* HYDROGUI_Tool::GetPresentation( const Handle(HYDROData_Entity)& theObj,
276 const GraphicsView_ObjectList& theObjects )
278 if( !theObj.IsNull() )
280 GraphicsView_ObjectListIterator anIter( theObjects );
281 while( anIter.hasNext() )
283 if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
285 Handle(HYDROData_Entity) anObj = aPrs->getObject();
286 if( IsEqual( anObj, theObj ) )
294 GraphicsView_ObjectList HYDROGUI_Tool::GetPrsList( GraphicsView_ViewPort* theViewPort )
296 GraphicsView_ObjectList aList;
299 GraphicsView_ObjectListIterator anIter( theViewPort->getObjects() );
300 while( anIter.hasNext() )
301 if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
302 aList.append( aPrs );
307 HYDROData_SequenceOfObjects HYDROGUI_Tool::GetSelectedObjects( HYDROGUI_Module* theModule )
309 HYDROData_SequenceOfObjects aSeq;
311 HYDROGUI_DataModel* aModel = theModule->getDataModel();
313 SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr();
314 SUIT_DataOwnerPtrList anOwners;
315 aSelectionMgr->selected( anOwners );
317 QStringList aCollectedNameList; // to avoid duplication
318 foreach( SUIT_DataOwner* aSUITOwner, anOwners )
320 if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
322 Handle(HYDROData_Entity) anObject = aModel->objectByEntry( anOwner->entry() );
323 if( !anObject.IsNull() )
325 QString aName = anObject->GetName();
326 if( !aCollectedNameList.contains( aName ) )
328 aSeq.Append( anObject );
329 aCollectedNameList.append( aName );
337 Handle(HYDROData_Entity) HYDROGUI_Tool::GetSelectedObject( HYDROGUI_Module* theModule )
339 HYDROData_SequenceOfObjects aSeq = GetSelectedObjects( theModule );
340 if( !aSeq.IsEmpty() )
345 HYDROData_SequenceOfObjects HYDROGUI_Tool::GetGeometryObjects(
346 HYDROGUI_Module* theModule )
348 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
350 HYDROData_SequenceOfObjects aResSeq;
352 HYDROData_Iterator anIter( aDocument );
353 for ( ; anIter.More(); anIter.Next() )
355 Handle(HYDROData_Entity) anObj = anIter.Current();
356 if ( !HYDROData_Tool::IsGeometryObject( anObj ) )
359 aResSeq.Append( anObj );
365 ObjectKind HYDROGUI_Tool::GetSelectedPartition( HYDROGUI_Module* theModule )
367 HYDROGUI_DataModel* aModel = theModule->getDataModel();
369 SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr();
370 SUIT_DataOwnerPtrList anOwners;
371 aSelectionMgr->selected( anOwners );
373 if( anOwners.size() != 1 )
376 if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( anOwners.first().operator->() ) )
378 QString anEntry = anOwner->entry();
379 QString aPrefix = HYDROGUI_DataObject::entryPrefix();
380 if( anEntry.left( aPrefix.length() ) == aPrefix )
382 anEntry.remove( aPrefix );
383 for( ObjectKind anObjectKind = KIND_UNKNOWN + 1; anObjectKind <= KIND_LAST; anObjectKind++ )
384 if( HYDROGUI_DataModel::tr( HYDROGUI_DataModel::partitionName( anObjectKind ).toAscii() ) == anEntry )
391 QStringList HYDROGUI_Tool::GetSelectedGeomObjects( HYDROGUI_Module* theModule,
392 QList<GEOM::shape_type> theTypes )
394 QStringList anEntryList;
396 // Get active SalomeApp_Study
397 SalomeApp_Study* aStudy = NULL;
398 if ( theModule && theModule->getApp() ) {
399 aStudy = dynamic_cast<SalomeApp_Study*>( theModule->getApp()->activeStudy() );
406 SUIT_SelectionMgr* aSelectionMgr = theModule->getApp()->selectionMgr();
407 SUIT_DataOwnerPtrList anOwners;
408 aSelectionMgr->selected( anOwners );
410 // Check if the selected objects belong to GEOM and have a shape
411 foreach( SUIT_DataOwner* aSUITOwner, anOwners )
413 if( LightApp_DataOwner* anOwner = dynamic_cast<LightApp_DataOwner*>( aSUITOwner ) )
415 QString anEntry = anOwner->entry();
416 _PTR(SObject) aSObject( aStudy->studyDS()->FindObjectID(qPrintable(anEntry)) );
418 _PTR(SComponent) aSComponent = aSObject->GetFatherComponent();
419 if ( aSComponent && aSComponent->ComponentDataType() == "GEOM" ) {
420 GEOM::GEOM_Object_var aGeomObj =
421 GEOMBase::GetObjectFromIOR( aSObject->GetIOR().c_str() );
423 if ( !aGeomObj->_is_nil() && aGeomObj->IsShape() &&
424 theTypes.contains( aGeomObj->GetShapeType() ) ) {
425 anEntryList << anEntry;
435 Handle(HYDROData_Entity) HYDROGUI_Tool::FindObjectByName( HYDROGUI_Module* theModule,
436 const QString& theName,
437 const ObjectKind theObjectKind )
439 Handle(HYDROData_Entity) aResObj;
441 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
442 if ( !aDocument.IsNull() )
443 aResObj = aDocument->FindObjectByName( theName, theObjectKind );
448 HYDROData_SequenceOfObjects HYDROGUI_Tool::FindObjectsByNames( HYDROGUI_Module* theModule,
449 const QStringList& theNames,
450 const ObjectKind theObjectKind )
452 HYDROData_SequenceOfObjects aResSeq;
454 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
455 if ( !aDocument.IsNull() )
456 aResSeq = aDocument->FindObjectsByNames( theNames, theObjectKind );
461 QString HYDROGUI_Tool::GenerateObjectName( HYDROGUI_Module* theModule,
462 const QString& thePrefix,
463 const QStringList& theUsedNames,
464 const bool theIsTryToUsePurePrefix)
466 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
467 return HYDROData_Tool::GenerateObjectName( aDocument, thePrefix, theUsedNames, theIsTryToUsePurePrefix );
470 size_t HYDROGUI_Tool::GetActiveViewId( HYDROGUI_Module* theModule,
471 const QString& theViewId )
474 SUIT_ViewManager* aViewMgr = theModule->getApp()->activeViewManager();
475 if( !aViewMgr || ( !theViewId.isEmpty() && aViewMgr->getType() != theViewId ) )
478 if( SUIT_ViewModel* aViewer = aViewMgr->getViewModel() )
479 aViewId = (size_t)aViewer;
483 size_t HYDROGUI_Tool::GetActiveGraphicsViewId( HYDROGUI_Module* theModule )
485 return GetActiveViewId( theModule, GraphicsView_Viewer::Type() );
488 size_t HYDROGUI_Tool::GetActiveOCCViewId( HYDROGUI_Module* theModule )
490 return GetActiveViewId( theModule, OCCViewer_Viewer::Type() );
493 QList<size_t> getViewIdList( HYDROGUI_Module* theModule,
494 const QString& theViewId )
497 ViewManagerList aViewMgrs;
498 theModule->getApp()->viewManagers( theViewId, aViewMgrs );
499 QListIterator<SUIT_ViewManager*> anIter( aViewMgrs );
500 while( anIter.hasNext() )
502 if( SUIT_ViewManager* aViewMgr = anIter.next() )
504 if( SUIT_ViewModel* aViewer = aViewMgr->getViewModel() )
505 aList.append( (size_t)aViewer );
511 QList<size_t> HYDROGUI_Tool::GetGraphicsViewIdList( HYDROGUI_Module* theModule )
513 return getViewIdList( theModule, GraphicsView_Viewer::Type() );
516 QList<size_t> HYDROGUI_Tool::GetOCCViewIdList( HYDROGUI_Module* theModule )
518 return getViewIdList( theModule, OCCViewer_Viewer::Type() );
521 void HYDROGUI_Tool::setOCCActionShown( OCCViewer_ViewFrame* theViewFrame,
522 const int theActionId,
528 OCCViewer_ViewWindow* aView = theViewFrame->getView( OCCViewer_ViewFrame::MAIN_VIEW );
530 aView->toolMgr()->setShown( theActionId, isShown );
531 if ( theActionId == OCCViewer_ViewWindow::MaximizedId )
532 theViewFrame->onMaximizedView( aView, true );
536 void HYDROGUI_Tool::setOCCActionShown( HYDROGUI_Module* theModule,
537 const int theActionId,
541 ViewManagerList aViewMgrs;
542 theModule->getApp()->viewManagers( OCCViewer_Viewer::Type(), aViewMgrs );
543 QListIterator<SUIT_ViewManager*> anIter( aViewMgrs );
544 while( anIter.hasNext() )
546 if( SUIT_ViewManager* aViewMgr = anIter.next() )
548 OCCViewer_ViewFrame* aViewFrame = dynamic_cast<OCCViewer_ViewFrame*>
549 ( aViewMgr->getActiveView() );
551 setOCCActionShown( aViewFrame, theActionId, isShown );
556 void HYDROGUI_Tool::GetObjectReferences( const Handle(HYDROData_Entity)& theObj,
557 HYDROData_SequenceOfObjects& theRefObjects,
558 QStringList& theRefNames )
560 if( theObj.IsNull() )
563 HYDROData_SequenceOfObjects anAllRefObjects = theObj->GetAllReferenceObjects();
564 theRefObjects.Append( anAllRefObjects );
566 for( int i = 1, n = anAllRefObjects.Length(); i <= n; ++i )
568 Handle(HYDROData_Entity) aRefObj = theRefObjects.Value( i );
569 if( aRefObj.IsNull() || aRefObj->IsRemoved() )
572 QString aRefObjectName = aRefObj->GetName();
573 if( theRefNames.contains( aRefObjectName ) )
576 theRefObjects.Append( aRefObj );
577 theRefNames.append( aRefObjectName );
579 GetObjectReferences( aRefObj, theRefObjects, theRefNames );
583 HYDROData_SequenceOfObjects HYDROGUI_Tool::GetObjectBackReferences(
584 HYDROGUI_Module* theModule,
585 const Handle(HYDROData_Entity)& theObj )
587 if( theObj.IsNull() )
588 return HYDROData_SequenceOfObjects();
590 QString anObjName = theObj->GetName();
592 QMap<QString,HYDROData_SequenceOfObjects> aMapOfBackRefs =
593 GetObjectsBackReferences( theModule, QStringList() << anObjName );
595 return aMapOfBackRefs[ anObjName ];
598 QMap<QString,HYDROData_SequenceOfObjects> HYDROGUI_Tool::GetObjectsBackReferences(
599 HYDROGUI_Module* theModule, const QStringList& theObjectNames )
601 QMap<QString,HYDROData_SequenceOfObjects> aResMap;
603 if( theObjectNames.isEmpty() )
606 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
607 if( aDocument.IsNull() )
610 HYDROData_Iterator anIterator( aDocument );
611 for( ; anIterator.More(); anIterator.Next() )
613 Handle(HYDROData_Entity) anObject = anIterator.Current();
614 if( anObject.IsNull() || anObject->IsRemoved() )
617 QString anObjectName = anObject->GetName();
618 if ( theObjectNames.contains( anObjectName ) )
621 HYDROData_SequenceOfObjects aRefObjects = anObject->GetAllReferenceObjects();
622 for ( int i = 1, n = aRefObjects.Length(); i <= n; ++i )
624 Handle(HYDROData_Entity) aRefObject = aRefObjects.Value( i );
625 if( aRefObject.IsNull() || aRefObject->IsRemoved() )
628 QString aRefObjectName = aRefObject->GetName();
629 if ( !theObjectNames.contains( aRefObjectName ) )
632 aResMap[ aRefObjectName ].Append( anObject );
639 QDockWidget* HYDROGUI_Tool::WindowDock( QWidget* wid )
644 QDockWidget* dock = 0;
645 QWidget* w = wid->parentWidget();
648 dock = ::qobject_cast<QDockWidget*>( w );
649 w = w->parentWidget();
654 QColor HYDROGUI_Tool::GenerateFillingColor( HYDROGUI_Module* theModule,
655 const QStringList& theZoneNames )
657 Handle(HYDROData_Document) aDocument = HYDROData_Document::Document( theModule->getStudyId() );
658 return GenerateFillingColor( aDocument, theZoneNames );
661 QColor HYDROGUI_Tool::GenerateFillingColor( const Handle(HYDROData_Document)& theDoc,
662 const QStringList& theZoneNames )
664 QColor aFillingColor( HYDROData_ImmersibleZone::DefaultFillingColor() );
667 int aR = 0, aG = 0, aB = 0;
668 QStringListIterator aZoneNameIter( theZoneNames );
669 while( aZoneNameIter.hasNext() )
671 const QString& aZoneName = aZoneNameIter.next();
672 Handle(HYDROData_ImmersibleZone) aRefZone =
673 Handle(HYDROData_ImmersibleZone)::DownCast( theDoc->FindObjectByName( aZoneName, KIND_IMMERSIBLE_ZONE ) );
674 if( !aRefZone.IsNull() )
676 QColor aRefColor = aRefZone->GetFillingColor();
677 aR += aRefColor.red();
678 aG += aRefColor.green();
679 aB += aRefColor.blue();
686 aFillingColor = QColor( aR / aCounter, aG / aCounter, aB / aCounter );
689 return aFillingColor;
692 QStringList HYDROGUI_Tool::FindExistingObjectsNames( const Handle(HYDROData_Document)& theDoc,
693 const ObjectKind theObjectKind,
694 bool isCheckValidProfile )
698 HYDROData_Iterator anIter( theDoc, theObjectKind );
699 for ( ; anIter.More(); anIter.Next() ) {
700 Handle(HYDROData_Entity) anObject = anIter.Current();
702 bool isOK = !anObject.IsNull();
704 if( isOK && isCheckValidProfile )
706 Handle_HYDROData_Profile aProfile = Handle_HYDROData_Profile::DownCast( anObject );
707 if( !aProfile.IsNull() && !aProfile->IsValid() )
712 aNames.append( anObject->GetName() );
718 QString HYDROGUI_Tool::GetCoordinateString( const double theNumber, bool isInLocale )
722 static QLocale aLocale( QLocale::English, QLocale::France );
723 return aLocale.toString( theNumber, 'f', 2 );
726 return QString::number( theNumber, 'f', 2 );
729 Handle(Image_PixMap) HYDROGUI_Tool::Pixmap( const QImage& theImage )
731 Handle(Image_PixMap) pix;
732 if ( theImage.isNull() || theImage.format() == QImage::Format_Invalid )
735 Handle(Image_PixMap) tmpPix = new Image_PixMap();
736 tmpPix->SetTopDown( false );
737 QImage anImage = theImage.mirrored();
738 if ( !anImage.hasAlphaChannel() && anImage.allGray() )
740 tmpPix->InitTrash( Image_PixMap::ImgGray, anImage.width(), anImage.height(), anImage.width() );
741 for ( int r = 0; r < anImage.height(); r++ )
743 Standard_Byte* aRowData = tmpPix->ChangeRow( anImage.height() - r - 1 );
744 for ( int p = 0; p < anImage.width(); p++ )
745 aRowData[p] = qRed( anImage.pixel( p, r ) );
750 Image_PixMap::ImgFormat aFormat;
751 if ( anImage.hasAlphaChannel() )
753 if ( anImage.format() != QImage::Format_ARGB32 )
754 anImage = anImage.convertToFormat( QImage::Format_ARGB32 );
755 aFormat = Image_PixMap::ImgRGBA;
759 if ( anImage.format() != QImage::Format_RGB888 )
760 anImage = anImage.convertToFormat( QImage::Format_RGB888 );
761 aFormat = Image_PixMap::ImgRGB;
764 tmpPix->InitWrapper( aFormat, (Standard_Byte*)anImage.bits(), anImage.width(), anImage.height(), anImage.bytesPerLine() );
767 if ( !tmpPix.IsNull() )
769 pix = new Image_PixMap();
770 pix->InitCopy( *tmpPix.operator->() );
771 pix->SetTopDown( tmpPix->IsTopDown() );