Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VVisCommand Class Reference

#include <G4VVisCommand.hh>

+ Inheritance diagram for G4VVisCommand:

Public Member Functions

 G4VVisCommand ()
 
virtual ~G4VVisCommand ()
 
- Public Member Functions inherited from G4UImessenger
 G4UImessenger ()=default
 
 G4UImessenger (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
virtual ~G4UImessenger ()
 
virtual G4String GetCurrentValue (G4UIcommand *command)
 
virtual void SetNewValue (G4UIcommand *command, G4String newValue)
 
G4bool operator== (const G4UImessenger &messenger) const
 
G4bool operator!= (const G4UImessenger &messenger) const
 
G4bool CommandsShouldBeInMaster () const
 

Static Public Member Functions

static G4VisManagerGetVisManager ()
 
static void SetVisManager (G4VisManager *pVisManager)
 
static const G4ColourGetCurrentTextColour ()
 

Protected Member Functions

void SetViewParameters (G4VViewer *viewer, const G4ViewParameters &viewParams)
 
void RefreshIfRequired (G4VViewer *viewer)
 
void InterpolateViews (G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
void InterpolateToNewView (G4VViewer *currentViewer, const G4ViewParameters &oldVP, const G4ViewParameters &newVP, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")
 
void Twinkle (G4VViewer *currentViewer, const G4ViewParameters &baseVP, const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &paths)
 
const G4StringConvertToColourGuidance ()
 
void ConvertToColour (G4Colour &colour, const G4String &redOrString, G4double green, G4double blue, G4double opacity)
 
G4bool ProvideValueOfUnit (const G4String &where, const G4String &unit, const G4String &category, G4double &value)
 
void CopyCameraParameters (G4ViewParameters &target, const G4ViewParameters &from)
 
void CheckSceneAndNotifyHandlers (G4Scene *=nullptr)
 
G4bool CheckView ()
 
void G4VisCommandsSceneAddUnsuccessful (G4VisManager::Verbosity verbosity)
 
void CopyGuidanceFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd, G4int startLine=0)
 
void CopyParametersFrom (const G4UIcommand *fromCmd, G4UIcommand *toCmd)
 
void DrawExtent (const G4VisExtent &)
 
- Protected Member Functions inherited from G4UImessenger
G4String ItoS (G4int i)
 
G4String DtoS (G4double a)
 
G4String BtoS (G4bool b)
 
G4int StoI (const G4String &s)
 
G4long StoL (const G4String &s)
 
G4double StoD (const G4String &s)
 
G4bool StoB (G4String s)
 
void AddUIcommand (G4UIcommand *newCommand)
 
void CreateDirectory (const G4String &path, const G4String &dsc, G4bool commandsToBeBroadcasted=true)
 
template<typename T >
T * CreateCommand (const G4String &cname, const G4String &dsc)
 

Static Protected Member Functions

static G4String ConvertToString (G4double x, G4double y, const char *unitName)
 
static G4bool ConvertToDoublePair (const G4String &paramString, G4double &xval, G4double &yval)
 

Static Protected Attributes

static G4VisManagerfpVisManager = nullptr
 
static G4int fCurrentArrow3DLineSegmentsPerCircle = 6
 
static G4Colour fCurrentColour = G4Colour::White()
 
static G4double fCurrentLineWidth = 1.
 
static G4Colour fCurrentTextColour = G4Colour::Blue()
 
static G4Text::Layout fCurrentTextLayout = G4Text::left
 
static G4double fCurrentTextSize = 12.
 
static G4PhysicalVolumeModel::TouchableProperties fCurrentTouchableProperties
 
static G4VisExtent fCurrentExtentForField
 
static std::vector< G4PhysicalVolumesSearchScene::FindingsfCurrrentPVFindingsForField
 
static G4bool fThereWasAViewer = false
 
static G4ViewParameters fExistingVP
 

Additional Inherited Members

- Protected Attributes inherited from G4UImessenger
G4UIdirectorybaseDir = nullptr
 
G4String baseDirName = ""
 
G4bool commandsShouldBeInMaster = false
 

Detailed Description

Definition at line 47 of file G4VVisCommand.hh.

Constructor & Destructor Documentation

◆ G4VVisCommand()

G4VVisCommand::G4VVisCommand ( )

Definition at line 59 of file G4VVisCommand.cc.

59{}

◆ ~G4VVisCommand()

G4VVisCommand::~G4VVisCommand ( )
virtual

Definition at line 61 of file G4VVisCommand.cc.

61{}

Member Function Documentation

◆ CheckSceneAndNotifyHandlers()

void G4VVisCommand::CheckSceneAndNotifyHandlers ( G4Scene pScene = nullptr)
protected

Definition at line 212 of file G4VVisCommand.cc.

213{
215
216 if (!pScene) {
217 if (verbosity >= G4VisManager::warnings) {
218 G4warn << "WARNING: Scene pointer is null."
219 << G4endl;
220 }
221 return;
222 }
223
224 G4VSceneHandler* pSceneHandler = fpVisManager -> GetCurrentSceneHandler();
225 if (!pSceneHandler) {
226 if (verbosity >= G4VisManager::warnings) {
227 G4warn << "WARNING: Scene handler not found." << G4endl;
228 }
229 return;
230 }
231
232 // Scene has changed. If it is the scene of the currrent scene handler
233 // refresh viewers of all scene handlers using this scene. If not, it may be
234 // a scene that the user is building up before attaching to a scene handler,
235 // so do nothing.
236 if (pScene == pSceneHandler->GetScene()) {
237 G4UImanager::GetUIpointer () -> ApplyCommand ("/vis/scene/notifyHandlers");
238 }
239
240}
#define G4warn
Definition: G4Scene.cc:41
#define G4endl
Definition: G4ios.hh:57
static G4UImanager * GetUIpointer()
Definition: G4UImanager.cc:77
G4Scene * GetScene() const
static G4VisManager * fpVisManager
static Verbosity GetVerbosity()

Referenced by G4VisCommandSceneActivateModel::SetNewValue(), G4VisCommandSceneRemoveModel::SetNewValue(), G4VisCommandSceneSelect::SetNewValue(), G4VisCommandSceneAddArrow::SetNewValue(), G4VisCommandSceneAddArrow2D::SetNewValue(), G4VisCommandSceneAddAxes::SetNewValue(), G4VisCommandSceneAddDate::SetNewValue(), G4VisCommandSceneAddDigis::SetNewValue(), G4VisCommandSceneAddEventID::SetNewValue(), G4VisCommandSceneAddExtent::SetNewValue(), G4VisCommandSceneAddElectricField::SetNewValue(), G4VisCommandSceneAddFrame::SetNewValue(), G4VisCommandSceneAddGPS::SetNewValue(), G4VisCommandSceneAddHits::SetNewValue(), G4VisCommandSceneAddLine::SetNewValue(), G4VisCommandSceneAddLine2D::SetNewValue(), G4VisCommandSceneAddLocalAxes::SetNewValue(), G4VisCommandSceneAddLogicalVolume::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddLogo2D::SetNewValue(), G4VisCommandSceneAddMagneticField::SetNewValue(), G4VisCommandSceneAddPSHits::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSceneAddText::SetNewValue(), G4VisCommandSceneAddText2D::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneAddUserAction::SetNewValue(), G4VisCommandSceneAddVolume::SetNewValue(), G4VisCommandSceneAddPlotter::SetNewValue(), and G4VisCommandViewerRefresh::SetNewValue().

◆ CheckView()

G4bool G4VVisCommand::CheckView ( )
protected

Definition at line 242 of file G4VVisCommand.cc.

243{
245 G4VViewer* viewer = fpVisManager -> GetCurrentViewer ();
246
247 if (!viewer) {
248 if (verbosity >= G4VisManager::errors) {
249 G4warn <<
250 "ERROR: No current viewer - \"/vis/viewer/list\" to see possibilities."
251 << G4endl;
252 }
253 return false;
254 }
255
256 return true;
257}

◆ ConvertToColour()

void G4VVisCommand::ConvertToColour ( G4Colour colour,
const G4String redOrString,
G4double  green,
G4double  blue,
G4double  opacity 
)
protected

Definition at line 124 of file G4VVisCommand.cc.

127{
128 // Note: colour is supplied by the caller and some or all of its components
129 // may act as default.
130 //
131 // Note: redOrString is either a number or string. If a string it must be
132 // one of the recognised colours.
133 //
134 // Thus the arguments can be, for example:
135 // (colour,"red",...,...,0.5): will give the colour red with opacity 0.5 (the
136 // third and fourth arguments are ignored), or
137 // (1.,0.,0.,0.5): this also will be red with opacity 0.5.
138
140
141 const std::size_t iPos0 = 0;
142 if (std::isalpha(redOrString[iPos0])) {
143
144 // redOrString is probably alphabetic characters defining the colour
145 if (!G4Colour::GetColour(redOrString, colour)) {
146 // Not a recognised string
147 if (verbosity >= G4VisManager::warnings) {
148 G4warn << "WARNING: Colour \"" << redOrString
149 << "\" not found. Defaulting to " << colour
150 << G4endl;
151 }
152 return;
153 } else {
154 // It was a recognised string. Now add opacity.
155 colour.SetAlpha(opacity);
156 return;
157 }
158
159 } else {
160
161 // redOrString is probably numeric defining the red component
162 std::istringstream iss(redOrString);
163 G4double red;
164 iss >> red;
165 if (iss.fail()) {
166 if (verbosity >= G4VisManager::warnings) {
167 G4warn << "WARNING: String \"" << redOrString
168 << "\" cannot be parsed. Defaulting to " << colour
169 << G4endl;
170 }
171 return;
172 } else {
173 colour = G4Colour(red,green,blue,opacity);
174 return;
175 }
176
177 }
178}
double G4double
Definition: G4Types.hh:83
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:155
void SetAlpha(G4double)
Definition: G4Colour.cc:70

Referenced by G4VisCommandGeometrySetColour::SetNewValue(), G4VisCommandSceneAddGPS::SetNewValue(), G4VisCommandSetColour::SetNewValue(), G4VisCommandSetTextColour::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), and G4VisCommandsViewerSet::SetNewValue().

◆ ConvertToColourGuidance()

const G4String & G4VVisCommand::ConvertToColourGuidance ( )
protected

Definition at line 114 of file G4VVisCommand.cc.

115{
116 static G4String guidance
117 ("Accepts (a) RGB triplet. e.g., \".3 .4 .5\", or"
118 "\n (b) string such as \"white\", \"black\", \"grey\", \"red\"...or"
119 "\n (c) an additional number for opacity, e.g., \".3 .4 .5 .6\""
120 "\n or \"grey ! ! .6\" (note \"!\"'s for unused parameters).");
121 return guidance;
122}

Referenced by G4VisCommandSceneAddGPS::G4VisCommandSceneAddGPS(), G4VisCommandSetColour::G4VisCommandSetColour(), G4VisCommandSetTextColour::G4VisCommandSetTextColour(), G4VisCommandsTouchableSet::G4VisCommandsTouchableSet(), and G4VisCommandsViewerSet::G4VisCommandsViewerSet().

◆ ConvertToDoublePair()

G4bool G4VVisCommand::ConvertToDoublePair ( const G4String paramString,
G4double xval,
G4double yval 
)
staticprotected

Definition at line 90 of file G4VVisCommand.cc.

93{
94 G4double x, y;
95 G4String unit;
96
97 std::istringstream is(paramString);
98 is >> x >> y >> unit;
99
101 xval = x*G4UIcommand::ValueOf(unit);
102 yval = y*G4UIcommand::ValueOf(unit);
103 } else {
105 if (verbosity >= G4VisManager::errors) {
106 G4warn << "ERROR: Unrecognised unit" << G4endl;
107 }
108 return false;
109 }
110
111 return true;
112}
static G4double ValueOf(const char *unitName)
Definition: G4UIcommand.cc:362
static G4bool IsUnitDefined(const G4String &)

