Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image origin crosshair #154

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions openmc_plotter/docks.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,17 @@ def _createOriginBox(self):
dimension=2)
self.zOrBox.valueChanged.connect(zbox_connector)

self.orCrossHairBox = QCheckBox()
crosshair_connector = partial(self.main_window.toggleOriginCrosshair, apply=False)
self.orCrossHairBox.setCheckState(QtCore.Qt.Checked if self.model.currentView.originCrosshair else QtCore.Qt.Unchecked)
self.orCrossHairBox.stateChanged.connect(crosshair_connector)

# Origin Form Layout
self.orLayout = QFormLayout()
self.orLayout.addRow('X:', self.xOrBox)
self.orLayout.addRow('Y:', self.yOrBox)
self.orLayout.addRow('Z:', self.zOrBox)
self.orLayout.addRow('Crosshair:', self.orCrossHairBox)
self.orLayout.setLabelAlignment(QtCore.Qt.AlignLeft)
self.orLayout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)

Expand Down
6 changes: 6 additions & 0 deletions openmc_plotter/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -828,6 +828,12 @@ def showExportDialog(self):
def editSingleOrigin(self, value, dimension):
self.model.activeView.origin[dimension] = value

def toggleOriginCrosshair(self, state, apply=False):
self.model.activeView.originCrosshair = bool(state)

if apply:
self.applyChanges()

def editPlotAlpha(self, value):
self.model.activeView.domainAlpha = value

Expand Down
5 changes: 5 additions & 0 deletions openmc_plotter/plotgui.py
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,11 @@ def updatePixmap(self):
self.ax.dataLim.y0 = data_bounds[2]
self.ax.dataLim.y1 = data_bounds[3]

if cv.originCrosshair:
self.ax.plot(cv.origin[self.main_window.xBasis],
cv.origin[self.main_window.yBasis],
'b+')

self.draw()
return "Done"

Expand Down
3 changes: 3 additions & 0 deletions openmc_plotter/plotmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,8 @@ class PlotViewIndependent:
Alpha value of the geometry plot
plotVisibile : bool
Controls visibility of geometry
originCrosshair: bool
Controls visibility of origin crosshair
outlines: bool
Controls visibility of geometry outlines
tallyDataColormap : str
Expand Down Expand Up @@ -915,6 +917,7 @@ def __init__(self):
self.overlap_color = (255, 0, 0)
self.domainAlpha = 1.0
self.domainVisible = True
self.originCrosshair = False
self.outlines = False
self.colormaps = {'temperature': 'Oranges', 'density': 'Greys'}
# set defaults for color dialog
Expand Down