mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
@ -177,14 +177,20 @@ void Foam::runTimePostProcessing::write()
|
|||||||
surfaces_[i].addGeometryToScene(0, renderer);
|
surfaces_[i].addGeometryToScene(0, renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the text
|
||||||
|
forAll(text_, i)
|
||||||
|
{
|
||||||
|
text_[i].addGeometryToScene(0, renderer);
|
||||||
|
}
|
||||||
|
|
||||||
while (scene_.loop(renderer))
|
while (scene_.loop(renderer))
|
||||||
{
|
{
|
||||||
scalar position = scene_.position();
|
scalar position = scene_.position();
|
||||||
|
|
||||||
// Add the text
|
// Update the text
|
||||||
forAll(text_, i)
|
forAll(text_, i)
|
||||||
{
|
{
|
||||||
text_[i].addGeometryToScene(position, renderer);
|
text_[i].updateActors(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the points
|
// Update the points
|
||||||
|
|||||||
@ -67,14 +67,18 @@ void Foam::scene::readCamera(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict.readIfPresent("startPosition", position_))
|
if (dict.readIfPresent("startPosition", startPosition_))
|
||||||
{
|
{
|
||||||
if ((position_ < 0) || (position_ > 1))
|
if ((startPosition_ < 0) || (startPosition_ > 1))
|
||||||
{
|
{
|
||||||
FatalIOErrorInFunction(dict)
|
FatalIOErrorInFunction(dict)
|
||||||
<< "startPosition must be in the range 0-1"
|
<< "startPosition must be in the range 0-1"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
position_ = startPosition_;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +93,7 @@ void Foam::scene::readCamera(const dictionary& dict)
|
|||||||
<< "endPosition must be in the range 0-1"
|
<< "endPosition must be in the range 0-1"
|
||||||
<< exit(FatalIOError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
dPosition_ = (endPosition - position_)/scalar(nFrameTotal_ - 1);
|
dPosition_ = (endPosition - startPosition_)/scalar(nFrameTotal_ - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
mode_ = modeTypeNames_.read(dict.lookup("mode"));
|
mode_ = modeTypeNames_.read(dict.lookup("mode"));
|
||||||
@ -111,12 +115,6 @@ void Foam::scene::readCamera(const dictionary& dict)
|
|||||||
);
|
);
|
||||||
const vector up(coeffs.lookup("up"));
|
const vector up(coeffs.lookup("up"));
|
||||||
cameraUp_.reset(new Constant<point>("up", up));
|
cameraUp_.reset(new Constant<point>("up", up));
|
||||||
if (nFrameTotal_ > 1)
|
|
||||||
{
|
|
||||||
WarningInFunction
|
|
||||||
<< "Static mode with nFrames > 1 - please check your setup"
|
|
||||||
<< endl;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case mtFlightPath:
|
case mtFlightPath:
|
||||||
@ -296,6 +294,7 @@ Foam::scene::scene(const objectRegistry& obr, const word& name)
|
|||||||
clipBox_(),
|
clipBox_(),
|
||||||
parallelProjection_(true),
|
parallelProjection_(true),
|
||||||
nFrameTotal_(1),
|
nFrameTotal_(1),
|
||||||
|
startPosition_(0),
|
||||||
position_(0),
|
position_(0),
|
||||||
dPosition_(0),
|
dPosition_(0),
|
||||||
currentFrameI_(0),
|
currentFrameI_(0),
|
||||||
@ -354,14 +353,15 @@ bool Foam::scene::loop(vtkRenderer* renderer)
|
|||||||
|
|
||||||
currentFrameI_++;
|
currentFrameI_++;
|
||||||
|
|
||||||
if (position_ > (1 + 0.5*dPosition_))
|
// Warning only if camera is in flight mode
|
||||||
|
if ((mode_ == mtFlightPath) && (position_ > (1 + 0.5*dPosition_)))
|
||||||
{
|
{
|
||||||
WarningInFunction
|
WarningInFunction
|
||||||
<< "Current position exceeded 1 - please check your setup"
|
<< "Current position "<< position_ <<" exceeded 1 - please check your setup"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
position_ += dPosition_;
|
position_ = startPosition_ + currentFrameI_*dPosition_;
|
||||||
|
|
||||||
if (currentFrameI_ < nFrameTotal_)
|
if (currentFrameI_ < nFrameTotal_)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -134,6 +134,9 @@ protected:
|
|||||||
//- Number of frames
|
//- Number of frames
|
||||||
label nFrameTotal_;
|
label nFrameTotal_;
|
||||||
|
|
||||||
|
//- startPosition [0-1]
|
||||||
|
scalar startPosition_;
|
||||||
|
|
||||||
//- Position [0-1]
|
//- Position [0-1]
|
||||||
scalar position_;
|
scalar position_;
|
||||||
|
|
||||||
|
|||||||
@ -47,7 +47,8 @@ Foam::text::text
|
|||||||
position_(dict.lookup("position")),
|
position_(dict.lookup("position")),
|
||||||
size_(readScalar(dict.lookup("size"))),
|
size_(readScalar(dict.lookup("size"))),
|
||||||
colour_(NULL),
|
colour_(NULL),
|
||||||
bold_(readBool(dict.lookup("bold")))
|
bold_(readBool(dict.lookup("bold"))),
|
||||||
|
timeStamp_(dict.lookupOrDefault<bool>("timeStamp", false))
|
||||||
{
|
{
|
||||||
if (dict.found("colour"))
|
if (dict.found("colour"))
|
||||||
{
|
{
|
||||||
@ -81,7 +82,13 @@ void Foam::text::addGeometryToScene
|
|||||||
|
|
||||||
vtkSmartPointer<vtkTextActor> actor = vtkSmartPointer<vtkTextActor>::New();
|
vtkSmartPointer<vtkTextActor> actor = vtkSmartPointer<vtkTextActor>::New();
|
||||||
|
|
||||||
actor->SetInput(string_.c_str());
|
// Concatenate string with timeStamp if true
|
||||||
|
string textAndTime = string_;
|
||||||
|
if (timeStamp_)
|
||||||
|
{
|
||||||
|
textAndTime = textAndTime + " " + geometryBase::parent_.obr().time().timeName();
|
||||||
|
}
|
||||||
|
actor->SetInput(textAndTime.c_str());
|
||||||
actor->GetTextProperty()->SetFontFamilyToArial();
|
actor->GetTextProperty()->SetFontFamilyToArial();
|
||||||
actor->GetTextProperty()->SetFontSize(size_);
|
actor->GetTextProperty()->SetFontSize(size_);
|
||||||
actor->GetTextProperty()->SetJustificationToLeft();
|
actor->GetTextProperty()->SetJustificationToLeft();
|
||||||
|
|||||||
@ -25,6 +25,23 @@ Class
|
|||||||
Foam::text
|
Foam::text
|
||||||
|
|
||||||
Description
|
Description
|
||||||
|
Example of text object specification:
|
||||||
|
\verbatim
|
||||||
|
text1
|
||||||
|
{
|
||||||
|
string "text to display";
|
||||||
|
position (0.1 0.05);
|
||||||
|
size 18;
|
||||||
|
bold yes;
|
||||||
|
visible yes;
|
||||||
|
|
||||||
|
// Optionally override default colour
|
||||||
|
// colour (0 1 1);
|
||||||
|
|
||||||
|
// Optional entry
|
||||||
|
timeStamp yes; //Append solution time to string
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
text.C
|
text.C
|
||||||
@ -82,6 +99,9 @@ protected:
|
|||||||
//- Bold flag
|
//- Bold flag
|
||||||
bool bold_;
|
bool bold_;
|
||||||
|
|
||||||
|
//- Time stamp flag
|
||||||
|
bool timeStamp_;
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user