(
self, dataHandler, focalPoint, position, phiAxis, phiAngles, thetaAngles
)
| 72 | |
| 73 | class SphericalCamera(object): |
| 74 | def __init__( |
| 75 | self, dataHandler, focalPoint, position, phiAxis, phiAngles, thetaAngles |
| 76 | ): |
| 77 | self.dataHandler = dataHandler |
| 78 | self.cameraSettings = [] |
| 79 | self.thetaBind = { |
| 80 | "mouse": { |
| 81 | "drag": {"modifier": 0, "coordinate": 1, "step": 30, "orientation": 1} |
| 82 | } |
| 83 | } |
| 84 | self.phiBind = { |
| 85 | "mouse": { |
| 86 | "drag": {"modifier": 0, "coordinate": 0, "step": 30, "orientation": 1} |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | # Convert to serializable type |
| 91 | fp = tuple(i for i in focalPoint) |
| 92 | |
| 93 | # Register arguments to the data handler |
| 94 | if len(phiAngles) > 1 and phiAngles[-1] + phiAngles[1] == 360: |
| 95 | self.dataHandler.registerArgument( |
| 96 | priority=0, |
| 97 | name="phi", |
| 98 | values=phiAngles, |
| 99 | ui="slider", |
| 100 | loop="modulo", |
| 101 | bind=self.phiBind, |
| 102 | ) |
| 103 | else: |
| 104 | self.dataHandler.registerArgument( |
| 105 | priority=0, name="phi", values=phiAngles, ui="slider", bind=self.phiBind |
| 106 | ) |
| 107 | if thetaAngles[0] < 0 and thetaAngles[0] >= -90: |
| 108 | idx = 0 |
| 109 | for theta in thetaAngles: |
| 110 | if theta < 0: |
| 111 | idx += 1 |
| 112 | |
| 113 | self.dataHandler.registerArgument( |
| 114 | priority=0, |
| 115 | name="theta", |
| 116 | values=[(x + 90) for x in thetaAngles], |
| 117 | ui="slider", |
| 118 | default=idx, |
| 119 | bind=self.thetaBind, |
| 120 | ) |
| 121 | else: |
| 122 | self.dataHandler.registerArgument( |
| 123 | priority=0, |
| 124 | name="theta", |
| 125 | values=thetaAngles, |
| 126 | ui="slider", |
| 127 | bind=self.thetaBind, |
| 128 | ) |
| 129 | |
| 130 | # Compute all camera settings |
| 131 | for theta in thetaAngles: |
nothing calls this directly
no test coverage detected