StelCore.cpp   StelCore.cpp 
skipping to change at line 54 skipping to change at line 54
QSettings* conf = StelApp::getInstance().getSettings(); QSettings* conf = StelApp::getInstance().getSettings();
// Create and initialize the default projector params // Create and initialize the default projector params
QString tmpstr = conf->value("projection/viewport").toString(); QString tmpstr = conf->value("projection/viewport").toString();
currentProjectorParams.maskType = StelProjector::stringToMaskType(tm pstr); currentProjectorParams.maskType = StelProjector::stringToMaskType(tm pstr);
const int viewport_width = conf->value("projection/viewport_width", currentProjectorParams.viewportXywh[2]).toInt(); const int viewport_width = conf->value("projection/viewport_width", currentProjectorParams.viewportXywh[2]).toInt();
const int viewport_height = conf->value("projection/viewport_height" , currentProjectorParams.viewportXywh[3]).toInt(); const int viewport_height = conf->value("projection/viewport_height" , currentProjectorParams.viewportXywh[3]).toInt();
const int viewport_x = conf->value("projection/viewport_x", 0).toInt (); const int viewport_x = conf->value("projection/viewport_x", 0).toInt ();
const int viewport_y = conf->value("projection/viewport_y", 0).toInt (); const int viewport_y = conf->value("projection/viewport_y", 0).toInt ();
currentProjectorParams.viewportXywh.set(viewport_x,viewport_y,viewpo rt_width,viewport_height); currentProjectorParams.viewportXywh.set(viewport_x,viewport_y,viewpo rt_width,viewport_height);
const double viewportCenterX = conf->value("projection/viewport_cent const float viewportCenterX = conf->value("projection/viewport_cente
er_x",0.5*viewport_width).toDouble(); r_x",0.5f*viewport_width).toFloat();
const double viewportCenterY = conf->value("projection/viewport_cent const float viewportCenterY = conf->value("projection/viewport_cente
er_y",0.5*viewport_height).toDouble(); r_y",0.5f*viewport_height).toFloat();
currentProjectorParams.viewportCenter.set(viewportCenterX, viewportC enterY); currentProjectorParams.viewportCenter.set(viewportCenterX, viewportC enterY);
currentProjectorParams.viewportFovDiameter = conf->value("projection /viewport_fov_diameter", qMin(viewport_width,viewport_height)).toDouble(); currentProjectorParams.viewportFovDiameter = conf->value("projection /viewport_fov_diameter", qMin(viewport_width,viewport_height)).toFloat();
currentProjectorParams.flipHorz = conf->value("projection/flip_horz" ,false).toBool(); currentProjectorParams.flipHorz = conf->value("projection/flip_horz" ,false).toBool();
currentProjectorParams.flipVert = conf->value("projection/flip_vert" ,false).toBool(); currentProjectorParams.flipVert = conf->value("projection/flip_vert" ,false).toBool();
currentProjectorParams.gravityLabels = conf->value("viewing/flag_gra vity_labels").toBool(); currentProjectorParams.gravityLabels = conf->value("viewing/flag_gra vity_labels").toBool();
} }
/************************************************************************* /*************************************************************************
Destructor Destructor
*************************************************************************/ *************************************************************************/
StelCore::~StelCore() StelCore::~StelCore()
skipping to change at line 242 skipping to change at line 242
/************************************************************************* /*************************************************************************
Update core state after drawing modules Update core state after drawing modules
*************************************************************************/ *************************************************************************/
void StelCore::postDraw() void StelCore::postDraw()
{ {
StelPainter sPainter(getProjection(StelCore::FrameJ2000)); StelPainter sPainter(getProjection(StelCore::FrameJ2000));
sPainter.drawViewportShape(); sPainter.drawViewportShape();
} }
void StelCore::setCurrentProjectionType(ProjectionType type)
{
currentProjectionType=type;
const double savedFov = currentProjectorParams.fov;
currentProjectorParams.fov = 0.0001; // Avoid crash
double newMaxFov = getProjection(Mat4d::identity())->getMaxFov();
movementMgr->setMaxFov(newMaxFov);
currentProjectorParams.fov = qMin(newMaxFov, savedFov);
}
//! Set the current projection type to use //! Set the current projection type to use
void StelCore::setCurrentProjectionTypeKey(QString key) void StelCore::setCurrentProjectionTypeKey(QString key)
{ {
const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType")); const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType"));
currentProjectionType = (ProjectionType)en.keyToValue(key.toAscii(). ProjectionType newType = (ProjectionType)en.keyToValue(key.toAscii()
data()); .data());
if (currentProjectionType<0) if (newType<0)
{ {
qWarning() << "Unknown projection type: " << key << "setting \"ProjectionStereographic\" instead"; qWarning() << "Unknown projection type: " << key << "setting \"ProjectionStereographic\" instead";
currentProjectionType = ProjectionStereographic; newType = ProjectionStereographic;
} }
const double savedFov = currentProjectorParams.fov; setCurrentProjectionType(newType);
currentProjectorParams.fov = 0.0001; // Avoid crash
double newMaxFov = getProjection(Mat4d())->getMaxFov();
movementMgr->setMaxFov(newMaxFov);
currentProjectorParams.fov = qMin(newMaxFov, savedFov);
} }
//! Get the current Mapping used by the Projection //! Get the current Mapping used by the Projection
QString StelCore::getCurrentProjectionTypeKey(void) const QString StelCore::getCurrentProjectionTypeKey(void) const
{ {
return metaObject()->enumerator(metaObject()->indexOfEnumerator("Pro jectionType")).key(currentProjectionType); return metaObject()->enumerator(metaObject()->indexOfEnumerator("Pro jectionType")).key(currentProjectionType);
} }
//! Get the list of all the available projections //! Get the list of all the available projections
QStringList StelCore::getAllProjectionTypeKeys() const QStringList StelCore::getAllProjectionTypeKeys() const
skipping to change at line 279 skipping to change at line 285
QStringList l; QStringList l;
for (int i=0;i<en.keyCount();++i) for (int i=0;i<en.keyCount();++i)
l << en.key(i); l << en.key(i);
return l; return l;
} }
//! Get the translated projection name from its TypeKey for the current loc ale //! Get the translated projection name from its TypeKey for the current loc ale
QString StelCore::projectionTypeKeyToNameI18n(const QString& key) const QString StelCore::projectionTypeKeyToNameI18n(const QString& key) const
{ {
const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType")); const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType"));
QString s(getProjection(Mat4d(), (ProjectionType)en.keysToValue(key. toAscii()))->getNameI18()); QString s(getProjection(StelCore::FrameJ2000, (ProjectionType)en.key sToValue(key.toAscii()))->getNameI18());
return s; return s;
} }
//! Get the projection TypeKey from its translated name for the current loc ale //! Get the projection TypeKey from its translated name for the current loc ale
QString StelCore::projectionNameI18nToTypeKey(const QString& nameI18n) cons t QString StelCore::projectionNameI18nToTypeKey(const QString& nameI18n) cons t
{ {
const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType")); const QMetaEnum& en = metaObject()->enumerator(metaObject()->indexOf Enumerator("ProjectionType"));
for (int i=0;i<en.keyCount();++i) for (int i=0;i<en.keyCount();++i)
{ {
if (getProjection(Mat4d(), (ProjectionType)i)->getNameI18()= =nameI18n) if (getProjection(StelCore::FrameJ2000, (ProjectionType)i)-> getNameI18()==nameI18n)
return en.valueToKey(i); return en.valueToKey(i);
} }
// Unknown translated name // Unknown translated name
Q_ASSERT(0); Q_ASSERT(0);
return en.valueToKey(ProjectionStereographic); return en.valueToKey(ProjectionStereographic);
} }
 End of changes. 8 change blocks. 
16 lines changed or deleted 22 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/