?? datum.c
字號:
{
error_code |= DATUM_NOT_INITIALIZED_ERROR;
}
return (error_code);
} /* End Datum_Ellipsoid_Code */
long Retrieve_Datum_Type (const long Index,
Datum_Type *Type)
{ /* Begin Retrieve_Datum_Type */
/*
* The function Retrieve_Datum_Type returns the type of the datum referenced by
* index.
*
* Index : The index of a given datum in the datum table. (input)
* Type : The type of datum referenced by index. (output)
*/
long error_code = DATUM_NO_ERROR;
if (Datum_Initialized)
{
if ((Index < 1) || (Index > Number_of_Datums))
error_code |= DATUM_INVALID_INDEX_ERROR;
else
*Type = Datum_Table[Index-1]->Type;
}
else
{
error_code |= DATUM_NOT_INITIALIZED_ERROR;
}
return (error_code);
} /* End Retrieve_Datum_Type */
long Datum_Seven_Parameters (const long Index,
double *Delta_X,
double *Delta_Y,
double *Delta_Z,
double *Rx,
double *Ry,
double *Rz,
double *Scale_Factor)
{ /* Begin Datum_Seven_Parameters */
/*
* The function Datum_Seven_Parameters returns the seven parameters
* for the datum referenced by index.
*
* Index : The index of a given datum in the datum table. (input)
* Delta_X : X translation in meters (output)
* Delta_Y : Y translation in meters (output)
* Delta_Z : Z translation in meters (output)
* Rx : X rotation in radians (output)
* Rx : Y rotation in radians (output)
* Ry : Z rotation in radians (output)
* Scale_Factor : Scale factor (output)
*/
long error_code = DATUM_NO_ERROR;
if (Datum_Initialized)
{
if (Index > 0 && Index <= Number_of_Datums)
{
*Delta_X = Datum_Table[Index-1]->Parameters[0];
*Delta_Y = Datum_Table[Index-1]->Parameters[1];
*Delta_Z = Datum_Table[Index-1]->Parameters[2];
*Rx = Datum_Table[Index-1]->Parameters[3];
*Ry = Datum_Table[Index-1]->Parameters[4];
*Rz = Datum_Table[Index-1]->Parameters[5];
*Scale_Factor = Datum_Table[Index-1]->Parameters[6];
}
else
{
error_code |= DATUM_INVALID_INDEX_ERROR;
}
}
else
{
error_code |= DATUM_NOT_INITIALIZED_ERROR;
}
return (error_code);
} /* End Datum_Seven_Parameters */
long Datum_Three_Parameters (const long Index,
double *Delta_X,
double *Delta_Y,
double *Delta_Z)
{ /* Begin Datum_Three_Parameters */
/*
* The function Datum_Three_Parameters returns the three parameters
* for the datum referenced by index.
*
* Index : The index of a given datum in the datum table. (input)
* Delta_X : X translation in meters (output)
* Delta_Y : Y translation in meters (output)
* Delta_Z : Z translation in meters (output)
*/
long error_code = DATUM_NO_ERROR;
if (Datum_Initialized)
{
if (Index > 0 && Index <= Number_of_Datums)
{
*Delta_X = Datum_Table[Index-1]->Parameters[0];
*Delta_Y = Datum_Table[Index-1]->Parameters[1];
*Delta_Z = Datum_Table[Index-1]->Parameters[2];
}
else
{
error_code |= DATUM_INVALID_INDEX_ERROR;
}
}
else
{
error_code |= DATUM_NOT_INITIALIZED_ERROR;
}
return (error_code);
} /* End Datum_Three_Parameters */
long Datum_Errors (const long Index,
double *Sigma_X,
double *Sigma_Y,
double *Sigma_Z)
{ /* Begin Datum_Errors */
/*
* The function Datum_Errors returns the standard errors in X,Y, & Z
* for the datum referenced by index.
*
* Index : The index of a given datum in the datum table (input)
* Sigma_X : Standard error in X in meters (output)
* Sigma_Y : Standard error in Y in meters (output)
* Sigma_Z : Standard error in Z in meters (output)
*/
long error_code = DATUM_NO_ERROR;
if (Datum_Initialized)
{
if (Index > 0 && Index <= Number_of_Datums)
{
*Sigma_X = Datum_Table[Index-1]->Sigma_X;
*Sigma_Y = Datum_Table[Index-1]->Sigma_Y;
*Sigma_Z = Datum_Table[Index-1]->Sigma_Z;
}
else
{
error_code |= DATUM_INVALID_INDEX_ERROR;
}
}
else
{
error_code |= DATUM_NOT_INITIALIZED_ERROR;
}
return (error_code);
} /* End Datum_Errors */
long Datum_Valid_Rectangle ( const long Index,
double *South_latitude,
double *North_latitude,
double *West_longitude,
double *East_longitude)
{ /* Begin Datum_Valid_Rectangle */
/*
* The function Datum_Valid_Rectangle returns the edges of the validity
* rectangle for the datum referenced by index.
*
* Index : The index of a given datum in the datum table (input)
* South_latitude : Southern edge of validity rectangle in radians (output)
* North_latitude : Northern edge of validity rectangle in radians (output)
* West_longitude : Western edge of validity rectangle in radians (output)
* East_longitude : Eastern edge of validity rectangle in radians (output)
*/
long error_code = DATUM_NO_ERROR;
if (Datum_Initialized)
{
if (Index > 0 && Index <= Number_of_Datums)
{
*South_latitude = Datum_Table[Index-1]->South_latitude;
*North_latitude = Datum_Table[Index-1]->North_latitude;
*West_longitude = Datum_Table[Index-1]->West_longitude;
*East_longitude = Datum_Table[Index-1]->East_longitude;
}
else
{
error_code |= DATUM_INVALID_INDEX_ERROR;
}
}
else
{
error_code |= DATUM_NOT_INITIALIZED_ERROR;
}
return (error_code);
} /* End Datum_Valid_Rectangle */
long Datum_User_Defined ( const long Index,
long *result )
{ /* Begin Datum_User_Defined */
/*
* Index : Index of a given datum in the datum table (input)
* result : Indicates whether specified datum is user defined (1)
* or not (0) (output)
*
* The function Datum_User_Defined checks whether or not the specified datum is
* user defined. It returns 1 if the datum is user defined, and returns
* 0 otherwise. If index is valid DATUM_NO_ERROR is returned, otherwise
* DATUM_INVALID_INDEX_ERROR is returned.
*/
long error_code = DATUM_NO_ERROR;
*result = FALSE;
if (Datum_Initialized)
{
if ((Index < 1) || (Index > Number_of_Datums))
error_code |= DATUM_INVALID_INDEX_ERROR;
else
{
if (Datum_Table[Index-1]->User_Defined)
*result = TRUE;
}
}
else
error_code |= DATUM_NOT_INITIALIZED_ERROR;
return (error_code);
} /* End Datum_User_Defined */
long Valid_Datum(const long Index,
double latitude,
double longitude,
long *result)
{ /* Begin Valid_Datum */
/*
* This function checks whether or not the specified location is within the
* validity rectangle for the specified datum. It returns zero if the specified
* location is NOT within the validity rectangle, and returns 1 otherwise.
*
* Index : The index of a given datum in the datum table (input)
* latitude : Latitude of the location to be checked in radians (input)
* longitude : Longitude of the location to be checked in radians (input)
* result : Indicates whether location is inside (1) or outside (0)
* of the validity rectangle of the specified datum (output)
*/
long error_code = DATUM_NO_ERROR;
*result = 0;
if (Datum_Initialized)
{
if (Index <= 0 || Index >= Number_of_Datums)
error_code |= DATUM_INVALID_INDEX_ERROR;
if ((latitude < MIN_LAT) || (latitude > MAX_LAT))
error_code |= DATUM_LAT_ERROR;
if ((longitude < MIN_LON) || (longitude > MAX_LON))
error_code |= DATUM_LON_ERROR;
if (!error_code)
{
if ((Datum_Table[Index-1]->South_latitude <= latitude) &&
(latitude <= Datum_Table[Index-1]->North_latitude) &&
(Datum_Table[Index-1]->West_longitude <= longitude) &&
(longitude <= Datum_Table[Index-1]->East_longitude))
{
*result = 1;
}
else
{
*result = 0;
}
}
}
else
{
error_code |= DATUM_NOT_INITIALIZED_ERROR;
}
return (error_code);
} /* End Valid_Datum */
void Geocentric_Shift_WGS72_To_WGS84(const double X,
const double Y,
const double Z,
double *X_WGS84,
double *Y_WGS84,
double *Z_WGS84)
{ /* Begin Geocentric_Shift_WGS72_To_WGS84 */
/*
* This function shifts a geocentric coordinate (X, Y, Z in meters) relative
* to WGS72 to a geocentric coordinate (X, Y, Z in meters) relative to WGS84.
*
* X : X coordinate relative to WGS72 (input)
* Y : Y coordinate relative to WGS72 (input)
* Z : Z coordinate relative to WGS72 (input)
* X_WGS84 : X coordinate relative to WGS84 (output)
* Y_WGS84 : Y coordinate relative to WGS84 (output)
* Z_WGS84 : Z coordinate relative to WGS84 (output)
*/
double Lat_72; /* Latitude relative to WGS72 */
double Lon_72; /* Longitude relative to WGS72 */
double Hgt_72; /* Height relative to WGS72 */
double Lat_84; /* Latitude relative to WGS84 */
double Lon_84; /* Longitude relative to WGS84 */
double Hgt_84; /* Heightt relative to WGS84 */
double a_72; /* Semi-major axis in meters of WGS72 ellipsoid */
double f_72; /* Flattening of WGS72 ellipsoid */
double a_84; /* Semi-major axis in meters of WGS84 ellipsoid */
double f_84; /* Flattening of WGS84 ellipsoid */
/* Set WGS72 ellipsoid params */
WGS72_Parameters(&a_72, &f_72);
Set_Geocentric_Parameters(a_72, f_72);
Convert_Geocentric_To_Geodetic(X, Y, Z, &Lat_72, &Lon_72, &Hgt_72);
Geodetic_Shift_WGS72_To_WGS84(Lat_72, Lon_72, Hgt_72, &Lat_84, &Lon_84,
&Hgt_84);
/* Set WGS84 ellipsoid params */
WGS84_Parameters(&a_84, &f_84);
Set_Geocentric_Parameters(a_84, f_84);
Convert_Geodetic_To_Geocentric(Lat_84, Lon_84, Hgt_84, X_WGS84, Y_WGS84,
Z_WGS84);
} /* End Geocentric_Shift_WGS72_To_WGS84 */
void Geocentric_Shift_WGS84_To_WGS72(const double X_WGS84,
const double Y_WGS84,
const double Z_WGS84,
double *X,
double *Y,
double *Z)
{ /* Begin Geocentric_Shift_WGS84_To_WGS72 */
/*
* This function shifts a geocentric coordinate (X, Y, Z in meters) relative
* to WGS84 to a geocentric coordinate (X, Y, Z in meters) relative to WGS72.
*
* X_WGS84 : X coordinate relative to WGS84 (input)
* Y_WGS84 : Y coordinate relative to WGS84 (input)
* Z_WGS84 : Z coordinate relative to WGS84 (input)
* X : X coordinate relative to WGS72 (output)
* Y : Y coordinate relative to WGS72 (output)
* Z : Z coordinate relative to WGS72 (output)
*/
double Lat_72; /* Latitude relative to WGS72 */
double Lon_72; /* Longitude relative to WGS72 */
double Hgt_72; /* Height relative to WGS72 */
double Lat_84; /* Latitude relative to WGS84 */
double Lon_84; /* Longitude relative to WGS84 */
double Hgt_84; /* Heightt relative to WGS84 */
double a_72; /* Semi-major axis in meters of WGS72 ellipsoid */
double f_72; /* Flattening of WGS72 ellipsoid */
double a_84; /* Semi-major axis in meters of WGS84 ellipsoid */
double f_84; /* Flattening of WGS84 ellipsoid */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -