BackendlessAPI.Service.GeoService.checkGeoQuery C# (CSharp) Method

checkGeoQuery() private method

private checkGeoQuery ( BackendlessAPI.Geo.BackendlessGeoQuery geoQuery ) : void
geoQuery BackendlessAPI.Geo.BackendlessGeoQuery
return void
    private void checkGeoQuery( BackendlessGeoQuery geoQuery )
    {
      if( geoQuery == null )
        throw new ArgumentNullException( ExceptionMessage.NULL_GEO_QUERY );

      if( geoQuery.SearchRectangle != null )
      {
        if( geoQuery.SearchRectangle.Length != 4 )
          throw new ArgumentException( ExceptionMessage.WRONG_SEARCH_RECTANGLE_QUERY );

        if( !Double.IsNaN( geoQuery.Radius ) )
          throw new ArgumentException( ExceptionMessage.INCONSISTENT_GEO_QUERY );

        if( !Double.IsNaN( geoQuery.Latitude ) )
          throw new ArgumentException( ExceptionMessage.INCONSISTENT_GEO_QUERY );

        if( !Double.IsNaN( geoQuery.Longitude ) )
          throw new ArgumentException( ExceptionMessage.INCONSISTENT_GEO_QUERY );
      }
      else if( !Double.IsNaN( geoQuery.Radius ) )
      {
        if( geoQuery.Radius <= 0 )
          throw new ArgumentException( ExceptionMessage.WRONG_RADIUS );

        if( Double.IsNaN( geoQuery.Latitude ) )
          throw new ArgumentNullException( ExceptionMessage.WRONG_LATITUDE_VALUE );

        if( Double.IsNaN( geoQuery.Longitude ) )
          throw new ArgumentNullException( ExceptionMessage.WRONG_LONGITUDE_VALUE );

        CheckCoordinates( geoQuery.Latitude, geoQuery.Longitude );

        if( geoQuery.Units == null )
          throw new ArgumentNullException( ExceptionMessage.NULL_UNIT );
      }
      else if( geoQuery.Categories == null && geoQuery.Metadata == null )
        throw new ArgumentNullException( ExceptionMessage.WRONG_GEO_QUERY );

      if( geoQuery.Categories != null )
        foreach( string categoryName in geoQuery.Categories )
          CheckCategoryName( categoryName );

      if( geoQuery.Offset < 0 )
        throw new ArgumentException( ExceptionMessage.WRONG_OFFSET );

      if( geoQuery.PageSize < 0 )
        throw new ArgumentException( ExceptionMessage.WRONG_PAGE_SIZE );
    }
    #endregion