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

core/SphericalPolygon.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2009 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 _SPHERICALPOLYGON_HPP_
00021 #define _SPHERICALPOLYGON_HPP_
00022 
00023 #include <QVector>
00024 #include <QVariant>
00025 #include <QDebug>
00026 #include <QSharedPointer>
00027 #include <QVarLengthArray>
00028 #include "StelSphereGeometry.hpp"
00029 
00033 class SphericalPolygon : public SphericalRegion
00034 {
00035 public:
00038     enum PolyWindingRule
00039     {
00040         WindingPositive,    
00041         WindingAbsGeqTwo    
00042     };
00043 
00045     SphericalPolygon() {;}
00047     SphericalPolygon(const QVector<QVector<Vec3d> >& contours) {setContours(contours);}
00049     SphericalPolygon(const QVector<Vec3d>& contour) {setContour(contour);}
00050     SphericalPolygon(const OctahedronPolygon& octContour) : octahedronPolygon(octContour) {;}
00051 
00052     virtual SphericalRegionType getType() const {return SphericalRegion::Polygon;}
00053 
00058     virtual QVariantMap toQVariant() const;
00059 
00060     virtual OctahedronPolygon getOctahedronPolygon() const {return octahedronPolygon;}
00061 
00063     // Methods specific to SphericalPolygon
00065 
00070     virtual void setContours(const QVector<QVector<Vec3d> >& contours, SphericalPolygon::PolyWindingRule windingRule=SphericalPolygon::WindingPositive);
00071 
00074     virtual void setContour(const QVector<Vec3d>& contour);
00075 
00077     bool intersects(const AllSkySphericalRegion& poly) const {return true;}
00078     bool contains(const AllSkySphericalRegion& poly) const {return false;}
00079 
00080 private:
00081     OctahedronPolygon octahedronPolygon;
00082 };
00083 
00084 
00085 #endif // _SPHERICALPOLYGON_HPP_
00086 

Generated on Wed Jun 2 13:11:13 2010 for Stellarium by  doxygen 1.5.5