Referenced by G4VisCommandViewerPan::SetNewValue(), and G4VisCommandsViewerSet::SetNewValue().

◆ ConvertToString()

G4String G4VVisCommand::ConvertToString ( G4double  x,
G4double  y,
const char *  unitName 
)
staticprotected

Definition at line 80 of file G4VVisCommand.cc.

82{
83 G4double uv = G4UIcommand::ValueOf(unitName);
84
85 std::ostringstream oss;
86 oss << x/uv << " " << y/uv << " " << unitName;
87 return oss.str();
88}

Referenced by G4VisCommandViewerPan::GetCurrentValue().

◆ CopyCameraParameters()

void G4VVisCommand::CopyCameraParameters ( G4ViewParameters target,
const G4ViewParameters from 
)
protected

Definition at line 435 of file G4VVisCommand.cc.

437{
438 // Copy view parameters pertaining only to camera
442 target.SetUpVector (from.GetUpVector());
443 target.SetFieldHalfAngle (from.GetFieldHalfAngle());
444 target.SetZoomFactor (from.GetZoomFactor());
445 target.SetScaleFactor (from.GetScaleFactor());
447 target.SetDolly (from.GetDolly());
448}
void SetViewpointDirection(const G4Vector3D &viewpointDirection)
void SetScaleFactor(const G4Vector3D &scaleFactor)
const G4Vector3D & GetScaleFactor() const
void SetCurrentTargetPoint(const G4Point3D &currentTargetPoint)
const G4Vector3D & GetLightpointDirection() const
void SetFieldHalfAngle(G4double fieldHalfAngle)
const G4Vector3D & GetViewpointDirection() const
const G4Point3D & GetCurrentTargetPoint() const
G4double GetFieldHalfAngle() const
G4double GetZoomFactor() const
void SetDolly(G4double dolly)
const G4Vector3D & GetUpVector() const
void SetZoomFactor(G4double zoomFactor)
void SetUpVector(const G4Vector3D &upVector)
void SetLightpointDirection(const G4Vector3D &lightpointDirection)
void SetLightsMoveWithCamera(G4bool moves)
G4bool GetLightsMoveWithCamera() const
G4double GetDolly() const

