int polylineArrow = addPreference( tr( "PREF_POLYLINE_ARROW" ), polylinesGroup,
LightApp_Preferences::Selector, "polyline", "arrow_type" );
- QList<QVariant> indices;
- indices.append( 0 );
- indices.append( 1 );
- indices.append( 2 );
- setPreferenceProperty( polylineArrow, "indexes", indices );
QList<QVariant> arrow_types;
arrow_types.append( tr( "No" ) );
arrow_types.append( tr( "Triangle" ) );
arrow_types.append( tr( "Cone" ) );
setPreferenceProperty( polylineArrow, "strings", arrow_types );
+ QList<QVariant> indices;
+ indices.append( 0 );
+ indices.append( 1 );
+ indices.append( 2 );
+ setPreferenceProperty( polylineArrow, "indexes", indices );
+ setPreferenceProperty( polylineArrow, "ids", indices );
+
int polylineSize = addPreference( tr( "PREF_POLYLINE_ARROW_SIZE" ), polylinesGroup,
LightApp_Preferences::IntSpin, "polyline", "arrow_size" );
}
void HYDROGUI_Module::preferencesChanged( const QString& theSection, const QString& thePref )
{
+ SUIT_ResourceMgr* resMgr = application()->resourceMgr();
if ( theSection == "preferences" && thePref == "default_strickler_coefficient" )
{
- SUIT_ResourceMgr* resMgr = application()->resourceMgr();
+
Handle(HYDROData_Document) aDoc = HYDROData_Document::Document( application()->activeStudy()->id() );
if ( resMgr && !aDoc.IsNull() )
aDoc->SetDefaultStricklerCoefficient( resMgr->doubleValue( theSection, thePref, 0 ) );
}
else if( theSection == "polyline" )
{
- //TODO: update polylines
+ int aType = -1;
+ int aSize = -1;
+ if( resMgr )
+ {
+ resMgr->value( "polyline", "arrow_type", aType );
+ resMgr->value( "polyline", "arrow_size", aSize );
+ }
+ //Update polylines
+ ViewManagerMap::const_iterator it = myViewManagerMap.begin(), last = myViewManagerMap.end();
+ for( ; it!=last; it++ )
+ {
+ int aViewerId = it.key();
+ OCCViewer_ViewManager* aMgr = dynamic_cast<OCCViewer_ViewManager*>( it.value().first );
+ if( aMgr )
+ getOCCDisplayer()->UpdatePolylines( aViewerId, aType, aSize );
+ }
}
else
LightApp_Module::preferencesChanged( theSection, thePref );
#include "HYDROGUI_Operation.h"
#include "HYDROGUI_DataObject.h"
#include "HYDROGUI_ZLayers.h"
+#include "HYDROGUI_Polyline.h"
#include <HYDROData_Bathymetry.h>
#include <HYDROData_Image.h>
return aColorScale;
}
+
+void HYDROGUI_OCCDisplayer::UpdatePolylines( int theViewerId, int theType, int theSize )
+{
+ OCCViewer_Viewer* aViewer = module()->getOCCViewer( theViewerId );
+ if( !aViewer )
+ return;
+
+ // Get interactive context
+ Handle(AIS_InteractiveContext) aCtx = aViewer->getAISContext();
+ if( aCtx.IsNull() )
+ return;
+
+ AIS_ListOfInteractive objs;
+ aCtx->DisplayedObjects( objs );
+ AIS_ListOfInteractive::const_iterator it = objs.begin(), last = objs.end();
+ for( ; it!=last; it++ )
+ {
+ Handle(HYDROGUI_Arrow) arr = Handle(HYDROGUI_Arrow)::DownCast( *it );
+ if( !arr.IsNull() )
+ {
+ if( theType>=0 )
+ arr->SetType( (HYDROGUI_Arrow::Type)theType );
+ if( theSize>=0 )
+ arr->SetSize( theSize );
+ aCtx->Redisplay( arr, Standard_False );
+ }
+ }
+ aCtx->UpdateCurrentViewer();
+}
* \param theViewerId viewer identifier
* \return the color scale
*/
- Handle(AIS_ColorScale) GetColorScale( const int theViewerId );
+ Handle(AIS_ColorScale) GetColorScale( const int theViewerId );
+
+
+ void UpdatePolylines( int theViewerId, int theType, int theSize );
protected:
/**
// if size==0, then the arrow length is proportional to curve length
arrowLen = curveLen/10;
else
- arrowLen = qMin( curveLen/10, (double)mySize );
+ {
+ //arrowLen = qMin( curveLen/10, (double)mySize );
+ arrowLen = (double)mySize;
+ }
double t = ( anAdaptor.FirstParameter() + anAdaptor.LastParameter() ) / 2;
gp_Pnt P, P1;
#include <TopoDS_Wire.hxx>
#include <TopExp_Explorer.hxx>
+#include <SUIT_ResourceMgr.h>
+#include <SUIT_Session.h>
+
HYDROGUI_Shape::HYDROGUI_Shape( const Handle(AIS_InteractiveContext)& theContext,
const Handle(HYDROData_Entity)& theObject,
const int theZLayer )
if ( aShapeType==TopAbs_EDGE || aShapeType==TopAbs_WIRE || IsWireEdgeCompound)
{
- shapes.append( HYDROGUI_Polyline::createPresentations( myTopoShape ) );
+ SUIT_ResourceMgr* aResMgr = 0;
+ SUIT_Session* aSession = SUIT_Session::session();
+ if ( aSession )
+ aResMgr = SUIT_Session::session()->resourceMgr();
+
+ int aType = -1;
+ int aSize = -1;
+ if( aResMgr )
+ {
+ aResMgr->value( "polyline", "arrow_type", aType );
+ aResMgr->value( "polyline", "arrow_size", aSize );
+ }
+
+ shapes.append( HYDROGUI_Polyline::createPresentations( myTopoShape, aType, aSize ) );
}
else
{