moved kdeaccessibility kdeaddons kdeadmin kdeartwork kdebindings kdeedu kdegames...
[kdeedu.git] / kstars / kstars / csegment.h
blob0adb2af901cedb2ace6c243cd838e92331ccd93d
1 /***************************************************************************
2 csegment.h - K Desktop Planetarium
3 -------------------
4 begin : Sun Feb 1 2004
5 copyright : (C) 2004 by Jason Harris
6 email : kstars@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
18 #ifndef CSEGMENT_H
19 #define CSEGMENT_H
21 #include <qstring.h>
22 #include <qptrlist.h>
24 /**@class CSegment
25 *A segment of a constellation boundary. The segment consists
26 *of two or more SkyPoint "nodes" which are vertices of the
27 *boundary polygon. A single segment is define as the set of nodes
28 *that separates a single pair of constellations. An entire
29 *constellation boundary must consist of many segments, because
30 *each constellation is surrounded by multiple neighbors.
32 *For example, imagine constellation A is surrounded by constellations
33 *B, C, and D. One CSegment (AB) will describe the boundary between
34 *A and B; another (AC) will describe the boundary between A and C;
35 *and a third (AD) will describe the boundary between A and D.
38 class SkyPoint;
40 class CSegment {
41 public:
42 /**Constructor*/
43 CSegment();
44 /**Destructor (empty)*/
45 ~CSegment() {};
47 /**Add a SkyPoint node to the boundary segment.
48 *@p ra the RA of the node
49 *@p dec the Dec of the node
51 void addPoint( double ra, double dec );
53 /**@return the name of one of the constellations
54 *that borders this boundary segment.
56 QString name1() const { return Name1; }
58 /**@return the name of one of the constellations
59 *that borders this boundary segment.
61 QString name2() const { return Name2; }
63 /**Set the names of the bounding constellations. Use the IAU
64 *three-letter abbreviations.
65 *@p n1 IAU name of one bounding constellation
66 *@p n2 IAU name of the other bounding constellation
68 bool setNames( QString n1, QString n2 );
70 /**Determine if a given constellation borders this boundary segment
71 *@p cname the IAU code of the constellation to be tested.
73 bool borders( QString cname );
75 /**@return pointer to the first node in the segment
77 SkyPoint* firstNode() { return Nodes.first(); }
78 /**@return pointer to the next node in the segment.
79 *If we were on the last node, return the NULL pointer.
81 SkyPoint* nextNode() { return Nodes.next(); }
83 /**@return pointer to the list of nodes*/
84 QPtrList<SkyPoint>* nodes() { return &Nodes; }
86 private:
87 QPtrList<SkyPoint> Nodes;
88 QString Name1, Name2;
91 #endif