StelObjectMgr.cpp   StelObjectMgr.cpp 
skipping to change at line 28 skipping to change at line 28
*/ */
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelObjectModule.hpp" #include "StelObjectModule.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "RefractionExtinction.hpp"
#include "StelSkyDrawer.hpp"
#include <QMouseEvent> #include <QMouseEvent>
#include <QString> #include <QString>
#include <QDebug> #include <QDebug>
#include <QStringList> #include <QStringList>
StelObjectMgr::StelObjectMgr() : searchRadiusPixel(30.f), distanceWeight(1. f) StelObjectMgr::StelObjectMgr() : searchRadiusPixel(30.f), distanceWeight(1. f)
{ {
setObjectName("StelObjectMgr"); setObjectName("StelObjectMgr");
objectPointerVisibility = true; objectPointerVisibility = true;
} }
skipping to change at line 139 skipping to change at line 142
// Now select the object minimizing the function y = distance(in pix el) + magnitude // Now select the object minimizing the function y = distance(in pix el) + magnitude
Vec3d winpos; Vec3d winpos;
prj->project(v, winpos); prj->project(v, winpos);
float xpos = winpos[0]; float xpos = winpos[0];
float ypos = winpos[1]; float ypos = winpos[1];
float best_object_value; float best_object_value;
best_object_value = 100000.f; best_object_value = 100000.f;
foreach (const StelObjectP& obj, candidates) foreach (const StelObjectP& obj, candidates)
{ {
prj->project(obj->getJ2000EquatorialPos(core->getNavigator() ), winpos); prj->project(obj->getJ2000EquatorialPos(core), winpos);
float distance = sqrt((xpos-winpos[0])*(xpos-winpos[0]) + (y pos-winpos[1])*(ypos-winpos[1]))*distanceWeight; float distance = sqrt((xpos-winpos[0])*(xpos-winpos[0]) + (y pos-winpos[1])*(ypos-winpos[1]))*distanceWeight;
float priority = obj->getSelectPriority(core->getNavigator( float priority = obj->getSelectPriority(core);
)); // qDebug() << (*iter).getShortInfoString(core) << ": " << p
// qDebug() << (*iter).getShortInfoString(core->getNavigator riority << " " << distance;
()) << ": " << priority << " " << distance;
if (distance + priority < best_object_value) if (distance + priority < best_object_value)
{ {
best_object_value = distance + priority; best_object_value = distance + priority;
sobj = obj; sobj = obj;
} }
} }
return sobj; return sobj;
} }
/************************************************************************* /*************************************************************************
Find in a "clever" way an object from its equatorial position Find in a "clever" way an object from its equatorial position
*************************************************************************/ *************************************************************************/
StelObjectP StelObjectMgr::cleverFind(const StelCore* core, int x, int y) c onst StelObjectP StelObjectMgr::cleverFind(const StelCore* core, int x, int y) c onst
{ {
Vec3d v; Vec3d v;
if (core->getProjection(StelCore::FrameJ2000)->unProject(x,y,v)) if (core->getProjection(StelCore::FrameJ2000)->unProject(x,y,v))
{
return cleverFind(core, v); return cleverFind(core, v);
}
return StelObjectP(); return StelObjectP();
} }
/************************************************************************* /*************************************************************************
Notify that we want to unselect any object Notify that we want to unselect any object
*************************************************************************/ *************************************************************************/
void StelObjectMgr::unSelect(void) void StelObjectMgr::unSelect(void)
{ {
lastSelectedObjects.clear(); lastSelectedObjects.clear();
emit(selectedObjectChanged(StelModule::RemoveFromSelection));
// Send the event to every StelModule
foreach (StelModule* iter, StelApp::getInstance().getModuleMgr().get
AllModules())
{
iter->selectedObjectChangeCallBack(StelModule::RemoveFromSel
ection);
}
} }
/************************************************************************* /*************************************************************************
Notify that we want to select the given object Notify that we want to select the given object
*************************************************************************/ *************************************************************************/
bool StelObjectMgr::setSelectedObject(const StelObjectP obj, StelModule::St elModuleSelectAction action) bool StelObjectMgr::setSelectedObject(const StelObjectP obj, StelModule::St elModuleSelectAction action)
{ {
if (!obj) if (!obj)
{ {
unSelect(); unSelect();
skipping to change at line 204 skipping to change at line 204
/************************************************************************* /*************************************************************************
Notify that we want to select the given objects Notify that we want to select the given objects
*************************************************************************/ *************************************************************************/
bool StelObjectMgr::setSelectedObject(const QList<StelObjectP>& objs, StelM odule::StelModuleSelectAction action) bool StelObjectMgr::setSelectedObject(const QList<StelObjectP>& objs, StelM odule::StelModuleSelectAction action)
{ {
if (action==StelModule::AddToSelection) if (action==StelModule::AddToSelection)
lastSelectedObjects.append(objs); lastSelectedObjects.append(objs);
else else
lastSelectedObjects = objs; lastSelectedObjects = objs;
emit(selectedObjectChanged(action));
// Send the event to every StelModule
foreach (StelModule* iter, StelApp::getInstance().getModuleMgr().get
AllModules())
{
iter->selectedObjectChangeCallBack(action);
}
return true; return true;
} }
/************************************************************************* /*************************************************************************
Return the list objects of type "withType" which was recently selected by Return the list objects of type "withType" which was recently selected by
the user the user
*************************************************************************/ *************************************************************************/
QList<StelObjectP> StelObjectMgr::getSelectedObject(const QString& type) QList<StelObjectP> StelObjectMgr::getSelectedObject(const QString& type)
{ {
QList<StelObjectP> result; QList<StelObjectP> result;
 End of changes. 7 change blocks. 
20 lines changed or deleted 11 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/