From 1e49f2e33eeaad706da6090bc6bdf72987b59646 Mon Sep 17 00:00:00 2001 From: Ovin Eilertsen Teige <91891939+ovineq@users.noreply.github.com> Date: Mon, 12 Sep 2022 13:56:52 +0200 Subject: [PATCH] feat: Add customizable casing shoe size (#481) Let's the implementer override default shoe size. Issue: https://github.com/equinor/wellx-designer/issues/653 --- src/interfaces.ts | 6 ++++++ src/layers/CasingLayer.ts | 15 ++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/interfaces.ts b/src/interfaces.ts index 7b0e3c39..7424ba41 100644 --- a/src/interfaces.ts +++ b/src/interfaces.ts @@ -81,9 +81,15 @@ export interface HoleSizeLayerOptions extends WellComponentBaseOptions { lineColor?: number; } +export interface CasingShoeSize { + width: number; + length: number; +} + export interface CasingLayerOptions extends WellComponentBaseOptions { solidColor?: number; lineColor?: number; + casingShoeSize?: CasingShoeSize; } export interface CementLayerOptions extends WellComponentBaseOptions { diff --git a/src/layers/CasingLayer.ts b/src/layers/CasingLayer.ts index a5a09545..8fc5a31e 100644 --- a/src/layers/CasingLayer.ts +++ b/src/layers/CasingLayer.ts @@ -1,7 +1,7 @@ import { Point, Rectangle, RENDERER_TYPE, Texture } from 'pixi.js'; import { zip } from 'd3-array'; import { WellboreBaseComponentLayer } from './WellboreBaseComponentLayer'; -import { CasingLayerOptions, Casing } from '..'; +import { CasingLayerOptions, Casing, CasingShoeSize } from '..'; import { makeTubularPolygon } from '../datautils/wellboreItemShapeGenerator'; import { createNormals, offsetPoint, offsetPoints } from '../utils/vectorUtils'; import { SHOE_LENGTH, SHOE_WIDTH } from '../constants'; @@ -16,6 +16,11 @@ export interface CasingRenderObject { casingWallWidth: number; } +const defaultCasingShoeSize: CasingShoeSize = { + width: SHOE_WIDTH, + length: SHOE_LENGTH, +}; + export class CasingLayer extends WellboreBaseComponentLayer { constructor(id?: string, options?: CasingLayerOptions) { super(id, options); @@ -23,6 +28,7 @@ export class CasingLayer extends WellboreBaseComponentLayer { ...this.options, solidColor: 0xdcdcdc, lineColor: 0x575757, + casingShoeSize: defaultCasingShoeSize, ...options, }; } @@ -100,10 +106,9 @@ export class CasingLayer extends WellboreBaseComponentLayer { }; drawShoe(casingEnd: number, casingRadius: number): void { - const { exaggerationFactor } = this.options as CasingLayerOptions; - - const shoeWidth = SHOE_WIDTH * exaggerationFactor; - const shoeLength = SHOE_LENGTH * exaggerationFactor; + const { exaggerationFactor, casingShoeSize } = this.options as CasingLayerOptions; + const shoeWidth = casingShoeSize.width * exaggerationFactor; + const shoeLength = casingShoeSize.length * exaggerationFactor; const shoeCoords = this.generateShoe(casingEnd, casingRadius, shoeLength, shoeWidth); const shoeCoords2 = this.generateShoe(casingEnd, casingRadius, shoeLength, -shoeWidth); this.drawBigPolygon(shoeCoords2);