Exemple #1
0
 def recreate(self, negMsgHandler, parentKey, offset):
     # start cutting suface not on sampled grid
     if not covise.coConfigIsOn("vr-prepare.ArrowsOnSampledGrid", True) or not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
         PartCuttingSurfaceVis.recreate(self, negMsgHandler, parentKey, ['GridIn0'], [], [], ['DataIn0'], USER_DEFINED, offset)
     # start cutting surface on sampled grid
     else:
         PartCuttingSurfaceVis.recreate(self, negMsgHandler, parentKey, [], ['GridIn0'], ['DataIn0'], [], USER_DEFINED, offset)
     #self.params.arrow_head_factor = 0.2
     self.params.setMoreParams()
Exemple #2
0
 def __init__(self):
     # start cutting suface not on sampled grid
     if not covise.coConfigIsOn("vr-prepare.ArrowsOnSampledGrid", True) or not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
         PartCuttingSurfaceVis.__init__(self,  ['GridIn0'], [], [], ['DataIn0'], USER_DEFINED)
     # start cutting surface on sampled grid
     else:
         PartCuttingSurfaceVis.__init__(self, [],  ['GridIn0'], ['DataIn0'], [], USER_DEFINED)
     self.params = PartVectorVisParams()
     self.params.name = 'Arrows'
     NameArrowsCuttingSurface = covise.getCoConfigEntry("vr-prepare.NameArrowsCuttingSurface")
     if NameArrowsCuttingSurface:
         self.params.name = NameArrowsCuttingSurface
     self.params.option = 1
     self.params.vector = 3
Exemple #3
0
    def __init__(self, parent):
        QtWidgets.QDockWidget.__init__(self, coTranslate("Video Capture Manager"), parent)

        self.setWidget(VideoCaptureManagerBase(self))

        #connection of the DockWidget visibilityChanged
        self.visibilityChanged.connect(self.visibilityChangedS)
        
        # connection of buttons
        self.widget().buttonCapture.clicked.connect(self.capture)
        self.widget().buttonPreview.clicked.connect(self.startPreview)
        self.widget().comboBox.activated.connect(self.selectMode)
        
        # connect open
        self.widget().pushButton.clicked.connect(self.openFile)
        
        # connect filename
        self.widget().lineEdit.returnPressed.connect(self.setFilename)
        self.widget().lineEdit.editingFinished.connect(self.checkFilename)

        self.widget().groupSettings.setVisible(True)
        self.widget().groupCapturing.setVisible(True)
        #self.recording = False;
        
        self.filename = "C:\capture.wmv"
        if covise.coConfigIsOn("COVER.Plugin.Video", False):
            filename = covise.getCoConfigEntry("COVER.Plugin.Video.Filename")
            if filename:
                self.filename = filename
        
        self.widget().lineEdit.setText(self.filename)
        self.oldFilename = self.filename
        self.freeCapture = False
        self.mode=0
    def updateForObject( self, keys ):
        if isinstance( keys, int):
            self.__keys = [keys]
        else:
            self.__keys = keys

        # set the variables
        if len(self.__keys)==1 :
            # enable the visualization and the transform tab
            self.tabWidget.setTabEnabled(0, True)
            self.tabWidget.setTabEnabled(1, True)

            scalar = ObjectMgr().getPossibleScalarVariablesForType(self.__keys[0])
            vector = ObjectMgr().getPossibleVectorVariablesForType(self.__keys[0])
            if covise.coConfigIsOn("vr-prepare.UseComposedVelocity", False):
                myObject = globalKeyHandler().getObject(self.__keys[0])
                if (myObject.typeNr == TYPE_3D_COMPOSED_PART):
                    vector.append(COMPOSED_VELOCITY)
            self._setUnsetVariable(True)        
            self._setScalarVariables(scalar)
            self._setVectorVariables(vector)
            self.setGridName(ObjectMgr().getNameOfType(self.__keys[0]) )
        else : # multi selection
            # disable the visualization and the transform tab
            self.tabWidget.setTabEnabled(0, False)
            self.tabWidget.setTabEnabled(1, False)
        # apply params
        params = ObjectMgr().getParamsOfObject(self.__keys[0])
        params.name = ObjectMgr().getNameOfType(self.__keys[0]) 
        #if self.__key in Application.vrpApp.guiKey2visuKey:
        #    params.isVisible = ObjectMgr().getParamsOfObject(Application.vrpApp.guiKey2visuKey[self.__key]).isVisible
        self.__setParams( params )
Exemple #5
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        Ui_ClipIntervalPanelBase.__init__(self)
        self.setupUi(self)
        #current object key
        self.__key = -1
        
        #default setting of the panel
        self.vrpCheckBoxMapVariable.setEnabled(False)
        self.vrpComboBoxVariable.setEnabled(False)
        self.visibilityCheckBox.setVisible(covise.coConfigIsOn("vr-prepare.AdditionalVisibilityCheckbox", False))

        self.__baseVariable = None

        #temporary storage of this parameter part
        self.colorCreator = None

        middleFloatInRangeCtrls = [self.floatInRangeIsoValueLow]
        self.__boundingBox = ((-1, 1), (-1, 1), (-1, 1))
        for w, r in zip(middleFloatInRangeCtrls, self.__boundingBox):
            w.setRange(r)
        sideRange = 0, self.__heuristicProbeMaxSideLengthFromBox(
            self.__boundingBox)
            
        ClipIntervalPanelConnector(self)