Referenced by G4VisCommandViewerCopyViewFrom::SetNewValue(), and G4VisCommandViewerResetCameraParameters::SetNewValue().

◆ CopyGuidanceFrom()

void G4VVisCommand::CopyGuidanceFrom ( const G4UIcommand fromCmd,
G4UIcommand toCmd,
G4int  startLine = 0 
)
protected

Definition at line 396 of file G4VVisCommand.cc.

398{
399 if (fromCmd && toCmd) {
400 const G4int nGuideEntries = (G4int)fromCmd->GetGuidanceEntries();
401 for (G4int i = startLine; i < nGuideEntries; ++i) {
402 const G4String& guidance = fromCmd->GetGuidanceLine(i);
403 toCmd->SetGuidance(guidance);
404 }
405 }
406}
int G4int
Definition: G4Types.hh:85
const G4String & GetGuidanceLine(G4int i) const
Definition: G4UIcommand.hh:133
void SetGuidance(const char *aGuidance)
Definition: G4UIcommand.hh:157
std::size_t GetGuidanceEntries() const
Definition: G4UIcommand.hh:129

Referenced by G4VisCommandDrawLogicalVolume::G4VisCommandDrawLogicalVolume(), G4VisCommandDrawVolume::G4VisCommandDrawVolume(), G4VisCommandOpen::G4VisCommandOpen(), G4VisCommandSceneAddMagneticField::G4VisCommandSceneAddMagneticField(), G4VisCommandsTouchable::G4VisCommandsTouchable(), and G4VisCommandViewerCentreOn::G4VisCommandViewerCentreOn().

