Warning, /phoenix-eic-event-display/src/app/eic-detector/eic-detector.component.ts is written in an unsupported language. File is not indexed.
0001 import { Component, OnInit } from '@angular/core';
0002 import {
0003 EventDataFormat,
0004 EventDataImportOption,
0005 EventDisplayService,
0006 } from 'phoenix-ui-components';
0007 import {
0008 Configuration,
0009 PhoenixLoader,
0010 PresetView,
0011 PhoenixMenuNode,
0012 ScriptLoader,
0013 } from 'phoenix-event-display';
0014
0015 @Component({
0016 selector: 'app-eic-detector',
0017 templateUrl: './eic-detector.component.html',
0018 styleUrls: ['./eic-detector.component.scss']
0019 })
0020 export class EicDetectorComponent implements OnInit {
0021
0022 /** The root Phoenix menu node. */
0023 phoenixMenuRoot = new PhoenixMenuNode("Phoenix Menu");
0024
0025 loaded = false;
0026 loadingProgress = 0;
0027
0028 eventDataImportOptions: EventDataImportOption[] = [
0029 EventDataFormat.JSON,
0030 EventDataFormat.IG,
0031 ];
0032
0033 constructor(private eventDisplay: EventDisplayService) { }
0034
0035 ngOnInit() {
0036 // Create the event display configuration
0037 const configuration: Configuration = {
0038 eventDataLoader: new PhoenixLoader(),
0039 presetViews: [
0040 // simple preset views, looking at point 0,0,0 and with no clipping
0041 new PresetView('Left View', [0, 0, -12000], [0, 0, 0], 'left-cube'),
0042 new PresetView('Center View', [-500, 12000, 0], [0, 0, 0], 'top-cube'),
0043 // more fancy view, looking at point 0,0,5000 and with some clipping
0044 new PresetView('Right View', [0, 0, 12000], [0, 0, 5000], 'right-cube')
0045 ],
0046 // default view with x, y, z of the camera and then x, y, z of the point it looks at
0047 defaultView: [4000, 0, 4000, 0, 0 ,0],
0048 phoenixMenuRoot: this.phoenixMenuRoot,
0049 // Event data to load by default
0050 defaultEventFile: {
0051 // (Assuming the file exists in the `src/assets` directory of the app)
0052 eventFile: 'assets/event_data.xml',
0053 eventType: 'jivexml'
0054 },
0055 }
0056
0057 // Initialize the event display
0058 this.eventDisplay.init(configuration);
0059
0060 // Load detector geometry (assuming the file exists in the `src/assets` directory of the app)
0061 this.eventDisplay.loadGLTFGeometry('assets/eic.gltf', 'Detector');
0062
0063 this.eventDisplay
0064 .getLoadingManager()
0065 .addProgressListener((progress) => (this.loadingProgress = progress));
0066
0067 this.eventDisplay
0068 .getLoadingManager()
0069 .addLoadListenerWithCheck(() => (this.loaded = true));
0070
0071 }
0072
0073 }