Skip to content

Commit

Permalink
Code comment fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nilscb committed Oct 13, 2023
1 parent b741d89 commit 3aecd43
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 48 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
import { removeConsecutiveDuplicates, splineRefine } from "./spline";
import type { Position3D } from "../../utils/layerTools";
import { generateSyntheticWell } from "./generateSyntheticWell";
import type { FeatureCollection } from "geojson";

const testWell = {
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "GeometryCollection",
geometries: [
{
type: "Point",
coordinates: [0, 0],
},
{
type: "LineString",
coordinates: [
[0, 0, 0],
[0, 0, -100],
[0, 0, -200],
[0, 0, -300],
[0, 0, -400],
[0, 0, -500],
[0, 0, -600],
[0, 0, -700],
[0, 0, -800],
],
},
],
},
properties: {
name: "wl6",
color: [255, 255, 0, 255],
md: [[0, 1, 2, 3, 4, 5, 8, 9]],
},
},
],
};

describe("remove duplicates", () => {
const coords: Position3D[] = [
[1, 2, 3],
Expand Down Expand Up @@ -49,20 +85,24 @@ describe("remove duplicates", () => {

// Test splineRefine functions
it("should not refine if given invalid input", () => {
const well = generateSyntheticWell() as unknown as FeatureCollection;
expect(
splineRefine(well, 0).features[0].geometry.geometries[1].coordinates.length // eslint-disable-line
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
splineRefine(testWell as unknown as FeatureCollection, 0).features[0].geometry.geometries[1].coordinates.length // eslint-disable-line
).toStrictEqual(9);
});

it("should refine and output more vertices if given valid input", () => {
const well = generateSyntheticWell();
expect(
splineRefine(well as unknown as FeatureCollection).features[0].geometry.geometries[1].coordinates.length // eslint-disable-line
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
splineRefine(testWell as unknown as FeatureCollection).features[0].geometry.geometries[1].coordinates.length // eslint-disable-line
).toStrictEqual(33);

expect(
splineRefine(well as unknown as FeatureCollection, 10).features[0].geometry.geometries[1].coordinates.length // eslint-disable-line
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
splineRefine(testWell as unknown as FeatureCollection, 10).features[0].geometry.geometries[1].coordinates.length // eslint-disable-line
).toStrictEqual(63);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,46 @@ import {
import type { MapMouseEvent } from "../../components/Map";
import WellsLayer from "./wellsLayer";
import AxesLayer from "../axes/axesLayer";
import { generateSynteticWell } from "./utils/generateSyntheticWell";

const PREFIX = "VolveWells";

const testWellWithDuplicates = {
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "GeometryCollection",
geometries: [
{
type: "Point",
coordinates: [0, 0],
},
{
type: "LineString",
coordinates: [
[0, 0, 0],
[0, 0, -100],
[0, 0, -200],
[0, 0, -300],
[0, 0, -400],
[0, 0, -500],
[0, 0, -600],
[0, 0, -700],
[0, 0, -800],
],
},
],
},
properties: {
name: "wl6",
color: [255, 255, 0, 255],
md: [[0, 1, 2, 3, 4, 5, 8, 9]],
},
},
],
};

const classes = {
main: `${PREFIX}-main`,
};
Expand Down Expand Up @@ -444,7 +480,7 @@ VerticalWellWithDuplicates.args = {
bounds: [-150, -150, 150, 150],
layers: [
new WellsLayer({
data: generateSynteticWell(),
data: testWellWithDuplicates,
}),
new AxesLayer({
id: "axes-layer",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ export interface WellsLayerProps extends ExtendedLayerProps {
logrunName: string;
logRadius: number;
logCurves: boolean;
/** If true will refine the well path by interpolating it using a spline and super sample it
* so that one by default gets 5 new vertices along the path between each pair of original vertices.
* May also be specified as a number greater than 1 in which case the number of new vertices
* between pairs of original vertices will be this number.
*/
refine: boolean | number;
wellHeadStyle: WellHeadStyleAccessor;
colorMappingFunction: (x: number) => [number, number, number];
Expand Down

0 comments on commit 3aecd43

Please sign in to comment.