◆ CopyParametersFrom()

void G4VVisCommand::CopyParametersFrom ( const G4UIcommand fromCmd,
G4UIcommand toCmd 
)
protected

Definition at line 408 of file G4VVisCommand.cc.

410{
411 if (fromCmd && toCmd) {
412 const G4int nParEntries = (G4int)fromCmd->GetParameterEntries();
413 for (G4int i = 0; i < nParEntries; ++i) {
414 G4UIparameter* parameter = new G4UIparameter(*(fromCmd->GetParameter(i)));
415 toCmd->SetParameter(parameter);
416 }
417 }
418}
std::size_t GetParameterEntries() const
Definition: G4UIcommand.hh:139
G4UIparameter * GetParameter(G4int i) const
Definition: G4UIcommand.hh:140
void SetParameter(G4UIparameter *const newParameter)
Definition: G4UIcommand.hh:147

Referenced by G4VisCommandDrawLogicalVolume::G4VisCommandDrawLogicalVolume(), G4VisCommandDrawVolume::G4VisCommandDrawVolume(), G4VisCommandSceneAddMagneticField::G4VisCommandSceneAddMagneticField(), and G4VisCommandViewerCentreOn::G4VisCommandViewerCentreOn().

◆ DrawExtent()

void G4VVisCommand::DrawExtent ( const G4VisExtent extent)
protected

Definition at line 420 of file G4VVisCommand.cc.

421{
422 if (fpVisManager) {
423 const G4double halfX = (extent.GetXmax() - extent.GetXmin()) / 2.;
424 const G4double halfY = (extent.GetYmax() - extent.GetYmin()) / 2.;
425 const G4double halfZ = (extent.GetZmax() - extent.GetZmin()) / 2.;
426 if (halfX > 0. && halfY > 0. && halfZ > 0.) {
427 const G4Box box("vis_extent",halfX,halfY,halfZ);
428 const G4VisAttributes visAtts(G4Color::Red());
429 const G4Point3D& centre = extent.GetExtentCenter();
430 fpVisManager->Draw(box,visAtts,G4Translate3D(centre));
431 }
432 }
433}
HepGeom::Translate3D G4Translate3D
Definition: G4Box.hh:56
static G4Colour Red()
Definition: G4Colour.hh:161
G4double GetYmin() const
Definition: G4VisExtent.hh:101
G4double GetXmax() const
Definition: G4VisExtent.hh:100
const G4Point3D & GetExtentCenter() const
Definition: G4VisExtent.hh:106
G4double GetYmax() const
Definition: G4VisExtent.hh:102
G4double GetZmax() const
Definition: G4VisExtent.hh:104
G4double GetZmin() const
Definition: G4VisExtent.hh:103
G4double GetXmin() const
Definition: G4VisExtent.hh:99
void Draw(const G4Circle &, const G4Transform3D &objectTransformation=G4Transform3D())