Exemple #6
0
    def __init__(self, parent=None):
        _infoer.function = str(self.__init__)
        _infoer.write("")
        QtWidgets.QWidget.__init__(self, parent)
        Ui_DocumentViewerBase.__init__(self)
        self.setupUi(self)
        self.__key = -1

        changeIndicatedLEs = [ self.floatX, self.floatY, self.floatZ, self.floatHsize, self.floatVsize, self.floatScaling  ]

        for w in changeIndicatedLEs:
            w.returnPressed.connect(self.emitParamsChange)

        
        self.spinBoxPage.valueChanged.connect(self.emitParamsChange)
        self.ChangeButton.clicked.connect(self.change)

        ObjectMgr().sigGuiParamChanged.connect(self.paramChanged)
        #validators:
        # allow only double values for changeIndicatedLEs
        doubleValidator = QtGui.QDoubleValidator(self)
        self.floatX.setValidator(doubleValidator)
        self.floatY.setValidator(doubleValidator)
        self.floatZ.setValidator(doubleValidator)
        self.floatHsize.setValidator(doubleValidator)
        self.floatVsize.setValidator(doubleValidator)
        self.floatScaling.setValidator(doubleValidator)

        self.spinBoxPage.setMinimum(1)
        self.spinBoxPage.setMaximum(1)
        self.currentImage_ = None
        self.currentPixmap_ = None

        self.documentsInGUI_ = covise.coConfigIsOn("vr-prepare.DocumentsInGUI", False)
Exemple #7
0
 def takeSnapshot(self):
     _infoer.function = str(self.takeSnapshot)
     _infoer.write("")
     filename = ""
     if covise.coConfigIsOn("vr-prepare.ShowSnapshotDialog", True):
         directory = covise.getCoConfigEntry("COVER.Plugin.PBufferSnapShot.Directory")
         if (directory == None):
             directory = "snapshot.png"
         else:
             directory = directory + "/" + "snapshot.png"  
         filenameQt = QtWidgets.QFileDialog.getSaveFileName(
             self,
             self.__tr('Snapshot'),
             directory,
             self.__tr('Image (*.png)'),
             None,
             QtWidgets.QFileDialog.DontConfirmOverwrite)
         if filenameQt == "":
             return
         #filenameQt is filename + extension touple
         filename = filenameQt[0]
         print(filename)
         if not filename.lower().endswith(".png"):
             filename += ".png"
         if  os.path.exists(filename):
             asker = ReallyWantToOverrideAsker(self, filename)
             decicion = asker.exec_()
             if decicion == QtWidgets.QDialog.Rejected:
                 self.statusBar().showMessage( self.__tr('Cancelled overwrite of "%s"') % filename )
                 return
     msg = coGRSnapshotMsg( filename, "snapOnce" )
     covise.sendRendMsg(msg.c_str())
Exemple #8
0
    def _initBase(self, modName, geoInputNames=['GridIn0'], octtreeInputNames=[], geoSampleNames=[], dataSampleNames=[], \
        dataInputNames=[], scalarInputNames=[], twoDInputNames=[], sampleType=1, bbox = True, octtree= True):
        '''called from the constructor and after the class was unpickled '''
        self._module = None
        self._lastDataConnection = None
        self._lastScalarConnection = None
        self._last2DPartConnection = None
        
        self._moduleName = modName
        self._geoInputNames = geoInputNames
        self._octtreeInputNames = octtreeInputNames
        self._geoSampleNames = geoSampleNames
        self._dataSampleNames = dataSampleNames
        self._sampleType = sampleType
        self._dataInputNames = dataInputNames
        self._scalarInputNames = scalarInputNames
        self._2DPartInputNames = twoDInputNames
        self.__createBBox = bbox
        self.__createOcttree = octtree
        self.__firstTime = True
        self.__connectedToCOVER = False
        
        #register for UI Actions
        self._registered = False
        self._firstGeoForVars = True

        if not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
            self._geoSampleNames  = []
            self._dataSampleNames = []
Exemple #9
0
    def executeSampleData(self, varname, bbox=None, outside=USER_DEFINED):
        if not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
            return

        self._updateSample(2, varname, bbox, outside)
        sample = self._sample

        saveExecute(sample)
Exemple #10
0
    def executeSampleGeo( self, dim ):
        if not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
            return

        self._updateSample( dim )
#        if not Import2DModule.executeGeo(self):
        if not ParentClass2D.executeGeo(self):
            saveExecute(self._sample)
Exemple #11
0
 def updateForObject( self, key):
     self.__key = key
     scalar = ObjectMgr().getPossibleScalarVariablesForType(self.__key)
     vector = ObjectMgr().getPossibleVectorVariablesForType(self.__key)
     if covise.coConfigIsOn("vr-prepare.UseComposedVelocity", False):
         myObject = globalKeyHandler().getObject(key)
         while (myObject.typeNr == TYPE_2D_CUTGEOMETRY_PART):
             myObject = globalKeyHandler().getObject(myObject.parentKey)
         if (myObject.typeNr == TYPE_2D_COMPOSED_PART):
             scalar.append(COMPOSED_VELOCITY)
     self._setScalarVariables(scalar)
     self._setVectorVariables(vector)
     self.setGridName(ObjectMgr().getNameOfType(self.__key))
Exemple #12
0
 def run(self, runmode, negMsgHandler=None):
     if runmode==RUN_GEO:
         self.importModule.executeGeo()
     elif runmode==RUN_OCT:
         self.importModule.executeOct()
         # sample over first vel value
         if covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
             if not self.importModule.getIsTransient():
                 for v in self.params.partcase.variables:
                     if v.variableDimension==3:
                         self.importModule.executeSampleData(v.name)
     else:
         coKeydObject.run(self, runmode, negMsgHandler)
