Stellarium 0.15.2
List of all members | Public Member Functions | Static Public Member Functions | Static Public Attributes
SphericalRegionP Class Reference

A shared pointer on a SphericalRegion. More...

#include <StelSphereGeometry.hpp>

+ Inheritance diagram for SphericalRegionP:
+ Collaboration diagram for SphericalRegionP:

Public Member Functions

 SphericalRegionP (SphericalRegion *ptr)
 
template<class Deleter >
 SphericalRegionP (SphericalRegion *ptr, Deleter deleter)
 
 SphericalRegionP (const SphericalRegionP &other)
 
 SphericalRegionP (const QWeakPointer< SphericalRegion > &other)
 

Static Public Member Functions

static SphericalRegionP loadFromJson (QIODevice *in)
 Create a SphericalRegion from the given input JSON stream. More...
 
static SphericalRegionP loadFromJson (const QByteArray &a)
 Create a SphericalRegion from the given QByteArray containing the JSON data. More...
 
static SphericalRegionP loadFromQVariant (const QVariantMap &map)
 Create a SphericalRegion from the given QVariantMap with a format matching the JSON file parsed in loadFromJson(). More...
 
static SphericalRegionP loadFromQVariant (const QVariantList &list)
 
static void serializeToJson (const QVariant &jsonObject, QIODevice *output, int indentLevel=0)
 Method registered to JSON serializer. More...
 

Static Public Attributes

static int metaTypeId
 The meta type ID associated to a SphericalRegionP. More...
 

Detailed Description

A shared pointer on a SphericalRegion.

Definition at line 49 of file StelSphereGeometry.hpp.

Member Function Documentation

static SphericalRegionP SphericalRegionP::loadFromJson ( QIODevice *  in)
static

Create a SphericalRegion from the given input JSON stream.

The type of the region is automatically recognized from the input format. The currently recognized format are:

  • Contour list:
    [[contour1], [contour2],[...]]
    This format consists of a list of contours. Contours defined in counterclockwise direction (CW) are added to the final region while CCW contours are subtracted (they can be used to form complex polygons even with holes). Each contour can have different format:
    • [[ra,dec], [ra,dec], [ra,dec], [ra,dec]]
      A list of points connected by great circles with the last point connected to the first one. Each point is defined by its ra,dec coordinates in degrees.
    • ["CAP", [raCenter,decCenter], ap]
      A spherical cap centered on raCenter/decCenter with aperture radius ap in degrees. For example:
      ["CAP", [0.,-90.], 90]
      define the region covering the entire southern hemisphere.
    • ["PATH", [startRa,startDec], [[prim1],[prim2],[prim3],...]]
      A path is a contour starting a startRa/startDec and defined by a list of primitives. Each primitive can be either a great circle or a small circle. Great circles are defined by the point to link to: ["greatCircleTo", [ra,dec]]. Small circles are defined by a rotation axis and a rotation angle: ["smallCircle",[0,90],-88]. A full example is:
      ["PATH",[330,-25],[["smallCircle",[0,90],82.5],["greatCircleTo",[52.5,-35]],["smallCircle",[0,90],-82.5]]]
      This defines a box of 82.5x10 degrees following latitude and longitude lines.
  • Polygon vertex list with associated texture coordinates:
    {
    "worldCoords": [[[ra,dec],[ra,dec],[ra,dec],[ra,dec]], [[ra,dec],[ra,dec],[ra,dec]],[...]],
    "textureCoords": [[[u,v],[u,v],[u,v],[u,v]], [[u,v],[u,v],[u,v]], [...]]
    }
    The format is used to describe textured polygons. The worldCoords part is similar to the one described above. The textureCoords part is the addition of a list of texture coordinates in the u,v texture space (between 0 and 1). There must be one texture coordinate for each vertex.
Parameters
inan open QIODevice ready for read.
Exceptions
std::runtime_errorwhen there was an error while parsing the file.
static SphericalRegionP SphericalRegionP::loadFromJson ( const QByteArray &  a)
static

Create a SphericalRegion from the given QByteArray containing the JSON data.

See also
loadFromJson(QIODevice* in) for format info.
static SphericalRegionP SphericalRegionP::loadFromQVariant ( const QVariantMap &  map)
static

Create a SphericalRegion from the given QVariantMap with a format matching the JSON file parsed in loadFromJson().

Parameters
mapa valid QVariantMap which can be created e.g. from parsing a JSON file with the StelJsonParser class.
static void SphericalRegionP::serializeToJson ( const QVariant &  jsonObject,
QIODevice *  output,
int  indentLevel = 0 
)
static

Method registered to JSON serializer.

Member Data Documentation

int SphericalRegionP::metaTypeId
static

The meta type ID associated to a SphericalRegionP.

Definition at line 113 of file StelSphereGeometry.hpp.


The documentation for this class was generated from the following file: