Пример #1
0
/******************************************************************************
	Test function.  Used to locate the specific "Entry" item in the main object
	linked list which is the best entry to use for converting the supplied
	point.
*/
double CStestNad27ToCsrsEntry (struct csNad27ToCsrsEntry_* __This,Const double* ll_csrs)
{
	extern double cs_Zero;
	
	struct csNad27ToAts77Entry_ *nad27ToAts77Ptr; 
	struct csAts77ToCsrsEntry_ *ats77ToCsrsPtr; 
	double rtnValue = cs_Zero;

	rtnValue = cs_Zero;
	switch (__This->type){
	case dtNad27ToCsrsC2:
		rtnValue = CStestDatumShiftCa2 (__This->pointers.c2DatumPtr,ll_csrs);
		break;
	case dtNad27ToCsrsXfrm:
		nad27ToAts77Ptr = CSselectNad27ToAts77 (__This->pointers.nad27ToCsrsViaXfrm->nad27ToAts77,ats77DirToAts77,ll_csrs);
		if (nad27ToAts77Ptr != NULL)
		{
			ats77ToCsrsPtr = CSselectAts77ToCsrs (__This->pointers.nad27ToCsrsViaXfrm->ats77ToCsrs,ll_csrs);
			if (ats77ToCsrsPtr != NULL)
			{
				rtnValue = __This->density; 
			}
		}
		break;
	case dtNad27ToCsrsNoneYet:
	default:
		rtnValue = cs_Zero;
		break;
	}
	return rtnValue;
}
Пример #2
0
Const char *CSsourceAts77ToCsrs (struct csAts77ToCsrs_* __This,Const double ll_77 [2])
{
	const char *cp;
	struct csAts77ToCsrsEntry_* dtEntryPtr;

	cp = NULL;
	if (__This->cachePtr != NULL)
	{
		cp = CSsourceLLGridCellCache (__This->cachePtr,ll_77);
	}
	if (cp == NULL)
	{
		dtEntryPtr = CSselectAts77ToCsrs (__This,ll_77);
		if (dtEntryPtr != NULL)
		{
			cp = CSsourceAts77ToCsrsEntry (dtEntryPtr,ll_77);
		}
	}
	if (cp == NULL && __This->fallback != NULL)
	{
		cp = CSsourceFallback (__This->fallback);
	}
	return cp;
}
Пример #3
0
/******************************************************************************
	Calculate datum shift, the main man.
	Returns  0 for expected result
	        -1 for hard/fatal failure
			+1 for no data coverage, unshifted result returned
			+2 for no data coverage, fallback used successfully
*/
int CScalcAts77ToCsrs (struct csAts77ToCsrs_* __This,double* ll_csrs,Const double *ll_ats77)
{
	int status;
	struct csAts77ToCsrsEntry_* dtEntryPtr;

	status = 0;

	/* First see if using the cache works.  This works more often than not. */
	if (__This->cachePtr != NULL)
	{
		status = CScalcLLGridCellCache (__This->cachePtr,ll_csrs,ll_ats77);
		if (status == 0)
		{
			return status;
		}
	}

	/* I guess we'll have to do it the hard way. */
	dtEntryPtr = CSselectAts77ToCsrs (__This,ll_ats77);
	if (dtEntryPtr != NULL)
	{
		status = CScalcAts77ToCsrsEntry (dtEntryPtr,ll_csrs,ll_ats77,__This->cachePtr);
	}
	else if (__This->fallback != NULL)
	{
		/* Use the fallback definition if there is no coverage. */
		status = CScalcFallbackForward (__This->fallback,ll_csrs,ll_ats77);
	}
	else
	{
		/* We didn't find any coverage.  A positive value is used to indicate
		   an error, but not internally within this code. */
		status = 1;
	}
	return status;
}