Referenced by G4VisCommandSceneShowExtents::SetNewValue(), G4VisCommandSetVolumeForField::SetNewValue(), and G4VisCommandsTouchable::SetNewValue().

◆ G4VisCommandsSceneAddUnsuccessful()

void G4VVisCommand::G4VisCommandsSceneAddUnsuccessful ( G4VisManager::Verbosity  verbosity)
protected

◆ GetCurrentTextColour()

const G4Colour & G4VVisCommand::GetCurrentTextColour ( )
static

Definition at line 75 of file G4VVisCommand.cc.

76{
77 return fCurrentTextColour;
78}
static G4Colour fCurrentTextColour

◆ GetVisManager()

◆ InterpolateToNewView()

void G4VVisCommand::InterpolateToNewView ( G4VViewer currentViewer,
const G4ViewParameters oldVP,
const G4ViewParameters newVP,
const G4int  nInterpolationPoints = 50,
const G4int  waitTimePerPointmilliseconds = 20,
const G4String  exportString = "" 
)
protected

Definition at line 318 of file G4VVisCommand.cc.

325{
326 std::vector<G4ViewParameters> viewVector;
327 viewVector.push_back(oldVP);
328 viewVector.push_back(oldVP);
329 viewVector.push_back(newVP);
330 viewVector.push_back(newVP);
331
333 (currentViewer,
334 viewVector,
335 nInterpolationPoints,
336 waitTimePerPointmilliseconds,
337 exportString);
338}
void InterpolateViews(G4VViewer *currentViewer, std::vector< G4ViewParameters > viewVector, const G4int nInterpolationPoints=50, const G4int waitTimePerPointmilliseconds=20, const G4String exportString="")

Referenced by G4VisCommandsTouchable::SetNewValue(), and G4VisCommandViewerCentreOn::SetNewValue().

◆ InterpolateViews()

void G4VVisCommand::InterpolateViews ( G4VViewer currentViewer,
std::vector< G4ViewParameters viewVector,
const G4int  nInterpolationPoints = 50,
const G4int  waitTimePerPointmilliseconds = 20,
const G4String  exportString = "" 
)
protected

Definition at line 293 of file G4VVisCommand.cc.

299{
300 const G4int safety = (G4int)viewVector.size()*nInterpolationPoints;
301 G4int safetyCount = 0;
302 do {
303 G4ViewParameters* vp =
304 G4ViewParameters::CatmullRomCubicSplineInterpolation(viewVector,nInterpolationPoints);
305 if (!vp) break; // Finished.
306 currentViewer->SetViewParameters(*vp);
307 currentViewer->RefreshView();
308 if (exportString == "export" &&
309 G4StrUtil::contains(currentViewer->GetName(), "OpenGL")) {
310 G4UImanager::GetUIpointer()->ApplyCommand("/vis/ogl/export");
311 }
312 currentViewer->ShowView();
313 if (waitTimePerPointmilliseconds > 0)
314 std::this_thread::sleep_for(std::chrono::milliseconds(waitTimePerPointmilliseconds));
315 } while (safetyCount++ < safety); // Loop checking, 16.02.2016, J.Allison
316}
G4int ApplyCommand(const char *aCommand)
Definition: G4UImanager.cc:495
const G4String & GetName() const
void SetViewParameters(const G4ViewParameters &vp)
Definition: G4VViewer.cc:126
void RefreshView()
virtual void ShowView()
Definition: G4VViewer.cc:105
static G4ViewParameters * CatmullRomCubicSplineInterpolation(const std::vector< G4ViewParameters > &views, G4int nInterpolationPoints=50)
G4bool contains(const G4String &str, std::string_view ss)
Check if a string contains a given substring.

Referenced by InterpolateToNewView(), and G4VisCommandViewerInterpolate::SetNewValue().

◆ ProvideValueOfUnit()

G4bool G4VVisCommand::ProvideValueOfUnit ( const G4String where,
const G4String unit,
const G4String category,
G4double value 
)
protected

