StelSphereGeometry.hpp   StelSphereGeometry.hpp 
skipping to change at line 102 skipping to change at line 102
//! @throws std::runtime_error when there was an error while parsing the file. //! @throws std::runtime_error when there was an error while parsing the file.
static SphericalRegionP loadFromJson(QIODevice* in); static SphericalRegionP loadFromJson(QIODevice* in);
//! Create a SphericalRegion from the given QByteArray containing th e JSON data. //! Create a SphericalRegion from the given QByteArray containing th e JSON data.
//! @see loadFromJson(QIODevice* in) for format info. //! @see loadFromJson(QIODevice* in) for format info.
static SphericalRegionP loadFromJson(const QByteArray& a); static SphericalRegionP loadFromJson(const QByteArray& a);
//! Create a SphericalRegion from the given QVariantMap with a forma t matching the JSON file parsed in loadFromJson(). //! Create a SphericalRegion from the given QVariantMap with a forma t matching the JSON file parsed in loadFromJson().
//! @param map a valid QVariantMap which can be created e.g. from pa rsing a JSON file with the StelJsonParser class. //! @param map a valid QVariantMap which can be created e.g. from pa rsing a JSON file with the StelJsonParser class.
static SphericalRegionP loadFromQVariant(const QVariantMap& map); static SphericalRegionP loadFromQVariant(const QVariantMap& map);
// It can only be a pure shape definition, without texture coords
static SphericalRegionP loadFromQVariant(const QVariantList& list); static SphericalRegionP loadFromQVariant(const QVariantList& list);
//! The QVariant type associated to a SphericalRegionP. //! Method registered to JSON serializer.
static const QVariant::Type qVariantType; static void serializeToJson(const QVariant& jsonObject, QIODevice* o
utput, int indentLevel=0);
//! The meta type ID associated to a SphericalRegionP. //! The meta type ID associated to a SphericalRegionP.
static int metaTypeId; static int metaTypeId;
private: private:
static QVector<QVector<Vec3d> > loadContourFromQVariant(const QVaria ntList& contoursList);
//! Initialize stuff to allow SphericalRegionP to be used with Qt me ta type system. //! Initialize stuff to allow SphericalRegionP to be used with Qt me ta type system.
static int initialize(); static int initialize();
}; };
// Allow to use SphericalRegionP with the Qt MetaType system. // Allow to use SphericalRegionP with the Qt MetaType system.
Q_DECLARE_METATYPE(SphericalRegionP); Q_DECLARE_METATYPE(SphericalRegionP);
//! Serialize the passed SphericalRegionP into a binary blob. //! Serialize the passed SphericalRegionP into a binary blob.
QDataStream& operator<<(QDataStream& out, const SphericalRegionP& region); QDataStream& operator<<(QDataStream& out, const SphericalRegionP& region);
skipping to change at line 183 skipping to change at line 183
//! @param margin the minimum enlargement margin in radian. //! @param margin the minimum enlargement margin in radian.
virtual SphericalRegionP getEnlarged(double margin) const; virtual SphericalRegionP getEnlarged(double margin) const;
//! Return an openGL compatible array to be displayed using vertex a rrays. //! Return an openGL compatible array to be displayed using vertex a rrays.
virtual StelVertexArray getFillVertexArray() const {return getOctahe dronPolygon().getFillVertexArray();} virtual StelVertexArray getFillVertexArray() const {return getOctahe dronPolygon().getFillVertexArray();}
//! Get the outline of the contours defining the SphericalPolygon. //! Get the outline of the contours defining the SphericalPolygon.
//! @return a list of vertex which taken 2 by 2 define the contours of the polygon. //! @return a list of vertex which taken 2 by 2 define the contours of the polygon.
virtual StelVertexArray getOutlineVertexArray() const {return getOct ahedronPolygon().getOutlineVertexArray();} virtual StelVertexArray getOutlineVertexArray() const {return getOct ahedronPolygon().getOutlineVertexArray();}
//! Serialize the region into a QVariant map matching the JSON forma //! Get the contours defining the SphericalPolygon when combined usi
t. ng a positive winding rule.
virtual QVariantMap toQVariant() const = 0; //! The default implementation return a list of tesselated triangles
derived from the OctahedronPolygon.
virtual QVector<QVector<Vec3d > > getSimplifiedContours() const;
//! Serialize the region into a QVariant list matching the JSON form
at.
virtual QVariantList toQVariant() const = 0;
//! Serialize the region. This method must allow as fast as possible serialization and work with deserialize(). //! Serialize the region. This method must allow as fast as possible serialization and work with deserialize().
virtual void serialize(QDataStream& out) const = 0; virtual void serialize(QDataStream& out) const = 0;
//! Output a JSON string representing the polygon. //! Output a JSON string representing the polygon.
//! This method is convenient for debugging. //! This method is convenient for debugging.
QByteArray toJSON() const; QByteArray toJSON() const;
//! Returns whether a SphericalRegion is contained into this region. //! Returns whether a SphericalRegion is contained into this region.
//! A default potentially very slow implementation is provided for e ach cases. //! A default potentially very slow implementation is provided for e ach cases.
skipping to change at line 317 skipping to change at line 321
//! I managed to make it without sqrt or acos, so it is very fast! //! I managed to make it without sqrt or acos, so it is very fast!
//! @see http://f4bien.blogspot.com/2009/05/spherical-geometry-optim isations.html for detailed explanations. //! @see http://f4bien.blogspot.com/2009/05/spherical-geometry-optim isations.html for detailed explanations.
virtual bool intersects(const SphericalCap& h) const virtual bool intersects(const SphericalCap& h) const
{ {
const double a = d*h.d - n*h.n; const double a = d*h.d - n*h.n;
return d+h.d<=0. || a<=0. || (a<=1. && a*a <= (1.-d*d)*(1.-h .d*h.d)); return d+h.d<=0. || a<=0. || (a<=1. && a*a <= (1.-d*d)*(1.-h .d*h.d));
} }
virtual bool intersects(const AllSkySphericalRegion&) const {return d<=1.;} virtual bool intersects(const AllSkySphericalRegion&) const {return d<=1.;}
//! Serialize the region into a QVariant map matching the JSON forma t. //! Serialize the region into a QVariant map matching the JSON forma t.
//! The format is {"type": "CAP", "center": [ra, dec], "radius": rad ius}, with ra dec in degree in ICRS frame //! The format is ["CAP", [ra, dec], radius], with ra dec in degree in ICRS frame
//! and radius in degree (between 0 and 180 deg) //! and radius in degree (between 0 and 180 deg)
virtual QVariantMap toQVariant() const; virtual QVariantList toQVariant() const;
virtual void serialize(QDataStream& out) const {out << n << d;} virtual void serialize(QDataStream& out) const {out << n << d;}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Methods specific to SphericalCap // Methods specific to SphericalCap
//! Return the radiusof the cap in radian //! Return the radiusof the cap in radian
double getRadius() const {return std::acos(d);} double getRadius() const {return std::acos(d);}
//! Returns whether a HalfSpace (like a SphericalCap with d=0) inter sects with this SphericalCap. //! Returns whether a HalfSpace (like a SphericalCap with d=0) inter sects with this SphericalCap.
skipping to change at line 421 skipping to change at line 425
SphericalPoint(const Vec3d& an) : n(an) {Q_ASSERT(std::fabs(1.-n.len gth())<0.0000001);} SphericalPoint(const Vec3d& an) : n(an) {Q_ASSERT(std::fabs(1.-n.len gth())<0.0000001);}
virtual ~SphericalPoint() {;} virtual ~SphericalPoint() {;}
virtual SphericalRegionType getType() const {return SphericalRegion: :Point;} virtual SphericalRegionType getType() const {return SphericalRegion: :Point;}
virtual OctahedronPolygon getOctahedronPolygon() const; virtual OctahedronPolygon getOctahedronPolygon() const;
virtual double getArea() const {return 0.;} virtual double getArea() const {return 0.;}
virtual bool isEmpty() const {return false;} virtual bool isEmpty() const {return false;}
virtual Vec3d getPointInside() const {return n;} virtual Vec3d getPointInside() const {return n;}
virtual SphericalCap getBoundingCap() const {return SphericalCap(n, 1);} virtual SphericalCap getBoundingCap() const {return SphericalCap(n, 1);}
//! Serialize the region into a QVariant map matching the JSON forma t. //! Serialize the region into a QVariant map matching the JSON forma t.
//! The format is {"type": "POINT", "pos": [ra, dec]}, with ra dec i //! The format is ["POINT", [ra, dec]], with ra dec in degree in ICR
n degree in ICRS frame. S frame.
virtual QVariantMap toQVariant() const; virtual QVariantList toQVariant() const;
virtual void serialize(QDataStream& out) const {out << n;} virtual void serialize(QDataStream& out) const {out << n;}
// Contain and intersect // Contain and intersect
virtual bool contains(const Vec3d& p) const {return n==p;} virtual bool contains(const Vec3d& p) const {return n==p;}
virtual bool contains(const SphericalPolygon&) const {return false;} virtual bool contains(const SphericalPolygon&) const {return false;}
virtual bool contains(const SphericalConvexPolygon&) const {return f alse;} virtual bool contains(const SphericalConvexPolygon&) const {return f alse;}
virtual bool contains(const SphericalCap&) const {return false;} virtual bool contains(const SphericalCap&) const {return false;}
virtual bool contains(const SphericalPoint& r) const {return n==r.n; } virtual bool contains(const SphericalPoint& r) const {return n==r.n; }
virtual bool contains(const AllSkySphericalRegion&) const {return fa lse;} virtual bool contains(const AllSkySphericalRegion&) const {return fa lse;}
virtual bool intersects(const SphericalPolygon&) const; virtual bool intersects(const SphericalPolygon&) const;
skipping to change at line 459 skipping to change at line 463
public: public:
virtual ~AllSkySphericalRegion() {;} virtual ~AllSkySphericalRegion() {;}
virtual SphericalRegionType getType() const {return SphericalRegion: :AllSky;} virtual SphericalRegionType getType() const {return SphericalRegion: :AllSky;}
virtual OctahedronPolygon getOctahedronPolygon() const {return Octah edronPolygon::getAllSkyOctahedronPolygon();} virtual OctahedronPolygon getOctahedronPolygon() const {return Octah edronPolygon::getAllSkyOctahedronPolygon();}
virtual double getArea() const {return 4.*M_PI;} virtual double getArea() const {return 4.*M_PI;}
virtual bool isEmpty() const {return false;} virtual bool isEmpty() const {return false;}
virtual Vec3d getPointInside() const {return Vec3d(1,0,0);} virtual Vec3d getPointInside() const {return Vec3d(1,0,0);}
virtual SphericalCap getBoundingCap() const {return SphericalCap(Vec 3d(1,0,0), -2);} virtual SphericalCap getBoundingCap() const {return SphericalCap(Vec 3d(1,0,0), -2);}
//! Serialize the region into a QVariant map matching the JSON forma t. //! Serialize the region into a QVariant map matching the JSON forma t.
//! The format is {"type": "ALLSKY"} //! The format is ["ALLSKY"]
virtual QVariantMap toQVariant() const; virtual QVariantList toQVariant() const;
virtual void serialize(QDataStream&) const {;} virtual void serialize(QDataStream&) const {;}
// Contain and intersect // Contain and intersect
virtual bool contains(const Vec3d&) const {return true;} virtual bool contains(const Vec3d&) const {return true;}
virtual bool contains(const SphericalPolygon&) const {return true;} virtual bool contains(const SphericalPolygon&) const {return true;}
virtual bool contains(const SphericalConvexPolygon&) const {return t rue;} virtual bool contains(const SphericalConvexPolygon&) const {return t rue;}
virtual bool contains(const SphericalCap&) const {return true;} virtual bool contains(const SphericalCap&) const {return true;}
virtual bool contains(const SphericalPoint&) const {return true;} virtual bool contains(const SphericalPoint&) const {return true;}
virtual bool contains(const AllSkySphericalRegion&) const {return tr ue;} virtual bool contains(const AllSkySphericalRegion&) const {return tr ue;}
virtual bool intersects(const SphericalPolygon&) const {return true; } virtual bool intersects(const SphericalPolygon&) const {return true; }
skipping to change at line 501 skipping to change at line 505
EmptySphericalRegion() {;} EmptySphericalRegion() {;}
virtual ~EmptySphericalRegion() {;} virtual ~EmptySphericalRegion() {;}
virtual SphericalRegionType getType() const {return SphericalRegion: :Empty;} virtual SphericalRegionType getType() const {return SphericalRegion: :Empty;}
virtual OctahedronPolygon getOctahedronPolygon() const {return Octah edronPolygon::getEmptyOctahedronPolygon();} virtual OctahedronPolygon getOctahedronPolygon() const {return Octah edronPolygon::getEmptyOctahedronPolygon();}
virtual double getArea() const {return 0.;} virtual double getArea() const {return 0.;}
virtual bool isEmpty() const {return true;} virtual bool isEmpty() const {return true;}
virtual Vec3d getPointInside() const {return Vec3d(1,0,0);} virtual Vec3d getPointInside() const {return Vec3d(1,0,0);}
virtual SphericalCap getBoundingCap() const {return SphericalCap(Vec 3d(1,0,0), 2);} virtual SphericalCap getBoundingCap() const {return SphericalCap(Vec 3d(1,0,0), 2);}
//! Serialize the region into a QVariant map matching the JSON forma t. //! Serialize the region into a QVariant map matching the JSON forma t.
//! The format is {"type": "EMPTY"} //! The format is ["EMPTY"]
virtual QVariantMap toQVariant() const; virtual QVariantList toQVariant() const;
virtual void serialize(QDataStream&) const {;} virtual void serialize(QDataStream&) const {;}
// Contain and intersect // Contain and intersect
virtual bool contains(const Vec3d&) const {return false;} virtual bool contains(const Vec3d&) const {return false;}
virtual bool contains(const SphericalPolygon&) const {return false;} virtual bool contains(const SphericalPolygon&) const {return false;}
virtual bool contains(const SphericalConvexPolygon&) const {return f alse;} virtual bool contains(const SphericalConvexPolygon&) const {return f alse;}
virtual bool contains(const SphericalCap&) const {return false;} virtual bool contains(const SphericalCap&) const {return false;}
virtual bool contains(const SphericalPoint&) const {return false;} virtual bool contains(const SphericalPoint&) const {return false;}
virtual bool contains(const AllSkySphericalRegion&) const {return fa lse;} virtual bool contains(const AllSkySphericalRegion&) const {return fa lse;}
virtual bool intersects(const SphericalPolygon&) const {return false ;} virtual bool intersects(const SphericalPolygon&) const {return false ;}
skipping to change at line 546 skipping to change at line 550
SphericalPolygon(const QVector<QVector<Vec3d> >& contours) : octahed ronPolygon(contours) {;} SphericalPolygon(const QVector<QVector<Vec3d> >& contours) : octahed ronPolygon(contours) {;}
//! Constructor from one contour. //! Constructor from one contour.
SphericalPolygon(const QVector<Vec3d>& contour) : octahedronPolygon( contour) {;} SphericalPolygon(const QVector<Vec3d>& contour) : octahedronPolygon( contour) {;}
SphericalPolygon(const OctahedronPolygon& octContour) : octahedronPo lygon(octContour) {;} SphericalPolygon(const OctahedronPolygon& octContour) : octahedronPo lygon(octContour) {;}
SphericalPolygon(const QList<OctahedronPolygon>& octContours) : octa hedronPolygon(octContours) {;} SphericalPolygon(const QList<OctahedronPolygon>& octContours) : octa hedronPolygon(octContours) {;}
virtual SphericalRegionType getType() const {return SphericalRegion: :Polygon;} virtual SphericalRegionType getType() const {return SphericalRegion: :Polygon;}
virtual OctahedronPolygon getOctahedronPolygon() const {return octah edronPolygon;} virtual OctahedronPolygon getOctahedronPolygon() const {return octah edronPolygon;}
//! Serialize the region into a QVariant map matching the JSON forma t. //! Serialize the region into a QVariant map matching the JSON forma t.
//! The format is //! The format is:
//! @code["worldCoords": [[[ra,dec], [ra,dec], [ra,dec], [ra,dec]], //! @code[[[ra,dec], [ra,dec], [ra,dec], [ra,dec]], [[ra,dec], [ra,d
[[ra,dec], [ra,dec], [ra,dec]],[...]]]@endcode ec], [ra,dec]],[...]]@endcode
//! worldCoords is a list of closed contours, with each points defin //! it is a list of closed contours, with each points defined by ra
ed by ra dec in degree in the ICRS frame. dec in degree in the ICRS frame.
virtual QVariantMap toQVariant() const; virtual QVariantList toQVariant() const;
virtual void serialize(QDataStream& out) const; virtual void serialize(QDataStream& out) const;
virtual SphericalCap getBoundingCap() const; virtual SphericalCap getBoundingCap() const;
virtual bool contains(const Vec3d& p) const {return octahedronPolygo n.contains(p);} virtual bool contains(const Vec3d& p) const {return octahedronPolygo n.contains(p);}
virtual bool contains(const SphericalPolygon& r) const {return octah edronPolygon.contains(r.octahedronPolygon);} virtual bool contains(const SphericalPolygon& r) const {return octah edronPolygon.contains(r.octahedronPolygon);}
virtual bool contains(const SphericalConvexPolygon& r) const; virtual bool contains(const SphericalConvexPolygon& r) const;
virtual bool contains(const SphericalCap& r) const {return octahedro nPolygon.contains(r.getOctahedronPolygon());} virtual bool contains(const SphericalCap& r) const {return octahedro nPolygon.contains(r.getOctahedronPolygon());}
virtual bool contains(const SphericalPoint& r) const {return octahed ronPolygon.contains(r.n);} virtual bool contains(const SphericalPoint& r) const {return octahed ronPolygon.contains(r.n);}
virtual bool contains(const AllSkySphericalRegion& r) const {return octahedronPolygon.contains(r.getOctahedronPolygon());} virtual bool contains(const AllSkySphericalRegion& r) const {return octahedronPolygon.contains(r.getOctahedronPolygon());}
skipping to change at line 594 skipping to change at line 598
//! @param contour a contour defining the polygon area. //! @param contour a contour defining the polygon area.
void setContour(const QVector<Vec3d>& contour) {octahedronPolygon = OctahedronPolygon(contour);} void setContour(const QVector<Vec3d>& contour) {octahedronPolygon = OctahedronPolygon(contour);}
//! Return the list of closed contours defining the polygon boundari es. //! Return the list of closed contours defining the polygon boundari es.
QVector<QVector<Vec3d> > getClosedOutlineContours() const {Q_ASSERT( 0); return QVector<QVector<Vec3d> >();} QVector<QVector<Vec3d> > getClosedOutlineContours() const {Q_ASSERT( 0); return QVector<QVector<Vec3d> >();}
//! Deserialize the region. This method must allow as fast as possib le deserialization. //! Deserialize the region. This method must allow as fast as possib le deserialization.
static SphericalRegionP deserialize(QDataStream& in); static SphericalRegionP deserialize(QDataStream& in);
//! Create a new SphericalRegionP which is the union of all the pass ed ones. //! Create a new SphericalRegionP which is the union of all the pass ed ones.
static SphericalRegionP multiUnion(const QList<SphericalRegionP>& re static SphericalRegionP multiUnion(const QList<SphericalRegionP>& re
gions); gions, bool optimizeByPreGrouping=false);
//! Create a new SphericalRegionP which is the intersection of all t
he passed ones.
static SphericalRegionP multiIntersection(const QList<SphericalRegio
nP>& regions);
private: private:
OctahedronPolygon octahedronPolygon; OctahedronPolygon octahedronPolygon;
}; };
//! @class SphericalConvexPolygon //! @class SphericalConvexPolygon
//! A special case of SphericalPolygon for which the polygon is convex. //! A special case of SphericalPolygon for which the polygon is convex.
class SphericalConvexPolygon : public SphericalRegion class SphericalConvexPolygon : public SphericalRegion
{ {
public: public:
skipping to change at line 632 skipping to change at line 639
virtual OctahedronPolygon getOctahedronPolygon() const {return Octah edronPolygon(contour);} virtual OctahedronPolygon getOctahedronPolygon() const {return Octah edronPolygon(contour);}
virtual StelVertexArray getFillVertexArray() const {return StelVerte xArray(contour, StelVertexArray::TriangleFan);} virtual StelVertexArray getFillVertexArray() const {return StelVerte xArray(contour, StelVertexArray::TriangleFan);}
virtual StelVertexArray getOutlineVertexArray() const {return StelVe rtexArray(contour, StelVertexArray::LineLoop);} virtual StelVertexArray getOutlineVertexArray() const {return StelVe rtexArray(contour, StelVertexArray::LineLoop);}
virtual double getArea() const; virtual double getArea() const;
virtual bool isEmpty() const {return contour.isEmpty();} virtual bool isEmpty() const {return contour.isEmpty();}
virtual Vec3d getPointInside() const; virtual Vec3d getPointInside() const;
virtual SphericalCap getBoundingCap() const {return cachedBoundingCa p;} virtual SphericalCap getBoundingCap() const {return cachedBoundingCa p;}
QVector<SphericalCap> getBoundingSphericalCaps() const; QVector<SphericalCap> getBoundingSphericalCaps() const;
//! Serialize the region into a QVariant map matching the JSON forma t. //! Serialize the region into a QVariant map matching the JSON forma t.
//! The format is //! The format is
//! @code{"type": "CVXPOLYGON", "worldCoords": [[[ra,dec], [ra,dec], //! @code["CONVEX_POLYGON", [[ra,dec], [ra,dec], [ra,dec], [ra,dec]]
[ra,dec], [ra,dec]], [[ra,dec], [ra,dec], [ra,dec]],[...]]}@endcode ]@endcode
//! worldCoords is a list of closed contours, with each points defin //! where the coords are a closed convex contour, with each points d
ed by ra dec in degree in the ICRS frame. efined by ra dec in degree in the ICRS frame.
virtual QVariantMap toQVariant() const; virtual QVariantList toQVariant() const;
virtual void serialize(QDataStream& out) const {out << contour;} virtual void serialize(QDataStream& out) const {out << contour;}
// Contain and intersect // Contain and intersect
virtual bool contains(const Vec3d& p) const; virtual bool contains(const Vec3d& p) const;
virtual bool contains(const SphericalPolygon& r) const; virtual bool contains(const SphericalPolygon& r) const;
virtual bool contains(const SphericalConvexPolygon& r) const; virtual bool contains(const SphericalConvexPolygon& r) const;
virtual bool contains(const SphericalCap& r) const; virtual bool contains(const SphericalCap& r) const;
virtual bool contains(const SphericalPoint& r) const {return contain s(r.n);} virtual bool contains(const SphericalPoint& r) const {return contain s(r.n);}
virtual bool contains(const AllSkySphericalRegion&) const {return fa lse;} virtual bool contains(const AllSkySphericalRegion&) const {return fa lse;}
virtual bool intersects(const SphericalCap& r) const {if (!cachedBou ndingCap.intersects(r)) return false; return r.intersects(*this);} virtual bool intersects(const SphericalCap& r) const {if (!cachedBou ndingCap.intersects(r)) return false; return r.intersects(*this);}
skipping to change at line 712 skipping to change at line 719
//! Computes whether the passed points are all outside of at least o ne SphericalCap defining the polygon boundary. //! Computes whether the passed points are all outside of at least o ne SphericalCap defining the polygon boundary.
bool areAllPointsOutsideOneSide(const QVector<Vec3d>& points) const bool areAllPointsOutsideOneSide(const QVector<Vec3d>& points) const
{ {
return areAllPointsOutsideOneSide(contour.constData(), conto ur.size(), points.constData(), points.size()); return areAllPointsOutsideOneSide(contour.constData(), conto ur.size(), points.constData(), points.size());
} }
bool containsConvexContour(const Vec3d* vertice, int nbVertex) const ; bool containsConvexContour(const Vec3d* vertice, int nbVertex) const ;
}; };
//! @class SphericalConvexPolygonSet
//! A special case of SphericalPolygon for which the polygon is composed of
disjoint convex polygons.
//class SphericalConvexPolygonSet : public SphericalRegion
//{
//public:
// // Avoid name hiding when overloading the virtual methods.
// using SphericalRegion::intersects;
// using SphericalRegion::contains;
//
// //! Default constructor.
// SphericalConvexPolygonSet() {;}
//
// //! Constructor from a list of contours.
// SphericalConvexPolygonSet(const QVector<QVector<Vec3d> >& contours);
//
// virtual SphericalRegionType getType() const {return SphericalRegion:
:ConvexPolygonSet;}
// virtual OctahedronPolygon getOctahedronPolygon() const;
// virtual StelVertexArray getFillVertexArray() const;
// virtual StelVertexArray getOutlineVertexArray() const;
// virtual double getArea() const;
// virtual bool isEmpty() const;
// virtual Vec3d getPointInside() const;
// virtual SphericalCap getBoundingCap() const {return cachedBoundingCa
p;}
// QVector<SphericalCap> getBoundingSphericalCaps() const;
// //! Serialize the region into a QVariant map matching the JSON forma
t.
// //! The format is
// //! @code["CONVEX_POLYGON_SET", [[ra,dec], [ra,dec], [ra,dec], [ra,d
ec]], [[ra,dec], [ra,dec], [ra,dec], [ra,dec]]]@endcode
// //! where the coords from a list of closed convex contour, with each
points defined by ra dec in degree in the ICRS frame.
// virtual QVariantList toQVariant() const;
// virtual void serialize(QDataStream& out) const;
//
// // Contain and intersect
// virtual bool contains(const Vec3d& p) const;
// virtual bool contains(const SphericalPolygon& r) const;
// virtual bool contains(const SphericalConvexPolygon& r) const;
// virtual bool contains(const SphericalCap& r) const;
// virtual bool contains(const SphericalPoint& r) const {return contain
s(r.n);}
// virtual bool contains(const AllSkySphericalRegion&) const {return fa
lse;}
// virtual bool intersects(const SphericalCap& r) const {if (!cachedBou
ndingCap.intersects(r)) return false; return r.intersects(*this);}
// virtual bool intersects(const SphericalPolygon& r) const;
// virtual bool intersects(const SphericalConvexPolygon& r) const;
// virtual bool intersects(const SphericalPoint& r) const {return conta
ins(r.n);}
// virtual bool intersects(const AllSkySphericalRegion&) const {return
true;}
//
// ////////////////////////////////////////////////////////////////////
// // Methods specific to SphericalConvexPolygonSet
// ////////////////////////////////////////////////////////////////////
// //! Deserialize the region. This method must allow as fast as possib
le deserialization.
// static SphericalRegionP deserialize(QDataStream& in);
//
//protected:
// QVector<SphericalConvexPolygon> contours;
//
// //! Cache the bounding cap.
// SphericalCap cachedBoundingCap;
//
// //! Update the bounding cap from the vertex list.
// void updateBoundingCap();
//};
//! @class SphericalTexturedPolygon //! @class SphericalTexturedPolygon
//! An extension of SphericalPolygon with addition of texture coordinates. //! An extension of SphericalPolygon with addition of texture coordinates.
class SphericalTexturedPolygon : public SphericalPolygon class SphericalTexturedPolygon : public SphericalPolygon
{ {
public: public:
//! @struct TextureVertex //! @struct TextureVertex
//! A container for 3D vertex + associated texture coordinates //! A container for 3D vertex + associated texture coordinates
struct TextureVertex struct TextureVertex
{ {
Vec3d vertex; Vec3d vertex;
skipping to change at line 735 skipping to change at line 802
SphericalTexturedPolygon() {;} SphericalTexturedPolygon() {;}
//! Constructor from a list of contours. //! Constructor from a list of contours.
SphericalTexturedPolygon(const QVector<QVector<TextureVertex> >& con tours) {Q_UNUSED(contours); Q_ASSERT(0);} SphericalTexturedPolygon(const QVector<QVector<TextureVertex> >& con tours) {Q_UNUSED(contours); Q_ASSERT(0);}
//! Constructor from one contour. //! Constructor from one contour.
SphericalTexturedPolygon(const QVector<TextureVertex>& contour) {Q_U NUSED(contour); Q_ASSERT(0);} SphericalTexturedPolygon(const QVector<TextureVertex>& contour) {Q_U NUSED(contour); Q_ASSERT(0);}
//! Return an openGL compatible array of texture coords to be used u sing vertex arrays. //! Return an openGL compatible array of texture coords to be used u sing vertex arrays.
virtual StelVertexArray getFillVertexArray() const {Q_ASSERT(0); ret urn StelVertexArray();} virtual StelVertexArray getFillVertexArray() const {Q_ASSERT(0); ret urn StelVertexArray();}
//! Serialize the region into a QVariant map matching the JSON forma t. //! Serialize the region into a QVariant map matching the JSON forma t.
//! The format is: //! The format is:
//! @code{"worldCoords": [[[ra,dec], [ra,dec], [ra,dec], [ra,dec]], //! @code["TEXTURED_POLYGON", [[[ra,dec], [ra,dec], [ra,dec], [ra,de
[[ra,dec], [ra,dec], [ra,dec]],[...]], c]], [[ra,dec], [ra,dec], [ra,dec]],[...]],
//! "textureCoords": [[[u,v],[u,v],[u,v],[u,v]], [[u,v],[u,v],[u,v]] //! [[[u,v],[u,v],[u,v],[u,v]], [[u,v],[u,v],[u,v]], [...]]]@endcode
, [...]] //! where the two lists are a list of closed contours, with each poi
//! }@endcode nts defined by ra dec in degree in the ICRS frame
//! textureCoords is a list of texture coordinates in the u,v textur //! followed by a list of texture coordinates in the u,v texture spa
e space (between 0 and 1). ce (between 0 and 1).
//! worldCoords is a list of closed contours, with each points defin
ed by ra dec in degree in the ICRS frame.
//! There must be one texture coordinate for each vertex. //! There must be one texture coordinate for each vertex.
virtual QVariantMap toQVariant() const; virtual QVariantList toQVariant() const;
virtual void serialize(QDataStream& out) const {Q_UNUSED(out); Q_ASS ERT(0);} virtual void serialize(QDataStream& out) const {Q_UNUSED(out); Q_ASS ERT(0);}
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Methods specific to SphericalTexturedPolygon // Methods specific to SphericalTexturedPolygon
//! Set the contours defining the SphericalPolygon. //! Set the contours defining the SphericalPolygon.
//! @param contours the list of contours defining the polygon area u sing the WindingPositive winding rule. //! @param contours the list of contours defining the polygon area u sing the WindingPositive winding rule.
void setContours(const QVector<QVector<TextureVertex> >& contours) { Q_UNUSED(contours); Q_ASSERT(0);} void setContours(const QVector<QVector<TextureVertex> >& contours) { Q_UNUSED(contours); Q_ASSERT(0);}
//! Set a single contour defining the SphericalPolygon. //! Set a single contour defining the SphericalPolygon.
//! @param contour a contour defining the polygon area. //! @param contour a contour defining the polygon area.
skipping to change at line 791 skipping to change at line 857
//! This method is not optimized for SphericalConvexPolygon instance s. //! This method is not optimized for SphericalConvexPolygon instance s.
virtual StelVertexArray getFillVertexArray() const {return StelVerte xArray(contour, StelVertexArray::TriangleFan, textureCoords);} virtual StelVertexArray getFillVertexArray() const {return StelVerte xArray(contour, StelVertexArray::TriangleFan, textureCoords);}
//! Set a single contour defining the SphericalPolygon. //! Set a single contour defining the SphericalPolygon.
//! @param acontour a contour defining the polygon area. //! @param acontour a contour defining the polygon area.
//! @param texCoord a list of texture coordinates matching the verti ces of the contour. //! @param texCoord a list of texture coordinates matching the verti ces of the contour.
virtual void setContour(const QVector<Vec3d>& acontour, const QVecto r<Vec2f>& texCoord) {SphericalConvexPolygon::setContour(acontour); textureC oords=texCoord;} virtual void setContour(const QVector<Vec3d>& acontour, const QVecto r<Vec2f>& texCoord) {SphericalConvexPolygon::setContour(acontour); textureC oords=texCoord;}
//! Serialize the region into a QVariant map matching the JSON forma t. //! Serialize the region into a QVariant map matching the JSON forma t.
//! The format is: //! The format is:
//! @code{"type": "CVXPOLYGON", "worldCoords": [[[ra,dec], [ra,dec], //! @code["TEXTURED_CONVEX_POLYGON", [[ra,dec], [ra,dec], [ra,dec],
[ra,dec], [ra,dec]], [[ra,dec], [ra,dec], [ra,dec]],[...]], [ra,dec]], [[u,v],[u,v],[u,v],[u,v]]]@endcode
//! "textureCoords": [[[u,v],[u,v],[u,v],[u,v]], [[u,v],[u,v],[u,v]] //! where the two lists are a closed convex contours, with each poin
, [...]] ts defined by ra dec in degree in the ICRS frame
//! }@endcode //! followed by a list of texture coordinates in the u,v texture spa
//! textureCoords is a list of texture coordinates in the u,v textur ce (between 0 and 1).
e space (between 0 and 1).
//! worldCoords is a list of closed contours, with each points defin
ed by ra dec in degree in the ICRS frame.
//! There must be one texture coordinate for each vertex. //! There must be one texture coordinate for each vertex.
virtual QVariantMap toQVariant() const; virtual QVariantList toQVariant() const;
virtual void serialize(QDataStream& out) const {out << contour << te xtureCoords;} virtual void serialize(QDataStream& out) const {out << contour << te xtureCoords;}
protected: protected:
//! A list of uv textures coordinates corresponding to the triangle vertices. //! A list of uv textures coordinates corresponding to the triangle vertices.
//! There should be 1 uv position per vertex. //! There should be 1 uv position per vertex.
QVector<Vec2f> textureCoords; QVector<Vec2f> textureCoords;
}; };
//! Compute the intersection of 2 great circles segments. //! Compute the intersection of 2 great circles segments.
 End of changes. 17 change blocks. 
48 lines changed or deleted 127 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/