if ( res && app && !app->stdApp().IsNull() )
{
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
TColStd_SequenceOfExtendedString formats;
app->stdApp()->Formats( formats );
if ( !formats.IsEmpty() )
bool status = false;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
-
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == PCDM_RS_OK;
-#else
- status = app->Open( CAF_Tools::toExtString( fname ), myStdDoc ) == CDF_RS_OK;
-#endif
}
catch ( Standard_Failure ) {
status = false;
bool status = false;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
if ( save )
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
status = app->Save( stdDoc() ) == PCDM_SS_OK;
-#else
- status = app->Save( stdDoc() ) == CDF_SS_OK;
-#endif
else
{
TCollection_ExtendedString format, path( CAF_Tools::toExtString( fname ) );
if ( format.Length() )
stdDoc()->ChangeStorageFormat( format );
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
status = app->SaveAs( stdDoc(), path ) == PCDM_SS_OK;
-#else
- status = app->SaveAs( stdDoc(), path ) == CDF_SS_OK;
-#endif
}
}
catch ( Standard_Failure ) {
bool res = true;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
if ( myStdDoc->HasOpenCommand() )
myStdDoc->AbortCommand();
bool res = true;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
myStdDoc->AbortCommand();
update();
}
bool res = true;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
myStdDoc->CommitCommand();
if ( canUndo() )
return false;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
myStdDoc->Undo();
undoModified(); /* decrement modification counter */
}
return false;
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
myStdDoc->Redo();
doModified(); /* increment modification counter */
}
if ( theUnits && *theUnits && strcmp( theUnits, "%" ) )
{
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
aRetValue = UnitsAPI::AnyToSI( theValue, theUnits );
}
catch( Standard_Failure ) {
if ( theUnits && *theUnits && strcmp( theUnits, "%" ) )
{
try {
-#if OCC_VERSION_LARGE > 0x06010000
OCC_CATCH_SIGNALS;
-#endif
aRetValue = UnitsAPI::AnyFromSI( theValue, theUnits );
}
catch( Standard_Failure ) {
pref->setItemProperty( "strings", aValuesList, vtkStyleMode );
pref->setItemProperty( "indexes", anIndicesList, vtkStyleMode );
// ... -> zooming mode
- #if OCC_VERSION_LARGE > 0x0603000A // available only with OCC-6.3-sp11 and higher version
- int occZoomingStyleMode = pref->addPreference( tr( "PREF_ZOOMING" ), Viewer3DGroup,
- LightApp_Preferences::Selector, "3DViewer", "zooming_mode" );
- aValuesList.clear();
- anIndicesList.clear();
- aValuesList << tr("PREF_ZOOMING_AT_CENTER") << tr("PREF_ZOOMING_AT_CURSOR");
- anIndicesList << 0 << 1;
- pref->setItemProperty( "strings", aValuesList, occZoomingStyleMode );
- pref->setItemProperty( "indexes", anIndicesList, occZoomingStyleMode );
- #endif
+ int occZoomingStyleMode = pref->addPreference( tr( "PREF_ZOOMING" ), Viewer3DGroup,
+ LightApp_Preferences::Selector, "3DViewer", "zooming_mode" );
+ aValuesList.clear();
+ anIndicesList.clear();
+ aValuesList << tr("PREF_ZOOMING_AT_CENTER") << tr("PREF_ZOOMING_AT_CURSOR");
+ anIndicesList << 0 << 1;
+ pref->setItemProperty( "strings", aValuesList, occZoomingStyleMode );
+ pref->setItemProperty( "indexes", anIndicesList, occZoomingStyleMode );
// ... "Trihedron" group <<start>>
int occTriGroup = pref->addPreference( tr( "PREF_TRIHEDRON" ), Viewer3DGroup );
pref->setItemProperty( "columns", 2, occTriGroup );
return ChangeFind(K);
}
-#if OCC_VERSION_LARGE > 0x06050100 // for OCC-6.5.2 and higher version
Standard_EXPORT Standard_Address Find1 (const Handle(SALOME_InteractiveObject)& K) const;
Standard_EXPORT Standard_Address ChangeFind1 (const Handle(SALOME_InteractiveObject)& K);
-#endif
private:
Standard_EXPORT SALOME_DataMapOfIOMapOfInteger(const SALOME_DataMapOfIOMapOfInteger& Other);
*/
void OCCViewer_CubeAxesDlg::ApplyData( const Handle(V3d_View)& theView )
{
-#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
if( theView.IsNull() )
return;
theView->GraduatedTrihedronErase();
theView->Redraw();
-#endif
}
#include <Visual3d_View.hxx>
-
-// VSR: Uncomment below line to allow texture background support in OCC viewer
-#define OCC_ENABLE_TEXTURED_BACKGROUND
-
/*!
Get data for supported background modes: gradient types, identifiers and supported image formats
*/
Diagonal1Gradient << Diagonal2Gradient <<
Corner1Gradient << Corner2Gradient <<
Corner3Gradient << Corner4Gradient;
-#if OCC_VERSION_LARGE > 0x06050200 // enabled since OCCT 6.5.3, since in previous version this functionality is buggy
-#ifdef OCC_ENABLE_TEXTURED_BACKGROUND
txtList << Qtx::CenterTexture << Qtx::TileTexture << Qtx::StretchTexture;
-#endif
-#endif
return tr("BG_IMAGE_FILES");
}
//myV3dViewer->Init(); // to avoid creation of the useless perspective view (see OCCT issue 0024267)
myV3dViewer->SetDefaultLights();
-#if OCC_VERSION_LARGE <= 0x06060000 // Porting to OCCT higher 6.6.0 version
- myV3dCollector = OCCViewer_VService::CreateViewer( TCollection_ExtendedString("Collector3d").ToExtString() );
- //myV3dCollector->Init(); // to avoid creation of the useless perspective view (see OCCT issue 0024267)
- myV3dCollector->SetDefaultLights();
-#endif
-
// init selector
-#if OCC_VERSION_LARGE <= 0x06060000
- myAISContext = new AIS_InteractiveContext( myV3dViewer, myV3dCollector );
-#else
myAISContext = new AIS_InteractiveContext( myV3dViewer );
-#endif
myAISContext->SelectionColor( Quantity_NOC_WHITE );
// display isoline on planar faces (box for ex.)
{
myAISContext.Nullify();
myV3dViewer.Nullify();
-#if OCC_VERSION_LARGE <= 0x06060000
- myV3dCollector.Nullify();
-#endif
}
/*!
int OCCViewer_Viewer::getTopLayerId()
{
-#if OCC_VERSION_LARGE > 0x06050200
if ( myTopLayerId == 0 && !myAISContext->CurrentViewer().IsNull() )
myAISContext->CurrentViewer()->AddZLayer( myTopLayerId );
-#endif
return myTopLayerId;
}
AIS_ListOfInteractive List;
myAISContext->DisplayedObjects(List);
-#if OCC_VERSION_LARGE <= 0x06060000
- if( !onlyInViewer )
- {
- AIS_ListOfInteractive List1;
- myAISContext->ObjectsInCollector(List1);
- List.Append(List1);
- }
-#endif
-
AIS_ListIteratorOfListOfInteractive ite(List);
for ( ; ite.More(); ite.Next() )
if( ite.Value()==obj )
public:
Handle(V3d_Viewer) getViewer3d() const { return myV3dViewer;}
-#if OCC_VERSION_LARGE <= 0x06060000
- Handle(V3d_Viewer) getCollector3d() const { return myV3dCollector; }
-#endif
Handle(AIS_InteractiveContext) getAISContext() const { return myAISContext; }
Handle(AIS_Trihedron) getTrihedron() const { return myTrihedron; }
protected:
Handle(V3d_Viewer) myV3dViewer;
-#if OCC_VERSION_LARGE <= 0x06060000
- Handle(V3d_Viewer) myV3dCollector;
-#endif
-
-
Handle(AIS_Trihedron) myTrihedron;
Handle(AIS_InteractiveContext) myAISContext;
if ( activeView().IsNull() ) return;
if ( !myBackground.isValid() ) return;
- // VSR: Important note on below code.
- // In OCCT (in version 6.5.2), things about the background drawing
- // are not straightforward and not clearly understandable:
- // - Horizontal gradient is drawn vertically (!), well ok, from top side to bottom one.
- // - Vertical gradient is drawn horizontally (!), from right side to left one (!!!).
- // - First and second diagonal gradients are confused.
- // - Image texture, once set, can not be removed (!).
- // - Texture image fill mode Aspect_FM_NONE is not taken into account (and means the same
- // as Aspect_FM_CENTERED).
- // - The only way to cancel gradient background (and get back to single colored) is to
- // set gradient background style to Aspect_GFM_NONE while passing two colors is also needed
- // (see V3d_View::SetBgGradientColors() function).
- // - Also, it is impossible to draw texture image above the gradiented background (only above
- // single-colored).
- // In OCCT 6.5.3 all above mentioned problems are fixed; so, above comment should be removed as soon
- // as SALOME is migrated to OCCT 6.5.3. The same concerns #ifdef statements in the below code
switch ( myBackground.mode() ) {
case Qtx::ColorBackground:
{
// Unset texture should be done here
// ...
Quantity_Color qCol( c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB );
-#if OCC_VERSION_LARGE > 0x06050200 // available since OCCT 6.5.3
activeView()->SetBgGradientStyle( Aspect_GFM_NONE ); // cancel gradient background
activeView()->SetBgImageStyle( Aspect_FM_NONE ); // cancel texture background
-#else
- // cancel gradient background (in OCC before v6.5.3 the only way to do this is to set it to NONE type passing arbitrary colors as parameters)
- activeView()->SetBgGradientColors( qCol, qCol, Aspect_GFM_NONE );
-#endif
// then change background color
activeView()->SetBackgroundColor( qCol );
// update viewer
activeView()->SetBgImageStyle( Aspect_FM_NONE ); // cancel texture background
switch ( type ) {
case OCCViewer_Viewer::HorizontalGradient:
-#if OCC_VERSION_LARGE > 0x06050200 // available since OCCT 6.5.3
activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_HOR, Standard_True );
-#else
- // in OCCT before v6.5.3, to draw horizontal gradient it's necessary to use Aspect_GFM_VER type
- // and interchange the colors
- activeView()->SetBgGradientColors( qCol2, qCol1, Aspect_GFM_VER, Standard_True );
-#endif
break;
case OCCViewer_Viewer::VerticalGradient:
-#if OCC_VERSION_LARGE > 0x06050200 // available since OCCT 6.5.3
activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_VER, Standard_True );
-#else
- // in OCCT before v6.5.3, to draw vertical gradient it's necessary to use Aspect_GFM_HOR type
- activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_HOR, Standard_True );
-#endif
break;
case OCCViewer_Viewer::Diagonal1Gradient:
-#if OCC_VERSION_LARGE > 0x06050200 // available since OCCT 6.5.3
activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_DIAG1, Standard_True );
-#else
- // in OCCT before v6.5.3, to draw 1st dialognal gradient it's necessary to use Aspect_GFM_DIAG2 type
- // and interchange the colors
- activeView()->SetBgGradientColors( qCol2, qCol1, Aspect_GFM_DIAG2, Standard_True );
-#endif
break;
case OCCViewer_Viewer::Diagonal2Gradient:
-#if OCC_VERSION_LARGE > 0x06050200 // available since OCCT 6.5.3
activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_DIAG2, Standard_True );
-#else
- // in OCCT before v6.5.3, to draw 2nd dialognal gradient it's necessary to use Aspect_GFM_DIAG1 type
- activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_DIAG1, Standard_True );
-#endif
break;
case OCCViewer_Viewer::Corner1Gradient:
activeView()->SetBgGradientColors( qCol1, qCol2, Aspect_GFM_CORNER1, Standard_True );
default:
break;
}
-#if OCC_VERSION_LARGE > 0x06050200 // available since OCCT 6.5.3
- // VSR: In OCCT before v6.5.3 below code can't be used because of very ugly bug - it has been impossible to
- // clear the background texture image as soon as it was once set to the viewer.
if ( myBackground.isTextureShown() ) {
QString fileName;
int textureMode = myBackground.texture( fileName );
activeView()->Update();
}
}
-#endif
}
/*!
*/
void OCCViewer_ViewPort3d::startZoomAtPoint( int x, int y )
{
-#if OCC_VERSION_LARGE > 0x0603000A // available only with OCC-6.3-sp11 and higher version
if ( !activeView().IsNull() && isAdvancedZoomingEnabled() )
activeView()->StartZoomAtPoint( x, y );
-#endif
}
/*!
// as OCCT respects a sign of only dx,
// but we want both signes to be taken into account
//activeView()->Zoom( x0, y0, x, y );
-#if OCC_VERSION_LARGE > 0x0603000A // available only with OCC-6.3-sp11 and higher version
if ( isAdvancedZoomingEnabled() )
activeView()->ZoomAtPoint( x0, y0, x, y );
else
-#endif
activeView()->Zoom( x0 + y0, 0, x + y, 0 );
emit vpTransformed( this );
}
#include <gp_GTrsf.hxx>
#include <TColgp_Array1OfPnt2d.hxx>
-#if OCC_VERSION_LARGE > 0x06060000
#include <Graphic3d_SequenceOfHClipPlane.hxx>
#include <Graphic3d_ClipPlane.hxx>
-#endif
-
#include <Image_PixMap.hxx>
#include <Standard_Version.hxx>
}
toolMgr()->append( DumpId, tid );
toolMgr()->append( SwitchInteractionStyleId, tid );
-#if OCC_VERSION_LARGE > 0x0603000A // available only with OCC-6.3-sp11 and higher version
toolMgr()->append( SwitchZoomingStyleId, tid );
-#endif
toolMgr()->append( SwitchPreselectionId, tid );
toolMgr()->append( SwitchSelectionId, tid );
if( myModel->trihedronActivated() )
toolMgr()->append( toolMgr()->separator(), tid );
toolMgr()->append( ClippingId, tid );
toolMgr()->append( AxialScaleId, tid );
-#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
toolMgr()->append( GraduatedAxesId, tid );
-#endif
toolMgr()->append( AmbientId, tid );
toolMgr()->append( MaximizedId, tid );
myModel->setTrihedronShown( anItem.isVisible );
myModel->setTrihedronSize( anItem.size );
-#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
// graduated trihedron
bool anIsVisible = anItem.gtIsVisible;
OCCViewer_AxisWidget::AxisData anAxisData[3];
myCubeAxesDlg->SetData( anIsVisible, anAxisData );
myCubeAxesDlg->ApplyData( aView3d );
-#endif
} // if ( !baseParamsOnly )
aView3d->Center( params.centerX, params.centerY );
#endif
-#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 and higher version
// graduated trihedron
bool anIsVisible = false;
OCCViewer_AxisWidget::AxisData anAxisData[3];
params.gtTickmarkLengthX = anAxisData[0].TickmarkLength;
params.gtTickmarkLengthY = anAxisData[1].TickmarkLength;
params.gtTickmarkLengthZ = anAxisData[2].TickmarkLength;
-#endif
return params;
}
data << ClippingPlane;
}
-
-#if OCC_VERSION_LARGE > 0x06030009 // available only with OCC-6.3-sp10 or newer version
// graduated trihedron
data << QString( "gtIsVisible=%1" ) .arg( params.gtIsVisible );
data << QString( "gtDrawNameX=%1" ) .arg( params.gtDrawNameX );
data << QString( "gtTickmarkLengthX=%1" ).arg( params.gtTickmarkLengthX );
data << QString( "gtTickmarkLengthY=%1" ).arg( params.gtTickmarkLengthY );
data << QString( "gtTickmarkLengthZ=%1" ).arg( params.gtTickmarkLengthZ );
-#endif
QString bg = Qtx::backgroundToString( background() ).replace( "=", "$" );
data << QString( "background=%1" ).arg( bg );
{
AIS_ListOfInteractive List;
getAISContext()->DisplayedObjects(List);
-
-#if OCC_VERSION_LARGE <= 0x06060000
- if( !onlyInViewer ) {
- AIS_ListOfInteractive List1;
- getAISContext()->ObjectsInCollector(List1);
- List.Append(List1);
-}
-#endif
-
-
AIS_ListIteratorOfListOfInteractive ite(List);
for ( ; ite.More(); ite.Next() )
{
continue;
}
-#if OCC_VERSION_LARGE <= 0x06060000
- // then try to find presentation in the collector
- if(ic->IsInCollector(anAIS))
- {
- ic->DisplayFromCollector( anAIS, false );
- // Deactivate object if necessary
- if ( !anOCCPrs->ToActivate() )
- ic->Deactivate( anAIS );
-
- // Set visibility flag
- // Temporarily commented to avoid awful dependecy on SALOMEDS
- // TODO: better mechanism of storing display/erse status in a study
- // should be provided...
- //Handle(SALOME_InteractiveObject) anObj =
- // Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
- //if ( !anObj.IsNull() && anObj->hasEntry() )
- //{
- // if ( study )
- // ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
- //}
- continue;
- }
-#endif
// if object is not displayed and not found in the collector - display it
if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) )
{
{
aSh->SetClippable (prs->IsClippable());
applyExistingClipPlanesToObject (anAIS);
-#if OCC_VERSION_LARGE > 0x06050200
bool top = (aSh->isTopLevel() && aSh->switchTopLevel());
ic->SetZLayer( aSh, top ? getTopLayerId() : 0 );
if(!aSh->toActivate())
{
ic->Deactivate( aSh );
}
-#endif
}
//Register anAIS (if it has an entry) in entry2aisobjects map
Handle(AIS_InteractiveObject) anAIS = aIter.Value();
if ( !anAIS.IsNull() ) {
// erase the object from context : move it to collector
-#if OCC_VERSION_LARGE <= 0x06060000
- ic->Erase( anAIS, false, forced ? false : true );
-#else
ic->Erase( anAIS, false );
-#endif
// Set visibility flag if necessary
// Temporarily commented to avoid awful dependecy on SALOMEDS
// TODO: better mechanism of storing display/erse status in a study
// erase an object
Handle(AIS_InteractiveObject) anIO = anIter.Value();
-#if OCC_VERSION_LARGE <= 0x06060000
- ic->Erase( anIO, false, forced ? false : true );
-#else
ic->Erase( anIO, false );
-#endif
// Set visibility flag if necessary
// Temporarily commented to avoid awful dependecy on SALOMEDS
for ( unsigned int ind = 0; ind < List.size(); ind++ )
{
Handle(AIS_InteractiveObject) anAIS=List[ind];
- if(ic->IsDisplayed(anAIS)
-#if OCC_VERSION_LARGE <= 0x06060000
- || ic->IsInCollector(anAIS)
-#endif
- )
+ if(ic->IsDisplayed(anAIS))
{
prs->AddObject( anAIS );
}
#include <QString>
-#if OCC_VERSION_LARGE > 0x06010000
- #include <Standard_ErrorHandler.hxx>
- #include <Standard_Failure.hxx>
-#else
- #include "CASCatch.hxx"
-#endif
+#include <Standard_ErrorHandler.hxx>
+#include <Standard_Failure.hxx>
+
/*!Constructor. Initialize by \a floatSignal.*/
SalomeApp_ExceptionHandler::SalomeApp_ExceptionHandler( const bool floatSignal )
/*!Try to call SUIT_ExceptionHandler::internalHandle(o, e), catch if failure.*/
bool SalomeApp_ExceptionHandler::handleSignals( QObject* o, QEvent* e )
{
-#if OCC_VERSION_LARGE > 0x06010000
try {
OCC_CATCH_SIGNALS;
-#else
- CASCatch_TRY {
-#endif
SUIT_ExceptionHandler::internalHandle( o, e );
}
-#if OCC_VERSION_LARGE > 0x06010000
catch(Standard_Failure) {
-#else
- CASCatch_CATCH(Standard_Failure) {
-#endif
Handle(Standard_Failure) aFail = Standard_Failure::Caught();
throw Standard_Failure( aFail->GetMessageString() );
}
virtual bool notify( QObject* receiver, QEvent* e )
{
-#if OCC_VERSION_LARGE < 0x06010100
- // Disable GUI user actions while python command is executed
- if (SUIT_Session::IsPythonExecuted()) {
- // Disable mouse and keyboard events
- QEvent::Type aType = e->type();
- if (aType == QEvent::MouseButtonPress || aType == QEvent::MouseButtonRelease ||
- aType == QEvent::MouseButtonDblClick || aType == QEvent::MouseMove ||
- aType == QEvent::Wheel || aType == QEvent::ContextMenu ||
- aType == QEvent::KeyPress || aType == QEvent::KeyRelease ||
- aType == QEvent::Accel || aType == QEvent::AccelOverride)
- return false;
- }
-#endif
#ifdef ENABLE_TESTRECORDER
return myHandler ? myHandler->handle( receiver, e ) :