Пример #1
0
    def __init__(self, interactive, cubeSize: CubeSize,
                 newColor_signal: QtCore.pyqtSignal,
                 eraseColor_signal: QtCore.pyqtSignal, parent):
        super(Qtw.QWidget, self).__init__(parent)

        self.parent = parent
        self.graph = Q3DScatter()
        self.graph.setAspectRatio(1.0)
        self.currentColor = self.parent.getCurrentColor()
        self.onWidget = False
        self.imageZoom = 160
        self.screenSize = self.graph.screen().size()

        self.container = Qtw.QWidget.createWindowContainer(self.graph)
        self.container.setMinimumSize(
            QtCore.QSize(self.screenSize.width() / 5,
                         self.screenSize.height() / 5))
        self.container.setMaximumSize(self.screenSize)
        self.container.setSizePolicy(Qtw.QSizePolicy.Expanding,
                                     Qtw.QSizePolicy.Expanding)
        self.container.setFocusPolicy(QtCore.Qt.StrongFocus)

        self.layout = Qtw.QGridLayout(self)
        self.layout.addWidget(self.container, 0, 0)

        self.modifier = ScatterDataModifierInteract(interactive, cubeSize,
                                                    newColor_signal,
                                                    eraseColor_signal,
                                                    self.graph, self)
Пример #2
0
    def __init__(
            self,
            space_shape: tuple = (-1.0, 1.0, -1.0, 1.0, -1.0, 1.0),
            segment_shape: tuple = (8, 8, 8),
            swap_right_and_left_buttons=True,
            use_theme=Q3DTheme.ThemeQt
    ):
        super().__init__()

        self._graph = Q3DScatter()
        if swap_right_and_left_buttons:
            self._graph.setActiveInputHandler(Custom3DInputHander())
        self._graph.setOrthoProjection(True)
        self._graph.activeTheme().setType(use_theme)
        self._graph.activeTheme().setBackgroundEnabled(True)
        self._graph.setShadowQuality(QAbstract3DGraph.ShadowQualityNone)
        self._graph.activeInputHandler().setZoomAtTargetEnabled(False)
        self._graph.scene().activeCamera().setCameraPreset(Q3DCamera.CameraPresetIsometricLeft)
        self._graph.scene().activeCamera().setZoomLevel(180)
        self._graph.axisX().setSegmentCount(segment_shape[0])
        self._graph.axisX().setTitle("X")
        self._graph.axisX().setTitleVisible(True)
        self._graph.axisX().setAutoAdjustRange(True)

        self._graph.axisY().setSegmentCount(segment_shape[1])
        self._graph.axisY().setTitle("Z")
        self._graph.axisY().setTitleVisible(True)
        self._graph.axisY().setAutoAdjustRange(True)

        self._graph.axisZ().setSegmentCount(segment_shape[2])
        self._graph.axisZ().setTitle("Y")
        self._graph.axisZ().setTitleVisible(True)
        self._graph.axisZ().setAutoAdjustRange(True)

        self._graph.setAspectRatio(1)

        self._volume = QCustom3DVolume()
        self._volume.setUseHighDefShader(True)
        self._volume.setAlphaMultiplier(1.0)
        self._volume.setPreserveOpacity(False)
        self._volume.setDrawSlices(False)
        self._volume.setScaling(QVector3D(1.0, 1.0, 1.0))

        self._spaceShape = None
        self.set_space_shape(space_shape)

        self._current_texture = numpy.empty((0, 0, 0, 4), dtype=numpy.uint8)

        self._graph.addCustomItem(self._volume)
        self.setLayout(QHBoxLayout())
        self.layout().addWidget(QWidget().createWindowContainer(self._graph))
Пример #3
0
        if self.m_itemCount == self.numberOfItems:
            self.m_itemCount = self.lowerNumberOfItems
            self.m_curveDivider = self.lowerCurveDivider
        else:
            self.m_itemCount = self.numberOfItems
            self.m_curveDivider = self.curveDivider

        self.m_graph.seriesList()[0].dataProxy().resetArray(None)
        self.addData()


if __name__ == '__main__':
    import sys

    app = QApplication(sys.argv)
    graph = Q3DScatter()
    container = QWidget.createWindowContainer(graph)

    screenSize = graph.screen().size()
    container.setMinimumSize(
        QSize(screenSize.width() / 2,
              screenSize.height() / 1.5))
    container.setMaximumSize(screenSize)
    container.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
    container.setFocusPolicy(Qt.StrongFocus)

    widget = QWidget()
    hLayout = QHBoxLayout(widget)
    vLayout = QVBoxLayout()
    hLayout.addWidget(container, 1)
    hLayout.addLayout(vLayout)