vtkFloatingPointType aPointSize = SMESH::GetFloat("SMESH:node_size",3);
vtkFloatingPointType aLineWidth = SMESH::GetFloat("SMESH:element_width",1);
-
+
vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
VTKViewer_ExtractUnstructuredGrid* aFilter = NULL;
// Clipping planes
myImplicitBoolean = vtkImplicitBoolean::New();
myImplicitBoolean->SetOperationTypeToIntersection();
+
+
+ //Quadratic 2D elements representation
+ //-----------------------------------------------------------------------------
+ int aQuadratic2DMode = mgr->integerValue( "SMESH", "quadratic_mode", 0);
+ if(aQuadratic2DMode == 0){
+ myHighlitableActor->SetQuadraticArcMode(false);
+ my2DActor->SetQuadraticArcMode(false);
+ my1DActor->SetQuadraticArcMode(false);
+ }
+ else if(aQuadratic2DMode == 1){
+ myHighlitableActor->SetQuadraticArcMode(true);
+ my2DActor->SetQuadraticArcMode(true);
+ my1DActor->SetQuadraticArcMode(true);
+ }
+
+ int aQuadraticAngle = mgr->integerValue( "SMESH", "max_angle", 2);
+ myHighlitableActor->SetQuadraticArcAngle(aQuadraticAngle);
+ my2DActor->SetQuadraticArcAngle(aQuadraticAngle);
+
// Set color of the name actor
SMESH::GetColor( "SMESH", "fill_color", anRGB[0], anRGB[1], anRGB[2], QColor( 0, 170, 255 ) );
myNameActor->SetBackgroundColor(anRGB[0], anRGB[1], anRGB[2]);
void SMESH_ActorDef::SetPointsLabeled( bool theIsPointsLabeled )
-{
+{
vtkUnstructuredGrid* aGrid = GetUnstructuredGrid();
+
myIsPointsLabeled = theIsPointsLabeled && aGrid->GetNumberOfPoints();
if ( myIsPointsLabeled )
myNodeExtActor->SetVisibility(false);
vtkProperty *aProp = NULL, *aBackProp = NULL;
SMESH_DeviceActor::EReperesent aReperesent = SMESH_DeviceActor::EReperesent(-1);
+ SMESH_Actor::EQuadratic2DRepresentation aQuadraticMode = GetQuadratic2DRepresentation();
switch(myRepresentation){
case ePoint:
myPickableActor = myNodeActor;
myNodeActor->SetVisibility(true);
-
+ aQuadraticMode = SMESH_Actor::eLines;
aProp = aBackProp = myNodeProp;
aReperesent = SMESH_DeviceActor::ePoint;
break;
my2DActor->SetBackfaceProperty(aBackProp);
my2DActor->SetRepresentation(aReperesent);
+ if(aQuadraticMode == SMESH_Actor::eLines)
+ my2DActor->SetQuadraticArcMode(false);
+ else if(aQuadraticMode == SMESH_Actor::eArcs)
+ my2DActor->SetQuadraticArcMode(true);
+
my2DExtActor->SetRepresentation(aReperesent);
my3DActor->SetProperty(aProp);
break;
}
+ if(aQuadraticMode == SMESH_Actor::eLines)
+ my1DActor->SetQuadraticArcMode(false);
+ else if(aQuadraticMode == SMESH_Actor::eArcs)
+ my1DActor->SetQuadraticArcMode(true);
+
+
my1DActor->SetProperty(aProp);
my1DActor->SetBackfaceProperty(aBackProp);
my1DActor->SetRepresentation(aReperesent);
myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
}
+
+void SMESH_ActorDef::SetQuadratic2DRepresentation(EQuadratic2DRepresentation theMode)
+{
+ switch(theMode) {
+ case SMESH_Actor::eLines :
+ myHighlitableActor->SetQuadraticArcMode(false);
+ my2DActor->SetQuadraticArcMode(false);
+ my1DActor->SetQuadraticArcMode(false);
+ break;
+ case SMESH_Actor::eArcs :
+ myHighlitableActor->SetQuadraticArcMode(true);
+ if(GetRepresentation() != SMESH_Actor::ePoint) {
+ my2DActor->SetQuadraticArcMode(true);
+ my1DActor->SetQuadraticArcMode(true);
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+
+SMESH_Actor::EQuadratic2DRepresentation SMESH_ActorDef::GetQuadratic2DRepresentation()
+{
+ if(myHighlitableActor->GetQuadraticArcMode())
+ return SMESH_Actor::eArcs;
+ else
+ return SMESH_Actor::eLines;
+}
enum EReperesent { ePoint, eEdge, eSurface};
enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
+
+ enum EQuadratic2DRepresentation { eLines = 0x01, eArcs = 0x02 };
+
virtual void SetEntityMode(unsigned int theMode) = 0;
virtual unsigned int GetEntityMode() const = 0;
+ virtual void SetQuadratic2DRepresentation(EQuadratic2DRepresentation) = 0;
+ virtual EQuadratic2DRepresentation GetQuadratic2DRepresentation() = 0;
+
virtual void SetPointRepresentation(bool theIsPointsVisible) = 0;
virtual bool GetPointRepresentation() = 0;
virtual long GetControlsPrecision() const { return myControlsPrecision; }
virtual void UpdateScalarBar();
+
+
+ virtual void SetQuadratic2DRepresentation(EQuadratic2DRepresentation);
+ virtual EQuadratic2DRepresentation GetQuadratic2DRepresentation();
protected:
void SetControlMode(eControl theMode, bool theCheckEntityMode);
myPolygonOffsetUnits = units;
}
+/*!
+ * On/Off representation 2D quadratic element as arked polygon
+ */
+void SMESH_DeviceActor::SetQuadraticArcMode(bool theFlag){
+ myGeomFilter->SetQuadraticArcMode(theFlag);
+}
+
+/*!
+ * Return true if 2D quadratic element displayed as arked polygon
+ */
+bool SMESH_DeviceActor::GetQuadraticArcMode(){
+ return myGeomFilter->GetQuadraticArcMode();
+}
+/*!
+ * Set Max angle for representation 2D quadratic element as arked polygon
+ */
+void SMESH_DeviceActor::SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle){
+ myGeomFilter->SetQuadraticArcAngle(theMaxAngle);
+}
+
+/*!
+ * Return Max angle of the representation 2D quadratic element as arked polygon
+ */
+vtkFloatingPointType SMESH_DeviceActor::GetQuadraticArcAngle(){
+ return myGeomFilter->GetQuadraticArcAngle();
+}
virtual void SetFacesOriented(bool theIsFacesOriented);
virtual bool GetFacesOriented() { return myIsFacesOriented; }
+ //----------------------------------------------------------------------------
+ //! Setting for displaying quadratic elements
+ virtual void SetQuadraticArcMode(bool theFlag);
+ virtual bool GetQuadraticArcMode();
+
+ virtual void SetQuadraticArcAngle(vtkFloatingPointType theMaxAngle);
+ virtual vtkFloatingPointType GetQuadraticArcAngle();
+
void UpdateFaceOrientation();
vtkFloatingPointType GetShrinkFactor();
case 215:
anActor->SetRepresentation(SMESH_Actor::ePoint);
break;
+ case 231:
+ if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eLines)
+ anActor->SetQuadratic2DRepresentation(SMESH_Actor::eLines);
+ break;
+ case 232:
+ if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eArcs)
+ anActor->SetQuadratic2DRepresentation(SMESH_Actor::eArcs);
+ break;
case 1132:{
vtkFloatingPointType color[3];
anActor->GetSufaceColor(color[0], color[1], color[2]);
::SetDisplayMode(theCommandID);
break;
- // Display Entity
+ //2D quadratic representation
+ case 231:
+ case 232:
+ ::SetDisplayMode(theCommandID);
+ break;
+
+ // Display Entity
case 217: // Edges
case 218: // Faces
case 219: // Volumes
createSMESHAction( 219, "VOLUMES", "ICON_DLG_TETRAS", 0, true );
createSMESHAction( 220, "ALL" );
createSMESHAction( 221, "FACE_ORIENTATION", "", 0, true );
+
+ createSMESHAction( 231, "LINE_REPRESENTATION", "", 0, true );
+ createSMESHAction( 232, "ARC_REPRESENTATION", "", 0, true );
+
createSMESHAction( 1100, "EDIT_HYPO" );
createSMESHAction( 1101, "RENAME", "", Qt::Key_F2 );
createSMESHAction( 1102, "UNASSIGN" );
aMeshInVtkHasVolumes = aMeshInVTK + "&&" + hasVolumes;
anId = popupMgr()->insert( tr( "MEN_CTRL" ), -1, -1 );
-
+
popupMgr()->insert( action( 200 ), anId, -1 ); // RESET
popupMgr()->setRule( action( 200 ), aMeshInVTK + "&& controlMode <> 'eNone'", QtxPopupMgr::VisibleRule );
popupMgr()->insert( separator(), -1, -1 );
+
+ //-------------------------------------------------
+ // Representation of the 2D Quadratic elements
+ //-------------------------------------------------
+ anId = popupMgr()->insert( tr( "MEN_QUADRATIC_REPRESENT" ), -1, -1 );
+ popupMgr()->insert( action( 231 ), anId, -1 ); // LINE REPRESENTATION
+ popupMgr()->setRule( action( 231 ), aMeshInVTK + "and isVisible",QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( 231 ), "quadratic2DMode = 'eLines'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( action( 232 ), anId, -1 ); // ARC REPRESENTATION
+ popupMgr()->setRule( action( 232 ), aMeshInVTK + "and isVisible", QtxPopupMgr::VisibleRule );
+ popupMgr()->setRule( action( 232 ), "quadratic2DMode = 'eArcs'", QtxPopupMgr::ToggleRule );
+
+ popupMgr()->insert( separator(), -1, -1 );
+
//-------------------------------------------------
// Display / Erase
//-------------------------------------------------
setPreferenceProperty( dispmode, "strings", modes );
setPreferenceProperty( dispmode, "indexes", indices );
+ int arcgroup = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), genTab );
+ setPreferenceProperty( arcgroup, "columns", 2 );
+ int quadraticmode = addPreference( tr( "QUADRATIC_REPRESENT_MODE" ), arcgroup, LightApp_Preferences::Selector, "SMESH", "quadratic_mode" );
+ QStringList quadraticModes;
+ quadraticModes.append("Lines");
+ quadraticModes.append("Arcs");
+ indices.clear();
+ indices.append( 0 );
+ indices.append( 1 );
+ setPreferenceProperty( quadraticmode, "strings", quadraticModes );
+ setPreferenceProperty( quadraticmode, "indexes", indices );
+
+ int maxAngle = addPreference( tr( "MAX_ARC_ANGLE" ), arcgroup, LightApp_Preferences::IntSpin,
+ "SMESH", "max_angle" );
+ setPreferenceProperty( maxAngle, "min", 1 );
+ setPreferenceProperty( maxAngle, "max", 90 );
+
+
+
int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
setPreferenceProperty( exportgroup, "columns", 2 );
addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
else if ( p=="isImported" ) val = QVariant( isImported( ind ) );
else if ( p=="facesOrientationMode" ) val = QVariant( facesOrientationMode( ind ) );
else if ( p=="groupType" ) val = QVariant( groupType( ind ) );
+ else if ( p=="quadratic2DMode") val = QVariant(quadratic2DMode(ind));
if( val.isValid() )
return val;
return "Unknown";
}
+
+//=======================================================================
+//function : quadratic2DMode
+//purpose : return SMESH_Actor::EQuadratic2DRepresentation
+//=======================================================================
+QString SMESHGUI_Selection::quadratic2DMode( int ind ) const
+{
+ SMESH_Actor* actor = getActor( ind );
+ if ( actor ) {
+ switch( actor->GetQuadratic2DRepresentation() ) {
+ case SMESH_Actor::eLines: return "eLines";
+ case SMESH_Actor::eArcs: return "eArcs";
+ default: break;
+ }
+ }
+ return "Unknown";
+}
+
//=======================================================================
//function : shrinkMode
//purpose : return either 'IsSrunk', 'IsNotShrunk' or 'IsNotShrinkable'
}
return type;
}
+
virtual QVariant hasReference( int ) const;
virtual QVariant isVisible( int ) const;
+ virtual QString quadratic2DMode(int ) const;
+
// parameters got from actor return nothing if an actor is not visible
virtual QList<QVariant> elemTypes( int ) const;
virtual QList<QVariant> labeledTypes( int ) const;
<source>MEN_SHADE</source>
<translation>Shading</translation>
</message>
+ <message>
+ <source>MEN_QUADRATIC_REPRESENT</source>
+ <translation>2D Quadratic</translation>
+ </message>
+ <message>
+ <source>MEN_LINE_REPRESENTATION</source>
+ <translation>Lines</translation>
+ </message>
+ <message>
+ <source>MEN_ARC_REPRESENTATION</source>
+ <translation>Arcs</translation>
+ </message>
<message>
<source>MEN_SHOW</source>
<translation>Show</translation>
<translation>Display entity</translation>
</message>
<message>
+ <source>QUADRATIC_REPRESENT_MODE</source>
+ <translation>Representation of the 2D quadratic elements</translation>
+ </message>
+ <message>
+ <source>MAX_ARC_ANGLE</source>
+ <translation>Maximum angle</translation>
+ </message>
+ <message>
<source>PREF_DISPLAY_MODE</source>
<translation>Display mode</translation>
</message>