| import { GLModel } from "@/UI/Panels/Viewer/GLModelType"; |
| import { EasyParserParent } from "./EasyParserParent"; |
| import { EasyParserGLModel } from "./EasyParserGLModel"; |
| import { EasyParserPDB } from "./EasyParserPDB"; |
| import { IFileInfo } from "@/FileSystem/Types"; |
| import { FileInfo } from "@/FileSystem/FileInfo"; |
| import { getFormatInfoGivenType } from "../../Types/MolFormats"; |
| import { IAtom } from "@/UI/Navigation/TreeView/TreeInterfaces"; |
| import { EasyParserIAtomList } from "./EasyParserIAtomList"; |
| import { EasyParserMol2 } from "./EasyParserMol2"; |
| import { EasyParserSDF } from "./EasyParserSDF"; |
|
|
| |
| |
| |
| |
| |
| |
| export function makeEasyParser( |
| src: IFileInfo | GLModel | IAtom[] | undefined |
| ): EasyParserParent { |
| |
| if (src === undefined) { |
| return new EasyParserIAtomList([]); |
| } |
|
|
| |
| if (Array.isArray(src)) { |
| return new EasyParserIAtomList(src); |
| } |
|
|
| if ((src as GLModel).selectedAtoms !== undefined) { |
| return new EasyParserGLModel(src); |
| } |
|
|
| |
| const typ = new FileInfo(src as IFileInfo).getFileType(); |
|
|
| const formatInfo = getFormatInfoGivenType(typ as string); |
|
|
| if (formatInfo?.primaryExt === "pdb") { |
| return new EasyParserPDB(src as IFileInfo); |
| } |
| if (formatInfo?.primaryExt === "sdf" || formatInfo?.primaryExt === "mol") { |
| return new EasyParserSDF(src as IFileInfo); |
| } |
| if (formatInfo?.primaryExt === "mol2") { |
| return new EasyParserMol2(src as IFileInfo); |
| } |
|
|
| |
| |
| return new EasyParserIAtomList([]); |
|
|
|
|
| |
| |
| |
| |
| |
| |
| } |
|
|