Search in sources :

Example 1 with Lwjgl3Files

use of com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files in project gaiasky by langurmonkey.

the class OctreeGeneratorRun method run.

public void run() {
    try {
        if (outFolder == null) {
            outFolder = System.getProperty("java.io.tmpdir");
        }
        if (!outFolder.endsWith("/"))
            outFolder += "/";
        Path outPath = Path.of(outFolder);
        Files.createDirectories(outPath);
        // Assets location
        String ASSETS_LOC = Settings.ASSETS_LOC;
        Gdx.files = new Lwjgl3Files();
        // Add notification watch
        new ConsoleLogger();
        // Initialize number format
        NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
        // Initialize date format
        DateFormatFactory.initialize(new DesktopDateFormatFactory());
        // Initialize i18n
        I18n.initialize(Path.of(ASSETS_LOC, "i18n/gsbundle"));
        // Initialize configuration
        Path dummyv = Path.of(ASSETS_LOC, "data/dummyversion");
        if (!Files.exists(dummyv)) {
            dummyv = Path.of(ASSETS_LOC, "dummyversion");
        }
        SettingsManager.initialize(new FileInputStream(Path.of(ASSETS_LOC, "conf/config.yaml").toFile()), new FileInputStream(dummyv.toFile()));
        // Parallelism
        if (parallelism > 0) {
            System.setProperty("java.util.concurrent.ForkJoinPool.common.parallelism", String.valueOf(parallelism));
        }
        logger.info("Parallelism set to " + ForkJoinPool.commonPool().getParallelism());
        OctreeNode root = generateOctree();
        if (root != null) {
            // Save arguments and structure
            StringBuffer argStr = new StringBuffer();
            for (int i = 0; i < arguments.length; i++) {
                argStr.append(arguments[i]).append(" ");
            }
            try (PrintStream out = new PrintStream(new FileOutputStream(outFolder + "log"))) {
                out.print(argStr);
                out.println();
                out.println();
                for (MessageBean msg : NotificationsInterface.getHistorical()) {
                    out.println(msg.toString());
                }
            }
        }
    } catch (Exception e) {
        logger.error(e);
    }
}
Also used : Path(java.nio.file.Path) MessageBean(gaiasky.interafce.MessageBean) Lwjgl3Files(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files) OctreeNode(gaiasky.util.tree.OctreeNode) DesktopDateFormatFactory(gaiasky.desktop.format.DesktopDateFormatFactory) InvocationTargetException(java.lang.reflect.InvocationTargetException) ConsoleLogger(gaiasky.interafce.ConsoleLogger) DesktopNumberFormatFactory(gaiasky.desktop.format.DesktopNumberFormatFactory)

Example 2 with Lwjgl3Files

use of com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files in project gaiasky by langurmonkey.

the class OortGenerator method main.

