Additional fix for issue 0020836.

This commit is contained in:
ouv 2010-06-22 11:12:50 +00:00
parent 784f3578ce
commit ad2e1f88fa
8 changed files with 81 additions and 34 deletions

View File

@ -109,6 +109,7 @@ multitranslationdouble.png \
multitranslationsimple.png \ multitranslationsimple.png \
normale.png \ normale.png \
offset.png \ offset.png \
origin_and_vectors.png \
partition.png \ partition.png \
partitionkeep.png \ partitionkeep.png \
partitionplane.png \ partitionplane.png \

View File

@ -49,8 +49,8 @@
<parameter name="isos_color" value="200, 200, 200" /> <parameter name="isos_color" value="200, 200, 200" />
<parameter name="type_of_marker" value="1" /> <parameter name="type_of_marker" value="1" />
<parameter name="deflection_coeff" value="0.001" /> <parameter name="deflection_coeff" value="0.001" />
<parameter name="auto_created_objects" value="false" /> <parameter name="auto_create_base_objects" value="false" />
<parameter name="auto_vectors_length" value="1" /> <parameter name="base_vectors_length" value="1" />
<parameter name="marker_scale" value="1" /> <parameter name="marker_scale" value="1" />
<!-- Input field precisions --> <!-- Input field precisions -->
<parameter name="def_precision" value="3" /> <parameter name="def_precision" value="3" />

BIN
resources/origin_and_vectors.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -905,6 +905,10 @@
<source>ICO_OFFSET</source> <source>ICO_OFFSET</source>
<translation>offset.png</translation> <translation>offset.png</translation>
</message> </message>
<message>
<source>ICO_ORIGIN_AND_VECTORS</source>
<translation>origin_and_vectors.png</translation>
</message>
<message> <message>
<source>ICO_PARTITION</source> <source>ICO_PARTITION</source>
<translation>partition.png</translation> <translation>partition.png</translation>

View File

@ -2359,6 +2359,10 @@ Please, select face, shell or solid and try again</translation>
<source>MEN_OPERATIONS</source> <source>MEN_OPERATIONS</source>
<translation>Operations</translation> <translation>Operations</translation>
</message> </message>
<message>
<source>MEN_ORIGIN_AND_VECTORS</source>
<translation>Origin and Base Vectors</translation>
</message>
<message> <message>
<source>MEN_PARTITION</source> <source>MEN_PARTITION</source>
<translation>Partition</translation> <translation>Partition</translation>
@ -2647,6 +2651,10 @@ Please, select face, shell or solid and try again</translation>
<source>GEOM_PREF_param_tol_precision</source> <source>GEOM_PREF_param_tol_precision</source>
<translation>Parametric tolerance precision</translation> <translation>Parametric tolerance precision</translation>
</message> </message>
<message>
<source>PREF_AUTO_CREATE</source>
<translation>Auto create</translation>
</message>
<message> <message>
<source>PREF_DISPLAY_MODE</source> <source>PREF_DISPLAY_MODE</source>
<translation>Default display mode</translation> <translation>Default display mode</translation>
@ -2656,8 +2664,8 @@ Please, select face, shell or solid and try again</translation>
<translation>Color of free boundaries</translation> <translation>Color of free boundaries</translation>
</message> </message>
<message> <message>
<source>PREF_GROUP_AUTO_CREATED_OBJECTS</source> <source>PREF_GROUP_ORIGIN_AND_BASE_VECTORS</source>
<translation>Automatically created objects</translation> <translation>Origin and base vectors</translation>
</message> </message>
<message> <message>
<source>PREF_GROUP_GENERAL</source> <source>PREF_GROUP_GENERAL</source>
@ -2708,8 +2716,8 @@ Please, select face, shell or solid and try again</translation>
<translation>Type</translation> <translation>Type</translation>
</message> </message>
<message> <message>
<source>PREF_VECTORS_LENGTH</source> <source>PREF_BASE_VECTORS_LENGTH</source>
<translation>Length of vectors</translation> <translation>Length of base vectors</translation>
</message> </message>
<message> <message>
<source>PREF_WIREFRAME_COLOR</source> <source>PREF_WIREFRAME_COLOR</source>
@ -2983,6 +2991,10 @@ Please, select face, shell or solid and try again</translation>
<source>STB_OFFSET</source> <source>STB_OFFSET</source>
<translation>Offset surface</translation> <translation>Offset surface</translation>
</message> </message>
<message>
<source>STB_ORIGIN_AND_VECTORS</source>
<translation>Create an origin and base Vectors</translation>
</message>
<message> <message>
<source>STB_PARTITION</source> <source>STB_PARTITION</source>
<translation>Make a partition</translation> <translation>Make a partition</translation>
@ -3503,6 +3515,10 @@ Please, select face, shell or solid and try again</translation>
<source>TOP_OFFSET</source> <source>TOP_OFFSET</source>
<translation>Offset surface</translation> <translation>Offset surface</translation>
</message> </message>
<message>
<source>TOP_ORIGIN_AND_VECTORS</source>
<translation>Create an origin and base Vectors</translation>
</message>
<message> <message>
<source>TOP_PARTITION</source> <source>TOP_PARTITION</source>
<translation>Partition</translation> <translation>Partition</translation>

