All files / tools/src/types ISculptToolShape.ts

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 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 64                                                                                                                               
import type { Types } from '@cornerstonejs/core';
import type { SVGDrawingHelper, EventTypes, ContourAnnotation } from '.';
import type { PushedHandles } from '../tools/SculptorTool/CircleSculptCursor';
import type { SculptData } from '../tools/SculptorTool';
 
/**
 * This interface defines a contract for implementing various shapes within the sculptor tool.
 * Classes such as `CircleSculptCursor` adhere to this interface,
 * providing specific implementations for sculptor tools to utilize the shape
 * during sculpting operations.
 */
export interface ISculptToolShape {
  /**
   * Used to render shapes supported for sculptor tool
   *
   * @param svgDrawingHelper - The svgDrawingHelper providing the context for drawing.
   * @param canvasLocation - Current canvas location in canvas index coordinates
   * @param options - Options for drawing shapes
   */
  renderShape(
    svgDrawingHelper: SVGDrawingHelper,
    canvasLocation: Types.Point2,
    options
  ): void;
  /**
   * Pushes the points radially away from the mouse if they are
   * contained within the shape defined by the freehandSculpter tool
   */
  pushHandles(viewport: Types.IViewport, sculptData: SculptData): PushedHandles;
 
  /**
   * Function configures the tool size
   */
  configureToolSize(evt: EventTypes.InteractionEventType): void;
 
  /**
   * Updates the tool size
   * @param canvasCoords - Current canvas points
   */
  updateToolSize(
    canvasCoords: Types.Point2,
    viewport: Types.IViewport,
    activeAnnotation: ContourAnnotation
  ): void;
 
  /**
   * Function returns max spacing between two handles
   * @param minSpacing -
   */
  getMaxSpacing(minSpacing: number): number;
 
  /**
   * Function returns the the position to insert new handle
   * @param previousIndex - Previous handle index
   * @param nextIndex - Next handle index
   * @param sculptData - Sculpt data
   */
  getInsertPosition(
    previousIndex: number,
    nextIndex: number,
    sculptData: SculptData
  ): Types.Point3;
}