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
00037 class StelObjectMgr : public StelModule
00038 {
00039 public:
00040 StelObjectMgr();
00041 virtual ~StelObjectMgr();
00042
00044
00045 virtual void init() {;}
00046 virtual void draw(StelCore*) {;}
00047 virtual void update(double) {;}
00048
00052 void registerStelObjectMgr(StelObjectModule* mgr);
00053
00059 bool findAndSelect(const StelCore* core, const Vec3d& pos, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00060
00067 bool findAndSelect(const StelCore* core, int x, int y, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00068
00073 bool findAndSelectI18n(const QString &nameI18n, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00074
00079 bool findAndSelect(const QString &name, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00080
00085 QStringList listMatchingObjectsI18n(const QString& objPrefix, unsigned int maxNbItem=5) const;
00086
00088 bool getWasSelected(void) const {return !lastSelectedObjects.empty();}
00089
00091 void unSelect(void);
00092
00097 bool setSelectedObject(const StelObjectP obj, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00098
00103 bool setSelectedObject(const QList<StelObjectP>& objs, StelModule::StelModuleSelectAction action=StelModule::ReplaceSelection);
00104
00106 const QList<StelObjectP>& getSelectedObject() const {return lastSelectedObjects;}
00107
00110 QList<StelObjectP> getSelectedObject(const QString& type);
00111
00113 void setFlagSelectedObjectPointer(bool b) {objectPointerVisibility=b;}
00115 bool getFlagSelectedObjectPointer(void) {return objectPointerVisibility;}
00116
00118 StelObjectP searchByNameI18n(const QString &name) const;
00119
00121 StelObjectP searchByName(const QString &name) const;
00122
00124 void setObjectSearchRadius(float radius) {searchRadiusPixel=radius;}
00125
00128 void setDistanceWeight(float newDistanceWeight) {distanceWeight=newDistanceWeight;}
00129
00130 private:
00131
00132 QList<StelObjectModule*> objectsModule;
00133
00134 QList<StelObjectP> lastSelectedObjects;
00135
00136 bool objectPointerVisibility;
00137
00139 StelObjectP cleverFind(const StelCore* core, const Vec3d& pos) const;
00140
00142 StelObjectP cleverFind(const StelCore* core, int x, int y) const;
00143
00144
00145 float searchRadiusPixel;
00146
00147
00148 float distanceWeight;
00149 };
00150
00151 #endif // _SELECTIONMGR_HPP_