def testStepStatus(self):
        from mapclientplugins.pointcloudserializerstep.widgets.configuredialog import ConfigureDialogState
        state = ConfigureDialogState()

        self.assertEqual(state.identifier(), '')

        newstate = ConfigureDialogState('here')
        self.assertEqual(newstate.identifier(), 'here')
コード例 #2
0
    def __init__(self, location):
        super(PointCloudSerializerStep, self).__init__('Point Cloud Serializer', location)
#        self._name = 'Point Cloud Store'
#        self._location = location
        self._icon = QtGui.QImage(':/pointcloudserializer/images/pointcloudserializer.png')
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port', 'http://physiomeproject.org/workflow/1.0/rdf-schema#uses', 'http://physiomeproject.org/workflow/1.0/rdf-schema#pointcloud'))
        self._state = ConfigureDialogState()
        self._category = 'Sink'
        self._dataIn = None
コード例 #3
0
class PointCloudSerializerStep(WorkflowStepMountPoint):
    """
    A step satisfies the step plugin duck.
    
    It stores point cloud data.
    It can be used as a point cloud data store.
    """
    def __init__(self, location):
        super(PointCloudSerializerStep, self).__init__('Point Cloud Serializer', location)
#        self._name = 'Point Cloud Store'
#        self._location = location
        self._icon = QtGui.QImage(':/pointcloudserializer/images/pointcloudserializer.png')
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port', 'http://physiomeproject.org/workflow/1.0/rdf-schema#uses', 'http://physiomeproject.org/workflow/1.0/rdf-schema#pointcloud'))
        self._state = ConfigureDialogState()
        self._category = 'Sink'
        self._dataIn = None

    def configure(self):
        d = ConfigureDialog(self._state, QtGui.QApplication.activeWindow().currentWidget())
        d.setModal(True)
        if d.exec_():
            self._state = d.getState()

        self._configured = d.validate()
        if self._configured and self._configuredObserver != None:
            self._configuredObserver()

    def getIdentifier(self):
        return self._state.identifier()

    def setIdentifier(self, identifier):
        self._state.setIdentifier(identifier)

    def serialize(self):
        return self._state.serialize()

    def deserialize(self, string):
        self._state.deserialize(string)
        d = ConfigureDialog(self._state)
        self._configured = d.validate()

    def getOutputDirectory(self):
        return os.path.join(self._location, self._state.identifier())

    def setPortData(self, portId, dataIn):
        self._dataIn = dataIn

    def execute(self):
        if self._dataIn:
            if not os.path.exists(self.getOutputDirectory()):
                os.makedirs(self.getOutputDirectory())
                
            with open(os.path.join(self.getOutputDirectory(), 'pointcloud.txt'), 'w') as f:
                for i, pt in enumerate(self._dataIn):
                    f.write(str(i + 1) + '\t' + str(pt[0]) + '\t' + str(pt[1]) + '\t' + str(pt[2]) + '\n')
        self._doneExecution()
コード例 #4
0
    def __init__(self, location):
        '''
        Constructor
        '''
        super(PointCloudSerializerStep, self).__init__('Point Cloud Serializer', location)
#        self._name = 'Point Cloud Store'
#        self._location = location
        self._icon = QtGui.QImage(':/pointcloudserializer/images/pointcloudserializer.png')
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port', 'http://physiomeproject.org/workflow/1.0/rdf-schema#uses', 'http://physiomeproject.org/workflow/1.0/rdf-schema#pointcloud'))
        self._state = ConfigureDialogState()
        self._category = 'Sink'
        self._dataIn = None
    def testStepStatus(self):
        from mapclientplugins.pointcloudserializerstep.widgets.configuredialog import ConfigureDialogState
        state = ConfigureDialogState()

        self.assertEqual(state.identifier(), '')

        newstate = ConfigureDialogState('here')
        self.assertEqual(newstate.identifier(), 'here')
        def testConfigureDialog(self):
            if self.pixmap_unavailable:
                return

            from mapclientplugins.pointcloudserializerstep.widgets.configuredialog import ConfigureDialog, ConfigureDialogState
            state = ConfigureDialogState()
            d = ConfigureDialog(state)

            self.assertEqual(
                d._ui.buttonBox.button(QtGui.QDialogButtonBox.Ok).isEnabled(),
                False)
            QTest.keyClicks(d._ui.identifierLineEdit, 'hello')
            self.assertEqual(
                d._ui.buttonBox.button(QtGui.QDialogButtonBox.Ok).isEnabled(),
                True)
            # QTest.mouseClick(d._ui.buttonBox.button(QtGui.QDialogButtonBox.Ok), QtCore.Qt.LeftButton)
            newstate = d.getState()
            self.assertEqual(newstate.identifier(), 'hello')
コード例 #7
0
class PointCloudSerializerStep(WorkflowStepMountPoint):
    '''
    A step satisfies the step plugin duck.
    
    It stores point cloud data.
    It can be used as a point cloud data store.
    '''
    def __init__(self, location):
        '''
        Constructor
        '''
        super(PointCloudSerializerStep, self).__init__('Point Cloud Serializer', location)
#        self._name = 'Point Cloud Store'
#        self._location = location
        self._icon = QtGui.QImage(':/pointcloudserializer/images/pointcloudserializer.png')
        self.addPort(('http://physiomeproject.org/workflow/1.0/rdf-schema#port', 'http://physiomeproject.org/workflow/1.0/rdf-schema#uses', 'http://physiomeproject.org/workflow/1.0/rdf-schema#pointcloud'))
        self._state = ConfigureDialogState()
        self._category = 'Sink'
        self._dataIn = None

    def configure(self):
        d = ConfigureDialog(self._state)
        d.setModal(True)
        if d.exec_():
            self._state = d.getState()

        self._configured = d.validate()
        if self._configured and self._configuredObserver != None:
            self._configuredObserver()

    def getIdentifier(self):
        return self._state.identifier()

    def setIdentifier(self, identifier):
        self._state.setIdentifier(identifier)

    def serialize(self, location):
        if not os.path.exists(self.getOutputDirectory()):
            os.mkdir(self.getOutputDirectory())

        configuration_file = os.path.join(location, getConfigFilename(self._state.identifier()))
        s = QtCore.QSettings(configuration_file, QtCore.QSettings.IniFormat)
        self._state.save(s)

    def deserialize(self, location):
        configuration_file = os.path.join(location, getConfigFilename(self._state.identifier()))
        s = QtCore.QSettings(configuration_file, QtCore.QSettings.IniFormat)
        self._state.load(s)
        d = ConfigureDialog(self._state)
        self._configured = d.validate()

    def getOutputDirectory(self):
        return os.path.join(self._location, self._state.identifier())

    def setPortData(self, portId, dataIn):
        self._dataIn = dataIn

    def execute(self):
        if self._dataIn:
            f = open(os.path.join(self.getOutputDirectory(), 'pointcloud.txt'), 'w')
            for i, pt in enumerate(self._dataIn):
                f.write(str(i + 1) + '\t' + str(pt[0]) + '\t' + str(pt[1]) + '\t' + str(pt[2]) + '\n')
            f.close()
        self._doneExecution()