1
/****************************************************************************
2
Xplanet 0.94 - render an image of a planet into an X window
3
Copyright (C) 2002 Hari Nair <hari@alumni.caltech.edu>
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
****************************************************************************/
27
#include "ProjectionBase.h"
28
#include "ProjectionAncient.h"
29
#include "ProjectionAzimuthal.h"
30
#include "ProjectionHemisphere.h"
31
#include "ProjectionMollweide.h"
32
#include "ProjectionMercator.h"
33
#include "ProjectionOrthographic.h"
34
#include "ProjectionPeters.h"
35
#include "ProjectionRectangular.h"
38
getProjectionType(char *proj_string)
42
char *lowercase = proj_string;
43
char *ptr = proj_string;
44
while (*ptr != '\0') *ptr++ = tolower(*proj_string++);
45
if (strncmp(lowercase, "ancient", 2) == 0)
47
else if (strncmp(lowercase, "azimuthal", 2) == 0)
48
projection = AZIMUTHAL;
49
else if (strncmp(lowercase, "hemisphere", 1) == 0)
50
projection = HEMISPHERE;
51
else if (strncmp(lowercase, "mercator", 2) == 0)
52
projection = MERCATOR;
53
else if (strncmp(lowercase, "mollweide", 2) == 0)
54
projection = MOLLWEIDE;
55
else if (strncmp(lowercase, "orthographic", 1) == 0)
56
projection = ORTHOGRAPHIC;
57
else if (strncmp(lowercase, "peters", 1) == 0)
59
else if (strncmp(lowercase, "rectangular", 1) == 0)
60
projection = RECTANGULAR;
63
cerr << "Unknown projection, using rectangular\n";
64
projection = RECTANGULAR;
70
getProjection(const int projection, const int width, const int height)
72
ProjectionBase *thisProjection = NULL;
76
thisProjection = new ProjectionAncient(width, height);
79
thisProjection = new ProjectionAzimuthal(width, height);
82
thisProjection = new ProjectionHemisphere(width, height);
85
thisProjection = new ProjectionMercator(width, height);
88
thisProjection = new ProjectionMollweide(width, height);
91
thisProjection = new ProjectionOrthographic(width, height);
94
thisProjection = new ProjectionPeters(width, height);
99
return(thisProjection);