Skip to content

gi-nx


gi-nx / evaluateFeatures

ts
function evaluateFeatures(features: (
  | RawPoint
  | RawMultiPoint
  | RawLineString
  | RawMultiLineString
  | RawPolygon
  | RawMultiPolygon)[]): Record<{
  length: number;
  [iterator]: StringIterator<string>;
  anchor: string;
  at: string;
  big: string;
  blink: string;
  bold: string;
  charAt: string;
  charCodeAt: number;
  codePointAt: number;
  concat: string;
  endsWith: boolean;
  fixed: string;
  fontcolor: string;
  fontsize: string;
  includes: boolean;
  indexOf: number;
  italics: string;
  lastIndexOf: number;
  link: string;
  localeCompare: number;
  match: RegExpMatchArray;
  matchAll: RegExpStringIterator<RegExpExecArray>;
  normalize: string;
  padEnd: string;
  padStart: string;
  repeat: string;
  replace: string;
  replaceAll: string;
  search: number;
  slice: string;
  small: string;
  split: string[];
  startsWith: boolean;
  strike: string;
  sub: string;
  substr: string;
  substring: string;
  sup: string;
  toLocaleLowerCase: string;
  toLocaleUpperCase: string;
  toLowerCase: string;
  toString: string;
  toUpperCase: string;
  trim: string;
  trimEnd: string;
  trimLeft: string;
  trimRight: string;
  trimStart: string;
  valueOf: string;
}, (
  | PreStackedPoint
  | PreStackedLineString
| PreStackedPolygon<Record<string, any>>)[]>;

Evaluates a set of raw sections against the current project state, producing pre-stacked sections keyed by feature ID.

Parameters

ParameterType
features( | RawPoint | RawMultiPoint | RawLineString | RawMultiLineString | RawPolygon | RawMultiPolygon)[]

Returns

Record<{ length: number; [iterator]: StringIterator<string>; anchor: string; at: string; big: string; blink: string; bold: string; charAt: string; charCodeAt: number; codePointAt: number; concat: string; endsWith: boolean; fixed: string; fontcolor: string; fontsize: string; includes: boolean; indexOf: number; italics: string; lastIndexOf: number; link: string; localeCompare: number; match: RegExpMatchArray; matchAll: RegExpStringIterator<RegExpExecArray>; normalize: string; padEnd: string; padStart: string; repeat: string; replace: string; replaceAll: string; search: number; slice: string; small: string; split: string[]; startsWith: boolean; strike: string; sub: string; substr: string; substring: string; sup: string; toLocaleLowerCase: string; toLocaleUpperCase: string; toLowerCase: string; toString: string; toUpperCase: string; trim: string; trimEnd: string; trimLeft: string; trimRight: string; trimStart: string; valueOf: string; }, ( | PreStackedPoint | PreStackedLineString | PreStackedPolygon<Record<string, any>>)[]>

A map from each feature's ID to its evaluated PreStackedSection array.

Example

ts
const features = [
  {
    type: 'Feature',
    geometry: {
      type: 'Polygon',
      coordinates: [
        [
          [151.29261804, -33.80972803],
          [151.29261804, -33.8099807],
          [151.29291899, -33.8099807],
          [151.29291898, -33.80972803],
          [151.29261804, -33.80972803],
        ],
      ],
    },
    properties: {
      id: 'nN8LKLcFMJDJWEQTKj1ZD',
      flow: {
        id: '055897e4d98e444388ee1a168e782cdc',
        inputs: { radius: 12 },
      },
      usage: 'Residential',
      levels: 4,
      layerId: 'default',
      stackOrder: 0,
    },
  },
];

const result = evaluateFeatures(features);
// result['nN8LKLcFMJDJWEQTKj1ZD'] -> PreStackedSection[]