molde 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {molde-0.1.0 → molde-0.1.2}/PKG-INFO +5 -3
- {molde-0.1.0 → molde-0.1.2}/README.md +26 -26
- {molde-0.1.0 → molde-0.1.2}/molde/__init__.py +6 -5
- {molde-0.1.0 → molde-0.1.2}/molde/__main__.py +74 -63
- {molde-0.1.0 → molde-0.1.2}/molde/actors/__init__.py +5 -4
- molde-0.1.2/molde/actors/common_symbols_actor.py +148 -0
- {molde-0.1.0 → molde-0.1.2}/molde/actors/ghost_actor.py +12 -12
- {molde-0.1.0 → molde-0.1.2}/molde/actors/lines_actor.py +31 -31
- {molde-0.1.0 → molde-0.1.2}/molde/actors/round_points_actor.py +7 -7
- {molde-0.1.0 → molde-0.1.2}/molde/actors/square_points_actor.py +32 -32
- molde-0.1.2/molde/colors/__init__.py +2 -0
- {molde-0.1.0 → molde-0.1.2}/molde/colors/color.py +120 -120
- {molde-0.1.0 → molde-0.1.2}/molde/colors/color_names.py +124 -124
- {molde-0.1.0 → molde-0.1.2}/molde/interactor_styles/__init__.py +2 -2
- {molde-0.1.0 → molde-0.1.2}/molde/interactor_styles/arcball_camera_style.py +288 -272
- {molde-0.1.0 → molde-0.1.2}/molde/interactor_styles/box_selection_style.py +70 -70
- molde-0.1.2/molde/main_window.ui +864 -0
- {molde-0.1.0 → molde-0.1.2}/molde/pickers/__init__.py +2 -2
- {molde-0.1.0 → molde-0.1.2}/molde/pickers/cell_area_picker.py +61 -61
- {molde-0.1.0 → molde-0.1.2}/molde/pickers/cell_property_area_picker.py +84 -84
- molde-0.1.2/molde/poly_data/__init__.py +19 -0
- molde-0.1.2/molde/poly_data/arrows.py +54 -0
- molde-0.1.2/molde/poly_data/complex_shapes.py +26 -0
- {molde-0.1.0 → molde-0.1.2}/molde/poly_data/lines_data.py +23 -23
- molde-0.1.2/molde/poly_data/simple_shapes.py +22 -0
- {molde-0.1.0 → molde-0.1.2}/molde/poly_data/vertices_data.py +24 -24
- {molde-0.1.0 → molde-0.1.2}/molde/render_widgets/__init__.py +2 -2
- {molde-0.1.0 → molde-0.1.2}/molde/render_widgets/animated_render_widget.py +164 -164
- {molde-0.1.0 → molde-0.1.2}/molde/render_widgets/common_render_widget.py +433 -433
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/__init__.py +119 -119
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/common.qss +16 -16
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/create_color_page.py +61 -61
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/mainwindow.ui +611 -611
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qcheckbox.qss +18 -18
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qinputs.qss +78 -78
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qlayouts.qss +22 -22
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qmenubar.qss +12 -12
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qprogressbar.qss +11 -11
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qpushbutton.qss +90 -90
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qradiobutton.qss +30 -30
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qscrollbar.qss +29 -29
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qslider.qss +61 -61
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qtablewidget.qss +27 -27
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qtabwidget.qss +29 -29
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qtoolbar.qss +62 -62
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qtoolbuttons.qss +14 -14
- {molde-0.1.0 → molde-0.1.2}/molde/stylesheets/qtreewidget.qss +25 -25
- molde-0.1.2/molde/ui_files/messages/new_loading_window.ui +73 -0
- {molde-0.1.0 → molde-0.1.2}/molde/utils/__init__.py +8 -8
- {molde-0.1.0 → molde-0.1.2}/molde/utils/format_sequences.py +44 -44
- {molde-0.1.0 → molde-0.1.2}/molde/utils/poly_data_utils.py +24 -24
- {molde-0.1.0 → molde-0.1.2}/molde/utils/tree_info.py +52 -52
- molde-0.1.2/molde/windows/loading_window.py +189 -0
- {molde-0.1.0 → molde-0.1.2}/pyproject.toml +28 -28
- molde-0.1.0/molde/colors/__init__.py +0 -2
- molde-0.1.0/molde/poly_data/__init__.py +0 -2
- {molde-0.1.0 → molde-0.1.2}/molde/fonts/IBMPlexMono-Bold.ttf +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/fonts/IBMPlexMono-Regular.ttf +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_down_dark_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_down_disabled_dark_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_down_disabled_light_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_down_light_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_left_dark_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_left_light_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_right_dark_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_right_light_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_up_dark_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_up_disabled_dark_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_up_disabled_light_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/arrow_up_light_theme.svg +0 -0
- {molde-0.1.0 → molde-0.1.2}/molde/icons/check_box_image.svg +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.3
|
2
2
|
Name: molde
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.2
|
4
4
|
Summary:
|
5
5
|
Author: André Fernandes
|
6
6
|
Author-email: fpf.andre@gmail.com
|
@@ -8,8 +8,10 @@ Requires-Python: >=3.10
|
|
8
8
|
Classifier: Programming Language :: Python :: 3
|
9
9
|
Classifier: Programming Language :: Python :: 3.10
|
10
10
|
Classifier: Programming Language :: Python :: 3.11
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
11
13
|
Requires-Dist: moviepy (>=1.0.3,<2.0.0)
|
12
|
-
Requires-Dist: numpy (>=2.
|
14
|
+
Requires-Dist: numpy (>=2.0,<3.0)
|
13
15
|
Requires-Dist: pyqt5 (>=5.15.10,<6.0.0)
|
14
16
|
Requires-Dist: pyqt5-qt5 (==5.15.2)
|
15
17
|
Requires-Dist: vtk (>=9.3.1,<10.0.0)
|
@@ -1,26 +1,26 @@
|
|
1
|
-
<div align="center">
|
2
|
-
<img height="90" src="logos/mold_horizontal_logo_dark_300dpi.png" alt="Logo" align="center">
|
3
|
-
</div>
|
4
|
-
|
5
|
-
# MOLDE
|
6
|
-
**M**OPT **L**ightweight **De**esign (MOLDE) is a library created to standardize and make easier the creation and maintainance of internal products of the Multidisciplinary Optimization Group (MOPT).
|
7
|
-
|
8
|
-
Here are the colors, icons, fonts and common interface components, that may be usefull for multiple MOPT projects.
|
9
|
-
|
10
|
-
This is heavily inspired by [Carbon Design System](https://carbondesignsystem.com/), [Atlassian Design System](https://atlassian.design/), [Fast Design System](https://www.fast.design/), [Material Design](https://m3.material.io/) and [Bold Design System](https://bold.bridge.ufsc.br/pt/).
|
11
|
-
|
12
|
-
# Colors
|
13
|
-
The color palettes are available [here](https://andrefpf.github.io/molde/).
|
14
|
-
|
15
|
-
# Icons
|
16
|
-
A lot of free to use icons, from Material Design, are available [here](https://fonts.google.com/icons).
|
17
|
-
Other icons may be necessary, and they will be made to match the same style.
|
18
|
-
For consistency avoid using icons from other places.
|
19
|
-
|
20
|
-
# Typeface
|
21
|
-
The font choose for this system is [IBM Plex](https://www.ibm.com/plex/).
|
22
|
-
The `.ttf` files for every version of the font, including monospaced, can be found [here](https://github.com/IBM/plex/tree/master/packages).
|
23
|
-
|
24
|
-
# Component
|
25
|
-
The sylesheets of the Qt components are designed to make it similar to [Atlassian components](https://atlassian.design/components/).
|
26
|
-
Always check for the Atlassian component usage guide in case of any doubt.
|
1
|
+
<div align="center">
|
2
|
+
<img height="90" src="logos/mold_horizontal_logo_dark_300dpi.png" alt="Logo" align="center">
|
3
|
+
</div>
|
4
|
+
|
5
|
+
# MOLDE
|
6
|
+
**M**OPT **L**ightweight **De**esign (MOLDE) is a library created to standardize and make easier the creation and maintainance of internal products of the Multidisciplinary Optimization Group (MOPT).
|
7
|
+
|
8
|
+
Here are the colors, icons, fonts and common interface components, that may be usefull for multiple MOPT projects.
|
9
|
+
|
10
|
+
This is heavily inspired by [Carbon Design System](https://carbondesignsystem.com/), [Atlassian Design System](https://atlassian.design/), [Fast Design System](https://www.fast.design/), [Material Design](https://m3.material.io/) and [Bold Design System](https://bold.bridge.ufsc.br/pt/).
|
11
|
+
|
12
|
+
# Colors
|
13
|
+
The color palettes are available [here](https://andrefpf.github.io/molde/).
|
14
|
+
|
15
|
+
# Icons
|
16
|
+
A lot of free to use icons, from Material Design, are available [here](https://fonts.google.com/icons).
|
17
|
+
Other icons may be necessary, and they will be made to match the same style.
|
18
|
+
For consistency avoid using icons from other places.
|
19
|
+
|
20
|
+
# Typeface
|
21
|
+
The font choose for this system is [IBM Plex](https://www.ibm.com/plex/).
|
22
|
+
The `.ttf` files for every version of the font, including monospaced, can be found [here](https://github.com/IBM/plex/tree/master/packages).
|
23
|
+
|
24
|
+
# Component
|
25
|
+
The sylesheets of the Qt components are designed to make it similar to [Atlassian components](https://atlassian.design/components/).
|
26
|
+
Always check for the Atlassian component usage guide in case of any doubt.
|
@@ -1,5 +1,6 @@
|
|
1
|
-
from pathlib import Path
|
2
|
-
|
3
|
-
from .colors import Color
|
4
|
-
|
5
|
-
MOLDE_DIR = Path(__file__).parent
|
1
|
+
from pathlib import Path
|
2
|
+
|
3
|
+
from .colors import Color
|
4
|
+
|
5
|
+
MOLDE_DIR = Path(__file__).parent
|
6
|
+
UI_DIR = MOLDE_DIR / "ui_files/"
|
@@ -1,63 +1,74 @@
|
|
1
|
-
import os, sys
|
2
|
-
from PyQt5.QtWidgets import QMainWindow, QApplication, QMessageBox, QLineEdit, QTableWidgetItem, QPushButton, QLabel
|
3
|
-
from PyQt5.QtGui import QColor
|
4
|
-
from PyQt5 import uic
|
5
|
-
from PyQt5.QtCore import Qt
|
6
|
-
from time import time
|
7
|
-
|
8
|
-
from
|
9
|
-
from
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
self.
|
21
|
-
|
22
|
-
self.
|
23
|
-
self.render_widget
|
24
|
-
self.render_widget.
|
25
|
-
|
26
|
-
self.
|
27
|
-
self.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
self.
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
1
|
+
import os, sys
|
2
|
+
from PyQt5.QtWidgets import QMainWindow, QApplication, QMessageBox, QLineEdit, QTableWidgetItem, QPushButton, QLabel
|
3
|
+
from PyQt5.QtGui import QColor
|
4
|
+
from PyQt5 import uic
|
5
|
+
from PyQt5.QtCore import Qt
|
6
|
+
from time import time
|
7
|
+
|
8
|
+
from vtkmodules.vtkFiltersSources import vtkCylinderSource
|
9
|
+
from vtkmodules.vtkRenderingCore import vtkPolyDataMapper, vtkActor
|
10
|
+
|
11
|
+
from molde import MOLDE_DIR
|
12
|
+
from molde import stylesheets
|
13
|
+
from molde.render_widgets.common_render_widget import CommonRenderWidget
|
14
|
+
|
15
|
+
|
16
|
+
class Example(QMainWindow):
|
17
|
+
def __init__(self, parent=None) -> None:
|
18
|
+
super().__init__(parent)
|
19
|
+
uic.loadUi(MOLDE_DIR / "stylesheets/mainwindow.ui", self)
|
20
|
+
self.current_theme = "light"
|
21
|
+
|
22
|
+
self.change_theme_button.clicked.connect(self.change_theme)
|
23
|
+
self.render_widget: CommonRenderWidget
|
24
|
+
self.render_widget.create_axes()
|
25
|
+
self.render_widget.create_scale_bar()
|
26
|
+
self.render_widget.create_color_bar()
|
27
|
+
self.render_widget.set_info_text("Hola\nque\ntal?")
|
28
|
+
|
29
|
+
cylinder = vtkCylinderSource()
|
30
|
+
cylinder.SetResolution(8)
|
31
|
+
cylinder_mapper = vtkPolyDataMapper()
|
32
|
+
cylinder_mapper.SetInputConnection(cylinder.GetOutputPort())
|
33
|
+
cylinder_actor = vtkActor()
|
34
|
+
cylinder_actor.SetMapper(cylinder_mapper)
|
35
|
+
self.render_widget.add_actors(cylinder_actor)
|
36
|
+
|
37
|
+
self.botao1 = QPushButton()
|
38
|
+
self.label = QLabel("Olha o sapooo")
|
39
|
+
self.botao1.setText("Olha a faca")
|
40
|
+
self.toolbar_2.addWidget(self.label)
|
41
|
+
self.toolbar_2.addWidget(self.botao1)
|
42
|
+
|
43
|
+
item = QTableWidgetItem("fr")
|
44
|
+
item.setBackground(QColor("#FF0000"))
|
45
|
+
self.tableWidget.setItem(0, 0, item)
|
46
|
+
self.show()
|
47
|
+
|
48
|
+
def change_theme(self):
|
49
|
+
if self.current_theme == "light":
|
50
|
+
self.current_theme = "dark"
|
51
|
+
else:
|
52
|
+
self.current_theme = "light"
|
53
|
+
|
54
|
+
self.render_widget.set_theme(self.current_theme)
|
55
|
+
stylesheets.set_theme(self.current_theme)
|
56
|
+
|
57
|
+
def closeEvent(self, event):
|
58
|
+
close = QMessageBox.question(
|
59
|
+
self,
|
60
|
+
"QUIT",
|
61
|
+
"Would you like to close the application?",
|
62
|
+
QMessageBox.Yes | QMessageBox.No
|
63
|
+
)
|
64
|
+
QApplication.quit()
|
65
|
+
|
66
|
+
|
67
|
+
if __name__ == "__main__":
|
68
|
+
# Make the window scale evenly for every monitor
|
69
|
+
os.environ["QT_AUTO_SCREEN_SCALE_FACTOR"] = "1"
|
70
|
+
|
71
|
+
app = QApplication(sys.argv)
|
72
|
+
e = Example()
|
73
|
+
e.change_theme()
|
74
|
+
sys.exit(app.exec())
|
@@ -1,4 +1,5 @@
|
|
1
|
-
from .ghost_actor import GhostActor
|
2
|
-
from .lines_actor import LinesActor
|
3
|
-
from .round_points_actor import RoundPointsActor
|
4
|
-
from .square_points_actor import SquarePointsActor
|
1
|
+
from .ghost_actor import GhostActor
|
2
|
+
from .lines_actor import LinesActor
|
3
|
+
from .round_points_actor import RoundPointsActor
|
4
|
+
from .square_points_actor import SquarePointsActor
|
5
|
+
from .common_symbols_actor import CommonSymbolsActorFixedSize, CommonSymbolsActorVariableSize
|
@@ -0,0 +1,148 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
|
3
|
+
from molde import Color
|
4
|
+
from vtkmodules.vtkCommonCore import (
|
5
|
+
vtkDoubleArray,
|
6
|
+
vtkIntArray,
|
7
|
+
vtkPoints,
|
8
|
+
vtkUnsignedCharArray,
|
9
|
+
)
|
10
|
+
from vtkmodules.vtkCommonDataModel import vtkPolyData
|
11
|
+
from vtkmodules.vtkRenderingCore import vtkActor, vtkDistanceToCamera, vtkGlyph3DMapper, vtkRenderer
|
12
|
+
|
13
|
+
Triple = tuple[float, float, float]
|
14
|
+
|
15
|
+
|
16
|
+
@dataclass
|
17
|
+
class Symbol:
|
18
|
+
shape_name: str
|
19
|
+
position: Triple
|
20
|
+
orientation: Triple
|
21
|
+
color: Color
|
22
|
+
scale: float
|
23
|
+
|
24
|
+
|
25
|
+
class CommonSymbolsActor(vtkActor):
|
26
|
+
def __init__(self, *args, **kwargs):
|
27
|
+
self._shapes: dict[str, vtkPolyData] = dict()
|
28
|
+
self._symbols: list[Symbol] = list()
|
29
|
+
|
30
|
+
def register_shape(self, name: str, shape: vtkPolyData):
|
31
|
+
self._shapes[name] = shape
|
32
|
+
|
33
|
+
def add_symbol(
|
34
|
+
self,
|
35
|
+
shape_name: str,
|
36
|
+
position: Triple,
|
37
|
+
orientation: Triple,
|
38
|
+
color: Triple,
|
39
|
+
scale: float = 1,
|
40
|
+
):
|
41
|
+
symbol = Symbol(
|
42
|
+
shape_name,
|
43
|
+
position,
|
44
|
+
orientation,
|
45
|
+
color,
|
46
|
+
scale,
|
47
|
+
)
|
48
|
+
self._symbols.append(symbol)
|
49
|
+
|
50
|
+
def clear_shapes(self):
|
51
|
+
self._shapes.clear()
|
52
|
+
|
53
|
+
def clear_symbols(self):
|
54
|
+
self._symbols.clear()
|
55
|
+
|
56
|
+
def clear_all(self):
|
57
|
+
self.clear_shapes()
|
58
|
+
self.clear_symbols()
|
59
|
+
|
60
|
+
def common_build(self):
|
61
|
+
self.data = vtkPolyData()
|
62
|
+
points = vtkPoints()
|
63
|
+
|
64
|
+
self.mapper: vtkGlyph3DMapper = vtkGlyph3DMapper()
|
65
|
+
self.SetMapper(self.mapper)
|
66
|
+
|
67
|
+
sources = vtkIntArray()
|
68
|
+
sources.SetName("sources")
|
69
|
+
|
70
|
+
rotations = vtkDoubleArray()
|
71
|
+
rotations.SetNumberOfComponents(3)
|
72
|
+
rotations.SetName("rotations")
|
73
|
+
|
74
|
+
scales = vtkDoubleArray()
|
75
|
+
scales.SetName("scales")
|
76
|
+
|
77
|
+
colors = vtkUnsignedCharArray()
|
78
|
+
colors.SetNumberOfComponents(3)
|
79
|
+
colors.SetName("colors")
|
80
|
+
|
81
|
+
shape_name_to_index = dict()
|
82
|
+
for index, (name, shape) in enumerate(self._shapes.items()):
|
83
|
+
shape_name_to_index[name] = index
|
84
|
+
self.mapper.SetSourceData(index, shape)
|
85
|
+
|
86
|
+
for symbol in self._symbols:
|
87
|
+
points.InsertNextPoint(symbol.position)
|
88
|
+
rotations.InsertNextTuple(symbol.orientation)
|
89
|
+
colors.InsertNextTuple(symbol.color.to_rgb())
|
90
|
+
scales.InsertNextValue(symbol.scale)
|
91
|
+
sources.InsertNextValue(shape_name_to_index[symbol.shape_name])
|
92
|
+
|
93
|
+
self.data.SetPoints(points)
|
94
|
+
self.data.GetPointData().AddArray(sources)
|
95
|
+
self.data.GetPointData().AddArray(rotations)
|
96
|
+
self.data.GetPointData().AddArray(scales)
|
97
|
+
self.data.GetPointData().SetScalars(colors)
|
98
|
+
|
99
|
+
|
100
|
+
class CommonSymbolsActorFixedSize(CommonSymbolsActor):
|
101
|
+
def build(self):
|
102
|
+
self.common_build()
|
103
|
+
|
104
|
+
self.mapper.SetInputData(self.data)
|
105
|
+
self.mapper.SetSourceIndexArray("sources")
|
106
|
+
self.mapper.SetOrientationArray("rotations")
|
107
|
+
self.mapper.SetScaleArray("scales")
|
108
|
+
self.mapper.SourceIndexingOn()
|
109
|
+
self.mapper.ScalarVisibilityOn()
|
110
|
+
self.mapper.SetScaleModeToScaleByMagnitude()
|
111
|
+
self.mapper.SetScalarModeToUsePointData()
|
112
|
+
self.mapper.SetOrientationModeToDirection()
|
113
|
+
self.mapper.Update()
|
114
|
+
|
115
|
+
|
116
|
+
class CommonSymbolsActorVariableSize(CommonSymbolsActor):
|
117
|
+
def __init__(self, renderer: vtkRenderer):
|
118
|
+
super().__init__()
|
119
|
+
self.renderer = renderer
|
120
|
+
|
121
|
+
def build(self):
|
122
|
+
self.common_build()
|
123
|
+
|
124
|
+
distance_to_camera = vtkDistanceToCamera()
|
125
|
+
distance_to_camera.SetInputData(self.data)
|
126
|
+
distance_to_camera.SetScreenSize(40)
|
127
|
+
distance_to_camera.SetRenderer(self.renderer)
|
128
|
+
|
129
|
+
self.mapper.SetInputConnection(distance_to_camera.GetOutputPort())
|
130
|
+
self.mapper.SetSourceIndexArray("sources")
|
131
|
+
self.mapper.SetOrientationArray("rotations")
|
132
|
+
self.mapper.SetScaleArray("DistanceToCamera")
|
133
|
+
self.mapper.SourceIndexingOn()
|
134
|
+
self.mapper.ScalarVisibilityOn()
|
135
|
+
self.mapper.SetScaleModeToScaleByMagnitude()
|
136
|
+
self.mapper.SetScalarModeToUsePointData()
|
137
|
+
self.mapper.SetOrientationModeToDirection()
|
138
|
+
|
139
|
+
# shows the actor in front of everything else
|
140
|
+
# offset = -66000
|
141
|
+
offset = 0
|
142
|
+
factor = 1.3
|
143
|
+
self.mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
144
|
+
self.mapper.SetRelativeCoincidentTopologyLineOffsetParameters(factor, offset)
|
145
|
+
self.mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(factor, offset)
|
146
|
+
self.mapper.SetRelativeCoincidentTopologyPointOffsetParameter(offset)
|
147
|
+
|
148
|
+
self.mapper.Update()
|
@@ -1,12 +1,12 @@
|
|
1
|
-
from vtkmodules.vtkRenderingCore import vtkActor
|
2
|
-
|
3
|
-
|
4
|
-
class GhostActor(vtkActor):
|
5
|
-
def make_ghost(self):
|
6
|
-
self.GetProperty().LightingOff()
|
7
|
-
offset = -66000
|
8
|
-
mapper = self.GetMapper()
|
9
|
-
mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
10
|
-
mapper.SetRelativeCoincidentTopologyLineOffsetParameters(0, offset)
|
11
|
-
mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(0, offset)
|
12
|
-
mapper.SetRelativeCoincidentTopologyPointOffsetParameter(offset)
|
1
|
+
from vtkmodules.vtkRenderingCore import vtkActor
|
2
|
+
|
3
|
+
|
4
|
+
class GhostActor(vtkActor):
|
5
|
+
def make_ghost(self):
|
6
|
+
self.GetProperty().LightingOff()
|
7
|
+
offset = -66000
|
8
|
+
mapper = self.GetMapper()
|
9
|
+
mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
10
|
+
mapper.SetRelativeCoincidentTopologyLineOffsetParameters(0, offset)
|
11
|
+
mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(0, offset)
|
12
|
+
mapper.SetRelativeCoincidentTopologyPointOffsetParameter(offset)
|
@@ -1,31 +1,31 @@
|
|
1
|
-
from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper
|
2
|
-
|
3
|
-
from molde.poly_data import LinesData
|
4
|
-
|
5
|
-
|
6
|
-
class LinesActor(vtkActor):
|
7
|
-
def __init__(self, lines_list) -> None:
|
8
|
-
super().__init__()
|
9
|
-
self.lines_list = lines_list
|
10
|
-
|
11
|
-
self.build()
|
12
|
-
|
13
|
-
def build(self):
|
14
|
-
data = LinesData(self.lines_list)
|
15
|
-
mapper = vtkPolyDataMapper()
|
16
|
-
mapper.SetInputData(data)
|
17
|
-
self.SetMapper(mapper)
|
18
|
-
self.GetProperty().SetLineWidth(3)
|
19
|
-
|
20
|
-
def set_width(self, width):
|
21
|
-
self.GetProperty().SetLineWidth(width)
|
22
|
-
|
23
|
-
def appear_in_front(self, cond: bool):
|
24
|
-
# this offset is the Z position of the camera buffer.
|
25
|
-
# if it is -66000 the object stays in front of everything.
|
26
|
-
offset = -66000 if cond else 0
|
27
|
-
mapper = self.GetMapper()
|
28
|
-
mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
29
|
-
mapper.SetRelativeCoincidentTopologyLineOffsetParameters(0, offset)
|
30
|
-
mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(0, offset)
|
31
|
-
mapper.SetRelativeCoincidentTopologyPointOffsetParameter(offset)
|
1
|
+
from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper
|
2
|
+
|
3
|
+
from molde.poly_data import LinesData
|
4
|
+
|
5
|
+
|
6
|
+
class LinesActor(vtkActor):
|
7
|
+
def __init__(self, lines_list) -> None:
|
8
|
+
super().__init__()
|
9
|
+
self.lines_list = lines_list
|
10
|
+
|
11
|
+
self.build()
|
12
|
+
|
13
|
+
def build(self):
|
14
|
+
data = LinesData(self.lines_list)
|
15
|
+
mapper = vtkPolyDataMapper()
|
16
|
+
mapper.SetInputData(data)
|
17
|
+
self.SetMapper(mapper)
|
18
|
+
self.GetProperty().SetLineWidth(3)
|
19
|
+
|
20
|
+
def set_width(self, width):
|
21
|
+
self.GetProperty().SetLineWidth(width)
|
22
|
+
|
23
|
+
def appear_in_front(self, cond: bool):
|
24
|
+
# this offset is the Z position of the camera buffer.
|
25
|
+
# if it is -66000 the object stays in front of everything.
|
26
|
+
offset = -66000 if cond else 0
|
27
|
+
mapper = self.GetMapper()
|
28
|
+
mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
29
|
+
mapper.SetRelativeCoincidentTopologyLineOffsetParameters(0, offset)
|
30
|
+
mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(0, offset)
|
31
|
+
mapper.SetRelativeCoincidentTopologyPointOffsetParameter(offset)
|
@@ -1,7 +1,7 @@
|
|
1
|
-
from .square_points_actor import SquarePointsActor
|
2
|
-
|
3
|
-
|
4
|
-
class RoundPointsActor(SquarePointsActor):
|
5
|
-
def __init__(self, points) -> None:
|
6
|
-
super().__init__(points)
|
7
|
-
self.GetProperty().RenderPointsAsSpheresOn()
|
1
|
+
from .square_points_actor import SquarePointsActor
|
2
|
+
|
3
|
+
|
4
|
+
class RoundPointsActor(SquarePointsActor):
|
5
|
+
def __init__(self, points) -> None:
|
6
|
+
super().__init__(points)
|
7
|
+
self.GetProperty().RenderPointsAsSpheresOn()
|
@@ -1,32 +1,32 @@
|
|
1
|
-
from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper
|
2
|
-
|
3
|
-
from molde.poly_data import VerticesData
|
4
|
-
|
5
|
-
|
6
|
-
class SquarePointsActor(vtkActor):
|
7
|
-
def __init__(self, points_list) -> None:
|
8
|
-
super().__init__()
|
9
|
-
self.points_list = points_list
|
10
|
-
self.build()
|
11
|
-
|
12
|
-
def build(self):
|
13
|
-
data = VerticesData(self.points_list)
|
14
|
-
mapper = vtkPolyDataMapper()
|
15
|
-
mapper.SetInputData(data)
|
16
|
-
self.SetMapper(mapper)
|
17
|
-
|
18
|
-
self.GetProperty().SetPointSize(20)
|
19
|
-
self.GetProperty().LightingOff()
|
20
|
-
|
21
|
-
def set_size(self, size):
|
22
|
-
self.GetProperty().SetPointSize(size)
|
23
|
-
|
24
|
-
def appear_in_front(self, cond: bool):
|
25
|
-
# this offset is the Z position of the camera buffer.
|
26
|
-
# if it is -66000 the object stays in front of everything.
|
27
|
-
offset = -66000 if cond else 0
|
28
|
-
mapper = self.GetMapper()
|
29
|
-
mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
30
|
-
mapper.SetRelativeCoincidentTopologyLineOffsetParameters(0, offset)
|
31
|
-
mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(0, offset)
|
32
|
-
mapper.SetRelativeCoincidentTopologyPointOffsetParameter(offset)
|
1
|
+
from vtkmodules.vtkRenderingCore import vtkActor, vtkPolyDataMapper
|
2
|
+
|
3
|
+
from molde.poly_data import VerticesData
|
4
|
+
|
5
|
+
|
6
|
+
class SquarePointsActor(vtkActor):
|
7
|
+
def __init__(self, points_list) -> None:
|
8
|
+
super().__init__()
|
9
|
+
self.points_list = points_list
|
10
|
+
self.build()
|
11
|
+
|
12
|
+
def build(self):
|
13
|
+
data = VerticesData(self.points_list)
|
14
|
+
mapper = vtkPolyDataMapper()
|
15
|
+
mapper.SetInputData(data)
|
16
|
+
self.SetMapper(mapper)
|
17
|
+
|
18
|
+
self.GetProperty().SetPointSize(20)
|
19
|
+
self.GetProperty().LightingOff()
|
20
|
+
|
21
|
+
def set_size(self, size):
|
22
|
+
self.GetProperty().SetPointSize(size)
|
23
|
+
|
24
|
+
def appear_in_front(self, cond: bool):
|
25
|
+
# this offset is the Z position of the camera buffer.
|
26
|
+
# if it is -66000 the object stays in front of everything.
|
27
|
+
offset = -66000 if cond else 0
|
28
|
+
mapper = self.GetMapper()
|
29
|
+
mapper.SetResolveCoincidentTopologyToPolygonOffset()
|
30
|
+
mapper.SetRelativeCoincidentTopologyLineOffsetParameters(0, offset)
|
31
|
+
mapper.SetRelativeCoincidentTopologyPolygonOffsetParameters(0, offset)
|
32
|
+
mapper.SetRelativeCoincidentTopologyPointOffsetParameter(offset)
|