mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-14 09:38:34 +05:00
0020012: EDF 831 GEOM : API for points representation in 3D viewer
This commit is contained in:
parent
7a644cc9d7
commit
f341d9035f
Binary file not shown.
Before Width: | Height: | Size: 261 B After Width: | Height: | Size: 239 B |
Binary file not shown.
Before Width: | Height: | Size: 239 B After Width: | Height: | Size: 261 B |
@ -83,6 +83,8 @@ QVariant GEOMGUI_Selection::parameter( const int ind, const QString& p ) const
|
||||
// else
|
||||
if( p == "type" )
|
||||
return QVariant( typeName( ind ) );
|
||||
if( p == "typeid" )
|
||||
return QVariant( typeId( ind ) );
|
||||
else if ( p == "displaymode" )
|
||||
return QVariant( displayMode( ind ) );
|
||||
else if ( p == "isAutoColor" )
|
||||
@ -112,6 +114,15 @@ QString GEOMGUI_Selection::typeName( const int index ) const
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
int GEOMGUI_Selection::typeId( const int index ) const
|
||||
{
|
||||
int aType = -1;
|
||||
GEOM::GEOM_Object_var anObj = getObject( index );
|
||||
if ( !CORBA::is_nil( anObj ) )
|
||||
aType = anObj->GetType();
|
||||
return aType;
|
||||
}
|
||||
|
||||
bool GEOMGUI_Selection::isVisible( const int index ) const
|
||||
{
|
||||
GEOM::GEOM_Object_var obj = getObject( index );
|
||||
|
@ -48,6 +48,7 @@ private:
|
||||
bool isVisible( const int ) const;
|
||||
bool isAutoColor( const int ) const;
|
||||
QString typeName( const int ) const;
|
||||
int typeId( const int ) const;
|
||||
QString displayMode( const int ) const;
|
||||
QString selectionMode() const;
|
||||
bool isVectorsMode( const int ) const;
|
||||
|
@ -89,6 +89,7 @@
|
||||
#include CORBA_CLIENT_HEADER(SALOMEDS_Attributes)
|
||||
|
||||
#include <GEOMImpl_Types.hxx>
|
||||
#include <Graphic3d_HArray1OfBytes.hxx>
|
||||
|
||||
using namespace std;
|
||||
|
||||
@ -257,13 +258,10 @@ GEOM_Displayer::GEOM_Displayer( SalomeApp_Study* st )
|
||||
myShadingColor = SalomeApp_Tools::color( col );
|
||||
|
||||
myDisplayMode = resMgr->integerValue("Geometry", "display_mode", 0);
|
||||
myTypeOfMarker = (Aspect_TypeOfMarker)resMgr->integerValue("Geometry", "type_of_marker", Aspect_TOM_PLUS);
|
||||
myScaleOfMarker = resMgr->doubleValue("Geometry", "marker_scale", 1.);
|
||||
if(myScaleOfMarker < 1.0)
|
||||
myScaleOfMarker = 1.0;
|
||||
if(myScaleOfMarker > 7.)
|
||||
myScaleOfMarker = 7.;
|
||||
|
||||
int aType = resMgr->integerValue("Geometry", "type_of_marker", (int)Aspect_TOM_PLUS);
|
||||
myTypeOfMarker = (Aspect_TypeOfMarker)(std::min((int)Aspect_TOM_RING3, std::max((int)Aspect_TOM_POINT, aType)));
|
||||
myScaleOfMarker = (resMgr->integerValue("Geometry", "marker_scale", 1)-(int)GEOM::MS_10)*0.5 + 1.0;
|
||||
myScaleOfMarker = std::min(7.0, std::max(1., myScaleOfMarker));
|
||||
|
||||
myColor = -1;
|
||||
// This color is used for shape displaying. If it is equal -1 then
|
||||
@ -752,7 +750,7 @@ void GEOM_Displayer::Update( SALOME_OCCPrs* prs )
|
||||
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;
|
||||
Handle(Graphic3d_HArray1OfBytes) aTexture = GeometryGUI::getTextureAspect( getStudy(), aTextureId, aWidth, aHeight );
|
||||
Handle(Graphic3d_HArray1OfBytes) aTexture = GeometryGUI::getTexture( getStudy(), aTextureId, aWidth, aHeight );
|
||||
if ( !aTexture.IsNull() ) {
|
||||
static int TextureId = 0;
|
||||
Handle(Prs3d_PointAspect) aTextureAspect = new Prs3d_PointAspect(aQuanColor,
|
||||
|
@ -665,6 +665,22 @@
|
||||
<source>ICON_VERTEX_MARKER_9</source>
|
||||
<translation>marker_9.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_VERTEX_MARKER_10</source>
|
||||
<translation>marker_10.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_VERTEX_MARKER_11</source>
|
||||
<translation>marker_11.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_VERTEX_MARKER_12</source>
|
||||
<translation>marker_12.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICON_VERTEX_MARKER_13</source>
|
||||
<translation>marker_13.png</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>ICO_ARC</source>
|
||||
<translation>arc.png</translation>
|
||||
|
@ -2551,6 +2551,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_WORK_PLANE</source>
|
||||
<translation>Working Plane</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_POP_POINT_MARKER</source>
|
||||
<translation>Point Marker</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>NAME_LBL</source>
|
||||
<translation>Name: </translation>
|
||||
@ -3051,6 +3055,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_WORK_PLANE</source>
|
||||
<translation>Create a working plane</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_POP_POINT_MARKER</source>
|
||||
<translation>Set Point Marker</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SUPPRESS_RESULT</source>
|
||||
<translation>Suppress Result</translation>
|
||||
@ -3511,6 +3519,10 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_WORK_PLANE</source>
|
||||
<translation>Create a working plane</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_POP_POINT_MARKER</source>
|
||||
<translation>Point Marker</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>WRN_NOT_IMPLEMENTED</source>
|
||||
<translation>Sorry, this functionality is not yet implemented</translation>
|
||||
@ -4265,4 +4277,51 @@ Would you like to continue?</translation>
|
||||
<translation>Delete objects</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>GEOMToolsGUI_MarkerDlg</name>
|
||||
<message>
|
||||
<source>SET_MARKER_TLT</source>
|
||||
<translation>Set Point Marker</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STANDARD_MARKER</source>
|
||||
<translation>Standard</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CUSTOM_MARKER</source>
|
||||
<translation>Custom</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TYPE</source>
|
||||
<translation>Type:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>SCALE</source>
|
||||
<translation>Scale:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CUSTOM</source>
|
||||
<translation>Texture:</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>BROWSE</source>
|
||||
<translation>Browse...</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>OK_BTN</source>
|
||||
<translation>&OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>CANCEL_BTN</source>
|
||||
<translation>&Cancel</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>HELP_BTN</source>
|
||||
<translation>&Help</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>LOAD_TEXTURE_TLT</source>
|
||||
<translation>Load Texture</translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
@ -382,6 +382,7 @@ void GeometryGUI::OnGUIEvent( int id )
|
||||
id == 8036 || // POPUP VIEWER - DISABLE AUTO COLOR
|
||||
id == 8037 || // POPUP VIEWER - SHOW CHILDREN
|
||||
id == 8038 || // POPUP VIEWER - HIDE CHILDREN
|
||||
id == 8039 || // POPUP VIEWER - POINT MARKER
|
||||
id == 804 || // POPUP VIEWER - ADD IN STUDY
|
||||
id == 901 || // OBJECT BROWSER - RENAME
|
||||
id == 9024 ) { // OBJECT BROWSER - OPEN
|
||||
@ -904,6 +905,7 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createGeomAction( 8001, "POP_CREATE_GROUP" );
|
||||
createGeomAction( 8037, "POP_SHOW_CHILDREN" );
|
||||
createGeomAction( 8038, "POP_HIDE_CHILDREN" );
|
||||
createGeomAction( 8039, "POP_POINT_MARKER" );
|
||||
|
||||
// make wireframe-shading items to be exclusive (only one at a time is selected)
|
||||
//QActionGroup* dispModeGr = new QActionGroup( this, "", true );
|
||||
@ -1171,6 +1173,8 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
mgr->setRule( action( 8033 ), clientOCCorVTK_AndSomeVisible, QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( 8034 ), -1, -1 ); // isos
|
||||
mgr->setRule( action( 8034 ), clientOCCorVTK_AndSomeVisible + " and selcount>0 and isVisible", QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( action( 8039 ), -1, -1 ); // point marker
|
||||
mgr->setRule( action( 8039 ), QString( "selcount>0 and $typeid in {%1}" ).arg( GEOM_POINT ), QtxPopupMgr::VisibleRule );
|
||||
mgr->insert( separator(), -1, -1 ); // -----------
|
||||
mgr->insert( action( 8035 ), -1, -1 ); // auto color
|
||||
mgr->setRule( action( 8035 ), autoColorPrefix + " and isAutoColor=false", QtxPopupMgr::VisibleRule );
|
||||
@ -1463,7 +1467,7 @@ QString GeometryGUI::engineIOR() const
|
||||
return "";
|
||||
}
|
||||
|
||||
Handle(Graphic3d_HArray1OfBytes) GeometryGUI::getTextureAspect( SalomeApp_Study* theStudy, int theId, int& theWidth, int& theHeight )
|
||||
Handle(Graphic3d_HArray1OfBytes) GeometryGUI::getTexture( SalomeApp_Study* theStudy, int theId, int& theWidth, int& theHeight )
|
||||
{
|
||||
theWidth = theHeight = 0;
|
||||
Handle(Graphic3d_HArray1OfBytes) aTexture;
|
||||
@ -1569,7 +1573,7 @@ void GeometryGUI::createPreferences()
|
||||
LightApp_Preferences::Selector, "Geometry", "type_of_marker" );
|
||||
|
||||
int markerScale = addPreference( tr( "PREF_MARKER_SCALE" ), VertexGroup,
|
||||
LightApp_Preferences::DblSpin, "Geometry", "marker_scale" );
|
||||
LightApp_Preferences::Selector, "Geometry", "marker_scale" );
|
||||
|
||||
// Set property for default display mode
|
||||
QStringList aModesList;
|
||||
@ -1588,38 +1592,32 @@ void GeometryGUI::createPreferences()
|
||||
setPreferenceProperty( step, "max", 10000 );
|
||||
setPreferenceProperty( step, "precision", 3 );
|
||||
|
||||
// Set property for type of vertex marker
|
||||
QList<QVariant> anTypeOfMarkerIndexesList;
|
||||
QList<QVariant> anTypeOfMarkerIconsList;
|
||||
// Set property vertex marker type
|
||||
QList<QVariant> aMarkerTypeIndicesList;
|
||||
QList<QVariant> aMarkerTypeIconsList;
|
||||
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_PLUS);
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_POINT);
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_STAR);
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_O);
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_X);
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_O_POINT);
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_O_PLUS);
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_O_STAR);
|
||||
anTypeOfMarkerIndexesList.append(Aspect_TOM_O_X);
|
||||
|
||||
// Create icons list
|
||||
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
|
||||
for (int i = 1; i<=9; i++) {
|
||||
QString str = "ICON_VERTEX_MARKER_";
|
||||
str.append( QString::number(i) );
|
||||
QPixmap pixmap (resMgr->loadPixmap("GEOM", tr( str.toLatin1().data() )));
|
||||
anTypeOfMarkerIconsList.append(pixmap);
|
||||
for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) {
|
||||
QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
|
||||
QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) );
|
||||
aMarkerTypeIndicesList << (i-1);
|
||||
aMarkerTypeIconsList << pixmap;
|
||||
}
|
||||
|
||||
setPreferenceProperty( typeOfMarker, "indexes", anTypeOfMarkerIndexesList );
|
||||
setPreferenceProperty( typeOfMarker, "icons", anTypeOfMarkerIconsList );
|
||||
setPreferenceProperty( typeOfMarker, "indexes", aMarkerTypeIndicesList );
|
||||
setPreferenceProperty( typeOfMarker, "icons", aMarkerTypeIconsList );
|
||||
|
||||
// Set property for Vertex Marker scale
|
||||
setPreferenceProperty( markerScale, "min", 1. );
|
||||
setPreferenceProperty( markerScale, "max", 7. );
|
||||
setPreferenceProperty( markerScale, "precision", 0.01 );
|
||||
setPreferenceProperty( markerScale, "step", 0.5 );
|
||||
// Set property for vertex marker scale
|
||||
QList<QVariant> aMarkerScaleIndicesList;
|
||||
QStringList aMarkerScaleValuesList;
|
||||
|
||||
for ( int i = GEOM::MS_10; i <= GEOM::MS_70; i++ ) {
|
||||
aMarkerScaleIndicesList << i;
|
||||
aMarkerScaleValuesList << QString::number( (i-(int)GEOM::MS_10)*0.5 + 1.0 );
|
||||
}
|
||||
|
||||
setPreferenceProperty( markerScale, "strings", aMarkerScaleValuesList );
|
||||
setPreferenceProperty( markerScale, "indexes", aMarkerScaleIndicesList );
|
||||
}
|
||||
|
||||
void GeometryGUI::preferencesChanged( const QString& section, const QString& param )
|
||||
|
@ -76,7 +76,7 @@ public:
|
||||
virtual void initialize( CAM_Application* );
|
||||
virtual QString engineIOR() const;
|
||||
|
||||
static Handle(Graphic3d_HArray1OfBytes) getTextureAspect( SalomeApp_Study*, int, int&, int& );
|
||||
static Handle(Graphic3d_HArray1OfBytes) getTexture( SalomeApp_Study*, int, int&, int& );
|
||||
|
||||
static bool InitGeomGen(); //BugID IPAL9186: SRN: To be called by Python scripts
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user