Skip to content
Snippets Groups Projects
Select Git revision
  • 66b9f6104c1104255a527f6af92e8c80b319f1ac
  • master default protected
  • rednatco-v2
  • base-pairs-ladder
  • rednatco
  • test
  • ntc-tube-uniform-color
  • ntc-tube-missing-atoms
  • restore-vertex-array-per-program
  • watlas2
  • dnatco_new
  • cleanup-old-nodejs
  • webmmb
  • fix_auth_seq_id
  • update_deps
  • ext_dev
  • ntc_balls
  • nci-2
  • plugin
  • bugfix-0.4.5
  • nci
  • v0.5.0-dev.1
  • v0.4.5
  • v0.4.4
  • v0.4.3
  • v0.4.2
  • v0.4.1
  • v0.4.0
  • v0.3.12
  • v0.3.11
  • v0.3.10
  • v0.3.9
  • v0.3.8
  • v0.3.7
  • v0.3.6
  • v0.3.5
  • v0.3.4
  • v0.3.3
  • v0.3.2
  • v0.3.1
  • v0.3.0
41 results

intra-unit-link-cylinder.ts

Blame
  • data-model.ts 2.47 KiB
    /**
     * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
     *
     * Taken/adapted from DensityServer (https://github.com/dsehnal/DensityServer)
     *
     * @author David Sehnal <david.sehnal@gmail.com>
     */
    
    import * as DataFormat from '../../common/data-format'
    import * as Coords from '../algebra/coordinate'
    import * as Box from '../algebra/box'
    import Writer from 'mol-io/writer/writer'
    import { SpacegroupCell } from 'mol-math/geometry';
    import { FileHandle } from 'mol-io/common/file-handle';
    import { TypedArrayValueArray } from 'mol-io/common/typed-array';
    
    //////////////////////////////////////
    // DATA
    //////////////////////////////////////
    
    export interface Sampling {
        index: number,
        rate: number,
        byteOffset: number,
        dataDomain: Coords.GridDomain<'Data'>,
        blockDomain: Coords.GridDomain<'Block'>
    }
    
    export interface DataContext {
        file: FileHandle,
        header: DataFormat.Header,
        spacegroup: SpacegroupCell,
        dataBox: Box.Fractional,
        sampling: Sampling[]
    }
    
    export interface BlockData {
        sampleCount: number[],
        values: TypedArrayValueArray
    }
    
    //////////////////////////////////////
    // QUERY
    //////////////////////////////////////
    
    export type QueryOutputStream = Writer & { end: () => void }
    
    export namespace QueryParamsBox {
        export type Cartesian = { kind: 'Cartesian', a: Coords.Cartesian, b: Coords.Cartesian }
        export type Fractional = { kind: 'Fractional', a: Coords.Fractional, b: Coords.Fractional }
        export type Cell = { kind: 'Cell' }
    }
    export type QueryParamsBox = QueryParamsBox.Cartesian | QueryParamsBox.Fractional | QueryParamsBox.Cell
    
    export interface QueryParams {
        sourceFilename: string,
        sourceId: string,
        asBinary: boolean,
        box: QueryParamsBox,
        detail: number,
        forcedSamplingLevel?: number
    }
    
    export type QueryBlock = { coord: Coords.Grid<'Block'>, offsets: Coords.Fractional[] }
    
    export interface QuerySamplingInfo {
        sampling: Sampling,
        fractionalBox: Box.Fractional,
        gridDomain: Coords.GridDomain<'Query'>,
        blocks: QueryBlock[]
    }
    
    export type QueryContext = QueryContext.Error | QueryContext.Empty | QueryContext.Data
    
    export namespace QueryContext {
        type Base = { guid: string, params: QueryParams }
        export type Error = { kind: 'Error', message: string } & Base
        export type Empty = { kind: 'Empty', data: DataContext } & Base
        export type Data = { kind: 'Data', data: DataContext, samplingInfo: QuerySamplingInfo, values: TypedArrayValueArray[] } & Base
    }