예제 #1
0
파일: CS_defaults.c 프로젝트: auranet/csmap
char * EXP_LVL1 CS_audflt (Const char *dflt_au)

{
	extern char csAuDflt [];

	double unit_scl;

	CS_stncp (previous,csAuDflt,sizeof (previous));

	if (dflt_au == NULL)
	{
		return (previous);
	}
	if (*dflt_au == '\0')
	{
		csAuDflt [0] = '\0';
		return (previous);
	}

	unit_scl = CS_unitlu (cs_UTYP_ANG,dflt_au);
	if (unit_scl == 0.0)
	{
		return (NULL);
	}
	CS_stncp (csAuDflt,dflt_au,cs_KEYNM_DEF);
	return (previous);
}
예제 #2
0
파일: CS_ntv2.c 프로젝트: asir6/Colt
/*
	The following returns a pointer to the file which would be used to
	do the calculation.  At this point, the file is already selected.
	What we do here is to add the name of the sub-grid to the name
	of the file.
*/
Const char *CSsourceNTv2 (struct cs_NTv2_* thisPtr,Const double llSource [2])
{
	char *cp1;
	Const char *cp;
	struct csNTv2SubGrid_ *cvtPtr;

	cp = NULL;		/* Until we know different. */

	/* Locate the sub-grid which covers the provided location, if any. */
	cvtPtr = CSlocateSubNTv2 (thisPtr,llSource);

	/* Return the file name and the sub-grid name of the sub-grid
	   which covers this point. */
	if (cvtPtr != NULL)
	{
		/* This file does cover the point, and we have located the
		   sub-grid. */
		cp1 = CS_stncp (thisPtr->sourceId,thisPtr->FileName,16);
		*cp1++ = ':';
		*cp1++ = ':';
		CS_stncp (cp1,cvtPtr->Name,16);
		cp = thisPtr->sourceId;
	}
	return cp;
}
예제 #3
0
파일: CS_defaults.c 프로젝트: auranet/csmap
char * EXP_LVL1 CS_dtdflt (Const char *dflt_dt)
{
	extern char csDtDflt [];

	struct cs_Dtdef_ *dtp;

	CS_stncp (previous,csDtDflt,sizeof (previous));

	if (dflt_dt == NULL)
	{
		return (previous);
	}
	if (*dflt_dt == '\0')
	{
		csDtDflt [0] = '\0';
		return (previous);
	}

	/* Verify the value provided is a valid datum name. */

	dtp = CS_dtdef (dflt_dt);
	if (dtp == NULL)
	{
		return (NULL);
	}
	CS_free (dtp);
	CS_stncp (csDtDflt,dflt_dt,cs_KEYNM_DEF);
	return (previous);
}
예제 #4
0
파일: CS_defaults.c 프로젝트: auranet/csmap
char * EXP_LVL1 CS_eldflt (Const char *dflt_el)

{
	extern char csElDflt [];

	struct cs_Eldef_ *elp;

	CS_stncp (previous,csElDflt,sizeof (previous));

	if (dflt_el == NULL)
	{
		return (previous);
	}
	if (*dflt_el == '\0')
	{
		csElDflt [0] = '\0';
		return (previous);
	}
	elp = CS_eldef (dflt_el);
	if (elp == NULL)
	{
		return (NULL);
	}
	CS_free (elp);
	CS_stncp (csElDflt,dflt_el,cs_KEYNM_DEF);
	return (previous);
}
예제 #5
0
	CsdDictionaryIterator(csFILE* (*pOpenFunc)(const char* mode))
		: m_currentIndex(-1), m_pOpenFunc(pOpenFunc)
	{
		//the paths we're going to look for CSD files
		//look into the directory first where we're storing the custom CSD files in
		char targetPaths[2][MAXPATH] = { {'\0'}, {'\0' } };
		CS_stncp(targetPaths[0], cs_UserDir, sizeof(targetPaths[0]));
		CS_stncp(targetPaths[1], m_dictionarySwitch.GetCurrentDir(), sizeof(targetPaths[1]));

		//go through all directories we've
		for (size_t i = 0; i < (sizeof(targetPaths) / sizeof(targetPaths[0])); ++i)
		{
			/* Search the file for the requested coordinate system definition. */
			const char* const pTargetPath = targetPaths[i];
			if ('\0' == *pTargetPath)
				continue;

			//switch [cs_dir] and [cs_DirP] to whatever the current target directory is
			if (CS_setdr(pTargetPath, NULL))
			{
				continue;
				//return NULL;
			}

			csFILE* dictionaryFile = this->m_pOpenFunc(_STRM_BINRD);
			if (NULL == dictionaryFile)
				continue;

			char* directoryName = strdup(pTargetPath);
			this->m_allFiles.push_back(std::pair<char const*, csFILE*>(directoryName, dictionaryFile));
		}
	};
