Changeset 1315 for trunk/source/visualization/HepRep/src
- Timestamp:
- Jun 18, 2010, 11:42:07 AM (14 years ago)
- Location:
- trunk/source/visualization/HepRep/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/visualization/HepRep/src/G4HepRepFileSceneHandler.cc
r1228 r1315 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4HepRepFileSceneHandler.cc,v 1.6 8 2009/12/16 17:51:21 gunterExp $27 // GEANT4 tag $Name: $26 // $Id: G4HepRepFileSceneHandler.cc,v 1.69 2010/06/05 06:25:03 perl Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 28 28 // 29 29 // … … 210 210 #endif 211 211 212 // HepRApp does not correctly represent the end faces of cones at 213 // non-standard angles, let the base class convert these solids to polygons. 214 CLHEP::HepRotation r = fpObjectTransformation->getRotation(); 215 G4bool linedUpWithAnAxis = (std::fabs(r.phiX())<=.001 || 216 std::fabs(r.phiY())<=.001 || 217 std::fabs(r.phiZ())<=.001 || 218 std::fabs(r.phiX()-pi)<=.001 || 219 std::fabs(r.phiY()-pi)<=.001 || 220 std::fabs(r.phiZ()-pi)<=.001); 221 //G4cout << "Angle X:" << r.phiX() << ", Angle Y:" << r.phiY() << ", Angle Z:" << r.phiZ() << G4endl; 222 //G4cout << "linedUpWithAnAxis:" << linedUpWithAnAxis << G4endl; 223 212 224 // HepRep does not have a primitive for a cut cone, 213 225 // so if this cone is cut, let the base class convert this 214 226 // solid to polygons. 215 if (cons.GetDeltaPhiAngle() < twopi) { 227 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 228 if (cons.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons()) 229 { 216 230 G4VSceneHandler::AddSolid(cons); // Invoke default action. 217 231 } else { … … 278 292 // so if this cylinder is cut, let the base class convert this 279 293 // solid to polygons. 280 if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis) 294 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance(); 295 if (tubs.GetDeltaPhiAngle() < twopi || !linedUpWithAnAxis || messenger->renderCylAsPolygons()) 281 296 { 282 297 G4VSceneHandler::AddSolid(tubs); // Invoke default action. … … 291 306 haveVisible = false; 292 307 AddHepRepInstance("Cylinder", NULL); 293 294 G4HepRepMessenger* messenger = G4HepRepMessenger::GetInstance();295 308 296 309 if (fpVisAttribs && (fpVisAttribs->IsVisible()==0) && messenger->getCullInvisibles()) … … 475 488 if (!pTrModel) G4Exception 476 489 ("G4HepRepFileSceneHandler::AddCompound(const G4VTrajectory&): Not a G4TrajectoriesModel."); 477 G4int drawingMode = pTrModel->GetDrawingMode();478 490 479 491 // Pointers to hold trajectory attribute values and definitions. … … 551 563 // Would rather be able to get these attDefs without needing a reference from any 552 564 // particular point, but don't know how to do that. 553 if (( drawingMode!=0 ||trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts())565 if ((trajContext->GetDrawStepPts() || trajContext->GetDrawAuxPts()) 554 566 && traj.GetPointEntries()>0) { 555 567 G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0); … … 626 638 627 639 // Draw step points. 628 if ( drawingMode!=0 ||trajContext->GetDrawStepPts()) {640 if (trajContext->GetDrawStepPts()) { 629 641 if (!doneInitTraj) 630 642 InitTrajectory(); … … 642 654 G4bool visible; 643 655 G4bool square; 644 if (drawingMode==0) { 645 G4Colour colour = trajContext->GetStepPtsColour(); 646 redness = colour.GetRed(); 647 greenness = colour.GetGreen(); 648 blueness = colour.GetBlue(); 649 markSize = (G4int) trajContext->GetStepPtsSize(); 650 visible = (G4int) trajContext->GetStepPtsVisible(); 651 square = (trajContext->GetStepPtsType()==G4Polymarker::squares); 652 } else { 653 redness = 1.; 654 greenness = 1.; 655 blueness = 1.; 656 markSize = std::abs(drawingMode/1000); 657 visible = true; 658 square = false; 659 } 656 G4Colour colour = trajContext->GetStepPtsColour(); 657 redness = colour.GetRed(); 658 greenness = colour.GetGreen(); 659 blueness = colour.GetBlue(); 660 markSize = (G4int) trajContext->GetStepPtsSize(); 661 visible = (G4int) trajContext->GetStepPtsVisible(); 662 square = (trajContext->GetStepPtsType()==G4Polymarker::squares); 660 663 661 664 // Avoiding drawing anything black on black. … … 735 738 736 739 // Draw Auxiliary Points 737 if ( drawingMode!=0 ||trajContext->GetDrawAuxPts()) {740 if (trajContext->GetDrawAuxPts()) { 738 741 if (!doneInitTraj) 739 742 InitTrajectory(); … … 751 754 G4bool visible; 752 755 G4bool square; 753 if (drawingMode==0) { 754 G4Colour colour = trajContext->GetAuxPtsColour(); 755 redness = colour.GetRed(); 756 greenness = colour.GetGreen(); 757 blueness = colour.GetBlue(); 758 markSize = (G4int) trajContext->GetAuxPtsSize(); 759 visible = (G4int) trajContext->GetAuxPtsVisible(); 760 square = (trajContext->GetAuxPtsType()==G4Polymarker::squares); 761 } else { 762 redness = 1.; 763 greenness = 1.; 764 blueness = 1.; 765 markSize = std::abs(drawingMode/1000); 766 visible = true; 767 square = false; 768 } 756 G4Colour colour = trajContext->GetAuxPtsColour(); 757 redness = colour.GetRed(); 758 greenness = colour.GetGreen(); 759 blueness = colour.GetBlue(); 760 markSize = (G4int) trajContext->GetAuxPtsSize(); 761 visible = (G4int) trajContext->GetAuxPtsVisible(); 762 square = (trajContext->GetAuxPtsType()==G4Polymarker::squares); 769 763 770 764 // Avoiding drawing anything black on black. -
trunk/source/visualization/HepRep/src/G4HepRepMessenger.cc
r1228 r1315 24 24 // ******************************************************************** 25 25 // 26 // $Id: G4HepRepMessenger.cc,v 1.1 1 2009/11/23 05:42:28perl Exp $27 // GEANT4 tag $Name: $26 // $Id: G4HepRepMessenger.cc,v 1.12 2010/06/05 06:25:03 perl Exp $ 27 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 28 28 // 29 29 #include "G4HepRepMessenger.hh" … … 100 100 } 101 101 setCullInvisiblesCommand->AvailableForStates(G4State_Idle); 102 103 renderCylAsPolygonsCommand = new G4UIcmdWithABool("/vis/heprep/renderCylAsPolygons", this); 104 renderCylAsPolygonsCommand->SetGuidance("Render cylinders and cones as polygons."); 105 renderCylAsPolygonsCommand->SetGuidance("This command is used by HepRepFile, not by HepRepXML."); 106 renderCylAsPolygonsCommand->SetParameterName("flag",false); 107 renderCylAsPolygonsCommand->SetDefaultValue(true); 108 renderCylAsPolygonsCommand->AvailableForStates(G4State_Idle); 102 109 103 110 setEventNumberSuffixCommand = new G4UIcmdWithAString("/vis/heprep/setEventNumberSuffix", this); … … 122 129 addPointAttributesCommand->SetDefaultValue(false); 123 130 addPointAttributesCommand->AvailableForStates(G4State_Idle); 124 125 126 127 useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile. ");128 129 130 131 132 useSolidsCommand = new G4UIcmdWithABool("/vis/heprep/useSolids", this); 133 useSolidsCommand->SetGuidance("Use HepRep Solids, rather than Geant4 Primitives."); 134 useSolidsCommand->SetGuidance("This command is used by HepRepXML, not by HepRepFile.."); 135 useSolidsCommand->SetParameterName("flag",false); 136 useSolidsCommand->SetDefaultValue(true); 137 useSolidsCommand->AvailableForStates(G4State_Idle); 131 138 } 132 139 … … 136 143 delete setOverwriteCommand; 137 144 delete setCullInvisiblesCommand; 145 delete renderCylAsPolygonsCommand; 138 146 delete setEventNumberSuffixCommand; 139 147 delete appendGeometryCommand; … … 152 160 } else if (command==setCullInvisiblesCommand) { 153 161 return cullInvisibles; 162 } else if (command==renderCylAsPolygonsCommand) { 163 return renderCylAsPolygonsCommand->ConvertToString(cylAsPolygons); 154 164 } else if (command==setEventNumberSuffixCommand) { 155 165 return suffix; … … 174 184 } else if (command==setCullInvisiblesCommand) { 175 185 cullInvisibles = setCullInvisiblesCommand->GetNewBoolValue(newValue); 186 } else if (command==renderCylAsPolygonsCommand) { 187 cylAsPolygons = renderCylAsPolygonsCommand->GetNewBoolValue(newValue); 176 188 } else if (command==setEventNumberSuffixCommand) { 177 189 suffix = newValue; … … 201 213 } 202 214 215 G4bool G4HepRepMessenger::renderCylAsPolygons() { 216 return cylAsPolygons; 217 } 218 203 219 G4String G4HepRepMessenger::getEventNumberSuffix() { 204 220 return suffix;
Note: See TracChangeset
for help on using the changeset viewer.