Exemple #13
0
    def executeSampleData(self, varname, bbox=None, outside=USER_DEFINED):
        if not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
            return

        if bbox==None:
            if not (varname,outside) in self._bbox:
                self._bbox[(varname,outside)] = Box()
            box = self._bbox[(varname,outside)]
        else:
            box = bbox
        self._updateSample( varname, box, outside)                   
        sample = self._sample[(varname,outside)]

        saveExecute(sample)
Exemple #14
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        Ui_GenericVisualizerPanelBase.__init__(self)
        self.setupUi(self)
        #current object key
        self.__key = -1

        # remove unneccessary tabs
        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabAdjustmentStreamline))
        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabAdjustmentCuttingSurface))
        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabAdvanced))
        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabClipPlane))
        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabPositioning))

        self.__generalTab = self.tab
        self.__generalTabText = self.TabWidgetGeneralAdvanced.tabText(self.TabWidgetGeneralAdvanced.indexOf(self.tab))

        self.TabWidgetGeneralAdvanced.setCurrentIndex(0) # ignore index set by the designer (usually no one cares about the active index when editing ui-files)

        self.visibilityCheckBox.setVisible(covise.coConfigIsOn("vr-prepare.AdditionalVisibilityCheckbox", False))

        #default setting of the panel
        self.vrpCheckBoxMapVariable.hide()
        self.vrpComboBoxVariable.hide()
        #self.vrpToolButtonChain.hide()
        self.floatInRangeEndPointX.hide()
        self.floatInRangeEndPointY.hide()
        self.floatInRangeEndPointZ.hide()
        self.textEndPointX.hide()
        self.textEndPointY.hide()
        self.textEndPointZ.hide()
        self.checkBoxFreeStartpoints.hide()
        self.vrpPushButtonAdjustPreview.hide()

        self.__baseVariable = None

        #temporary storage of this parameter part
        self.colorCreator = None

        middleFloatInRangeCtrls = [self.floatInRangeX]
        self.__boundingBox = ((-1, 1), (-1, 1), (-1, 1))
        for w, r in zip(middleFloatInRangeCtrls, self.__boundingBox):
            w.setRange(r)
        sideRange = 0, self.__heuristicProbeMaxSideLengthFromBox(
            self.__boundingBox)

        DomainSurfacePanelConnector(self)
Exemple #15
0
 def addGrid(self, key, name, vectorvars):
     if not key in self.__key2name.keys():
         self.__key2name[key] = name
         self.CheckBoxVariable[key] = QtWidgets.QCheckBox(self.box)
         self.CheckBoxVariable[key].setGeometry(QtCore.QRect(10,20,150,24))
         self.CheckBoxVariable[key].setText(name)
         self.CheckBoxVariable[key].setChecked(True)
         self.CheckBoxVariable[key].toggled.connect(self.checkSelection)
         self.ComboBoxVariable[key] = QtWidgets.QComboBox(self.box)
         self.ComboBoxVariable[key].setGeometry(QtCore.QRect(160,20,178,24))
         self.ComboBoxVariable[key].setSizePolicy(QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,QtWidgets.QSizePolicy.Fixed))
         self.ComboBoxVariable[key].setCursor(QtGui.QCursor(QtCore.Qt.CursorShape(13)))
         for varname in vectorvars:
             self.ComboBoxVariable[key].addItem(varname)
     self.boxLayout.addWidget(self.CheckBoxVariable[key], self.cnt, 0)
     self.boxLayout.addWidget(self.ComboBoxVariable[key], self.cnt, 1)
     self.ComboBoxVariable[key].setVisible(covise.coConfigIsOn("vr-prepare.UseComposedVelocity", False))
     self.cnt=self.cnt+1
Exemple #16
0
    def __readButtonConfig(self):
        # read buttons from config
        buttonList = covise.getCoConfigSubEntries("vr-prepare.TrackingManager.ButtonMap")
        completeButtonList = ['TRANS_LEFT', 'TRANS_RIGHT', 'TRANS_UP', 'TRANS_DOWN', 'TRANS_FRONT', 'TRANS_BACK', \
                           'ROT_X_MINUS', 'ROT_X_PLUS', 'ROT_Y_MINUS', 'ROT_Y_PLUS', 'ROT_Z_MINUS', 'ROT_Z_PLUS', \
                           'SCALE_PLUS', 'SCALE_MINUS']

        for b in buttonList:
            if b in completeButtonList:
                self.__dict__[b] = int(covise.getCoConfigEntry("vr-prepare.TrackingManager.ButtonMap." + b, "button"))
        
        # if not all buttons are described in config.vr-prepare.xml
        for b in completeButtonList:
            if not b in self.__dict__.keys():
                self.__dict__[b] = -1

        TranslateBarrier = covise.getCoConfigEntry("vr-prepare.TrackingManager.TranslateBarrier")
        if TranslateBarrier:
            self.TranslateBarrier = float(TranslateBarrier)
        else:
            self.TranslateBarrier = 1.0

        self.VRCJoystick = covise.coConfigIsOn("vr-prepare.TrackingManager.VRCJoystick", False)

        # buttons for vrml sensors
        ButtonSensor1 = covise.getCoConfigEntry("vr-prepare.TrackingManager.ButtonSensor1")
        ButtonSensor2 = covise.getCoConfigEntry("vr-prepare.TrackingManager.ButtonSensor2")
        if ButtonSensor1:
            self.BUTTON_SENSOR_1 = int(ButtonSensor1)
        else:
            self.BUTTON_SENSOR_1 = -1
        if ButtonSensor2:
            self.BUTTON_SENSOR_2 = int(ButtonSensor2)
        else:
            self.BUTTON_SENSOR_2 = -1

        WrlName = covise.getCoConfigEntry("vr-prepare.TrackingManager.WrlName")
        if WrlName:
            self.wrl_name = WrlName
        else:
            self.wrl_name = ""
