StelObjectMgr.hpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELOBJECTMGR_HPP_
00021 #define _STELOBJECTMGR_HPP_
00022
00023 #include <QList>
00024 #include <QString>
00025 #include "VecMath.hpp"
00026 #include "StelModule.hpp"
00027 #include "StelObject.hpp"
00028
00029 class StelObjectModule;
00030 class StelCore;
00031
00035 class StelObjectMgr : public StelModule
00036 {
00037 Q_OBJECT
00038 public:
00039 StelObjectMgr();
00040 virtual ~StelObjectMgr();
00041
00043
00044 virtual void init() {;}
00045 virtual void draw(StelCore*, class StelRenderer*) {;}
00046 virtual void update(double) {;}
00047
00051 void registerStelObjectMgr(StelObjectModule* mgr);
00052
00058 bool findAndSelect(const StelCore* core, const Vec3d& pos, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00059
00066 bool findAndSelect(const StelCore* core, int x, int y, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00067
00072 bool findAndSelectI18n(const QString &nameI18n, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00073
00078 bool findAndSelect(const QString &name, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00079
00084 QStringList listMatchingObjectsI18n(const QString& objPrefix, unsigned int maxNbItem=5) const;
00085
00086 QStringList listAllModuleObjects(const QString& moduleId, bool inEnglish) const;
00087 QMap<QString, QString> objectModulesMap() const;
00088
00090 bool getWasSelected(void) const {return !lastSelectedObjects.empty();}
00091
00093 void unSelect(void);
00094
00099 bool setSelectedObject(const StelObjectP obj, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00100
00105 bool setSelectedObject(const QList<StelObjectP>& objs, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00106
00108 const QList<StelObjectP>& getSelectedObject() const {return lastSelectedObjects;}
00109
00112 QList<StelObjectP> getSelectedObject(const QString& type);
00113
00115 void setFlagSelectedObjectPointer(bool b) {objectPointerVisibility=b;}
00117 bool getFlagSelectedObjectPointer(void) {return objectPointerVisibility;}
00118
00120 StelObjectP searchByNameI18n(const QString &name) const;
00121
00123 StelObjectP searchByName(const QString &name) const;
00124
00126 void setObjectSearchRadius(float radius) {searchRadiusPixel=radius;}
00127
00130 void setDistanceWeight(float newDistanceWeight) {distanceWeight=newDistanceWeight;}
00131
00132 signals:
00135 void selectedObjectChanged(StelModule::StelModuleSelectAction action);
00136
00137 private:
00138
00139 QList<StelObjectModule*> objectsModule;
00140
00141 QList<StelObjectP> lastSelectedObjects;
00142
00143 bool objectPointerVisibility;
00144
00146 StelObjectP cleverFind(const StelCore* core, const Vec3d& pos) const;
00147
00149 StelObjectP cleverFind(const StelCore* core, int x, int y) const;
00150
00151
00152 float searchRadiusPixel;
00153
00154
00155 float distanceWeight;
00156 };
00157
00158 #endif // _SELECTIONMGR_HPP_