1 /* 2 * Stellarium 3 * Copyright (C) 2010 Fabien Chereau 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 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. 18 */ 19 20 #ifndef TRAILGROUP_HPP 21 #define TRAILGROUP_HPP 22 23 #include "VecMath.hpp" 24 #include "StelCore.hpp" 25 #include "StelObjectType.hpp" 26 27 class StelPainter; 28 29 class TrailGroup 30 { 31 public: 32 TrailGroup(float atimeExtent, int maxPoints); 33 34 void draw(StelCore* core, StelPainter*); 35 36 // Add 1 point to all the curves at current time and remove too old points 37 void update(); 38 39 void addObject(const StelObjectP&, const Vec3f* col=Q_NULLPTR); 40 setOpacity(float op)41 void setOpacity(float op) {opacity=op;} 42 43 //! Reset (clear) all trails points, and set maximum trail length to keep up framerate 44 void reset(int maxPoints); 45 46 private: 47 class Trail 48 { 49 public: Trail(const StelObjectP & obj,const Vec3f & col)50 Trail(const StelObjectP& obj, const Vec3f& col) : stelObject(obj), color(col) {;} 51 StelObjectP stelObject; 52 // All previous positions 53 QList<Vec3d> posHistory; 54 Vec3f color; 55 }; 56 57 StelCore *core; 58 QList<Trail> allTrails; 59 60 // Maximum time extent in days 61 float timeExtent; 62 int maxPoints; //!< Limitation to avoid fps breakdown. 63 64 QList<float> times; 65 66 Mat4d j2000ToTrailNative; 67 Mat4d j2000ToTrailNativeInverted; 68 69 float opacity; 70 }; 71 72 #endif // TRAILMGR_HPP 73