From: apo Date: Tue, 31 Oct 2006 08:42:14 +0000 (+0000) Subject: To implement TimeStampsRange ColoredPrs3d:GetTimeStampsRange() X-Git-Tag: WP1_2_3_06-10-2006~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4718cfc0edabca21e8a5af9f548d1aed38540c6b;p=modules%2Fvisu.git To implement TimeStampsRange ColoredPrs3d:GetTimeStampsRange() --- diff --git a/idl/VISU_Gen.idl b/idl/VISU_Gen.idl index 986f8ea3..b35287ef 100644 --- a/idl/VISU_Gen.idl +++ b/idl/VISU_Gen.idl @@ -415,15 +415,43 @@ module VISU { */ interface ColoredPrs3d : Prs3d { + /*! Sets Entity input parameter that defines where the parent mesh to be taken from. + */ void SetEntity(in Entity theEntity); + /*! Gets Entity input parameter that defines where the parent mesh is taken from. + */ Entity GetEntity(); + /*! Sets name of field input parameter that defines what phisical data to be retrived. + */ void SetFieldName(in string theName); + /*! Gets name of field input parameter that defines what phisical data is retrived. + */ string GetFieldName(); + /*! Sets number of timestamp input parameter that defines what time of phisical data to be retrived. + */ void SetTimeStampNumber(in long theTimeStampNumber); + /*! Gets number of timestamp input parameter that defines what time of phisical data is retrived. + */ long GetTimeStampNumber(); + /*! Defines timestamp representation. + */ + struct TimeStampInfo + { + string myTime; + long myNumber; + }; + + /*! Defines representation range of timestamps. + */ + typedef sequence TimeStampsRange; + + /*! Gets available range of timestamps. + */ + TimeStampsRange GetTimeStampsRange(); + /*! Sets the method of coloring of the elements composing a 3D presentation. */ void SetScalarMode(in long theScalarMode); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index e233854f..7a06e9f9 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -241,6 +241,37 @@ VISU::ColoredPrs3d_i Update(); } +VISU::ColoredPrs3d::TimeStampsRange* +VISU::ColoredPrs3d_i +::GetTimeStampsRange() +{ + typedef std::map TTimeStampsRange; + TTimeStampsRange aRange; + { + const VISU::TValField& aValField = GetField()->myValField; + VISU::TValField::const_iterator anIter = aValField.begin(); + for(; anIter != aValField.end(); anIter++){ + vtkIdType aTimeStampNumber = anIter->first; + const PValForTime& aValForTime = anIter->second; + std::string aTime = VISU_Convertor::GenerateName(aValForTime->myTime); + aRange[aTime] = aTimeStampNumber; + } + } + VISU::ColoredPrs3d::TimeStampsRange_var aTimeStampsRange = new VISU::ColoredPrs3d::TimeStampsRange(); + { + aTimeStampsRange->length(aRange.size()); + TTimeStampsRange::const_iterator anIter = aRange.begin(); + for(size_t aCounter = 0; anIter != aRange.end(); anIter++, aCounter++){ + vtkIdType aTimeStampNumber = anIter->second; + const std::string& aTime = anIter->first; + VISU::ColoredPrs3d::TimeStampInfo anInfo; + anInfo.myNumber = aTimeStampNumber; + anInfo.myTime = aTime.c_str(); + aTimeStampsRange[aCounter] = anInfo; + } + } + return aTimeStampsRange._retn(); +} //---------------------------------------------------------------------------- CORBA::Long diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 6f03e81e..9c28c902 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -82,6 +82,10 @@ namespace VISU CORBA::Long GetTimeStampNumber(); + virtual + VISU::ColoredPrs3d::TimeStampsRange* + GetTimeStampsRange(); + //---------------------------------------------------------------------------- virtual CORBA::Long diff --git a/src/VISU_SWIG/visu_change_input.py b/src/VISU_SWIG/visu_change_input.py index 44c42850..fed21181 100644 --- a/src/VISU_SWIG/visu_change_input.py +++ b/src/VISU_SWIG/visu_change_input.py @@ -49,6 +49,12 @@ def WalkTroughTimeStamps(theVISUType, print "\ttheFieldName = '%s'" % theFieldName print "\ttheTimeStampNumber = %s" % theTimeStampNumber return + + aRange = aPrs3d.GetTimeStampsRange() + for anInfo in aRange: + print "%d (%s); " % (anInfo.myNumber, anInfo.myTime), + pass + print aView = theViewManager.Create3DView(); aView.SetTitle("To test presentation of %s type" % theVISUType) @@ -56,7 +62,7 @@ def WalkTroughTimeStamps(theVISUType, aView.FitAll() aDelay = 0.0 - for aTimeStampNumber in xrange(1,3): + for aTimeStampNumber in xrange(1,7): aPrs3d.SetTimeStampNumber(aTimeStampNumber) aPrs3d.Apply() aView.Update(); @@ -81,7 +87,7 @@ PRS3D_TYPE_LIST.append(VISU.TSCALARMAPONDEFORMEDSHAPE) #--------------------------------------------------------------- aMedFile = "TimeStamps.med" -aMedFile = "ResOK_0000.med" +#aMedFile = "ResOK_0000.med" aMedFile = os.getenv('DATA_DIR') + '/MedFiles/' + aMedFile aResult = myVisu.ImportFile(aMedFile)