Definition at line 180 of file G4VVisCommand.cc.

185{
186 // Return false if there's a problem
187
189
190 G4bool success = true;
192 if (verbosity >= G4VisManager::warnings) {
193 G4warn << where
194 << "\n Unit \"" << unit << "\" not defined"
195 << G4endl;
196 }
197 success = false;
198 } else if (G4UnitDefinition::GetCategory(unit) != category) {
199 if (verbosity >= G4VisManager::warnings) {
200 G4warn << where
201 << "\n Unit \"" << unit << "\" not a unit of " << category;
202 if (category == "Volumic Mass") G4warn << " (density)";
203 G4warn << G4endl;
204 }
205 success = false;
206 } else {
207 value = G4UnitDefinition::GetValueOf(unit);
208 }
209 return success;
210}
bool G4bool
Definition: G4Types.hh:86
static G4double GetValueOf(const G4String &)
static G4String GetCategory(const G4String &)

Referenced by G4VisCommandViewerColourByDensity::SetNewValue(), and G4VisCommandsViewerSet::SetNewValue().

◆ RefreshIfRequired()

void G4VVisCommand::RefreshIfRequired ( G4VViewer viewer)
protected

Definition at line 276 of file G4VVisCommand.cc.

276 {
278 G4VSceneHandler* sceneHandler = viewer->GetSceneHandler();
279 const G4ViewParameters& viewParams = viewer->GetViewParameters();
280 if (sceneHandler && sceneHandler->GetScene()) {
281 if (viewParams.IsAutoRefresh()) {
282 G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/refresh");
283 }
284 else {
285 if (verbosity >= G4VisManager::warnings) {
286 G4warn << "Issue /vis/viewer/refresh or flush to see effect."
287 << G4endl;
288 }
289 }
290 }
291}
const G4ViewParameters & GetViewParameters() const
G4VSceneHandler * GetSceneHandler() const
G4bool IsAutoRefresh() const

Referenced by G4VisCommandViewerRebuild::SetNewValue(), G4VisCommandViewerReset::SetNewValue(), G4VisCommandViewerResetCameraParameters::SetNewValue(), G4VisCommandViewerSelect::SetNewValue(), and SetViewParameters().

◆ SetViewParameters()

◆ SetVisManager()

void G4VVisCommand::SetVisManager ( G4VisManager pVisManager)
static

Definition at line 70 of file G4VVisCommand.cc.

71{
72 fpVisManager = pVisManager;
73}

Referenced by G4VisManager::G4VisManager().

◆ Twinkle()

void G4VVisCommand::Twinkle ( G4VViewer currentViewer,
const G4ViewParameters baseVP,
const std::vector< std::vector< G4PhysicalVolumeModel::G4PhysicalVolumeNodeID > > &  paths 
)
protected

Definition at line 340 of file G4VVisCommand.cc.

346{
347 // Copy view parameters to temporary variables ready for adding VisAttributes Modifiers (VAMs)
348 auto loVP = baseVP; // For black and solid VAMs
349 auto hiVP = baseVP; // For white and solid VAMs
350
351 // Modify them with vis attribute modifiers (VAMs)
352 for (const auto& path: paths) {
353 const auto& touchable = path.back().GetPhysicalVolume();
354 auto loVisAtts
355 = *(currentViewer->GetApplicableVisAttributes
356 (touchable->GetLogicalVolume()->GetVisAttributes()));
357 auto hiVisAtts = loVisAtts;
358 loVisAtts.SetColour(G4Colour::Black());
359 loVisAtts.SetForceSolid();
360 hiVisAtts.SetColour(G4Colour::White());
361 hiVisAtts.SetForceSolid();
362 auto pvNameCopyNoPath
364
366 (loVisAtts, G4ModelingParameters::VASColour, pvNameCopyNoPath);
367 loVP.AddVisAttributesModifier(loVAMColour);
369 (loVisAtts, G4ModelingParameters::VASForceSolid, pvNameCopyNoPath);
370 loVP.AddVisAttributesModifier(loVAMStyle);
371
373 (hiVisAtts, G4ModelingParameters::VASColour, pvNameCopyNoPath);
374 hiVP.AddVisAttributesModifier(hiVAMColour);
376 (hiVisAtts, G4ModelingParameters::VASForceSolid, pvNameCopyNoPath);
377 hiVP.AddVisAttributesModifier(hiVAMStyle);
378 }
379
380 // Twinkle
381 std::vector<G4ViewParameters> viewVector;
382 viewVector.push_back(loVP);
383 viewVector.push_back(hiVP);
384 viewVector.push_back(loVP);
385 viewVector.push_back(hiVP);
386 viewVector.push_back(loVP);
387 viewVector.push_back(hiVP);
388 viewVector.push_back(loVP);
389 viewVector.push_back(hiVP);
390 viewVector.push_back(loVP);
391 viewVector.push_back(hiVP);
392 // Just 5 interpolation points for a reasonable twinkle rate
393 InterpolateViews(currentViewer,viewVector,5);
394}
static G4Colour White()
Definition: G4Colour.hh:156
static G4Colour Black()
Definition: G4Colour.hh:159
static G4ModelingParameters::PVNameCopyNoPath GetPVNameCopyNoPath(const std::vector< G4PhysicalVolumeNodeID > &)
const G4VisAttributes * GetApplicableVisAttributes(const G4VisAttributes *) const

