2006-10-18 04:23:40 -06:00
|
|
|
// rotationmanager.cpp
|
|
|
|
//
|
|
|
|
// Copyright (C) 2006 Chris Laurel <claurel@shatters.net>
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
|
2009-11-02 13:30:18 -07:00
|
|
|
#include "rotationmanager.h"
|
2006-10-18 04:23:40 -06:00
|
|
|
#include "celestia.h"
|
2009-11-02 13:30:18 -07:00
|
|
|
#include <celephem/samporient.h>
|
2006-10-18 04:23:40 -06:00
|
|
|
#include <celutil/debug.h>
|
2009-11-02 13:30:18 -07:00
|
|
|
#include <iostream>
|
|
|
|
#include <fstream>
|
2006-10-18 04:23:40 -06:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
2018-09-22 07:13:49 -06:00
|
|
|
static RotationModelManager* rotationModelManager = nullptr;
|
2006-10-18 04:23:40 -06:00
|
|
|
|
|
|
|
|
|
|
|
RotationModelManager* GetRotationModelManager()
|
|
|
|
{
|
2018-09-22 07:13:49 -06:00
|
|
|
if (rotationModelManager == nullptr)
|
2006-10-18 04:23:40 -06:00
|
|
|
rotationModelManager = new RotationModelManager("data");
|
|
|
|
return rotationModelManager;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
string RotationModelInfo::resolve(const string& baseDir)
|
|
|
|
{
|
|
|
|
if (!path.empty())
|
|
|
|
{
|
|
|
|
string filename = path + "/data/" + source;
|
2018-09-22 07:13:49 -06:00
|
|
|
ifstream in(filename);
|
2006-10-18 04:23:40 -06:00
|
|
|
if (in.good())
|
|
|
|
return filename;
|
|
|
|
}
|
|
|
|
|
|
|
|
return baseDir + "/" + source;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
RotationModel* RotationModelInfo::load(const string& filename)
|
|
|
|
{
|
|
|
|
DPRINTF(1, "Loading rotation model: %s\n", filename.c_str());
|
|
|
|
|
|
|
|
return LoadSampledOrientation(filename);
|
|
|
|
}
|