Exemple #17
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        Ui_VectorFieldPanelBase.__init__(self)
        self.setupUi(self)
        TransformManager.__init__(self, self.emitTransformChanged)

        #current object key
        self.__key = -1

        # for custom RGB color
        self.__r = None
        self.__g = None
        self.__b = None
        self.__coloringOption = None

        #default setting of the panel
        self.vrpCheckBoxMapVariable.setEnabled(False)
        self.vrpComboBoxVariable.setEnabled(False)
        self.vrpLineEditVariable.hide()

        self.__baseVariable = None

        #temporary storage of this parameter part
        self.colorCreator = None

#        middleFloatInRangeCtrls = [self.floatInRangeScalingValue]
#        self.__boundingBox = ((-1, 1), (-1, 1), (-1, 1))
#        for w, r in zip(middleFloatInRangeCtrls, self.__boundingBox):
#            w.setRange(r)
#        sideRange = 0, self.__heuristicProbeMaxSideLengthFromBox(self.__boundingBox)

        VectorFieldPanelConnector(self)

        self.visibilityCheckBox.setVisible(covise.coConfigIsOn("vr-prepare.AdditionalVisibilityCheckbox", False))

        # set up initial radio group status
        self.emitChangedRadioGroup()
Exemple #18
0
    def __init__(self, parent=None):
        _infoer.function = str(self.__init__)
        _infoer.write("")

        QtWidgets.QWidget.__init__(self, parent)
        Ui_GenericVisualizerPanelBase.__init__(self)
        self.setupUi(self)
        # current object key
        self.__key = -1

        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabAdjustmentCuttingSurface))
        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabClipPlane))
        self.TabWidgetGeneralAdvanced.setCurrentIndex(0) # ignore index set by the designer (usually no one cares about the active index when editing ui-files)

        self.visibilityCheckBox.setVisible(covise.coConfigIsOn("vr-prepare.AdditionalVisibilityCheckbox", False))

        self.vrpPushButtonAdjustPreview.hide()

        # manager handling the starting rectangle
        self.__rectangleManager = RectangleManager( self, self.emitTraceParametersApply, self.emitRadioBttnsTracerApply, self.emitRectangleChange )
        
        # keys of 2D objects in combobox        
        self.__key2UsePart = {}
        self.__UsePart2key = {}
        
        # current task type        
        self.__taskType = STREAMLINE

        # start style of tracer to that the panel will change
        self.__startStyle = PLANE
        self.__baseVariable = None
        
        #temporary storage of this parameter part
        self.colorCreator = None        

        # qt connections and settings
        StreamlinesPanelConnector(self)
Exemple #19
0
    def geoSampleConnectionPoint(self, varname=None, outside=USER_DEFINED):
        if not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
            return

        self._initSample(varname, outside)
        return ConnectionPoint(self._showgrid, 'points')
Exemple #20
0
    def __init__(self):
        VisualizationPanel.__init__(self)
        self.vrpLocalisationLabel.hide()
        self.vrpLabelLocalisation.hide()

        #dictionaries to enable the buttons
        self._enableDictComposedMode = {
                self.CuttingSurfaceColoredPushButton: False,
                self.IsoSurfacePushButton: False,
                self.IsoCutterPushButton: False,
                self.ClipIntervalPushButton: False,
                self.MovingPointsPushButton: False,
                self.PathlinesPushButton: False,
                self.ProbingPointPushButton: False, #True
                self.ProbingSquarePushButton: False,
                self.StreaklinesPushButton: False,
                self.Streamlines2DPushButton: False,
                self.SurfaceVectorsPushButton: False,
                self.MagmaTracePushButton: False,
                }
        self._enableDictVectorVariable = {
                self.CuttingSurfaceColoredPushButton: True,
                self.IsoSurfacePushButton: False,
                self.IsoCutterPushButton: False,
                self.ClipIntervalPushButton: False,
                self.MovingPointsPushButton: True,
                self.PathlinesPushButton: True,
                self.ProbingPointPushButton: False,
                self.ProbingSquarePushButton: False,
                self.StreaklinesPushButton: True,
                self.Streamlines2DPushButton: True,
                self.SurfaceVectorsPushButton: True,
                self.MagmaTracePushButton: False,
                }
        self._enableDictScalarVariable = {
                self.CuttingSurfaceColoredPushButton: True,
                self.IsoSurfacePushButton: True,
                self.IsoCutterPushButton: True,
                self.ClipIntervalPushButton: True,
                self.MovingPointsPushButton: False,
                self.PathlinesPushButton: False,
                self.ProbingPointPushButton: False, #True
                self.ProbingSquarePushButton: False, #True
                self.StreaklinesPushButton: False,
                self.Streamlines2DPushButton: False,
                self.SurfaceVectorsPushButton: False,
                self.MagmaTracePushButton: True,
                }
        #disabled buttons
        self._disablees = [
            self.CuttingSurfaceColoredPushButton,
            self.IsoSurfacePushButton,
            self.ProbingPointPushButton,
            self.ProbingSquarePushButton,
            self.MovingPointsPushButton,
            self.PathlinesPushButton,
            self.StreaklinesPushButton,
            ]
        # hide buttons
        if not covise.coConfigIsOn("CFDGui.VISUALIZER_MAGMATRACE"):
            self.MagmaTracePushButton.hide()
        # current key
        self.__key = None

        self._disableBrokenParts()

        
        self.Streamlines2DPushButton.clicked.connect(self.emitStreamline2DRequest)
        self.MovingPointsPushButton.clicked.connect(self.emitMovingPointsRequest)
        self.PathlinesPushButton.clicked.connect(self.emitPathlinesRequest)
        self.vrpComboBoxVariable.activated[str].connect(self._enableMethodButtsForVariableSlot)
        self.CuttingSurfaceColoredPushButton.clicked.connect(self.emitPlaneRequest)
        self.IsoSurfacePushButton.clicked.connect(self.emitIsoPlaneRequest)
        self.IsoCutterPushButton.clicked.connect(self.emitIsoCutterRequest)
        self.ClipIntervalPushButton.clicked.connect(self.emitClipIntervalRequest)
        self.SurfaceVectorsPushButton.clicked.connect(self.emitVectorFieldRequest)
        self.MagmaTracePushButton.clicked.connect(self.emitMagmaTraceRequest)
