Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature holesizelayer #83

Merged
merged 17 commits into from
Feb 28, 2020
9 changes: 5 additions & 4 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"parser": "@typescript-eslint/parser",
"plugins": ["@typescript-eslint", "prettier"],
"plugins": ["@typescript-eslint/eslint-plugin", "prettier"],
"env": {
"es6": true,
"node": true
"node": true,
"browser": true
},
"extends": [
"eslint:recommended",
Expand All @@ -18,14 +19,14 @@
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./.eslintrc.json"
"project": "./tsconfig.json"
},
"rules": {
"no-continue": "off",
"no-plusplus": "off",
"no-param-reassign": "off",
"prettier/prettier": "error",
"import/prefer-default-export": "off",
"max-len": ["error", {"code": 150}]
"max-len": ["error", { "code": 150 }]
}
}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
storybook-static
storybook-static
report*
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 150,
"singleQuote": true,
"trailingComma": "all",
"endOfLine": "lf",
"useTabs": false,
"tabWidth": 2,
"semi": true,
"bracketSpacing": true
}
19 changes: 2 additions & 17 deletions .storybook/src/components/axis.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@ export const SingleAxis = () => {
.attr('height', '1000px')
.attr('width', '1000px');

const createScale = (
xMin: number,
xMax: number,
yMin: number,
yMax: number,
height: number,
width: number,
) => {
const createScale = (xMin: number, xMax: number, yMin: number, yMax: number, height: number, width: number) => {
return [
scaleLinear()
.domain([xMin, xMax])
Expand All @@ -37,15 +30,7 @@ export const SingleAxis = () => {
const mainGroup = svg;
const showLabels = true;

const axis = new Axis(
mainGroup,
scaleX,
scaleY,
showLabels,
'Displacement',
'TVD MSL',
'm',
);
const axis = new Axis(mainGroup, scaleX, scaleY, showLabels, 'Displacement', 'TVD MSL', 'm');
axis.render();
return div;
};
34 changes: 10 additions & 24 deletions .storybook/src/geomodel-layer.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ import { GeomodelLayerOptions, OnUpdateEvent } from '../../src/interfaces';
import { SurfaceGenerator } from './utils/surfaceGenerator';
import { ZoomPanHandler } from '../../src/control/ZoomPanHandler';

import {
generateSurfaceData,
generateProjectedTrajectory,
SurfaceData,
} from '../../src/datautils';
import { generateSurfaceData, generateProjectedTrajectory, SurfaceData } from '../../src/datautils';

//Data
import poslog from './exampledata/polog.json';
Expand All @@ -34,28 +30,21 @@ export const GeoModel = () => {

const root = document.createElement('div');
root.className = 'grid-container';
root.setAttribute(
'style',
`height: ${height}px; width: ${width}px;background-color: #eee;`,
);
root.setAttribute('style', `height: ${height}px; width: ${width}px;background-color: #eee;`);
root.setAttribute('height', `${height}`);
root.setAttribute('width', `${width}`);

geoModelLayer.onMount({ elm: root, height, width });
const strat1: [number[], number[]] = [[0], [1]];
const data: [
number[],
number[],
number[],
][] = new SurfaceGenerator().generateData();
const data: [number[], number[], number[]][] = new SurfaceGenerator().generateData();

geoModelLayer.onUpdate(createEventObj(root, data));

return root;
};

function transformData(inData: [number[], number[], number[]]){
const data = inData[0].map((v, index) => ([v, inData[1][index], inData[2][index]]));
function transformData(inData: [number[], number[], number[]]) {
const data = inData[0].map((v, index) => [v, inData[1][index], inData[2][index]]);
return data;
}

Expand All @@ -67,7 +56,7 @@ const createEventObj = (elm: any, inputData: any) => {
.domain(ybounds)
.range([0, height]);

if(!inputData)return;
if (!inputData) return;

const data = {
lines: [],
Expand Down Expand Up @@ -102,8 +91,8 @@ const createEventObj = (elm: any, inputData: any) => {
color: 0x155512,
data: transformData(inputData[5]),
},
]
}
],
};
return {
xScale: xScale.copy(),
yScale: yScale.copy(),
Expand All @@ -115,10 +104,7 @@ const createEventObj = (elm: any, inputData: any) => {
export const GeoModelWithSampleData = () => {
const root = document.createElement('div');
root.className = 'grid-container';
root.setAttribute(
'style',
`height: ${height}px; width: ${width}px;background-color: #eee;`,
);
root.setAttribute('style', `height: ${height}px; width: ${width}px;background-color: #eee;`);
root.setAttribute('height', `${height}`);
root.setAttribute('width', `${width}`);

Expand All @@ -135,7 +121,7 @@ export const GeoModelWithSampleData = () => {
zoomHandler.zFactor = 1;
zoomHandler.setTranslateBounds([-5000, 6000], [-5000, 6000]);
zoomHandler.enableTranslateExtent = false;
zoomHandler.setViewport(1000,1000, 5000);
zoomHandler.setViewport(1000, 1000, 5000);

return root;
};
Loading