Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4Scene.cc 86360 2014-11-10 08:34:16Z gcosmo $
|
||||
// $Id: G4Scene.cc 99418 2016-09-21 09:18:42Z gcosmo $
|
||||
//
|
||||
//
|
||||
// Scene data John Allison 19th July 1996.
|
||||
@@ -170,7 +170,7 @@ G4bool G4Scene::AddWorldIfEmpty (G4bool warn) {
|
||||
"\n For a better view of the contents, mark the world as"
|
||||
" invisible, e.g.,"
|
||||
"\n myWorldLogicalVol ->"
|
||||
" SetVisAttributes (G4VisAttributes::Invisible);"
|
||||
" SetVisAttributes (G4VisAttributes::GetInvisible());"
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VGraphicsSystem.cc 93025 2015-09-30 16:02:12Z gcosmo $
|
||||
// $Id: G4VGraphicsSystem.cc 99418 2016-09-21 09:18:42Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 27th March 1996
|
||||
@@ -74,7 +74,7 @@ G4bool G4VGraphicsSystem::IsUISessionCompatible () const
|
||||
std::ostream& operator << (std::ostream& os, const G4VGraphicsSystem& gs)
|
||||
{
|
||||
os << "Graphics System: " << gs.GetName ();
|
||||
os << ", nicknames:"; for (auto&& nickname: gs.GetNicknames())
|
||||
os << ", nicknames:"; for (const auto& nickname: gs.GetNicknames())
|
||||
{os << ' ' << nickname;}
|
||||
os << "\n Description: " << gs.GetDescription ();
|
||||
os << "\n Functionality: ";
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VSceneHandler.cc 91686 2015-07-31 09:40:08Z gcosmo $
|
||||
// $Id: G4VSceneHandler.cc 101714 2016-11-22 08:53:13Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 19th July 1996
|
||||
@@ -56,12 +56,14 @@
|
||||
#include "G4TrajectoriesModel.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Trap.hh"
|
||||
#include "G4Sphere.hh"
|
||||
#include "G4Orb.hh"
|
||||
#include "G4Para.hh"
|
||||
#include "G4Sphere.hh"
|
||||
#include "G4Torus.hh"
|
||||
#include "G4Trap.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Ellipsoid.hh"
|
||||
#include "G4Polycone.hh"
|
||||
#include "G4Polyhedra.hh"
|
||||
#include "G4DisplacedSolid.hh"
|
||||
@@ -87,6 +89,7 @@
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4VVisCommand.hh"
|
||||
#include "G4PhysicalConstants.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
G4VSceneHandler::G4VSceneHandler (G4VGraphicsSystem& system, G4int id, const G4String& name):
|
||||
fSystem (system),
|
||||
@@ -213,59 +216,98 @@ void G4VSceneHandler::ClearStore () {}
|
||||
|
||||
void G4VSceneHandler::ClearTransientStore () {}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Box& box) {
|
||||
RequestPrimitives (box);
|
||||
// If your graphics system is sophisticated enough to handle a
|
||||
// particular solid shape as a primitive, in your derived class write a
|
||||
// function to override this. (Note: some compilers warn that your
|
||||
// function "hides" this one. That's OK.)
|
||||
// Your function might look like this...
|
||||
// void G4MyScene::AddSolid (const G4Box& box) {
|
||||
// Get parameters of appropriate object, e.g.:
|
||||
// G4double dx = box.GetXHalfLength ();
|
||||
// G4double dy = box.GetYHalfLength ();
|
||||
// G4double dz = box.GetZHalfLength ();
|
||||
// and Draw or Store in your display List.
|
||||
template <class T> void G4VSceneHandler::AddSolidT
|
||||
(const T& solid)
|
||||
{
|
||||
// Get and check applicable vis attributes.
|
||||
fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
|
||||
RequestPrimitives (solid);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Tubs& tubs) {
|
||||
RequestPrimitives (tubs);
|
||||
template <class T> void G4VSceneHandler::AddSolidWithAuxiliaryEdges
|
||||
(const T& solid)
|
||||
{
|
||||
// Get and check applicable vis attributes.
|
||||
fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
|
||||
// Draw with auxiliary edges unless otherwise specified.
|
||||
if (!fpVisAttribs->IsForceAuxEdgeVisible()) {
|
||||
// Create a vis atts object for the modified vis atts.
|
||||
// It is static so that we may return a reliable pointer to it.
|
||||
static G4VisAttributes visAttsWithAuxEdges;
|
||||
// Initialise it with the current vis atts and reset the pointer.
|
||||
visAttsWithAuxEdges = *fpVisAttribs;
|
||||
// Force auxiliary edges visible.
|
||||
visAttsWithAuxEdges.SetForceAuxEdgeVisible();
|
||||
fpVisAttribs = &visAttsWithAuxEdges;
|
||||
}
|
||||
RequestPrimitives (solid);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Box& box) {
|
||||
AddSolidT (box);
|
||||
// If your graphics system is sophisticated enough to handle a
|
||||
// particular solid shape as a primitive, in your derived class write a
|
||||
// function to override this.
|
||||
// Your function might look like this...
|
||||
// void G4MySceneHandler::AddSolid (const G4Box& box) {
|
||||
// Get and check applicable vis attributes.
|
||||
// fpVisAttribs = fpViewer->GetApplicableVisAttributes(fpVisAttribs);
|
||||
// Do not draw if not visible.
|
||||
// if (fpVisAttribs->IsVisible()) {
|
||||
// Get parameters of appropriate object, e.g.:
|
||||
// G4double dx = box.GetXHalfLength ();
|
||||
// G4double dy = box.GetYHalfLength ();
|
||||
// G4double dz = box.GetZHalfLength ();
|
||||
// ...
|
||||
// and Draw or Store in your display List.
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Cons& cons) {
|
||||
RequestPrimitives (cons);
|
||||
AddSolidT (cons);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Trd& trd) {
|
||||
RequestPrimitives (trd);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Trap& trap) {
|
||||
RequestPrimitives (trap);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Sphere& sphere) {
|
||||
RequestPrimitives (sphere );
|
||||
void G4VSceneHandler::AddSolid (const G4Orb& orb) {
|
||||
AddSolidWithAuxiliaryEdges (orb);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Para& para) {
|
||||
RequestPrimitives (para);
|
||||
AddSolidT (para);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Sphere& sphere) {
|
||||
AddSolidWithAuxiliaryEdges (sphere);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Torus& torus) {
|
||||
RequestPrimitives (torus);
|
||||
AddSolidWithAuxiliaryEdges (torus);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Trap& trap) {
|
||||
AddSolidT (trap);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Trd& trd) {
|
||||
AddSolidT (trd);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Tubs& tubs) {
|
||||
AddSolidT (tubs);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Ellipsoid& ellipsoid) {
|
||||
AddSolidWithAuxiliaryEdges (ellipsoid);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Polycone& polycone) {
|
||||
RequestPrimitives (polycone);
|
||||
AddSolidT (polycone);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4Polyhedra& polyhedra) {
|
||||
RequestPrimitives (polyhedra);
|
||||
AddSolidT (polyhedra);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddSolid (const G4VSolid& solid) {
|
||||
RequestPrimitives (solid);
|
||||
AddSolidT (solid);
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddCompound (const G4VTrajectory& traj) {
|
||||
@@ -300,11 +342,11 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
|
||||
G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
|
||||
if (mesh && mesh->IsActive()) {
|
||||
MeshScoreMap scoreMap = mesh->GetScoreMap();
|
||||
const G4String& mapNam = const_cast<G4THitsMap<G4double>&>(hits).GetName();
|
||||
for(MeshScoreMap::const_iterator i = scoreMap.begin();
|
||||
i != scoreMap.end(); ++i) {
|
||||
const G4String& scoreMapName = i->first;
|
||||
const G4THitsMap<G4double>* foundHits = i->second;
|
||||
if (foundHits == &hits) {
|
||||
if (scoreMapName == mapNam) {
|
||||
G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
|
||||
scoreMapHits = true;
|
||||
mesh->DrawMesh(scoreMapName, &colorMap);
|
||||
@@ -332,6 +374,48 @@ void G4VSceneHandler::AddCompound (const G4THitsMap<G4double>& hits) {
|
||||
}
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddCompound (const G4THitsMap<G4StatDouble>& hits) {
|
||||
//G4cout << "AddCompound: hits: " << &hits << G4endl;
|
||||
G4bool scoreMapHits = false;
|
||||
G4ScoringManager* scoringManager = G4ScoringManager::GetScoringManagerIfExist();
|
||||
if (scoringManager) {
|
||||
size_t nMeshes = scoringManager->GetNumberOfMesh();
|
||||
for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
|
||||
G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
|
||||
if (mesh && mesh->IsActive()) {
|
||||
MeshScoreMap scoreMap = mesh->GetScoreMap();
|
||||
for(MeshScoreMap::const_iterator i = scoreMap.begin();
|
||||
i != scoreMap.end(); ++i) {
|
||||
const G4String& scoreMapName = i->first;
|
||||
const G4THitsMap<G4StatDouble>* foundHits = i->second;
|
||||
if (foundHits == &hits) {
|
||||
G4DefaultLinearColorMap colorMap("G4VSceneHandlerColorMap");
|
||||
scoreMapHits = true;
|
||||
mesh->DrawMesh(scoreMapName, &colorMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (scoreMapHits) {
|
||||
static G4bool first = true;
|
||||
if (first) {
|
||||
first = false;
|
||||
G4cout <<
|
||||
"Scoring map drawn with default parameters."
|
||||
"\n To get gMocren file for gMocren browser:"
|
||||
"\n /vis/open gMocrenFile"
|
||||
"\n /vis/viewer/flush"
|
||||
"\n Many other options available with /score/draw... commands."
|
||||
"\n You might want to \"/vis/viewer/set/autoRefresh false\"."
|
||||
<< G4endl;
|
||||
}
|
||||
} else { // Not score map hits. Just call DrawAllHits.
|
||||
// Cast away const because DrawAllHits is non-const!!!!
|
||||
const_cast<G4THitsMap<G4StatDouble>&>(hits).DrawAllHits();
|
||||
}
|
||||
}
|
||||
|
||||
void G4VSceneHandler::AddViewerToList (G4VViewer* pViewer) {
|
||||
fViewerList.push_back (pViewer);
|
||||
}
|
||||
@@ -434,6 +518,8 @@ void G4VSceneHandler::AddPrimitive (const G4Scale& scale) {
|
||||
AddPrimitive(tick21.transform(transformation));
|
||||
AddPrimitive(tick22.transform(transformation));
|
||||
G4Text text(scale.GetAnnotation(),textPosition.transform(transformation));
|
||||
G4VisAttributes va(G4VVisCommand::GetCurrentTextColour());
|
||||
text.SetVisAttributes(va);
|
||||
text.SetScreenSize(scale.GetAnnotationSize());
|
||||
AddPrimitive(text);
|
||||
}
|
||||
@@ -487,13 +573,14 @@ void G4VSceneHandler::SetScene (G4Scene* pScene) {
|
||||
}
|
||||
|
||||
void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
|
||||
BeginPrimitives (fObjectTransformation);
|
||||
G4Polyhedron::SetNumberOfRotationSteps (GetNoOfSides (fpVisAttribs));
|
||||
G4Polyhedron* pPolyhedron = solid.GetPolyhedron ();
|
||||
G4Polyhedron::ResetNumberOfRotationSteps ();
|
||||
if (pPolyhedron) {
|
||||
pPolyhedron -> SetVisAttributes (fpVisAttribs);
|
||||
BeginPrimitives (fObjectTransformation);
|
||||
AddPrimitive (*pPolyhedron);
|
||||
EndPrimitives ();
|
||||
}
|
||||
else {
|
||||
G4VisManager::Verbosity verbosity = G4VisManager::GetVerbosity();
|
||||
@@ -501,11 +588,19 @@ void G4VSceneHandler::RequestPrimitives (const G4VSolid& solid) {
|
||||
G4cerr <<
|
||||
"ERROR: G4VSceneHandler::RequestPrimitives"
|
||||
"\n Polyhedron not available for " << solid.GetName () <<
|
||||
".\n This means it cannot be visualized on most systems."
|
||||
"\n Contact the Visualization Coordinator." << G4endl;
|
||||
"\n Touchable path: ";
|
||||
G4PhysicalVolumeModel* pPVModel = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
|
||||
if (pPVModel) {
|
||||
G4cerr << pPVModel->GetFullPVPath();
|
||||
}
|
||||
G4cerr <<
|
||||
"\n This means it cannot be visualized on most systems (try RayTracer)."
|
||||
"\n 1) The solid may not have implemented the CreatePolyhedron method."
|
||||
"\n 2) For Boolean solids, the BooleanProcessor, which attempts to create"
|
||||
"\n the resultant polyhedron, may have failed."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
EndPrimitives ();
|
||||
}
|
||||
|
||||
void G4VSceneHandler::ProcessScene () {
|
||||
@@ -604,7 +699,7 @@ void G4VSceneHandler::ProcessScene () {
|
||||
if (verbosity >= G4VisManager::confirmations) {
|
||||
G4cout << "Refreshing events in run..." << G4endl;
|
||||
}
|
||||
for (auto&& event: *events) {
|
||||
for (const auto& event: *events) {
|
||||
if (event) DrawEvent(event);
|
||||
}
|
||||
|
||||
@@ -764,7 +859,32 @@ G4VSolid* G4VSceneHandler::CreateSectionSolid()
|
||||
|
||||
G4VSolid* G4VSceneHandler::CreateCutawaySolid()
|
||||
{
|
||||
// To be reviewed.
|
||||
return 0;
|
||||
/*** An alternative way of getting a cutaway is to use
|
||||
Command /vis/scene/add/volume
|
||||
Guidance :
|
||||
Adds a physical volume to current scene, with optional clipping volume.
|
||||
If physical-volume-name is "world" (the default), the top of the
|
||||
main geometry tree (material world) is added. If "worlds", the
|
||||
top of all worlds - material world and parallel worlds, if any - are
|
||||
added. Otherwise a search of all worlds is made, taking the first
|
||||
matching occurence only. To see a representation of the geometry
|
||||
hierarchy of the worlds, try "/vis/drawTree [worlds]" or one of the
|
||||
driver/browser combinations that have the required functionality, e.g., HepRep.
|
||||
If clip-volume-type is specified, the subsequent parameters are used to
|
||||
to define a clipping volume. For example,
|
||||
"/vis/scene/add/volume ! ! ! -box km 0 1 0 1 0 1" will draw the world
|
||||
with the positive octant cut away. (If the Boolean Processor issues
|
||||
warnings try replacing 0 by 0.000000001 or something.)
|
||||
If clip-volume-type is prepended with '-', the clip-volume is subtracted
|
||||
(cutaway). (This is the default if there is no prepended character.)
|
||||
If '*' is prepended, the intersection of the physical-volume and the
|
||||
clip-volume is made. (You can make a section/DCUT with a thin box, for
|
||||
example).
|
||||
For "box", the parameters are xmin,xmax,ymin,ymax,zmin,zmax.
|
||||
Only "box" is programmed at present.
|
||||
***/
|
||||
}
|
||||
|
||||
void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
|
||||
@@ -827,17 +947,10 @@ void G4VSceneHandler::LoadAtts(const G4Visible& visible, G4AttHolder* holder)
|
||||
}
|
||||
}
|
||||
|
||||
const G4Colour& G4VSceneHandler::GetColour (const G4Visible& visible) {
|
||||
// Colour is determined by the applicable vis attributes.
|
||||
const G4Colour& colour = fpViewer ->
|
||||
GetApplicableVisAttributes (visible.GetVisAttributes ()) -> GetColour ();
|
||||
return colour;
|
||||
}
|
||||
|
||||
const G4Colour& G4VSceneHandler::GetTextColour (const G4Text& text) {
|
||||
const G4VisAttributes* pVA = text.GetVisAttributes ();
|
||||
if (!pVA) {
|
||||
pVA = fpViewer -> GetViewParameters (). GetDefaultTextVisAttributes ();
|
||||
return G4VVisCommand::GetCurrentTextColour();
|
||||
}
|
||||
const G4Colour& colour = pVA -> GetColour ();
|
||||
return colour;
|
||||
@@ -894,7 +1007,9 @@ G4ViewParameters::DrawingStyle G4VSceneHandler::GetDrawingStyle
|
||||
|
||||
G4bool G4VSceneHandler::GetAuxEdgeVisible (const G4VisAttributes* pVisAttribs) {
|
||||
G4bool isAuxEdgeVisible = fpViewer->GetViewParameters().IsAuxEdgeVisible ();
|
||||
if (pVisAttribs -> IsForceAuxEdgeVisible()) isAuxEdgeVisible = true;
|
||||
if (pVisAttribs -> IsForceAuxEdgeVisible()) {
|
||||
isAuxEdgeVisible = pVisAttribs->IsForcedAuxEdgeVisible();
|
||||
}
|
||||
return isAuxEdgeVisible;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VViewer.cc 95006 2016-01-15 08:26:18Z gcosmo $
|
||||
// $Id: G4VViewer.cc 101714 2016-11-22 08:53:13Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 27th March 1996
|
||||
@@ -41,6 +41,7 @@
|
||||
#include "G4Scene.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
G4VViewer::G4VViewer (G4VSceneHandler& sceneHandler,
|
||||
G4int id, const G4String& name):
|
||||
@@ -74,15 +75,6 @@ void G4VViewer::SetName (const G4String& name) {
|
||||
fShortName.strip ();
|
||||
}
|
||||
|
||||
const G4VisAttributes* G4VViewer::GetApplicableVisAttributes
|
||||
(const G4VisAttributes* pVisAttribs) const {
|
||||
// If pVisAttribs is zero, pick up the default vis attributes from
|
||||
// the view parameters.
|
||||
if (!pVisAttribs)
|
||||
pVisAttribs = GetViewParameters ().GetDefaultVisAttributes ();
|
||||
return pVisAttribs;
|
||||
}
|
||||
|
||||
void G4VViewer::NeedKernelVisit () {
|
||||
|
||||
fNeedKernelVisit = true;
|
||||
@@ -98,13 +90,11 @@ void G4VViewer::NeedKernelVisit () {
|
||||
// }
|
||||
// ??...but, there's a problem in OpenGL Stored which seems to
|
||||
// require *all* viewers to revisit the kernel, so...
|
||||
/*
|
||||
const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
|
||||
G4ViewerListConstIterator i;
|
||||
for (i = viewerList.begin(); i != viewerList.end(); i++) {
|
||||
(*i) -> SetNeedKernelVisit (true);
|
||||
}
|
||||
*/
|
||||
// const G4ViewerList& viewerList = fSceneHandler.GetViewerList ();
|
||||
// G4ViewerListConstIterator i;
|
||||
// for (i = viewerList.begin(); i != viewerList.end(); i++) {
|
||||
// (*i) -> SetNeedKernelVisit (true);
|
||||
// }
|
||||
// Feb 2005 - commented out. Let's fix OpenGL if necessary.
|
||||
}
|
||||
|
||||
@@ -131,7 +121,87 @@ void G4VViewer::SetViewParameters (const G4ViewParameters& vp) {
|
||||
fVP = vp;
|
||||
}
|
||||
|
||||
void G4VViewer::SetTouchable
|
||||
(const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& fullPath)
|
||||
{
|
||||
// Set the touchable for /vis/touchable/set/... commands.
|
||||
std::ostringstream oss;
|
||||
for (const auto& pvNodeId: fullPath) {
|
||||
oss
|
||||
<< ' ' << pvNodeId.GetPhysicalVolume()->GetName()
|
||||
<< ' ' << pvNodeId.GetCopyNo();
|
||||
}
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/set/touchable" + oss.str());
|
||||
}
|
||||
|
||||
void G4VViewer::TouchableSetVisibility
|
||||
(const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& fullPath,
|
||||
G4bool visibiity)
|
||||
{
|
||||
// Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "/vis/touchable/set/visibility ";
|
||||
if (visibiity) oss << "true"; else oss << "false";
|
||||
|
||||
// The following is equivalent to
|
||||
// G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
|
||||
// (assuming the touchable has already been set), but avoids view rebuild.
|
||||
|
||||
// Instantiate a working copy of a G4VisAttributes object...
|
||||
G4VisAttributes workingVisAtts;
|
||||
// and set the visibility.
|
||||
workingVisAtts.SetVisibility(visibiity);
|
||||
|
||||
fVP.AddVisAttributesModifier
|
||||
(G4ModelingParameters::VisAttributesModifier
|
||||
(workingVisAtts,
|
||||
G4ModelingParameters::VASVisibility,
|
||||
fullPath));
|
||||
// G4ModelingParameters::VASVisibility (VAS = Vis Attribute Signifier)
|
||||
// signifies that it is the visibility that should be picked out
|
||||
// and merged with the touchable's normal vis attributes.
|
||||
|
||||
// Record on G4cout (with #) for information.
|
||||
if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
|
||||
G4cout << "# " << oss.str() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
void G4VViewer::TouchableSetColour
|
||||
(const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& fullPath,
|
||||
const G4Colour& colour)
|
||||
{
|
||||
// Changes the Vis Attribute Modifiers WITHOUT triggering a rebuild.
|
||||
|
||||
std::ostringstream oss;
|
||||
oss << "/vis/touchable/set/colour "
|
||||
<< colour.GetRed() << ' ' << colour.GetGreen()
|
||||
<< ' ' << colour.GetBlue() << ' ' << colour.GetAlpha();
|
||||
|
||||
// The following is equivalent to
|
||||
// G4UImanager::GetUIpointer()->ApplyCommand(oss.str());
|
||||
// (assuming the touchable has already been set), but avoids view rebuild.
|
||||
|
||||
// Instantiate a working copy of a G4VisAttributes object...
|
||||
G4VisAttributes workingVisAtts;
|
||||
// and set the colour.
|
||||
workingVisAtts.SetColour(colour);
|
||||
|
||||
fVP.AddVisAttributesModifier
|
||||
(G4ModelingParameters::VisAttributesModifier
|
||||
(workingVisAtts,
|
||||
G4ModelingParameters::VASColour,
|
||||
fullPath));
|
||||
// G4ModelingParameters::VASColour (VAS = Vis Attribute Signifier)
|
||||
// signifies that it is the colour that should be picked out
|
||||
// and merged with the touchable's normal vis attributes.
|
||||
|
||||
// Record on G4cout (with #) for information.
|
||||
if (G4UImanager::GetUIpointer()->GetVerboseLevel() >= 2) {
|
||||
G4cout << "# " << oss.str() << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
|
||||
{
|
||||
@@ -140,33 +210,33 @@ std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
|
||||
G4SplineTest};
|
||||
|
||||
// Choose a curve type (for testing)
|
||||
int myCurveType = Bezier;
|
||||
// int myCurveType = Bezier;
|
||||
|
||||
// number if step points
|
||||
int stepPoints = 500;
|
||||
|
||||
|
||||
G4Spline* spline = new G4Spline();
|
||||
G4Spline spline;
|
||||
|
||||
|
||||
// At the moment we don't use the aVect parameters, but build it here :
|
||||
// Good step points for exampleB5
|
||||
spline->AddSplinePoint(G4Vector3D(0,1000,-14000));
|
||||
spline->AddSplinePoint(G4Vector3D(0,1000,0));
|
||||
spline->AddSplinePoint(G4Vector3D(-4000,1000,4000));
|
||||
spline.AddSplinePoint(G4Vector3D(0,1000,-14000));
|
||||
spline.AddSplinePoint(G4Vector3D(0,1000,0));
|
||||
spline.AddSplinePoint(G4Vector3D(-4000,1000,4000));
|
||||
|
||||
|
||||
std::vector <G4ThreeVector> viewVect;
|
||||
|
||||
if(myCurveType == Bezier) {
|
||||
|
||||
// if(myCurveType == Bezier) {
|
||||
|
||||
|
||||
// Draw the spline
|
||||
|
||||
for (int i = 0; i < stepPoints; i++) {
|
||||
float t = (float)i / (float)stepPoints;
|
||||
G4Vector3D cameraPosition = spline->GetInterpolatedSplinePoint(t);
|
||||
// G4Vector3D targetPoint = spline->GetInterpolatedSplinePoint(t);
|
||||
G4Vector3D cameraPosition = spline.GetInterpolatedSplinePoint(t);
|
||||
// G4Vector3D targetPoint = spline.GetInterpolatedSplinePoint(t);
|
||||
|
||||
// viewParam->SetViewAndLights(G4ThreeVector (cameraPosition.x(), cameraPosition.y(), cameraPosition.z()));
|
||||
// viewParam->SetCurrentTargetPoint(targetPoint);
|
||||
@@ -174,7 +244,7 @@ std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
|
||||
viewVect.push_back(G4ThreeVector (cameraPosition.x(), cameraPosition.y(), cameraPosition.z()));
|
||||
}
|
||||
|
||||
} else if (myCurveType == G4SplineTest) {
|
||||
// } else if (myCurveType == G4SplineTest) {
|
||||
/*
|
||||
This method is a inspire from a Bezier curve. The problem of the Bezier curve is that the path does not go straight between two waypoints.
|
||||
This method add "stay straight" parameter which could be between 0 and 1 where the pass will follow exactly the line between the waypoints
|
||||
@@ -198,87 +268,87 @@ std::vector <G4ThreeVector> G4VViewer::ComputeFlyThrough(G4Vector3D* /*aVect*/)
|
||||
P0 P2
|
||||
|
||||
*/
|
||||
G4Vector3D a;
|
||||
G4Vector3D b;
|
||||
G4Vector3D m1;
|
||||
G4Vector3D m2;
|
||||
G4Vector3D P0;
|
||||
G4Vector3D P1;
|
||||
G4Vector3D P2;
|
||||
G4double stayStraight = 0;
|
||||
G4double bezierSpeed = 0.4; // Spend 40% time in bezier curve (time between m1-m2 is 40% of time between P0-P1)
|
||||
|
||||
G4Vector3D firstPoint;
|
||||
G4Vector3D lastPoint;
|
||||
|
||||
float nbBezierSteps = (stepPoints * bezierSpeed*(1-stayStraight)) * (2./spline->GetNumPoints());
|
||||
float nbFirstSteps = ((stepPoints/2-nbBezierSteps/2) /(1+stayStraight)) * (2./spline->GetNumPoints());
|
||||
|
||||
// First points
|
||||
firstPoint = spline->GetPoint(0);
|
||||
lastPoint = (firstPoint + spline->GetPoint(1))/2;
|
||||
|
||||
for( float j=0; j<1; j+= 1/nbFirstSteps) {
|
||||
G4ThreeVector pt = firstPoint + (lastPoint - firstPoint) * j;
|
||||
viewVect.push_back(pt);
|
||||
G4cout << "FLY Bezier A1("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
}
|
||||
|
||||
for (int i = 0; i < spline->GetNumPoints()-2; i++) {
|
||||
P0 = spline->GetPoint(i);
|
||||
P1 = spline->GetPoint(i+1);
|
||||
P2 = spline->GetPoint(i+2);
|
||||
|
||||
m1 = P1 - (P1-P0)*(1-stayStraight)/2;
|
||||
m2 = P1 + (P2-P1)*(1-stayStraight)/2;
|
||||
|
||||
// We have to get straight path from (middile of P0-P1) to (middile of P0-P1 + (dist P0-P1) * stayStraight/2)
|
||||
if (stayStraight >0) {
|
||||
|
||||
firstPoint = (P0 + P1)/2;
|
||||
lastPoint = (P0 + P1)/2 + (P1-P0)*stayStraight/2;
|
||||
|
||||
for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
|
||||
G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
|
||||
viewVect.push_back(pt);
|
||||
G4cout << "FLY Bezier A2("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
}
|
||||
}
|
||||
// Compute Bezier curve
|
||||
for( float delta = 0 ; delta < 1 ; delta += 1/nbBezierSteps)
|
||||
{
|
||||
// The Green Line
|
||||
a = m1 + ( (P1 - m1) * delta );
|
||||
b = P1 + ( (m2 - P1) * delta );
|
||||
|
||||
// Final point
|
||||
G4ThreeVector pt = a + ((b-a) * delta );
|
||||
viewVect.push_back(pt);
|
||||
G4cout << "FLY Bezier("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
}
|
||||
|
||||
// We have to get straight path
|
||||
if (stayStraight >0) {
|
||||
firstPoint = (P1 + P2)/2 - (P2-P1)*stayStraight/2;
|
||||
lastPoint = (P1 + P2)/2;
|
||||
|
||||
for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
|
||||
G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
|
||||
viewVect.push_back(pt);
|
||||
G4cout << "FLY Bezier B1("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// last points
|
||||
firstPoint = spline->GetPoint(spline->GetNumPoints()-2);
|
||||
lastPoint = spline->GetPoint(spline->GetNumPoints()-1);
|
||||
for( float j=1; j>0; j-= 1/nbFirstSteps) {
|
||||
G4ThreeVector pt = lastPoint - ((lastPoint-firstPoint)*((1-stayStraight)/2) * j );
|
||||
viewVect.push_back(pt);
|
||||
G4cout << "FLY Bezier B2("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
}
|
||||
}
|
||||
// G4Vector3D a;
|
||||
// G4Vector3D b;
|
||||
// G4Vector3D m1;
|
||||
// G4Vector3D m2;
|
||||
// G4Vector3D P0;
|
||||
// G4Vector3D P1;
|
||||
// G4Vector3D P2;
|
||||
// G4double stayStraight = 0;
|
||||
// G4double bezierSpeed = 0.4; // Spend 40% time in bezier curve (time between m1-m2 is 40% of time between P0-P1)
|
||||
//
|
||||
// G4Vector3D firstPoint;
|
||||
// G4Vector3D lastPoint;
|
||||
//
|
||||
// float nbBezierSteps = (stepPoints * bezierSpeed*(1-stayStraight)) * (2./spline.GetNumPoints());
|
||||
// float nbFirstSteps = ((stepPoints/2-nbBezierSteps/2) /(1+stayStraight)) * (2./spline.GetNumPoints());
|
||||
//
|
||||
// // First points
|
||||
// firstPoint = spline.GetPoint(0);
|
||||
// lastPoint = (firstPoint + spline.GetPoint(1))/2;
|
||||
//
|
||||
// for( float j=0; j<1; j+= 1/nbFirstSteps) {
|
||||
// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint) * j;
|
||||
// viewVect.push_back(pt);
|
||||
// G4cout << "FLY Bezier A1("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
// }
|
||||
//
|
||||
// for (int i = 0; i < spline.GetNumPoints()-2; i++) {
|
||||
// P0 = spline.GetPoint(i);
|
||||
// P1 = spline.GetPoint(i+1);
|
||||
// P2 = spline.GetPoint(i+2);
|
||||
//
|
||||
// m1 = P1 - (P1-P0)*(1-stayStraight)/2;
|
||||
// m2 = P1 + (P2-P1)*(1-stayStraight)/2;
|
||||
//
|
||||
// // We have to get straight path from (middile of P0-P1) to (middile of P0-P1 + (dist P0-P1) * stayStraight/2)
|
||||
// if (stayStraight >0) {
|
||||
//
|
||||
// firstPoint = (P0 + P1)/2;
|
||||
// lastPoint = (P0 + P1)/2 + (P1-P0)*stayStraight/2;
|
||||
//
|
||||
// for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
|
||||
// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
|
||||
// viewVect.push_back(pt);
|
||||
// G4cout << "FLY Bezier A2("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
// }
|
||||
// }
|
||||
// // Compute Bezier curve
|
||||
// for( float delta = 0 ; delta < 1 ; delta += 1/nbBezierSteps)
|
||||
// {
|
||||
// // The Green Line
|
||||
// a = m1 + ( (P1 - m1) * delta );
|
||||
// b = P1 + ( (m2 - P1) * delta );
|
||||
//
|
||||
// // Final point
|
||||
// G4ThreeVector pt = a + ((b-a) * delta );
|
||||
// viewVect.push_back(pt);
|
||||
// G4cout << "FLY Bezier("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
// }
|
||||
//
|
||||
// // We have to get straight path
|
||||
// if (stayStraight >0) {
|
||||
// firstPoint = (P1 + P2)/2 - (P2-P1)*stayStraight/2;
|
||||
// lastPoint = (P1 + P2)/2;
|
||||
//
|
||||
// for( float j=0; j<1; j+= 1/(nbFirstSteps*stayStraight)) {
|
||||
// G4ThreeVector pt = firstPoint + (lastPoint - firstPoint)* j;
|
||||
// viewVect.push_back(pt);
|
||||
// G4cout << "FLY Bezier B1("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // last points
|
||||
// firstPoint = spline.GetPoint(spline.GetNumPoints()-2);
|
||||
// lastPoint = spline.GetPoint(spline.GetNumPoints()-1);
|
||||
// for( float j=1; j>0; j-= 1/nbFirstSteps) {
|
||||
// G4ThreeVector pt = lastPoint - ((lastPoint-firstPoint)*((1-stayStraight)/2) * j );
|
||||
// viewVect.push_back(pt);
|
||||
// G4cout << "FLY Bezier B2("<< viewVect.size()<< "):" << pt << G4endl;
|
||||
// }
|
||||
// }
|
||||
return viewVect;
|
||||
}
|
||||
|
||||
@@ -320,17 +390,17 @@ std::ostream& operator << (std::ostream& os, const G4VViewer& v) {
|
||||
|
||||
// ===== G4Spline class =====
|
||||
|
||||
G4Spline::G4Spline()
|
||||
G4VViewer::G4Spline::G4Spline()
|
||||
: vp(), delta_t(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
G4Spline::~G4Spline()
|
||||
G4VViewer::G4Spline::~G4Spline()
|
||||
{}
|
||||
|
||||
// Solve the Catmull-Rom parametric equation for a given time(t) and vector quadruple (p1,p2,p3,p4)
|
||||
G4Vector3D G4Spline::CatmullRom_Eq(float t, const G4Vector3D& p1, const G4Vector3D& p2, const G4Vector3D& p3, const G4Vector3D& p4)
|
||||
G4Vector3D G4VViewer::G4Spline::CatmullRom_Eq(float t, const G4Vector3D& p1, const G4Vector3D& p2, const G4Vector3D& p3, const G4Vector3D& p4)
|
||||
{
|
||||
float t2 = t * t;
|
||||
float t3 = t2 * t;
|
||||
@@ -343,24 +413,24 @@ G4Vector3D G4Spline::CatmullRom_Eq(float t, const G4Vector3D& p1, const G4Vector
|
||||
return (p1*b1 + p2*b2 + p3*b3 + p4*b4);
|
||||
}
|
||||
|
||||
void G4Spline::AddSplinePoint(const G4Vector3D& v)
|
||||
void G4VViewer::G4Spline::AddSplinePoint(const G4Vector3D& v)
|
||||
{
|
||||
vp.push_back(v);
|
||||
delta_t = (float)1 / (float)vp.size();
|
||||
}
|
||||
|
||||
|
||||
G4Vector3D G4Spline::GetPoint(int a)
|
||||
G4Vector3D G4VViewer::G4Spline::GetPoint(int a)
|
||||
{
|
||||
return vp[a];
|
||||
}
|
||||
|
||||
int G4Spline::GetNumPoints()
|
||||
int G4VViewer::G4Spline::GetNumPoints()
|
||||
{
|
||||
return vp.size();
|
||||
}
|
||||
|
||||
G4Vector3D G4Spline::GetInterpolatedSplinePoint(float t)
|
||||
G4Vector3D G4VViewer::G4Spline::GetInterpolatedSplinePoint(float t)
|
||||
{
|
||||
// Find out in which interval we are on the spline
|
||||
int p = (int)(t / delta_t);
|
||||
@@ -375,5 +445,3 @@ G4Vector3D G4Spline::GetInterpolatedSplinePoint(float t)
|
||||
// Interpolate
|
||||
return CatmullRom_Eq(lt, vp[p0], vp[p1], vp[p2], vp[p3]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4ViewParameters.cc 97548 2016-06-03 15:56:56Z gcosmo $
|
||||
// $Id: G4ViewParameters.cc 101035 2016-11-04 08:48:17Z gcosmo $
|
||||
//
|
||||
//
|
||||
// John Allison 19th July 1996
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "G4ViewParameters.hh"
|
||||
|
||||
#include "G4VisManager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4ios.hh"
|
||||
@@ -52,7 +53,7 @@ G4ViewParameters::G4ViewParameters ():
|
||||
fCutawayMode (cutawayUnion),
|
||||
fCutawayPlanes (),
|
||||
fExplodeFactor (1.),
|
||||
fNoOfSides (24),
|
||||
fNoOfSides (72),
|
||||
fViewpointDirection (G4Vector3D (0., 0., 1.)), // On z-axis.
|
||||
fUpVector (G4Vector3D (0., 1., 0.)), // y-axis up.
|
||||
fFieldHalfAngle (0.), // Orthogonal projection.
|
||||
@@ -206,10 +207,14 @@ void G4ViewParameters::SetViewAndLights
|
||||
// If the requested viewpoint direction is parallel to the up
|
||||
// vector, the orientation of the view is undefined...
|
||||
if (fViewpointDirection.unit() * fUpVector.unit() > .9999) {
|
||||
G4cout <<
|
||||
static G4bool firstTime = true;
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
G4cout <<
|
||||
"WARNING: Viewpoint direction is very close to the up vector direction."
|
||||
"\n Consider setting the up vector to obtain definable behaviour."
|
||||
<< G4endl;
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Move the lights too if requested...
|
||||
@@ -250,7 +255,7 @@ void G4ViewParameters::IncrementPan (G4double right, G4double up, G4double dista
|
||||
|
||||
void G4ViewParameters::AddVisAttributesModifier
|
||||
(const G4ModelingParameters::VisAttributesModifier& vam) {
|
||||
// If target exists, just change vis attributes.
|
||||
// If target exists with same signifier just change vis attributes.
|
||||
G4bool duplicateTarget = false;
|
||||
auto i = fVisAttributesModifiers.begin();
|
||||
for (; i < fVisAttributesModifiers.end(); ++i) {
|
||||
@@ -555,36 +560,44 @@ G4String G4ViewParameters::TouchableCommands() const
|
||||
<< vamVisAtts.GetLineWidth();
|
||||
break;
|
||||
case G4ModelingParameters::VASForceWireframe:
|
||||
if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::wireframe) {
|
||||
oss << "\n/vis/touchable/set/forceWireframe ";
|
||||
if (vamVisAtts.IsForceDrawingStyle()) {
|
||||
oss << "true";
|
||||
} else {
|
||||
oss << "false";
|
||||
if (vamVisAtts.IsForceDrawingStyle()) {
|
||||
if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::wireframe) {
|
||||
oss << "\n/vis/touchable/set/forceWireframe ";
|
||||
if (vamVisAtts.IsForceDrawingStyle()) {
|
||||
oss << "true";
|
||||
} else {
|
||||
oss << "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case G4ModelingParameters::VASForceSolid:
|
||||
if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::solid) {
|
||||
oss << "\n/vis/touchable/set/forceSolid ";
|
||||
if (vamVisAtts.IsForceDrawingStyle()) {
|
||||
if (vamVisAtts.IsForceDrawingStyle()) {
|
||||
if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::solid) {
|
||||
oss << "\n/vis/touchable/set/forceSolid ";
|
||||
if (vamVisAtts.IsForceDrawingStyle()) {
|
||||
oss << "true";
|
||||
} else {
|
||||
oss << "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case G4ModelingParameters::VASForceAuxEdgeVisible:
|
||||
if (vamVisAtts.IsForceAuxEdgeVisible()) {
|
||||
oss << "\n/vis/touchable/set/forceAuxEdgeVisible ";
|
||||
if (vamVisAtts.IsForcedAuxEdgeVisible()) {
|
||||
oss << "true";
|
||||
} else {
|
||||
oss << "false";
|
||||
}
|
||||
}
|
||||
break;
|
||||
case G4ModelingParameters::VASForceAuxEdgeVisible:
|
||||
oss << "\n/vis/touchable/set/forceAuxEdgeVisible ";
|
||||
if (vamVisAtts.IsForceAuxEdgeVisible()) {
|
||||
oss << "true";
|
||||
} else {
|
||||
oss << "false";
|
||||
}
|
||||
break;
|
||||
case G4ModelingParameters::VASForceLineSegmentsPerCircle:
|
||||
oss << "\n/vis/touchable/set/lineSegmentsPerCircle "
|
||||
<< vamVisAtts.GetForcedLineSegmentsPerCircle();
|
||||
if (vamVisAtts.GetForcedLineSegmentsPerCircle() > 0) {
|
||||
oss << "\n/vis/touchable/set/lineSegmentsPerCircle "
|
||||
<< vamVisAtts.GetForcedLineSegmentsPerCircle();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -659,6 +672,10 @@ void G4ViewParameters::PrintDifferences (const G4ViewParameters& v) const {
|
||||
if (fExplodeCentre != v.fExplodeCentre)
|
||||
G4cout << "Difference in explode centre." << G4endl;
|
||||
}
|
||||
|
||||
if (fVisAttributesModifiers != v.fVisAttributesModifiers) {
|
||||
G4cout << "Difference in vis attributes modifiers." << G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& operator << (std::ostream& os,
|
||||
@@ -898,11 +915,10 @@ G4bool G4ViewParameters::operator != (const G4ViewParameters& v) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void G4ViewParameters::SetXGeometryString (const G4String& geomStringArg)
|
||||
{
|
||||
G4int x,y = 0;
|
||||
unsigned int w,h = 0;
|
||||
G4int x = 0, y = 0;
|
||||
unsigned int w = 0, h = 0;
|
||||
G4String geomString = geomStringArg;
|
||||
// Parse windowSizeHintString for backwards compatibility...
|
||||
const G4String delimiters("xX+-");
|
||||
@@ -1225,21 +1241,21 @@ G4ViewParameters* G4ViewParameters::CatmullRomCubicSplineInterpolation
|
||||
// Real parameters
|
||||
INTERPOLATE(fVisibleDensity);
|
||||
if (real < 0.) real = 0.;
|
||||
holdingValues.fVisibleDensity = real;
|
||||
holdingValues.fVisibleDensity = real;
|
||||
INTERPOLATE(fExplodeFactor);
|
||||
if (real < 0.) real = 0.;
|
||||
holdingValues.fExplodeFactor = real;
|
||||
holdingValues.fExplodeFactor = real;
|
||||
INTERPOLATE(fFieldHalfAngle);
|
||||
if (real < 0.) real = 0.;
|
||||
holdingValues.fFieldHalfAngle = real;
|
||||
holdingValues.fFieldHalfAngle = real;
|
||||
INTERPOLATE(fZoomFactor);
|
||||
if (real < 0.) real = 0.;
|
||||
holdingValues.fZoomFactor = real;
|
||||
holdingValues.fZoomFactor = real;
|
||||
INTERPOLATE(fDolly);
|
||||
holdingValues.fDolly = real;
|
||||
holdingValues.fDolly = real;
|
||||
INTERPOLATE(fGlobalMarkerScale);
|
||||
if (real < 0.) real = 0.;
|
||||
holdingValues.fGlobalMarkerScale = real;
|
||||
holdingValues.fGlobalMarkerScale = real;
|
||||
INTERPOLATE(fGlobalLineWidthScale);
|
||||
if (real < 0.) real = 0.;
|
||||
holdingValues.fGlobalLineWidthScale = real;
|
||||
@@ -1337,8 +1353,9 @@ INTERPOLATE(plane.d()); d = real;
|
||||
}
|
||||
|
||||
// Vis attributes modifiers
|
||||
// Really, we are only intersted in colour - other attributes can follow
|
||||
// Really, we are only interested in colour - other attributes can follow
|
||||
// the "crude" interpolation that is guaranteed above.
|
||||
static G4VisAttributes workingVA;
|
||||
if (v[i].fVisAttributesModifiers.size()) {
|
||||
CONTINUITY(fVisAttributesModifiers.size());
|
||||
if (continuous) { \
|
||||
@@ -1350,7 +1367,7 @@ INTERPOLATE(plane.d()); d = real;
|
||||
if (v[i].fVisAttributesModifiers[j].GetVisAttributesSignifier() ==
|
||||
G4ModelingParameters::VASColour) {
|
||||
INTERPOLATECOLOUR(fVisAttributesModifiers[j].GetVisAttributes().GetColour());
|
||||
G4VisAttributes workingVA = v[i].fVisAttributesModifiers[j].GetVisAttributes();
|
||||
workingVA = v[i].fVisAttributesModifiers[j].GetVisAttributes();
|
||||
workingVA.SetColour(G4Colour(red,green,blue,alpha));
|
||||
holdingValues.fVisAttributesModifiers[j].SetVisAttributes(workingVA);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsCompound.cc 95006 2016-01-15 08:26:18Z gcosmo $
|
||||
// $Id: G4VisCommandsCompound.cc 98766 2016-08-09 14:17:17Z gcosmo $
|
||||
|
||||
// Compound /vis/ commands - John Allison 15th May 2000
|
||||
|
||||
@@ -311,10 +311,12 @@ G4VisCommandSpecify::G4VisCommandSpecify() {
|
||||
fpCommand->SetGuidance
|
||||
("Creates a scene consisting of this logical volume and asks the"
|
||||
"\n current viewer to draw it to the specified depth of descent"
|
||||
"\n showing boolean components (if any), voxels (if any)"
|
||||
"\n and readout geometry (if any), under control of the appropriate flag.");
|
||||
"\n showing boolean components (if any), voxels (if any),"
|
||||
"\n readout geometry (if any) and local axes, under control of the"
|
||||
"\n appropriate flag.");
|
||||
fpCommand->SetGuidance
|
||||
("Note: voxels are not constructed until start of run - /run/beamOn.");
|
||||
("Note: voxels are not constructed until start of run - /run/beamOn."
|
||||
"\n (For voxels without a run, \"/run/beamOn 0\".)");
|
||||
fpCommand->SetGuidance("The scene becomes current.");
|
||||
G4UIparameter* parameter;
|
||||
parameter = new G4UIparameter("logical-volume-name", 's', omitable = false);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsGeometrySet.cc 86865 2014-11-19 14:41:25Z gcosmo $
|
||||
// $Id: G4VisCommandsGeometrySet.cc 98797 2016-08-09 15:12:22Z gcosmo $
|
||||
|
||||
// /vis/geometry commands - John Allison 31st January 2006
|
||||
|
||||
@@ -194,7 +194,7 @@ G4VisCommandGeometrySetDaughtersInvisible::G4VisCommandGeometrySetDaughtersInvis
|
||||
("Depth of propagation (-1 means unlimited depth).");
|
||||
fpCommand->SetParameter(parameter);
|
||||
parameter = new G4UIparameter("daughtersInvisible", 'b', omitable = true);
|
||||
parameter->SetDefaultValue(false);
|
||||
parameter->SetDefaultValue(true);
|
||||
fpCommand->SetParameter(parameter);
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ G4VisCommandGeometrySetForceAuxEdgeVisible::G4VisCommandGeometrySetForceAuxEdgeV
|
||||
("Depth of propagation (-1 means unlimited depth).");
|
||||
fpCommand->SetParameter(parameter);
|
||||
parameter = new G4UIparameter("forceAuxEdgeVisible", 'b', omitable = true);
|
||||
parameter->SetDefaultValue(false);
|
||||
parameter->SetDefaultValue(true);
|
||||
fpCommand->SetParameter(parameter);
|
||||
}
|
||||
|
||||
@@ -322,8 +322,8 @@ G4VisCommandGeometrySetForceLineSegmentsPerCircle::G4VisCommandGeometrySetForceL
|
||||
fpCommand->SetParameter(parameter);
|
||||
parameter = new G4UIparameter("lineSegmentsPerCircle", 'd', omitable = true);
|
||||
parameter->SetGuidance
|
||||
("< 0 means not forced, i.e., under control of viewer.");
|
||||
parameter->SetDefaultValue(-1);
|
||||
("<= 0 means not forced, i.e., under control of viewer.");
|
||||
parameter->SetDefaultValue(0);
|
||||
fpCommand->SetParameter(parameter);
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ G4VisCommandGeometrySetForceSolid::G4VisCommandGeometrySetForceSolid()
|
||||
("Depth of propagation (-1 means unlimited depth).");
|
||||
fpCommand->SetParameter(parameter);
|
||||
parameter = new G4UIparameter("forceSolid", 'b', omitable = true);
|
||||
parameter->SetDefaultValue(false);
|
||||
parameter->SetDefaultValue(true);
|
||||
fpCommand->SetParameter(parameter);
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ G4VisCommandGeometrySetForceWireframe::G4VisCommandGeometrySetForceWireframe()
|
||||
("Depth of propagation (-1 means unlimited depth).");
|
||||
fpCommand->SetParameter(parameter);
|
||||
parameter = new G4UIparameter("forceWireframe", 'b', omitable = true);
|
||||
parameter->SetDefaultValue(false);
|
||||
parameter->SetDefaultValue(true);
|
||||
fpCommand->SetParameter(parameter);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsSceneAdd.cc 96733 2016-05-02 11:52:48Z gcosmo $
|
||||
// $Id: G4VisCommandsSceneAdd.cc 98766 2016-08-09 14:17:17Z gcosmo $
|
||||
// /vis/scene/add commands - John Allison 9th August 1998
|
||||
|
||||
#include "G4VisCommandsSceneAdd.hh"
|
||||
@@ -269,8 +269,8 @@ G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes () {
|
||||
fpCommand -> SetGuidance
|
||||
("Draws axes at (x0, y0, z0) of given length and colour.");
|
||||
fpCommand -> SetGuidance
|
||||
("If \"unitcolour\" is \"auto\", x, y and z will be red, green and blue"
|
||||
"\n respectively. Otherwise choose from the pre-defined text-specified"
|
||||
("If \"colour-string\" is \"auto\", x, y and z will be red, green and blue"
|
||||
"\n respectively. Otherwise it can be one of the pre-defined text-specified"
|
||||
"\n colours - see information printed by the vis manager at start-up or"
|
||||
"\n use \"/vis/list\".");
|
||||
fpCommand -> SetGuidance
|
||||
@@ -293,7 +293,7 @@ G4VisCommandSceneAddAxes::G4VisCommandSceneAddAxes () {
|
||||
parameter = new G4UIparameter ("unit", 's', omitable = true);
|
||||
parameter->SetDefaultValue ("m");
|
||||
fpCommand->SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("unitcolour", 's', omitable = true);
|
||||
parameter = new G4UIparameter ("colour-string", 's', omitable = true);
|
||||
parameter->SetDefaultValue ("auto");
|
||||
fpCommand->SetParameter (parameter);
|
||||
parameter = new G4UIparameter ("showtext", 'b', omitable = true);
|
||||
@@ -1090,9 +1090,10 @@ G4VisCommandSceneAddLogicalVolume::G4VisCommandSceneAddLogicalVolume () {
|
||||
fpCommand = new G4UIcommand ("/vis/scene/add/logicalVolume", this);
|
||||
fpCommand -> SetGuidance ("Adds a logical volume to the current scene,");
|
||||
fpCommand -> SetGuidance
|
||||
("Shows boolean components (if any), voxels (if any) and readout geometry"
|
||||
"\n(if any). Note: voxels are not constructed until start of run -"
|
||||
"\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
|
||||
("Shows boolean components (if any), voxels (if any), readout geometry"
|
||||
"\n (if any) and local axes, under control of the appropriate flag."
|
||||
"\n Note: voxels are not constructed until start of run -"
|
||||
"\n \"/run/beamOn\". (For voxels without a run, \"/run/beamOn 0\".)");
|
||||
G4UIparameter* parameter;
|
||||
parameter = new G4UIparameter ("logical-volume-name", 's', omitable = false);
|
||||
fpCommand -> SetParameter (parameter);
|
||||
@@ -1556,7 +1557,7 @@ void G4VisCommandSceneAddLogo::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
G4VisCommandSceneAddLogo::G4Logo::G4Logo
|
||||
(G4double height, const G4VisAttributes& visAtts):
|
||||
fVisAtts(visAtts)
|
||||
{
|
||||
{
|
||||
const G4double& h = height;
|
||||
const G4double h2 = 0.5 * h; // Half height.
|
||||
const G4double ri = 0.25 * h; // Inner radius.
|
||||
@@ -1584,6 +1585,17 @@ G4VisCommandSceneAddLogo::G4Logo::G4Logo
|
||||
const G4double xtr = ss - f1, ytr = -ss - f2 -w;
|
||||
x9 += xtr; y9 += ytr;
|
||||
|
||||
// The idea here is to create a polyhedron for the G and the 4. To do
|
||||
// this we use Geant4 geometry solids and make boolean operations.
|
||||
// Note that we do not need to keep the solids. We use local objects,
|
||||
// which, of course, are deleted on leaving this function. This
|
||||
// is contrary to the usual requirement for solids that are part of the
|
||||
// detector for which solids MUST be created on the heap (with "new").
|
||||
// Finally we invoke CreatePolyhedron, which creates a polyhedron on the heap
|
||||
// and returns a pointer. It is the user's responsibility to delete,
|
||||
// which is done in the destructor of this class. Thus the polyhedra,
|
||||
// created here, remain on the heap for the lifetime of the job.
|
||||
|
||||
// G...
|
||||
G4Tubs tG("tG",ri,ro,d2,0.15*pi,1.85*pi);
|
||||
G4Box bG("bG",w2,ro2,d2);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsSceneHandler.cc 95006 2016-01-15 08:26:18Z gcosmo $
|
||||
// $Id: G4VisCommandsSceneHandler.cc 99418 2016-09-21 09:18:42Z gcosmo $
|
||||
|
||||
// /vis/sceneHandler commands - John Allison 10th October 1998
|
||||
|
||||
@@ -223,14 +223,14 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
|
||||
G4int iGS; // Selector index.
|
||||
G4bool found = false;
|
||||
for (iGS = 0; iGS < nSystems; iGS++) {
|
||||
auto&& gs = gsl[iGS];
|
||||
const auto& gs = gsl[iGS];
|
||||
if (graphicsSystem.compareTo(gs->GetName(), G4String::ignoreCase) == 0) {
|
||||
found = true;
|
||||
break; // Match found
|
||||
} else {
|
||||
auto&& nicknames = gs->GetNicknames();
|
||||
const auto& nicknames = gs->GetNicknames();
|
||||
for (size_t i = 0; i < nicknames.size(); ++i) {
|
||||
auto&& nickname = nicknames[i];
|
||||
const auto& nickname = nicknames[i];
|
||||
if (graphicsSystem.compareTo (nickname, G4String::ignoreCase) == 0) {
|
||||
found = true;
|
||||
break; // Match found
|
||||
@@ -262,9 +262,9 @@ void G4VisCommandSceneHandlerCreate::SetNewValue (G4UIcommand*,
|
||||
fallback = false;
|
||||
G4String fallbackNickname = gsl[iGS]->GetNickname() + "_FALLBACK";
|
||||
for (iGS = 0; iGS < nSystems; iGS++) {
|
||||
auto&& nicknames = gsl[iGS]->GetNicknames();
|
||||
const auto& nicknames = gsl[iGS]->GetNicknames();
|
||||
for (size_t i = 0; i < nicknames.size(); ++i) {
|
||||
auto&& nickname = nicknames[i];
|
||||
const auto& nickname = nicknames[i];
|
||||
if (fallbackNickname.compareTo (nickname, G4String::ignoreCase) == 0) {
|
||||
fallback = true;
|
||||
break; // Match found
|
||||
|
||||
@@ -24,12 +24,13 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsTouchableSet.cc 82799 2014-07-10 13:18:29Z gcosmo $
|
||||
// $Id: G4VisCommandsTouchableSet.cc 99418 2016-09-21 09:18:42Z gcosmo $
|
||||
|
||||
// /vis/touchable/set commands - John Allison 8th October 2012
|
||||
|
||||
#include "G4VisCommandsTouchableSet.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
@@ -74,7 +75,7 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
|
||||
fpCommandSetDaughtersInvisible->SetGuidance
|
||||
("Use \"/vis/set/touchable\" to set current touchable.");
|
||||
fpCommandSetDaughtersInvisible->SetParameterName("daughtersInvisible", omitable = true);
|
||||
fpCommandSetDaughtersInvisible->SetDefaultValue(false);
|
||||
fpCommandSetDaughtersInvisible->SetDefaultValue(true);
|
||||
|
||||
fpCommandSetForceAuxEdgeVisible = new G4UIcmdWithABool
|
||||
("/vis/touchable/set/forceAuxEdgeVisible", this);
|
||||
@@ -83,7 +84,7 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
|
||||
fpCommandSetForceAuxEdgeVisible->SetGuidance
|
||||
("Use \"/vis/set/touchable\" to set current touchable.");
|
||||
fpCommandSetForceAuxEdgeVisible->SetParameterName("forceAuxEdgeVisible", omitable = true);
|
||||
fpCommandSetForceAuxEdgeVisible->SetDefaultValue(false);
|
||||
fpCommandSetForceAuxEdgeVisible->SetDefaultValue(true);
|
||||
|
||||
fpCommandSetLineSegmentsPerCircle = new G4UIcmdWithAnInteger
|
||||
("/vis/touchable/set/lineSegmentsPerCircle", this);
|
||||
@@ -95,7 +96,7 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
|
||||
fpCommandSetLineSegmentsPerCircle->SetGuidance
|
||||
("Use \"/vis/set/touchable\" to set current touchable.");
|
||||
fpCommandSetLineSegmentsPerCircle->SetParameterName("lineSegmentsPerCircle", omitable = true);
|
||||
fpCommandSetLineSegmentsPerCircle->SetDefaultValue(-1);
|
||||
fpCommandSetLineSegmentsPerCircle->SetDefaultValue(0);
|
||||
|
||||
fpCommandSetForceSolid = new G4UIcmdWithABool
|
||||
("/vis/touchable/set/forceSolid", this);
|
||||
@@ -104,7 +105,7 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
|
||||
fpCommandSetForceSolid->SetGuidance
|
||||
("Use \"/vis/set/touchable\" to set current touchable.");
|
||||
fpCommandSetForceSolid->SetParameterName("forceSolid", omitable = true);
|
||||
fpCommandSetForceSolid->SetDefaultValue(false);
|
||||
fpCommandSetForceSolid->SetDefaultValue(true);
|
||||
|
||||
fpCommandSetForceWireframe = new G4UIcmdWithABool
|
||||
("/vis/touchable/set/forceWireframe", this);
|
||||
@@ -113,7 +114,7 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
|
||||
fpCommandSetForceWireframe->SetGuidance
|
||||
("Use \"/vis/set/touchable\" to set current touchable.");
|
||||
fpCommandSetForceWireframe->SetParameterName("forceWireframe", omitable = true);
|
||||
fpCommandSetForceWireframe->SetDefaultValue(false);
|
||||
fpCommandSetForceWireframe->SetDefaultValue(true);
|
||||
|
||||
fpCommandSetLineStyle = new G4UIcmdWithAString
|
||||
("/vis/touchable/set/lineStyle", this);
|
||||
@@ -139,7 +140,7 @@ G4VisCommandsTouchableSet::G4VisCommandsTouchableSet()
|
||||
fpCommandSetVisibility->SetGuidance
|
||||
("Use \"/vis/set/touchable\" to set current touchable.");
|
||||
fpCommandSetVisibility->SetParameterName("visibility", omitable = true);
|
||||
fpCommandSetVisibility->SetDefaultValue(false);
|
||||
fpCommandSetVisibility->SetDefaultValue(true);
|
||||
}
|
||||
|
||||
G4VisCommandsTouchableSet::~G4VisCommandsTouchableSet() {
|
||||
@@ -296,4 +297,7 @@ void G4VisCommandsTouchableSet::SetNewValue
|
||||
}
|
||||
|
||||
SetViewParameters(currentViewer,workingVP);
|
||||
|
||||
// To update all views
|
||||
G4UImanager::GetUIpointer()->ApplyCommand("/vis/scene/notifyHandlers");
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsViewer.cc 97316 2016-06-01 12:12:58Z gcosmo $
|
||||
// $Id: G4VisCommandsViewer.cc 99440 2016-09-22 08:34:04Z gcosmo $
|
||||
|
||||
// /vis/viewer commands - John Allison 25th October 1998
|
||||
|
||||
@@ -459,7 +459,7 @@ void G4VisCommandViewerClone::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
|
||||
// Need to handle the possibility that the names contain embedded
|
||||
// blanks within quotation marks...
|
||||
char c;
|
||||
char c = ' ';
|
||||
while (is.get(c) && c == ' '){}
|
||||
if (c == '"') {
|
||||
while (is.get(c) && c != '"') {originalName += c;}
|
||||
@@ -974,7 +974,7 @@ G4VisCommandViewerInterpolate::G4VisCommandViewerInterpolate () {
|
||||
"order of filename. The files may be written by hand or produced by the "
|
||||
"\"/vis/viewer/save\" command.");
|
||||
fpCommand -> SetGuidance
|
||||
("The default is to search the working directory for files with a .view "
|
||||
("The default is to search the working directory for files with a .g4view "
|
||||
"extension. Another procedure is to assemble view files in a subdirectory, "
|
||||
"e.g., \"myviews\"; then they can be interpolated with\n"
|
||||
"\"/vis/viewer/interpolate myviews/*\".");
|
||||
@@ -984,7 +984,7 @@ G4VisCommandViewerInterpolate::G4VisCommandViewerInterpolate () {
|
||||
G4UIparameter* parameter;
|
||||
parameter = new G4UIparameter("pattern", 's', omitable = true);
|
||||
parameter -> SetGuidance("Pattern that defines the view files.");
|
||||
parameter -> SetDefaultValue("*.view");
|
||||
parameter -> SetDefaultValue("*.g4view");
|
||||
fpCommand -> SetParameter(parameter);
|
||||
parameter = new G4UIparameter("no-of-points", 'i', omitable = true);
|
||||
parameter -> SetGuidance ("Number of interpolation points per interval.");
|
||||
@@ -1014,6 +1014,16 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
|
||||
|
||||
G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity();
|
||||
|
||||
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
|
||||
if (!currentViewer) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr <<
|
||||
"ERROR: G4VisCommandViewerInterpolate::SetNewValue: no current viewer."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
G4String pattern;
|
||||
G4int nInterpolationPoints;
|
||||
G4String waitTimePerPointString;
|
||||
@@ -1045,16 +1055,6 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
|
||||
return;
|
||||
}
|
||||
|
||||
G4VViewer* currentViewer = fpVisManager->GetCurrentViewer();
|
||||
if (!currentViewer) {
|
||||
if (verbosity >= G4VisManager::errors) {
|
||||
G4cerr <<
|
||||
"ERROR: G4VisCommandViewerInterpolate::SetNewValue: no current viewer."
|
||||
<< G4endl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Save current view parameters
|
||||
G4ViewParameters saveVP = currentViewer->GetViewParameters();
|
||||
|
||||
@@ -1067,8 +1067,8 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
|
||||
fpVisManager->SetVerboseLevel(G4VisManager::errors);
|
||||
ui->SetVerboseLevel(0);
|
||||
|
||||
// Switch off auto-refresh (it will be restored later)
|
||||
// Note: the view files do not set autoRefresh.
|
||||
// Switch off auto-refresh while we read in the view files (it will be
|
||||
// restored later). Note: the view files do not set auto-refresh.
|
||||
G4ViewParameters non_auto = saveVP;
|
||||
non_auto.SetAutoRefresh(false);
|
||||
currentViewer->SetViewParameters(non_auto);
|
||||
@@ -1095,6 +1095,7 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
|
||||
"\n the number of way points exceeds the maximum currently allowed: "
|
||||
<< safety << G4endl;
|
||||
}
|
||||
pclose(filelist);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1103,7 +1104,9 @@ void G4VisCommandViewerInterpolate::SetNewValue (G4UIcommand*, G4String newValue
|
||||
do {
|
||||
G4ViewParameters* vp =
|
||||
G4ViewParameters::CatmullRomCubicSplineInterpolation(viewVector,nInterpolationPoints);
|
||||
if (!vp) break;
|
||||
if (!vp) break; // Finished.
|
||||
// Set original auto-refresh status.
|
||||
vp->SetAutoRefresh(saveVP.IsAutoRefresh());
|
||||
currentViewer->SetViewParameters(*vp);
|
||||
currentViewer->RefreshView();
|
||||
if (exportString == "export" &&
|
||||
@@ -1184,11 +1187,14 @@ void G4VisCommandViewerList::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
for (int iHandler = 0; iHandler < nHandlers; iHandler++) {
|
||||
G4VSceneHandler* sceneHandler = sceneHandlerList [iHandler];
|
||||
const G4ViewerList& viewerList = sceneHandler -> GetViewerList ();
|
||||
G4cout << "Scene handler \"" << sceneHandler -> GetName ();
|
||||
G4cout
|
||||
<< "Scene handler \"" << sceneHandler -> GetName () << "\" ("
|
||||
<< sceneHandler->GetGraphicsSystem()->GetNickname() << ')';
|
||||
const G4Scene* pScene = sceneHandler -> GetScene ();
|
||||
if (pScene) {
|
||||
G4cout << "\", scene \"" << pScene -> GetName () << "\":";
|
||||
G4cout << ", scene \"" << pScene -> GetName () << "\"";
|
||||
}
|
||||
G4cout << ':';
|
||||
G4int nViewers = viewerList.size ();
|
||||
if (nViewers == 0) {
|
||||
G4cout << "\n No viewers for this scene handler." << G4endl;
|
||||
@@ -1544,12 +1550,12 @@ G4VisCommandViewerSave::G4VisCommandViewerSave () {
|
||||
("Read them back into the same or any viewer with \"/control/execute\".");
|
||||
fpCommand -> SetGuidance
|
||||
("If the filename is omitted the view is saved to a file "
|
||||
"\"g4_nn.view\", where nn is a sequential two-digit number.");
|
||||
"\"g4_nn.g4view\", where nn is a sequential two-digit number.");
|
||||
fpCommand -> SetGuidance
|
||||
("If the filename is \"-\", the data are written to G4cout.");
|
||||
fpCommand -> SetGuidance
|
||||
("If you are wanting to save views for future interpolation a recommended "
|
||||
"procedure is: save views to \"g4_nn.view\", as above, then move the files "
|
||||
"procedure is: save views to \"g4_nn.g4view\", as above, then move the files "
|
||||
"into a sub-directory, say, \"views\", then interpolate with"
|
||||
"\"/vis/viewer/interpolate views/\" (note the trailing \'/\').");
|
||||
fpCommand -> SetParameterName ("filename", omitable = true);
|
||||
@@ -1634,7 +1640,7 @@ void G4VisCommandViewerSave::SetNewValue (G4UIcommand*, G4String newValue) {
|
||||
}
|
||||
std::ostringstream oss;
|
||||
oss << std::setw(2) << std::setfill('0') << sequenceNumber++;
|
||||
filename = "g4_" + oss.str() + ".view";
|
||||
filename = "g4_" + oss.str() + ".g4view";
|
||||
}
|
||||
|
||||
if (filename == "-") {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4VisCommandsViewerSet.cc 86988 2014-11-21 13:06:15Z gcosmo $
|
||||
// $Id: G4VisCommandsViewerSet.cc 101035 2016-11-04 08:48:17Z gcosmo $
|
||||
|
||||
// /vis/viewer/set commands - John Allison 16th May 2000
|
||||
|
||||
@@ -292,7 +292,7 @@ G4VisCommandsViewerSet::G4VisCommandsViewerSet ():
|
||||
fpCommandLineSegments->SetGuidance
|
||||
("Refers to graphical representation of objects with curved lines/surfaces.");
|
||||
fpCommandLineSegments->SetParameterName("line-segments",omitable = true);
|
||||
fpCommandLineSegments->SetDefaultValue(24);
|
||||
fpCommandLineSegments->SetDefaultValue(72);
|
||||
|
||||
fpCommandPicking = new G4UIcmdWithABool
|
||||
("/vis/viewer/set/picking",this);
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4VisManager.cc 97388 2016-06-02 10:04:52Z gcosmo $
|
||||
// $Id: G4VisManager.cc 101792 2016-11-28 16:47:50Z gcosmo $
|
||||
//
|
||||
//
|
||||
// GEANT4 Visualization Manager - John Allison 02/Jan/1996.
|
||||
@@ -546,6 +546,15 @@ void G4VisManager::Enable() {
|
||||
if (fVerbosity >= confirmations) {
|
||||
G4cout << "G4VisManager::Enable: visualization enabled." << G4endl;
|
||||
}
|
||||
if (fVerbosity >= warnings) {
|
||||
auto nKeptEvents =
|
||||
G4RunManager::GetRunManager()->GetCurrentRun()->GetEventVector()->size();
|
||||
G4cout <<
|
||||
"There are " << nKeptEvents << " kept events."
|
||||
"\n \"/vis/reviewKeptEvents\" to review them one by one."
|
||||
"\n \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (fVerbosity >= warnings) {
|
||||
@@ -562,11 +571,24 @@ void G4VisManager::Disable() {
|
||||
SetConcreteInstance(0);
|
||||
if (fVerbosity >= confirmations) {
|
||||
G4cout <<
|
||||
"G4VisManager::Disable: visualization disabled."
|
||||
"\n The pointer returned by GetConcreteInstance will be zero."
|
||||
"\n Note that it will become enabled after some valid vis commands."
|
||||
"G4VisManager::Disable: visualization disabled."
|
||||
"\n The pointer returned by GetConcreteInstance will be zero."
|
||||
"\n Note that it will become enabled after some valid vis commands."
|
||||
<< G4endl;
|
||||
}
|
||||
if (fVerbosity >= warnings) {
|
||||
G4int currentTrajectoryType =
|
||||
G4RunManagerKernel::GetRunManagerKernel()->GetTrackingManager()->GetStoreTrajectory();
|
||||
if (currentTrajectoryType > 0) {
|
||||
G4cout <<
|
||||
"You may wish to disable trajectory production too:"
|
||||
"\n \"/tracking/storeTrajectory 0\""
|
||||
"\nbut don't forget to re-enable with"
|
||||
"\n \"/vis/enable\""
|
||||
"\n \"/tracking/storeTrajectory " << currentTrajectoryType << "\" (for your case)."
|
||||
<< G4endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const G4GraphicsSystemList& G4VisManager::GetAvailableGraphicsSystems () {
|
||||
@@ -1438,7 +1460,7 @@ void G4VisManager::PrintAvailableGraphicsSystems (Verbosity verbosity) const
|
||||
{
|
||||
G4cout << "Current available graphics systems are:\n";
|
||||
if (fAvailableGraphicsSystems.size ()) {
|
||||
for (auto&& gs: fAvailableGraphicsSystems) {
|
||||
for (const auto& gs: fAvailableGraphicsSystems) {
|
||||
const G4String& name = gs->GetName();
|
||||
const std::vector<G4String>& nicknames = gs->GetNicknames();
|
||||
if (verbosity <= warnings) {
|
||||
@@ -1699,21 +1721,6 @@ G4ThreadFunReturnType G4VisManager::G4VisSubThread(G4ThreadFunArgType p)
|
||||
#endif
|
||||
}
|
||||
|
||||
// EndOfRun on master thread has signalled end of run
|
||||
if (pScene->GetRefreshAtEndOfRun()) {
|
||||
pSceneHandler->DrawEndOfRunModels();
|
||||
// ShowView guarantees the view is flushed to the screen. It also
|
||||
// triggers other features such picking (if enabled) and allows
|
||||
// file-writing viewers to close the file.
|
||||
pViewer->ShowView();
|
||||
// An extra refresh for auto-refresh viewers.
|
||||
// ???? I DON'T THINK THIS IS NECESSARY ???? JA ????
|
||||
// if (pViewer->GetViewParameters().IsAutoRefresh()) {
|
||||
// pViewer->RefreshView();
|
||||
// }
|
||||
pSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
}
|
||||
|
||||
// Inform viewer that we have finished all sub-thread drawing
|
||||
pViewer->DoneWithVisSubThread();
|
||||
pViewer->MovingToMasterThread();
|
||||
@@ -2054,7 +2061,11 @@ void G4VisManager::EndOfRun ()
|
||||
#endif
|
||||
|
||||
#ifdef G4MULTITHREADED
|
||||
if (IsValidView()) { // I.e., events should have been drawn.
|
||||
// Print warning about discarded events, if any.
|
||||
// Don't call IsValidView unless there is a scene handler. This
|
||||
// avoids WARNING message from IsValidView() when the user has
|
||||
// not instantiated a scene handler, e.g., in batch mode.
|
||||
if (fpSceneHandler && IsValidView()) { // Events should have been drawn
|
||||
G4int noOfEventsRequested = runManager->GetNumberOfEventsToBeProcessed();
|
||||
if (fNoOfEventsDrawnThisRun != noOfEventsRequested) {
|
||||
if (!fWaitOnEventQueueFull && fVerbosity >= warnings) {
|
||||
@@ -2089,7 +2100,10 @@ void G4VisManager::EndOfRun ()
|
||||
}
|
||||
G4cout << " made by the vis manager.)" << G4endl;
|
||||
}
|
||||
G4cout << " \"/vis/reviewKeptEvents\" to review them." << G4endl;
|
||||
G4cout <<
|
||||
"\n \"/vis/reviewKeptEvents\" to review them one by one."
|
||||
"\n \"/vis/viewer/flush\" or \"/vis/viewer/rebuild\" to see them accumulated."
|
||||
<< G4endl;
|
||||
}
|
||||
// static G4bool warned = false;
|
||||
// if (!valid && fVerbosity >= warnings && !warned) {
|
||||
@@ -2102,6 +2116,7 @@ void G4VisManager::EndOfRun ()
|
||||
// "\n \"/vis/scene/add/hits\" or \"/vis/scene/add/digitisations\""
|
||||
// "\n and, possibly, \"/vis/viewer/flush\"."
|
||||
// "\n To see all events: \"/vis/scene/endOfEventAction accumulate\"."
|
||||
// "\n (You may need \"/vis/viewer/flush\" or even \"/vis/viewer/rebuild\".)"
|
||||
// "\n To see events individually: \"/vis/reviewKeptEvents\"."
|
||||
// << G4endl;
|
||||
// warned = true;
|
||||
@@ -2132,21 +2147,17 @@ void G4VisManager::EndOfRun ()
|
||||
// // figured out why). ???? JA ????
|
||||
// if (!fpSceneHandler->GetMarkForClearingTransientStore()) {
|
||||
if (fpScene->GetRefreshAtEndOfRun()) {
|
||||
// Some instructions that should NOT be in multithreaded version.
|
||||
#ifndef G4MULTITHREADED
|
||||
// These instructions are in G4VisSubThread for multithreading.
|
||||
fpSceneHandler->DrawEndOfRunModels();
|
||||
// An extra refresh for auto-refresh viewers.
|
||||
// ???? I DON'T WHY THIS IS NECESSARY ???? JA ????
|
||||
if (fpViewer->GetViewParameters().IsAutoRefresh()) {
|
||||
fpViewer->RefreshView();
|
||||
}
|
||||
// ShowView guarantees the view is flushed to the screen. It also
|
||||
// triggers other features such picking (if enabled) and allows
|
||||
// file-writing viewers to close the file.
|
||||
fpViewer->ShowView();
|
||||
// // An extra refresh for auto-refresh viewers.
|
||||
// // ???? I DON'T THINK THIS IS NECESSARY ???? JA ????
|
||||
// if (fpViewer->GetViewParameters().IsAutoRefresh()) {
|
||||
// fpViewer->RefreshView();
|
||||
// }
|
||||
fpSceneHandler->SetMarkForClearingTransientStore(true);
|
||||
#endif
|
||||
} else {
|
||||
if (fpGraphicsSystem->GetFunctionality() ==
|
||||
G4VGraphicsSystem::fileWriter) {
|
||||
|
||||
Reference in New Issue
Block a user