Exemple #21
0
    def dataSampleConnectionPoint(self, varname=None, outside=USER_DEFINED):
        if not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
            return

        self._initSample( varname, outside)
        return ConnectionPoint(self._sample[(varname,outside)], 'DataOut')
Exemple #22
0
    def dataSampleConnectionPoint(self, varname=None, outside=USER_DEFINED):
        if not covise.coConfigIsOn("vr-prepare.UseSamplingModules", False):
            return

        self._initSample(varname, outside)
        return ConnectionPoint(self._sample, 'DataOut')
Exemple #23
0
    def __init__(self, parent=None):
        QtWidgets.QWidget.__init__(self, parent)
        Ui_GenericVisualizerPanelBase.__init__(self)
        self.setupUi(self)
        #current object
        self.__key = -1
        
        self.vrpPushButtonAdjustPreview.hide()
        self.floatInRangeRotX.setEnabled(False)
        self.floatInRangeRotY.setEnabled(True)
        self.floatInRangeRotZ.setEnabled(True)
        self.floatInRangeEndPointX.hide()
        self.floatInRangeEndPointY.hide()
        self.floatInRangeEndPointZ.hide()
        self.textEndPointX.hide()
        self.textEndPointY.hide()
        self.textEndPointZ.hide()
        self.vrpCheckBoxShow.setText(self.__tr("Show Preview"))
        self.vrpGroupBoxPositioning.setTitle(self.__tr("Plane Positioning")) 
        self.checkBoxFreeStartpoints.hide()
        self.vrpCheckBoxMapVariable.hide()
        self.vrpComboBoxVariable.hide()
        self.textLabel4_3_3.hide()
        self.floatInRangeWidth.hide()
        self.textLabel4_3_2_3.hide()
        self.floatInRangeHeight.hide()
        self.checkBoxDomainFromList.hide()
        self.comboBoxDomain.hide()
        self.checkBoxFreeStartpoints.hide()
        self.groupOrientation.setTitle(self.__tr("Normal:"))

        # change tooltips
        self.textLabel4_4_3.setToolTip(self.__tr("x, y, z define one point on the plane."))
        self.textLabel4_4_3.setWhatsThis(self.__tr("x, y, z define one point on the plane."))
        self.textLabel4_4_2_3.setToolTip(self.__tr("x, y, z define one point on the plane."))
        self.textLabel4_4_2_3.setWhatsThis(self.__tr("x, y, z define one point on the plane."))
        self.textLabel4_4_2_2_2.setToolTip(self.__tr("x, y, z define one point on the plane."))
        self.textLabel4_4_2_2_2.setWhatsThis(self.__tr("x, y, z define one point on the plane."))
        self.xAxisRadioButton.setToolTip(self.__tr("Orientation defines the normal of the plane."))
        self.xAxisRadioButton.setWhatsThis(self.__tr("Orientation defines the normal of the plane."))
        self.yAxisRadioButton.setToolTip(self.__tr("Orientation defines the normal of the plane."))
        self.yAxisRadioButton.setWhatsThis(self.__tr("Orientation defines the normal of the plane."))
        self.zAxisRadioButton.setToolTip(self.__tr("Orientation defines the normal of the plane."))
        self.zAxisRadioButton.setWhatsThis(self.__tr("Orientation defines the normal of the plane."))
        self.textLabelRotX.setToolTip(self.__tr("For finetuning the orientation<br> of the plane, you can add rotations around each axis."))
        self.textLabelRotX.setWhatsThis(self.__tr("For finetuning the orientation<br> of the plane, you can add rotations around each axis."))
        self.textLabelRotY.setToolTip(self.__tr("For finetuning the orientation<br> of the plane, you can add rotations around each axis."))
        self.textLabelRotY.setWhatsThis(self.__tr("For finetuning the orientation<br> of the plane, you can add rotations around each axis."))
        self.textLabelRotZ.setToolTip(self.__tr("For finetuning the orientation<br> of the plane, you can add rotations around each axis."))
        self.textLabelRotZ.setWhatsThis(self.__tr("For finetuning the orientation<br> of the plane, you can add rotations around each axis."))

        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabAdjustmentStreamline))
        self.TabWidgetGeneralAdvanced.removeTab(self.TabWidgetGeneralAdvanced.indexOf(self.tabAdvanced))
        self.TabWidgetGeneralAdvanced.setCurrentIndex(0) # ignore index set by the designer (usually no one cares about the active index when editing ui-files)

        self.visibilityCheckBox.setVisible(covise.coConfigIsOn("vr-prepare.AdditionalVisibilityCheckbox", False))

        # manager handling the starting rectangle
        self.__rectangleManager = RectangleManager( self, self.emitPlaneParametersApply, self.emitPlaneParametersApply, self.emitRectangleChange, CUTTINGSURFACE )

        self.__vector = PLANE
        self.__baseVariable = None
        
        #temporary storage of this parameter part       
        self.colorCreator = None

        #qt connections and settings
        CuttingSurfacePanelConnector(self)
