Changeset 703 for trunk/geant4
- Timestamp:
- Jan 29, 2008, 6:15:49 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/geant4/visualization/OpenGL/src/G4OpenGLQtViewer.cc
r702 r703 48 48 #include "G4Scene.hh" 49 49 #include "G4OpenGLQtExportDialog.hh" 50 50 #include "G4UnitsTable.hh" 51 51 #include "G4Qt.hh" 52 52 #include "G4UImanager.hh" … … 416 416 QPopupMenu *mRepresentation = new QPopupMenu(fContextMenu); 417 417 418 QPopupMenu *mProjection = new QPopupMenu(f Projection);418 QPopupMenu *mProjection = new QPopupMenu(fContextMenu); 419 419 420 420 #if QT_VERSION < 0x030200 … … 447 447 448 448 QMenu *mRepresentation = mStyle->addMenu("&Representation"); 449 QMenu *mProjection = mStyle->addMenu("&Projection"); 449 450 QAction *polyhedron = mRepresentation->addAction("Polyhedron"); 450 451 QAction *nurbs = mRepresentation->addAction("NURBS"); 451 452 452 QAction *ortho = m Representation->addAction("Orthographic");453 QAction *perspective = m Representation->addAction("Persepective");453 QAction *ortho = mProjection->addAction("Orthographic"); 454 QAction *perspective = mProjection->addAction("Persepective"); 454 455 #endif 455 456 … … 1077 1078 fVP.SetRepStyle (style); 1078 1079 1079 #ifdef GEANT4_QT_DEBUG1080 printf("G4OpenGLQtViewer::toggleRepresentation 3%d\n",check);1081 #endif1082 1080 updateQWidget(); 1083 #ifdef GEANT4_QT_DEBUG1084 printf("G4OpenGLQtViewer::toggleRepresentation 4%d\n",check);1085 #endif1086 1081 } 1087 1082 … … 1101 1096 fVP.SetFieldHalfAngle (0); 1102 1097 } else { 1098 1103 1099 // look for the default parameter hidden in G4UIcommand parameters 1104 1100 G4UImanager* UI = G4UImanager::GetUIpointer(); … … 1113 1109 1114 1110 // find param 1115 G4UIparameter * param = NULL; 1116 1111 G4UIparameter * angleParam = NULL; 1117 1112 for(G4int i=0; i<command->GetParameterEntries(); i++) 1118 1113 { 1119 1114 if( command->GetParameter(i)->GetParameterName() == "field-half-angle" ) { 1120 param = command->GetParameter(i);1115 angleParam = command->GetParameter(i); 1121 1116 } 1122 1117 } 1123 if (! param)1118 if (!angleParam) 1124 1119 return; 1125 G4double defaultValue = command->ConvertToDouble(param->GetDefaultValue()); 1126 G4cout << "Perspective view has been set to default value. Field half angle="<<defaultValue <<" \n" << G4endl; 1127 fVP.SetFieldHalfAngle (defaultValue); 1128 } 1129 1130 #ifdef GEANT4_QT_DEBUG 1131 printf("G4OpenGLQtViewer::toggleRepresentation 3%d\n",check); 1132 #endif 1120 1121 // find unit 1122 G4UIparameter * unitParam = NULL; 1123 for(G4int i=0; i<command->GetParameterEntries(); i++) 1124 { 1125 if( command->GetParameter(i)->GetParameterName() == "unit" ) { 1126 unitParam = command->GetParameter(i); 1127 } 1128 } 1129 if (!unitParam) 1130 return; 1131 1132 G4double defaultValue = command->ConvertToDouble(angleParam->GetDefaultValue()) 1133 * G4UnitDefinition::GetValueOf(unitParam->GetDefaultValue()); 1134 if (defaultValue > 89.5 || defaultValue <= 0.0) { 1135 G4cerr << "Field half angle should be 0 < angle <= 89.5 degrees. Check your default Field half angle parameter\n"; 1136 } else { 1137 G4cout << "Perspective view has been set to default value. Field half angle="<<angleParam->GetDefaultValue() <<" \n" << G4endl; 1138 fVP.SetFieldHalfAngle (defaultValue); 1139 SetView (); 1140 } 1141 } 1133 1142 updateQWidget(); 1134 #ifdef GEANT4_QT_DEBUG1135 printf("G4OpenGLQtViewer::toggleRepresentation 4%d\n",check);1136 #endif1137 1143 } 1138 1144 … … 1193 1199 1194 1200 updateQWidget(); 1195 #ifdef GEANT4_QT_DEBUG1196 printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);1197 #endif1198 1201 } 1199 1202 … … 1212 1215 updateQWidget(); 1213 1216 1214 #ifdef GEANT4_QT_DEBUG1215 printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);1216 #endif1217 1217 } 1218 1218 … … 1230 1230 updateQWidget(); 1231 1231 1232 #ifdef GEANT4_QT_DEBUG1233 printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);1234 #endif1235 1232 } 1236 1233 … … 1244 1241 #else 1245 1242 G4cerr << "This version of G4UI Could not generate the selected format\n" << G4endl; 1246 #endif1247 #ifdef GEANT4_QT_DEBUG1248 printf("G4OpenGLQtViewer::toggleRepresentation %d\n",check);1249 1243 #endif 1250 1244 } … … 1417 1411 #endif 1418 1412 { 1419 int dx = pos_x - fLastPos.x();1420 int dy = pos_y - fLastPos.y();1413 int dx = fLastPos.x() - pos_x; 1414 int dy = fLastPos.y() - pos_y; 1421 1415 if (fMouseAction == STYLE1) { // rotate 1422 1416 if (mButtons & Qt::LeftButton) { … … 1825 1819 holdKeyEvent = true; 1826 1820 1827 #ifdef GEANT4_QT_DEBUG1828 printf("G4OpenGLQtViewer::keyPressEvent count:%d autoRepeat:%d key:%d\n",event->count(),event->isAutoRepeat(),event->key());1829 #endif1830 if (event->modifiers() & Qt::ShiftModifier)1831 {1832 printf("-------------------------\n");1833 }1834 1835 1821 if ((event->key() == Qt::Key_Down) && (event->modifiers() & Qt::ShiftModifier)) // go backward 1836 1822 { … … 1867 1853 updateQWidget(); 1868 1854 } 1869 #ifdef GEANT4_QT_DEBUG1870 printf("G4OpenGLQtViewer::keyPressEvent END\n");1871 #endif1872 1855 holdKeyEvent = false; 1873 1856 }
Note: See TracChangeset
for help on using the changeset viewer.