View File

@ -360,6 +360,9 @@ void GeometryGUI::OnGUIEvent( int id )
QString libName; QString libName;
// find corresponding GUI library // find corresponding GUI library
switch ( id ) { switch ( id ) {
case GEOMOp::OpOriginAndVectors: // MENU BASIC - ORIGIN AND BASE VECTORS
createOriginAndBaseVectors(); // internal operation
return;
case GEOMOp::OpImport: // MENU FILE - IMPORT case GEOMOp::OpImport: // MENU FILE - IMPORT
case GEOMOp::OpExport: // MENU FILE - EXPORT case GEOMOp::OpExport: // MENU FILE - EXPORT
case GEOMOp::OpSelectVertex: // POPUP MENU - SELECT ONLY - VERTEX case GEOMOp::OpSelectVertex: // POPUP MENU - SELECT ONLY - VERTEX
@ -404,7 +407,7 @@ void GeometryGUI::OnGUIEvent( int id )
case GEOMOp::OpVector: // MENU BASIC - VECTOR case GEOMOp::OpVector: // MENU BASIC - VECTOR
case GEOMOp::OpPlane: // MENU BASIC - PLANE case GEOMOp::OpPlane: // MENU BASIC - PLANE
case GEOMOp::OpCurve: // MENU BASIC - CURVE case GEOMOp::OpCurve: // MENU BASIC - CURVE
case GEOMOp::OpLCS: // MENU BASIC - REPAIR case GEOMOp::OpLCS: // MENU BASIC - LOCAL COORDINATE SYSTEM
libName = "BasicGUI"; libName = "BasicGUI";
break; break;
case GEOMOp::OpBox: // MENU PRIMITIVE - BOX case GEOMOp::OpBox: // MENU PRIMITIVE - BOX
@ -585,7 +588,36 @@ void GeometryGUI::createGeomAction( const int id, const QString& label, const QS
this, SLOT( OnGUIEvent() ) ); this, SLOT( OnGUIEvent() ) );
} }
//=======================================================================
// function : createGeomAction
// purpose :
//=======================================================================
void GeometryGUI::createOriginAndBaseVectors()
{
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
if( appStudy ) {
_PTR(Study) studyDS = appStudy->studyDS();
if( studyDS && !CORBA::is_nil( GetGeomGen() ) ) {
GEOM::GEOM_IBasicOperations_var aBasicOperations = GetGeomGen()->GetIBasicOperations( studyDS->StudyId() );
if( !aBasicOperations->_is_nil() ) {
SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
double aLength = aResourceMgr->doubleValue( "Geometry", "base_vectors_length", 1.0 );
GEOM::GEOM_Object_var anOrigin = aBasicOperations->MakePointXYZ( 0.0, 0.0, 0.0 );
GEOM::GEOM_Object_var anOX = aBasicOperations->MakeVectorDXDYDZ( aLength, 0.0, 0.0 );
GEOM::GEOM_Object_var anOY = aBasicOperations->MakeVectorDXDYDZ( 0.0, aLength, 0.0 );
GEOM::GEOM_Object_var anOZ = aBasicOperations->MakeVectorDXDYDZ( 0.0, 0.0, aLength );
SALOMEDS::Study_var aDSStudy = ClientStudyToStudy( studyDS );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOrigin, "O" );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" );
getApp()->updateObjectBrowser( false );
}
}
}
}
//======================================================================= //=======================================================================
// function : GeometryGUI::initialize() // function : GeometryGUI::initialize()
@ -611,6 +643,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createGeomAction( GEOMOp::OpVector, "VECTOR" ); createGeomAction( GEOMOp::OpVector, "VECTOR" );
createGeomAction( GEOMOp::OpPlane, "PLANE" ); createGeomAction( GEOMOp::OpPlane, "PLANE" );
createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" ); createGeomAction( GEOMOp::OpLCS, "LOCAL_CS" );
createGeomAction( GEOMOp::OpOriginAndVectors, "ORIGIN_AND_VECTORS" );
createGeomAction( GEOMOp::OpBox, "BOX" ); createGeomAction( GEOMOp::OpBox, "BOX" );
createGeomAction( GEOMOp::OpCylinder, "CYLINDER" ); createGeomAction( GEOMOp::OpCylinder, "CYLINDER" );
@ -761,6 +794,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createMenu( GEOMOp::OpVector, basicId, -1 ); createMenu( GEOMOp::OpVector, basicId, -1 );
createMenu( GEOMOp::OpPlane, basicId, -1 ); createMenu( GEOMOp::OpPlane, basicId, -1 );
createMenu( GEOMOp::OpLCS, basicId, -1 ); createMenu( GEOMOp::OpLCS, basicId, -1 );
createMenu( GEOMOp::OpOriginAndVectors, basicId, -1 );
int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 ); int primId = createMenu( tr( "MEN_PRIMITIVES" ), newEntId, -1 );
createMenu( GEOMOp::OpBox, primId, -1 ); createMenu( GEOMOp::OpBox, primId, -1 );
@ -928,6 +962,7 @@ void GeometryGUI::initialize( CAM_Application* app )
createTool( GEOMOp::OpVector, basicTbId ); createTool( GEOMOp::OpVector, basicTbId );
createTool( GEOMOp::OpPlane, basicTbId ); createTool( GEOMOp::OpPlane, basicTbId );
createTool( GEOMOp::OpLCS, basicTbId ); createTool( GEOMOp::OpLCS, basicTbId );
createTool( GEOMOp::OpOriginAndVectors, basicTbId );
int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) ); int primTbId = createTool( tr( "TOOL_PRIMITIVES" ) );
createTool( GEOMOp::OpBox, primTbId ); createTool( GEOMOp::OpBox, primTbId );
@ -1197,31 +1232,14 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
// 0020836 (Basic vectors and origin) // 0020836 (Basic vectors and origin)
SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
bool isAutoCreatedObjects = aResourceMgr->booleanValue( "Geometry", "auto_created_objects", false ); if( aResourceMgr->booleanValue( "Geometry", "auto_create_base_objects", false ) ) {
if( isAutoCreatedObjects && !CORBA::is_nil( GetGeomGen() ) ) {
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() ); SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( application()->activeStudy() );
if( appStudy ) { if( appStudy ) {
_PTR(Study) studyDS = appStudy->studyDS(); _PTR(Study) studyDS = appStudy->studyDS();
if( studyDS ) { if( studyDS ) {
_PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM"); _PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
if( !aSComponent ) { if( !aSComponent ) // create objects automatically only if there is no GEOM component
GEOM::GEOM_IBasicOperations_var aBasicOperations = GetGeomGen()->GetIBasicOperations( studyDS->StudyId() ); createOriginAndBaseVectors();
if( !aBasicOperations->_is_nil() ) {
double aLength = aResourceMgr->doubleValue( "Geometry", "auto_vectors_length", 1.0 );
GEOM::GEOM_Object_var anOrigin = aBasicOperations->MakePointXYZ( 0.0, 0.0, 0.0 );
GEOM::GEOM_Object_var anOX = aBasicOperations->MakeVectorDXDYDZ( aLength, 0.0, 0.0 );
GEOM::GEOM_Object_var anOY = aBasicOperations->MakeVectorDXDYDZ( 0.0, aLength, 0.0 );
GEOM::GEOM_Object_var anOZ = aBasicOperations->MakeVectorDXDYDZ( 0.0, 0.0, aLength );
SALOMEDS::Study_var aDSStudy = ClientStudyToStudy( studyDS );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOrigin, "O" );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" );
GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" );
getApp()->updateObjectBrowser( false );
}
}
} }
} }
} }
@ -1481,13 +1499,6 @@ void GeometryGUI::createPreferences()
int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup, int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" ); LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
int autoGroup = addPreference( tr( "PREF_GROUP_AUTO_CREATED_OBJECTS" ), tabId,
LightApp_Preferences::Auto, "Geometry", "auto_created_objects" );
int autoVectorsLength = addPreference( tr( "PREF_VECTORS_LENGTH" ), autoGroup,
LightApp_Preferences::DblSpin, "Geometry", "auto_vectors_length" );
setPreferenceProperty( autoVectorsLength, "min", 0.01 );
setPreferenceProperty( autoVectorsLength, "max", 1000 );
// Quantities with individual precision settings // Quantities with individual precision settings
int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId ); int precGroup = addPreference( tr( "GEOM_PREF_GROUP_PRECISION" ), tabId );
setPreferenceProperty( precGroup, "columns", 2 ); setPreferenceProperty( precGroup, "columns", 2 );
@ -1576,6 +1587,18 @@ void GeometryGUI::createPreferences()
setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList ); setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList ); setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
int originGroup = addPreference( tr( "PREF_GROUP_ORIGIN_AND_BASE_VECTORS" ), tabId );
setPreferenceProperty( originGroup, "columns", 2 );
int baseVectorsLength = addPreference( tr( "PREF_BASE_VECTORS_LENGTH" ), originGroup,
LightApp_Preferences::DblSpin, "Geometry", "base_vectors_length" );
setPreferenceProperty( baseVectorsLength, "min", 0.01 );
setPreferenceProperty( baseVectorsLength, "max", 1000 );
addPreference( tr( "PREF_AUTO_CREATE" ), originGroup,
LightApp_Preferences::Bool, "Geometry", "auto_create_base_objects" );
} }
void GeometryGUI::preferencesChanged( const QString& section, const QString& param ) void GeometryGUI::preferencesChanged( const QString& section, const QString& param )

