#include <TestViewer.h>
#include <HYDROData_Tool.h>
#include <OCCViewer_ViewManager.h>
+#ifdef WIN32
+ #pragma warning ( disable: 4251 )
+#endif
#include <OCCViewer_ViewPort3d.h>
#ifdef WIN32
#pragma warning ( disable: 4251 )
#include <AIS_Shape.hxx>
#include <Aspect_ColorScale.hxx>
#include <TopoDS_Iterator.hxx>
-
#include <QDir>
#include <QPainter>
#include <QHash>
QColor TestViewer::GetColor(int i)
{
- QVector<QColor> aCV;
- aCV << QColor(0,0,255)
- << QColor(0,255,0)
- << QColor(255,0,0)
- << QColor(255,255,20)
- << QColor(20,255,255)
- << QColor(100,100,20)
- << QColor(10,100,150);
+ static QVector<QColor> aCV;
+ if( aCV.isEmpty() )
+ {
+ aCV << QColor(0,0,255)
+ << QColor(0,255,0)
+ << QColor(255,0,0)
+ << QColor(255,255,20)
+ << QColor(20,255,255)
+ << QColor(100,100,20)
+ << QColor(10,100,150);
+ }
return aCV[i];
}
void TestViewer::show( const Handle(AIS_InteractiveObject)& theObject,
int theMode, int theSelectionMode, bool isFitAll, const char* theKey )
{
+ context()->CloseLocalContext();
context()->EraseAll( Standard_False );
- context()->Display( theObject, theMode, theSelectionMode );
+ if( theSelectionMode > 0 )
+ {
+ context()->Display( theObject, theMode, theSelectionMode );
+ context()->OpenLocalContext();
+ context()->Activate( theObject, theSelectionMode, Standard_True );
+ }
myKey = theKey;
return false;
}
-Handle_Aspect_ColorScale TestViewer::showColorScale()
+Handle_Aspect_ColorScale TestViewer::showColorScale( bool isShow )
{
Handle(V3d_View) aView = myViewWindow->getViewPort()->getView();
if( aView.IsNull() )
aColorScale->SetTitle( "test" );
aColorScale->SetRange( 0, 1 );
- if( !aView->ColorScaleIsDisplayed() )
- aView->ColorScaleDisplay();
-
+ if( isShow )
+ {
+ if( !aView->ColorScaleIsDisplayed() )
+ aView->ColorScaleDisplay();
+ }
+ else
+ {
+ if( aView->ColorScaleIsDisplayed() )
+ aView->ColorScaleErase();
+ }
return aColorScale;
}
Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
aPrs->SetTable( aTable );
- TestViewer::show( aPrs, AIS_Shaded, 1, true, "LandCoverMap_PrsByTypes" );
+ TestViewer::show( aPrs, AIS_Shaded, 4, true, "LandCoverMap_PrsByTypes" );
CPPUNIT_ASSERT_IMAGES
aDoc->Close();
Handle(HYDROGUI_LandCoverMapPrs) aPrs = new HYDROGUI_LandCoverMapPrs( aMap );
aPrs->SetTable( aTable );
- aPrs->SetColorScale( TestViewer::showColorScale() );
- TestViewer::show( aPrs, AIS_Shaded, 1, true, "LandCoverMap_PrsByCoeff" );
+ aPrs->SetColorScale( TestViewer::showColorScale( true ) );
+ TestViewer::show( aPrs, AIS_Shaded, 4, true, "LandCoverMap_PrsByCoeff" );
CPPUNIT_ASSERT_IMAGES
+ TestViewer::showColorScale( false );
aDoc->Close();
}