CustomObjectMgr.cpp   CustomObjectMgr.cpp 
skipping to change at line 71 skipping to change at line 71
const StelProjectorP prj = StelApp::getInstance().getCore()- >getProjection(StelCore::FrameJ2000, StelCore::RefractionAuto); const StelProjectorP prj = StelApp::getInstance().getCore()- >getProjection(StelCore::FrameJ2000, StelCore::RefractionAuto);
QPoint p = StelMainView::getInstance().getMousePos(); // get screen coordinates of mouse cursor QPoint p = StelMainView::getInstance().getMousePos(); // get screen coordinates of mouse cursor
Vec3d mousePosition; Vec3d mousePosition;
float wh = prj->getViewportWidth()/2.; // get half of width of the screen float wh = prj->getViewportWidth()/2.; // get half of width of the screen
float hh = prj->getViewportHeight()/2.; // get half of heigh t of the screen float hh = prj->getViewportHeight()/2.; // get half of heigh t of the screen
float mx = p.x()-wh; // point 0 in center of the screen, axi s X directed to right float mx = p.x()-wh; // point 0 in center of the screen, axi s X directed to right
float my = p.y()-hh; // point 0 in center of the screen, axi s Y directed to bottom float my = p.y()-hh; // point 0 in center of the screen, axi s Y directed to bottom
// calculate position of mouse cursor via position of center of the screen (and invert axis Y) // calculate position of mouse cursor via position of center of the screen (and invert axis Y)
// If coordinates are invalid, don't draw them. // If coordinates are invalid, don't draw them.
bool coordsValid=false; bool coordsValid = prj->unProject(prj->getViewportPosX()+wh+
coordsValid = prj->unProject(prj->getViewportPosX()+wh+mx, p mx, prj->getViewportPosY()+hh+1-my, mousePosition);
rj->getViewportPosY()+hh+1-my, mousePosition); if (coordsValid)
{ // Nick Fedoseev patch { // Nick Fedoseev patch
Vec3d win; Vec3d win;
prj->project(mousePosition,win); prj->project(mousePosition,win);
float dx = prj->getViewportPosX()+wh+mx - win.v[0]; float dx = prj->getViewportPosX()+wh+mx - win.v[0];
float dy = prj->getViewportPosY()+hh+1-my - win.v[1] ; float dy = prj->getViewportPosY()+hh+1-my - win.v[1] ;
coordsValid = prj->unProject(prj->getViewportPosX()+ prj->unProject(prj->getViewportPosX()+wh+mx+dx, prj-
wh+mx+dx, prj->getViewportPosY()+hh+1-my+dy, mousePosition); >getViewportPosY()+hh+1-my+dy, mousePosition);
}
if (coordsValid)
addCustomObject(QString("%1 %2").arg(N_("Marker")).a rg(countMarkers + 1), mousePosition, true); addCustomObject(QString("%1 %2").arg(N_("Marker")).a rg(countMarkers + 1), mousePosition, true);
}
e->setAccepted(true); e->setAccepted(true);
return; return;
} }
if (e->modifiers().testFlag(Qt::ShiftModifier) && e->button()==Qt::R ightButton && e->type()==QEvent::MouseButtonPress) if (e->modifiers().testFlag(Qt::ShiftModifier) && e->button()==Qt::R ightButton && e->type()==QEvent::MouseButtonPress)
{ {
// Delete custom markers // Delete custom markers
removeCustomObjects(); removeCustomObjects();
e->setAccepted(true); e->setAccepted(true);
return; return;
} }
skipping to change at line 144 skipping to change at line 142
addCustomObject(designation, J2000, isVisible); addCustomObject(designation, J2000, isVisible);
} }
void CustomObjectMgr::addCustomObjectRaDec(QString designation, const QStri ng &ra, const QString &dec, bool isVisible) void CustomObjectMgr::addCustomObjectRaDec(QString designation, const QStri ng &ra, const QString &dec, bool isVisible)
{ {
Vec3d aim; Vec3d aim;
double dRa = StelUtils::getDecAngle(ra); double dRa = StelUtils::getDecAngle(ra);
double dDec = StelUtils::getDecAngle(dec); double dDec = StelUtils::getDecAngle(dec);
StelUtils::spheToRect(dRa, dDec, aim); StelUtils::spheToRect(dRa, dDec, aim);
addCustomObject(designation, StelApp::getInstance().getCore()->equin oxEquToJ2000(aim), isVisible); addCustomObject(designation, StelApp::getInstance().getCore()->equin oxEquToJ2000(aim, StelCore::RefractionOff), isVisible);
} }
void CustomObjectMgr::addCustomObjectAltAzi(QString designation, const QStr ing &alt, const QString &azi, bool isVisible) void CustomObjectMgr::addCustomObjectAltAzi(QString designation, const QStr ing &alt, const QString &azi, bool isVisible)
{ {
Vec3d aim; Vec3d aim;
double dAlt = StelUtils::getDecAngle(alt); double dAlt = StelUtils::getDecAngle(alt);
double dAzi = M_PI - StelUtils::getDecAngle(azi); double dAzi = M_PI - StelUtils::getDecAngle(azi);
if (StelApp::getInstance().getFlagSouthAzimuthUsage()) if (StelApp::getInstance().getFlagSouthAzimuthUsage())
dAzi -= M_PI; dAzi -= M_PI;
skipping to change at line 203 skipping to change at line 201
Vec3d pos=obj->getJ2000EquatorialPos(core); Vec3d pos=obj->getJ2000EquatorialPos(core);
Vec3d screenpos; Vec3d screenpos;
// Compute 2D pos and return if outside screen // Compute 2D pos and return if outside screen
if (!painter.getProjector()->project(pos, screenpos)) if (!painter.getProjector()->project(pos, screenpos))
return; return;
const Vec3f& c(obj->getInfoColor()); const Vec3f& c(obj->getInfoColor());
painter.setColor(c[0],c[1],c[2]); painter.setColor(c[0],c[1],c[2]);
texPointer->bind(); texPointer->bind();
painter.enableTexture2d(true); painter.setBlending(true);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // Normal
transparency mode
painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, S telApp::getInstance().getTotalRunTime()*40.); painter.drawSprite2dMode(screenpos[0], screenpos[1], 13.f, S telApp::getInstance().getTotalRunTime()*40.);
} }
} }
QList<StelObjectP> CustomObjectMgr::searchAround(const Vec3d& av, double li mitFov, const StelCore*) const QList<StelObjectP> CustomObjectMgr::searchAround(const Vec3d& av, double li mitFov, const StelCore*) const
{ {
QList<StelObjectP> result; QList<StelObjectP> result;
Vec3d v(av); Vec3d v(av);
v.normalize(); v.normalize();
 End of changes. 5 change blocks. 
13 lines changed or deleted 8 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/