myName = "";
myIO = NULL;
- myColorMode = eNone;
+ myControlMode = eNone;
my1DColorMode = e1DNone;
myControlActor = my2DActor;
aPtsTextProp->SetShadow(0);
myPtsLabeledDataMapper->SetLabelTextProperty(aPtsTextProp);
aPtsTextProp->Delete();
-
+
myEntityMode = eAllEntity;
myIsPointsLabeled = false;
void SMESH_Actor::SetControlMode(eControl theMode){
- myColorMode = eNone;
+ myControlMode = eNone;
my1DColorMode = e1DNone;
my1DActor->GetMapper()->SetScalarVisibility(false);
myControlActor = my1DActor;
break;
}
+ case eLength:
+ {
+ aFunctor.reset(new SMESH::Controls::Length2D());
+ myControlActor = my2DActor;
+ break;
+ }
case eFreeBorders:
aFunctor.reset(new SMESH::Controls::FreeBorders());
myControlActor = my1DActor;
vtkUnstructuredGrid* aGrid = myControlActor->GetUnstructuredGrid();
vtkIdType aNbCells = aGrid->GetNumberOfCells();
if(aNbCells){
- myColorMode = theMode;
+ myControlMode = theMode;
if(theMode == eFreeBorders || theMode == eFreeEdges){
my1DColorMode = e1DHighlited;
my1DExtActor->SetExtControlMode(aFunctor,myControlActor);
- }else{
+ } else if (theMode == eLength){
+ my1DColorMode = e1DColored;
+ my1DExtActor->SetLength2DControlMode(aFunctor,myControlActor,myScalarBarActor,myLookupTable);
+ } else{
if(myControlActor == my1DActor)
my1DColorMode = e1DColored;
myControlActor->SetControlMode(aFunctor,myScalarBarActor,myLookupTable);
if(theIsUpdateRepersentation)
SetRepresentation(GetRepresentation());
- if(myColorMode != eNone){
- if(my1DColorMode == e1DHighlited)
+ if(myControlMode != eNone){
+ if(my1DColorMode == e1DHighlited || myControlMode == eLength)
my1DExtActor->VisibilityOn();
else if(myControlActor->GetUnstructuredGrid()->GetNumberOfCells())
myScalarBarActor->VisibilityOn();
Modified();
}
-
namespace{
inline bool UpdateEntityMode(unsigned int& theOutputMode,
myEntityMode = theMode;
}
-
void SMESH_Actor::SetRepresentation(int theMode){
int aNbEdges = myVisualObj->GetNbEntities(SMESH::EDGE);
int aNbFaces = myVisualObj->GetNbEntities(SMESH::FACE);
my3DActor->SetRepresentation(aReperesent);
my1DExtActor->SetVisibility(false);
- switch(my1DColorMode){
- case e1DColored:
+// switch(my1DColorMode){
+// case e1DColored:
+// aProp = aBackProp = my1DProp;
+// if(myRepresentation != ePoint)
+// aReperesent = SMESH_DeviceActor::eInsideframe;
+// break;
+// case e1DHighlited:
+// my1DExtActor->SetVisibility(true);
+// break;
+// }
+ if (my1DColorMode == e1DColored){
aProp = aBackProp = my1DProp;
if(myRepresentation != ePoint)
aReperesent = SMESH_DeviceActor::eInsideframe;
- break;
- case e1DHighlited:
+ } else if (my1DColorMode == e1DHighlited || myControlMode == eLength){
my1DExtActor->SetVisibility(true);
- break;
}
my1DActor->SetProperty(aProp);
enum EReperesent { ePoint, eEdge, eSurface};
virtual void SetRepresentation(int theMode);
-
+
enum EEntityMode { eEdges = 0x01, eFaces = 0x02, eVolumes = 0x04, eAllEntity = 0x07};
unsigned int GetEntityMode() const { return myEntityMode;}
void SetEntityMode(unsigned int theMode);
void SetCellsLabeled(bool theIsCellsLabeled);
bool GetCellsLabeled(){ return myIsCellsLabeled;}
- enum eControl{eNone, eLengthEdges, eFreeBorders, eFreeEdges, eMultiConnection,
+ enum eControl{eNone, eLengthEdges, eLength, eFreeBorders, eFreeEdges, eMultiConnection,
eArea, eTaper, eAspectRatio, eMinimumAngle, eWarping, eSkew,
eAspectRatio3D};
void SetControlMode(eControl theMode);
- eControl GetControlMode(){ return myColorMode;}
+ eControl GetControlMode(){ return myControlMode;}
enum e1DControl{e1DNone, e1DColored, e1DHighlited};
e1DControl Get1DControlMode(){ return my1DColorMode;}
SMESH_DeviceActor* myHighlitableActor;
SMESH_DeviceActor* myNodeHighlitableActor;
- eControl myColorMode;
+ eControl myControlMode;
SMESH_DeviceActor* my2DActor;
SMESH_DeviceActor* my3DActor;
SMESH_DeviceActor* myControlActor;
// File : SMESH_Actor.cxx
// Author : Nicolas REJNERI
// Module : SMESH
-// $Header$
+// $Header$Header: /home/server/cvs/SMESH/SMESH_SRC/src/OBJECT/SMESH_DeviceActor.cxx,v 1.5.2.1 2004/12/23 10:31:24 apo Exp $
#include "SMESH_DeviceActor.h"
myExtractUnstructuredGrid->SetInput(myExtractGeometry->GetOutput());
myMergeFilter->SetGeometry(myExtractUnstructuredGrid->GetOutput());
-
+
theGrid = static_cast<vtkUnstructuredGrid*>(myMergeFilter->GetOutput());
int anId = 0;
theScalarBarActor->SetVisibility(anIsInitialized);
}
+void SMESH_DeviceActor::SetLength2DControlMode(SMESH::Controls::FunctorPtr theFunctor,
+ SMESH_DeviceActor* theDeviceActor,
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable)
+{
+ bool anIsInitialized = theFunctor;
+
+ using namespace SMESH::Controls;
+ if (anIsInitialized){
+ if (Length2D* aLength2D = dynamic_cast<Length2D*>(theFunctor.get())){
+ SMESH::Controls::Length2D::TValues aValues;
+
+ myVisualObj->UpdateFunctor(theFunctor);
+
+ aLength2D->GetValues(aValues);
+ vtkUnstructuredGrid* aDataSet = vtkUnstructuredGrid::New();
+ vtkUnstructuredGrid* aGrid = myVisualObj->GetUnstructuredGrid();
+
+ aDataSet->SetPoints(aGrid->GetPoints());
+
+ vtkIdType aNbCells = aValues.size();
+
+ vtkDoubleArray *aScalars = vtkDoubleArray::New();
+ aScalars->SetNumberOfComponents(1);
+ aScalars->SetNumberOfTuples(aNbCells);
+
+ vtkIdType aCellsSize = 3*aNbCells;
+ vtkCellArray* aConnectivity = vtkCellArray::New();
+ aConnectivity->Allocate( aCellsSize, 0 );
+
+ vtkUnsignedCharArray* aCellTypesArray = vtkUnsignedCharArray::New();
+ aCellTypesArray->SetNumberOfComponents( 1 );
+ aCellTypesArray->Allocate( aNbCells * aCellTypesArray->GetNumberOfComponents() );
+
+ vtkIdList *anIdList = vtkIdList::New();
+ anIdList->SetNumberOfIds(2);
+
+ Length2D::TValues::const_iterator anIter = aValues.begin();
+ int i = 0;
+ for(vtkIdType aVtkId; anIter != aValues.end(); anIter++,i++){
+ const Length2D::Value& aValue = *anIter;
+ int aNode[2] = {
+ myVisualObj->GetNodeVTKId(aValue.myPntId[0]),
+ myVisualObj->GetNodeVTKId(aValue.myPntId[1])
+ };
+ if(aNode[0] >= 0 && aNode[1] >= 0){
+ anIdList->SetId( 0, aNode[0] );
+ anIdList->SetId( 1, aNode[1] );
+ aConnectivity->InsertNextCell( anIdList );
+ aCellTypesArray->InsertNextValue( VTK_LINE );
+ aScalars->SetValue(i,aValue.myLength);
+ }
+ }
+
+ vtkIntArray* aCellLocationsArray = vtkIntArray::New();
+ aCellLocationsArray->SetNumberOfComponents( 1 );
+ aCellLocationsArray->SetNumberOfTuples( aNbCells );
+
+ aConnectivity->InitTraversal();
+ for( vtkIdType idType = 0, *pts, npts; aConnectivity->GetNextCell( npts, pts ); idType++ )
+ aCellLocationsArray->SetValue( idType, aConnectivity->GetTraversalLocation( npts ) );
+
+ aDataSet->SetCells( aCellTypesArray, aCellLocationsArray,aConnectivity );
+ SetUnstructuredGrid(aDataSet);
+
+ aDataSet->GetCellData()->SetScalars(aScalars);
+ aScalars->Delete();
+
+ theLookupTable->SetRange(aScalars->GetRange());
+ theLookupTable->Build();
+
+ SetUnstructuredGrid(aDataSet);
+
+ myMergeFilter->SetScalars(aDataSet);
+ aDataSet->Delete();
+ }
+ }
+ GetMapper()->SetScalarVisibility(anIsInitialized);
+ theScalarBarActor->SetVisibility(anIsInitialized);
+}
void SMESH_DeviceActor::SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor)
SetUnstructuredGrid(aDataSet);
aDataSet->Delete();
- }
+ }
}
+
+
unsigned long int SMESH_DeviceActor::GetMTime(){
unsigned long mTime = this->Superclass::GetMTime();
mTime = max(mTime,myExtractGeometry->GetMTime());
void SetControlMode(SMESH::Controls::FunctorPtr theFunctor,
vtkScalarBarActor* theScalarBarActor,
vtkLookupTable* theLookupTable);
+ void SetLength2DControlMode(SMESH::Controls::FunctorPtr theFunctor,
+ SMESH_DeviceActor* theDeviceActor,
+ vtkScalarBarActor* theScalarBarActor,
+ vtkLookupTable* theLookupTable);
void SetExtControlMode(SMESH::Controls::FunctorPtr theFunctor,
SMESH_DeviceActor* theDeviceActor);
aTitle = QObject::tr( "LENGTH_EDGES" );
aControl = SMESH_Actor::eLengthEdges;
break;
+ case 6018:
+ aTitle = QObject::tr( "LENGTH2D_EDGES" );
+ aControl = SMESH_Actor::eLength;
+ break;
case 6002:
aTitle = QObject::tr( "FREE_EDGES" );
aControl = SMESH_Actor::eFreeEdges;
case 6012:
case 6011:
case 6001:
+ case 6018:
case 6002:
case 6003:
case 6004:
switch ( cMode ) {
case SMESH_Actor::eLengthEdges:
mi->popup()->setItemChecked( 6001, true ); break;
+ case SMESH_Actor::eLength:
+ mi->popup()->setItemChecked( 6018, true ); break;
case SMESH_Actor::eFreeEdges:
mi->popup()->setItemChecked( 6002, true );
mi->popup()->removeItem( 201 );
TVisualObjPtr aVisualObj = anActor->GetObject();
if(aNbEdges == 0){
mi->popup()->removeItem( 6001 );
+ mi->popup()->removeItem( 6018 );
mi->popup()->removeItem( 6003 );
mi->popup()->removeItem( 6004 );
}