2002-11-03 13:33:30 -07:00
|
|
|
/***************************************************************************
|
|
|
|
url.h - description
|
|
|
|
-------------------
|
|
|
|
begin : Wed Aug 7 2002
|
|
|
|
copyright : (C) 2002 by chris
|
|
|
|
email : chris@tux.teyssier.org
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* *
|
|
|
|
* 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. *
|
|
|
|
* *
|
|
|
|
***************************************************************************/
|
|
|
|
#ifndef _URL_H_
|
|
|
|
#define _URL_H_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include "celestiacore.h"
|
|
|
|
#include "celengine/astro.h"
|
|
|
|
|
|
|
|
class CelestiaCore;
|
|
|
|
|
|
|
|
class Url
|
|
|
|
{
|
|
|
|
public:
|
2003-01-23 15:46:46 -07:00
|
|
|
enum UrlType {
|
|
|
|
Absolute = 0,
|
2003-05-31 11:40:19 -06:00
|
|
|
Relative = 1,
|
|
|
|
Settings = 2,
|
2003-01-23 15:46:46 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
Url();
|
|
|
|
|
2002-11-03 13:33:30 -07:00
|
|
|
// parses str
|
|
|
|
Url(const std::string& str, CelestiaCore *core);
|
|
|
|
// current url of appCore
|
2003-01-23 15:46:46 -07:00
|
|
|
Url(CelestiaCore* appCore, UrlType type = Absolute);
|
2002-11-03 13:33:30 -07:00
|
|
|
~Url();
|
|
|
|
|
|
|
|
std::string getAsString() const;
|
|
|
|
std::string getName() const;
|
|
|
|
void goTo();
|
|
|
|
|
2003-01-23 15:46:46 -07:00
|
|
|
|
2002-11-03 13:33:30 -07:00
|
|
|
private:
|
|
|
|
std::string urlStr, name;
|
|
|
|
std::string modeStr;
|
|
|
|
std::string body1, body2, selectedStr, trackedStr;
|
|
|
|
|
|
|
|
CelestiaCore *appCore;
|
|
|
|
|
2008-02-08 14:46:02 -07:00
|
|
|
ObserverFrame ref;
|
2002-11-03 13:33:30 -07:00
|
|
|
Selection selected;
|
|
|
|
Selection tracked;
|
|
|
|
|
2008-02-08 14:46:02 -07:00
|
|
|
ObserverFrame::CoordinateSystem mode;
|
2002-11-03 13:33:30 -07:00
|
|
|
int nbBodies;
|
|
|
|
float fieldOfView;
|
|
|
|
float timeScale;
|
|
|
|
int renderFlags;
|
|
|
|
int labelMode;
|
2003-05-06 16:13:33 -06:00
|
|
|
bool lightTimeDelay;
|
2007-11-03 03:49:29 -06:00
|
|
|
bool pauseState;
|
2002-11-03 13:33:30 -07:00
|
|
|
|
|
|
|
std::map<std::string, std::string> parseUrlParams(const std::string& url) const;
|
2008-02-08 14:46:02 -07:00
|
|
|
std::string getCoordSysName(ObserverFrame::CoordinateSystem mode) const;
|
2002-11-03 13:33:30 -07:00
|
|
|
std::string getSelectionName(const Selection& selection) const;
|
|
|
|
std::string getBodyShortName(const std::string& body) const;
|
|
|
|
static std::string decode_string(const std::string& str);
|
|
|
|
|
|
|
|
bool fromString;
|
2003-01-23 15:46:46 -07:00
|
|
|
UrlType type;
|
|
|
|
|
|
|
|
void evalName();
|
|
|
|
|
|
|
|
// Variables specific to Global Urls
|
|
|
|
UniversalCoord coord;
|
|
|
|
astro::Date date;
|
|
|
|
Quatf orientation;
|
|
|
|
|
|
|
|
// Variables specific to Relative Urls
|
|
|
|
double distance, longitude, latitude;
|
2002-11-03 13:33:30 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|