Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/TrailGroup.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2010 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018  */
00019 
00020 #ifndef TRAILGROUP_HPP
00021 #define TRAILGROUP_HPP
00022 
00023 #include "VecMath.hpp"
00024 #include "StelCore.hpp"
00025 #include "StelObjectType.hpp"
00026 
00027 class StelPainter;
00028 
00029 class TrailGroup
00030 {
00031 public:
00032     TrailGroup(float atimeExtent);
00033 
00034     void draw(StelCore* core, StelPainter*);
00035 
00036     // Add 1 point to all the curves at current time and suppress too old points
00037     void update();
00038 
00039     // Set the matrix to use to post process J2000 positions before storing in the trail
00040     void setJ2000ToTrailNative(const Mat4d& m);
00041 
00042     void addObject(const StelObjectP&, const Vec3f* col=NULL);
00043 
00044     void setOpacity(float op) {opacity=op;}
00045 
00047     void reset();
00048 
00049 private:
00050     class Trail
00051     {
00052     public:
00053         Trail(const StelObjectP& obj, const Vec3f& col) : stelObject(obj), color(col) {;}
00054         StelObjectP stelObject;
00055         // All previous positions
00056         QList<Vec3d> posHistory;
00057         Vec3f color;
00058     };
00059 
00060     QList<Trail> allTrails;
00061 
00062     // Maximum time extent in days
00063     float timeExtent;
00064 
00065     QList<float> times;
00066 
00067     Mat4d j2000ToTrailNative;
00068     Mat4d j2000ToTrailNativeInverted;
00069 
00070     float opacity;
00071 };
00072 
00073 #endif // TRAILMGR_HPP