Search in sources :

Example 1 with IObserver

use of gaiasky.event.IObserver in project gaiasky by langurmonkey.

the class EventScriptingInterface method runCameraPath.

@Override
public void runCameraPath(String file, boolean sync) {
    em.post(Event.PLAY_CAMERA_CMD, this, file);
    // Wait if needed
    if (sync) {
        Object monitor = new Object();
        IObserver watcher = (event, source, data) -> {
            switch(event) {
                case CAMERA_PLAY_INFO:
                    Boolean status = (Boolean) data[0];
                    if (!status) {
                        synchronized (monitor) {
                            monitor.notify();
                        }
                    }
                    break;
                default:
                    break;
            }
        };
        em.subscribe(watcher, Event.CAMERA_PLAY_INFO);
        // Wait for camera to finish
        synchronized (monitor) {
            try {
                monitor.wait();
            } catch (InterruptedException e) {
                logger.error(e, "Error waiting for camera file to finish");
            }
        }
    }
}
Also used : IGui(gaiasky.interafce.IGui) SysUtils(gaiasky.desktop.util.SysUtils) IAttribute(gaiasky.util.filter.attrib.IAttribute) GL20(com.badlogic.gdx.graphics.GL20) IObserver(gaiasky.event.IObserver) CubemapProjections(gaiasky.util.gdx.contrib.postprocess.effects.CubemapProjections) DatasetLoadType(gaiasky.data.group.DatasetOptions.DatasetLoadType) ComponentTypes(gaiasky.render.ComponentTypes) ZoneOffset(java.time.ZoneOffset) Shape(gaiasky.interafce.AddShapeDialog.Shape) Path(java.nio.file.Path) FileDataSource(uk.ac.starlink.util.FileDataSource) AssetManager(com.badlogic.gdx.assets.AssetManager) CatalogInfoSource(gaiasky.util.CatalogInfo.CatalogInfoSource) Coordinates(gaiasky.util.coord.Coordinates) StarClusterLoader(gaiasky.data.cluster.StarClusterLoader) Event(gaiasky.event.Event) AbstractOrbitCoordinates(gaiasky.util.coord.AbstractOrbitCoordinates) Instant(java.time.Instant) TimeFrame(gaiasky.event.EventManager.TimeFrame) InvocationTargetException(java.lang.reflect.InvocationTargetException) DatasetOptions(gaiasky.data.group.DatasetOptions) STILDataProvider(gaiasky.data.group.STILDataProvider) AttributeUCD(gaiasky.util.filter.attrib.AttributeUCD) Keys(com.badlogic.gdx.Input.Keys) EventManager(gaiasky.event.EventManager) GaiaSky(gaiasky.GaiaSky) ChronoField(java.time.temporal.ChronoField) Primitive(gaiasky.interafce.AddShapeDialog.Primitive) CameraMode(gaiasky.scenegraph.camera.CameraManager.CameraMode) java.util(java.util) Array(com.badlogic.gdx.utils.Array) LocalDateTime(java.time.LocalDateTime) DataSource(uk.ac.starlink.util.DataSource) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Gdx(com.badlogic.gdx.Gdx) ScreenshotSettings(gaiasky.util.Settings.ScreenshotSettings) Constructor(java.lang.reflect.Constructor) AtomicReference(java.util.concurrent.atomic.AtomicReference) Texture(com.badlogic.gdx.graphics.Texture) gaiasky.scenegraph(gaiasky.scenegraph) UCD(gaiasky.util.ucd.UCD) NaturalCamera(gaiasky.scenegraph.camera.NaturalCamera) TimeUtils(com.badlogic.gdx.utils.TimeUtils) gaiasky.util.math(gaiasky.util.math) Files(java.nio.file.Files) ComponentType(gaiasky.render.ComponentTypes.ComponentType) gaiasky.util(gaiasky.util) Group(com.badlogic.gdx.scenes.scene2d.Group) Actor(com.badlogic.gdx.scenes.scene2d.Actor) ImageRenderer(gaiasky.screenshot.ImageRenderer) ITimeFrameProvider(gaiasky.util.time.ITimeFrameProvider) Paths(java.nio.file.Paths) Log(gaiasky.util.Logger.Log) ColormapPicker(gaiasky.interafce.ColormapPicker) IParticleRecord(gaiasky.scenegraph.particle.IParticleRecord) ColorUtils(gaiasky.util.color.ColorUtils) IObserver(gaiasky.event.IObserver) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean)

Aggregations

Gdx (com.badlogic.gdx.Gdx)1 Keys (com.badlogic.gdx.Input.Keys)1 AssetManager (com.badlogic.gdx.assets.AssetManager)1 GL20 (com.badlogic.gdx.graphics.GL20)1 Texture (com.badlogic.gdx.graphics.Texture)1 Actor (com.badlogic.gdx.scenes.scene2d.Actor)1 Group (com.badlogic.gdx.scenes.scene2d.Group)1 Array (com.badlogic.gdx.utils.Array)1 TimeUtils (com.badlogic.gdx.utils.TimeUtils)1 GaiaSky (gaiasky.GaiaSky)1 StarClusterLoader (gaiasky.data.cluster.StarClusterLoader)1 DatasetOptions (gaiasky.data.group.DatasetOptions)1 DatasetLoadType (gaiasky.data.group.DatasetOptions.DatasetLoadType)1 STILDataProvider (gaiasky.data.group.STILDataProvider)1 SysUtils (gaiasky.desktop.util.SysUtils)1 Event (gaiasky.event.Event)1 EventManager (gaiasky.event.EventManager)1 TimeFrame (gaiasky.event.EventManager.TimeFrame)1 IObserver (gaiasky.event.IObserver)1 Primitive (gaiasky.interafce.AddShapeDialog.Primitive)1