Skip to content

Commit

Permalink
feat: Add customizable casing shoe size (#481)
Browse files Browse the repository at this point in the history
Let's the implementer override default shoe size.
Issue: https://github.com/equinor/wellx-designer/issues/653
  • Loading branch information
ovineq authored Sep 12, 2022
1 parent f0c47ad commit 1e49f2e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
6 changes: 6 additions & 0 deletions src/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
15 changes: 10 additions & 5 deletions src/layers/CasingLayer.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -16,13 +16,19 @@ 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);
this.options = {
...this.options,
solidColor: 0xdcdcdc,
lineColor: 0x575757,
casingShoeSize: defaultCasingShoeSize,
...options,
};
}
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1e49f2e

Please sign in to comment.