|
@@ -5,7 +5,7 @@
|
|
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
|
*/
|
|
|
|
|
|
-import { ANVILMembraneOrientation } from '../../extensions/anvil/behavior';
|
|
|
+import { ANVILMembraneOrientation, MembraneOrientation3D, tryCreateMembraneOrientation } from '../../extensions/anvil/behavior';
|
|
|
import { CellPack } from '../../extensions/cellpack';
|
|
|
import { DnatcoConfalPyramids } from '../../extensions/dnatco';
|
|
|
import { G3DFormat, G3dProvider } from '../../extensions/g3d/format';
|
|
@@ -30,7 +30,7 @@ import { PluginCommands } from '../../mol-plugin/commands';
|
|
|
import { PluginConfig } from '../../mol-plugin/config';
|
|
|
import { PluginSpec } from '../../mol-plugin/spec';
|
|
|
import { PluginState } from '../../mol-plugin/state';
|
|
|
-import { StateObjectSelector } from '../../mol-state';
|
|
|
+import { StateObjectRef, StateObjectSelector } from '../../mol-state';
|
|
|
import { Asset } from '../../mol-util/assets';
|
|
|
import { Color } from '../../mol-util/color';
|
|
|
import '../../mol-util/polyfill';
|
|
@@ -152,6 +152,20 @@ export class Viewer {
|
|
|
this.plugin = createPlugin(element, spec);
|
|
|
}
|
|
|
|
|
|
+ // Csongor's version
|
|
|
+ applyMembrane() {
|
|
|
+ console.log("under investigation...");
|
|
|
+ console.log(MembraneOrientation3D.id);
|
|
|
+
|
|
|
+ const hier = this.plugin.managers.structure.hierarchy;
|
|
|
+ const stateObj: StateObjectRef<PluginStateObject.Molecule.Structure> =
|
|
|
+ hier.selection.structures[0].components[0].structure.cell;
|
|
|
+
|
|
|
+ // TODO (?): it doesn't work: ApplyAction.apply(MembraneOrientation3D.toAction());
|
|
|
+
|
|
|
+ tryCreateMembraneOrientation(this.plugin, stateObj);
|
|
|
+ }
|
|
|
+
|
|
|
setRemoteSnapshot(id: string) {
|
|
|
const url = `${this.plugin.config.get(PluginConfig.State.CurrentServer)}/get/${id}`;
|
|
|
return PluginCommands.State.Snapshots.Fetch(this.plugin, { url });
|
|
@@ -176,6 +190,16 @@ export class Viewer {
|
|
|
}));
|
|
|
}
|
|
|
|
|
|
+ // David Sehnal's version
|
|
|
+ async loadStructureWithMembraneRepresentation(url: string, format: BuiltInTrajectoryFormat, isBinary: boolean) {
|
|
|
+ const data = await this.plugin.builders.data.download({ url, isBinary }, { state: { isGhost: true } });
|
|
|
+ const trajectory = await this.plugin.builders.structure.parseTrajectory(data, format);
|
|
|
+ await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'default', { representationPreset: 'preset-membrane-orientation' as any });
|
|
|
+
|
|
|
+ // reset the camera because the membranes render 1st and the structure might not be fully visible
|
|
|
+ requestAnimationFrame(() => this.plugin.canvas3d?.requestCameraReset());
|
|
|
+ }
|
|
|
+
|
|
|
async loadAllModelsOrAssemblyFromUrl(url: string, format: BuiltInTrajectoryFormat = 'mmcif', isBinary = false, options?: LoadStructureOptions) {
|
|
|
const plugin = this.plugin;
|
|
|
|
|
@@ -339,4 +363,4 @@ export interface VolumeIsovalueInfo {
|
|
|
color: Color,
|
|
|
alpha?: number,
|
|
|
volumeIndex?: number
|
|
|
-}
|
|
|
+}
|