Exemple #24
0
    def setParams(self, params, negMsgHandler=None, sendToCover=False):
        _infoer.function = str(self.setParams)
        _infoer.write(" ")

        # change of maxIdx means shorten the history
        oldParams = self.params
        changedParams = ParamsDiff( self.params, params)

        if hasattr(params, 'currentStep'):
            diffStep = params.currentStep - oldParams.currentStep
        else:
            diffStep = params.currentKey - oldParams.currentKey

        coKeydObject.setParams( self, params )
        if 'currentKey' in changedParams or 'reloadStep' in changedParams:
            if os.getenv('VR_PREPARE_DEBUG_VISITEMS_DIR'):
                for key in globalKeyHandler().getAllElements():
                    if globalKeyHandler().getObject(key) and isinstance(globalKeyHandler().getObject(key), VisItem):
                        globalKeyHandler().getObject(key).updateDebugFilename(self.params.currentKey)

            # send message presentationstep changed
            if diffStep == 1:
                msg = coGRKeyWordMsg("presForward", True)
                covise.sendRendMsg(msg.c_str())
            elif diffStep ==  -1:
                msg = coGRKeyWordMsg("presBackward", True)
                covise.sendRendMsg(msg.c_str())
            elif 'reloadStep' in changedParams:
                msg = coGRKeyWordMsg("presReload", True)
                covise.sendRendMsg(msg.c_str())
            else:
                msg_str = "goToStep "+str(params.currentStep)
                msg = coGRKeyWordMsg(msg_str, True)
                covise.sendRendMsg(msg.c_str())

            if negMsgHandler:
                #if hasattr(globalKeyHandler().getObject(self.params.currentKey).params, 'status'):
                key2stateParam  = globalKeyHandler().getObject(self.params.currentKey).params.status
                project = globalKeyHandler().getObject(0)
                keysInProject = []
                keysInProject.append(globalProjectKey)
                self.__addToList(project, keysInProject)
                orderedKeysInProject1 = []
                orderedKeysInProject2 = []
                for key in keysInProject: # put some objects at the beginning of the list
                    obj = globalKeyHandler().getObject(key)
                    #check if visItem is readyToChange otherwise send message
                    if diffStep > 0 and hasattr(obj.params, 'nextPresStep') and not obj.params.nextPresStep and covise.coConfigIsOn("vr-prepare.SolvePresentationStep"):
                        #roll back changes
                        negMsgHandler.sendParams(globalPresentationMgrKey, oldParams)
                        msg = coGRKeyWordMsg("showNotReady", True)
                        covise.sendRendMsg(msg.c_str())
                        return
                    if (obj.typeNr in [VIS_DOCUMENT, TYPE_TRACKING_MGR]):
                        orderedKeysInProject1.append(key)
                    else:
                        orderedKeysInProject2.append(key)
                orderedKeysInProject1.extend(orderedKeysInProject2)
                for key in orderedKeysInProject1:
                    if key in key2stateParam:
                        params = key2stateParam[key]
                        if not hasattr(params, 'flyingMode'): # do not save settings of viewpointMgr
                            obj = globalKeyHandler().getObject(key)
                            newparams = CopyParams(obj.getParams()) # take the objects params as base (so we have all the merged defaultParams)
                            paramChanged = False
                            for pkey in params.__dict__:
                                if pkey in newparams.__dict__:
                                    if covise.coConfigIsOn("vr-prepare.DoNotUpdateCuttingSurfaces", False) \
                                       and isinstance(obj, PartCuttingSurfaceVis. PartCuttingSurfaceVis) and pkey=='isVisible':
                                        pass
                                    elif hasattr(newparams, "isStaticParam") and newparams.isStaticParam(pkey):
                                        # skip static params
                                        pass
                                    elif pkey=='actTimeStep' and (not hasattr(params, 'version') or params.__dict__['version'] < 7):
                                        # change actual timestep for old 6.0 projects
                                        newparams.__dict__[pkey] = params.__dict__[pkey] -1
                                        if newparams.__dict__[pkey] < 0:
                                            newparams.__dict__[pkey] = newparams.__dict__['numTimeSteps'] - 1
                                        paramChanged = True
                                    elif (pkey=='autoActiveSensorIDs') and (len(params.autoActiveSensorIDs) > 0):
                                        # always set params if the new step has autoActiveSensorIDs
                                        newparams.__dict__[pkey] = copy.deepcopy(params.__dict__[pkey])
                                        paramChanged = True
                                    else:
                                        if (newparams.__dict__[pkey] != params.__dict__[pkey]):
                                            newparams.__dict__[pkey] = copy.deepcopy(params.__dict__[pkey]) # need a deepcopy in case we have a list/dict
                                            paramChanged = True
                            if (paramChanged):
                                if key != globalProjectKey and 'currentKey' in changedParams:
                                    negMsgHandler.presentationRecvParams( key, newparams )
                                    negMsgHandler.sendParams(key, newparams)
                                elif key != globalProjectKey:
                                    negMsgHandler.presentationRecvParams( key, newparams, True) #TODO, ueberpruefen, ob das nach kompletter portierung noetig ist
                                    negMsgHandler.sendParams(key, newparams)
                                else :
                                    negMsgHandler.sendParams(key, newparams)
                                    project.setParams(newparams)
                                    project.sendMessages()

                    # hide all visItem which are not in list
                    else:
                        params =  globalKeyHandler().getObject(key).params
                        if params:
                            #do not save settings of viewpointMgr
                            if not hasattr(params, 'flyingMode'):
                                if hasattr(params, 'isVisible') and params.isVisible:
                                    cparams = CopyParams(params)
                                    cparams.isVisible = False
                                    negMsgHandler.presentationRecvParams( key, cparams)
                                    negMsgHandler.sendParams(key, cparams)
