~ubuntu-branches/debian/wheezy/stellarium/wheezy

« back to all changes in this revision

Viewing changes to src/core/StelObjectMgr.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cédric Delfosse
  • Date: 2011-08-02 20:55:21 UTC
  • mfrom: (1.2.6 upstream)
  • Revision ID: james.westby@ubuntu.com-20110802205521-pjeo0d4v3oe96fax
Tags: 0.11.0-1
* New upstream release (Closes: #633517)
* Update description and drop libqt4-sql-sqlite (Closes: #613380)

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
#include "StelUtils.hpp"
26
26
#include "StelProjector.hpp"
27
27
#include "StelMovementMgr.hpp"
 
28
#include "RefractionExtinction.hpp"
 
29
#include "StelSkyDrawer.hpp"
 
30
 
28
31
#include <QMouseEvent>
29
32
#include <QString>
30
33
#include <QDebug>
139
142
        best_object_value = 100000.f;
140
143
        foreach (const StelObjectP& obj, candidates)
141
144
        {
142
 
                prj->project(obj->getJ2000EquatorialPos(core->getNavigator()), winpos);
 
145
                prj->project(obj->getJ2000EquatorialPos(core), winpos);
143
146
                float distance = sqrt((xpos-winpos[0])*(xpos-winpos[0]) + (ypos-winpos[1])*(ypos-winpos[1]))*distanceWeight;
144
 
                float priority =  obj->getSelectPriority(core->getNavigator());
145
 
                // qDebug() << (*iter).getShortInfoString(core->getNavigator()) << ": " << priority << " " << distance;
 
147
                float priority =  obj->getSelectPriority(core);
 
148
                // qDebug() << (*iter).getShortInfoString(core) << ": " << priority << " " << distance;
146
149
                if (distance + priority < best_object_value)
147
150
                {
148
151
                        best_object_value = distance + priority;
159
162
StelObjectP StelObjectMgr::cleverFind(const StelCore* core, int x, int y) const
160
163
{
161
164
        Vec3d v;
162
 
        core->getProjection(StelCore::FrameJ2000)->unProject(x,y,v);
163
 
        return cleverFind(core, v);
 
165
        if (core->getProjection(StelCore::FrameJ2000)->unProject(x,y,v))
 
166
        {
 
167
                return cleverFind(core, v);
 
168
        }
 
169
        return StelObjectP();
164
170
}
165
171
 
166
172
/*************************************************************************
169
175
void StelObjectMgr::unSelect(void)
170
176
{
171
177
        lastSelectedObjects.clear();
172
 
 
173
 
        // Send the event to every StelModule
174
 
        foreach (StelModule* iter, StelApp::getInstance().getModuleMgr().getAllModules())
175
 
        {
176
 
                iter->selectedObjectChangeCallBack(StelModule::RemoveFromSelection);
177
 
        }
 
178
        emit(selectedObjectChanged(StelModule::RemoveFromSelection));
178
179
}
179
180
 
180
181
/*************************************************************************
199
200
*************************************************************************/
200
201
bool StelObjectMgr::setSelectedObject(const QList<StelObjectP>& objs, StelModule::StelModuleSelectAction action)
201
202
{
202
 
        lastSelectedObjects=objs;
203
 
 
204
 
        // Send the event to every StelModule
205
 
        foreach (StelModule* iter, StelApp::getInstance().getModuleMgr().getAllModules())
206
 
        {
207
 
                iter->selectedObjectChangeCallBack(action);
208
 
        }
 
203
        if (action==StelModule::AddToSelection)
 
204
                lastSelectedObjects.append(objs);
 
205
        else
 
206
                lastSelectedObjects = objs;
 
207
        emit(selectedObjectChanged(action));
209
208
        return true;
210
209
}
211
210