Import Geant4 11.1.0 source tree
This commit is contained in:
@@ -1,11 +1,60 @@
|
||||
# Category openinventor History
|
||||
|
||||
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
|
||||
which **must** added in reverse chronological order (newest at the top). It must **not**
|
||||
be used as a substitute for writing good git commit messages!
|
||||
which **must** added in reverse chronological order (newest at the top).
|
||||
It must **not** be used as a substitute for writing good git commit messages!
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
## 2022-11-25 Gabriele Cosmo (openinventor-V11-00-18)
|
||||
- Fixed compilation warnings for implicit type conversions on macOS/XCode 14.1.
|
||||
|
||||
## 2022-11-06 John Allison (openinventor-V11-00-17)
|
||||
- Eliminate G4cerr and introduce G4warn.
|
||||
- `#define G4warn G4cout`
|
||||
- The above is temporary until a genuine G4warn output stream is
|
||||
implemented.
|
||||
- Change G4cerr to G4warn in all cases.
|
||||
- In all except the Xt files, which, I understand are scheduled for
|
||||
removal, change G4cout to G4warn in those cases where it is clearly
|
||||
an error report or a warning.
|
||||
|
||||
## 2022-10-28 John Allison (openinventor-V11-00-16)
|
||||
- Request kernel visit when cutaway mode changes:
|
||||
- G4OpenInventorViewer.cc
|
||||
|
||||
## 2022-10-24 Frederick Jones (openinventor-V11-00-15)
|
||||
- G4OpenInventorQtExaminerViewer.cc: For MacOS only, disabled the mouse
|
||||
wheel event handler to fix the trackpad zoom direction issue.
|
||||
- G4OpenInventorXtExtendedViewer.cc: replaced sprintf by snprintf.
|
||||
|
||||
## 2022-10-18 Gabriele Cosmo (openinventor-V11-00-14)
|
||||
- Fixed compilation warning on gcc-12.
|
||||
|
||||
## 2022-10-14 Gabriele Cosmo (openinventor-V11-00-13)
|
||||
- Replaced use of sprintf() and vsprintf() with snprintf() and vsnprintf()
|
||||
respectively, to fix deprecation compilation warnings on macOS-13 SDK.
|
||||
|
||||
## 2022-10-07 Gabriele Cosmo (openinventor-V11-00-12)
|
||||
- Fixed compilation warnings on Intel/icc compiler for deprecated conversion
|
||||
of string literal to char* in G4OpenInventorQtExaminerViewer.
|
||||
|
||||
## 2022-09-14 John Allison (openinventor-V11-00-11)
|
||||
- G4OpenInventorViewer.cc:
|
||||
- Add check on special mesh rendering option in CompareForKernelVisit.
|
||||
|
||||
## 2022-09-03 John Allison (openinventor-V11-00-10)
|
||||
- Implement special mesh rendering:
|
||||
- Use base class `StandardSpecialMeshRendering`.
|
||||
|
||||
## 2022-08-31 Gabriele Cosmo (openinventor-V11-00-09)
|
||||
- Fixed reported Coverity defects for potentially uninitialised variables.
|
||||
|
||||
## 2022-07-05 Gabriele Cosmo (openinventor-V11-00-08)
|
||||
- Fixed compilation error for missing inclusion of G4Types.hh
|
||||
in G4OpenInventorTransform3D.hh, induced by recent changes in "global"
|
||||
category.
|
||||
|
||||
## 2022-05-03 Ben Morgan (openinventor-V11-00-07)
|
||||
- Preliminary build support for Qt5 and Qt6
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4String.hh"
|
||||
|
||||
//#include "G4OpenInventorViewer.hh"
|
||||
|
||||
@@ -182,6 +182,7 @@ private:
|
||||
int uiQtTabIndex;
|
||||
|
||||
int processSoEventCount;
|
||||
G4String empty = "";
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@@ -63,6 +63,9 @@ public:
|
||||
void AddPrimitive (const G4Polyhedron& p);
|
||||
void AddPrimitive (const G4Polymarker&);
|
||||
|
||||
using G4VSceneHandler::AddCompound;
|
||||
void AddCompound (const G4Mesh&);
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// Other inherited functions.
|
||||
void ClearStore ();
|
||||
|
||||
@@ -33,16 +33,21 @@
|
||||
#ifndef G4OPENINVENTORTRANSFORM3D_HH
|
||||
#define G4OPENINVENTORTRANSFORM3D_HH
|
||||
|
||||
#include "G4Types.hh"
|
||||
#include "G4Transform3D.hh"
|
||||
|
||||
class SbMatrix;
|
||||
|
||||
class G4OpenInventorTransform3D : public G4Transform3D {
|
||||
public:
|
||||
G4OpenInventorTransform3D (const G4Transform3D &t);
|
||||
SbMatrix* GetSbMatrix () const;
|
||||
private:
|
||||
G4float m[16];
|
||||
class G4OpenInventorTransform3D : public G4Transform3D
|
||||
{
|
||||
public:
|
||||
|
||||
G4OpenInventorTransform3D (const G4Transform3D &t);
|
||||
SbMatrix* GetSbMatrix () const;
|
||||
|
||||
private:
|
||||
|
||||
G4float m[16];
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include "moc_G4OpenInventorQt.cpp"
|
||||
#endif
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4OpenInventorQt::G4OpenInventorQt()
|
||||
: G4OpenInventor("OpenInventorQt", "OIQt", G4VGraphicsSystem::threeD),
|
||||
fInited(false)
|
||||
@@ -78,7 +80,7 @@ G4VViewer* G4OpenInventorQt::CreateViewer(G4VSceneHandler& scene,
|
||||
|
||||
if (pView) {
|
||||
if (pView->GetViewId() < 0) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"G4OpenInventorQt::CreateViewer: ERROR flagged by negative"
|
||||
" view id in G4OpenInventorQtViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
@@ -88,7 +90,7 @@ G4VViewer* G4OpenInventorQt::CreateViewer(G4VSceneHandler& scene,
|
||||
}
|
||||
}
|
||||
if (!pView) {
|
||||
G4cerr <<
|
||||
G4warn <<
|
||||
"G4OpenInventorQt::CreateViewer: ERROR: null pointer on new G4OpenInventorQtViewer."
|
||||
<< G4endl;
|
||||
}
|
||||
|
||||
@@ -102,6 +102,8 @@
|
||||
#include "moc_G4OpenInventorQtExaminerViewer.cpp"
|
||||
#endif
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4OpenInventorQtExaminerViewer* G4OpenInventorQtExaminerViewer::viewer = 0;
|
||||
|
||||
#define MIN_SPEED 2.1 // Lower number means faster
|
||||
@@ -896,8 +898,7 @@ void G4OpenInventorQtExaminerViewer::superimpositionEvent(SoAction * action)
|
||||
curInfoFont->name.setValue("defaultFont:Bold");
|
||||
char zPos[20];
|
||||
// FWJ need a better format here
|
||||
sprintf(zPos, "%-7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
// sprintf(zPos, "%7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
snprintf(zPos, sizeof zPos, "%-7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
curInfoText->string.setValue(SbString(zPos));
|
||||
}
|
||||
}
|
||||
@@ -922,7 +923,7 @@ bool G4OpenInventorQtExaminerViewer::loadViewPts()
|
||||
// Converts data from string type into necessary types
|
||||
while (getline(fileIn, token)) {
|
||||
|
||||
int end = token.find_last_not_of(' '); // Remove padded spaces
|
||||
std::size_t end = token.find_last_not_of(' '); // Remove padded spaces
|
||||
token = token.substr(0, end + 1);
|
||||
|
||||
char *vpName = new char[token.size() + 1];
|
||||
@@ -1043,7 +1044,7 @@ void G4OpenInventorQtExaminerViewer::moveCamera(float dist, bool lookdown)
|
||||
if (refParticleIdx < 0) {
|
||||
prevPt = refParticleTrajectory[refParticleIdx + step];
|
||||
dist = (prevPt - cam->position.getValue()).length();
|
||||
refParticleIdx = refParticleTrajectory.size() - 2;
|
||||
refParticleIdx = (int) refParticleTrajectory.size() - 2;
|
||||
}
|
||||
|
||||
// Set start and end points
|
||||
@@ -1178,9 +1179,9 @@ void G4OpenInventorQtExaminerViewer::pickingCB(void *aThis,
|
||||
}
|
||||
|
||||
if(coords == NULL) {
|
||||
G4cout << "Could not find the coordinates node"
|
||||
G4warn << "Could not find the coordinates node"
|
||||
" for the picked trajectory." << G4endl;
|
||||
G4cout << " Reference trajectory not set" << G4endl;
|
||||
G4warn << " Reference trajectory not set" << G4endl;
|
||||
return;
|
||||
}
|
||||
// FWJ DEBUG
|
||||
@@ -1202,7 +1203,7 @@ void G4OpenInventorQtExaminerViewer::pickingCB(void *aThis,
|
||||
|
||||
std::string strTrajPoint = "G4TrajectoryPoint:";
|
||||
std::ostringstream oss;
|
||||
for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
for (std::size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
G4cout << G4AttCheck(attHolder->GetAttValues()[i],
|
||||
attHolder->GetAttDefs()[i]);
|
||||
oss << G4AttCheck(attHolder->GetAttValues()[i],
|
||||
@@ -1223,11 +1224,11 @@ void G4OpenInventorQtExaminerViewer::pickingCB(void *aThis,
|
||||
} else {
|
||||
G4String name((char*)node->getName().getString());
|
||||
G4String cls((char*)node->getTypeId().getName().getString());
|
||||
G4cout << "SoNode : " << node
|
||||
G4warn << "SoNode : " << node
|
||||
<< " SoType : " << cls
|
||||
<< " name : " << name
|
||||
<< G4endl;
|
||||
G4cout << "No attributes attached." << G4endl;
|
||||
G4warn << "No attributes attached." << G4endl;
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -1243,18 +1244,18 @@ void G4OpenInventorQtExaminerViewer::pickingCB(void *aThis,
|
||||
// Default behavior in G4OpenInventorViewer::SelectionCB
|
||||
G4AttHolder* attHolder = dynamic_cast<G4AttHolder*>(node);
|
||||
if(attHolder && attHolder->GetAttDefs().size()) {
|
||||
for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
for (std::size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
G4cout << G4AttCheck(attHolder->GetAttValues()[i],
|
||||
attHolder->GetAttDefs()[i]);
|
||||
}
|
||||
} else {
|
||||
G4String name((char*)node->getName().getString());
|
||||
G4String cls((char*)node->getTypeId().getName().getString());
|
||||
G4cout << "SoNode : " << node
|
||||
G4warn << "SoNode : " << node
|
||||
<< " SoType : " << cls
|
||||
<< " name : " << name
|
||||
<< G4endl;
|
||||
G4cout << "No attributes attached." << G4endl;
|
||||
G4warn << "No attributes attached." << G4endl;
|
||||
}
|
||||
|
||||
//Suppress other event handlers
|
||||
@@ -1303,7 +1304,7 @@ void G4OpenInventorQtExaminerViewer::mouseoverCB(void *aThis, SoEventCallback *e
|
||||
attHolder->GetAttDefs();
|
||||
std::vector<const std::vector<G4AttValue>*> vecVals =
|
||||
attHolder->GetAttValues();
|
||||
for (size_t i = 0; i < vecDefs.size(); ++i) {
|
||||
for (std::size_t i = 0; i < vecDefs.size(); ++i) {
|
||||
const std::vector<G4AttValue> * vals = vecVals[i];
|
||||
|
||||
std::vector<G4AttValue>::const_iterator iValue;
|
||||
@@ -1337,7 +1338,7 @@ void G4OpenInventorQtExaminerViewer::mouseoverCB(void *aThis, SoEventCallback *e
|
||||
std::string strTrajPoint = "G4TrajectoryPoint:";
|
||||
std::ostringstream oss;
|
||||
G4String t1, t1Ch, t2, t3, t4;
|
||||
for (size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
for (std::size_t i = 0; i < attHolder->GetAttDefs().size(); ++i) {
|
||||
// G4cout << "Getting index " << i << " from attHolder" << G4endl;
|
||||
// No, returns a vector!
|
||||
// G4AttValue* attValue = attHolder->GetAttValues()[i];
|
||||
@@ -1375,7 +1376,7 @@ void G4OpenInventorQtExaminerViewer::mouseoverCB(void *aThis, SoEventCallback *e
|
||||
if (valueName == "IKE") t3 = "KE " + value;
|
||||
if (valueName == "IMom") {
|
||||
// Remove units
|
||||
unsigned ipos = value.rfind(" ");
|
||||
std::size_t ipos = value.rfind(" ");
|
||||
G4String value1 = value;
|
||||
value1.erase(ipos);
|
||||
t3 += " P (" + value1 + ")";
|
||||
@@ -1476,7 +1477,7 @@ void G4OpenInventorQtExaminerViewer::incSpeed() {
|
||||
animateBtwPtsPeriod = 0.0;
|
||||
|
||||
if (currentState != PAUSED_ANIMATION) {
|
||||
int lastIdx = refParticleTrajectory.size() - 1;
|
||||
int lastIdx = (int) refParticleTrajectory.size() - 1;
|
||||
if (refParticleIdx < lastIdx && !animateSensor->isScheduled())
|
||||
animateRefParticle();
|
||||
}
|
||||
@@ -1604,14 +1605,14 @@ void G4OpenInventorQtExaminerViewer::findAndSetRefPath()
|
||||
SoFullPath *path = (SoFullPath *)pathList[i];
|
||||
|
||||
G4AttHolder* attHolder = dynamic_cast<G4AttHolder*>(path->getTail());
|
||||
for (size_t j = 0; j < attHolder->GetAttDefs().size(); ++j) {
|
||||
for (std::size_t j = 0; j < attHolder->GetAttDefs().size(); ++j) {
|
||||
std::ostringstream oss;
|
||||
oss << G4AttCheck(attHolder->GetAttValues()[j],
|
||||
attHolder->GetAttDefs()[j]);
|
||||
|
||||
std::string findStr = "Type of trajectory (Type): ";
|
||||
std::string compareValue = "REFERENCE";
|
||||
size_t idx = oss.str().find(findStr);
|
||||
std::size_t idx = oss.str().find(findStr);
|
||||
|
||||
if(idx != std::string::npos) {
|
||||
if(oss.str().substr(idx + findStr.size(),
|
||||
@@ -1847,7 +1848,7 @@ void G4OpenInventorQtExaminerViewer::distanceToTrajectory(const SbVec3f &q,
|
||||
//
|
||||
// --PLG
|
||||
|
||||
const size_t count = refParticleTrajectory.size();
|
||||
const std::size_t count = refParticleTrajectory.size();
|
||||
assert(count>0);
|
||||
|
||||
SbVec3f b = refParticleTrajectory[0];
|
||||
@@ -1855,7 +1856,7 @@ void G4OpenInventorQtExaminerViewer::distanceToTrajectory(const SbVec3f &q,
|
||||
float sqrDist = sqrlen(dbq);
|
||||
closestPoint = b;
|
||||
index = 0;
|
||||
for (size_t i = 1; i < count; ++i) {
|
||||
for (std::size_t i = 1; i < count; ++i) {
|
||||
const SbVec3f a = b;
|
||||
const SbVec3f daq = dbq;
|
||||
b = refParticleTrajectory[i];
|
||||
@@ -1894,7 +1895,7 @@ void G4OpenInventorQtExaminerViewer::distanceToTrajectory(const SbVec3f &q,
|
||||
if (current_dist < sqrDist) {
|
||||
sqrDist = current_dist;
|
||||
closestPoint = a + t*(b-a);
|
||||
index = i;
|
||||
index = (int) i;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2030,8 +2031,8 @@ G4OpenInventorQtExaminerViewer::LookAtSceneElementCB(QListWidgetItem* item)
|
||||
|
||||
elementField = value;
|
||||
|
||||
int idx = elementField.find_last_of("[");
|
||||
if(idx == -1)
|
||||
std::size_t idx = elementField.find_last_of("[");
|
||||
if(idx == std::string::npos)
|
||||
idx = elementField.size(); //if "[" not found for whatever reason (list not sorted)
|
||||
else
|
||||
idx--; // To get rid of the space that is between the name and '['
|
||||
@@ -2040,7 +2041,8 @@ G4OpenInventorQtExaminerViewer::LookAtSceneElementCB(QListWidgetItem* item)
|
||||
SoFullPath *path;
|
||||
SoSearchAction search;
|
||||
SoNode *root = getSceneManager()->getSceneGraph();
|
||||
int counter, idxUnderscore = elementField.find_last_of("_");
|
||||
int counter;
|
||||
std::size_t idxUnderscore = elementField.find_last_of("_");
|
||||
|
||||
parseString<int>(counter,
|
||||
elementField.substr(idxUnderscore + 1, idx), error);
|
||||
@@ -2085,7 +2087,7 @@ G4OpenInventorQtExaminerViewer::LookAtSceneElementCB(QListWidgetItem* item)
|
||||
SbVec3f p;
|
||||
|
||||
float absLengthNow, absLengthMin;
|
||||
int maxIdx = refParticleTrajectory.size() - 2;
|
||||
int maxIdx = (int) refParticleTrajectory.size() - 2;
|
||||
int targetIdx = 0;
|
||||
SbVec3f dir;
|
||||
|
||||
@@ -2255,9 +2257,9 @@ void G4OpenInventorQtExaminerViewer::evenOutRefParticlePts()
|
||||
float totalDistBtwPts = 0;
|
||||
std::vector<SbVec3f> newRefParticleTrajectory;
|
||||
SbVec3f refPoint;
|
||||
int size = refParticleTrajectory.size() - 1;
|
||||
std::size_t size = refParticleTrajectory.size() - 1;
|
||||
int numOfPts = 0;
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
p1 = refParticleTrajectory[i];
|
||||
p2 = refParticleTrajectory[i + 1];
|
||||
if (p1 == p2)
|
||||
@@ -2273,7 +2275,7 @@ void G4OpenInventorQtExaminerViewer::evenOutRefParticlePts()
|
||||
// float maxDistAllowed = 1.25 * avgDistBtwPts; // Pts tend to be close not far
|
||||
|
||||
float x, y, z;
|
||||
int i = 0, j = 0;
|
||||
std::size_t i = 0, j = 0;
|
||||
while (i < size) {
|
||||
p1 = refParticleTrajectory[i];
|
||||
p2 = refParticleTrajectory[i + 1];
|
||||
@@ -2615,10 +2617,10 @@ void G4OpenInventorQtExaminerViewer::sceneChangeCB(void* userData, SoSensor*)
|
||||
|
||||
void G4OpenInventorQtExaminerViewer::addViewPoints()
|
||||
{
|
||||
int size = viewPtList.size();
|
||||
std::size_t size = viewPtList.size();
|
||||
if (!size) return;
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
new QListWidgetItem(viewPtList[i].viewPtName,
|
||||
AuxWindowDialog->listWidget);
|
||||
}
|
||||
@@ -2752,7 +2754,7 @@ G4OpenInventorQtExaminerViewer::ToolsAnimateRefParticleCB()
|
||||
// G4cout << "Tools: Animate Ref Particle CALLBACK" << G4endl;
|
||||
if (!refParticleTrajectory.size()) {
|
||||
returnToAnim = true;
|
||||
G4cout << "No Reference Trajectory" << G4endl;
|
||||
G4warn << "No Reference Trajectory" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3005,7 +3007,7 @@ void G4OpenInventorQtExaminerViewer::setViewPt()
|
||||
|
||||
SoCamera * camera = getCamera();
|
||||
if (camera == NULL) {
|
||||
G4cout << "setViewPt: Camera is null. Unable to set the viewpoint." <<
|
||||
G4warn << "setViewPt: Camera is null. Unable to set the viewpoint." <<
|
||||
G4endl;
|
||||
// String dialogName = (char *) "Missing Camera Node";
|
||||
// std::string msg = "Camera is null. Unable to set the viewpoint.";
|
||||
@@ -3014,7 +3016,7 @@ void G4OpenInventorQtExaminerViewer::setViewPt()
|
||||
}
|
||||
|
||||
if (!viewPtList.size()) {
|
||||
G4cout << "setViewPt: There are no viewpoints to load." << G4endl;
|
||||
G4warn << "setViewPt: There are no viewpoints to load." << G4endl;
|
||||
// String dialogName = (char *) "Missing Viewpoints";
|
||||
// std::string msg = "There are no viewpoints to load.";
|
||||
// warningMsgDialog(msg, dialogName, NULL);
|
||||
@@ -3095,7 +3097,7 @@ void G4OpenInventorQtExaminerViewer::PrevViewPtCB()
|
||||
|
||||
if (!viewPtList.size()) return;
|
||||
if (viewPtIdx == 0)
|
||||
viewPtIdx = viewPtList.size() - 1;
|
||||
viewPtIdx = (int) viewPtList.size() - 1;
|
||||
else
|
||||
viewPtIdx--;
|
||||
|
||||
@@ -3197,7 +3199,7 @@ void G4OpenInventorQtExaminerViewer::DeleteBookmarkCB()
|
||||
void G4OpenInventorQtExaminerViewer::deleteViewPt(char *vpName)
|
||||
{
|
||||
std::string line;
|
||||
int end;
|
||||
std::size_t end;
|
||||
fileIn.open(fileName.c_str());
|
||||
std::ofstream out("temporaryFile.txt");
|
||||
|
||||
@@ -3226,8 +3228,8 @@ void G4OpenInventorQtExaminerViewer::deleteViewPt(char *vpName)
|
||||
}
|
||||
}
|
||||
|
||||
int idx = 0; // Remove viewpoint from the vector
|
||||
int size = viewPtList.size();
|
||||
std::size_t idx = 0; // Remove viewpoint from the vector
|
||||
std::size_t size = viewPtList.size();
|
||||
while (idx < size) {
|
||||
if (!strcmp(viewPtList[idx].viewPtName, vpName)) {
|
||||
viewPtList.erase(viewPtList.begin() + idx);
|
||||
@@ -3266,7 +3268,7 @@ void G4OpenInventorQtExaminerViewer::deleteViewPt(char *vpName)
|
||||
fileOut.seekp(0, std::ios::end);
|
||||
|
||||
if (!viewPtList.size()) { // viewPtList is empty
|
||||
curViewPtName = (char *) "";
|
||||
curViewPtName = (char *) empty.c_str();
|
||||
scheduleRedraw();
|
||||
} else {
|
||||
if (viewPtIdx >= (int) viewPtList.size())
|
||||
@@ -3308,8 +3310,8 @@ void G4OpenInventorQtExaminerViewer::RenameBookmarkCB()
|
||||
char* newname = new char[nVPName];
|
||||
newname = strdup(qPrintable(newnamein));
|
||||
|
||||
int size = viewPtList.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
std::size_t size = viewPtList.size();
|
||||
for (std::size_t i = 0; i < size; ++i) {
|
||||
if (!strcmp(newname, viewPtList[i].viewPtName)) {
|
||||
QMessageBox msgbox;
|
||||
msgbox.setFont(*font);
|
||||
@@ -3332,8 +3334,8 @@ void G4OpenInventorQtExaminerViewer::RenameBookmarkCB()
|
||||
|
||||
void G4OpenInventorQtExaminerViewer::renameViewPt(char *vpName)
|
||||
{
|
||||
int idx = 0, end, pos;
|
||||
int size = viewPtList.size();
|
||||
std::size_t idx = 0, end, pos;
|
||||
std::size_t size = viewPtList.size();
|
||||
std::string line, newName;
|
||||
fileIn.open(fileName.c_str());
|
||||
|
||||
@@ -3416,7 +3418,7 @@ void G4OpenInventorQtExaminerViewer::sortViewPts(std::vector<std::string> sorted
|
||||
{
|
||||
SbVec3f axis;
|
||||
float x, y, z, angle;
|
||||
int sortIdx = 0, unsortIdx = 0;
|
||||
std::size_t sortIdx = 0, unsortIdx = 0;
|
||||
|
||||
if (fileOut.is_open())
|
||||
fileOut.close();
|
||||
@@ -3425,7 +3427,7 @@ void G4OpenInventorQtExaminerViewer::sortViewPts(std::vector<std::string> sorted
|
||||
|
||||
writeViewPtIdx();
|
||||
|
||||
int size = sortedViewPts.size();
|
||||
std::size_t size = sortedViewPts.size();
|
||||
while (sortIdx < size) {
|
||||
while (strcmp(sortedViewPts[sortIdx].c_str(),
|
||||
viewPtList[unsortIdx].viewPtName))
|
||||
@@ -3461,8 +3463,10 @@ void G4OpenInventorQtExaminerViewer::sortViewPts(std::vector<std::string> sorted
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Needed to implement mouse wheel zoom direction change.
|
||||
// Does not work with MacOS trackpad: use Coin3d default handler.
|
||||
// Emulating private method SoGuiFullViewerP::zoom()
|
||||
#ifndef __APPLE__
|
||||
void
|
||||
G4OpenInventorQtExaminerViewer::zoom(const float diffvalue)
|
||||
{
|
||||
@@ -3485,7 +3489,7 @@ G4OpenInventorQtExaminerViewer::zoom(const float diffvalue)
|
||||
oc->height = oc->height.getValue() * multiplicator;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Handling mouse and keyboard events
|
||||
|
||||
@@ -3499,6 +3503,9 @@ G4OpenInventorQtExaminerViewer::processSoEvent(const SoEvent* const ev)
|
||||
SoCamera *cam = getCamera();
|
||||
const SoType type(ev->getTypeId());
|
||||
|
||||
// Needed to implement mouse wheel zoom direction change.
|
||||
// Does not work with MacOS trackpad: use Coin3d default handler.
|
||||
#ifndef __APPLE__
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
SoMouseButtonEvent * me = (SoMouseButtonEvent *) ev;
|
||||
|
||||
@@ -3522,15 +3529,16 @@ G4OpenInventorQtExaminerViewer::processSoEvent(const SoEvent* const ev)
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// }
|
||||
if (currentState == GENERAL) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
SoKeyboardEvent* ke = (SoKeyboardEvent*)ev;
|
||||
|
||||
@@ -63,7 +63,9 @@
|
||||
#include "HEPVis/nodes/SoTrap.h"
|
||||
#endif
|
||||
#include "HEPVis/nodes/SoMarkerSet.h"
|
||||
typedef HEPVis_SoMarkerSet SoMarkerSet;
|
||||
|
||||
using SoMarkerSet = HEPVis_SoMarkerSet;
|
||||
|
||||
#include "HEPVis/nodekits/SoDetectorTreeKit.h"
|
||||
#include "HEPVis/misc/SoStyleCache.h"
|
||||
|
||||
@@ -95,6 +97,8 @@ typedef HEPVis_SoMarkerSet SoMarkerSet;
|
||||
#include "G4Material.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4int G4OpenInventorSceneHandler::fSceneIdCount = 0;
|
||||
|
||||
G4OpenInventorSceneHandler::G4OpenInventorSceneHandler (G4OpenInventor& system,
|
||||
@@ -198,13 +202,13 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
AddProperties(pVA); // Colour, etc.
|
||||
AddTransform(); // Transformation
|
||||
|
||||
G4int nPoints = line.size();
|
||||
G4int nPoints = (G4int)line.size();
|
||||
SbVec3f* pCoords = new SbVec3f[nPoints];
|
||||
|
||||
for (G4int iPoint = 0; iPoint < nPoints ; iPoint++) {
|
||||
pCoords[iPoint].setValue((float)line[iPoint].x(),
|
||||
(float)line[iPoint].y(),
|
||||
(float)line[iPoint].z());
|
||||
for (G4int iPoint = 0; iPoint < nPoints ; ++iPoint) {
|
||||
pCoords[iPoint].setValue((G4float)line[iPoint].x(),
|
||||
(G4float)line[iPoint].y(),
|
||||
(G4float)line[iPoint].z());
|
||||
}
|
||||
|
||||
//
|
||||
@@ -226,7 +230,7 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyline& line)
|
||||
if (fpViewer->GetViewParameters().IsPicking()) LoadAtts(line, pLine);
|
||||
|
||||
#ifdef INVENTOR2_0
|
||||
pLine->numVertices.setValues(0,1,(const long *)&nPoints);
|
||||
pLine->numVertices.setValues(0,1,(const G4long *)&nPoints);
|
||||
#else
|
||||
pLine->numVertices.setValues(0,1,&nPoints);
|
||||
#endif
|
||||
@@ -257,14 +261,14 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polymarker& polymarker)
|
||||
AddProperties(pVA); // Colour, etc.
|
||||
AddTransform(); // Transformation
|
||||
|
||||
G4int pointn = polymarker.size();
|
||||
G4int pointn = (G4int)polymarker.size();
|
||||
if(pointn<=0) return;
|
||||
|
||||
SbVec3f* points = new SbVec3f[pointn];
|
||||
for (G4int iPoint = 0; iPoint < pointn ; iPoint++) {
|
||||
points[iPoint].setValue((float)polymarker[iPoint].x(),
|
||||
(float)polymarker[iPoint].y(),
|
||||
(float)polymarker[iPoint].z());
|
||||
for (G4int iPoint = 0; iPoint < pointn ; ++iPoint) {
|
||||
points[iPoint].setValue((G4float)polymarker[iPoint].x(),
|
||||
(G4float)polymarker[iPoint].y(),
|
||||
(G4float)polymarker[iPoint].z());
|
||||
}
|
||||
|
||||
SoCoordinate3* coordinate3 = new SoCoordinate3;
|
||||
@@ -376,10 +380,10 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Text& text)
|
||||
//
|
||||
const G4Colour& c = GetTextColour (text);
|
||||
SoMaterial* material =
|
||||
fStyleCache->getMaterial((float)c.GetRed(),
|
||||
(float)c.GetGreen(),
|
||||
(float)c.GetBlue(),
|
||||
(float)(1-c.GetAlpha()));
|
||||
fStyleCache->getMaterial((G4float)c.GetRed(),
|
||||
(G4float)c.GetGreen(),
|
||||
(G4float)c.GetBlue(),
|
||||
(G4float)(1-c.GetAlpha()));
|
||||
fCurrentSeparator->addChild(material);
|
||||
|
||||
MarkerSizeType sizeType;
|
||||
@@ -473,9 +477,9 @@ void G4OpenInventorSceneHandler::AddCircleSquare
|
||||
|
||||
// Borrowed from AddPrimitive(G4Polymarker) - inefficient? JA
|
||||
SbVec3f* points = new SbVec3f[1];
|
||||
points[0].setValue((float)centre.x(),
|
||||
(float)centre.y(),
|
||||
(float)centre.z());
|
||||
points[0].setValue((G4float)centre.x(),
|
||||
(G4float)centre.y(),
|
||||
(G4float)centre.z());
|
||||
SoCoordinate3* coordinate3 = new SoCoordinate3;
|
||||
coordinate3->point.setValues(0,1,points);
|
||||
fCurrentSeparator->addChild(coordinate3);
|
||||
@@ -581,6 +585,10 @@ void G4OpenInventorSceneHandler::AddPrimitive (const G4Polyhedron& polyhedron)
|
||||
fCurrentSeparator->addChild(soPolyhedron);
|
||||
}
|
||||
|
||||
void G4OpenInventorSceneHandler::AddCompound(const G4Mesh& mesh) {
|
||||
StandardSpecialMeshRendering(mesh);
|
||||
}
|
||||
|
||||
void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
{
|
||||
// Utility for PreAddSolid and BeginPrimitives.
|
||||
@@ -611,8 +619,8 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
// PVNodeID object, which is a physical volume and copy number. It
|
||||
// is a vector of PVNodeIDs corresponding to the geometry hierarchy
|
||||
// actually selected, i.e., not culled.
|
||||
typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
|
||||
typedef std::vector<PVNodeID> PVPath;
|
||||
using PVNodeID = G4PhysicalVolumeModel::G4PhysicalVolumeNodeID;
|
||||
using PVPath = std::vector<PVNodeID>;
|
||||
const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
|
||||
//G4int currentDepth = pPVModel->GetCurrentDepth();
|
||||
G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
|
||||
@@ -664,10 +672,10 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
|
||||
// First find the color attributes...
|
||||
const G4Colour& g4Col = pApplicableVisAttribs->GetColour ();
|
||||
const double red = g4Col.GetRed ();
|
||||
const double green = g4Col.GetGreen ();
|
||||
const double blue = g4Col.GetBlue ();
|
||||
double transparency = 1 - g4Col.GetAlpha();
|
||||
const G4double red = g4Col.GetRed ();
|
||||
const G4double green = g4Col.GetGreen ();
|
||||
const G4double blue = g4Col.GetBlue ();
|
||||
G4double transparency = 1 - g4Col.GetAlpha();
|
||||
|
||||
// Drawing style...
|
||||
G4ViewParameters::DrawingStyle drawing_style =
|
||||
@@ -687,10 +695,10 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
}
|
||||
|
||||
SoMaterial* material =
|
||||
fStyleCache->getMaterial((float)red,
|
||||
(float)green,
|
||||
(float)blue,
|
||||
(float)transparency);
|
||||
fStyleCache->getMaterial((G4float)red,
|
||||
(G4float)green,
|
||||
(G4float)blue,
|
||||
(G4float)transparency);
|
||||
detectorTreeKit->setPart("appearance.material",material);
|
||||
|
||||
SoLightModel* lightModel =
|
||||
@@ -714,7 +722,7 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
// G4PhysicalVolumeModel sends volumes as it encounters them,
|
||||
// i.e., mothers before daughters, in its descent of the
|
||||
// geometry tree. Error!
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"ERROR: G4OpenInventorSceneHandler::GeneratePrerequisites: Mother "
|
||||
<< ri->GetPhysicalVolume()->GetName()
|
||||
<< ':' << ri->GetCopyNo()
|
||||
@@ -744,7 +752,7 @@ void G4OpenInventorSceneHandler::GeneratePrerequisites()
|
||||
// G4PhysicalVolumeModel sends volumes as it encounters them,
|
||||
// i.e., mothers before daughters, in its descent of the
|
||||
// geometry tree. Error!
|
||||
G4cout << "ERROR: G4OpenInventorSceneHandler::PreAddSolid: Mother "
|
||||
G4warn << "ERROR: G4OpenInventorSceneHandler::PreAddSolid: Mother "
|
||||
<< ri->GetPhysicalVolume()->GetName()
|
||||
<< ':' << ri->GetCopyNo()
|
||||
<< " not previously encountered."
|
||||
@@ -777,10 +785,10 @@ void G4OpenInventorSceneHandler::AddProperties(const G4VisAttributes* visAtts)
|
||||
|
||||
// First find the color attributes...
|
||||
const G4Colour& g4Col = pApplicableVisAttribs->GetColour ();
|
||||
const double red = g4Col.GetRed ();
|
||||
const double green = g4Col.GetGreen ();
|
||||
const double blue = g4Col.GetBlue ();
|
||||
double transparency = 1 - g4Col.GetAlpha();
|
||||
const G4double red = g4Col.GetRed ();
|
||||
const G4double green = g4Col.GetGreen ();
|
||||
const G4double blue = g4Col.GetBlue ();
|
||||
G4double transparency = 1 - g4Col.GetAlpha();
|
||||
|
||||
// Drawing style...
|
||||
G4ViewParameters::DrawingStyle drawing_style =
|
||||
@@ -804,10 +812,10 @@ void G4OpenInventorSceneHandler::AddProperties(const G4VisAttributes* visAtts)
|
||||
fReducedWireFrame = !isAuxEdgeVisible;
|
||||
|
||||
SoMaterial* material =
|
||||
fStyleCache->getMaterial((float)red,
|
||||
(float)green,
|
||||
(float)blue,
|
||||
(float)transparency);
|
||||
fStyleCache->getMaterial((G4float)red,
|
||||
(G4float)green,
|
||||
(G4float)blue,
|
||||
(G4float)transparency);
|
||||
fCurrentSeparator->addChild(material);
|
||||
|
||||
SoLightModel* lightModel =
|
||||
@@ -830,7 +838,7 @@ void G4OpenInventorSceneHandler::AddTransform(const G4Point3D& translation)
|
||||
const G4Vector3D scale = fpViewer->GetViewParameters().GetScaleFactor();
|
||||
SbMatrix sbScale;
|
||||
sbScale.setScale
|
||||
(SbVec3f((float)scale.x(),(float)scale.y(),(float)scale.z()));
|
||||
(SbVec3f((G4float)scale.x(),(G4float)scale.y(),(G4float)scale.z()));
|
||||
sbMatrix->multRight(sbScale);
|
||||
|
||||
matrixTransform->matrix.setValue(*sbMatrix);
|
||||
|
||||
@@ -192,7 +192,9 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
|
||||
(vp.GetVisAttributesModifiers() !=
|
||||
fVP.GetVisAttributesModifiers()) ||
|
||||
(vp.IsSpecialMeshRendering() !=
|
||||
fVP.IsSpecialMeshRendering())
|
||||
fVP.IsSpecialMeshRendering()) ||
|
||||
(vp.GetSpecialMeshRenderingOption() !=
|
||||
fVP.GetSpecialMeshRenderingOption())
|
||||
)
|
||||
return true;
|
||||
|
||||
@@ -210,6 +212,7 @@ G4bool G4OpenInventorViewer::CompareForKernelVisit(G4ViewParameters& vp) {
|
||||
return true;
|
||||
|
||||
if (vp.IsCutaway ()) {
|
||||
if (vp.GetCutawayMode() != fVP.GetCutawayMode()) return true;
|
||||
if (vp.GetCutawayPlanes ().size () !=
|
||||
fVP.GetCutawayPlanes ().size ()) return true;
|
||||
for (size_t i = 0; i < vp.GetCutawayPlanes().size(); ++i)
|
||||
|
||||
@@ -576,7 +576,7 @@ void G4OpenInventorXtExaminerViewer::superimpositionEvent(SoAction * action)
|
||||
this->curInfoFont->size.setValue(16);
|
||||
this->curInfoFont->name.setValue("defaultFont:Bold");
|
||||
char zPos[20];
|
||||
sprintf(zPos, "%7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
snprintf(zPos, sizeof zPos, "%7.2f [m]", refZPositions[refParticleIdx] / 1000);
|
||||
this->curInfoText->string.setValue(SbString(zPos));
|
||||
}
|
||||
}
|
||||
@@ -925,9 +925,9 @@ void G4OpenInventorXtExaminerViewer::moveCamera(float dist, bool lookdown)
|
||||
{
|
||||
|
||||
SoCamera *cam = getCamera();
|
||||
SbVec3f p1, p2; // The particle moves from p1 to p2
|
||||
SbVec3f particleDir; // Direction vector from p1 to p2
|
||||
SbVec3f camPosNew; // New position of the camera
|
||||
SbVec3f p1(0), p2(0); // The particle moves from p1 to p2
|
||||
SbVec3f particleDir; // Direction vector from p1 to p2
|
||||
SbVec3f camPosNew(0); // New position of the camera
|
||||
|
||||
if(refParticleTrajectory.size() == 0) {
|
||||
//refParticleTrajectory hasn't been set yet
|
||||
@@ -1006,7 +1006,7 @@ void G4OpenInventorXtExaminerViewer::moveCamera(float dist, bool lookdown)
|
||||
// }
|
||||
|
||||
|
||||
float x,y,z;
|
||||
float x(0.),y(0.),z(0.);
|
||||
prevPt.getValue(x,y,z);
|
||||
|
||||
|
||||
@@ -2769,7 +2769,7 @@ void G4OpenInventorXtExaminerViewer::lookAtSceneElementCB(Widget,
|
||||
SoFullPath *path;
|
||||
SoSearchAction search;
|
||||
SoNode *root = This->getSceneManager()->getSceneGraph();
|
||||
int counter, idxUnderscore = elementField.find_last_of("_");
|
||||
int counter(1), idxUnderscore = elementField.find_last_of("_");
|
||||
|
||||
This->parseString<int>(counter, elementField.substr(idxUnderscore + 1, idx), error);
|
||||
|
||||
@@ -3495,7 +3495,7 @@ bool G4OpenInventorXtExaminerViewer::loadViewPts()
|
||||
std::string token;
|
||||
SbVec3f axis;
|
||||
SbRotation orient;
|
||||
float x, y, z, angle;
|
||||
float x(0.), y(0.), z(0.), angle(0.);
|
||||
|
||||
// Gets the last view point accessed, stored in the first line of the data file.
|
||||
fileIn >> token;
|
||||
@@ -3531,7 +3531,7 @@ bool G4OpenInventorXtExaminerViewer::loadViewPts()
|
||||
orient.setValue(axis.setValue(x, y, z), angle);
|
||||
tmp.orientation = orient.getValue();
|
||||
|
||||
int camType;
|
||||
int camType(0);
|
||||
parseString<int>(camType, token, error);
|
||||
fileIn >> token;
|
||||
tmp.camType = (CameraType) camType;
|
||||
@@ -4683,8 +4683,8 @@ void G4OpenInventorXtExaminerViewer::setStartingPtForAnimation()
|
||||
stopAnimating();
|
||||
|
||||
SbRotation rot;
|
||||
SbVec3f p1, p2, p2_tmp, camUpV, camD, camD_tmp, leftRightAxis;
|
||||
float x1, y1, z1, x2, y2, z2;
|
||||
SbVec3f p1(0), p2(0), p2_tmp(0), camUpV(0), camD, camD_tmp, leftRightAxis;
|
||||
float x1(0.), y1(0.), z1(0.), x2(0.), y2(0.), z2(0.);
|
||||
|
||||
if (currentState == ANIMATION) {
|
||||
p1 = refParticleTrajectory[refParticleIdx];
|
||||
|
||||
@@ -103,7 +103,7 @@ void G4OpenInventorXtExtendedViewer::Initialise() {
|
||||
<< G4endl;
|
||||
width = 600;
|
||||
height = 600;
|
||||
sprintf(s,"%dx%d",width,height);
|
||||
snprintf(s,32,"%dx%d",width,height);
|
||||
sgeometry = s;
|
||||
} else {
|
||||
width = fVP.GetWindowSizeHintX();
|
||||
|
||||
@@ -96,7 +96,7 @@ void G4OpenInventorXtViewer::Initialise() {
|
||||
<< G4endl;
|
||||
width = 600;
|
||||
height = 600;
|
||||
sprintf(str,"%dx%d",width,height);
|
||||
snprintf(str,sizeof str,"%dx%d",width,height);
|
||||
sgeometry = str;
|
||||
} else {
|
||||
width = fVP.GetWindowSizeHintX();
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "moc_G4SoQt.cpp"
|
||||
#endif
|
||||
|
||||
#define G4warn G4cout
|
||||
|
||||
G4SoQt* G4SoQt::instance = NULL;
|
||||
|
||||
static G4bool QtInited = FALSE;
|
||||
@@ -142,7 +144,7 @@ void G4SoQt::SecondaryLoop()
|
||||
// "ENTERING OIQT VIEWER SECONDARY LOOP" << G4endl;
|
||||
// else
|
||||
|
||||
G4cout <<
|
||||
G4warn <<
|
||||
"ENTERING OIQT VIEWER SECONDARY LOOP... PRESS E KEY TO EXIT" << G4endl;
|
||||
|
||||
SoQt::mainLoop();
|
||||
|
||||
@@ -465,7 +465,7 @@ void SbPainterPS::putInStreamF(
|
||||
va_start(args,aFormat);
|
||||
printV(aFormat,args);
|
||||
va_end(args);
|
||||
int length = ::strlen(fBufferString);
|
||||
int length = (int)strlen(fBufferString);
|
||||
if(length>METAFILE_RECORD_LENGTH) {
|
||||
::printf("SoPostScript::putInStreamF overflow\n");
|
||||
return;
|
||||
@@ -523,7 +523,7 @@ void SbPainterPS::printV(
|
||||
if(fBufferString==NULL) return;
|
||||
}
|
||||
fBufferString[MAX_STR-1] = '\0';
|
||||
::vsprintf(fBufferString,This,aArgs);
|
||||
::vsnprintf(fBufferString,MAX_STR-1, This,aArgs);
|
||||
if(fBufferString[MAX_STR-1]!='\0') {
|
||||
::printf("SbPainterPS::printV overflow\n");
|
||||
fBufferString[0] = '\0';
|
||||
|
||||
Reference in New Issue
Block a user