APIAny_​CalcSunOnPlaceID

Calculates the sun position in a given place.

    GSErrCode ACAPI_Goodies (
        APIAny_CalcSunOnPlaceID,
        API_PlaceInfo*     placeInfo,

    );

 

Parameters

placeInfo
[in/out] Parameters of the sun place.

API_PlaceInfo

cityInd

required, index of the city attribute

sumTime

required, daylight saving on/off

date

required, in days from 1th, January

time

required, in minutes from 0:00 AM

north

required, north direction

sunAngXY

out, the sun angle

sunAngZ

out, the sun angle

 

Return Values

NoError
The function has completed with success.
APIERR_NOPLAN
no open project
APIERR_BADPARS
placeInfo is nullptr or contains invalid data

For other common API errors see the API Errors document.

 

Remarks

This function is used get the sun angles to in a custom place. The sun angles are calculated in a given city and on a certain day and time. The calculated angles are returned in the sunAngXY and sunAngZ fields of the structure.

Refer to the APIEnv_GetPlaceSetsID function to get the actual location and date parameters.

 

Example


API_PlaceInfo  placeInfo;
API_Attribute  attrib;
GSErrCode      err;

BNZeroMemory (&attrib, sizeof (API_Attribute));
attrib.header.typeID = API_CityID;
CHCopyC ("London", attrib.header.name);

err = ACAPI_Attribute_Search (&attrib.header);
if (!err) {

    BNZeroMemory (&placeInfo, sizeof (API_PlaceInfo));
    placeInfo.cityInd = attrib.header.index;
    placeInfo.sumTime = false;    /* winter time */
    placeInfo.date = 31 + 5;      /* febr. 5.   */
    placeInfo.time = 7 * 60;      /* seven o'clock */
    placeInfo.north = PI / 2;     /* up direction */

    err = ACAPI_Goodies (APIAny_CalcSunOnPlaceID, &placeInfo, nullptr);
}

 

Requirements

Version: API 4.1 or later
Header: APIdefs_Goodies.h

 

See Also

API_PlaceInfo,
APIEnv_GetPlaceSetsID,
ACAPI_Goodies, API Functions