aboutsummaryrefslogtreecommitdiff
path: root/src/client/northstar
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-04-08 22:45:22 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-04-08 22:45:22 -0400
commit5e086920bf97297a02bcd38faea56454c2220279 (patch)
tree9b7fa3ec3df3a522b5676dc743afc17ef2b5cf09 /src/client/northstar
parentcecbafdd8e42b1fa021a54fe624c3cf68e8645bd (diff)
Enabled semi-colon and braces linter rule
Diffstat (limited to 'src/client/northstar')
-rw-r--r--src/client/northstar/core/BaseObject.ts4
-rw-r--r--src/client/northstar/core/attribute/AttributeModel.ts6
-rw-r--r--src/client/northstar/core/attribute/AttributeTransformationModel.ts17
-rw-r--r--src/client/northstar/core/attribute/CalculatedAttributeModel.ts2
-rw-r--r--src/client/northstar/core/brusher/IBaseBrushable.ts4
-rw-r--r--src/client/northstar/core/brusher/IBaseBrusher.ts2
-rw-r--r--src/client/northstar/core/filter/FilterModel.ts2
-rw-r--r--src/client/northstar/core/filter/IBaseFilterConsumer.ts4
-rw-r--r--src/client/northstar/core/filter/IBaseFilterProvider.ts2
-rw-r--r--src/client/northstar/core/filter/ValueComparision.ts16
-rw-r--r--src/client/northstar/dash-fields/HistogramField.ts2
-rw-r--r--src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts12
-rw-r--r--src/client/northstar/dash-nodes/HistogramBox.tsx24
-rw-r--r--src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx40
-rw-r--r--src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx15
-rw-r--r--src/client/northstar/manager/Gateway.ts2
-rw-r--r--src/client/northstar/model/ModelExtensions.ts18
-rw-r--r--src/client/northstar/model/ModelHelpers.ts8
-rw-r--r--src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts4
-rw-r--r--src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts4
-rw-r--r--src/client/northstar/model/binRanges/NominalVisualBinRange.ts4
-rw-r--r--src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts2
-rw-r--r--src/client/northstar/model/binRanges/VisualBinRange.ts2
-rw-r--r--src/client/northstar/model/binRanges/VisualBinRangeHelper.ts14
-rw-r--r--src/client/northstar/operations/BaseOperation.ts9
-rw-r--r--src/client/northstar/operations/HistogramOperation.ts2
-rw-r--r--src/client/northstar/utils/ArrayUtil.ts2
-rw-r--r--src/client/northstar/utils/Extensions.ts6
-rw-r--r--src/client/northstar/utils/GeometryUtil.ts34
-rw-r--r--src/client/northstar/utils/MathUtil.ts38
-rw-r--r--src/client/northstar/utils/SizeConverter.ts16
-rw-r--r--src/client/northstar/utils/StyleContants.ts2
-rw-r--r--src/client/northstar/utils/Utils.ts8
33 files changed, 180 insertions, 147 deletions
diff --git a/src/client/northstar/core/BaseObject.ts b/src/client/northstar/core/BaseObject.ts
index f1761e643..ed3818071 100644
--- a/src/client/northstar/core/BaseObject.ts
+++ b/src/client/northstar/core/BaseObject.ts
@@ -1,5 +1,5 @@
-import { IEquatable } from '../utils/IEquatable'
-import { IDisposable } from '../utils/IDisposable'
+import { IEquatable } from '../utils/IEquatable';
+import { IDisposable } from '../utils/IDisposable';
export class BaseObject implements IEquatable, IDisposable {
diff --git a/src/client/northstar/core/attribute/AttributeModel.ts b/src/client/northstar/core/attribute/AttributeModel.ts
index 230bfecc8..c89b1617c 100644
--- a/src/client/northstar/core/attribute/AttributeModel.ts
+++ b/src/client/northstar/core/attribute/AttributeModel.ts
@@ -1,5 +1,5 @@
-import { Attribute, DataType, VisualizationHint } from '../../model/idea/idea'
-import { BaseObject } from '../BaseObject'
+import { Attribute, DataType, VisualizationHint } from '../../model/idea/idea';
+import { BaseObject } from '../BaseObject';
import { observable } from "mobx";
export abstract class AttributeModel extends BaseObject {
@@ -93,7 +93,7 @@ export class BackendAttributeModel extends AttributeModel {
}
public get DisplayName(): string {
- return this._displayName.ReplaceAll("_", " ");;
+ return this._displayName.ReplaceAll("_", " ");
}
public get CodeName(): string {
diff --git a/src/client/northstar/core/attribute/AttributeTransformationModel.ts b/src/client/northstar/core/attribute/AttributeTransformationModel.ts
index f50b78d51..66485183b 100644
--- a/src/client/northstar/core/attribute/AttributeTransformationModel.ts
+++ b/src/client/northstar/core/attribute/AttributeTransformationModel.ts
@@ -1,4 +1,4 @@
-;
+
import { computed, observable } from "mobx";
import { AggregateFunction } from "../../model/idea/idea";
import { AttributeModel } from "./AttributeModel";
@@ -20,16 +20,21 @@ export class AttributeTransformationModel implements IEquatable {
if (this.AggregateFunction === AggregateFunction.Count) {
return "count";
}
- if (this.AggregateFunction === AggregateFunction.Avg)
+ if (this.AggregateFunction === AggregateFunction.Avg) {
displayName = "avg(" + displayName + ")";
- else if (this.AggregateFunction === AggregateFunction.Max)
+ }
+ else if (this.AggregateFunction === AggregateFunction.Max) {
displayName = "max(" + displayName + ")";
- else if (this.AggregateFunction === AggregateFunction.Min)
+ }
+ else if (this.AggregateFunction === AggregateFunction.Min) {
displayName = "min(" + displayName + ")";
- else if (this.AggregateFunction === AggregateFunction.Sum)
+ }
+ else if (this.AggregateFunction === AggregateFunction.Sum) {
displayName = "sum(" + displayName + ")";
- else if (this.AggregateFunction === AggregateFunction.SumE)
+ }
+ else if (this.AggregateFunction === AggregateFunction.SumE) {
displayName = "sumE(" + displayName + ")";
+ }
return displayName;
}
diff --git a/src/client/northstar/core/attribute/CalculatedAttributeModel.ts b/src/client/northstar/core/attribute/CalculatedAttributeModel.ts
index 0b8e0d12c..a197c1305 100644
--- a/src/client/northstar/core/attribute/CalculatedAttributeModel.ts
+++ b/src/client/northstar/core/attribute/CalculatedAttributeModel.ts
@@ -1,5 +1,5 @@
import { BackendAttributeModel, AttributeModel, CodeAttributeModel } from "./AttributeModel";
-import { DataType, VisualizationHint } from '../../model/idea/idea'
+import { DataType, VisualizationHint } from '../../model/idea/idea';
export class CalculatedAttributeManager {
public static AllCalculatedAttributes: Array<AttributeModel> = new Array<AttributeModel>();
diff --git a/src/client/northstar/core/brusher/IBaseBrushable.ts b/src/client/northstar/core/brusher/IBaseBrushable.ts
index 99a36636f..c46db4d22 100644
--- a/src/client/northstar/core/brusher/IBaseBrushable.ts
+++ b/src/client/northstar/core/brusher/IBaseBrushable.ts
@@ -1,6 +1,6 @@
-import { PIXIPoint } from '../../utils/MathUtil'
+import { PIXIPoint } from '../../utils/MathUtil';
import { IEquatable } from '../../utils/IEquatable';
-import { Document } from '../../../../fields/Document'
+import { Document } from '../../../../fields/Document';
export interface IBaseBrushable<T> extends IEquatable {
BrusherModels: Array<Document>;
diff --git a/src/client/northstar/core/brusher/IBaseBrusher.ts b/src/client/northstar/core/brusher/IBaseBrusher.ts
index d7ae65464..d2de6ed62 100644
--- a/src/client/northstar/core/brusher/IBaseBrusher.ts
+++ b/src/client/northstar/core/brusher/IBaseBrusher.ts
@@ -1,4 +1,4 @@
-import { PIXIPoint } from '../../utils/MathUtil'
+import { PIXIPoint } from '../../utils/MathUtil';
import { IEquatable } from '../../utils/IEquatable';
diff --git a/src/client/northstar/core/filter/FilterModel.ts b/src/client/northstar/core/filter/FilterModel.ts
index 20fca77f5..e2ba3f652 100644
--- a/src/client/northstar/core/filter/FilterModel.ts
+++ b/src/client/northstar/core/filter/FilterModel.ts
@@ -15,7 +15,7 @@ export class FilterModel {
public Equals(other: FilterModel): boolean {
if (!Utils.EqualityHelper(this, other)) return false;
- if (!this.isSame(this.ValueComparisons, (other as FilterModel).ValueComparisons)) return false;
+ if (!this.isSame(this.ValueComparisons, (other).ValueComparisons)) return false;
return true;
}
diff --git a/src/client/northstar/core/filter/IBaseFilterConsumer.ts b/src/client/northstar/core/filter/IBaseFilterConsumer.ts
index 93f66a154..59d7adf4c 100644
--- a/src/client/northstar/core/filter/IBaseFilterConsumer.ts
+++ b/src/client/northstar/core/filter/IBaseFilterConsumer.ts
@@ -1,5 +1,5 @@
-import { FilterOperand } from '../filter/FilterOperand'
-import { IEquatable } from '../../utils/IEquatable'
+import { FilterOperand } from '../filter/FilterOperand';
+import { IEquatable } from '../../utils/IEquatable';
import { Document } from "../../../../fields/Document";
export interface IBaseFilterConsumer extends IEquatable {
diff --git a/src/client/northstar/core/filter/IBaseFilterProvider.ts b/src/client/northstar/core/filter/IBaseFilterProvider.ts
index d082bfe12..fc3301b11 100644
--- a/src/client/northstar/core/filter/IBaseFilterProvider.ts
+++ b/src/client/northstar/core/filter/IBaseFilterProvider.ts
@@ -1,4 +1,4 @@
-import { FilterModel } from '../filter/FilterModel'
+import { FilterModel } from '../filter/FilterModel';
export interface IBaseFilterProvider {
FilterModels: Array<FilterModel>;
diff --git a/src/client/northstar/core/filter/ValueComparision.ts b/src/client/northstar/core/filter/ValueComparision.ts
index 1a3e461f5..80b1242a9 100644
--- a/src/client/northstar/core/filter/ValueComparision.ts
+++ b/src/client/northstar/core/filter/ValueComparision.ts
@@ -1,5 +1,5 @@
-import { Predicate } from '../../model/idea/idea'
-import { Utils } from '../../utils/Utils'
+import { Predicate } from '../../model/idea/idea';
+import { Utils } from '../../utils/Utils';
import { AttributeModel } from '../attribute/AttributeModel';
export class ValueComparison {
@@ -15,15 +15,19 @@ export class ValueComparison {
}
public Equals(other: Object): boolean {
- if (!Utils.EqualityHelper(this, other))
+ if (!Utils.EqualityHelper(this, other)) {
return false;
- if (this.Predicate !== (other as ValueComparison).Predicate)
+ }
+ if (this.Predicate !== (other as ValueComparison).Predicate) {
return false;
+ }
let isComplex = (typeof this.Value === "object");
- if (!isComplex && this.Value !== (other as ValueComparison).Value)
+ if (!isComplex && this.Value !== (other as ValueComparison).Value) {
return false;
- if (isComplex && !this.Value.Equals((other as ValueComparison).Value))
+ }
+ if (isComplex && !this.Value.Equals((other as ValueComparison).Value)) {
return false;
+ }
return true;
}
diff --git a/src/client/northstar/dash-fields/HistogramField.ts b/src/client/northstar/dash-fields/HistogramField.ts
index fa2a9c008..6abde4677 100644
--- a/src/client/northstar/dash-fields/HistogramField.ts
+++ b/src/client/northstar/dash-fields/HistogramField.ts
@@ -41,7 +41,7 @@ export class HistogramField extends BasicField<HistogramOperation> {
data: this.toString(),
_id: this.Id
- }
+ };
}
@action
diff --git a/src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts b/src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts
index cdae90c8b..6291ec1fc 100644
--- a/src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts
+++ b/src/client/northstar/dash-nodes/HistogramBinPrimitiveCollection.ts
@@ -1,4 +1,4 @@
-import React = require("react")
+import React = require("react");
import { AttributeTransformationModel } from "../../northstar/core/attribute/AttributeTransformationModel";
import { ChartType } from '../../northstar/model/binRanges/VisualBinRange';
import { AggregateFunction, Bin, Brush, DoubleValueAggregateResult, HistogramResult, MarginAggregateParameters, MarginAggregateResult } from "../../northstar/model/idea/idea";
@@ -29,7 +29,7 @@ export class HistogramBinPrimitiveCollection {
private _histoBox: HistogramBox;
private get histoOp() { return this._histoBox.HistoOp; }
private get histoResult() { return this.histoOp.Result as HistogramResult; }
- private get sizeConverter() { return this._histoBox.SizeConverter!; }
+ private get sizeConverter() { return this._histoBox.SizeConverter; }
public BinPrimitives: Array<HistogramBinPrimitive> = new Array<HistogramBinPrimitive>();
public HitGeom: PIXIRectangle = PIXIRectangle.EMPTY;
@@ -99,13 +99,14 @@ export class HistogramBinPrimitiveCollection {
private createHeatmapBinPrimitives(bin: Bin, brush: Brush, brushFactorSum: number): number {
let unNormalizedValue = this.getBinValue(2, bin, brush.brushIndex!);
- if (unNormalizedValue === undefined)
+ if (unNormalizedValue === undefined) {
return brushFactorSum;
+ }
var normalizedValue = (unNormalizedValue - this._histoBox.ValueRange[0]) / (Math.abs((this._histoBox.ValueRange[1] - this._histoBox.ValueRange[0])) < HistogramBinPrimitiveCollection.TOLERANCE ?
unNormalizedValue : this._histoBox.ValueRange[1] - this._histoBox.ValueRange[0]);
- let allUnNormalizedValue = this.getBinValue(2, bin, ModelHelpers.AllBrushIndex(this.histoResult))
+ let allUnNormalizedValue = this.getBinValue(2, bin, ModelHelpers.AllBrushIndex(this.histoResult));
// bcz: are these calls needed?
let [xFrom, xTo] = this.sizeConverter.DataToScreenXAxisRange(this._histoBox.VisualBinRanges, 0, bin);
@@ -145,8 +146,9 @@ export class HistogramBinPrimitiveCollection {
let [xFrom, xTo] = this.sizeConverter.DataToScreenPointRange(0, bin, ModelHelpers.CreateAggregateKey(this.histoOp.Schema!.distinctAttributeParameters, this.histoOp.X, this.histoResult, brush.brushIndex!));
let [yFrom, yTo] = this.sizeConverter.DataToScreenPointRange(1, bin, ModelHelpers.CreateAggregateKey(this.histoOp.Schema!.distinctAttributeParameters, this.histoOp.Y, this.histoResult, brush.brushIndex!));
- if (xFrom !== undefined && yFrom !== undefined && xTo !== undefined && yTo !== undefined)
+ if (xFrom !== undefined && yFrom !== undefined && xTo !== undefined && yTo !== undefined) {
this.createBinPrimitive(-1, brush, PIXIRectangle.EMPTY, 0, xFrom, xTo, yFrom, yTo, this.baseColorFromBrush(brush), 1, unNormalizedValue);
+ }
}
return 0;
}
diff --git a/src/client/northstar/dash-nodes/HistogramBox.tsx b/src/client/northstar/dash-nodes/HistogramBox.tsx
index ec9413649..7df59ef07 100644
--- a/src/client/northstar/dash-nodes/HistogramBox.tsx
+++ b/src/client/northstar/dash-nodes/HistogramBox.tsx
@@ -1,4 +1,4 @@
-import React = require("react")
+import React = require("react");
import { action, computed, observable, reaction, runInAction, trace } from "mobx";
import { observer } from "mobx-react";
import Measure from "react-measure";
@@ -25,7 +25,7 @@ import { StyleConstants } from "../utils/StyleContants";
@observer
export class HistogramBox extends React.Component<FieldViewProps> {
- public static LayoutString(fieldStr: string = "DataKey") { return FieldView.LayoutString(HistogramBox, fieldStr) }
+ public static LayoutString(fieldStr: string = "DataKey") { return FieldView.LayoutString(HistogramBox, fieldStr); }
private _dropXRef = React.createRef<HTMLDivElement>();
private _dropYRef = React.createRef<HTMLDivElement>();
private _dropXDisposer?: DragManager.DragDropDisposer;
@@ -92,15 +92,15 @@ export class HistogramBox extends React.Component<FieldViewProps> {
}
reaction(() => CurrentUserUtils.NorthstarDBCatalog, (catalog?: Catalog) => this.activateHistogramOperation(catalog), { fireImmediately: true });
reaction(() => [this.VisualBinRanges && this.VisualBinRanges.slice()], () => this.SizeConverter.SetVisualBinRanges(this.VisualBinRanges));
- reaction(() => [this.PanelHeight, this.PanelWidth], () => this.SizeConverter.SetIsSmall(this.PanelWidth < 40 && this.PanelHeight < 40))
+ reaction(() => [this.PanelHeight, this.PanelWidth], () => this.SizeConverter.SetIsSmall(this.PanelWidth < 40 && this.PanelHeight < 40));
reaction(() => this.HistogramResult ? this.HistogramResult.binRanges : undefined,
(binRanges: BinRange[] | undefined) => {
if (binRanges) {
this.VisualBinRanges.splice(0, this.VisualBinRanges.length, ...binRanges.map((br, ind) =>
- VisualBinRangeHelper.GetVisualBinRange(this.HistoOp.Schema!.distinctAttributeParameters, br, this.HistogramResult!, ind ? this.HistoOp.Y : this.HistoOp.X, this.ChartType)));
+ VisualBinRangeHelper.GetVisualBinRange(this.HistoOp.Schema!.distinctAttributeParameters, br, this.HistogramResult, ind ? this.HistoOp.Y : this.HistoOp.X, this.ChartType)));
- let valueAggregateKey = ModelHelpers.CreateAggregateKey(this.HistoOp.Schema!.distinctAttributeParameters, this.HistoOp.V, this.HistogramResult!, ModelHelpers.AllBrushIndex(this.HistogramResult!));
- this.ValueRange = Object.values(this.HistogramResult!.bins!).reduce((prev, cur) => {
+ let valueAggregateKey = ModelHelpers.CreateAggregateKey(this.HistoOp.Schema!.distinctAttributeParameters, this.HistoOp.V, this.HistogramResult, ModelHelpers.AllBrushIndex(this.HistogramResult));
+ this.ValueRange = Object.values(this.HistogramResult.bins!).reduce((prev, cur) => {
let value = ModelHelpers.GetAggregateResult(cur, valueAggregateKey) as DoubleValueAggregateResult;
return value && value.hasResult ? [Math.min(prev[0], value.result!), Math.max(prev[1], value.result!)] : prev;
}, [Number.MAX_VALUE, Number.MIN_VALUE]);
@@ -109,10 +109,12 @@ export class HistogramBox extends React.Component<FieldViewProps> {
}
componentWillUnmount() {
- if (this._dropXDisposer)
+ if (this._dropXDisposer) {
this._dropXDisposer();
- if (this._dropYDisposer)
+ }
+ if (this._dropYDisposer) {
this._dropYDisposer();
+ }
}
activateHistogramOperation(catalog?: Catalog) {
@@ -128,7 +130,7 @@ export class HistogramBox extends React.Component<FieldViewProps> {
this.HistoOp.BrushLinks.splice(0, this.HistoOp.BrushLinks.length, ...brushingDocs.map((brush, i) => {
brush.SetNumber(KeyStore.BackgroundColor, StyleConstants.BRUSH_COLORS[i % StyleConstants.BRUSH_COLORS.length]);
let brushed = brush.GetList(KeyStore.BrushingDocs, [] as Document[]);
- return { l: brush, b: brushed[0].Id === proto.Id ? brushed[1] : brushed[0] }
+ return { l: brush, b: brushed[0].Id === proto.Id ? brushed[1] : brushed[0] };
}));
}, { fireImmediately: true });
reaction(() => this.createOperationParamsCache, () => this.HistoOp.Update(), { fireImmediately: true });
@@ -146,7 +148,7 @@ export class HistogramBox extends React.Component<FieldViewProps> {
let roff = this.SizeConverter.RightOffset;
let boff = this.SizeConverter.BottomOffset;
return (
- <Measure onResize={(r: any) => runInAction(() => { this.PanelWidth = r.entry.width; this.PanelHeight = r.entry.height })}>
+ <Measure onResize={(r: any) => runInAction(() => { this.PanelWidth = r.entry.width; this.PanelHeight = r.entry.height; })}>
{({ measureRef }) =>
<div className="histogrambox-container" ref={measureRef} style={{ transform: `translate(-50%, -50%)` }}>
<div className="histogrambox-yaxislabel" onPointerDown={this.yLabelPointerDown} ref={this._dropYRef} >
@@ -168,7 +170,7 @@ export class HistogramBox extends React.Component<FieldViewProps> {
</div>
}
</Measure>
- )
+ );
}
}
diff --git a/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx b/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
index a78703247..4c5bdb14b 100644
--- a/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
+++ b/src/client/northstar/dash-nodes/HistogramBoxPrimitives.tsx
@@ -1,4 +1,4 @@
-import React = require("react")
+import React = require("react");
import { computed, observable, reaction, runInAction, trace, action } from "mobx";
import { observer } from "mobx-react";
import { Utils as DashUtils } from '../../../Utils';
@@ -28,17 +28,18 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
@computed get selectedPrimitives() { return this._selectedPrims.map(bp => this.drawRect(bp.Rect, bp.BarAxis, undefined, "border")); }
@computed get barPrimitives() {
let histoResult = this.props.HistoBox.HistogramResult;
- if (!histoResult || !histoResult.bins || !this.props.HistoBox.VisualBinRanges.length)
+ if (!histoResult || !histoResult.bins || !this.props.HistoBox.VisualBinRanges.length) {
return (null);
+ }
let allBrushIndex = ModelHelpers.AllBrushIndex(histoResult);
return Object.keys(histoResult.bins).reduce((prims: JSX.Element[], key: string) => {
- let drawPrims = new HistogramBinPrimitiveCollection(histoResult!.bins![key], this.props.HistoBox);
+ let drawPrims = new HistogramBinPrimitiveCollection(histoResult.bins![key], this.props.HistoBox);
let toggle = this.getSelectionToggle(drawPrims.BinPrimitives, allBrushIndex,
- ModelHelpers.GetBinFilterModel(histoResult!.bins![key], allBrushIndex, histoResult!, this.histoOp.X, this.histoOp.Y));
+ ModelHelpers.GetBinFilterModel(histoResult.bins![key], allBrushIndex, histoResult, this.histoOp.X, this.histoOp.Y));
drawPrims.BinPrimitives.filter(bp => bp.DataValue && bp.BrushIndex !== allBrushIndex).map(bp =>
prims.push(...[{ r: bp.Rect, c: bp.Color }, { r: bp.MarginRect, c: StyleConstants.MARGIN_BARS_COLOR }].map(pair => this.drawRect(pair.r, bp.BarAxis, pair.c, "bar", toggle))));
return prims;
- }, [] as JSX.Element[])
+ }, [] as JSX.Element[]);
}
componentDidMount() {
@@ -47,8 +48,9 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
private getSelectionToggle(binPrimitives: HistogramBinPrimitive[], allBrushIndex: number, filterModel: FilterModel) {
let rawAllBrushPrim = ArrayUtil.FirstOrDefault(binPrimitives, bp => bp.BrushIndex === allBrushIndex);
- if (!rawAllBrushPrim)
- return () => { }
+ if (!rawAllBrushPrim) {
+ return () => { };
+ }
let allBrushPrim = rawAllBrushPrim;
return () => runInAction(() => {
if (ArrayUtil.Contains(this.histoOp.FilterModels, filterModel)) {
@@ -59,23 +61,25 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
this._selectedPrims.push(allBrushPrim);
this.histoOp.AddFilterModels([filterModel]);
}
- })
+ });
}
private renderGridLinesAndLabels(axis: number) {
trace();
- if (!this.props.HistoBox.SizeConverter.Initialized)
+ if (!this.props.HistoBox.SizeConverter.Initialized) {
return (null);
+ }
let labels = this.props.HistoBox.VisualBinRanges[axis].GetLabels();
return <svg className="histogramboxprimitives-svgContainer">
{labels.reduce((prims, binLabel, i) => {
let r = this.props.HistoBox.SizeConverter.DataToScreenRange(binLabel.minValue!, binLabel.maxValue!, axis);
prims.push(this.drawLine(r.xFrom, r.yFrom, axis === 0 ? 0 : r.xTo - r.xFrom, axis === 0 ? r.yTo - r.yFrom : 0));
- if (i === labels.length - 1)
+ if (i === labels.length - 1) {
prims.push(this.drawLine(axis === 0 ? r.xTo : r.xFrom, axis === 0 ? r.yFrom : r.yTo, axis === 0 ? 0 : r.xTo - r.xFrom, axis === 0 ? r.yTo - r.yFrom : 0));
+ }
return prims;
}, [] as JSX.Element[])}
- </svg>
+ </svg>;
}
drawLine(xFrom: number, yFrom: number, width: number, height: number) {
@@ -89,9 +93,9 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
}
let trans2Xpercent = `${(xFrom + width) / this.renderDimension * 100}%`;
let trans2Ypercent = `${(yFrom + height) / this.renderDimension * 100}%`;
- let trans1Xpercent = `${xFrom / this.renderDimension * 100}%`
- let trans1Ypercent = `${yFrom / this.renderDimension * 100}%`
- return <line className="histogramboxprimitives-line" key={DashUtils.GenerateGuid()} x1={trans1Xpercent} x2={`${trans2Xpercent}`} y1={trans1Ypercent} y2={`${trans2Ypercent}`} />
+ let trans1Xpercent = `${xFrom / this.renderDimension * 100}%`;
+ let trans1Ypercent = `${yFrom / this.renderDimension * 100}%`;
+ return <line className="histogramboxprimitives-line" key={DashUtils.GenerateGuid()} x1={trans1Xpercent} x2={`${trans2Xpercent}`} y1={trans1Ypercent} y2={`${trans2Ypercent}`} />;
}
drawRect(r: PIXIRectangle, barAxis: number, color: number | undefined, classExt: string, tapHandler: () => void = () => { }) {
if (r.height < 0) {
@@ -102,11 +106,11 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
r.x += r.width;
r.width = -r.width;
}
- let transXpercent = `${r.x / this.renderDimension * 100}%`
- let transYpercent = `${r.y / this.renderDimension * 100}%`
+ let transXpercent = `${r.x / this.renderDimension * 100}%`;
+ let transYpercent = `${r.y / this.renderDimension * 100}%`;
let widthXpercent = `${r.width / this.renderDimension * 100}%`;
let heightYpercent = `${r.height / this.renderDimension * 100}%`;
- return (<rect className={`histogramboxprimitives-${classExt}`} key={DashUtils.GenerateGuid()} onPointerDown={(e: React.PointerEvent) => { if (e.button === 0) tapHandler() }}
+ return (<rect className={`histogramboxprimitives-${classExt}`} key={DashUtils.GenerateGuid()} onPointerDown={(e: React.PointerEvent) => { if (e.button === 0) tapHandler(); }}
x={transXpercent} width={`${widthXpercent}`} y={transYpercent} height={`${heightYpercent}`} fill={color ? `${LABColor.RGBtoHexString(color)}` : "transparent"} />);
}
render() {
@@ -118,6 +122,6 @@ export class HistogramBoxPrimitives extends React.Component<HistogramPrimitivesP
{this.barPrimitives}
{this.selectedPrimitives}
</svg>
- </div>
+ </div>;
}
} \ No newline at end of file
diff --git a/src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx b/src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx
index dd62e9146..5785fe838 100644
--- a/src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx
+++ b/src/client/northstar/dash-nodes/HistogramLabelPrimitives.tsx
@@ -1,4 +1,4 @@
-import React = require("react")
+import React = require("react");
import { action, computed, reaction } from "mobx";
import { observer } from "mobx-react";
import { Utils as DashUtils } from '../../../Utils';
@@ -13,7 +13,7 @@ import { HistogramPrimitivesProps } from "./HistogramBoxPrimitives";
export class HistogramLabelPrimitives extends React.Component<HistogramPrimitivesProps> {
componentDidMount() {
reaction(() => [this.props.HistoBox.PanelWidth, this.props.HistoBox.SizeConverter.LeftOffset, this.props.HistoBox.VisualBinRanges.length],
- (fields) => HistogramLabelPrimitives.computeLabelAngle(fields[0] as number, fields[1] as number, this.props.HistoBox), { fireImmediately: true });
+ (fields) => HistogramLabelPrimitives.computeLabelAngle(fields[0], fields[1], this.props.HistoBox), { fireImmediately: true });
}
@action
@@ -32,8 +32,9 @@ export class HistogramLabelPrimitives extends React.Component<HistogramPrimitive
private renderGridLinesAndLabels(axis: number) {
let sc = this.props.HistoBox.SizeConverter;
let vb = this.props.HistoBox.VisualBinRanges;
- if (!vb.length || !sc.Initialized)
+ if (!vb.length || !sc.Initialized) {
return (null);
+ }
let dim = (axis === 0 ? this.props.HistoBox.PanelWidth : this.props.HistoBox.PanelHeight) / ((axis === 0 && vb[axis] instanceof NominalVisualBinRange) ?
(12 + 5) : // (<number>FontStyles.AxisLabel.fontSize + 5)));
sc.MaxLabelSizes[axis].coords[axis] + 5);
@@ -52,8 +53,8 @@ export class HistogramLabelPrimitives extends React.Component<HistogramPrimitive
xStart += Math.max(textWidth / 2, (1 - textWidth / space) * textWidth / 2) - textHeight / 2;
}
- let xPercent = axis === 1 ? `${xStart}px` : `${xStart / sc.RenderDimension * 100}%`
- let yPercent = axis === 0 ? `${this.props.HistoBox.PanelHeight - sc.BottomOffset - textHeight}px` : `${yStart / sc.RenderDimension * 100}%`
+ let xPercent = axis === 1 ? `${xStart}px` : `${xStart / sc.RenderDimension * 100}%`;
+ let yPercent = axis === 0 ? `${this.props.HistoBox.PanelHeight - sc.BottomOffset - textHeight}px` : `${yStart / sc.RenderDimension * 100}%`;
prims.push(
<div className="histogramLabelPrimitives-placer" key={DashUtils.GenerateGuid()} style={{ transform: `translate(${xPercent}, ${yPercent})` }}>
@@ -61,7 +62,7 @@ export class HistogramLabelPrimitives extends React.Component<HistogramPrimitive
{label}
</div>
</div>
- )
+ );
}
return prims;
}, [] as JSX.Element[]);
@@ -73,7 +74,7 @@ export class HistogramLabelPrimitives extends React.Component<HistogramPrimitive
return <div className="histogramLabelPrimitives-container">
{xaxislines}
{yaxislines}
- </div>
+ </div>;
}
} \ No newline at end of file
diff --git a/src/client/northstar/manager/Gateway.ts b/src/client/northstar/manager/Gateway.ts
index ba6fe2ad5..1c8d3fd73 100644
--- a/src/client/northstar/manager/Gateway.ts
+++ b/src/client/northstar/manager/Gateway.ts
@@ -1,4 +1,4 @@
-import { Catalog, OperationReference, Result, CompileResults } from "../model/idea/idea"
+import { Catalog, OperationReference, Result, CompileResults } from "../model/idea/idea";
import { computed, observable, action } from "mobx";
export class Gateway {
diff --git a/src/client/northstar/model/ModelExtensions.ts b/src/client/northstar/model/ModelExtensions.ts
index e4bf77ed8..29f80d2d1 100644
--- a/src/client/northstar/model/ModelExtensions.ts
+++ b/src/client/northstar/model/ModelExtensions.ts
@@ -1,7 +1,7 @@
-import { AttributeParameters, Brush, MarginAggregateParameters, SingleDimensionAggregateParameters, Solution } from '../model/idea/idea'
-import { Utils } from '../utils/Utils'
+import { AttributeParameters, Brush, MarginAggregateParameters, SingleDimensionAggregateParameters, Solution } from '../model/idea/idea';
+import { Utils } from '../utils/Utils';
-import { FilterModel } from '../core/filter/FilterModel'
+import { FilterModel } from '../core/filter/FilterModel';
(SingleDimensionAggregateParameters as any).prototype.Equals = function (other: Object) {
if (!Utils.EqualityHelper(this, other)) return false;
@@ -9,13 +9,13 @@ import { FilterModel } from '../core/filter/FilterModel'
(other as SingleDimensionAggregateParameters).attributeParameters!)) return false;
if (!((this as SingleDimensionAggregateParameters).attributeParameters! as any).Equals((other as SingleDimensionAggregateParameters).attributeParameters)) return false;
return true;
-}
+};
{
(AttributeParameters as any).prototype.Equals = function (other: AttributeParameters) {
- return (<any>this).constructor.name === (<any>other).constructor.name &&
+ return (this).constructor.name === (<any>other).constructor.name &&
this.rawName === other.rawName;
- }
+ };
}
{
@@ -23,7 +23,7 @@ import { FilterModel } from '../core/filter/FilterModel'
if (!Utils.EqualityHelper(this, other)) return false;
if ((this as Solution).solutionId !== (other as Solution).solutionId) return false;
return true;
- }
+ };
}
{
@@ -35,7 +35,7 @@ import { FilterModel } from '../core/filter/FilterModel'
if ((this as MarginAggregateParameters).aggregateFunction !== (other as MarginAggregateParameters).aggregateFunction) return false;
return true;
- }
+ };
}
{
@@ -44,5 +44,5 @@ import { FilterModel } from '../core/filter/FilterModel'
if ((this as Brush).brushEnum !== (other as Brush).brushEnum) return false;
if ((this as Brush).brushIndex !== (other as Brush).brushIndex) return false;
return true;
- }
+ };
} \ No newline at end of file
diff --git a/src/client/northstar/model/ModelHelpers.ts b/src/client/northstar/model/ModelHelpers.ts
index 1a58e6180..ac807b41f 100644
--- a/src/client/northstar/model/ModelHelpers.ts
+++ b/src/client/northstar/model/ModelHelpers.ts
@@ -64,7 +64,7 @@ export class ModelHelpers {
if (aggParams) {
aggregateParameters.push(aggParams);
- var margin = new MarginAggregateParameters()
+ var margin = new MarginAggregateParameters();
margin.aggregateFunction = agg.AggregateFunction;
margin.attributeParameters = ModelHelpers.GetAttributeParameters(agg.AttributeModel);
margin.distinctAttributeParameters = distinctAttributeParameters;
@@ -106,7 +106,7 @@ export class ModelHelpers {
{
rawName: am.CodeName,
visualizationHints: am.VisualizationHints,
- id: (am as BackendAttributeModel).Id
+ id: (am).Id
});
}
else if (am instanceof CodeAttributeModel) {
@@ -114,11 +114,11 @@ export class ModelHelpers {
{
rawName: am.CodeName,
visualizationHints: am.VisualizationHints,
- code: (am as CodeAttributeModel).Code
+ code: (am).Code
});
}
else {
- throw new Exception()
+ throw new Exception();
}
}
diff --git a/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts b/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
index 995bf4e0b..120b034f2 100644
--- a/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/AlphabeticVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { AlphabeticBinRange, BinLabel } from '../../model/idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { AlphabeticBinRange, BinLabel } from '../../model/idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class AlphabeticVisualBinRange extends VisualBinRange {
public DataBinRange: AlphabeticBinRange;
diff --git a/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts b/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
index f5872aa4c..776e643cd 100644
--- a/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/DateTimeVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { DateTimeBinRange, DateTimeStep, DateTimeStepGranularity } from '../idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { DateTimeBinRange, DateTimeStep, DateTimeStepGranularity } from '../idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class DateTimeVisualBinRange extends VisualBinRange {
public DataBinRange: DateTimeBinRange;
diff --git a/src/client/northstar/model/binRanges/NominalVisualBinRange.ts b/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
index 407ff3ea6..42509d797 100644
--- a/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/NominalVisualBinRange.ts
@@ -1,5 +1,5 @@
-import { NominalBinRange, BinLabel } from '../../model/idea/idea'
-import { VisualBinRange } from './VisualBinRange'
+import { NominalBinRange, BinLabel } from '../../model/idea/idea';
+import { VisualBinRange } from './VisualBinRange';
export class NominalVisualBinRange extends VisualBinRange {
public DataBinRange: NominalBinRange;
diff --git a/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts b/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
index 80886416b..c579c8e5f 100644
--- a/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/QuantitativeVisualBinRange.ts
@@ -1,4 +1,4 @@
-import { QuantitativeBinRange } from '../idea/idea'
+import { QuantitativeBinRange } from '../idea/idea';
import { VisualBinRange } from './VisualBinRange';
import { format } from "d3-format";
diff --git a/src/client/northstar/model/binRanges/VisualBinRange.ts b/src/client/northstar/model/binRanges/VisualBinRange.ts
index a0766e494..449a22e91 100644
--- a/src/client/northstar/model/binRanges/VisualBinRange.ts
+++ b/src/client/northstar/model/binRanges/VisualBinRange.ts
@@ -1,4 +1,4 @@
-import { BinLabel } from '../../model/idea/idea'
+import { BinLabel } from '../../model/idea/idea';
export abstract class VisualBinRange {
diff --git a/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts b/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
index 63ee61909..9671e55f8 100644
--- a/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
+++ b/src/client/northstar/model/binRanges/VisualBinRangeHelper.ts
@@ -16,18 +16,18 @@ export class VisualBinRangeHelper {
public static GetNonAggregateVisualBinRange(dataBinRange: BinRange): VisualBinRange {
if (dataBinRange instanceof NominalBinRange) {
- return new NominalVisualBinRange(dataBinRange as NominalBinRange);
+ return new NominalVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof QuantitativeBinRange) {
- return new QuantitativeVisualBinRange(dataBinRange as QuantitativeBinRange);
+ return new QuantitativeVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof AlphabeticBinRange) {
- return new AlphabeticVisualBinRange(dataBinRange as AlphabeticBinRange);
+ return new AlphabeticVisualBinRange(dataBinRange);
}
else if (dataBinRange instanceof DateTimeBinRange) {
- return new DateTimeVisualBinRange(dataBinRange as DateTimeBinRange);
+ return new DateTimeVisualBinRange(dataBinRange);
}
- throw new Exception()
+ throw new Exception();
}
public static GetVisualBinRange(distinctAttributeParameters: AttributeParameters | undefined, dataBinRange: BinRange, histoResult: HistogramResult, attr: AttributeTransformationModel, chartType: ChartType): VisualBinRange {
@@ -51,13 +51,13 @@ export class VisualBinRangeHelper {
}
}
}
- };
+ }
let visualBinRange = QuantitativeVisualBinRange.Initialize(minValue, maxValue, 10, false);
if (chartType === ChartType.HorizontalBar || chartType === ChartType.VerticalBar) {
visualBinRange = QuantitativeVisualBinRange.Initialize(Math.min(0, minValue),
- Math.max(0, (visualBinRange as QuantitativeVisualBinRange).DataBinRange.maxValue!),
+ Math.max(0, (visualBinRange).DataBinRange.maxValue!),
SETTINGS_X_BINS, false);
}
else if (chartType === ChartType.SinglePoint) {
diff --git a/src/client/northstar/operations/BaseOperation.ts b/src/client/northstar/operations/BaseOperation.ts
index a14337763..c6d5f0a15 100644
--- a/src/client/northstar/operations/BaseOperation.ts
+++ b/src/client/northstar/operations/BaseOperation.ts
@@ -1,4 +1,4 @@
-import { FilterModel } from '../core/filter/FilterModel'
+import { FilterModel } from '../core/filter/FilterModel';
import { ErrorResult, Exception, OperationParameters, OperationReference, Result, ResultParameters } from '../model/idea/idea';
import { action, computed, observable } from "mobx";
import { Gateway } from '../manager/Gateway';
@@ -62,8 +62,9 @@ export abstract class BaseOperation {
}
let operationParameters = this.CreateOperationParameters();
- if (this.Result)
- this.Result.progress = 0; // bcz: used to set Result to undefined, but that causes the display to blink
+ if (this.Result) {
+ this.Result.progress = 0;
+ } // bcz: used to set Result to undefined, but that causes the display to blink
this.Error = "";
let salt = Math.random().toString();
this.RequestSalt = salt;
@@ -97,7 +98,7 @@ export abstract class BaseOperation {
pollPromise.Start(async () => {
let result = await Gateway.Instance.GetResult(resultParameters.toJSON());
if (result instanceof ErrorResult) {
- throw new Error((result as ErrorResult).message);
+ throw new Error((result).message);
}
if (this.RequestSalt === pollPromise.RequestSalt) {
if (result && (!this.Result || this.Result.progress !== result.progress)) {
diff --git a/src/client/northstar/operations/HistogramOperation.ts b/src/client/northstar/operations/HistogramOperation.ts
index a3ddc1c98..760106023 100644
--- a/src/client/northstar/operations/HistogramOperation.ts
+++ b/src/client/northstar/operations/HistogramOperation.ts
@@ -62,7 +62,7 @@ export class HistogramOperation extends BaseOperation implements IBaseFilterCons
@computed
public get FilterString(): string {
let filterModels: FilterModel[] = [];
- return FilterModel.GetFilterModelsRecursive(this, new Set<IBaseFilterProvider>(), filterModels, true)
+ return FilterModel.GetFilterModelsRecursive(this, new Set<IBaseFilterProvider>(), filterModels, true);
}
@computed
diff --git a/src/client/northstar/utils/ArrayUtil.ts b/src/client/northstar/utils/ArrayUtil.ts
index a52ca6d96..12b8d8e77 100644
--- a/src/client/northstar/utils/ArrayUtil.ts
+++ b/src/client/northstar/utils/ArrayUtil.ts
@@ -50,7 +50,7 @@ export class ArrayUtil {
if (filtered.length > 0) {
return filtered[0];
}
- throw new Exception()
+ throw new Exception();
}
public static FirstOrDefault<T>(arr: T[], predicate: (x: any) => boolean): T | undefined {
diff --git a/src/client/northstar/utils/Extensions.ts b/src/client/northstar/utils/Extensions.ts
index 7c2b7fc9d..df14d4da0 100644
--- a/src/client/northstar/utils/Extensions.ts
+++ b/src/client/northstar/utils/Extensions.ts
@@ -6,7 +6,7 @@ interface String {
String.prototype.ReplaceAll = function (toReplace: string, replacement: string): string {
var target = this;
return target.split(toReplace).join(replacement);
-}
+};
String.prototype.Truncate = function (length: number, replacement: string): String {
var target = this;
@@ -14,7 +14,7 @@ String.prototype.Truncate = function (length: number, replacement: string): Stri
target = target.slice(0, Math.max(0, length - replacement.length)) + replacement;
}
return target;
-}
+};
interface Math {
log10(val: number): number;
@@ -22,7 +22,7 @@ interface Math {
Math.log10 = function (val: number): number {
return Math.log(val) / Math.LN10;
-}
+};
declare interface ObjectConstructor {
assign(...objects: Object[]): Object;
diff --git a/src/client/northstar/utils/GeometryUtil.ts b/src/client/northstar/utils/GeometryUtil.ts
index 6d8acea20..d5220c479 100644
--- a/src/client/northstar/utils/GeometryUtil.ts
+++ b/src/client/northstar/utils/GeometryUtil.ts
@@ -8,15 +8,19 @@ export class GeometryUtil {
let minY: number = Number.MAX_VALUE;
let maxX: number = Number.MIN_VALUE;
let maxY: number = Number.MIN_VALUE;
- for (var i = 0; i < points.length; i++) {
- if (points[i].x < minX)
- minX = points[i].x;
- if (points[i].y < minY)
- minY = points[i].y;
- if (points[i].x > maxX)
- maxX = points[i].x;
- if (points[i].y > maxY)
- maxY = points[i].y;
+ for (const point of points) {
+ if (point.x < minX) {
+ minX = point.x;
+ }
+ if (point.y < minY) {
+ minY = point.y;
+ }
+ if (point.x > maxX) {
+ maxX = point.x;
+ }
+ if (point.y > maxY) {
+ maxY = point.y;
+ }
}
return new PIXIRectangle(minX * scale - padding, minY * scale - padding, (maxX - minX) * scale + padding * 2, (maxY - minY) * scale + padding * 2);
}
@@ -35,7 +39,7 @@ export class GeometryUtil {
nx = (cos * (x - cx)) + (sin * (y - cy)) + cx,
ny = (cos * (y - cy)) - (sin * (x - cx)) + cy;
return new PIXIPoint(nx, ny);
- }
+ };
return points.map(p => rotate(center.x, center.y, p.x, p.y, angle));
}
@@ -54,9 +58,9 @@ export class GeometryUtil {
return [];
}
- for (let v = 0; v < points.length; v++) {
- x = points[v].x;
- y = points[v].y;
+ for (const point of points) {
+ x = point.x;
+ y = point.y;
sum_x += x;
sum_y += y;
sum_xx += x * x;
@@ -68,8 +72,8 @@ export class GeometryUtil {
let b = (sum_y / count) - (m * sum_x) / count;
let result: PIXIPoint[] = new Array<PIXIPoint>();
- for (let v = 0; v < points.length; v++) {
- x = points[v].x;
+ for (const point of points) {
+ x = point.x;
y = x * m + b;
result.push(new PIXIPoint(x, y));
}
diff --git a/src/client/northstar/utils/MathUtil.ts b/src/client/northstar/utils/MathUtil.ts
index 7aa255096..4b44f40c3 100644
--- a/src/client/northstar/utils/MathUtil.ts
+++ b/src/client/northstar/utils/MathUtil.ts
@@ -16,11 +16,11 @@ export class PIXIRectangle {
public x: number;
public y: number;
public width: number;
- public height: number
- public get left() { return this.x }
+ public height: number;
+ public get left() { return this.x; }
public get right() { return this.x + this.width; }
- public get top() { return this.y }
- public get bottom() { return this.top + this.height }
+ public get top() { return this.y; }
+ public get bottom() { return this.top + this.height; }
public static get EMPTY() { return new PIXIRectangle(0, 0, -1, -1); }
constructor(x: number, y: number, width: number, height: number) {
this.x = x;
@@ -127,14 +127,18 @@ export class MathUtil {
}
public static PointInPIXIRectangle(p: PIXIPoint, rect: PIXIRectangle): boolean {
- if (p.x < rect.left - this.EPSILON)
+ if (p.x < rect.left - this.EPSILON) {
return false;
- if (p.x > rect.right + this.EPSILON)
+ }
+ if (p.x > rect.right + this.EPSILON) {
return false;
- if (p.y < rect.top - this.EPSILON)
+ }
+ if (p.y < rect.top - this.EPSILON) {
return false;
- if (p.y > rect.bottom + this.EPSILON)
+ }
+ if (p.y > rect.bottom + this.EPSILON) {
return false;
+ }
return true;
}
@@ -145,23 +149,27 @@ export class MathUtil {
var r3 = new PIXIPoint(rect.right, rect.bottom);
var r4 = new PIXIPoint(rect.left, rect.bottom);
var ret = new Array<PIXIPoint>();
- var dist = this.Dist(lineFrom, lineTo)
+ var dist = this.Dist(lineFrom, lineTo);
var inter = this.LineSegmentIntersection(lineFrom, lineTo, r1, r2);
if (inter && this.PointInPIXIRectangle(inter, rect) &&
- this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist)
+ this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist) {
ret.push(inter);
+ }
inter = this.LineSegmentIntersection(lineFrom, lineTo, r2, r3);
if (inter && this.PointInPIXIRectangle(inter, rect) &&
- this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist)
+ this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist) {
ret.push(inter);
+ }
inter = this.LineSegmentIntersection(lineFrom, lineTo, r3, r4);
if (inter && this.PointInPIXIRectangle(inter, rect) &&
- this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist)
+ this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist) {
ret.push(inter);
+ }
inter = this.LineSegmentIntersection(lineFrom, lineTo, r4, r1);
if (inter && this.PointInPIXIRectangle(inter, rect) &&
- this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist)
+ this.Dist(inter, lineFrom) < dist && this.Dist(inter, lineTo) < dist) {
ret.push(inter);
+ }
return ret;
}
@@ -178,7 +186,7 @@ export class MathUtil {
}
public static Dot(p1: PIXIPoint, p2: PIXIPoint): number {
- return p1.x * p2.x + p1.y * p2.y
+ return p1.x * p2.x + p1.y * p2.y;
}
public static Normalize(p1: PIXIPoint) {
@@ -193,7 +201,7 @@ export class MathUtil {
public static DistSquared(p1: PIXIPoint, p2: PIXIPoint): number {
const a = p1.x - p2.x;
const b = p1.y - p2.y;
- return (a * a + b * b)
+ return (a * a + b * b);
}
public static RectIntersectsRect(r1: PIXIRectangle, r2: PIXIRectangle): boolean {
diff --git a/src/client/northstar/utils/SizeConverter.ts b/src/client/northstar/utils/SizeConverter.ts
index b5c4a16ab..a52890ed9 100644
--- a/src/client/northstar/utils/SizeConverter.ts
+++ b/src/client/northstar/utils/SizeConverter.ts
@@ -32,8 +32,8 @@ export class SizeConverter {
this.Initialized++;
var xLabels = visualBinRanges[0].GetLabels();
var yLabels = visualBinRanges[1].GetLabels();
- var xLabelStrings = xLabels.map(l => l.label!).sort(function (a, b) { return b.length - a.length });
- var yLabelStrings = yLabels.map(l => l.label!).sort(function (a, b) { return b.length - a.length });
+ var xLabelStrings = xLabels.map(l => l.label!).sort(function (a, b) { return b.length - a.length; });
+ var yLabelStrings = yLabels.map(l => l.label!).sort(function (a, b) { return b.length - a.length; });
var metricsX = { width: 75 }; // RenderUtils.MeasureText(FontStyles.Default.fontFamily.toString(), 12, // FontStyles.AxisLabel.fontSize as number,
//xLabelStrings[0]!.slice(0, 20)) // StyleConstants.MAX_CHAR_FOR_HISTOGRAM_LABELS));
@@ -62,19 +62,20 @@ export class SizeConverter {
public DataToScreenPointRange(axis: number, bin: Bin, aggregateKey: AggregateKey) {
var value = ModelHelpers.GetAggregateResult(bin, aggregateKey) as DoubleValueAggregateResult;
- if (value && value.hasResult)
+ if (value && value.hasResult) {
return [this.DataToScreenCoord(value.result!, axis) - 5,
this.DataToScreenCoord(value.result!, axis) + 5];
+ }
return [undefined, undefined];
}
public DataToScreenXAxisRange(visualBinRanges: VisualBinRange[], index: number, bin: Bin) {
var value = visualBinRanges[0].GetValueFromIndex(bin.binIndex!.indices![index]);
- return [this.DataToScreenX(value), this.DataToScreenX(visualBinRanges[index].AddStep(value))]
+ return [this.DataToScreenX(value), this.DataToScreenX(visualBinRanges[index].AddStep(value))];
}
public DataToScreenYAxisRange(visualBinRanges: VisualBinRange[], index: number, bin: Bin) {
var value = visualBinRanges[1].GetValueFromIndex(bin.binIndex!.indices![index]);
- return [this.DataToScreenY(value), this.DataToScreenY(visualBinRanges[index].AddStep(value))]
+ return [this.DataToScreenY(value), this.DataToScreenY(visualBinRanges[index].AddStep(value))];
}
public DataToScreenX(x: number): number {
@@ -85,8 +86,9 @@ export class SizeConverter {
return flip ? (this.RenderDimension) - retY : retY;
}
public DataToScreenCoord(v: number, axis: number) {
- if (axis === 0)
+ if (axis === 0) {
return this.DataToScreenX(v);
+ }
return this.DataToScreenY(v);
}
public DataToScreenRange(minVal: number, maxVal: number, axis: number) {
@@ -94,6 +96,6 @@ export class SizeConverter {
let xTo = this.DataToScreenX(axis === 0 ? maxVal : this.DataMaxs[0]);
let yFrom = this.DataToScreenY(axis === 1 ? minVal : this.DataMins[1]);
let yTo = this.DataToScreenY(axis === 1 ? maxVal : this.DataMaxs[1]);
- return { xFrom, yFrom, xTo, yTo }
+ return { xFrom, yFrom, xTo, yTo };
}
} \ No newline at end of file
diff --git a/src/client/northstar/utils/StyleContants.ts b/src/client/northstar/utils/StyleContants.ts
index ac8617e3b..e9b6e0297 100644
--- a/src/client/northstar/utils/StyleContants.ts
+++ b/src/client/northstar/utils/StyleContants.ts
@@ -11,7 +11,7 @@ export class StyleConstants {
static OPERATOR_MENU_LARGE: number = 35;
static OPERATOR_MENU_SMALL: number = 25;
- static BRUSH_PALETTE: number[] = [0x42b43c, 0xfa217f, 0x6a9c75, 0xfb5de7, 0x25b8ea, 0x9b5bc4, 0xda9f63, 0xe23209, 0xfb899b, 0x94a6fd]
+ static BRUSH_PALETTE: number[] = [0x42b43c, 0xfa217f, 0x6a9c75, 0xfb5de7, 0x25b8ea, 0x9b5bc4, 0xda9f63, 0xe23209, 0xfb899b, 0x94a6fd];
static GAP: number = 3;
static BACKGROUND_COLOR: number = 0xF3F3F3;
diff --git a/src/client/northstar/utils/Utils.ts b/src/client/northstar/utils/Utils.ts
index c96b4cbd9..d071dec62 100644
--- a/src/client/northstar/utils/Utils.ts
+++ b/src/client/northstar/utils/Utils.ts
@@ -1,7 +1,7 @@
-import { IBaseBrushable } from '../core/brusher/IBaseBrushable'
-import { IBaseFilterConsumer } from '../core/filter/IBaseFilterConsumer'
-import { IBaseFilterProvider } from '../core/filter/IBaseFilterProvider'
-import { AggregateFunction } from '../model/idea/idea'
+import { IBaseBrushable } from '../core/brusher/IBaseBrushable';
+import { IBaseFilterConsumer } from '../core/filter/IBaseFilterConsumer';
+import { IBaseFilterProvider } from '../core/filter/IBaseFilterProvider';
+import { AggregateFunction } from '../model/idea/idea';
export class Utils {