Referenced by G4VisCommandsTouchable::SetNewValue(), and G4VisCommandViewerCentreOn::SetNewValue().

Member Data Documentation

◆ fCurrentArrow3DLineSegmentsPerCircle

◆ fCurrentColour

◆ fCurrentExtentForField

◆ fCurrentLineWidth

◆ fCurrentTextColour

◆ fCurrentTextLayout

◆ fCurrentTextSize

G4double G4VVisCommand::fCurrentTextSize = 12.
staticprotected

◆ fCurrentTouchableProperties

◆ fCurrrentPVFindingsForField

◆ fExistingVP

G4ViewParameters G4VVisCommand::fExistingVP
staticprotected

◆ fpVisManager

G4VisManager * G4VVisCommand::fpVisManager = nullptr
staticprotected

Definition at line 146 of file G4VVisCommand.hh.

Referenced by CheckSceneAndNotifyHandlers(), CheckView(), ConvertToColour(), ConvertToDoublePair(), G4VVisCommandScene::CurrentSceneName(), DrawExtent(), G4VisCommandSceneHandlerCreate::G4VisCommandSceneHandlerCreate(), G4VisCommandOpen::GetCurrentValue(), G4VisCommandSceneHandlerAttach::GetCurrentValue(), G4VisCommandSceneHandlerCreate::GetCurrentValue(), G4VisCommandViewerClear::GetCurrentValue(), G4VisCommandViewerClearTransients::GetCurrentValue(), G4VisCommandViewerClone::GetCurrentValue(), G4VisCommandViewerCreate::GetCurrentValue(), G4VisCommandViewerFlush::GetCurrentValue(), G4VisCommandViewerRebuild::GetCurrentValue(), G4VisCommandViewerRefresh::GetCurrentValue(), G4VisCommandViewerReset::GetCurrentValue(), G4VisCommandViewerResetCameraParameters::GetCurrentValue(), G4VisCommandViewerUpdate::GetCurrentValue(), GetVisManager(), ProvideValueOfUnit(), RefreshIfRequired(), G4VVisCommandGeometrySet::Set(), G4VVisCommandGeometrySet::SetLVVisAtts(), G4VisCommandAbortReviewKeptEvents::SetNewValue(), G4VisCommandAbortReviewPlots::SetNewValue(), G4VisCommandDrawOnlyToBeKeptEvents::SetNewValue(), G4VisCommandEnable::SetNewValue(), G4VisCommandInitialize::SetNewValue(), G4VisCommandList::SetNewValue(), G4VisCommandReviewKeptEvents::SetNewValue(), G4VisCommandReviewPlots::SetNewValue(), G4VisCommandVerbose::SetNewValue(), G4VisCommandDrawTree::SetNewValue(), G4VisCommandDrawView::SetNewValue(), G4VisCommandDrawLogicalVolume::SetNewValue(), G4VisCommandDrawVolume::SetNewValue(), G4VisCommandOpen::SetNewValue(), G4VisCommandPlot::SetNewValue(), G4VisCommandSpecify::SetNewValue(), G4VisCommandGeometryList::SetNewValue(), G4VisCommandGeometryRestore::SetNewValue(), G4VisCommandGeometrySetDaughtersInvisible::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValue(), G4VisCommandSceneActivateModel::SetNewValue(), G4VisCommandSceneCreate::SetNewValue(), G4VisCommandSceneEndOfEventAction::SetNewValue(), G4VisCommandSceneEndOfRunAction::SetNewValue(), G4VisCommandSceneList::SetNewValue(), G4VisCommandSceneNotifyHandlers::SetNewValue(), G4VisCommandSceneRemoveModel::SetNewValue(), G4VisCommandSceneSelect::SetNewValue(), G4VisCommandSceneShowExtents::SetNewValue(), G4VisCommandSceneAddArrow::SetNewValue(), G4VisCommandSceneAddArrow2D::SetNewValue(), G4VisCommandSceneAddAxes::SetNewValue(), G4VisCommandSceneAddDate::SetNewValue(), G4VisCommandSceneAddDigis::SetNewValue(), G4VisCommandSceneAddEventID::SetNewValue(), G4VisCommandSceneAddExtent::SetNewValue(), G4VisCommandSceneAddElectricField::SetNewValue(), G4VisCommandSceneAddFrame::SetNewValue(), G4VisCommandSceneAddGPS::SetNewValue(), G4VisCommandSceneAddHits::SetNewValue(), G4VisCommandSceneAddLine::SetNewValue(), G4VisCommandSceneAddLine2D::SetNewValue(), G4VisCommandSceneAddLocalAxes::SetNewValue(), G4VisCommandSceneAddLogicalVolume::SetNewValue(), G4VisCommandSceneAddLogo::SetNewValue(), G4VisCommandSceneAddLogo2D::SetNewValue(), G4VisCommandSceneAddMagneticField::SetNewValue(), G4VisCommandSceneAddPSHits::SetNewValue(), G4VisCommandSceneAddScale::SetNewValue(), G4VisCommandSceneAddText::SetNewValue(), G4VisCommandSceneAddText2D::SetNewValue(), G4VisCommandSceneAddTrajectories::SetNewValue(), G4VisCommandSceneAddUserAction::SetNewValue(), G4VisCommandSceneAddVolume::SetNewValue(), G4VisCommandSceneAddPlotter::SetNewValue(), G4VisCommandSceneHandlerAttach::SetNewValue(), G4VisCommandSceneHandlerCreate::SetNewValue(), G4VisCommandSceneHandlerList::SetNewValue(), G4VisCommandSceneHandlerSelect::SetNewValue(), G4VisCommandSetArrow3DLineSegmentsPerCircle::SetNewValue(), G4VisCommandSetColour::SetNewValue(), G4VisCommandSetExtentForField::SetNewValue(), G4VisCommandSetLineWidth::SetNewValue(), G4VisCommandSetTextColour::SetNewValue(), G4VisCommandSetTextLayout::SetNewValue(), G4VisCommandSetTextSize::SetNewValue(), G4VisCommandSetTouchable::SetNewValue(), G4VisCommandSetVolumeForField::SetNewValue(), G4VisCommandsTouchable::SetNewValue(), G4VisCommandsTouchableSet::SetNewValue(), G4VisCommandViewerAddCutawayPlane::SetNewValue(), G4VisCommandViewerCentreOn::SetNewValue(), G4VisCommandViewerChangeCutawayPlane::SetNewValue(), G4VisCommandViewerClear::SetNewValue(), G4VisCommandViewerClearCutawayPlanes::SetNewValue(), G4VisCommandViewerClearTransients::SetNewValue(), G4VisCommandViewerClearVisAttributesModifiers::SetNewValue(), G4VisCommandViewerClone::SetNewValue(), G4VisCommandViewerColourByDensity::SetNewValue(), G4VisCommandViewerCopyViewFrom::SetNewValue(), G4VisCommandViewerCreate::SetNewValue(), G4VisCommandViewerDolly::SetNewValue(), G4VisCommandViewerFlush::SetNewValue(), G4VisCommandViewerInterpolate::SetNewValue(), G4VisCommandViewerList::SetNewValue(), G4VisCommandViewerPan::SetNewValue(), G4VisCommandViewerRebuild::SetNewValue(), G4VisCommandViewerRefresh::SetNewValue(), G4VisCommandViewerReset::SetNewValue(), G4VisCommandViewerResetCameraParameters::SetNewValue(), G4VisCommandViewerSave::SetNewValue(), G4VisCommandViewerScale::SetNewValue(), G4VisCommandViewerSelect::SetNewValue(), G4VisCommandViewerUpdate::SetNewValue(), G4VisCommandViewerZoom::SetNewValue(), G4VisCommandViewerDefaultHiddenEdge::SetNewValue(), G4VisCommandViewerDefaultStyle::SetNewValue(), G4VisCommandsViewerSet::SetNewValue(), G4VisCommandGeometrySetVisibility::SetNewValueOnLV(), and SetVisManager().

◆ fThereWasAViewer

G4bool G4VVisCommand::fThereWasAViewer = false
staticprotected

The documentation for this class was generated from the following files: