/*
 * mapLines.h --
 *
 *	This header file provides structures and procedures to manipulate
 *	mapLines (arrays of mapPts) and mapLnArrs (arrays of mapLns).
 *	See the MapLn(3) and MapLnArr(3) man pages for more information.
 * 
 * Copyright (c) 2004 Gordon D. Carrie.  All rights reserved.
 * 
 * Licensed under the Open Software License version 2.1
 * 
 * Please address questions and feedback to user0@tkgeomap.org
 *
 * @(#) $Id: mapLines.h,v 1.6 2007/06/26 21:49:30 tkgeomap Exp $
 *
 ********************************************
 *
 */

#ifndef _MAPLINES_H_
#define _MAPLINES_H_

/*
 * For C++ compilers, use extern "C"
 */


#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <tcl.h>
#include "geography.h"
#include "geoProj.h"
#include "geoLines.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
 * This structure stores a mapline, which is an array of map points.
 */

struct MapLn {
    unsigned	nPts;		/* Number of points */
    unsigned	nPtsMax;	/* Max number of points in current allocation */
    double	absMax;		/* Max abscissa */
    double	absMin;		/* Min abscissa */
    double	ordMax;		/* Max ordinate */
    double	ordMin;		/* Min ordinate */
    MapPt	*pts;		/* Array of points in the line */
};
typedef struct MapLn *MapLn;

/*
 * Global functions for managing MapLn's.
 */

EXTERN MapLn		MapLnCreate _ANSI_ARGS_((unsigned nptsMax));
EXTERN void		MapLnClear _ANSI_ARGS_((MapLn mapLn));
EXTERN void		MapLnSetAlloc _ANSI_ARGS_((MapLn mapLn,
				unsigned nptsMax));
EXTERN void		MapLnAddPt _ANSI_ARGS_((MapPt mapPt, MapLn mapLn));
EXTERN MapPt		MapLnGetPt _ANSI_ARGS_((MapLn mapLn, unsigned n));
EXTERN void		MapLnDestroy _ANSI_ARGS_((MapLn mapLn));

/*
 * This structure stores a maplinearray, an array of maplines
 */

struct MapLnArr {
    char	*descr;		/* Descriptor */
    unsigned	nLines;		/* Number of lines */
    unsigned	nLinesMax;	/* Max number of lines in current allocation */
    unsigned	nPts;		/* Number of points for all lines */
    unsigned	nMax;		/* Number of points in longest line */
    double	absMax;		/* Max abscissa for all lines */
    double	absMin;		/* Min abscissa e for all lines */
    double	ordMax;		/* Max ordinate for all lines */
    double	ordMin;		/* Min ordinate for all lines */
    MapLn  	*lines;		/* Array of lines */
    GeoLnArr	geoLnArr;	/* GeoLineArray that produced it */
    GeoProj	proj;		/* Projection used for the transformation */
};
typedef struct MapLnArr *MapLnArr;

/*
 * Global functions for managing mapLnArrs.
 */

EXTERN MapLnArr		MapLnArrCreate _ANSI_ARGS_((unsigned nLinesMax));
EXTERN void		MapLnArrSetDescr _ANSI_ARGS_((MapLnArr mapLnArr,
				CONST char *descr));
EXTERN void		MapLnArrSetAlloc _ANSI_ARGS_((MapLnArr mapLnArr,
				unsigned nLinesMax));
EXTERN void		MapLnArrSet _ANSI_ARGS_((MapLnArr mapLnArr,
				GeoLnArr geoLnArr, GeoProj proj));
EXTERN void		MapLnArrAddLine _ANSI_ARGS_((MapLn mapLn,
				MapLnArr mapLnArr));
EXTERN void		MapLnArrPutLine _ANSI_ARGS_((MapLn mapLn,
				MapLnArr mapLnArr));
EXTERN char		*MapLnArrGetDescr _ANSI_ARGS_((MapLnArr mapLnArr));
EXTERN MapLn		MapLnArrGetLine _ANSI_ARGS_((MapLnArr mapLnArr,
				unsigned n));
EXTERN void		MapLnArrDestroy _ANSI_ARGS_((MapLnArr mapLnArr));

/*
 * end block for C++
 */

#ifdef __cplusplus
}
#endif

#endif


syntax highlighted by Code2HTML, v. 0.9.1