Commit cb8fc256 authored by filatov's avatar filatov
Browse files

geometryFunctions

parent 311476d0
Loading
Loading
Loading
Loading
+40 −0
Original line number Original line Diff line number Diff line
@@ -655,4 +655,44 @@ module LibItsSecurity_Functions {
        
        
    } // End of group externalFunctions
    } // End of group externalFunctions
    
    
    group geometryFunctions {
        
        /**
         * @desc    Check that given location is valid
         * @param   p_location    location to be checked
         * @return  true on success, false otherwise
         */
        function f_isValidTwoDLocation(in template (value) TwoDLocation p_location
        ) return boolean {
            return not (    p_location.longitude > c_maxLongitude
                         or p_location.longitude < c_minLongitude
                         or p_location.latitude  < c_minLatitude
                         or p_location.latitude  > c_maxLatitude );
        }
        
        /**
         * @desc    Check that two given rectanlular regions are intersected
         *          Note: Regions must be normalized(northwest.latitude >= southeast.latitude)
         *          TODO: Add case when 
         * @param   p_r1    Region 1
         * @param   p_r2    Region 2
         * 
         * @return  true on success, false otherwise
         */
        function f_isRectangularRegionsIntersected(in template (value) RectangularRegion p_r1,
                                                   in template (value) RectangularRegion p_r2
        ) return boolean {                                           
            return not (    p_r2.northwest.longitude > p_r1.southeast.longitude
                         or p_r2.southeast.longitude < p_r1.northwest.longitude
                         or p_r2.southeast.latitude  > p_r1.northwest.latitude
                         or p_r2.northwest.latitude  < p_r1.southeast.latitude );
        }
        
        function f_isContinuousRectangularRegions(in template (value) RectangularRegions regions
        ) return boolean {
            // TODO: implement it
            return true;
        }
    }
    
} // End of module LibItsSecurity_Functions
} // End of module LibItsSecurity_Functions
 No newline at end of file
+5 −0
Original line number Original line Diff line number Diff line
@@ -61,6 +61,11 @@ module LibItsSecurity_Templates {
         */
         */
        const UInt16 c_messageType_DENM := 1;
        const UInt16 c_messageType_DENM := 1;
        
        
        const Int32 c_minLongitude := -1800000000;
        const Int32 c_maxLongitude :=  1800000000;
        const Int32 c_minLatitude  := -900000000; 
        const Int32 c_maxLatitude  :=  900000000;
        
    } // End of group constants
    } // End of group constants
    
    
    /**
    /**