View File

@ -153,6 +153,8 @@ private:
const bool isExpandAll = false, const bool isOCC = false, const bool isExpandAll = false, const bool isOCC = false,
const int parentId = -1 ); const int parentId = -1 );
void createOriginAndBaseVectors();
public: public:
static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!! static GEOM::GEOM_Gen_var myComponentGeom; // GEOM engine!!!

View File

@ -69,6 +69,7 @@ namespace GEOMOp {
OpPlane = 3006, // MENU NEW ENTITY - BASIC - PLANE OpPlane = 3006, // MENU NEW ENTITY - BASIC - PLANE
OpCurve = 3007, // MENU NEW ENTITY - BASIC - CURVE OpCurve = 3007, // MENU NEW ENTITY - BASIC - CURVE
OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM OpLCS = 3008, // MENU NEW ENTITY - BASIC - LOCAL COORDINATE SYSTEM
OpOriginAndVectors = 3009, // MENU NEW ENTITY - BASIC - ORIGIN AND BASE VECTORS
// PrimitiveGUI --------------//-------------------------------- // PrimitiveGUI --------------//--------------------------------
OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX OpBox = 3100, // MENU NEW ENTITY - PRIMITIVES - BOX
OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER OpCylinder = 3101, // MENU NEW ENTITY - PRIMITIVES - CYLINDER