Exemple #25
0
 def isTransientCB(self, isTransient):
     if covise.coConfigIsOn("vr-prepare.Panels.AnimationManager", "visible", True):
         Application.vrpApp.mw.showAnimationWindow(isTransient)
         Application.vrpApp.mw.windowAnimation_ManagerAction.setEnabled(isTransient)
Exemple #26
0
    # Set the socket parameters
    secondUDP_IP = covise.getCoConfigEntry("vr-prepare.SecondUDP.IP")
    if secondUDP_IP:
        host = QHostAddress(secondUDP_IP)
    else:
        host = QHostAddress("127.0.0.1")
    secondUDP_Port = covise.getCoConfigEntry("vr-prepare.SecondUDP.Port")
    if secondUDP_Port:
        port = int(secondUDP_Port)
    else:
        port = 6666
    buf = 1024
    addr = (host,port)

    # Create socket and bind to address
    if covise.coConfigIsOn("vr-prepare.SecondUDP"):
        UDPSock = QUdpSocket() 
        UDPSock.bind(port)
        udpMode = True
except:
    pass
#--------


#
# receiver thread filling up the global message queue
#
class Rec(Thread):
#================
    lastInfo_ = ""
    
Exemple #27
0
from VRPCoviseNetAccess import saveExecute, connect, disconnect, theNet, ConnectionPoint, RWCoviseModule#, TransformModule

from coPyModules import BoundingBox, MakeOctTree, Colors, RWCovise
from BoundingBox import BoundingBoxParser, Box
import coviseStartup
from coviseCase import SCALARVARIABLE
from Utils import getExistingFilename

from ErrorManager import CoviseFileNotFoundError

from printing import InfoPrintCapable
_infoer = InfoPrintCapable()
_infoer.doPrint = False # True

enableCachedOctTrees = False
if covise.coConfigIsOn("vr-prepare.CachedOctTrees"):
    enableCachedOctTrees = True    

""" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ """
"""                                                                """
"""    import a part( 2d or 3d geometry) and all data on that part """
"""                                                                """
"""    load files only once                                        """
"""                                                                """
""" ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ """

class ImportModule(object):

    def __init__(self, dimension, partcase ):
        global testPath
        self._dim = dimension
