Commit 97a6d123 authored by garciay's avatar garciay
Browse files

Add support of geographical external functions

parent b76a4180
......@@ -818,7 +818,7 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
external function fx_isLocationInsidePolygonalRegion(in PolygonalRegion p_region, in ThreeDLocation p_location) return boolean;
external function fx_isLocationInsidePolygonalRegion(in PolygonalRegion p_region, in ThreeDLocation p_location) return boolean;
/**
* @desc Check if the location is inside an identified region
......@@ -829,6 +829,17 @@ module LibItsSecurity_Functions {
*/
external function fx_isLocationInsideIdentifiedRegion(in IdentifiedRegion p_region, in ThreeDLocation p_location) return boolean;
/**
* @desc Convert a spacial coordinate from DMS to Dms
* @param p_degrees The degrees (D)
* @param p_minutes The minutes (M)
* @param p_seconds The seconds (S)
* @param p_latlon The latitude/longitude: (N|S|E|W)
* @return The decimal coordinate on success, 0.0, otherwise
* @verdict Unchanged
*/
external function fx_dms2dd(in integer p_degrees, in integer p_minutes, in float p_seconds, in charstring p_latlon) return float;
} // End of group geodesic
} // End of group externalFunctions
......@@ -913,8 +924,12 @@ module LibItsSecurity_Functions {
function f_isPolygonalRegionInside(in template (value) PolygonalRegion p_parent,
in template (value) PolygonalRegion p_region
) return boolean {
// TODO: call external function
return true;
// Sanity check
if (not isbound(p_parent) or not isbound(p_region) or (lengthof(p_parent) == 0) or (lengthof(p_region) == 0)) {
return false;
}
return fx_isPolygonalRegionInside(valueof(p_parent), valueof(p_region));
} // End of function f_isPolygonalRegionInside
/**
......@@ -923,7 +938,6 @@ module LibItsSecurity_Functions {
function f_isIdentifiedRegionInside(in template (value) UInt16 p_parent,
in template (value) UInt16 p_region
) return boolean {
// TODO: call external function
return valueof(p_parent) == valueof(p_region);
} // End of function f_isIdentifiedRegionInside
......@@ -989,12 +1003,14 @@ module LibItsSecurity_Functions {
* @verdict Unchanged
*/
function f_isLocationInsideRectangularRegion(in template (value) RectangularRegions p_region,
in template (value) ThreeDLocation p_location
in template (value) ThreeDLocation p_location
) return boolean {
// Sanity check
if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) {
return false;
}
log("f_isLocationInsideRectangularRegion: p_polygonalArea: ", p_region);
log("f_isLocationInsideRectangularRegion: p_location: ", p_location);
return fx_isLocationInsideRectangularRegion(valueof(p_region), valueof(p_location));
} // End of function f_isLocationInsideRectangularRegion
......@@ -1006,13 +1022,15 @@ module LibItsSecurity_Functions {
* @return true on success, false otherwise
* @verdict Unchanged
*/
function f_isLocationInsidePolygonalRegion(in template (value) PolygonalRegion p_region,
function f_isLocationInsidePolygonalRegion(in template (value) PolygonalRegion p_region,
in template (value) ThreeDLocation p_location
) return boolean {
// Sanity check
if (not isbound(p_region) or not isbound(p_location) or (lengthof(p_region) == 0)) {
return false;
}
// log("f_isLocationInsidePolygonalRegion: p_polygonalArea: ", p_region, " - ", valueof(p_region));
// log("f_isLocationInsidePolygonalRegion: p_location: ", p_location, " - ", valueof(p_location));
return fx_isLocationInsidePolygonalRegion(valueof(p_region), valueof(p_location));
} // End of function f_isLocationInsidePolygonalRegion
......@@ -1049,6 +1067,49 @@ module LibItsSecurity_Functions {
return false;
} // End of function f_isLocationInsideOtherRegion
/**
* @desc Convert a spacial coordinate from DMS to Dms
* @param p_degrees The degrees (D)
* @param p_minutes The minutes (M)
* @param p_seconds The seconds (S)
* @param p_latlon The latitude/longitude: (N|S|E|W)
* @return The decimal coordinate on success, 0.0, otherwise
* @verdict Unchanged
*/
function f_dms2dd(in integer p_degrees, in integer p_minutes, in float p_seconds, in charstring p_latlon)
return float {
// Sanity checks
if (lengthof(p_latlon) != 1) {
return 0.0;
} else if ((p_latlon != "N") and (p_latlon != "S") and (p_latlon != "E") and (p_latlon != "W")) {
return 0.0;
}
return fx_dms2dd(p_degrees, p_minutes, p_seconds, p_latlon);
} // End of function f_dms2dd
/**
* @desc Convert the latitude from float to int
* @param p_latitude The latitude to be converted. Significand length shall be 7 digits length
* @return The converted latitude
* @verdict Unchanged
*/
function f_ddlat2int(in float p_latitude)
return WGSLatitude {
return float2int(p_latitude * 10000000.0); // Significand length shall be 7 digits length
}
/**
* @desc Convert the longitude from float to int
* @param p_longitude The longitude to be converted. Significand length shall be 6 digits length
* @return The converted longitude
* @verdict Unchanged
*/
function f_ddlon2int(in float p_longitude)
return WGSLongitude {
return float2int(p_longitude * 1000000.0); // Significand length shall be 6 digits length
}
} // End of group geometryFunctions
} // End of module LibItsSecurity_Functions
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment