universe.h
上传用户:center1979
上传日期:2022-07-26
资源大小:50633k
文件大小:5k
源码类别:

OpenGL

开发平台:

Visual C++

  1. // universe.h
  2. //
  3. // Copyright (C) 2001, Chris Laurel <claurel@shatters.net>
  4. //
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the GNU General Public License
  7. // as published by the Free Software Foundation; either version 2
  8. // of the License, or (at your option) any later version.
  9. #ifndef _UNIVERSE_H_
  10. #define _UNIVERSE_H_
  11. #include <vector>
  12. #include <celmath/vecmath.h>
  13. #include <celmath/quaternion.h>
  14. #include <celengine/univcoord.h>
  15. #include <celengine/stardb.h>
  16. #include <celengine/dsodb.h>
  17. #include <celengine/solarsys.h>
  18. #include <celengine/deepskyobj.h>
  19. #include <celengine/asterism.h>
  20. #include <celengine/boundaries.h>
  21. #include <celengine/marker.h>
  22. #include <celengine/selection.h>
  23. class Universe
  24. {
  25.  public:
  26.     Universe();
  27.     ~Universe();
  28.     StarDatabase* getStarCatalog() const;
  29.     void setStarCatalog(StarDatabase*);
  30.     SolarSystemCatalog* getSolarSystemCatalog() const;
  31.     void setSolarSystemCatalog(SolarSystemCatalog*);
  32.     DSODatabase* getDSOCatalog() const;
  33.     void setDSOCatalog(DSODatabase*);
  34.     AsterismList* getAsterisms() const;
  35.     void setAsterisms(AsterismList*);
  36.     ConstellationBoundaries* getBoundaries() const;
  37.     void setBoundaries(ConstellationBoundaries*);
  38.     Selection pick(const UniversalCoord& origin,
  39.                    const Vec3f& direction,
  40.                    double when,
  41.                    int   renderFlags,
  42.                    float faintestMag,
  43.                    float tolerance = 0.0f);
  44.     Selection pickStar(const UniversalCoord& origin,
  45.                        const Vec3f& direction,
  46.                        double when,
  47.                        float faintest,
  48.                        float tolerance = 0.0f);
  49.     Selection pickDeepSkyObject(const UniversalCoord& origin,
  50.                                 const Vec3f& direction,
  51.                                 int   renderFlags,
  52.                                 float faintest,
  53.                                 float tolerance = 0.0f);
  54.     Selection find(const std::string& s,
  55.                    Selection* contexts = NULL,
  56.                    int nContexts = 0,
  57.                    bool i18n = false) const;
  58.     Selection findPath(const std::string& s,
  59.                        Selection* contexts = NULL,
  60.                        int nContexts = 0,
  61.                        bool i18n = false) const;
  62.     Selection findChildObject(const Selection& sel,
  63.                               const string& name,
  64.                               bool i18n = false) const;
  65.     Selection findObjectInContext(const Selection& sel,
  66.                                   const string& name,
  67.                                   bool i18n = false) const;
  68.     std::vector<std::string> getCompletion(const std::string& s,
  69.                                            Selection* contexts = NULL,
  70.                                            int nContexts = 0,
  71.                                            bool withLocations = false);
  72.     std::vector<std::string> getCompletionPath(const std::string& s,
  73.                                                Selection* contexts = NULL,
  74.                                                int nContexts = 0,
  75.                                                bool withLocations = false);
  76.     SolarSystem* getNearestSolarSystem(const UniversalCoord& position) const;
  77.     SolarSystem* getSolarSystem(const Star* star) const;
  78.     SolarSystem* getSolarSystem(const Selection&) const;
  79.     SolarSystem* createSolarSystem(Star* star) const;
  80.     void getNearStars(const UniversalCoord& position,
  81.                       float maxDistance,
  82.                       std::vector<const Star*>& stars) const;
  83.     void markObject(const Selection&,
  84.                     const MarkerRepresentation& rep,
  85.                     int priority,
  86.                     bool occludable = true,
  87.                     MarkerSizing sizing = ConstantSize);
  88.     void unmarkObject(const Selection&, int priority);
  89.     void unmarkAll();
  90.     bool isMarked(const Selection&, int priority) const;
  91.     MarkerList* getMarkers() const;
  92.  private:
  93.     Selection pickPlanet(SolarSystem& solarSystem,
  94.                          const UniversalCoord&,
  95.                          const Vec3f&,
  96.                          double when,
  97.                          float faintestMag,
  98.                          float tolerance);
  99.  private:
  100.     StarDatabase* starCatalog;
  101.     DSODatabase*             dsoCatalog;
  102.     SolarSystemCatalog* solarSystemCatalog;
  103.     AsterismList* asterisms;
  104.     ConstellationBoundaries* boundaries;
  105.     MarkerList* markers;
  106.     std::vector<const Star*> closeStars;
  107. };
  108. #endif // UNIVERSE_H_