Exemple #28
0
    def _init(self, negMsgHandler, sampleType=None):
        '''called from _update
            if module exists connect output of it to COVER
        '''
        if not sampleType == None:
            self._sampleType = sampleType
        if self._module == None and hasattr(self, 'importModule') and self.__firstTime:
            self.__firstTime = False
            self._module = self._moduleName()
            theNet().add(self._module)
            # need to execute blockcollect for geo
            if type(self.importModule) == ImportGroupManager.ImportGroup3DModule:
                self.importModule.executeGeo()

            for geoInput in self._geoInputNames:
                connect( self.importModule.geoConnectionPoint(), ConnectionPoint(self._module, geoInput) )

            if self.__createOcttree:
                if len(self._octtreeInputNames) > 0: 
                    for octtree in self._octtreeInputNames:
                        connect( self.importModule.octTreeConnectionPoint(), ConnectionPoint(self._module, octtree) )
                    self.importModule.executeOct()

            if (len(self._dataInputNames)>0):
                if hasattr(self.params, 'variable') and self.params.variable and self.params.variable!='Select a variable' and self.params.variable != 'unset':
                    for dataInput in self._dataInputNames:
                        connect( self.importModule.dataConnectionPoint(self.params.variable), ConnectionPoint(self._module, dataInput) )

            if len(self._geoSampleNames) > 0 and not self.importModule.getIsTransient():
                if hasattr(self.params, 'variable') and self.params.variable and self.params.variable!='Select a variable' and self.params.variable != 'unset':
                   assert self.params.variable!='Select a variable'
                   self.importModule.executeSampleData(self.params.variable, None, self._sampleType)
                   for geoSample in self._geoSampleNames:
                       connect( self.importModule.geoSampleConnectionPoint(self.params.variable, self._sampleType), ConnectionPoint(self._module, geoSample) )

            if len(self._dataSampleNames) > 0 and not self.importModule.getIsTransient():
                if hasattr(self.params, 'variable') and self.params.variable and self.params.variable!='Select a variable' and self.params.variable != 'unset':
                   assert self.params.variable!='Select a variable' 
                   for dataSample in self._dataSampleNames:
                       connect( self.importModule.dataSampleConnectionPoint(self.params.variable, self._sampleType), ConnectionPoint(self._module, dataSample) )
            self.reloadBBox()

            # optionally connect to COVER
            if not covise.coConfigIsOn("vr-prepare.InvisibleConnectToRenderer", True):
                # only connect to COVER if this visualizer really is visible
                if self.params.isVisible and not self.__connectedToCOVER:
                    VisItem.connectToCover( self, self )
                    self.__connectedToCOVER = True
            else:
                VisItem.connectToCover( self, self )
                self.__connectedToCOVER = True

        # refresh all connections as they might have changed
        if self._module != None and hasattr(self, 'importModule'):

            for geoInput in self._geoInputNames:
                theNet().disconnectAllFromModulePort(self._module, geoInput)     # remove all connections at the inport
                connect( self.importModule.geoConnectionPoint(), ConnectionPoint(self._module, geoInput) )

            if self.__createOcttree:
                for octtree in self._octtreeInputNames:
                    theNet().disconnectAllFromModulePort(self._module, octtree)     # remove all connections at the inport
                    connect( self.importModule.octTreeConnectionPoint(), ConnectionPoint(self._module, octtree) )

            if (len(self._dataInputNames)>0):
                if hasattr(self.params, 'variable') and self.params.variable and self.params.variable!='Select a variable' and self.params.variable != 'unset':
                    for dataInput in self._dataInputNames:
                        theNet().disconnectAllFromModulePort(self._module, dataInput)
                        connect( self.importModule.dataConnectionPoint(self.params.variable), ConnectionPoint(self._module, dataInput) )

            if hasattr(self.params, 'variable') and self.params.variable and self.params.variable!='Select a variable' and self.params.variable != 'unset':
                if self.params.variable != 'Select a variable' and not self.importModule.getIsTransient():
                    for geoSample in self._geoSampleNames:
                        theNet().disconnectAllFromModulePort(self._module, geoSample)
                        connect( self.importModule.geoSampleConnectionPoint(self.params.variable, self._sampleType), ConnectionPoint(self._module, geoSample) )

            if hasattr(self.params, 'variable') and self.params.variable and self.params.variable!='Select a variable' and self.params.variable != 'unset':
                if self.params.variable != 'Select a variable' and not self.importModule.getIsTransient():
                    for dataSample in self._dataSampleNames:
                        theNet().disconnectAllFromModulePort(self._module, dataSample)
                        connect( self.importModule.dataSampleConnectionPoint(self.params.variable, self._sampleType), ConnectionPoint(self._module, dataSample) )

            self.reloadBBox()

            # connect to COVER if visible and wasnt done initially
            if self.params.isVisible and not self.__connectedToCOVER:
                VisItem.connectToCover( self, self )
                self.__connectedToCOVER = True
Exemple #29
0
 def sendImagePathToWebserver(self):
     if covise.coConfigIsOn("vr-prepare.RemoteDeviceControll", False) and self.params.imageName != None:
         
         import os
         import vtrans
         import PathTranslator
         
         # starting point of 
         # image path processing
         imageName = self.params.imageName
         sNum = '1'
         
         # compute the image corresponding to step number 
         imageName = imageName.replace('\\', '/')
         ## just to be shure
         imageName = imageName.replace(os.sep, '/')
         
         pos = imageName.rfind('/')
         if pos >= 0:
             dirName = imageName[:pos]
             baseName = imageName[pos+1:]
             
             imageNumber = int(self.params.pageNo)
             imageSuffix = ''
             
             nPos = baseName.rfind('.')
             if nPos >= 0:
                 sNum = baseName[:nPos]
                 imageSuffix = baseName[nPos+1:]
                 iNum = int(sNum)
                 
                 # for backward compatibility
                 # in cc versions lesser than 3.2
                 # images were alloed to start with zero (0.png) 
                 if iNum == 0:
                     imageNumber = int(self.params.pageNo) - 1
         
             #compose all back togerther
             imageName = dirName + '/' + str(imageNumber) + '.' + imageSuffix             
             
         
         # get the language environment settings
         coPath = vtrans.covisePath
         localePrefix = covise.getCoConfigEntry("COVER.Localization.LocalePrefix")
         languageLocale = vtrans.languageLocale
         loc = localePrefix + "/" + languageLocale
         fullPathToImage = coPath + "/" +imageName
         
         # retrieve localized path
         fullPathToImage = PathTranslator.translate_path(loc, fullPathToImage)
         
         # retrieve relative path again
         imageName = fullPathToImage[len(coPath)+1:]
         
         path_to_current_image = imageName
         
         # again...
         # this time for the browser
         # compute the image corresponding to step number 
         path_to_current_image = path_to_current_image.replace('\\', '/')
         ## just to be shure
         path_to_current_image = path_to_current_image.replace(os.sep, '/')
         
         # pack the message
         msg = 'VRT IMAGE ' + path_to_current_image + '.' + str(self.params.maxPage)+ '.' + sNum
         
         # send it away
         destinationHost = covise.getCoConfigEntry("vr-prepare.RemoteDeviceHost")
         if not destinationHost:
            destinationHost = "127.0.0.1"
         destinationPort = covise.getCoConfigEntry("vr-prepare.RemoteDevicePort")
         if not destinationPort:
            destinationPort = "44142"
         sock = socket.socket(socket.AF_INET,socket.SOCK_DGRAM)
         sock.sendto( str(msg),(destinationHost,int(destinationPort)) )