public static void main(String[] args) {
    try {
        Gdx.files = new Lwjgl3Files();
        // Initialize number format
        NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
        // Initialize date format
        DateFormatFactory.initialize(new DesktopDateFormatFactory());
        SettingsManager.initialize(new FileInputStream("../assets/conf/config.yaml"), new FileInputStream("../assets/data/dummyversion"));
        I18n.initialize(new FileHandle(System.getenv("PROJECTS") + "/gaiasky/android/assets/i18n/gsbundle"));
        // Add notif watch
        new ConsoleLogger();
        Array<double[]> oort = null;
        oort = generateOort();
        if (writeFile) {
            writeToDisk(oort, "/tmp/");
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Lwjgl3Files(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files) FileHandle(com.badlogic.gdx.files.FileHandle) ConsoleLogger(gaiasky.interafce.ConsoleLogger) DesktopNumberFormatFactory(gaiasky.desktop.format.DesktopNumberFormatFactory) DesktopDateFormatFactory(gaiasky.desktop.format.DesktopDateFormatFactory)

Example 3 with Lwjgl3Files

use of com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files in project gaiasky by langurmonkey.

the class Positions2DExtractor method main.

public static void main(String[] args) throws IOException {
    Positions2DExtractor p2d = new Positions2DExtractor();
    new ConsoleLogger();
    I18n.initialize(new FileHandle(System.getenv("PROJECTS") + "/gaiasky/assets/i18n/gsbundle"));
    Gdx.files = new Lwjgl3Files();
    try {
        NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
        DateFormatFactory.initialize(new DesktopDateFormatFactory());
        SettingsManager.initialize(false);
    } catch (Exception e) {
        Logger.getLogger(Positions2DExtractor.class).error(e);
    }
    p2d.process();
}
Also used : Lwjgl3Files(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files) ConsoleLogger(gaiasky.interafce.ConsoleLogger) FileHandle(com.badlogic.gdx.files.FileHandle) DesktopNumberFormatFactory(gaiasky.desktop.format.DesktopNumberFormatFactory) DesktopDateFormatFactory(gaiasky.desktop.format.DesktopDateFormatFactory) IOException(java.io.IOException)

Example 4 with Lwjgl3Files

use of com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files in project gaiasky by langurmonkey.

the class HeliotropicOrbitDataLoader method main.

public static void main(String[] args) {
    HeliotropicOrbitDataLoader l = new HeliotropicOrbitDataLoader();
    try {
        // Assets location
        String ASSETS_LOC = Settings.ASSETS_LOC;
        // Logger
        new ConsoleLogger();
        Gdx.files = new Lwjgl3Files();
        // Initialize number format
        NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
        // Initialize date format
        DateFormatFactory.initialize(new DesktopDateFormatFactory());
        SettingsManager.initialize(new FileInputStream(ASSETS_LOC + "/conf/config.yaml"), new FileInputStream(ASSETS_LOC + "/dummyversion"));
        I18n.initialize(new FileHandle(ASSETS_LOC + "/i18n/gsbundle"));
        // Initialize math manager
        MathManager.initialize();
        String inputFile = System.getProperty("user.home") + "/Downloads/orbit.JWST.heliotropic.csv";
        String outputFile = System.getProperty("user.home") + "/Downloads/orbit.JWST.dat";
        PointCloudData od = l.load(new FileInputStream(inputFile));
        logger.info("Loaded and converted " + od.getNumPoints() + " orbit data points: " + inputFile);
        OrbitDataWriter.writeOrbitData(outputFile, od);
        logger.info("Results written successfully: " + outputFile);
    } catch (Exception e) {
        logger.error(e);
    }
}
Also used : Lwjgl3Files(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files) PointCloudData(gaiasky.data.util.PointCloudData) ConsoleLogger(gaiasky.interafce.ConsoleLogger) FileHandle(com.badlogic.gdx.files.FileHandle) DesktopNumberFormatFactory(gaiasky.desktop.format.DesktopNumberFormatFactory) DesktopDateFormatFactory(gaiasky.desktop.format.DesktopDateFormatFactory)

Example 5 with Lwjgl3Files

use of com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files in project gaiasky by langurmonkey.

the class OrbitSamplerDataProvider method main.

public static void main(String[] args) {
    try {
        // Assets location
        String ASSETS_LOC = Settings.ASSETS_LOC;
        // Logger
        new ConsoleLogger();
        Gdx.files = new Lwjgl3Files();
        // Initialize number format
        NumberFormatFactory.initialize(new DesktopNumberFormatFactory());
        // Initialize date format
        DateFormatFactory.initialize(new DesktopDateFormatFactory());
        SettingsManager.initialize(new FileInputStream(ASSETS_LOC + "/conf/config.yaml"), new FileInputStream(ASSETS_LOC + "/dummyversion"));
        I18n.initialize(new FileHandle(ASSETS_LOC + "/i18n/gsbundle"));
        // Initialize math manager
        MathManager.initialize();
        OrbitSamplerDataProvider.writeData = true;
        OrbitSamplerDataProvider me = new OrbitSamplerDataProvider();
        Date now = new Date();
        String[] bodies = new String[] { "Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn", "Uranus", "Neptune", "Moon", "Pluto" };
        double[] periods = new double[] { 87.9691, 224.701, 365.256363004, 686.971, 4332.59, 10759.22, 30799.095, 60190.03, 27.321682, 90560.0 };
        for (int i = 0; i < bodies.length; i++) {
            String b = bodies[i];
            double period = periods[i];
            OrbitDataLoaderParameter param = new OrbitDataLoaderParameter(me.getClass(), b, now, true, period, 500);
            me.load(null, param);
        }
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : Lwjgl3Files(com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files) FileHandle(com.badlogic.gdx.files.FileHandle) FileNotFoundException(java.io.FileNotFoundException) IOException(java.io.IOException) DesktopDateFormatFactory(gaiasky.desktop.format.DesktopDateFormatFactory) FileInputStream(java.io.FileInputStream) Date(java.util.Date) IOException(java.io.IOException) FileNotFoundException(java.io.FileNotFoundException) OrbitDataLoaderParameter(gaiasky.assets.OrbitDataLoader.OrbitDataLoaderParameter) ConsoleLogger(gaiasky.interafce.ConsoleLogger) DesktopNumberFormatFactory(gaiasky.desktop.format.DesktopNumberFormatFactory)

Aggregations

Lwjgl3Files (com.badlogic.gdx.backends.lwjgl3.Lwjgl3Files)8 DesktopDateFormatFactory (gaiasky.desktop.format.DesktopDateFormatFactory)8 DesktopNumberFormatFactory (gaiasky.desktop.format.DesktopNumberFormatFactory)8 ConsoleLogger (gaiasky.interafce.ConsoleLogger)8 FileHandle (com.badlogic.gdx.files.FileHandle)6 IOException (java.io.IOException)2 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)1 JCommander (com.beust.jcommander.JCommander)1 OrbitDataLoaderParameter (gaiasky.assets.OrbitDataLoader.OrbitDataLoaderParameter)1 DesktopSceneGraphImplementationProvider (gaiasky.data.DesktopSceneGraphImplementationProvider)1 PointDataProvider (gaiasky.data.group.PointDataProvider)1 PointCloudData (gaiasky.data.util.PointCloudData)1 DesktopPostProcessorFactory (gaiasky.desktop.render.DesktopPostProcessorFactory)1 DesktopMusicActors (gaiasky.desktop.util.DesktopMusicActors)1 MessageBean (gaiasky.interafce.MessageBean)1 IParticleRecord (gaiasky.scenegraph.particle.IParticleRecord)1 OctreeNode (gaiasky.util.tree.OctreeNode)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1