Base class for freeform drawing operations. A drawing operation has at least one location (x, y) in local coordinates.
| 248 | |
| 249 | |
| 250 | class _BaseDrawingOperation(object): |
| 251 | """Base class for freeform drawing operations. |
| 252 | |
| 253 | A drawing operation has at least one location (x, y) in local coordinates. |
| 254 | """ |
| 255 | |
| 256 | def __init__(self, freeform_builder: FreeformBuilder, x: Length, y: Length): |
| 257 | super(_BaseDrawingOperation, self).__init__() |
| 258 | self._freeform_builder = freeform_builder |
| 259 | self._x = x |
| 260 | self._y = y |
| 261 | |
| 262 | def apply_operation_to(self, path: CT_Path2D) -> CT_DrawingOperation: |
| 263 | """Add the XML element(s) implementing this operation to `path`. |
| 264 | |
| 265 | Must be implemented by each subclass. |
| 266 | """ |
| 267 | raise NotImplementedError("must be implemented by each subclass") |
| 268 | |
| 269 | @property |
| 270 | def x(self) -> Length: |
| 271 | """Return the horizontal (x) target location of this operation. |
| 272 | |
| 273 | The returned value is an integer in local coordinates. |
| 274 | """ |
| 275 | return self._x |
| 276 | |
| 277 | @property |
| 278 | def y(self) -> Length: |
| 279 | """Return the vertical (y) target location of this operation. |
| 280 | |
| 281 | The returned value is an integer in local coordinates. |
| 282 | """ |
| 283 | return self._y |
| 284 | |
| 285 | |
| 286 | class _Close(object): |
no outgoing calls
searching dependent graphs…