- Timestamp:
- May 20, 2010, 11:49:26 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/modeling/src/G4TrajectoryDrawerUtils.cc
r1247 r1258 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4TrajectoryDrawerUtils.cc,v 1.1 3 2010/04/27 15:46:18 lgarnierExp $26 // $Id: G4TrajectoryDrawerUtils.cc,v 1.14 2010/05/11 11:58:18 allison Exp $ 27 27 // GEANT4 tag $Name: $ 28 28 // … … 40 40 #include "G4UIcommand.hh" 41 41 #include "G4AttValue.hh" 42 #include <sstream> 42 43 43 44 namespace G4TrajectoryDrawerUtils { … … 79 80 } 80 81 } 81 82 83 /*** 82 84 void DrawLineAndPoints(const G4VTrajectory& traj, const G4int& i_mode, const G4Colour& colour, const G4bool& visible) { 83 85 // If i_mode>=0, draws a trajectory as a polyline (default is blue for … … 87 89 // given by std::abs(i_mode)/1000. E.g: i_mode = 5000 gives easily 88 90 // visible markers. 91 92 static G4bool warnedAboutIMode = false; 93 std::ostringstream oss; 94 oss << "WARNING: DEPRECATED use of i_mode (i_mode: " << i_mode 95 << "). Feature will be removed at a future major release."; 96 if (!warnedAboutIMode) { 97 G4Exception 98 ("G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, i_mode, colour, visible)", 99 "", 100 JustWarning, 101 oss.str().c_str()); 102 warnedAboutIMode = true; 103 } 89 104 90 105 G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance(); … … 130 145 131 146 } 147 ***/ 132 148 133 149 static void GetTimes(const G4VTrajectory& traj, … … 146 162 147 163 // Pre- and Post-Point times from the trajectory point... 148 G4double trajectoryPointPreTime = - DBL_MAX;149 G4double trajectoryPointPostTime = DBL_MAX;164 G4double trajectoryPointPreTime = -std::numeric_limits<double>::max(); 165 G4double trajectoryPointPostTime = std::numeric_limits<double>::max(); 150 166 std::vector<G4AttValue>* trajectoryPointAttValues = 151 167 aTrajectoryPoint->CreateAttValues(); … … 356 372 void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext& context, const G4int& i_mode) 357 373 { 374 static G4bool warnedAboutIMode = false; 375 std::ostringstream oss; 376 oss << "WARNING: DEPRECATED use of i_mode (i_mode: " << i_mode 377 << "). Feature will be removed at a future major release."; 378 if (!warnedAboutIMode) { 379 G4Exception 380 ("G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, context, i_mode)", 381 "", 382 JustWarning, 383 oss.str().c_str()); 384 warnedAboutIMode = true; 385 } 386 358 387 // Extra copy while i_mode is still around 359 388 G4VisTrajContext myContext(context); … … 370 399 myContext.SetAuxPtsSize(markerSize); 371 400 myContext.SetStepPtsSize(markerSize); 372 373 static G4bool warnedAboutIMode = false;374 375 if (!warnedAboutIMode) {376 G4cout<<"Trajectory drawing configuration will be based on imode value of "<<i_mode<<G4endl;377 warnedAboutIMode = true;378 }379 401 } 380 402 … … 421 443 } 422 444 } 445 446 void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext& context) 447 { 448 // Return if don't need to do anything 449 if (!context.GetDrawLine() && !context.GetDrawAuxPts() && !context.GetDrawStepPts()) return; 450 451 // Get points to draw 452 G4Polyline trajectoryLine; 453 G4Polymarker stepPoints; 454 G4Polymarker auxiliaryPoints; 455 456 GetPoints(traj, trajectoryLine, auxiliaryPoints, stepPoints); 457 458 if (context.GetTimeSliceInterval()) { 459 460 // Get corresponding track time information, if any 461 std::vector<G4double> trajectoryLineTimes; 462 std::vector<G4double> stepPointTimes; 463 std::vector<G4double> auxiliaryPointTimes; 464 465 GetTimes(traj, trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes); 466 467 // Check validity 468 if (trajectoryLineTimes.size() != trajectoryLine.size() || 469 stepPointTimes.size() != stepPoints.size() || 470 auxiliaryPointTimes.size() != auxiliaryPoints.size()) { 471 472 // Revert to drawing without time information... 473 DrawWithoutTime(context, trajectoryLine, auxiliaryPoints, stepPoints); 474 } else { 475 476 SliceLine(context.GetTimeSliceInterval(), 477 trajectoryLine, trajectoryLineTimes); 478 479 DrawWithTime(context, 480 trajectoryLine, auxiliaryPoints, stepPoints, 481 trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes); 482 } 483 484 } else { 485 486 DrawWithoutTime(context, trajectoryLine, auxiliaryPoints, stepPoints); 487 488 } 489 } 423 490 }
Note: See TracChangeset
for help on using the changeset viewer.