예제 #6
0
파일: csTest.cpp 프로젝트: auranet/csmap
void CcsTest::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);

	//{{AFX_DATA_MAP(CcsTest)
	DDX_Text(pDX, IDC_CSTST_SRCCNVRG, m_SrcConvergence);
	DDX_Text(pDX, IDC_CSTST_SRCDATKYNM, m_SrcDatumKeyName);
	DDX_Text(pDX, IDC_CSTST_SRCDATLBL, m_SrcDatumLabel);
	DDX_Text(pDX, IDC_CSTST_SRCDESCR, m_SrcDescription);
	DDV_MaxChars(pDX, m_SrcDescription, 64);
	DDX_Text(pDX, IDC_CSTST_SRCKEYNM, m_SrcKeyName);
	DDX_Text(pDX, IDC_CSTST_SRCSRC, m_SrcSource);
	DDX_Text(pDX, IDC_CSTST_SRCSTAT, m_SrcStatus);
	DDX_Text(pDX, IDC_CSTST_SRCUNIT, m_SrcUnit);
	DDX_Text(pDX, IDC_CSTST_SRCXLAT, m_SrcXLatitude);
	DDX_Text(pDX, IDC_CSTST_SRCXLATLBL, m_SrcXLatLabel);
	DDX_Text(pDX, IDC_CSTST_SRCYLNG, m_SrcYLongitude);
	DDX_Text(pDX, IDC_CSTST_SRCZHGT, m_SrcZHeight);
	DDX_Text(pDX, IDC_CSTST_TRGCNVRG, m_TrgConvergence);
	DDX_Text(pDX, IDC_CSTST_TRGDATLBL, m_TrgDatLabel);
	DDX_Text(pDX, IDC_CSTST_TRGDESCR, m_TrgDescription);
	DDX_Text(pDX, IDC_CSTST_TRGDTKY, m_TrgDatumKeyName);
	DDX_Text(pDX, IDC_CSTST_TRGGRIDSCL, m_TrgGridScale);
	DDX_Text(pDX, IDC_CSTST_TRGKEYNM, m_TrgKeyName);
	DDX_Text(pDX, IDC_CSTST_TRGSRC, m_TrgSource);
	DDX_Text(pDX, IDC_CSTST_TRGSTAT, m_TrgStatus);
	DDX_Text(pDX, IDC_CSTST_TRGUNIT, m_TrgUnit);
	DDX_Text(pDX, IDC_CSTST_TRGXLATLBL, m_TrgXLatLabel);
	DDX_Text(pDX, IDC_CSTST_SRCGRIDSCL, m_SrcGridScale);
	DDX_Text(pDX, IDC_CSTST_TRGXLAT, m_TrgXLatitude);
	DDX_Text(pDX, IDC_CSTST_TRGYLNG, m_TrgYLongitude);
	DDX_Text(pDX, IDC_CSTST_TRGZHGT, m_TrgZHeight);
	DDX_Check(pDX, IDC_CSTST_DECIMAL, m_DecimalDegrees);
	DDX_Check(pDX, IDC_CSTST_HIGHPREC, m_HighPrecision);
	DDX_Check(pDX, IDC_CSTST_3DCHECK, m_ThreeDCalc);
	DDX_Text(pDX, IDC_CSTST_SRCYLNGLBL, m_SrcYLngLabel);
	DDX_Text(pDX, IDC_CSTST_TRGYLNGLBL, m_TrgYLngLabel);
	DDX_Check(pDX, IDC_CSTST_SRCSP83, m_SrcSPZone83);
	DDX_Check(pDX, IDC_CSTST_TRGSP83, m_TrgSPZone83);
	//}}AFX_DATA_MAP

	if (pDX->m_bSaveAndValidate)
	{
		char csKeyName [cs_KEYNM_DEF];
		CS_stncp (csKeyName,m_SrcKeyName,sizeof (csKeyName));
		CS_spZoneNbrMap (csKeyName,m_SrcSPZone83);
		m_SrcKeyName = csKeyName;
		CS_stncp (csKeyName,m_TrgKeyName,sizeof (csKeyName));
		CS_spZoneNbrMap (csKeyName,m_TrgSPZone83);
		m_TrgKeyName = csKeyName;
	}
}
예제 #7
0
파일: elSelect.cpp 프로젝트: auranet/csmap
int EXP_LVL1 CS_elSelectorA (char *elKeyName,char *description,char *source)
{
	CelSelect elSelect;

	elSelect.SetInitialEllipsoid (elKeyName);
	INT_PTR st = elSelect.DoModal ();
	if (st == IDOK)
	{
		CS_stncp (elKeyName,elSelect.GetSelectedEllipsoid (),cs_KEYNM_DEF);
		CS_stncp (description,elSelect.GetSelectedDescription (),64);
		CS_stncp (source,elSelect.GetSelectedSource (),64);
	}
	return (int)st;
}
예제 #8
0
파일: CS_supprt.c 프로젝트: asir6/Colt
char * EXP_LVL3 CS_stncat (char *dest,Const char *source,int count)
{
	int length;
	int room;
	char *cPtr;

	cPtr = NULL;
	if (count > 0)
	{
		/* Determine how much room we have in the target character array. */
		length = (int)strlen (dest);
		room = count - length - 1;
		if (room >= 0)
		{
			cPtr = dest + length;
			if (room > 0)
			{
				/* Append the appropriate number of characters on to the end of target
				   array. */
				cPtr = CS_stncp (cPtr,source,room);
			}
		}
	}
	return cPtr;
}
예제 #9
0
파일: CS_elio.c 프로젝트: asir6/Colt
void EXP_LVL1 CS_elfnm (Const char *new_name)
{
	extern char cs_Elname [];

	(void)CS_stncp (cs_Elname,new_name,cs_FNM_MAXLEN);
	return;
}
예제 #10
0
파일: CS_dhdn.c 프로젝트: asir6/Colt
/******************************************************************************
	Initialize the DHDN <--> ETRF conversion system.  The catalog file is
	expected to	reside in the basic data directory.
*/
int EXP_LVL7 CSdhdnInit (void)
{
	extern char cs_Dir [];
	extern char* cs_DirP;
	extern char cs_DhdnName [];

	char catalog [MAXPATH];

	if (csDhdnToEtrf89 == NULL)
	{
		/* Set up the catalog file name.  Need a copy of it as the
		   new function will access CS_dtloc. */
		CS_stcpy (cs_DirP,cs_DhdnName);
		CS_stncp (catalog,cs_Dir,sizeof (catalog));

		/* Use it to build the DhdnToEtrf89 object. */
		csDhdnToEtrf89 = CSnewDhdnToEtrf89 (catalog);
		if (csDhdnToEtrf89 == NULL) goto error;
	}
	csDhdnToEtrf89Cnt += 1;
	return 0;

error:
	if (csDhdnToEtrf89 != NULL)
	{
		CSdeleteDhdnToEtrf89 (csDhdnToEtrf89);
		csDhdnToEtrf89 = NULL;
		csDhdnToEtrf89Cnt = 0;
	}
	return -1;
}
예제 #11
0
/******************************************************************************
	Calculation function.  Calculates the conversion from Ats77 to NAD83.
*/
int CScalcNad27ToCsrsEntry (struct csNad27ToCsrsEntry_* __This,double* ll_nad27,Const double *ll_csrs,struct csLLGridCellCache_ *cachePtr)
{
	extern char csErrnam [];

	int status;
	double ll_ats77 [3];

	switch (__This->type) {
	case dtNad27ToCsrsC2:
		status = CScalcDatumShiftCa2 (__This->pointers.c2DatumPtr,ll_nad27,ll_csrs,cachePtr);
		break;
	case dtNad27ToCsrsXfrm:
		status = CScalcNad27ToAts77 (__This->pointers.nad27ToCsrsViaXfrm->nad27ToAts77,ll_ats77,ll_csrs);
		if (status == 0)
		{
			status = CScalcAts77ToCsrs (__This->pointers.nad27ToCsrsViaXfrm->ats77ToCsrs,ll_nad27,ll_ats77);
		}
		break;
	case dtNad27ToCsrsNoneYet:
	default:
		/* Minus one indicates a fatal error.  In this case, it is an internal
		   software error. */
		CS_stncp (csErrnam,"CS_dtNad27ToCsrs:1",MAXPATH);
		CS_erpt (cs_ISER);
		status = -1;
		break;
	}
	return status;
}
예제 #12
0
파일: CSwinHlp.cpp 프로젝트: auranet/csmap
int EXP_LVL1 CS_setHelpPath (const char *path)
{
	CS_stncp (csHelpFile,path,sizeof (csHelpFile));
	if (CS_access (path,4) != 0) return FALSE;
	csHlpIsAvail = 1;
	return TRUE;
}
예제 #13
0
파일: CS_nzgd49.c 프로젝트: auranet/csmap
/******************************************************************************
	Initialize the NZGD49 <--> NZGD2K conversion system.  The catalog file is
	expected to	reside in the basic data directory.  The name of the file is
	taken from the cs_Nzgd49Name global variable.
*/
int EXP_LVL7 CSnzgd49Init (void)
{
	extern char cs_Dir [];
	extern char* cs_DirP;
	extern char cs_Nzgd49Name [];

	char catalog [MAXPATH];

	if (csNzgd49ToNzgd2K == NULL)
	{
		/* Set up the catalog file name. */
		CS_stcpy (cs_DirP,cs_Nzgd49Name);
		CS_stncp (catalog,cs_Dir,sizeof (catalog));

		/* Use it to build the Nzgd49ToNzgd2K object. */
		csNzgd49ToNzgd2K = CSnewNzgd49ToNzgd2K (catalog);
		if (csNzgd49ToNzgd2K == NULL) goto error;
	}
	csNzgd49ToNzgd2KCnt += 1;
	return 0;

error:
	if (csNzgd49ToNzgd2K != NULL)
	{
		CSdeleteNzgd49ToNzgd2K (csNzgd49ToNzgd2K);
		csNzgd49ToNzgd2K = NULL;
		csNzgd49ToNzgd2KCnt = 0;
	}
	return -1;
}
예제 #14
0
파일: CS_nzgd49.c 프로젝트: auranet/csmap
/**********************************************************************
**	CS_nzgd49Name (new_name);
**
**	char *new_name;				the name of the Nzgd49ToNzgd2K catalog
**								file.
**
**	This function specifies the name only.  The directory,
**	and possibly drive, are specified using CS_altdr.
**********************************************************************/
void EXP_LVL1 CS_nzgd49Name (Const char *newName)
{
	extern char cs_Nzgd49Name [];

	CS_stncp (cs_Nzgd49Name,newName,cs_FNM_MAXLEN);
	return;
}
예제 #15
0
파일: CS_nad27.c 프로젝트: auranet/csmap
/**********************************************************************
**	st = CSn27a77Init ();
**********************************************************************/
int EXP_LVL7 CSn27a77Init (void)
{
	extern char *cs_DirP;
	extern char cs_Dir [];
	extern char cs_N27A77Name [];

	char catalog [MAXPATH];

	/* See if we already have a csNad27ToNad83 object.
	   Note, we can have such even if the count is zero. */
	if (csNad27ToAts77 == NULL)
	{
		/* Nope, we best create one. */
		CS_stcpy (cs_DirP,cs_N27A77Name);
		CS_stncp (catalog,cs_Dir,sizeof (catalog));

		csNad27ToAts77 = CSnewNad27ToAts77 (catalog);
		if (csNad27ToAts77 == NULL)
		{
			goto error;
		}
		csNad27ToAts77Cnt = 0;
	}
	csNad27ToAts77Cnt += 1;
	return 0;

error:
	if (csNad27ToAts77 != NULL)
	{
		CSdeleteNad27ToAts77 (csNad27ToAts77);
		csNad27ToAts77 = NULL;
	}
	csNad27ToAts77Cnt = 0;
	return -1;
}
예제 #16
0
파일: dtSelect.cpp 프로젝트: auranet/csmap
int EXP_LVL1 CS_dtSelectorA (char *dtKeyName,char *description,char *source,char *ellipsoid,char *technique)
{
	CdtSelect dtSelect;

	dtSelect.SetInitialDatum (dtKeyName);
	INT_PTR st = dtSelect.DoModal ();
	if (st == IDOK)
	{
		CS_stncp (dtKeyName,dtSelect.GetSelectedDatum (),cs_KEYNM_DEF);
		CS_stncp (description,dtSelect.GetSelectedDescription (),64);
		CS_stncp (source,dtSelect.GetSelectedSource (),64);
		CS_stncp (ellipsoid,dtSelect.GetSelectedEllipsoid (),cs_KEYNM_DEF);
		CS_stncp (technique,dtSelect.GetSelectedTechnique (),32);
	}
	return (int)st;
}
예제 #17
0
파일: CS_ntv2.c 프로젝트: asir6/Colt
int CScntv2Q (struct csGeodeticXfromParmsFile_* fileParms,Const char* dictDir,int err_list [],int list_sz)
{
	extern char cs_DirsepC;

	int err_cnt;
	size_t rdCnt;

	char *cp;
	csFILE* strm;

	char chrBuffer [16];
	char pathBuffer [MAXPATH];

	cp = fileParms->fileName;
	if (*cp == '.' && *(cp + 1) == cs_DirsepC)
	{
		CS_stncp (pathBuffer,dictDir,sizeof (pathBuffer));
		CS_stncat (pathBuffer,cp,MAXPATH);
	}
	else
	{
		CS_stncp (pathBuffer,cp,MAXPATH);
	}

	/* We will return (err_cnt + 1) below. */
	err_cnt = -1;
	if (err_list == NULL) list_sz = 0;

	/* Verify that the file exists and that the format appears to be correct. */
	strm = CS_fopen (pathBuffer,_STRM_BINRD);
	if (strm != NULL)
	{
		rdCnt = CS_fread (chrBuffer,1,sizeof (chrBuffer),strm);
		CS_fclose (strm);
		strm = NULL;

		if (rdCnt != sizeof (chrBuffer) || CS_strnicmp (chrBuffer,"NUM_OREC",8))
		{
			if (++err_cnt < list_sz) err_list [err_cnt] = cs_DTQ_FORMAT;
		}
	}
	else
	{
		if (++err_cnt < list_sz) err_list [err_cnt] = cs_DTQ_FILE;
	}
	return (err_cnt + 1);
}
예제 #18
0
파일: CS_hlApi.c 프로젝트: auranet/csmap
/**********************************************************************
  The following function returns a list of the coordinate systems
  in the cache.
**********************************************************************/
void EXP_LVL1 CSbdcDbg (char *results,int rsltSz)
{
	extern csThread struct csDtcach_ *csDtcachP;

	int need;
	char *cp;
	char *rsltPtr = results;
	cs_Register struct csDtcach_ *ch_ptr;
	char myName [64];

	*results = '\0';
	if (csDtcachP == NULL)
	{
		CS_stncp (results,"<none>",rsltSz);
	}
	else
	{
		rsltSz -= 1;
		for (ch_ptr = csDtcachP;ch_ptr != NULL;ch_ptr = ch_ptr->next)
		{
			if (rsltSz > 0)
			{
				cp = myName;
				if (*results != '\0') *cp++ = ';';
				if (ch_ptr->dtc_ptr == NULL)
				{
					cp = CS_stcpy (cp,"<none>");
				}
				else
				{
					*cp++ = '<';
					cp = CS_stncp (cp,ch_ptr->dtc_ptr->srcKeyName,28);
					*cp++ = ':';
					*cp++ = ':';
					cp = CS_stncp (cp,ch_ptr->dtc_ptr->trgKeyName,28);
					*cp++ = '>';
					*cp = '\0';
				}
				need = (int)strlen (myName);
				if (need > rsltSz) need = rsltSz;
				rsltPtr = CS_stncp (rsltPtr,myName,need + 1);
				rsltSz -= need;
			}
		}
	}
	return;
}
예제 #19
0
파일: CS_hlApi.c 프로젝트: auranet/csmap
/**********************************************************************
  The following function returns a list of the coordinate systems
  in the cache.
**********************************************************************/
void EXP_LVL1 CSbccDbg (char *results,int rsltSz)
{
	extern csThread struct csCscach_ *csCscachP;

	int need;
	char *cp;
	char *rsltPtr = results;
	cs_Register struct csCscach_ *ch_ptr;
	char myName [32];

	*results = '\0';
	if (csCscachP == NULL)
	{
		CS_stncp (results,"<none>",rsltSz);
	}
	else
	{
		rsltSz -= 1;
		for (ch_ptr = csCscachP;ch_ptr != NULL;ch_ptr = ch_ptr->next)
		{
			if (rsltSz > 0)
			{
				cp = myName;
				if (*results != '\0') *cp++ = ',';

				if (ch_ptr->cs_nam [0] == '\0')
				{
					cp = CS_stcpy (cp,"<none>");
				}
				else if (ch_ptr->cs_ptr != NULL)
				{
					cp = CS_stncp (cp,ch_ptr->cs_nam,sizeof (myName) - 1);
				}
				else
				{
					cp = CS_stcpy (cp,"<none>");
				}
				need = (int)strlen (myName);
				if (need > rsltSz) need = rsltSz;
				rsltPtr = CS_stncp (rsltPtr,myName,need + 1);
				rsltSz -= need;
			}
		}
	}
	return;
}
예제 #20
0
파일: CSel2Wkt.c 프로젝트: auranet/csmap
int EXP_LVL3 CSel2WktEx (char *bufr,size_t bufrSize,enum ErcWktFlavor flavor,const struct cs_Eldef_ *el_def,unsigned short flags)
{
    extern double cs_One;

    /* The real value is infinity, but that this a rather awkward number to deal with.
       So, we use zero to indicate a sphere.  Quite frankly, the specification
       (if there reallyis one) for WKT does not handle spheres at all.  We should
       probably just bag anything references to a spehere. */
    Const char* kCp;
    double rcpFlattening = 0.0;

    char wktEllipsoidName [96];
    char cTemp [1024];

    if (el_def->flat != 0.0)
    {
        rcpFlattening = cs_One / el_def->flat;
    }

    if (bufrSize >= 1)
    {
        CS_stncp (wktEllipsoidName,el_def->key_nm,sizeof (wktEllipsoidName));
        if ((flags & cs_WKTFLG_MAPNAMES) != 0)
        {
            if (flavor == wktFlvrEsri)
            {
                kCp = CS_msiElpName2Esri (el_def->key_nm);
                if (kCp != 0)
                {
                    CS_stncp (wktEllipsoidName,kCp,sizeof (wktEllipsoidName));
                }
            }
            else if (flavor == wktFlvrOracle)
            {
                kCp = CS_msiElpName2Oracle (el_def->key_nm);
                if (kCp != 0)
                {
                    CS_stncp (wktEllipsoidName,kCp,sizeof (wktEllipsoidName));
                }
            }
        }
        sprintf (cTemp,"SPHEROID[\"%s\",%.3f,%.8f]",wktEllipsoidName,el_def->e_rad,rcpFlattening);
        CS_stncp (bufr,cTemp,(int)bufrSize);
    }
    return 0;
}
예제 #21
0
파일: csTest.cpp 프로젝트: auranet/csmap
///////////////////////////////////////////////////////////////////////////////
// C callable function.  Note, name is not mangled for easy access from Visual
//	Basic, et al.
extern "C" void EXP_LVL1 CS_csTest (char *srcSystem,char *trgSystem,double srcXYZ [3])
{
	CcsTest csTest;
	CS_recvr ();
	csTest.SetSourceSystem (srcSystem);
	csTest.SetTargetSystem (trgSystem);
	csTest.SetSourceCoordinate (srcXYZ);
	csTest.DoModal ();
	// Must capture the final settings, for persistence, before the
	// class goes out of scope.
	CS_stncp (srcSystem,csTest.GetSourceSystem (),cs_KEYNM_DEF);
	CS_stncp (trgSystem,csTest.GetTargetSystem (),cs_KEYNM_DEF);
	csTest.GetSourceCoordinate (srcXYZ);
	
	// The Test object uses the high level caches.  The following
	// releases the memory consumed by such, and eliminates what
	// appears to be a memory leak.
	CS_recvr ();
	return;
}
예제 #22
0
파일: dtSelect.cpp 프로젝트: auranet/csmap
///////////////////////////////////////////////////////////////////////////////
// Basic 'C' callable function interface
int EXP_LVL1 CS_dtSelector (char *dtKeyName)
{
	CdtSelect dtSelect;

	dtSelect.SetInitialDatum (dtKeyName);
	INT_PTR st = dtSelect.DoModal ();
	if (st == IDOK)
	{
		CS_stncp (dtKeyName,dtSelect.GetSelectedDatum (),cs_KEYNM_DEF);
	}
	return (int)st;
}
예제 #23
0
파일: elSelect.cpp 프로젝트: auranet/csmap
///////////////////////////////////////////////////////////////////////////////
// Basic 'C' callable function interface
int EXP_LVL1 CS_elSelector (char *elKeyName)
{
	CelSelect elSelect;

	elSelect.SetInitialEllipsoid (elKeyName);
	INT_PTR st = elSelect.DoModal ();
	if (st == IDOK)
	{
		CS_stncp (elKeyName,elSelect.GetSelectedEllipsoid (),cs_KEYNM_DEF);
	}
	return (int)st;
}
예제 #24
0
파일: CS_defCmp.c 프로젝트: kanbang/Colt
int EXP_LVL3 CS_elDefCmp (Const struct cs_Eldef_ *original,Const struct cs_Eldef_ *revised,char* message,size_t messageSize)
{
    int errCnt = 0;

    char errMsg [512];

    /* Pretty simple for an ellipsoid. */
    if (fabs (original->e_rad - revised->e_rad) > 6.0E-04)
    {
        if (errCnt == 0)
        {
            sprintf (errMsg,"%s: Equatorial radius was %14.4f, is now %14.4f",original->key_nm,original->e_rad,revised->e_rad);
        }
        errCnt += 1;
    }
    if (fabs (original->p_rad - revised->p_rad) > 6.0E-04)
    {
        if (errCnt == 0)
        {
            sprintf (errMsg,"%s: Polar radius was %14.4f, is now %14.4f",original->key_nm,original->p_rad,revised->p_rad);
        }
        errCnt += 1;
    }
    if (fabs (original->flat - revised->flat) > 5.0E-07)
    {
        if (errCnt == 0)
        {
            sprintf (errMsg,"%s: Flattening was %14.8f, is now %14.8f",original->key_nm,original->flat,revised->flat);
        }
        errCnt += 1;
    }
    if (fabs (original->ecent - revised->ecent) > 5.0E-08)
    {
        if (errCnt == 0)
        {
            sprintf (errMsg,"%s: Eccentricity was %11.9f, is now %11.9f",original->key_nm,original->ecent,revised->ecent);
        }
        errCnt += 1;
    }
    if (errCnt != 0)
    {
        if (message != 0 && messageSize > 1)
        {
            CS_stncp (message,errMsg,(int)messageSize);
        }
    }
    return errCnt;
}
예제 #25
0
파일: csKeyNm.cpp 프로젝트: auranet/csmap
///////////////////////////////////////////////////////////////////////////////
// Basic 'C' callable function interface
extern "C" int EXP_LVL1 CS_newKeyName (char *keyName,int type,int preserve)
{
	int st = 0;

	CnewKeyName dlgNewKeyName (static_cast<CnewKeyName::TnewKeyNameTypes>(type));

	dlgNewKeyName.SetPreserveEnable (preserve != 0);
	INT_PTR stDlg = dlgNewKeyName.DoModal ();
	if (stDlg == IDOK)
	{
		CString tempStr = dlgNewKeyName.GetNewName ();
		CS_stncp (keyName,(LPCTSTR)tempStr,cs_KEYNM_DEF);
		st = dlgNewKeyName.GetPreserve () ? 1 : 0;
	}
	else
	{
		st = -1;
	}
	return st;
}
예제 #26
0
파일: csDataDir.cpp 프로젝트: auranet/csmap
/////////////////////////////////////////////////////////////////////////////
// CcsDataDir dialog
CcsDataDir::CcsDataDir(CWnd* pParent /*=NULL*/)
			: CDialog(CcsDataDir::IDD, pParent)
{
	//{{AFX_DATA_INIT(CcsDataDir)
	m_CSName = _T("");
	m_DataDirectory = _T("");
	m_ElName = _T("");
	m_DtName = _T("");
	m_SaveInINI = FALSE;
	m_SaveInRegistry = FALSE;
	//}}AFX_DATA_INIT
	m_EnableINI = false;
	m_EnableReg = false;
	m_CSName = cs_Csname;
	m_DtName = cs_Dtname;
	m_ElName = cs_Elname;
	char ctemp [MAXPATH];
	*cs_DirP = '\0';
	CS_stncp (ctemp,cs_Dir,sizeof (ctemp));
	m_DataDirectory = ctemp;
}
예제 #27
0
/******************************************************************************
	Calculation function.  Calculates the conversion from AGD66 to GDA94.
*/
int CScalcEd50ToEtrf89Entry (struct csEd50ToEtrf89Entry_* __This,double* ll89,Const double *ll50,struct csLLGridCellCache_ *cachePtr)
{
	extern char csErrnam [];

	int status;

	switch (__This->type){
	case dtEd50ToEtrf89C2:
		status = CScalcDatumShiftCa2 (__This->pointers.c2DatumPtr,ll89,ll50,cachePtr);
		break;
	case dtEd50ToEtrf89NoneYet:
	default:
		/* Minus one indicates a fatal error.  In this case, it is an internal
		   software error. */
		CS_stncp (csErrnam,"CS_dtEd50ToEtrf89:1",MAXPATH);
		CS_erpt (cs_ISER);
		status = -1;
		break;
	}
	return status;
}
예제 #28
0
파일: CS_japanNew.c 프로젝트: asir6/Colt
/*
	The following function returns the mesh code appropriate for the given
	geographic coordinates provided.  Note, it is expected that the calling
	module deals with the rounding to the appropriate grid point.

	This function returns a zero to indicate an error.  Zero is not, under
	any circumstances, a valid mesh code.
*/
ulong32_t EXP_LVL9 CSjpnLlToMeshCode (const double ll [2])
{
	extern char csErrnam [];

	ulong32_t mesh;
	ulong32_t iLat, iLng;

	/* Verify that we are in the proper range.  This prevents many nasty
	   situations such as overflow. */
	if (ll [0] < 120.0 || ll [0] > 160.0 || ll [1] <  20.0 || ll [1] >  60.0)
	{
		CS_stncp (csErrnam,"CS_jpnMeshCode:1",MAXPATH);
		CS_erpt (cs_ISER);
		return 0;
	}

	/* Compute the mesh numbers for each value. */
	iLat = ((ulong32_t)CS_degToSec (ll [1])) / 30;
	iLng = ((ulong32_t)CS_degToSec (ll [0] - 100.0)) / 45;

	/* We do the last two digits; these range from 0 thru 9.  Each increment in
	   longitude represents 45 seconds of longitude.  Each increment in
	   latitude represents 30 seconds of latitude. */
	mesh  =  iLng % 10;
	mesh += (iLat % 10) * 10;

	/* Next two digits, range from 0 thru 7.  Each increment of longitude represents
	   7.5 minutes (450 seconds).  Each increment of latitude represents 5 minutes
	   (300 seconds). */
	mesh += ((iLng / 10) % 8) * 100;
	mesh += ((iLat / 10) % 8) * 1000;

	/* Now for the last set of four digits.  Each increment of latitude represents
	   40 minutes (2400 sceonds) and each increment of longitude repsents 12 degree
	   (3600 seconds) of longitude.  Note that we biased the longitude by 100 degrees
	   above. */
	mesh += ((iLng / 80) % 100) *   10000;
	mesh += ((iLat / 80) % 100) * 1000000;
	return mesh;
}
예제 #29
0
/******************************************************************************
	Calculation function.  Calculates the conversion from RGF93 to NTF.
*/
int CScalcRgf93ToNtfEntry (struct csRgf93ToNtfEntry_* __This,double* llNtf,Const double *llRgf93,struct csLLGridCellCache_ *cachePtr)
{
	extern char csErrnam [];

	int status;

	switch (__This->type){
	case dtRgf93ToNtfTxt:
		status = CScalcRgf93ToNtfTxt (__This->pointers.txtDatumPtr,llNtf,llRgf93);
		break;
	case dtRgf93ToNtfC2:
		status = CScalcDatumShiftCa2 (__This->pointers.c2DatumPtr,llNtf,llRgf93,cachePtr);
		break;
	case dtRgf93ToNtfNone:
	default:
		/* Minus one indicates a fatal error.  In this case, it is an internal
		   software error. */
		CS_stncp (csErrnam,"CS_dtRgf93ToNtf:1",MAXPATH);
		CS_erpt (cs_ISER);
		status = -1;
		break;
	}
	return status;
}
예제 #30
0
파일: CS_GeoidHeight.c 프로젝트: asir6/Colt
/******************************************************************************
	Calculate the geoid height, given the specific "Entry" item which is to
	be used.
*/
int CScalcGeoidHeightEntry (struct csGeoidHeightEntry_* __This,double* geoidHgt,Const double *ll84)
{
	extern char csErrnam [];

	int status;

	status = -1;
	if (__This != NULL)
	{
		switch (__This->type) {
		case csGeoidHgtTypeGeoid96:
			status = CScalcGeoid96GridFile (__This->pointers.geoid96Ptr,geoidHgt,ll84);
			break;
		case csGeoidHgtTypeGeoid99:
			status = CScalcGeoid99GridFile (__This->pointers.geoid99Ptr,geoidHgt,ll84);
			break;
		case csGeoidHgtTypeOsgm91:
			status = CScalcOsgm91 (__This->pointers.osgm91Ptr,geoidHgt,ll84);
			break;
		case csGeoidHgtTypeBynGridFile:
			status = CScalcBynGridFile (__This->pointers.bynGridFilePtr,geoidHgt,ll84);
			break;
      case csGeoidHgtTypeEgm96:
         status = CScalcEgm96 (__This->pointers.egm96Ptr,geoidHgt,ll84);
         break;
		case csGeoidHgtTypeWorld:
		case csGeoidHgtTypeAustralia:
		case csGeoidHgtTypeNone:
		default:
			CS_stncp (csErrnam,"CS_usGridFile:3",MAXPATH);
			CS_erpt (cs_ISER);
			break;
		}
	}
	return status;
}