本文整理汇总了TypeScript中neuroglancer/util/json.verifyObjectProperty函数的典型用法代码示例。如果您正苦于以下问题:TypeScript verifyObjectProperty函数的具体用法?TypeScript verifyObjectProperty怎么用?TypeScript verifyObjectProperty使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verifyObjectProperty函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: parseStackInfo
function parseStackInfo(obj: any): StackInfo|undefined {
verifyObject(obj);
let state = verifyObjectProperty(obj, 'state', verifyString);
let channels: string[] = [];
let lowerVoxelBound: vec3 = vec3.create();
let upperVoxelBound: vec3 = vec3.create();
if (VALID_STACK_STATES.has(state)) {
let stackStatsObj = verifyObjectProperty(obj, 'stats', verifyObject);
lowerVoxelBound = parseLowerVoxelBounds(stackStatsObj);
upperVoxelBound = parseUpperVoxelBounds(stackStatsObj);
if (stackStatsObj.hasOwnProperty('channelNames')) {
channels = parseChannelNames(stackStatsObj);
}
} else if (PARTIAL_STACK_STATES.has(state)) {
// Stacks in LOADING state will not have a 'stats' object.
// Values will be populated from command arguments in MultiscaleVolumeChunkSource()
} else {
return undefined;
}
let voxelResolution: vec3 = verifyObjectProperty(obj, 'currentVersion', parseStackVersionInfo);
let project: string = verifyObjectProperty(obj, 'stackId', parseStackProject);
return {lowerVoxelBound, upperVoxelBound, voxelResolution, project, channels};
}
示例2: parseTokenInfo
function parseTokenInfo(obj: any): TokenInfo {
verifyObject(obj);
return {
channels: verifyObjectProperty(obj, 'channels', x => verifyObjectAsMap(x, parseChannelInfo)),
scales: verifyObjectProperty(obj, 'dataset', parseScales),
};
}
示例3: parseVertexAttributeInfo
function parseVertexAttributeInfo(x: any): VertexAttributeInfo {
verifyObject(x);
return {
dataType: verifyObjectProperty(x, 'dataType', y => verifyEnumString(y, DataType)),
numComponents: verifyObjectProperty(x, 'numComponents', verifyPositiveInt),
};
}
示例4: parseOwnerInfo
function parseOwnerInfo(obj: any): OwnerInfo {
let stackObjs = parseArray(obj, verifyObject);
if (stackObjs.length < 1) {
throw new Error(`No stacks found for owner object.`);
}
let projects = new Map<string, ProjectInfo>();
// Get the owner from the first stack
let owner = verifyObjectProperty(stackObjs[0], 'stackId', parseStackOwner);
for (let stackObj of stackObjs) {
let stackName = verifyObjectProperty(stackObj, 'stackId', parseStackName);
let stackInfo = parseStackInfo(stackObj);
if (stackInfo !== undefined) {
let projectName = stackInfo.project;
let projectInfo = projects.get(projectName);
if (projectInfo === undefined) {
let stacks = new Map<string, StackInfo>();
projects.set(projectName, {stacks});
projectInfo = projects.get(projectName);
}
projectInfo!.stacks.set(stackName, stackInfo);
}
}
return {owner, projects};
}
示例5: constructor
constructor(public baseUrls: string[], public path: string, private obj: any) {
verifyObject(obj);
this.dataType = verifyObjectProperty(obj, 'data_type', x => verifyEnumString(x, DataType));
this.numChannels = verifyObjectProperty(obj, 'num_channels', verifyPositiveInt);
this.volumeType = verifyObjectProperty(obj, 'type', x => verifyEnumString(x, VolumeType));
this.mesh = verifyObjectProperty(obj, 'mesh', verifyOptionalString);
this.scales = verifyObjectProperty(obj, 'scales', x => parseArray(x, y => new ScaleInfo(y)));
}
示例6: parseChannelInfo
function parseChannelInfo(obj: any): ChannelInfo {
verifyObject(obj);
let channelType = verifyObjectProperty(obj, 'channel_type', verifyString);
return {
channelType,
description: verifyObjectProperty(obj, 'description', verifyString),
volumeType: getVolumeTypeFromChannelType(channelType),
dataType: verifyObjectProperty(obj, 'datatype', x => verifyEnumString(x, DataType)),
};
}
示例7: constructor
constructor(obj: any) {
verifyObject(obj);
this.dataType = verifyObjectProperty(obj, 'dataType', x => verifyEnumString(x, DataType));
this.size = verifyObjectProperty(
obj, 'dimensions', x => parseFixedLengthArray(vec3.create(), x, verifyPositiveInt));
this.chunkSize = verifyObjectProperty(
obj, 'blockSize', x => parseFixedLengthArray(vec3.create(), x, verifyPositiveInt));
this.encoding =
verifyObjectProperty(obj, 'compressionType', x => verifyEnumString(x, VolumeChunkEncoding));
}
示例8: parseScaleInfo
function parseScaleInfo(obj: any): ScaleInfo {
verifyObject(obj);
return {
key: verifyObjectProperty(obj, 'key', verifyString),
offset: verifyObjectProperty(obj, 'offset', verify3dVec),
sizeInVoxels: verifyObjectProperty(obj, 'sizeInVoxels', verify3dDimensions),
voxelSize: verifyObjectProperty(obj, 'voxelSize', verify3dScale),
chunkDataSize: verifyObjectProperty(
obj, 'chunkDataSize', x => x === undefined ? undefined : verify3dDimensions(x)),
};
}
示例9: parseLowerVoxelBounds
function parseLowerVoxelBounds(stackStatsObj: any): vec3 {
verifyObject(stackStatsObj);
let stackBounds = verifyObjectProperty(stackStatsObj, 'stackBounds', verifyObject);
let lowerVoxelBound: vec3 = vec3.create();
lowerVoxelBound[0] = verifyObjectProperty(stackBounds, 'minX', verifyInt);
lowerVoxelBound[1] = verifyObjectProperty(stackBounds, 'minY', verifyInt);
lowerVoxelBound[2] = verifyObjectProperty(stackBounds, 'minZ', verifyInt);
return lowerVoxelBound;
}
示例10: parseUpperVoxelBounds
function parseUpperVoxelBounds(stackStatsObj: any): vec3 {
verifyObject(stackStatsObj);
let stackBounds = verifyObjectProperty(stackStatsObj, 'stackBounds', verifyObject);
let upperVoxelBound: vec3 = vec3.create();
upperVoxelBound[0] = verifyObjectProperty(stackBounds, 'maxX', verifyFloat)+1;
upperVoxelBound[1] = verifyObjectProperty(stackBounds, 'maxY', verifyFloat)+1;
upperVoxelBound[2] = verifyObjectProperty(stackBounds, 'maxZ', verifyFloat)+1;
return upperVoxelBound;
}