/* rmap - vector based global map generating program
 * Copyright (C) 2000 Reza Naima <reza@reza.net>
 *
 * http://www.reza.net/rmap/
 *
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 */

#ifndef __RMAP_H__
#define __RMAP_H__
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <gd.h>
#include <gdfonts.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

// Some configurable defaults
#ifdef VECTORFILE
#define MAPFILE VECTORFILE
#else
#define MAPFILE "earth.rez"
#endif

#ifndef COLORFILE
#define COLORFILE "rmap.colors"
#endif


#define OUTFILE "EarthImage"	//FIXME file extension?

// The Constants, we we just have to have the constants
#define PI 3.141592654
#define CONV ( PI / 180.)
//#define EARTH_RADIUS 6378140 /*meters at equator*/
#define EARTH_RADIUS 250	/*meters at equator */
#define HEADER_MAGIC 0x86460346	//random number that i like
#define BIT32 int		//os specific
#define BIT16 short		//os specific

// The following are the Contient Codes
#define AFRICA 1
#define ASIA 2
#define EUROPE 3
#define NORTH_AMERICA 4
#define SOUTH_AMERICA 5
// And these are the categories
#define PBY 1
#define RIV 2
#define BDY 3
#define CIL 5

//colormap defines
#define NOPRINT -1
#define CONF 0
#define C_BACKGROUND 1
#define C_LAT_GRID 2
#define C_LONG_GRID 3
#define C_TEXT_CIRCLE 4
#define C_TEXT 5

// some reverse mapping arrays
/*
char *CONTINENT[] =
  { NULL, "Africa", "Asia", "Europe", "North America", "South America" };
char *CATAGORY[] =
  { NULL, "National Political Boundaries", "Rivers",
"International Political Boundaries", "Coastlines, Islands and Lakes" };
*/

// structs
typedef struct
{
  double item[3][3];
}
matrix;
typedef struct
{
  double item[3];
}
vector;
typedef struct
{
  double item[3];
}
spherePt;

// And some simple defines to make the vector and matrix structs make sense
#define X 0
#define Y 1
#define Z 2
#define LONGITUDE 0
#define LATITUDE  1
#define RADIUS    2

// this struct defines the layout of the image (height, width, perspective..)
struct imageLayout
{
  int height;			//y
  int width;			//x
  short transparent;
  gdImagePtr im;
  int colormap[5][16];
};


// and the more important structs...
struct header
{
  BIT32 magic;
  BIT32 segment_index_address;
  BIT32 segment_index_count;
};

struct segment_index
{
  BIT32 maxlat;
  BIT32 minlat;
  BIT32 maxlong;
  BIT32 minlong;
  BIT32 segment_address;
  BIT32 continent;
  BIT32 category;
  BIT32 type;
};

struct segment_header
{
  BIT32 orgx;
  BIT32 orgy;
  BIT32 nstrokes;
};

struct stroke
{
  BIT32 dx;
  BIT32 dy;
};

struct options 
{
  int cities;
  int gridlines;
  double zoom;
  double xrot;
  double yrot;
  double zrot;
  char* mapfile;
  char* outfile;
  char* colorfile;
  BIT32 desired_categories;
  BIT32 desired_continents; 
};


#endif /* __RMAP_H__ */


syntax highlighted by Code2HTML, v. 0.9.1