mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-11 18:53:07 +05:00
Improve GEOM_Displayer; required for features 0021391, 0021830 (part 2)
This commit is contained in:
parent
3892ca7188
commit
26f2b64fce
@ -577,10 +577,10 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mode == 0 || mode == 1 || mode == 2) {
|
if(mode == 0 || mode == 1 || mode == 2) {
|
||||||
aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
|
aStudy->setObjectProperty(mgrId,It.Value()->getEntry(),GEOM::propertyName( GEOM::DisplayMode ), mode);
|
||||||
}
|
}
|
||||||
else if (mode == 4) {
|
else if (mode == 4) {
|
||||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);
|
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::EdgesDirection ), vectorMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -625,10 +625,10 @@ void DisplayGUI::ChangeDisplayMode( const int mode, SUIT_ViewWindow* viewWindow
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mode == 0 || mode == 1 || mode == 2 || mode == 3) {
|
if(mode == 0 || mode == 1 || mode == 2 || mode == 3) {
|
||||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),DISPLAY_MODE_PROP, mode);
|
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::DisplayMode ), mode);
|
||||||
}
|
}
|
||||||
else if (mode == 4) {
|
else if (mode == 4) {
|
||||||
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),VECTOR_MODE_PROP, vectorMode);
|
aStudy->setObjectProperty(mgrId, It.Value()->getEntry(),GEOM::propertyName( GEOM::EdgesDirection ), vectorMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -318,19 +318,16 @@ void GEOMBase_Helper::displayPreview( GEOM::GEOM_Object_ptr object,
|
|||||||
const int displayMode,
|
const int displayMode,
|
||||||
const int color )
|
const int color )
|
||||||
{
|
{
|
||||||
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
|
|
||||||
// Set color for preview shape
|
// Set color for preview shape
|
||||||
getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color );
|
getDisplayer()->SetColor( color == -1 ? Quantity_NOC_VIOLET : color );
|
||||||
|
|
||||||
// set width of displayed shape
|
// set width of displayed shape
|
||||||
int lw = lineWidth;
|
getDisplayer()->SetWidth( lineWidth == -1 ? resMgr->integerValue("Geometry", "preview_edge_width", -1) : lineWidth );
|
||||||
if(lw == -1) {
|
|
||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
|
||||||
lw = resMgr->integerValue("Geometry", "preview_edge_width", -1);
|
|
||||||
}
|
|
||||||
getDisplayer()->SetWidth( lw );
|
|
||||||
|
|
||||||
// set display mode of displayed shape
|
// set display mode of displayed shape
|
||||||
int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode );
|
int aPrevDispMode = getDisplayer()->SetDisplayMode( displayMode == -1 ? resMgr->integerValue( "Geometry", "display_mode", 0 ) : displayMode );
|
||||||
|
|
||||||
// Disable activation of selection
|
// Disable activation of selection
|
||||||
getDisplayer()->SetToActivate( activate );
|
getDisplayer()->SetToActivate( activate );
|
||||||
|
@ -217,7 +217,7 @@ bool GEOMGUI_Selection::isVisible( const int index ) const
|
|||||||
|
|
||||||
#ifdef USE_VISUAL_PROP_MAP
|
#ifdef USE_VISUAL_PROP_MAP
|
||||||
bool found = false;
|
bool found = false;
|
||||||
QVariant v = visibleProperty( entry( index ), VISIBILITY_PROP );
|
QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::Visibility ) );
|
||||||
if ( v.canConvert( QVariant::Bool ) ) {
|
if ( v.canConvert( QVariant::Bool ) ) {
|
||||||
res = v.toBool();
|
res = v.toBool();
|
||||||
found = true;
|
found = true;
|
||||||
@ -289,7 +289,7 @@ QString GEOMGUI_Selection::displayMode( const int index ) const
|
|||||||
QString res;
|
QString res;
|
||||||
QString viewType = activeViewType();
|
QString viewType = activeViewType();
|
||||||
#ifdef USE_VISUAL_PROP_MAP
|
#ifdef USE_VISUAL_PROP_MAP
|
||||||
QVariant v = visibleProperty( entry( index ), DISPLAY_MODE_PROP );
|
QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::DisplayMode ) );
|
||||||
if ( v.canConvert( QVariant::Int ) ) {
|
if ( v.canConvert( QVariant::Int ) ) {
|
||||||
int dm = v.toInt();
|
int dm = v.toInt();
|
||||||
if ( viewType == OCCViewer_Viewer::Type() ) {
|
if ( viewType == OCCViewer_Viewer::Type() ) {
|
||||||
@ -361,7 +361,7 @@ bool GEOMGUI_Selection::isVectorsMode( const int index ) const
|
|||||||
|
|
||||||
#ifdef USE_VISUAL_PROP_MAP
|
#ifdef USE_VISUAL_PROP_MAP
|
||||||
bool found = false;
|
bool found = false;
|
||||||
QVariant v = visibleProperty( entry( index ), VECTOR_MODE_PROP );
|
QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::EdgesDirection ) );
|
||||||
if ( v.canConvert( QVariant::Bool ) ) {
|
if ( v.canConvert( QVariant::Bool ) ) {
|
||||||
res = v.toBool();
|
res = v.toBool();
|
||||||
found = true;
|
found = true;
|
||||||
@ -553,7 +553,7 @@ bool GEOMGUI_Selection::topLevel( const int index ) const {
|
|||||||
|
|
||||||
#ifdef USE_VISUAL_PROP_MAP
|
#ifdef USE_VISUAL_PROP_MAP
|
||||||
bool found = false;
|
bool found = false;
|
||||||
QVariant v = visibleProperty( entry( index ), TOP_LEVEL_PROP );
|
QVariant v = visibleProperty( entry( index ), GEOM::propertyName( GEOM::TopLevel ) );
|
||||||
if ( v.canConvert<bool>() ) {
|
if ( v.canConvert<bool>() ) {
|
||||||
res = v.toBool();
|
res = v.toBool();
|
||||||
found = true;
|
found = true;
|
||||||
@ -590,7 +590,7 @@ bool GEOMGUI_Selection::isPhysicalMaterial( const int idx ) const{
|
|||||||
|
|
||||||
#ifdef USE_VISUAL_PROP_MAP
|
#ifdef USE_VISUAL_PROP_MAP
|
||||||
bool found = false;
|
bool found = false;
|
||||||
QVariant v = visibleProperty( entry( idx ), MATERIAL_PROP );
|
QVariant v = visibleProperty( entry( idx ), GEOM::propertyName( GEOM::Material ) );
|
||||||
if ( v.canConvert<QString>() ) {
|
if ( v.canConvert<QString>() ) {
|
||||||
Material_Model material;
|
Material_Model material;
|
||||||
material.fromProperties( v.toString() );
|
material.fromProperties( v.toString() );
|
||||||
|
@ -121,6 +121,9 @@
|
|||||||
// of auto-color picking up
|
// of auto-color picking up
|
||||||
#define SIMPLE_AUTOCOLOR
|
#define SIMPLE_AUTOCOLOR
|
||||||
|
|
||||||
|
// Hard-coded value of shape deflection coefficient for VTK viewer
|
||||||
|
const double VTK_MIN_DEFLECTION = 0.001;
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
// Function : getActiveStudy
|
// Function : getActiveStudy
|
||||||
// Purpose : Get active study, returns 0 if no open study frame
|
// Purpose : Get active study, returns 0 if no open study frame
|
||||||
@ -323,6 +326,7 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
|
|||||||
myShadingColor = SalomeApp_Tools::color( col );
|
myShadingColor = SalomeApp_Tools::color( col );
|
||||||
|
|
||||||
myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0);
|
myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0);
|
||||||
|
myHasDisplayMode = false;
|
||||||
|
|
||||||
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
|
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
|
||||||
myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
|
myWidth = resMgr->integerValue("Geometry", "edge_width", -1);
|
||||||
@ -393,7 +397,7 @@ void GEOM_Displayer::Display( const Handle(SALOME_InteractiveObject)& theIO,
|
|||||||
|
|
||||||
int aMgrId = getViewManagerId(vf);
|
int aMgrId = getViewManagerId(vf);
|
||||||
SalomeApp_Study* aStudy = getStudy();
|
SalomeApp_Study* aStudy = getStudy();
|
||||||
aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 1 );
|
aStudy->setObjectProperty(aMgrId, theIO->getEntry(), GEOM::propertyName( GEOM::Visibility ), 1 );
|
||||||
|
|
||||||
setVisibilityState(theIO->getEntry(), Qtx::ShownState);
|
setVisibilityState(theIO->getEntry(), Qtx::ShownState);
|
||||||
|
|
||||||
@ -449,7 +453,7 @@ void GEOM_Displayer::Erase( const Handle(SALOME_InteractiveObject)& theIO,
|
|||||||
|
|
||||||
int aMgrId = getViewManagerId(vf);
|
int aMgrId = getViewManagerId(vf);
|
||||||
SalomeApp_Study* aStudy = getStudy();
|
SalomeApp_Study* aStudy = getStudy();
|
||||||
aStudy->setObjectProperty(aMgrId, theIO->getEntry(), VISIBILITY_PROP, 0 );
|
aStudy->setObjectProperty(aMgrId, theIO->getEntry(), GEOM::propertyName( GEOM::Visibility ), 0 );
|
||||||
|
|
||||||
setVisibilityState(theIO->getEntry(), Qtx::HiddenState);
|
setVisibilityState(theIO->getEntry(), Qtx::HiddenState);
|
||||||
}
|
}
|
||||||
@ -546,19 +550,173 @@ QColor GEOM_Displayer::colorFromResources( const QString& property, const QColor
|
|||||||
return SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", property, defColor );
|
return SUIT_Session::session()->resourceMgr()->colorValue( "Geometry", property, defColor );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GEOM_Displayer::setPointMarker( const Handle(GEOM_AISShape)& AISShape, const QString& markerData, const Quantity_Color color )
|
void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShape, bool create )
|
||||||
{
|
{
|
||||||
bool result = true;
|
// check that shape is not null
|
||||||
|
if ( AISShape.IsNull() ) return;
|
||||||
|
|
||||||
QStringList aList = markerData.split( DIGIT_SEPARATOR );
|
// check that study is active
|
||||||
|
SalomeApp_Study* study = getStudy();
|
||||||
|
if ( !study ) return;
|
||||||
|
|
||||||
|
if ( myShape.ShapeType() != TopAbs_VERTEX && // fix pb with not displayed points
|
||||||
|
!TopoDS_Iterator(myShape).More() )
|
||||||
|
return; // NPAL15983 (Bug when displaying empty groups)
|
||||||
|
|
||||||
|
// set interactive object
|
||||||
|
|
||||||
|
Handle( SALOME_InteractiveObject ) anIO;
|
||||||
|
|
||||||
|
if ( !myIO.IsNull() ) {
|
||||||
|
AISShape->setIO( myIO );
|
||||||
|
AISShape->SetOwner( myIO );
|
||||||
|
anIO = myIO;
|
||||||
|
}
|
||||||
|
else if ( !myName.empty() ) {
|
||||||
|
// workaround to allow selection of temporary objects
|
||||||
|
static int tempId = 0;
|
||||||
|
anIO = new SALOME_InteractiveObject( QString( "TEMP_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() );
|
||||||
|
AISShape->setIO( anIO );
|
||||||
|
AISShape->SetOwner( anIO );
|
||||||
|
}
|
||||||
|
|
||||||
|
// flag: only vertex or compound of vertices is processed (specific handling)
|
||||||
|
bool onlyVertex = myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape );
|
||||||
|
// presentation study entry (empty for temporary objects like preview)
|
||||||
|
QString entry = !anIO.IsNull() ? QString( anIO->getEntry() ) : QString();
|
||||||
|
// flag: temporary object
|
||||||
|
bool isTemporary = entry.isEmpty() || entry.startsWith( "TEMP_" );
|
||||||
|
// currently active view window's ID (-1 if no active view)
|
||||||
|
int aMgrId = !anIO.IsNull() ? getViewManagerId( myViewFrame ) : -1;
|
||||||
|
|
||||||
|
// get presentation properties
|
||||||
|
PropMap propMap = getObjectProperties( study, entry, myViewFrame );
|
||||||
|
|
||||||
|
// Temporary staff: vertex must be infinite for correct visualization
|
||||||
|
AISShape->SetInfiniteState( myShape.Infinite() ); // || myShape.ShapeType() == TopAbs_VERTEX // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines)
|
||||||
|
|
||||||
|
// set material
|
||||||
|
Material_Model material;
|
||||||
|
material.fromProperties( propMap.value( GEOM::propertyName( GEOM::Material ) ).toString() );
|
||||||
|
// - set front material properties
|
||||||
|
AISShape->SetCurrentFacingModel( Aspect_TOFM_FRONT_SIDE );
|
||||||
|
AISShape->SetMaterial( material.getMaterialOCCAspect( true ) );
|
||||||
|
// - set back material properties
|
||||||
|
AISShape->SetCurrentFacingModel( Aspect_TOFM_BACK_SIDE );
|
||||||
|
AISShape->SetMaterial( material.getMaterialOCCAspect( false ) );
|
||||||
|
// - switch to default (both sides) facing mode
|
||||||
|
AISShape->SetCurrentFacingModel( Aspect_TOFM_BOTH_SIDE );
|
||||||
|
|
||||||
|
// set colors
|
||||||
|
|
||||||
|
// - shading color
|
||||||
|
if ( HasColor() ) {
|
||||||
|
// predefined color, manually set to displayer via GEOM_Displayer::SetColor() function;
|
||||||
|
// we set it to the shape not taking into account material properties
|
||||||
|
AISShape->SetShadingColor( (Quantity_NameOfColor)GetColor() );
|
||||||
|
}
|
||||||
|
else if ( !material.isPhysical() ) {
|
||||||
|
// shading color from properties is used only for non-physical materials
|
||||||
|
AISShape->SetShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::ShadingColor ) ).value<QColor>() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
// - wireframe color
|
||||||
|
Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect();
|
||||||
|
anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
|
||||||
|
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>() ) );
|
||||||
|
AISShape->Attributes()->SetLineAspect( anAspect );
|
||||||
|
|
||||||
|
// - unfree boundaries color
|
||||||
|
anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
|
||||||
|
anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
|
||||||
|
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::WireframeColor ) ).value<QColor>() ) );
|
||||||
|
AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
|
||||||
|
|
||||||
|
// - free boundaries color
|
||||||
|
anAspect = AISShape->Attributes()->FreeBoundaryAspect();
|
||||||
|
anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
|
||||||
|
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::FreeBndColor ) ).value<QColor>() ) );
|
||||||
|
AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
|
||||||
|
|
||||||
|
// - standalone edges color
|
||||||
|
anAspect = AISShape->Attributes()->WireAspect();
|
||||||
|
anAspect->SetColor( HasColor() ? (Quantity_NameOfColor)GetColor() :
|
||||||
|
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::LineColor ) ).value<QColor>() ) );
|
||||||
|
AISShape->Attributes()->SetWireAspect( anAspect );
|
||||||
|
|
||||||
|
// - color for edges in shading+edges mode
|
||||||
|
AISShape->SetEdgesInShadingColor( SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::OutlineColor ) ).value<QColor>() ) );
|
||||||
|
|
||||||
|
// ???
|
||||||
|
AISShape->storeBoundaryColors();
|
||||||
|
|
||||||
|
// set display mode
|
||||||
|
AISShape->SetDisplayMode( HasDisplayMode() ?
|
||||||
|
// predefined display mode, manually set to displayer via GEOM_Displayer::SetDisplayMode() function
|
||||||
|
GetDisplayMode() :
|
||||||
|
// display mode from properties
|
||||||
|
propMap.value( GEOM::propertyName( GEOM::DisplayMode ) ).toInt() );
|
||||||
|
|
||||||
|
// set display vectors flag
|
||||||
|
AISShape->SetDisplayVectors( propMap.value( GEOM::propertyName( GEOM::EdgesDirection ) ).toBool() );
|
||||||
|
|
||||||
|
// set transparency ????????????????????????????????????????????????????
|
||||||
|
//AISShape->SetTransparency( propMap.value( GEOM::propertyName( GEOM::Transparency ) ).toDouble() );
|
||||||
|
|
||||||
|
// set iso properties
|
||||||
|
int uIsos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() )[0].toInt();
|
||||||
|
int vIsos = propMap.value( GEOM::propertyName( GEOM::NbIsos ) ).toString().split( GEOM::subSectionSeparator() )[1].toInt();
|
||||||
|
Quantity_Color isosColor = SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::IsosColor ) ).value<QColor>() );
|
||||||
|
int isosWidth = propMap.value( GEOM::propertyName( GEOM::IsosWidth ) ).toInt();
|
||||||
|
Handle(Prs3d_IsoAspect) uIsoAspect = AISShape->Attributes()->UIsoAspect();
|
||||||
|
Handle(Prs3d_IsoAspect) vIsoAspect = AISShape->Attributes()->VIsoAspect();
|
||||||
|
uIsoAspect->SetColor( isosColor );
|
||||||
|
uIsoAspect->SetWidth( isosWidth );
|
||||||
|
uIsoAspect->SetNumber( uIsos );
|
||||||
|
vIsoAspect->SetColor( isosColor );
|
||||||
|
vIsoAspect->SetWidth( isosWidth );
|
||||||
|
vIsoAspect->SetNumber( vIsos );
|
||||||
|
AISShape->Attributes()->SetUIsoAspect( uIsoAspect );
|
||||||
|
AISShape->Attributes()->SetVIsoAspect( vIsoAspect );
|
||||||
|
|
||||||
|
// set deflection coefficient
|
||||||
|
// ... to avoid to small values of the coefficient, its lower value is limited
|
||||||
|
AISShape->SetOwnDeviationCoefficient( qMax( propMap.value( GEOM::propertyName( GEOM::Deflection ) ).toDouble(), GEOM::minDeflection() ) );
|
||||||
|
|
||||||
|
// set texture
|
||||||
|
if ( HasTexture() ) {
|
||||||
|
// predefined display texture, manually set to displayer via GEOM_Displayer::SetTexture() function
|
||||||
|
AISShape->SetTextureFileName( TCollection_AsciiString( GetTexture().c_str() ) );
|
||||||
|
AISShape->SetTextureMapOn();
|
||||||
|
AISShape->DisableTextureModulate();
|
||||||
|
AISShape->SetDisplayMode( 3 );
|
||||||
|
}
|
||||||
|
|
||||||
|
// set line width
|
||||||
|
AISShape->SetWidth( HasWidth() ?
|
||||||
|
// predefined line width, manually set to displayer via GEOM_Displayer::SetLineWidth() function
|
||||||
|
GetWidth() :
|
||||||
|
// libe width from properties
|
||||||
|
propMap.value( GEOM::propertyName( GEOM::LineWidth ) ).toInt() );
|
||||||
|
|
||||||
|
// set top-level flag
|
||||||
|
AISShape->setTopLevel( propMap.value( GEOM::propertyName( GEOM::TopLevel ) ).toBool() );
|
||||||
|
|
||||||
|
// set point marker (for vertex / compound of vertices only)
|
||||||
|
if ( onlyVertex ) {
|
||||||
|
QStringList aList = propMap.value( GEOM::propertyName( GEOM::PointMarker ) ).toString().split( GEOM::subSectionSeparator() );
|
||||||
if ( aList.size() == 2 ) {
|
if ( aList.size() == 2 ) {
|
||||||
// standard marker string contains "TypeOfMarker:ScaleOfMarker"
|
// standard marker string contains "TypeOfMarker:ScaleOfMarker"
|
||||||
int aTypeOfMarker = aList[0].toInt();
|
int aTypeOfMarker = aList[0].toInt();
|
||||||
double aScaleOfMarker = aList[1].toDouble();
|
double aScaleOfMarker = (aList[1].toInt() + 1) * 0.5;
|
||||||
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
|
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
|
||||||
anAspect->SetScale( aScaleOfMarker );
|
anAspect->SetScale( aScaleOfMarker );
|
||||||
anAspect->SetTypeOfMarker( (Aspect_TypeOfMarker)( aTypeOfMarker-1 ) );
|
anAspect->SetTypeOfMarker( (Aspect_TypeOfMarker)( aTypeOfMarker-1 ) );
|
||||||
anAspect->SetColor( color );
|
anAspect->SetColor( HasColor() ?
|
||||||
|
// predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
|
||||||
|
(Quantity_NameOfColor)GetColor() :
|
||||||
|
// color from properties
|
||||||
|
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ) );
|
||||||
AISShape->Attributes()->SetPointAspect( anAspect );
|
AISShape->Attributes()->SetPointAspect( anAspect );
|
||||||
}
|
}
|
||||||
else if ( aList.size() == 1 ) {
|
else if ( aList.size() == 1 ) {
|
||||||
@ -570,311 +728,26 @@ bool GEOM_Displayer::setPointMarker( const Handle(GEOM_AISShape)& AISShape, cons
|
|||||||
#else
|
#else
|
||||||
Handle(Graphic3d_HArray1OfBytes) aTexture =
|
Handle(Graphic3d_HArray1OfBytes) aTexture =
|
||||||
#endif
|
#endif
|
||||||
GeometryGUI::getTexture( getStudy(), textureId, aWidth, aHeight );
|
GeometryGUI::getTexture( study, textureId, aWidth, aHeight );
|
||||||
if ( !aTexture.IsNull() ) {
|
if ( !aTexture.IsNull() ) {
|
||||||
static int TextureId = 0;
|
static int TextureId = 0;
|
||||||
Handle(Prs3d_PointAspect) aTextureAspect =
|
Handle(Prs3d_PointAspect) aTextureAspect =
|
||||||
new Prs3d_PointAspect( color,
|
new Prs3d_PointAspect( HasColor() ?
|
||||||
|
// predefined color, manually set to displayer via GEOM_Displayer::SetColor() function
|
||||||
|
(Quantity_NameOfColor)GetColor() :
|
||||||
|
// color from properties
|
||||||
|
SalomeApp_Tools::color( propMap.value( GEOM::propertyName( GEOM::PointColor ) ).value<QColor>() ),
|
||||||
++TextureId,
|
++TextureId,
|
||||||
aWidth, aHeight,
|
aWidth, aHeight,
|
||||||
aTexture );
|
aTexture );
|
||||||
AISShape->Attributes()->SetPointAspect( aTextureAspect );
|
AISShape->Attributes()->SetPointAspect( aTextureAspect );
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// texture is not loaded to GUI
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// wrong point marker data stored
|
|
||||||
result = false;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GEOM_Displayer::updateShapeProperties( const Handle(GEOM_AISShape)& AISShape )
|
|
||||||
{
|
|
||||||
// get study
|
|
||||||
SalomeApp_Study* study = getStudy();
|
|
||||||
if ( !study ) return;
|
|
||||||
|
|
||||||
// get resource manager
|
|
||||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
|
||||||
|
|
||||||
if ( myShape.ShapeType() != TopAbs_VERTEX && // fix pb with not displayed points
|
|
||||||
!TopoDS_Iterator(myShape).More() )
|
|
||||||
return; // NPAL15983 (Bug when displaying empty groups)
|
|
||||||
|
|
||||||
// flag: only vertex or compound of vertices is processed (specific handling)
|
|
||||||
bool onlyVertex = (myShape.ShapeType() == TopAbs_VERTEX || isCompoundOfVertices( myShape ));
|
|
||||||
// presentation study entry (empty for temporary objects like preview)
|
|
||||||
QString anEntry = !myIO.IsNull() ? QString( myIO->getEntry() ) : QString();
|
|
||||||
// flag: temporary object
|
|
||||||
bool isTemporary = anEntry.isEmpty() || anEntry.startsWith( "TEMP_" );
|
|
||||||
// currently active view window's ID (-1 if no active view)
|
|
||||||
int aMgrId = !myIO.IsNull() ? getViewManagerId( myViewFrame ) : -1;
|
|
||||||
|
|
||||||
// stored properties
|
|
||||||
PropMap aPropMap = study->getObjectPropMap( aMgrId, anEntry );
|
|
||||||
// default properties
|
|
||||||
PropMap aDefPropMap = getDefaultPropertyMap( SOCC_Viewer::Type() );
|
|
||||||
|
|
||||||
// use properties stored in study
|
|
||||||
bool useStudy = !isTemporary && aMgrId != -1; // anEntry.isEmpty()
|
|
||||||
// use GEOM object color (from engine side)
|
|
||||||
bool useObjColor = !aPropMap.contains( COLOR_PROP );
|
|
||||||
// use GEOM object marker (rom engine side)
|
|
||||||
bool useObjMarker = !aPropMap.contains( MARKER_TYPE_PROP );
|
|
||||||
|
|
||||||
MergePropertyMaps( aPropMap, aDefPropMap );
|
|
||||||
|
|
||||||
// default properties
|
|
||||||
double transparency = 0.0;
|
|
||||||
int uIsos = 1;
|
|
||||||
int vIsos = 1;
|
|
||||||
int dispMode = myDisplayMode; // take from resource manager ???
|
|
||||||
Quantity_Color shadingColor = myShadingColor; // take from resource manager ???
|
|
||||||
Standard_Boolean isTopLevel = Standard_False; // bool ???
|
|
||||||
bool isDisplayVectors = false;
|
|
||||||
double deflection = 0.001;
|
|
||||||
Material_Model material;
|
|
||||||
|
|
||||||
if ( useStudy ) {
|
|
||||||
// take proprties from stored properties:
|
|
||||||
// - shading color
|
|
||||||
shadingColor = SalomeApp_Tools::color( aPropMap.value( COLOR_PROP ).value<QColor>() );
|
|
||||||
// - display mode
|
|
||||||
dispMode = aPropMap.value( DISPLAY_MODE_PROP ).toInt();
|
|
||||||
// - nb of isos
|
|
||||||
uIsos = aPropMap.value( ISOS_PROP ).toString().split( DIGIT_SEPARATOR )[0].toInt();
|
|
||||||
vIsos = aPropMap.value( ISOS_PROP ).toString().split( DIGIT_SEPARATOR )[1].toInt();
|
|
||||||
// - transparency
|
|
||||||
transparency = aPropMap.value( TRANSPARENCY_PROP ).toDouble();
|
|
||||||
// - top-level flag
|
|
||||||
isTopLevel = aPropMap.value( TOP_LEVEL_PROP ).value<Standard_Boolean>();
|
|
||||||
// - display vectors flag
|
|
||||||
isDisplayVectors = aPropMap.value( VECTOR_MODE_PROP ).toBool();
|
|
||||||
// - deflection coefficient
|
|
||||||
deflection = aPropMap.value( DEFLECTION_COEFF_PROP ).toDouble();
|
|
||||||
// - line width
|
|
||||||
SetWidth( aPropMap.value( EDGE_WIDTH_PROP ).toInt() );
|
|
||||||
// - isos width
|
|
||||||
SetIsosWidth( aPropMap.value( ISOS_WIDTH_PROP ).toInt() );
|
|
||||||
// - material
|
|
||||||
material.fromProperties( aPropMap.value( MATERIAL_PROP ).toString() );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// take nb of isos from resources:
|
|
||||||
// - nb of isos
|
|
||||||
uIsos = aResMgr->integerValue( "Geometry", "iso_number_u", 1 );
|
|
||||||
vIsos = aResMgr->integerValue( "Geometry", "iso_number_v", 1 );
|
|
||||||
// - deflection coefficient
|
|
||||||
deflection = aResMgr->doubleValue( "Geometry", "deflection_coeff", 0.001 );
|
|
||||||
// - material
|
|
||||||
QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
|
|
||||||
material.fromResources( mname );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Temporary staff: vertex must be infinite for correct visualization
|
|
||||||
AISShape->SetInfiniteState( myShape.Infinite() ); // || myShape.ShapeType() == TopAbs_VERTEX // VSR: 05/04/2010: Fix 20668 (Fit All for points & lines)
|
|
||||||
|
|
||||||
// set material
|
|
||||||
// - set front material properties
|
|
||||||
AISShape->SetCurrentFacingModel(Aspect_TOFM_FRONT_SIDE);
|
|
||||||
AISShape->SetMaterial( material.getMaterialOCCAspect( true ) );
|
|
||||||
// - set back material properties
|
|
||||||
AISShape->SetCurrentFacingModel(Aspect_TOFM_BACK_SIDE);
|
|
||||||
AISShape->SetMaterial( material.getMaterialOCCAspect( false ) );
|
|
||||||
// - switch default facing mode
|
|
||||||
AISShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
|
||||||
|
|
||||||
// set shading color
|
|
||||||
if ( !material.isPhysical() )
|
|
||||||
AISShape->SetShadingColor( shadingColor );
|
|
||||||
|
|
||||||
// set display mode
|
|
||||||
AISShape->SetDisplayMode( dispMode );
|
|
||||||
|
|
||||||
// set iso properties
|
|
||||||
Handle(Prs3d_IsoAspect) uIsoAspect = AISShape->Attributes()->UIsoAspect();
|
|
||||||
Handle(Prs3d_IsoAspect) vIsoAspect = AISShape->Attributes()->VIsoAspect();
|
|
||||||
uIsoAspect->SetColor( qColorFromResources( "isos_color", QColor::fromRgbF( 0.5, 0.5, 0.5 ) ) );
|
|
||||||
vIsoAspect->SetColor( qColorFromResources( "isos_color", QColor::fromRgbF( 0.5, 0.5, 0.5 ) ) );
|
|
||||||
if ( HasIsosWidth() ) {
|
|
||||||
uIsoAspect->SetWidth( GetIsosWidth() );
|
|
||||||
vIsoAspect->SetWidth( GetIsosWidth() );
|
|
||||||
}
|
|
||||||
uIsoAspect->SetNumber( uIsos );
|
|
||||||
vIsoAspect->SetNumber( vIsos );
|
|
||||||
AISShape->Attributes()->SetUIsoAspect( uIsoAspect );
|
|
||||||
AISShape->Attributes()->SetVIsoAspect( vIsoAspect );
|
|
||||||
|
|
||||||
// set transparency
|
|
||||||
AISShape->SetTransparency( transparency );
|
|
||||||
|
|
||||||
// set top-level flag
|
|
||||||
AISShape->setTopLevel( isTopLevel );
|
|
||||||
|
|
||||||
// set display vectors flag
|
|
||||||
AISShape->SetDisplayVectors( isDisplayVectors );
|
|
||||||
|
|
||||||
// set point marker (for vertex / compound of vertices only)
|
|
||||||
if ( onlyVertex && !useObjMarker ) {
|
|
||||||
useObjMarker = !setPointMarker( AISShape,
|
|
||||||
aPropMap.value( MARKER_TYPE_PROP ).toString(),
|
|
||||||
HasColor() ? (Quantity_NameOfColor)GetColor() : qColorFromResources( "point_color", QColor( 255, 255, 0 ) ) );
|
|
||||||
}
|
|
||||||
if ( HasColor() ) {
|
|
||||||
AISShape->SetShadingColor( (Quantity_NameOfColor)GetColor() );
|
|
||||||
AISShape->SetColor( (Quantity_NameOfColor)GetColor() );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Set line aspect
|
|
||||||
Handle(Prs3d_LineAspect) anAspect = AISShape->Attributes()->LineAspect();
|
|
||||||
anAspect->SetColor( qColorFromResources( "wireframe_color", QColor( 255, 255, 0 ) ) );
|
|
||||||
AISShape->Attributes()->SetLineAspect( anAspect );
|
|
||||||
|
|
||||||
// Set unfree boundaries aspect
|
|
||||||
anAspect = AISShape->Attributes()->UnFreeBoundaryAspect();
|
|
||||||
anAspect->SetColor( qColorFromResources( "wireframe_color", QColor( 255, 255, 0 ) ) );
|
|
||||||
AISShape->Attributes()->SetUnFreeBoundaryAspect( anAspect );
|
|
||||||
AISShape->storeBoundaryColors();
|
|
||||||
|
|
||||||
// Set free boundaries aspect
|
|
||||||
anAspect = AISShape->Attributes()->FreeBoundaryAspect();
|
|
||||||
anAspect->SetColor( qColorFromResources( "free_bound_color", QColor( 0, 255, 0 ) ) );
|
|
||||||
AISShape->Attributes()->SetFreeBoundaryAspect( anAspect );
|
|
||||||
|
|
||||||
// Set wire aspect
|
|
||||||
anAspect = AISShape->Attributes()->WireAspect();
|
|
||||||
anAspect->SetColor( qColorFromResources( "line_color", QColor( 255, 0, 0 ) ) );
|
|
||||||
AISShape->Attributes()->SetWireAspect( anAspect );
|
|
||||||
|
|
||||||
// Set color for edges in shading
|
|
||||||
AISShape->SetEdgesInShadingColor( qColorFromResources( "edges_in_shading_color", QColor( 255, 255, 0 ) ) );
|
|
||||||
|
|
||||||
// Set deflection coefficient
|
|
||||||
AISShape->SetOwnDeviationCoefficient( qMax( deflection, DEFLECTION_MIN ) ); // to avoid to small values of the coefficient
|
|
||||||
}
|
|
||||||
|
|
||||||
// set texture
|
|
||||||
if ( HasTexture() ) {
|
|
||||||
AISShape->SetTextureFileName(TCollection_AsciiString(myTexture.c_str()));
|
|
||||||
AISShape->SetTextureMapOn();
|
|
||||||
AISShape->DisableTextureModulate();
|
|
||||||
AISShape->SetDisplayMode(3);
|
|
||||||
}
|
|
||||||
|
|
||||||
// set line width
|
|
||||||
if ( HasWidth() )
|
|
||||||
AISShape->SetWidth( GetWidth() );
|
|
||||||
|
|
||||||
// set interactive object
|
|
||||||
if ( !myIO.IsNull() ) {
|
|
||||||
AISShape->setIO( myIO );
|
|
||||||
AISShape->SetOwner( myIO );
|
|
||||||
}
|
|
||||||
else if ( !myName.empty() ) {
|
|
||||||
// Workaround to allow selection of temporary objects
|
|
||||||
static int tempId = 0;
|
|
||||||
Handle( SALOME_InteractiveObject ) anObj =
|
|
||||||
new SALOME_InteractiveObject( QString( "TEMP_%1" ).arg( tempId++ ).toLatin1().data(), "GEOM", myName.c_str() );
|
|
||||||
AISShape->setIO( anObj );
|
|
||||||
AISShape->SetOwner( anObj );
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle( SALOME_InteractiveObject ) anIO = AISShape->getIO();
|
|
||||||
if ( !anIO.IsNull() ) {
|
|
||||||
_PTR(SObject) SO ( study->studyDS()->FindObjectID( anIO->getEntry() ) );
|
|
||||||
if ( SO ) {
|
|
||||||
// get CORBA reference to data object
|
|
||||||
CORBA::Object_var object = GeometryGUI::ClientSObjectToObject(SO);
|
|
||||||
if ( !CORBA::is_nil( object ) ) {
|
|
||||||
// downcast to GEOM object
|
|
||||||
GEOM::GEOM_Object_var aGeomObject = GEOM::GEOM_Object::_narrow( object );
|
|
||||||
bool hasColor = false;
|
|
||||||
SALOMEDS::Color aSColor = getColor(aGeomObject,hasColor);
|
|
||||||
if ( hasColor && useObjColor ) {
|
|
||||||
Quantity_Color aQuanColor( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
|
|
||||||
if ( !material.isPhysical() ) {
|
|
||||||
AISShape->SetColor( aQuanColor );
|
|
||||||
AISShape->SetShadingColor( aQuanColor );
|
|
||||||
}
|
|
||||||
if ( onlyVertex ) {
|
|
||||||
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
|
|
||||||
anAspect->SetColor( aQuanColor );
|
|
||||||
anAspect->SetScale( myScaleOfMarker );
|
|
||||||
anAspect->SetTypeOfMarker( myTypeOfMarker );
|
|
||||||
AISShape->Attributes()->SetPointAspect( anAspect );
|
|
||||||
}
|
|
||||||
study->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, SalomeApp_Tools::color( aQuanColor ) );
|
|
||||||
}
|
|
||||||
else if ( !hasColor && !isTemporary ) {
|
|
||||||
//In case if color wasn't defined in the property map of the object
|
|
||||||
//and GEOM_Object color also wasn't defined get default color from Resource Mgr.
|
|
||||||
QColor col = aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) );
|
|
||||||
Quantity_Color aQuanColor = SalomeApp_Tools::color( col );
|
|
||||||
if ( !material.isPhysical() ) {
|
|
||||||
AISShape->SetShadingColor( aQuanColor );
|
|
||||||
}
|
|
||||||
study->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, col );
|
|
||||||
}
|
|
||||||
|
|
||||||
// ... marker type
|
|
||||||
if ( useObjMarker ) {
|
|
||||||
GEOM::marker_type aType = aGeomObject->GetMarkerType();
|
|
||||||
GEOM::marker_size aSize = aGeomObject->GetMarkerSize();
|
|
||||||
if ( aType > GEOM::MT_NONE && aType < GEOM::MT_USER && aSize > GEOM::MS_NONE && aSize <= GEOM::MS_70 ) {
|
|
||||||
Aspect_TypeOfMarker aMType = (Aspect_TypeOfMarker)( (int)aType-1 );
|
|
||||||
double aMSize = ((int)aSize+1)*0.5;
|
|
||||||
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
|
|
||||||
anAspect->SetScale( aMSize );
|
|
||||||
anAspect->SetTypeOfMarker( aMType );
|
|
||||||
Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
|
|
||||||
if ( hasColor )
|
|
||||||
aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
|
|
||||||
anAspect->SetColor( aQuanColor );
|
|
||||||
AISShape->Attributes()->SetPointAspect( anAspect );
|
|
||||||
}
|
|
||||||
else if ( aType == GEOM::MT_USER ) {
|
|
||||||
int aTextureId = aGeomObject->GetMarkerTexture();
|
|
||||||
Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
|
|
||||||
if ( hasColor ) aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
|
|
||||||
Standard_Integer aWidth, aHeight;
|
|
||||||
#if OCC_VERSION_LARGE > 0x06040000 // Porting to OCCT6.5.1
|
|
||||||
Handle(TColStd_HArray1OfByte) aTexture =
|
|
||||||
#else
|
|
||||||
Handle(Graphic3d_HArray1OfBytes) aTexture =
|
|
||||||
#endif
|
|
||||||
GeometryGUI::getTexture( study, aTextureId, aWidth, aHeight);
|
|
||||||
if (!aTexture.IsNull()) {
|
|
||||||
static int TextureId = 0;
|
|
||||||
Handle(Prs3d_PointAspect) aTextureAspect =
|
|
||||||
new Prs3d_PointAspect(aQuanColor, ++TextureId, aWidth, aHeight, aTexture );
|
|
||||||
AISShape->Attributes()->SetPointAspect( aTextureAspect );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else { //Use marker from the preferences
|
|
||||||
Handle(Prs3d_PointAspect) anAspect = AISShape->Attributes()->PointAspect();
|
|
||||||
anAspect->SetScale( myScaleOfMarker );
|
|
||||||
anAspect->SetTypeOfMarker( myTypeOfMarker );
|
|
||||||
Quantity_Color aQuanColor = SalomeApp_Tools::color( aResMgr->colorValue( "Geometry", "point_color", QColor( 255, 255, 0 ) ) );
|
|
||||||
if ( hasColor )
|
|
||||||
aQuanColor = Quantity_Color( aSColor.R, aSColor.G, aSColor.B, Quantity_TOC_RGB );
|
|
||||||
anAspect->SetColor( aQuanColor );
|
|
||||||
AISShape->Attributes()->SetPointAspect( anAspect );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !isTemporary )
|
if ( create && !isTemporary && aMgrId != -1 ) {
|
||||||
study->setObjectProperty( aMgrId, anIO->getEntry(), MATERIAL_PROP, material.toProperties() );
|
// set properties to the study
|
||||||
|
study->setObjectPropMap( aMgrId, entry, propMap );
|
||||||
if ( HasWidth() )
|
|
||||||
study->setObjectProperty( aMgrId, anIO->getEntry(), EDGE_WIDTH_PROP, GetWidth() );
|
|
||||||
if ( HasIsosWidth() )
|
|
||||||
study->setObjectProperty( aMgrId, anIO->getEntry(), ISOS_WIDTH_PROP, GetIsosWidth() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// AISShape->SetName(???); ??? necessary to set name ???
|
// AISShape->SetName(???); ??? necessary to set name ???
|
||||||
@ -986,7 +859,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
|||||||
Handle(GEOM_AISShape) AISShape = ( myType == GEOM_VECTOR ) ? new GEOM_AISVector( myShape, "" )
|
Handle(GEOM_AISShape) AISShape = ( myType == GEOM_VECTOR ) ? new GEOM_AISVector( myShape, "" )
|
||||||
: new GEOM_AISShape ( myShape, "" );
|
: new GEOM_AISShape ( myShape, "" );
|
||||||
// update shape properties
|
// update shape properties
|
||||||
updateShapeProperties( AISShape );
|
updateShapeProperties( AISShape, true );
|
||||||
// add shape to the presentation
|
// add shape to the presentation
|
||||||
occPrs->AddObject( AISShape );
|
occPrs->AddObject( AISShape );
|
||||||
|
|
||||||
@ -1023,7 +896,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
|||||||
if ( AISShape->Shape() != myShape )
|
if ( AISShape->Shape() != myShape )
|
||||||
AISShape->Set( myShape );
|
AISShape->Set( myShape );
|
||||||
// update shape properties
|
// update shape properties
|
||||||
updateShapeProperties( AISShape );
|
updateShapeProperties( AISShape, false );
|
||||||
// re-set interactive object
|
// re-set interactive object
|
||||||
if ( !myIO.IsNull() )
|
if ( !myIO.IsNull() )
|
||||||
{
|
{
|
||||||
@ -1091,7 +964,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
theActors->AddItem( aTrh );
|
theActors->AddItem( aTrh );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PropMap aDefPropMap = getDefaultPropertyMap(SVTK_Viewer::Type());
|
PropMap aDefPropMap = getDefaultPropertyMap();
|
||||||
|
|
||||||
if(!myIO.IsNull()) {
|
if(!myIO.IsNull()) {
|
||||||
aMgrId = getViewManagerId(myViewFrame);
|
aMgrId = getViewManagerId(myViewFrame);
|
||||||
@ -1101,13 +974,18 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
|
|
||||||
theActors = vtkActorCollection::New();
|
theActors = vtkActorCollection::New();
|
||||||
GEOM_Actor* aGeomActor = GEOM_Actor::New();
|
GEOM_Actor* aGeomActor = GEOM_Actor::New();
|
||||||
aGeomActor->SetShape(myShape,aDefPropMap.value(DEFLECTION_COEFF_PROP).toDouble(),myType == GEOM_VECTOR);
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// VSR: for VTK viewer currently deflection coefficient is hardcoded
|
||||||
|
// due to performance problem
|
||||||
|
// aGeomActor->SetShape(myShape,aDefPropMap.value(GEOM::propertyName( GEOM::Deflection )).toDouble(),myType == GEOM_VECTOR);
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
aGeomActor->SetShape(myShape, VTK_MIN_DEFLECTION, myType == GEOM_VECTOR);
|
||||||
theActors->AddItem(aGeomActor);
|
theActors->AddItem(aGeomActor);
|
||||||
aGeomActor->Delete();
|
aGeomActor->Delete();
|
||||||
|
|
||||||
if(useStudy) {
|
if(useStudy) {
|
||||||
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
|
aPropMap = aStudy->getObjectPropMap(aMgrId,anEntry);
|
||||||
if(!aPropMap.contains(COLOR_PROP))
|
if(!aPropMap.contains(GEOM::propertyName( GEOM::Color )))
|
||||||
useObjCol = true;
|
useObjCol = true;
|
||||||
MergePropertyMaps(aPropMap, aDefPropMap);
|
MergePropertyMaps(aPropMap, aDefPropMap);
|
||||||
}
|
}
|
||||||
@ -1160,15 +1038,15 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
|
|
||||||
int aIsos[2]= { 1, 1 };
|
int aIsos[2]= { 1, 1 };
|
||||||
if(useStudy) {
|
if(useStudy) {
|
||||||
QString anIsos = aPropMap.value(ISOS_PROP).toString();
|
QString anIsos = aPropMap.value(GEOM::propertyName( GEOM::NbIsos )).toString();
|
||||||
QStringList uv = anIsos.split(DIGIT_SEPARATOR);
|
QStringList uv = anIsos.split( GEOM::subSectionSeparator() );
|
||||||
aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt();
|
aIsos[0] = uv[0].toInt(); aIsos[1] = uv[1].toInt();
|
||||||
aGeomGActor->SetNbIsos(aIsos);
|
aGeomGActor->SetNbIsos(aIsos);
|
||||||
aGeomGActor->SetOpacity(1.0 - aPropMap.value(TRANSPARENCY_PROP).toDouble());
|
aGeomGActor->SetOpacity(1.0 - aPropMap.value(GEOM::propertyName( GEOM::Transparency )).toDouble());
|
||||||
SetWidth(aPropMap.value(EDGE_WIDTH_PROP).toInt());
|
SetWidth(aPropMap.value(GEOM::propertyName( GEOM::LineWidth )).toInt());
|
||||||
SetIsosWidth(aPropMap.value(ISOS_WIDTH_PROP).toInt());
|
SetIsosWidth(aPropMap.value(GEOM::propertyName( GEOM::IsosWidth )).toInt());
|
||||||
aGeomGActor->SetVectorMode(aPropMap.value(VECTOR_MODE_PROP).toBool());
|
aGeomGActor->SetVectorMode(aPropMap.value(GEOM::propertyName( GEOM::EdgesDirection )).toBool());
|
||||||
int aDispModeId = aPropMap.value(DISPLAY_MODE_PROP).toInt();
|
int aDispModeId = aPropMap.value(GEOM::propertyName( GEOM::DisplayMode )).toInt();
|
||||||
// Specially processing of 'Shading with edges' mode from preferences,
|
// Specially processing of 'Shading with edges' mode from preferences,
|
||||||
// because there is the following enum in VTK viewer:
|
// because there is the following enum in VTK viewer:
|
||||||
// Points - 0, Wireframe - 1, Surface - 2, Insideframe - 3, SurfaceWithEdges - 4
|
// Points - 0, Wireframe - 1, Surface - 2, Insideframe - 3, SurfaceWithEdges - 4
|
||||||
@ -1179,13 +1057,18 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
// enum in GEOM_Actor (and further to VTKViewer::Representation enum)
|
// enum in GEOM_Actor (and further to VTKViewer::Representation enum)
|
||||||
aDispModeId++;
|
aDispModeId++;
|
||||||
aGeomGActor->setDisplayMode(aDispModeId);
|
aGeomGActor->setDisplayMode(aDispModeId);
|
||||||
aGeomGActor->SetDeflection(aPropMap.value(DEFLECTION_COEFF_PROP).toDouble());
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
// VSR: for VTK viewer currently deflection coefficient is hardcoded
|
||||||
|
// due to performance problem;
|
||||||
|
// aGeomGActor->SetDeflection(aPropMap.value(GEOM::propertyName( GEOM::Deflection )).toDouble());
|
||||||
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
aGeomGActor->SetDeflection(VTK_MIN_DEFLECTION);
|
||||||
|
|
||||||
// Create material model
|
// Create material model
|
||||||
Material_Model material;
|
Material_Model material;
|
||||||
material.fromProperties( aPropMap.value(MATERIAL_PROP).toString() );
|
material.fromProperties( aPropMap.value(GEOM::propertyName( GEOM::Material )).toString() );
|
||||||
// Set material properties for the object
|
// Set material properties for the object
|
||||||
aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
|
aStudy->setObjectProperty( aMgrId, anEntry, GEOM::propertyName( GEOM::Material ), material.toProperties() );
|
||||||
// Set the same front and back materials for the selected shape
|
// Set the same front and back materials for the selected shape
|
||||||
std::vector<vtkProperty*> aProps;
|
std::vector<vtkProperty*> aProps;
|
||||||
aProps.push_back( material.getMaterialVTKProperty( true ) );
|
aProps.push_back( material.getMaterialVTKProperty( true ) );
|
||||||
@ -1214,12 +1097,12 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
|
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), COLOR_PROP, QColor( aColor[0] *255, aColor[1] * 255, aColor[2]* 255) );
|
aStudy->setObjectProperty( aMgrId, anIO->getEntry(), GEOM::propertyName( GEOM::Color ), QColor( aColor[0] *255, aColor[1] * 255, aColor[2]* 255) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
QColor c = aPropMap.value(COLOR_PROP).value<QColor>();
|
QColor c = aPropMap.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
|
||||||
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
|
aColor[0] = c.red()/255.; aColor[1] = c.green()/255.; aColor[2] = c.blue()/255.;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1235,7 +1118,7 @@ void GEOM_Displayer::Update( SALOME_VTKPrs* prs )
|
|||||||
QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
|
QString mname = aResMgr->stringValue( "Geometry", "material", "Plastic" );
|
||||||
material.fromResources( mname );
|
material.fromResources( mname );
|
||||||
// Set material properties for the object
|
// Set material properties for the object
|
||||||
aStudy->setObjectProperty( aMgrId, anEntry, MATERIAL_PROP, material.toProperties() );
|
aStudy->setObjectProperty( aMgrId, anEntry, GEOM::propertyName( GEOM::Material ), material.toProperties() );
|
||||||
// Set material for the selected shape
|
// Set material for the selected shape
|
||||||
std::vector<vtkProperty*> aProps;
|
std::vector<vtkProperty*> aProps;
|
||||||
aProps.push_back( material.getMaterialVTKProperty( true ) );
|
aProps.push_back( material.getMaterialVTKProperty( true ) );
|
||||||
@ -1624,8 +1507,8 @@ void GEOM_Displayer::AfterDisplay( SALOME_View* v, const SALOME_OCCPrs* p )
|
|||||||
Handle(SALOME_InteractiveObject) IO = sh->getIO();
|
Handle(SALOME_InteractiveObject) IO = sh->getIO();
|
||||||
if ( IO.IsNull() ) continue;
|
if ( IO.IsNull() ) continue;
|
||||||
PropMap aPropMap = aStudy->getObjectPropMap( aMgrId, IO->getEntry() );
|
PropMap aPropMap = aStudy->getObjectPropMap( aMgrId, IO->getEntry() );
|
||||||
if ( aPropMap.contains( TRANSPARENCY_PROP ) ) {
|
if ( aPropMap.contains( GEOM::propertyName( GEOM::Transparency ) ) ) {
|
||||||
double transparency = aPropMap.value(TRANSPARENCY_PROP).toDouble();
|
double transparency = aPropMap.value(GEOM::propertyName( GEOM::Transparency )).toDouble();
|
||||||
ic->SetTransparency( sh, transparency, true );
|
ic->SetTransparency( sh, transparency, true );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1806,12 +1689,12 @@ bool GEOM_Displayer::canBeDisplayed( const QString& entry, const QString& viewer
|
|||||||
int GEOM_Displayer::SetDisplayMode( const int theMode )
|
int GEOM_Displayer::SetDisplayMode( const int theMode )
|
||||||
{
|
{
|
||||||
int aPrevMode = myDisplayMode;
|
int aPrevMode = myDisplayMode;
|
||||||
if ( theMode != -1 )
|
if ( theMode != -1 ) {
|
||||||
myDisplayMode = theMode;
|
myDisplayMode = theMode;
|
||||||
else
|
myHasDisplayMode = true;
|
||||||
{
|
}
|
||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
else {
|
||||||
myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
|
UnsetDisplayMode();
|
||||||
}
|
}
|
||||||
return aPrevMode;
|
return aPrevMode;
|
||||||
}
|
}
|
||||||
@ -1826,9 +1709,15 @@ int GEOM_Displayer::UnsetDisplayMode()
|
|||||||
int aPrevMode = myDisplayMode;
|
int aPrevMode = myDisplayMode;
|
||||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
|
myDisplayMode = resMgr->integerValue( "Geometry", "display_mode", 0 );
|
||||||
|
myHasDisplayMode = false;
|
||||||
return aPrevMode;
|
return aPrevMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GEOM_Displayer::HasDisplayMode() const
|
||||||
|
{
|
||||||
|
return myHasDisplayMode;
|
||||||
|
}
|
||||||
|
|
||||||
SALOMEDS::Color GEOM_Displayer::getPredefinedUniqueColor()
|
SALOMEDS::Color GEOM_Displayer::getPredefinedUniqueColor()
|
||||||
{
|
{
|
||||||
static QList<QColor> colors;
|
static QList<QColor> colors;
|
||||||
@ -1917,121 +1806,228 @@ SALOMEDS::Color GEOM_Displayer::getUniqueColor( const QList<SALOMEDS::Color>& th
|
|||||||
return aSColor;
|
return aSColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PropMap GEOM_Displayer::getObjectProperties( SalomeApp_Study* study,
|
||||||
|
const QString& entry,
|
||||||
PropMap GEOM_Displayer::getDefaultPropertyMap(const QString& viewer_type)
|
SALOME_View* view )
|
||||||
{
|
{
|
||||||
PropMap aDefaultMap;
|
// get default properties for the explicitly specified default view type
|
||||||
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
|
PropMap propMap = GEOM_Displayer::getDefaultPropertyMap();
|
||||||
|
|
||||||
//1. Visibility
|
if ( study && view ) {
|
||||||
aDefaultMap.insert( VISIBILITY_PROP, 1 );
|
SUIT_ViewModel* viewModel = dynamic_cast<SUIT_ViewModel*>( view );
|
||||||
|
SUIT_ViewManager* viewMgr = ( viewModel != 0 ) ? viewModel->getViewManager() : 0;
|
||||||
|
int viewId = ( viewMgr != 0 ) ? viewMgr->getGlobalId() : -1;
|
||||||
|
|
||||||
//2. Nb Isos
|
if ( viewModel && viewId != -1 ) {
|
||||||
aDefaultMap.insert( ISOS_PROP,
|
// get properties from the study
|
||||||
|
PropMap storedMap = study->getObjectPropMap( viewId, entry );
|
||||||
|
// overwrite default properties from stored ones (that are specified)
|
||||||
|
for ( int prop = GEOM::Visibility; prop <= GEOM::LastProperty; prop++ ) {
|
||||||
|
if ( storedMap.contains( GEOM::propertyName( (GEOM::Property)prop ) ) )
|
||||||
|
propMap.insert( GEOM::propertyName( (GEOM::Property)prop ),
|
||||||
|
storedMap.value( GEOM::propertyName( (GEOM::Property)prop ) ) );
|
||||||
|
}
|
||||||
|
// ... specific processing for color
|
||||||
|
// ... current implementation is to use same stored color for all aspects
|
||||||
|
// ... (TODO) possible future improvements about free boundaries, standalone edges etc colors can be here
|
||||||
|
if ( storedMap.contains( GEOM::propertyName( GEOM::Color ) ) ) {
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::ShadingColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::WireframeColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::LineColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::PointColor ), storedMap.value( GEOM::propertyName( GEOM::Color ) ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !entry.isEmpty() ) {
|
||||||
|
// get CORBA reference to geom object
|
||||||
|
_PTR(SObject) SO( study->studyDS()->FindObjectID( entry.toStdString() ) );
|
||||||
|
if ( SO ) {
|
||||||
|
CORBA::Object_var object = GeometryGUI::ClientSObjectToObject( SO );
|
||||||
|
if ( !CORBA::is_nil( object ) ) {
|
||||||
|
GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_narrow( object );
|
||||||
|
// check that geom object has color properly set
|
||||||
|
bool hasColor = false;
|
||||||
|
SALOMEDS::Color aSColor = getColor( geomObject, hasColor );
|
||||||
|
// set color from geometry object (only once, if it is not yet set in GUI)
|
||||||
|
// current implementation is to use same color for all aspects
|
||||||
|
// (TODO) possible future improvements about free boundaries, standalone edges etc colors can be here
|
||||||
|
if ( hasColor && !storedMap.contains( GEOM::propertyName( GEOM::Color ) ) ) {
|
||||||
|
QColor objColor = QColor::fromRgbF( aSColor.R, aSColor.G, aSColor.B );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::ShadingColor ), objColor );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::WireframeColor ), objColor );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::LineColor ), objColor );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ), objColor );
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::PointColor ), objColor );
|
||||||
|
}
|
||||||
|
// check that object has point marker properly set
|
||||||
|
GEOM::marker_type mType = geomObject->GetMarkerType();
|
||||||
|
GEOM::marker_size mSize = geomObject->GetMarkerSize();
|
||||||
|
int mTextureId = geomObject->GetMarkerTexture();
|
||||||
|
bool hasMarker = ( mType > GEOM::MT_NONE && mType < GEOM::MT_USER && mSize > GEOM::MS_NONE && mSize <= GEOM::MS_70 ) ||
|
||||||
|
( mType == GEOM::MT_USER && mTextureId > 0 );
|
||||||
|
// set point marker from geometry object (only once, if it is not yet set in GUI)
|
||||||
|
if ( hasMarker && !storedMap.contains( GEOM::propertyName( GEOM::PointMarker ) ) ) {
|
||||||
|
if ( mType > GEOM::MT_NONE && mType < GEOM::MT_USER ) {
|
||||||
|
// standard type
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::PointMarker ),
|
||||||
|
QString( "%1%2%3" ).arg( (int)mType ).arg( GEOM::subSectionSeparator() ).arg( (int)mSize ) );
|
||||||
|
}
|
||||||
|
else if ( mType == GEOM::MT_USER ) {
|
||||||
|
// custom texture
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::PointMarker ), QString::number( mTextureId ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return propMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
PropMap GEOM_Displayer::getDefaultPropertyMap()
|
||||||
|
{
|
||||||
|
PropMap propMap;
|
||||||
|
|
||||||
|
// get resource manager
|
||||||
|
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||||
|
|
||||||
|
// fill in the properties map with default values
|
||||||
|
|
||||||
|
// - visibility (false by default)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::Visibility ), false );
|
||||||
|
|
||||||
|
// - nb isos (take default value from preferences)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::NbIsos ),
|
||||||
QString( "%1%2%3" ).
|
QString( "%1%2%3" ).
|
||||||
arg( aResMgr->integerValue( "Geometry", "iso_number_u", 1 ) ).
|
arg( resMgr->integerValue( "Geometry", "iso_number_u", 1 ) ).
|
||||||
arg( DIGIT_SEPARATOR ).
|
arg( GEOM::subSectionSeparator() ).
|
||||||
arg( aResMgr->integerValue( "Geometry", "iso_number_v", 1 ) ) );
|
arg( resMgr->integerValue( "Geometry", "iso_number_v", 1 ) ) );
|
||||||
|
|
||||||
//3. Transparency
|
// - transparency (opacity = 1-transparency)
|
||||||
aDefaultMap.insert( TRANSPARENCY_PROP, 0.0 );
|
propMap.insert( GEOM::propertyName( GEOM::Transparency ), 0.0 );
|
||||||
|
|
||||||
//4. Display Mode
|
// - display mode (take default value from preferences)
|
||||||
aDefaultMap.insert( DISPLAY_MODE_PROP,
|
propMap.insert( GEOM::propertyName( GEOM::DisplayMode ),
|
||||||
aResMgr->integerValue( "Geometry", "display_mode", 0 ) );
|
resMgr->integerValue( "Geometry", "display_mode", 0 ) );
|
||||||
|
|
||||||
//5. Vector Mode
|
// - show edges direction flag (false by default)
|
||||||
aDefaultMap.insert( VECTOR_MODE_PROP, false );
|
propMap.insert( GEOM::propertyName( GEOM::EdgesDirection ), false );
|
||||||
|
|
||||||
//6. Color
|
// - shading color (take default value from preferences)
|
||||||
aDefaultMap.insert( COLOR_PROP,
|
propMap.insert( GEOM::propertyName( GEOM::ShadingColor ),
|
||||||
aResMgr->colorValue( "Geometry", "shading_color", QColor( 255, 0, 0 ) ) );
|
colorFromResources( "shading_color", QColor( 255, 255, 0 ) ) );
|
||||||
|
|
||||||
//7. Deflection Coeff
|
// - wireframe color (take default value from preferences)
|
||||||
if ( viewer_type == SOCC_Viewer::Type() ) {
|
propMap.insert( GEOM::propertyName( GEOM::WireframeColor ),
|
||||||
aDefaultMap.insert( DEFLECTION_COEFF_PROP,
|
colorFromResources( "wireframe_color", QColor( 255, 255, 0 ) ) );
|
||||||
aResMgr->doubleValue( "Geometry", "deflection_coeff", 0.001 ) );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
aDefaultMap.insert( DEFLECTION_COEFF_PROP, 0.001 );
|
|
||||||
}
|
|
||||||
|
|
||||||
//8. Material
|
// - standalone edges color (take default value from preferences)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::LineColor ),
|
||||||
|
colorFromResources( "line_color", QColor( 255, 0, 0 ) ) );
|
||||||
|
|
||||||
|
// - free boundaries color (take default value from preferences)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::FreeBndColor ),
|
||||||
|
colorFromResources( "free_bound_color", QColor( 0, 255, 0 ) ) );
|
||||||
|
|
||||||
|
// - points color (take default value from preferences)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::PointColor ),
|
||||||
|
colorFromResources( "point_color", QColor( 255, 255, 0 ) ) );
|
||||||
|
|
||||||
|
// - isos color (take default value from preferences)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::IsosColor ),
|
||||||
|
colorFromResources( "isos_color", QColor( 200, 200, 200 ) ) );
|
||||||
|
|
||||||
|
// - outlines color (take default value from preferences)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::OutlineColor ),
|
||||||
|
colorFromResources( "edges_in_shading_color", QColor( 180, 180, 180 ) ) );
|
||||||
|
|
||||||
|
// - deflection coefficient (take default value from preferences)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::Deflection ),
|
||||||
|
resMgr->doubleValue( "Geometry", "deflection_coeff", 0.001 ) );
|
||||||
|
|
||||||
|
// - material (take default value from preferences)
|
||||||
Material_Model material;
|
Material_Model material;
|
||||||
material.fromResources( aResMgr->stringValue( "Geometry", "material", "Plastic" ) );
|
material.fromResources( resMgr->stringValue( "Geometry", "material", "Plastic" ) );
|
||||||
aDefaultMap.insert( MATERIAL_PROP, material.toProperties() );
|
propMap.insert( GEOM::propertyName( GEOM::Material ), material.toProperties() );
|
||||||
|
|
||||||
//9. Width of the edges
|
// - edge width (take default value from preferences)
|
||||||
aDefaultMap.insert( EDGE_WIDTH_PROP,
|
propMap.insert( GEOM::propertyName( GEOM::LineWidth ),
|
||||||
aResMgr->integerValue( "Geometry", "edge_width", 1 ) );
|
resMgr->integerValue( "Geometry", "edge_width", 1 ) );
|
||||||
|
|
||||||
//10. Width of iso-lines
|
// - isos width (take default value from preferences)
|
||||||
aDefaultMap.insert( ISOS_WIDTH_PROP,
|
propMap.insert( GEOM::propertyName( GEOM::IsosWidth ),
|
||||||
aResMgr->integerValue( "Geometry", "isolines_width", 1 ) );
|
resMgr->integerValue( "Geometry", "isolines_width", 1 ) );
|
||||||
|
|
||||||
//11. Top-level flag
|
// - point marker (take default value from preferences)
|
||||||
aDefaultMap.insert( TOP_LEVEL_PROP, Standard_False );
|
propMap.insert( GEOM::propertyName( GEOM::PointMarker ),
|
||||||
|
QString( "%1%2%3" ).
|
||||||
|
arg( resMgr->integerValue( "Geometry", "type_of_marker", 1 ) + 1 ).
|
||||||
|
arg( GEOM::subSectionSeparator() ).
|
||||||
|
arg( resMgr->integerValue( "Geometry", "marker_scale", 1 ) ) );
|
||||||
|
|
||||||
return aDefaultMap;
|
// - top-level flag (false by default)
|
||||||
|
propMap.insert( GEOM::propertyName( GEOM::TopLevel ), false );
|
||||||
|
|
||||||
|
return propMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault)
|
bool GEOM_Displayer::MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault)
|
||||||
{
|
{
|
||||||
int nbInserted = 0;
|
int nbInserted = 0;
|
||||||
|
|
||||||
if(!theOrigin.contains(VISIBILITY_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::Visibility ))) {
|
||||||
theOrigin.insert(VISIBILITY_PROP, 0);
|
theOrigin.insert(GEOM::propertyName( GEOM::Visibility ), 0);
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(TRANSPARENCY_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::Transparency ))) {
|
||||||
theOrigin.insert(TRANSPARENCY_PROP, theDefault.value(TRANSPARENCY_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::Transparency ), theDefault.value(GEOM::propertyName( GEOM::Transparency )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(DISPLAY_MODE_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::DisplayMode ))) {
|
||||||
theOrigin.insert(DISPLAY_MODE_PROP, theDefault.value(DISPLAY_MODE_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::DisplayMode ), theDefault.value(GEOM::propertyName( GEOM::DisplayMode )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(ISOS_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::NbIsos ))) {
|
||||||
theOrigin.insert(ISOS_PROP, theDefault.value(ISOS_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::NbIsos ), theDefault.value(GEOM::propertyName( GEOM::NbIsos )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(VECTOR_MODE_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::EdgesDirection ))) {
|
||||||
theOrigin.insert(VECTOR_MODE_PROP, theDefault.value(VECTOR_MODE_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::EdgesDirection ), theDefault.value(GEOM::propertyName( GEOM::EdgesDirection )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(DEFLECTION_COEFF_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::Deflection ))) {
|
||||||
theOrigin.insert(DEFLECTION_COEFF_PROP, theDefault.value(DEFLECTION_COEFF_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::Deflection ), theDefault.value(GEOM::propertyName( GEOM::Deflection )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(MATERIAL_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::Material ))) {
|
||||||
theOrigin.insert(MATERIAL_PROP, theDefault.value(MATERIAL_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::Material ), theDefault.value(GEOM::propertyName( GEOM::Material )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(EDGE_WIDTH_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::LineWidth ))) {
|
||||||
theOrigin.insert(EDGE_WIDTH_PROP, theDefault.value(EDGE_WIDTH_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::LineWidth ), theDefault.value(GEOM::propertyName( GEOM::LineWidth )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(ISOS_WIDTH_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::IsosWidth ))) {
|
||||||
theOrigin.insert(ISOS_WIDTH_PROP, theDefault.value(ISOS_WIDTH_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::IsosWidth ), theDefault.value(GEOM::propertyName( GEOM::IsosWidth )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(COLOR_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::Color ))) {
|
||||||
theOrigin.insert(COLOR_PROP, theDefault.value(COLOR_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::Color ), theDefault.value(GEOM::propertyName( GEOM::Color )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!theOrigin.contains(TOP_LEVEL_PROP)) {
|
if(!theOrigin.contains(GEOM::propertyName( GEOM::TopLevel ))) {
|
||||||
theOrigin.insert(TOP_LEVEL_PROP, theDefault.value(TOP_LEVEL_PROP));
|
theOrigin.insert(GEOM::propertyName( GEOM::TopLevel ), theDefault.value(GEOM::propertyName( GEOM::TopLevel )));
|
||||||
nbInserted++;
|
nbInserted++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public:
|
|||||||
int SetDisplayMode( const int );
|
int SetDisplayMode( const int );
|
||||||
int GetDisplayMode() const;
|
int GetDisplayMode() const;
|
||||||
int UnsetDisplayMode();
|
int UnsetDisplayMode();
|
||||||
|
bool HasDisplayMode() const;
|
||||||
|
|
||||||
/* Sets name - for temporary objects only */
|
/* Sets name - for temporary objects only */
|
||||||
void SetName( const char* theName );
|
void SetName( const char* theName );
|
||||||
@ -172,10 +172,6 @@ public:
|
|||||||
static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
|
static SALOMEDS::Color getUniqueColor( const QList<SALOMEDS::Color>& );
|
||||||
static SALOMEDS::Color getPredefinedUniqueColor();
|
static SALOMEDS::Color getPredefinedUniqueColor();
|
||||||
|
|
||||||
static PropMap getDefaultPropertyMap(const QString& viewer_type);
|
|
||||||
|
|
||||||
static bool MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault);
|
|
||||||
|
|
||||||
/*Get color of the geom object*/
|
/*Get color of the geom object*/
|
||||||
static SALOMEDS::Color getColor(GEOM::GEOM_Object_var aGeomObject, bool& hasColor);
|
static SALOMEDS::Color getColor(GEOM::GEOM_Object_var aGeomObject, bool& hasColor);
|
||||||
|
|
||||||
@ -213,7 +209,13 @@ protected:
|
|||||||
Quantity_Color qColorFromResources( const QString&, const QColor& );
|
Quantity_Color qColorFromResources( const QString&, const QColor& );
|
||||||
QColor colorFromResources( const QString&, const QColor& );
|
QColor colorFromResources( const QString&, const QColor& );
|
||||||
bool setPointMarker( const Handle(GEOM_AISShape)&, const QString&, const Quantity_Color );
|
bool setPointMarker( const Handle(GEOM_AISShape)&, const QString&, const Quantity_Color );
|
||||||
void updateShapeProperties( const Handle(GEOM_AISShape)& );
|
void updateShapeProperties( const Handle(GEOM_AISShape)&, bool );
|
||||||
|
|
||||||
|
PropMap getObjectProperties( SalomeApp_Study*, const QString&, SALOME_View* = 0 );
|
||||||
|
PropMap getDefaultPropertyMap();
|
||||||
|
|
||||||
|
static bool MergePropertyMaps(PropMap& theOrigin, PropMap& theDefault);
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Handle(SALOME_InteractiveObject) myIO;
|
Handle(SALOME_InteractiveObject) myIO;
|
||||||
@ -230,6 +232,7 @@ protected:
|
|||||||
int myIsosWidth;
|
int myIsosWidth;
|
||||||
bool myToActivate;
|
bool myToActivate;
|
||||||
int myDisplayMode;
|
int myDisplayMode;
|
||||||
|
bool myHasDisplayMode;
|
||||||
Aspect_TypeOfMarker myTypeOfMarker;
|
Aspect_TypeOfMarker myTypeOfMarker;
|
||||||
double myScaleOfMarker;
|
double myScaleOfMarker;
|
||||||
|
|
||||||
|
@ -1728,7 +1728,7 @@ void GeometryGUI::contextMenuPopup( const QString& client, QMenu* menu, QString&
|
|||||||
if ( anApp && anApp->activeViewManager() ) {
|
if ( anApp && anApp->activeViewManager() ) {
|
||||||
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() );
|
LightApp_Study* aStudy = dynamic_cast<LightApp_Study*>( anApp->activeStudy() );
|
||||||
if( aStudy ) {
|
if( aStudy ) {
|
||||||
v = aStudy->getObjectProperty( anApp->activeViewManager()->getGlobalId(), lst.Last()->getEntry(), MATERIAL_PROP, QVariant() );
|
v = aStudy->getObjectProperty( anApp->activeViewManager()->getGlobalId(), lst.Last()->getEntry(), GEOM::propertyName( GEOM::Material ), QVariant() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QString curModel = "";
|
QString curModel = "";
|
||||||
@ -1934,7 +1934,7 @@ void GeometryGUI::createPreferences()
|
|||||||
setPreferenceProperty( step, "precision", 3 );
|
setPreferenceProperty( step, "precision", 3 );
|
||||||
|
|
||||||
// Set property for deflection value for spinboxes
|
// Set property for deflection value for spinboxes
|
||||||
setPreferenceProperty( defl, "min", DEFLECTION_MIN );
|
setPreferenceProperty( defl, "min", GEOM::minDeflection() );
|
||||||
setPreferenceProperty( defl, "max", 1.0 );
|
setPreferenceProperty( defl, "max", 1.0 );
|
||||||
setPreferenceProperty( defl, "step", 1.0e-04 );
|
setPreferenceProperty( defl, "step", 1.0e-04 );
|
||||||
setPreferenceProperty( defl, "precision", 6 );
|
setPreferenceProperty( defl, "precision", 6 );
|
||||||
@ -2083,83 +2083,82 @@ void GeometryGUI::storeVisualParameters (int savePoint)
|
|||||||
if (!obj->FindAttribute(anAttr, "AttributeIOR"))
|
if (!obj->FindAttribute(anAttr, "AttributeIOR"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
std::string param,occParam = vType.toLatin1().data();
|
QString param, occParam = vType;
|
||||||
occParam += NAME_SEPARATOR;
|
occParam += GEOM::sectionSeparator();
|
||||||
occParam += QString::number(aMgrId).toLatin1().data();
|
occParam += QString::number(aMgrId);
|
||||||
occParam += NAME_SEPARATOR;
|
occParam += GEOM::sectionSeparator();
|
||||||
|
|
||||||
if (aProps.contains(VISIBILITY_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::Visibility ))) {
|
||||||
param = occParam + VISIBILITY_PROP;
|
param = occParam + GEOM::propertyName( GEOM::Visibility );
|
||||||
ip->setParameter(entry, param, aProps.value(VISIBILITY_PROP).toInt() == 1 ? "On" : "Off");
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Visibility )).toBool() ? "On" : "Off");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(DISPLAY_MODE_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::DisplayMode ))) {
|
||||||
param = occParam + DISPLAY_MODE_PROP;
|
param = occParam + GEOM::propertyName( GEOM::DisplayMode );
|
||||||
ip->setParameter(entry, param, QString::number(aProps.value(DISPLAY_MODE_PROP).toInt()).toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::DisplayMode )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(COLOR_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::Color ))) {
|
||||||
QColor c = aProps.value(COLOR_PROP).value<QColor>();
|
QColor c = aProps.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
|
||||||
QString colorStr = QString::number(c.red()/255.);
|
QStringList val;
|
||||||
colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.green()/255.);
|
val << QString::number(c.redF());
|
||||||
colorStr += DIGIT_SEPARATOR; colorStr += QString::number(c.blue()/255.);
|
val << QString::number(c.greenF());
|
||||||
param = occParam + COLOR_PROP;
|
val << QString::number(c.blueF());
|
||||||
ip->setParameter(entry, param, colorStr.toLatin1().data());
|
param = occParam + GEOM::propertyName( GEOM::Color );
|
||||||
|
ip->setParameter(entry, param.toStdString(), val.join( GEOM::subSectionSeparator()).toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vType == SVTK_Viewer::Type()) {
|
if (vType == SVTK_Viewer::Type()) {
|
||||||
if (aProps.contains(OPACITY_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::Opacity ))) {
|
||||||
param = occParam + OPACITY_PROP;
|
param = occParam + GEOM::propertyName( GEOM::Opacity );
|
||||||
ip->setParameter(entry, param, QString::number(1. - aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), QString::number(1. - aProps.value(GEOM::propertyName( GEOM::Transparency )).toDouble()).toStdString());
|
||||||
}
|
}
|
||||||
} else if (vType == SOCC_Viewer::Type()) {
|
} else if (vType == SOCC_Viewer::Type()) {
|
||||||
if (aProps.contains(TRANSPARENCY_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::Transparency ))) {
|
||||||
param = occParam + TRANSPARENCY_PROP;
|
param = occParam + GEOM::propertyName( GEOM::Transparency );
|
||||||
ip->setParameter(entry, param, QString::number(aProps.value(TRANSPARENCY_PROP).toDouble()).toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Transparency )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(TOP_LEVEL_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::TopLevel ))) {
|
||||||
param = occParam + TOP_LEVEL_PROP;
|
param = occParam + GEOM::propertyName( GEOM::TopLevel );
|
||||||
Standard_Boolean val = aProps.value(TOP_LEVEL_PROP).value<Standard_Boolean>();
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::TopLevel )).toString().toStdString());
|
||||||
if (val == Standard_True)
|
|
||||||
ip->setParameter(entry, param, "1");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(ISOS_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::NbIsos ))) {
|
||||||
param = occParam + ISOS_PROP;
|
param = occParam + GEOM::propertyName( GEOM::NbIsos );
|
||||||
ip->setParameter(entry, param, aProps.value(ISOS_PROP).toString().toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::NbIsos )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(VECTOR_MODE_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::EdgesDirection ))) {
|
||||||
param = occParam + VECTOR_MODE_PROP;
|
param = occParam + GEOM::propertyName( GEOM::EdgesDirection );
|
||||||
ip->setParameter(entry, param, QString::number(aProps.value(VECTOR_MODE_PROP).toInt()).toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::EdgesDirection )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(DEFLECTION_COEFF_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::Deflection ))) {
|
||||||
param = occParam + DEFLECTION_COEFF_PROP;
|
param = occParam + GEOM::propertyName( GEOM::Deflection );
|
||||||
ip->setParameter(entry, param, QString::number(aProps.value(DEFLECTION_COEFF_PROP).toDouble()).toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Deflection )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
//Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
|
//Marker type of the vertex - ONLY for the "Vertex" and "Compound of the Vertex"
|
||||||
if (aProps.contains(MARKER_TYPE_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::PointMarker ))) {
|
||||||
param = occParam + MARKER_TYPE_PROP;
|
param = occParam + GEOM::propertyName( GEOM::PointMarker );
|
||||||
ip->setParameter(entry, param, aProps.value(MARKER_TYPE_PROP).toString().toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::PointMarker )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(MATERIAL_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::Material ))) {
|
||||||
param = occParam + MATERIAL_PROP;
|
param = occParam + GEOM::propertyName( GEOM::Material );
|
||||||
ip->setParameter(entry, param, aProps.value(MATERIAL_PROP).toString().toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::Material )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(EDGE_WIDTH_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::LineWidth ))) {
|
||||||
param = occParam + EDGE_WIDTH_PROP;
|
param = occParam + GEOM::propertyName( GEOM::LineWidth );
|
||||||
ip->setParameter(entry, param, aProps.value(EDGE_WIDTH_PROP).toString().toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::LineWidth )).toString().toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aProps.contains(ISOS_WIDTH_PROP)) {
|
if (aProps.contains(GEOM::propertyName( GEOM::IsosWidth ))) {
|
||||||
param = occParam + ISOS_WIDTH_PROP;
|
param = occParam + GEOM::propertyName( GEOM::IsosWidth );
|
||||||
ip->setParameter(entry, param, aProps.value(ISOS_WIDTH_PROP).toString().toLatin1().data());
|
ip->setParameter(entry, param.toStdString(), aProps.value(GEOM::propertyName( GEOM::IsosWidth )).toString().toStdString());
|
||||||
}
|
}
|
||||||
} // object iterator
|
} // object iterator
|
||||||
} // for (views)
|
} // for (views)
|
||||||
@ -2222,7 +2221,7 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
|||||||
{
|
{
|
||||||
// visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
|
// visual parameters are stored in strings as follows: ViewerType_ViewIndex_ParamName.
|
||||||
// '_' is used as separator and should not be used in viewer type or parameter names.
|
// '_' is used as separator and should not be used in viewer type or parameter names.
|
||||||
QStringList lst = QString((*namesIt).c_str()).split(NAME_SEPARATOR, QString::SkipEmptyParts);
|
QStringList lst = QString((*namesIt).c_str()).split( GEOM::sectionSeparator(), QString::SkipEmptyParts);
|
||||||
if (lst.size() != 3)
|
if (lst.size() != 3)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -2240,36 +2239,36 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString val((*valuesIt).c_str());
|
QString val((*valuesIt).c_str());
|
||||||
if (paramNameStr == VISIBILITY_PROP) {
|
if (paramNameStr == GEOM::propertyName( GEOM::Visibility )) {
|
||||||
aListOfMap[viewIndex].insert(VISIBILITY_PROP, val == "On" ? 1 : 0);
|
aListOfMap[viewIndex].insert(GEOM::propertyName( GEOM::Visibility ), val == "On");
|
||||||
} else if (paramNameStr == OPACITY_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::Opacity )) {
|
||||||
aListOfMap[viewIndex].insert(TRANSPARENCY_PROP, 1. - val.toDouble());
|
aListOfMap[viewIndex].insert(GEOM::propertyName( GEOM::Transparency ), 1. - val.toDouble());
|
||||||
} else if (paramNameStr == TRANSPARENCY_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::Transparency )) {
|
||||||
aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val.toDouble() );
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Transparency ), val.toDouble() );
|
||||||
} else if (paramNameStr == TOP_LEVEL_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::TopLevel )) {
|
||||||
aListOfMap[viewIndex].insert( TRANSPARENCY_PROP, val == "1" ? Standard_True : Standard_False );
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::TopLevel ), val.toInt() ? Standard_True : Standard_False );
|
||||||
} else if (paramNameStr == DISPLAY_MODE_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::DisplayMode )) {
|
||||||
aListOfMap[viewIndex].insert( DISPLAY_MODE_PROP, val.toInt());
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::DisplayMode ), val.toInt());
|
||||||
} else if (paramNameStr == ISOS_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::NbIsos )) {
|
||||||
aListOfMap[viewIndex].insert( ISOS_PROP, val);
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::NbIsos ), val);
|
||||||
} else if (paramNameStr == COLOR_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::Color )) {
|
||||||
QStringList rgb = val.split(DIGIT_SEPARATOR);
|
QStringList rgb = val.split(GEOM::subSectionSeparator());
|
||||||
if (rgb.count() == 3) {
|
if (rgb.count() == 3) {
|
||||||
QColor c(int(rgb[0].toDouble()*255), int(rgb[1].toDouble()*255), int(rgb[2].toDouble()*255));
|
QColor c = QColor::fromRgbF(rgb[0].toDouble(), rgb[1].toDouble(), rgb[2].toDouble());
|
||||||
aListOfMap[viewIndex].insert( COLOR_PROP, c);
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Color ), c);
|
||||||
}
|
}
|
||||||
} else if (paramNameStr == VECTOR_MODE_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::EdgesDirection )) {
|
||||||
aListOfMap[viewIndex].insert( VECTOR_MODE_PROP, val.toInt());
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::EdgesDirection ), val.toInt());
|
||||||
} else if (paramNameStr == DEFLECTION_COEFF_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::Deflection )) {
|
||||||
aListOfMap[viewIndex].insert( DEFLECTION_COEFF_PROP, val.toDouble());
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Deflection ), val.toDouble());
|
||||||
} else if (paramNameStr == MARKER_TYPE_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::PointMarker )) {
|
||||||
aListOfMap[viewIndex].insert( MARKER_TYPE_PROP, val);
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::PointMarker ), val);
|
||||||
} else if (paramNameStr == MATERIAL_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::Material )) {
|
||||||
aListOfMap[viewIndex].insert( MATERIAL_PROP, val);
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::Material ), val);
|
||||||
} else if (paramNameStr == EDGE_WIDTH_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::LineWidth )) {
|
||||||
aListOfMap[viewIndex].insert( EDGE_WIDTH_PROP, val);
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::LineWidth ), val.toInt());
|
||||||
} else if (paramNameStr == ISOS_WIDTH_PROP) {
|
} else if (paramNameStr == GEOM::propertyName( GEOM::IsosWidth )) {
|
||||||
aListOfMap[viewIndex].insert( ISOS_WIDTH_PROP, val);
|
aListOfMap[viewIndex].insert( GEOM::propertyName( GEOM::IsosWidth ), val.toInt());
|
||||||
}
|
}
|
||||||
} // for names/parameters iterator
|
} // for names/parameters iterator
|
||||||
|
|
||||||
@ -2280,7 +2279,7 @@ void GeometryGUI::restoreVisualParameters (int savePoint)
|
|||||||
appStudy->setObjectPropMap(index, entry, aListOfMap[index]);
|
appStudy->setObjectPropMap(index, entry, aListOfMap[index]);
|
||||||
|
|
||||||
//Get Visibility property of the current PropMap
|
//Get Visibility property of the current PropMap
|
||||||
if (aListOfMap[index].value(VISIBILITY_PROP) == 1) {
|
if (aListOfMap[index].value(GEOM::propertyName( GEOM::Visibility )) == 1) {
|
||||||
SUIT_ViewManager* vman = lst.at(index);
|
SUIT_ViewManager* vman = lst.at(index);
|
||||||
SUIT_ViewModel* vmodel = vman->getViewModel();
|
SUIT_ViewModel* vmodel = vman->getViewModel();
|
||||||
displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
|
displayer()->Display(entry, true, dynamic_cast<SALOME_View*>(vmodel));
|
||||||
|
@ -301,8 +301,8 @@ void GEOMToolsGUI::SetColor( const QString& entry, const QColor& color, bool upd
|
|||||||
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
||||||
if ( !window ) return;
|
if ( !window ) return;
|
||||||
|
|
||||||
bool isOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
|
bool isOCC = window->getViewManager()->getType() == OCCViewer_Viewer::Type();
|
||||||
bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
|
bool isVTK = window->getViewManager()->getType() == SVTK_Viewer::Type();
|
||||||
|
|
||||||
// get view id
|
// get view id
|
||||||
int mgrId = window->getViewManager()->getGlobalId();
|
int mgrId = window->getViewManager()->getGlobalId();
|
||||||
@ -357,7 +357,7 @@ void GEOMToolsGUI::OnColor()
|
|||||||
bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
|
bool isVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
|
||||||
|
|
||||||
// get view id
|
// get view id
|
||||||
int mgrId = window->getViewManager()->getGlobalId();
|
int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
|
||||||
|
|
||||||
if ( isVTK ) {
|
if ( isVTK ) {
|
||||||
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
|
SVTK_ViewWindow* vtkVW = dynamic_cast<SVTK_ViewWindow*>( window );
|
||||||
@ -366,7 +366,7 @@ void GEOMToolsGUI::OnColor()
|
|||||||
// get initial color (use first object from selection)
|
// get initial color (use first object from selection)
|
||||||
SVTK_View* aView = vtkVW->getView();
|
SVTK_View* aView = vtkVW->getView();
|
||||||
QColor color = aView->GetColor( selected.First() );
|
QColor color = aView->GetColor( selected.First() );
|
||||||
QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
|
QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color );
|
||||||
|
|
||||||
// show Choose Color dialog box
|
// show Choose Color dialog box
|
||||||
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
|
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
|
||||||
@ -390,7 +390,7 @@ void GEOMToolsGUI::OnColor()
|
|||||||
QColor color = QColor((int)( aColor.Red() * 255.0 ),
|
QColor color = QColor((int)( aColor.Red() * 255.0 ),
|
||||||
(int)( aColor.Green() * 255.0 ),
|
(int)( aColor.Green() * 255.0 ),
|
||||||
(int)( aColor.Blue() * 255.0 ));
|
(int)( aColor.Blue() * 255.0 ));
|
||||||
QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), COLOR_PROP, color );
|
QVariant v = appStudy->getObjectProperty( mgrId, selected.First()->getEntry(), GEOM::propertyName( GEOM::Color ), color );
|
||||||
|
|
||||||
// show Choose Color dialog box
|
// show Choose Color dialog box
|
||||||
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
|
color = QColorDialog::getColor( v.value<QColor>(), app->desktop() );
|
||||||
@ -422,14 +422,14 @@ void GEOMToolsGUI::setVtkColor( SalomeApp_Study* study, // s
|
|||||||
{
|
{
|
||||||
// get material property
|
// get material property
|
||||||
QString matProp;
|
QString matProp;
|
||||||
matProp = study->getObjectProperty( mgrId, IO->getEntry(), MATERIAL_PROP, matProp ).toString();
|
matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString();
|
||||||
Material_Model material;
|
Material_Model material;
|
||||||
material.fromProperties( matProp );
|
material.fromProperties( matProp );
|
||||||
|
|
||||||
// change color only for shapes with not physical type of material
|
// change color only for shapes with not physical type of material
|
||||||
if ( !material.isPhysical() ) {
|
if ( !material.isPhysical() ) {
|
||||||
view->SetColor( IO, color );
|
view->SetColor( IO, color );
|
||||||
study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
|
study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color );
|
||||||
}
|
}
|
||||||
|
|
||||||
// store color to GEOM_Object
|
// store color to GEOM_Object
|
||||||
@ -462,7 +462,7 @@ void GEOMToolsGUI::setOccColor( SalomeApp_Study* study, // s
|
|||||||
|
|
||||||
// get material property
|
// get material property
|
||||||
QString matProp;
|
QString matProp;
|
||||||
matProp = study->getObjectProperty( mgrId, IO->getEntry(), MATERIAL_PROP, matProp ).toString();
|
matProp = study->getObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Material ), matProp ).toString();
|
||||||
Material_Model material;
|
Material_Model material;
|
||||||
material.fromProperties( matProp );
|
material.fromProperties( matProp );
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ void GEOMToolsGUI::setOccColor( SalomeApp_Study* study, // s
|
|||||||
|
|
||||||
io->Redisplay( Standard_True );
|
io->Redisplay( Standard_True );
|
||||||
|
|
||||||
study->setObjectProperty( mgrId, IO->getEntry(), COLOR_PROP, color );
|
study->setObjectProperty( mgrId, IO->getEntry(), GEOM::propertyName( GEOM::Color ), color );
|
||||||
}
|
}
|
||||||
|
|
||||||
// store color to GEOM_Object
|
// store color to GEOM_Object
|
||||||
@ -664,6 +664,7 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
|||||||
|
|
||||||
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
||||||
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
||||||
|
int aMgrId = window->getViewManager()->getGlobalId();
|
||||||
|
|
||||||
ic->InitCurrent();
|
ic->InitCurrent();
|
||||||
if ( ic->MoreCurrent() ) {
|
if ( ic->MoreCurrent() ) {
|
||||||
@ -705,12 +706,11 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(; ic->MoreCurrent(); ic->NextCurrent()) {
|
for(; ic->MoreCurrent(); ic->NextCurrent()) {
|
||||||
int aMgrId = window->getViewManager()->getGlobalId();
|
|
||||||
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||||
|
|
||||||
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
|
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
|
||||||
|
|
||||||
QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP , QVariant() );
|
QVariant v = aStudy->getObjectProperty( aMgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ) , QVariant() );
|
||||||
|
|
||||||
int width = v.isValid() ? v.toInt() : 1;
|
int width = v.isValid() ? v.toInt() : 1;
|
||||||
|
|
||||||
@ -722,8 +722,8 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
|||||||
ic->SetLocalAttributes(CurObject, CurDrawer);
|
ic->SetLocalAttributes(CurObject, CurDrawer);
|
||||||
ic->Redisplay(CurObject);
|
ic->Redisplay(CurObject);
|
||||||
|
|
||||||
QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
|
QString anIsos = QString("%1%2%3").arg(newNbUIso).arg(GEOM::subSectionSeparator()).arg(newNbVIso);
|
||||||
aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_PROP, anIsos);
|
aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GeometryGUI::Modified();
|
GeometryGUI::Modified();
|
||||||
@ -748,6 +748,8 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
|||||||
if ( !vtkVW )
|
if ( !vtkVW )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int aMgrId = window->getViewManager()->getGlobalId();
|
||||||
|
|
||||||
SALOME_View* view = GEOM_Displayer::GetActiveView();
|
SALOME_View* view = GEOM_Displayer::GetActiveView();
|
||||||
|
|
||||||
vtkActorCollection* aCollection = vtkActorCollection::New();
|
vtkActorCollection* aCollection = vtkActorCollection::New();
|
||||||
@ -817,9 +819,8 @@ void GEOMToolsGUI::OnNbIsos( ActionType actionType )
|
|||||||
anActor->SetNbIsos(aIsos);
|
anActor->SetNbIsos(aIsos);
|
||||||
anActor->StoreIsoNumbers();
|
anActor->StoreIsoNumbers();
|
||||||
|
|
||||||
QString anIsos("%1%2%3");anIsos = anIsos.arg(newNbUIso);anIsos = anIsos.arg(DIGIT_SEPARATOR);anIsos = anIsos.arg(newNbVIso);
|
QString anIsos = QString("%1%2%3").arg(newNbUIso).arg(GEOM::subSectionSeparator()).arg(newNbVIso);
|
||||||
int aMgrId = window->getViewManager()->getGlobalId();
|
aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::NbIsos ), anIsos);
|
||||||
aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_PROP, anIsos);
|
|
||||||
}
|
}
|
||||||
anAct = aCollection->GetNextActor();
|
anAct = aCollection->GetNextActor();
|
||||||
}
|
}
|
||||||
@ -836,7 +837,7 @@ void GEOMToolsGUI::OnDeflection()
|
|||||||
|
|
||||||
bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
|
bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
|
||||||
bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
|
bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
|
||||||
int mgrId = window->getViewManager()->getGlobalId();
|
int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
|
||||||
|
|
||||||
if (isOCC) { // if is OCCViewer
|
if (isOCC) { // if is OCCViewer
|
||||||
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
|
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
|
||||||
@ -866,7 +867,7 @@ void GEOMToolsGUI::OnDeflection()
|
|||||||
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||||
ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True);
|
ic->SetDeviationCoefficient(CurObject, aNewDC, Standard_True);
|
||||||
ic->Redisplay(CurObject);
|
ic->Redisplay(CurObject);
|
||||||
appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aNewDC);
|
appStudy->setObjectProperty(mgrId,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aNewDC);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -935,7 +936,7 @@ void GEOMToolsGUI::OnDeflection()
|
|||||||
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
|
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
|
||||||
// There are no casting to needed actor.
|
// There are no casting to needed actor.
|
||||||
anActor->SetDeflection(aDC);
|
anActor->SetDeflection(aDC);
|
||||||
appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), DEFLECTION_COEFF_PROP, aDC);
|
appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::Deflection ), aDC);
|
||||||
}
|
}
|
||||||
anAct = aCollection->GetNextActor();
|
anAct = aCollection->GetNextActor();
|
||||||
}
|
}
|
||||||
@ -1103,7 +1104,7 @@ void GEOMToolsGUI::OnEdgeWidth()
|
|||||||
|
|
||||||
bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
|
bool isOCC = (window && window->getViewManager()->getType() == OCCViewer_Viewer::Type());
|
||||||
bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
|
bool isVTK = (window && window->getViewManager()->getType() == SVTK_Viewer::Type());
|
||||||
int mgrId = window->getViewManager()->getGlobalId();
|
int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
|
||||||
|
|
||||||
if (isOCC) { // if is OCCViewer
|
if (isOCC) { // if is OCCViewer
|
||||||
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
|
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>(window->getViewManager()->getViewModel());
|
||||||
@ -1136,7 +1137,7 @@ void GEOMToolsGUI::OnEdgeWidth()
|
|||||||
ic->Redisplay(cur);
|
ic->Redisplay(cur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), EDGE_WIDTH_PROP, aNewWidth);
|
appStudy->setObjectProperty(mgrId, CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aNewWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1205,7 +1206,7 @@ void GEOMToolsGUI::OnEdgeWidth()
|
|||||||
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
|
if (GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
|
||||||
// There are no casting to needed actor.
|
// There are no casting to needed actor.
|
||||||
anActor->SetWidth(aWidth);
|
anActor->SetWidth(aWidth);
|
||||||
appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), EDGE_WIDTH_PROP, aWidth);
|
appStudy->setObjectProperty(mgrId, anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::LineWidth ), aWidth);
|
||||||
}
|
}
|
||||||
anAct = aCollection->GetNextActor();
|
anAct = aCollection->GetNextActor();
|
||||||
}
|
}
|
||||||
@ -1228,6 +1229,7 @@ void GEOMToolsGUI::OnIsosWidth() {
|
|||||||
|
|
||||||
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
||||||
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
||||||
|
int aMgrId = window->getViewManager()->getGlobalId();
|
||||||
|
|
||||||
ic->InitCurrent();
|
ic->InitCurrent();
|
||||||
if ( ic->MoreCurrent() ) {
|
if ( ic->MoreCurrent() ) {
|
||||||
@ -1256,7 +1258,6 @@ void GEOMToolsGUI::OnIsosWidth() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for(; ic->MoreCurrent(); ic->NextCurrent()) {
|
for(; ic->MoreCurrent(); ic->NextCurrent()) {
|
||||||
int aMgrId = window->getViewManager()->getGlobalId();
|
|
||||||
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||||
|
|
||||||
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
|
Handle(AIS_Drawer) CurDrawer = CurObject->Attributes();
|
||||||
@ -1266,7 +1267,7 @@ void GEOMToolsGUI::OnIsosWidth() {
|
|||||||
|
|
||||||
ic->Redisplay(CurObject);
|
ic->Redisplay(CurObject);
|
||||||
|
|
||||||
aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth);
|
aStudy->setObjectProperty(aMgrId ,CurObject->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth);
|
||||||
}
|
}
|
||||||
GeometryGUI::Modified();
|
GeometryGUI::Modified();
|
||||||
}
|
}
|
||||||
@ -1291,6 +1292,8 @@ void GEOMToolsGUI::OnIsosWidth() {
|
|||||||
if ( !vtkVW )
|
if ( !vtkVW )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
int aMgrId = window->getViewManager()->getGlobalId();
|
||||||
|
|
||||||
SALOME_View* view = GEOM_Displayer::GetActiveView();
|
SALOME_View* view = GEOM_Displayer::GetActiveView();
|
||||||
|
|
||||||
vtkActorCollection* aCollection = vtkActorCollection::New();
|
vtkActorCollection* aCollection = vtkActorCollection::New();
|
||||||
@ -1335,8 +1338,7 @@ void GEOMToolsGUI::OnIsosWidth() {
|
|||||||
if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
|
if(GEOM_Actor* anActor = GEOM_Actor::SafeDownCast(anAct)) {
|
||||||
// There are no casting to needed actor.
|
// There are no casting to needed actor.
|
||||||
anActor->SetIsosWidth(aWidth);
|
anActor->SetIsosWidth(aWidth);
|
||||||
int aMgrId = window->getViewManager()->getGlobalId();
|
aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), GEOM::propertyName( GEOM::IsosWidth ), aWidth);
|
||||||
aStudy->setObjectProperty(aMgrId ,anActor->getIO()->getEntry(), ISOS_WIDTH_PROP, aWidth);
|
|
||||||
}
|
}
|
||||||
anAct = aCollection->GetNextActor();
|
anAct = aCollection->GetNextActor();
|
||||||
}
|
}
|
||||||
@ -1387,15 +1389,15 @@ void GEOMToolsGUI::OnBringToFront() {
|
|||||||
if ( isOCC ) {
|
if ( isOCC ) {
|
||||||
GEOMBase* gb = new GEOMBase();
|
GEOMBase* gb = new GEOMBase();
|
||||||
Handle(GEOM_AISShape) aisShape;
|
Handle(GEOM_AISShape) aisShape;
|
||||||
|
int aMgrId = window->getViewManager()->getGlobalId();
|
||||||
|
|
||||||
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
|
Handle(AIS_InteractiveContext) ic = vm->getAISContext();
|
||||||
SALOME_ListIO anIOlst;
|
SALOME_ListIO anIOlst;
|
||||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||||
aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true );
|
aisShape = gb->ConvertIOinGEOMAISShape( It.Value(), true );
|
||||||
if ( !aisShape.IsNull() ) {
|
if ( !aisShape.IsNull() ) {
|
||||||
|
appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), GEOM::propertyName( GEOM::TopLevel ), checked );
|
||||||
aisShape->setTopLevel(checked);
|
aisShape->setTopLevel(checked);
|
||||||
int aMgrId = window->getViewManager()->getGlobalId();
|
|
||||||
appStudy->setObjectProperty( aMgrId, aisShape->getIO()->getEntry(), TOP_LEVEL_PROP, checked );
|
|
||||||
anIOlst.Append(aisShape->getIO());
|
anIOlst.Append(aisShape->getIO());
|
||||||
}
|
}
|
||||||
} // for...
|
} // for...
|
||||||
@ -1432,6 +1434,7 @@ void GEOMToolsGUI::OnClsBringToFront() {
|
|||||||
|
|
||||||
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
OCCViewer_Viewer* vm = dynamic_cast<OCCViewer_Viewer*>( window->getViewManager()->getViewModel() );
|
||||||
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
Handle (AIS_InteractiveContext) ic = vm->getAISContext();
|
||||||
|
int aMgrId = window->getViewManager()->getGlobalId();
|
||||||
|
|
||||||
SALOME_ListIO anIOlst;
|
SALOME_ListIO anIOlst;
|
||||||
AIS_ListOfInteractive aList;
|
AIS_ListOfInteractive aList;
|
||||||
@ -1443,10 +1446,8 @@ void GEOMToolsGUI::OnClsBringToFront() {
|
|||||||
if(CurObject.IsNull())
|
if(CurObject.IsNull())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), GEOM::propertyName( GEOM::TopLevel ), Standard_False );
|
||||||
CurObject->setTopLevel(Standard_False);
|
CurObject->setTopLevel(Standard_False);
|
||||||
|
|
||||||
int aMgrId = window->getViewManager()->getGlobalId();
|
|
||||||
appStudy->setObjectProperty( aMgrId, QString(CurObject->getIO()->getEntry()), TOP_LEVEL_PROP, Standard_False );
|
|
||||||
anIOlst.Append(CurObject->getIO());
|
anIOlst.Append(CurObject->getIO());
|
||||||
}
|
}
|
||||||
disp->Redisplay(anIOlst);
|
disp->Redisplay(anIOlst);
|
||||||
@ -1476,7 +1477,7 @@ void GEOMToolsGUI::OnSetMaterial( const QVariant& theParam )
|
|||||||
if ( selected.IsEmpty() )
|
if ( selected.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
SUIT_ViewWindow* window = app->desktop()->activeWindow();
|
||||||
int mgrId = window->getViewManager()->getGlobalId();
|
int mgrId = window ? window->getViewManager()->getGlobalId() : -1;
|
||||||
|
|
||||||
// convert needed material properties to the string representation
|
// convert needed material properties to the string representation
|
||||||
Material_Model aModel;
|
Material_Model aModel;
|
||||||
@ -1501,7 +1502,7 @@ void GEOMToolsGUI::OnSetMaterial( const QVariant& theParam )
|
|||||||
// set material property to the presentation
|
// set material property to the presentation
|
||||||
aView->SetMaterial( It.Value(), vtkPropF, vtkPropB );
|
aView->SetMaterial( It.Value(), vtkPropF, vtkPropB );
|
||||||
// store chosen material in the property map
|
// store chosen material in the property map
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
|
||||||
// set correct color for the non-physical material
|
// set correct color for the non-physical material
|
||||||
}
|
}
|
||||||
aView->Repaint();
|
aView->Repaint();
|
||||||
@ -1533,7 +1534,7 @@ void GEOMToolsGUI::OnSetMaterial( const QVariant& theParam )
|
|||||||
// Return to the default facing mode
|
// Return to the default facing mode
|
||||||
aisShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
aisShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
||||||
// store chosen material in the property map
|
// store chosen material in the property map
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
|
||||||
//if ( aisShape->DisplayMode() != AIS_Shaded)
|
//if ( aisShape->DisplayMode() != AIS_Shaded)
|
||||||
ic->Redisplay( aisShape, Standard_False );
|
ic->Redisplay( aisShape, Standard_False );
|
||||||
}
|
}
|
||||||
|
@ -78,7 +78,7 @@ GEOMToolsGUI_DeflectionDlg::GEOMToolsGUI_DeflectionDlg (QWidget* parent)
|
|||||||
SpinBox->setAcceptNames( false );
|
SpinBox->setAcceptNames( false );
|
||||||
SpinBox->setPrecision( aPrecision );
|
SpinBox->setPrecision( aPrecision );
|
||||||
SpinBox->setDecimals( aPrecision );
|
SpinBox->setDecimals( aPrecision );
|
||||||
SpinBox->setRange( DEFLECTION_MIN, 1.0 );
|
SpinBox->setRange( GEOM::minDeflection(), 1.0 );
|
||||||
SpinBox->setSingleStep( 1.0e-04 );
|
SpinBox->setSingleStep( 1.0e-04 );
|
||||||
// Add a hint for the user saying how to tune precision
|
// Add a hint for the user saying how to tune precision
|
||||||
QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() );
|
QString userPropName = QObject::tr( QString( "GEOM_PREF_%1" ).arg( quantity ).toLatin1().constData() );
|
||||||
|
@ -228,13 +228,13 @@ void GEOMToolsGUI_MarkerDlg::accept()
|
|||||||
anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() );
|
anObject->SetMarkerStd( getMarkerType(), getStandardMarkerScale() );
|
||||||
QString aMarker = "%1%2%3";
|
QString aMarker = "%1%2%3";
|
||||||
aMarker = aMarker.arg(getMarkerType());
|
aMarker = aMarker.arg(getMarkerType());
|
||||||
aMarker = aMarker.arg(DIGIT_SEPARATOR);
|
aMarker = aMarker.arg(GEOM::subSectionSeparator());
|
||||||
aMarker = aMarker.arg(getStandardMarkerScale());
|
aMarker = aMarker.arg(getStandardMarkerScale());
|
||||||
getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, aMarker);
|
getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),GEOM::propertyName( GEOM::PointMarker ), aMarker);
|
||||||
}
|
}
|
||||||
else if ( getCustomMarkerID() > 0 ) {
|
else if ( getCustomMarkerID() > 0 ) {
|
||||||
anObject->SetMarkerTexture( getCustomMarkerID() );
|
anObject->SetMarkerTexture( getCustomMarkerID() );
|
||||||
getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),MARKER_TYPE_PROP, QString::number(getCustomMarkerID()));
|
getStudy()->setObjectProperty(mgrId ,it.Value()->getEntry(),GEOM::propertyName( GEOM::PointMarker ), QString::number(getCustomMarkerID()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -329,10 +329,10 @@ GEOMToolsGUI_MaterialPropertiesDlg::GEOMToolsGUI_MaterialPropertiesDlg( QWidget*
|
|||||||
if ( window ) {
|
if ( window ) {
|
||||||
int mgrId = window->getViewManager()->getGlobalId();
|
int mgrId = window->getViewManager()->getGlobalId();
|
||||||
PropMap propMap = study->getObjectPropMap( mgrId, io->getEntry() );
|
PropMap propMap = study->getObjectPropMap( mgrId, io->getEntry() );
|
||||||
QString matProp = propMap.value(MATERIAL_PROP).toString();
|
QString matProp = propMap.value(GEOM::propertyName( GEOM::Material )).toString();
|
||||||
if ( !matProp.isEmpty() )
|
if ( !matProp.isEmpty() )
|
||||||
myCurrentModel.fromProperties( matProp );
|
myCurrentModel.fromProperties( matProp );
|
||||||
QColor c = propMap.value(COLOR_PROP).value<QColor>();
|
QColor c = propMap.value(GEOM::propertyName( GEOM::Color )).value<QColor>();
|
||||||
if ( c.isValid() )
|
if ( c.isValid() )
|
||||||
myColor->setColor( c );
|
myColor->setColor( c );
|
||||||
}
|
}
|
||||||
@ -500,11 +500,11 @@ void GEOMToolsGUI_MaterialPropertiesDlg::onApply()
|
|||||||
// set material property to the presentation
|
// set material property to the presentation
|
||||||
aView->SetMaterial( It.Value(), vtkPropF, vtkPropB );
|
aView->SetMaterial( It.Value(), vtkPropF, vtkPropB );
|
||||||
// store chosen material in the property map
|
// store chosen material in the property map
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
|
||||||
// set correct color for the non-physical material
|
// set correct color for the non-physical material
|
||||||
if ( !myCurrentModel.isPhysical() ) {
|
if ( !myCurrentModel.isPhysical() ) {
|
||||||
aView->SetColor( It.Value(), myColor->color() );
|
aView->SetColor( It.Value(), myColor->color() );
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() );
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Color ), myColor->color() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
aView->Repaint();
|
aView->Repaint();
|
||||||
@ -536,11 +536,11 @@ void GEOMToolsGUI_MaterialPropertiesDlg::onApply()
|
|||||||
// Return to the default facing mode
|
// Return to the default facing mode
|
||||||
aisShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
aisShape->SetCurrentFacingModel(Aspect_TOFM_BOTH_SIDE);
|
||||||
// store chosen material in the property map
|
// store chosen material in the property map
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), MATERIAL_PROP, prop );
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Material ), prop );
|
||||||
// set correct color for the non-physical material
|
// set correct color for the non-physical material
|
||||||
if ( !myCurrentModel.isPhysical() ) {
|
if ( !myCurrentModel.isPhysical() ) {
|
||||||
aisShape->SetShadingColor( SalomeApp_Tools::color( myColor->color() ) );
|
aisShape->SetShadingColor( SalomeApp_Tools::color( myColor->color() ) );
|
||||||
study->setObjectProperty( mgrId, It.Value()->getEntry(), COLOR_PROP, myColor->color() );
|
study->setObjectProperty( mgrId, It.Value()->getEntry(), GEOM::propertyName( GEOM::Color ), myColor->color() );
|
||||||
ic->RecomputePrsOnly( aisShape, Standard_False );
|
ic->RecomputePrsOnly( aisShape, Standard_False );
|
||||||
}
|
}
|
||||||
//if ( aisShape->DisplayMode() != AIS_Shaded/*aisShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges*/)
|
//if ( aisShape->DisplayMode() != AIS_Shaded/*aisShape->DisplayMode() == GEOM_AISShape::ShadingWithEdges*/)
|
||||||
|
@ -286,7 +286,7 @@ void GEOMToolsGUI_TransparencyDlg::SetTransparency()
|
|||||||
SUIT_OverrideCursor();
|
SUIT_OverrideCursor();
|
||||||
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
|
||||||
aView->SetTransparency( It.Value(), newValue );
|
aView->SetTransparency( It.Value(), newValue );
|
||||||
aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), TRANSPARENCY_PROP , newValue );
|
aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), GEOM::propertyName( GEOM::Transparency ) , newValue );
|
||||||
}
|
}
|
||||||
GeometryGUI::Modified();
|
GeometryGUI::Modified();
|
||||||
aView->Repaint();
|
aView->Repaint();
|
||||||
@ -317,7 +317,7 @@ void GEOMToolsGUI_TransparencyDlg::SetTransparency()
|
|||||||
if ( !aisShape.IsNull() ) {
|
if ( !aisShape.IsNull() ) {
|
||||||
ic->SetTransparency( aisShape, newValue, false );
|
ic->SetTransparency( aisShape, newValue, false );
|
||||||
ic->Redisplay( aisShape, Standard_False, Standard_True );
|
ic->Redisplay( aisShape, Standard_False, Standard_True );
|
||||||
aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), TRANSPARENCY_PROP , newValue );
|
aStudy->setObjectProperty( aMgrId , It.Value()->getEntry(), GEOM::propertyName( GEOM::Transparency ) , newValue );
|
||||||
}
|
}
|
||||||
} // for...
|
} // for...
|
||||||
ic->UpdateCurrentViewer();
|
ic->UpdateCurrentViewer();
|
||||||
|
@ -166,8 +166,6 @@ GEOM_AISShape::GEOM_AISShape(const TopoDS_Shape& shape,
|
|||||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
|
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(aMatAspect);
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
|
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(aMatAspect);
|
||||||
}
|
}
|
||||||
myCurrentFrontMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
|
||||||
myCurrentBackMaterial = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){
|
void GEOM_AISShape::setIO(const Handle(SALOME_InteractiveObject)& io){
|
||||||
@ -207,7 +205,7 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
|
|||||||
Handle(AIS_InteractiveContext) anIC = GetContext();
|
Handle(AIS_InteractiveContext) anIC = GetContext();
|
||||||
|
|
||||||
// StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode;
|
// StdSelect_DisplayMode d = (StdSelect_DisplayMode) aMode;
|
||||||
bool isTopLev = (isTopLevel() && topLevelDisplayMode() != TopShowAdditionalWActor);
|
bool isTopLev = isTopLevel() && switchTopLevel();
|
||||||
switch (aMode) {
|
switch (aMode) {
|
||||||
case 0://StdSelect_DM_Wireframe:
|
case 0://StdSelect_DM_Wireframe:
|
||||||
{
|
{
|
||||||
@ -317,26 +315,6 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent
|
|||||||
// aPrs->ReCompute(); // for hidden line recomputation if necessary...
|
// aPrs->ReCompute(); // for hidden line recomputation if necessary...
|
||||||
}
|
}
|
||||||
|
|
||||||
void GEOM_AISShape::SetTransparency(const Standard_Real aValue)
|
|
||||||
{
|
|
||||||
if(aValue<0.0 || aValue>1.0) return;
|
|
||||||
|
|
||||||
if(aValue<=0.05)
|
|
||||||
{
|
|
||||||
UnsetTransparency();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Graphic3d_MaterialAspect FMat = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
|
||||||
Graphic3d_MaterialAspect BMat = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
|
||||||
FMat.SetTransparency(aValue);
|
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial(FMat);
|
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial(BMat);
|
|
||||||
myCurrentFrontMaterial = FMat;
|
|
||||||
myCurrentBackMaterial = BMat;
|
|
||||||
myTransparency = aValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GEOM_AISShape::SetShadingColor(const Quantity_Color &aCol)
|
void GEOM_AISShape::SetShadingColor(const Quantity_Color &aCol)
|
||||||
{
|
{
|
||||||
myShadingColor = aCol;
|
myShadingColor = aCol;
|
||||||
@ -390,17 +368,13 @@ void GEOM_AISShape::shadingMode(const Handle(PrsMgr_PresentationManager3d)& aPre
|
|||||||
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
|
myDrawer->ShadingAspect()->Aspect()->SetDistinguishOn();
|
||||||
|
|
||||||
Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC);
|
Graphic3d_MaterialAspect aMatAspect(Graphic3d_NOM_PLASTIC);
|
||||||
aMatAspect.SetTransparency(myTransparency);
|
aMatAspect.SetTransparency(Transparency());
|
||||||
myCurrentFrontMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
Graphic3d_MaterialAspect currentFrontMaterial = myDrawer->ShadingAspect()->Aspect()->FrontMaterial();
|
||||||
myCurrentBackMaterial = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
Graphic3d_MaterialAspect currentBackMaterial = myDrawer->ShadingAspect()->Aspect()->BackMaterial();
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial( isTopLevel() ? aMatAspect : myCurrentFrontMaterial );
|
myDrawer->ShadingAspect()->Aspect()->SetFrontMaterial( isTopLevel() ? aMatAspect : currentFrontMaterial );
|
||||||
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial( isTopLevel() ? aMatAspect : myCurrentBackMaterial );
|
myDrawer->ShadingAspect()->Aspect()->SetBackMaterial ( isTopLevel() ? aMatAspect : currentBackMaterial );
|
||||||
|
|
||||||
//Handle(Graphic3d_AspectFillArea3d) a4bis = myDrawer->ShadingAspect()->Aspect();
|
if( isTopLevel() && switchTopLevel() )
|
||||||
// P->SetPrimitivesAspect(a4bis);
|
|
||||||
// G->SetGroupPrimitivesAspect(a4bis);
|
|
||||||
//a4bis->SetInteriorColor(myShadingColor);
|
|
||||||
if( isTopLevel() && topLevelDisplayMode() != TopShowAdditionalWActor )
|
|
||||||
myDrawer->ShadingAspect()->SetColor( topLevelColor() );
|
myDrawer->ShadingAspect()->SetColor( topLevelColor() );
|
||||||
else {
|
else {
|
||||||
if(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().MaterialType( Graphic3d_MATERIAL_ASPECT ))
|
if(myDrawer->ShadingAspect()->Aspect()->FrontMaterial().MaterialType( Graphic3d_MATERIAL_ASPECT ))
|
||||||
|
@ -116,7 +116,6 @@ public:
|
|||||||
void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight );
|
void highlightSubShapes(const TColStd_IndexedMapOfInteger& aIndexMap, const Standard_Boolean aHighlight );
|
||||||
~GEOM_AISShape();
|
~GEOM_AISShape();
|
||||||
|
|
||||||
void SetTransparency(const Standard_Real aValue);
|
|
||||||
void SetShadingColor(const Quantity_Color &aCol);
|
void SetShadingColor(const Quantity_Color &aCol);
|
||||||
void SetEdgesInShadingColor(const Quantity_Color &aCol);
|
void SetEdgesInShadingColor(const Quantity_Color &aCol);
|
||||||
void SetDisplayVectors(bool isShow);
|
void SetDisplayVectors(bool isShow);
|
||||||
@ -172,8 +171,6 @@ private:
|
|||||||
TCollection_AsciiString myName;
|
TCollection_AsciiString myName;
|
||||||
bool myDisplayVectors;
|
bool myDisplayVectors;
|
||||||
Standard_Boolean myTopLevel;
|
Standard_Boolean myTopLevel;
|
||||||
Graphic3d_MaterialAspect myCurrentFrontMaterial;
|
|
||||||
Graphic3d_MaterialAspect myCurrentBackMaterial;
|
|
||||||
Standard_Integer myPrevDisplayMode;
|
Standard_Integer myPrevDisplayMode;
|
||||||
|
|
||||||
static TopLevelDispMode myTopLevelDm;
|
static TopLevelDispMode myTopLevelDm;
|
||||||
|
102
src/OBJECT/GEOM_Constants.cxx
Normal file
102
src/OBJECT/GEOM_Constants.cxx
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||||
|
//
|
||||||
|
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||||
|
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2.1 of the License.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Lesser General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
|
// License along with this library; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
//
|
||||||
|
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||||
|
//
|
||||||
|
|
||||||
|
// File : GEOM_Constants.cxx
|
||||||
|
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
|
||||||
|
|
||||||
|
#include "GEOM_Constants.h"
|
||||||
|
|
||||||
|
namespace GEOM
|
||||||
|
{
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Get minimal allowed value for deflection coefficient
|
||||||
|
*/
|
||||||
|
double minDeflection()
|
||||||
|
{
|
||||||
|
return 1e-06; // DEFLECTION_MIN
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Get character used to separate parameter names
|
||||||
|
*/
|
||||||
|
QString sectionSeparator()
|
||||||
|
{
|
||||||
|
return "_"; // NAME_SEPARATOR
|
||||||
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
\brief Get character used to separate numeric parameter values (color = r:g:b)
|
||||||
|
*/
|
||||||
|
QString subSectionSeparator()
|
||||||
|
{
|
||||||
|
return ":"; // DIGIT_SEPARATOR
|
||||||
|
}
|
||||||
|
|
||||||
|
QString propertyName( Property type )
|
||||||
|
{
|
||||||
|
static const char* names[] = {
|
||||||
|
// visibility
|
||||||
|
"Visibility", // VISIBILITY_PROP
|
||||||
|
// transparency
|
||||||
|
"Transparency", // TRANSPARENCY_PROP
|
||||||
|
// display mode
|
||||||
|
"DisplayMode", // DISPLAY_MODE_PROP
|
||||||
|
// number of the iso lines (along u and v directions)
|
||||||
|
"Isos", // ISOS_PROP
|
||||||
|
// main / shading color
|
||||||
|
"Color", // COLOR_PROP
|
||||||
|
// "show edges direction" flag
|
||||||
|
"VectorMode", // VECTOR_MODE_PROP
|
||||||
|
// deflection coefficient
|
||||||
|
"DeflectionCoeff", // DEFLECTION_COEFF_PROP
|
||||||
|
// point marker data
|
||||||
|
"MarkerType", // MARKER_TYPE_PROP
|
||||||
|
// material
|
||||||
|
"Material", // MATERIAL_PROP
|
||||||
|
// general line width
|
||||||
|
"EdgeWidth", // EDGE_WIDTH_PROP
|
||||||
|
// isos width
|
||||||
|
"IsosWidth", // ISOS_WIDTH_PROP
|
||||||
|
// top-level flag
|
||||||
|
"TopLevelFlag", // TOP_LEVEL_PROP
|
||||||
|
// opacity
|
||||||
|
"Opacity", // OPACITY_PROP
|
||||||
|
// shading color
|
||||||
|
"ShadingColor", // -
|
||||||
|
// wireframe color
|
||||||
|
"WireframeColor", // -
|
||||||
|
// standalone edges color
|
||||||
|
"LineColor", // -
|
||||||
|
// free boundaries color
|
||||||
|
"FreeBndColor", // -
|
||||||
|
// points color
|
||||||
|
"PointColor", // -
|
||||||
|
// isos color
|
||||||
|
"IsosColor", // -
|
||||||
|
// outlines color
|
||||||
|
"OutlineColor", // -
|
||||||
|
};
|
||||||
|
return ( type >= GEOM::Visibility && type <= GEOM::LastProperty ) ? names[type] : QString();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace GEOM
|
@ -21,31 +21,47 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
// File : GEOM_Constants.h
|
// File : GEOM_Constants.h
|
||||||
// Author : Margarita KARPUNINA
|
// Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
|
||||||
// Module : GEOM
|
|
||||||
//
|
|
||||||
#ifndef GEOM_CONSTANTS_H
|
#ifndef GEOM_CONSTANTS_H
|
||||||
#define GEOM_CONSTANTS_H
|
#define GEOM_CONSTANTS_H
|
||||||
|
|
||||||
// minimum allowed value for deflection coefficient
|
#include <QString>
|
||||||
#define DEFLECTION_MIN 1e-06
|
|
||||||
|
|
||||||
//Define separators
|
namespace GEOM
|
||||||
#define NAME_SEPARATOR '_' // character used to separate parameter names
|
{
|
||||||
#define DIGIT_SEPARATOR ':' // character used to separate numeric parameter values (color = r:g:b)
|
enum Property {
|
||||||
|
Visibility,
|
||||||
|
Transparency,
|
||||||
|
DisplayMode,
|
||||||
|
NbIsos,
|
||||||
|
Color,
|
||||||
|
EdgesDirection,
|
||||||
|
Deflection,
|
||||||
|
PointMarker,
|
||||||
|
Material,
|
||||||
|
LineWidth,
|
||||||
|
IsosWidth,
|
||||||
|
TopLevel,
|
||||||
|
LastStudyProperty = TopLevel,
|
||||||
|
Opacity,
|
||||||
|
ShadingColor,
|
||||||
|
WireframeColor,
|
||||||
|
LineColor,
|
||||||
|
FreeBndColor,
|
||||||
|
PointColor,
|
||||||
|
IsosColor,
|
||||||
|
OutlineColor,
|
||||||
|
LastProperty = OutlineColor,
|
||||||
|
};
|
||||||
|
|
||||||
|
double minDeflection();
|
||||||
|
|
||||||
|
QString sectionSeparator();
|
||||||
|
QString subSectionSeparator();
|
||||||
|
|
||||||
|
QString propertyName( Property );
|
||||||
|
}
|
||||||
|
|
||||||
#define VISIBILITY_PROP "Visibility" //Object visibility property
|
|
||||||
#define OPACITY_PROP "Opacity" //Object opacity property
|
|
||||||
#define TRANSPARENCY_PROP "Transparency" //Object transparency property
|
|
||||||
#define DISPLAY_MODE_PROP "DisplayMode" //Object display mode property
|
|
||||||
#define ISOS_PROP "Isos" //Number of the Isos property of the object
|
|
||||||
#define COLOR_PROP "Color" //Color of the object
|
|
||||||
#define VECTOR_MODE_PROP "VectorMode" //Vector mode property
|
|
||||||
#define DEFLECTION_COEFF_PROP "DeflectionCoeff" //Deflection coeff property
|
|
||||||
#define MARKER_TYPE_PROP "MarkerType" //Marker type property
|
|
||||||
#define MATERIAL_PROP "Material" //Object material property
|
|
||||||
#define EDGE_WIDTH_PROP "EdgeWidth" //Width of the edge
|
|
||||||
#define ISOS_WIDTH_PROP "IsosWidth" //Width of the iso-lines
|
|
||||||
#define TOP_LEVEL_PROP "TopLevelFlag" //Top level flag
|
|
||||||
|
|
||||||
#endif //GEOM_CONSTANTS_H
|
#endif //GEOM_CONSTANTS_H
|
||||||
|
@ -56,6 +56,10 @@ GEOM_TopWireframeShape::GEOM_TopWireframeShape(const TopoDS_Shape& shape)
|
|||||||
SetColor(GEOM_AISShape::topLevelColor());
|
SetColor(GEOM_AISShape::topLevelColor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GEOM_TopWireframeShape::~GEOM_TopWireframeShape()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
Handle(SALOME_InteractiveObject) GEOM_TopWireframeShape::getIO(){
|
Handle(SALOME_InteractiveObject) GEOM_TopWireframeShape::getIO(){
|
||||||
Handle(SALOME_InteractiveObject) IO;
|
Handle(SALOME_InteractiveObject) IO;
|
||||||
if ( !GetOwner().IsNull() )
|
if ( !GetOwner().IsNull() )
|
||||||
|
@ -30,8 +30,6 @@
|
|||||||
#include <Standard_TypeMismatch.hxx>
|
#include <Standard_TypeMismatch.hxx>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GEOM_TopWireframeShape::~GEOM_TopWireframeShape() {}
|
|
||||||
|
|
||||||
Standard_EXPORT Handle_Standard_Type& GEOM_TopWireframeShape_Type_()
|
Standard_EXPORT Handle_Standard_Type& GEOM_TopWireframeShape_Type_()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -65,7 +65,8 @@ dist_libGEOMObject_la_SOURCES = \
|
|||||||
GEOM_VTKPropertyMaterial.cxx \
|
GEOM_VTKPropertyMaterial.cxx \
|
||||||
GEOM_AISVector.cxx \
|
GEOM_AISVector.cxx \
|
||||||
GEOM_PainterPolyDataMapper.cxx \
|
GEOM_PainterPolyDataMapper.cxx \
|
||||||
GEOM_DeviceActor.cxx
|
GEOM_DeviceActor.cxx \
|
||||||
|
GEOM_Constants.cxx
|
||||||
|
|
||||||
|
|
||||||
libGEOMObject_la_CPPFLAGS = \
|
libGEOMObject_la_CPPFLAGS = \
|
||||||
|
Loading…
Reference in New Issue
Block a user