コード例 #1
0
        private bool TryParseCoordinateArrayArrayArray(RavenJArray coordinates, StringBuilder result)
        {
            if (coordinates == null)
            {
                return(false);
            }

            var valid = coordinates.All(x => x is RavenJArray);

            if (!valid)
            {
                return(false);
            }

            for (var index = 0; index < coordinates.Length; index++)
            {
                if (index > 0)
                {
                    result.Append(", ");
                }
                result.Append("(");
                if (!TryParseCoordinateArrayArray((RavenJArray)coordinates[index], result))
                {
                    return(false);
                }
                result.Append(")");
            }
            return(true);
        }
コード例 #2
0
        private bool TryParseCoordinateArrayArrayArray(RavenJArray coordinates, out CoordinateInfo[][][] result)
        {
            result = null;
            if (coordinates == null)
            {
                return(false);
            }

            var valid = coordinates.All(x => x is RavenJArray);

            if (!valid)
            {
                return(false);
            }

            var tempResult = new CoordinateInfo[coordinates.Length][][];

            for (var index = 0; index < coordinates.Length; index++)
            {
                if (!TryParseCoordinateArrayArray((RavenJArray)coordinates[index], out tempResult[index]))
                {
                    return(false);
                }
            }
            result = tempResult;
            return(true);
        }
コード例 #3
0
 private bool TryParseCoordinate(RavenJArray coordinates, StringBuilder result)
 {
     if (coordinates != null && coordinates.Length > 1 && coordinates.All(x => x is RavenJValue))
     {
         var vals = coordinates.Cast <RavenJValue>().ToList();
         if (vals.All(x => x.Type == JTokenType.Float || x.Type == JTokenType.Integer))
         {
             result.AppendFormat(
                 CultureInfo.InvariantCulture,
                 "{0} {1}",
                 Convert.ToDouble(vals[0].Value),
                 Convert.ToDouble(vals[1].Value)
                 );
             return(true);
         }
     }
     return(false);
 }
コード例 #4
0
 private bool TryParseCoordinate(RavenJArray coordinates, out CoordinateInfo result)
 {
     if (coordinates != null && coordinates.Length > 1 && coordinates.All(x => x is RavenJValue))
     {
         var vals = coordinates.Cast <RavenJValue>().ToList();
         if (vals.All(x => x.Type == JTokenType.Float || x.Type == JTokenType.Integer))
         {
             result = new CoordinateInfo
             {
                 X = Convert.ToDouble(vals[0].Value),
                 Y = Convert.ToDouble(vals[1].Value),
                 Z = vals.Count > 2 ? Convert.ToDouble(vals[2].Value) : (double?)null,
                 M = vals.Count > 3 ? Convert.ToDouble(vals[3].Value) : (double?)null
             };
             return(true);
         }
     }
     result = null;
     return(false);
 }
コード例 #5
0
        private bool TryParseCoordinateArrayArrayArray(RavenJArray coordinates, StringBuilder result)
        {
            if (coordinates == null)
                return false;

            var valid = coordinates.All(x => x is RavenJArray);
            if (!valid)
                return false;

			for (var index = 0; index < coordinates.Length; index++)
			{
				if (index > 0)
					result.Append(", ");
				result.Append("(");
				if (!TryParseCoordinateArrayArray((RavenJArray)coordinates[index], result))
					return false;
				result.Append(")");
            }
            return true;
        }
コード例 #6
0
        private bool TryParseCoordinate(RavenJArray coordinates, StringBuilder result)
        {
			if (coordinates != null && coordinates.Length > 1 && coordinates.All(x => x is RavenJValue))
			{
				var vals = coordinates.Cast<RavenJValue>().ToList();
				if (vals.All(x => x.Type == JTokenType.Float || x.Type == JTokenType.Integer))
				{
					result.AppendFormat(
						CultureInfo.InvariantCulture,
						"{0} {1}",
						Convert.ToDouble(vals[0].Value),
					    Convert.ToDouble(vals[1].Value)
					);
					return true;
				}
			}
			return false;
        }
コード例 #7
0
		private bool TryParseCoordinateArrayArrayArray(RavenJArray coordinates, out CoordinateInfo[][][] result)
		{
			result = null;
			if (coordinates == null)
				return false;

			var valid = coordinates.All(x => x is RavenJArray);
			if (!valid)
				return false;

			var tempResult = new CoordinateInfo[coordinates.Length][][];
			for (var index = 0; index < coordinates.Length; index++)
			{
				if (!TryParseCoordinateArrayArray((RavenJArray)coordinates[index], out tempResult[index]))
					return false;
			}
			result = tempResult;
			return true;
		}
コード例 #8
0
		private bool TryParseCoordinate(RavenJArray coordinates, out CoordinateInfo result)
		{
			if (coordinates != null && coordinates.Length > 1 && coordinates.All(x => x is RavenJValue))
			{
				var vals = coordinates.Cast<RavenJValue>().ToList();
				if (vals.All(x => x.Type == JTokenType.Float || x.Type == JTokenType.Integer))
				{
					result = new CoordinateInfo
						{
							X = Convert.ToDouble(vals[0].Value),
							Y = Convert.ToDouble(vals[1].Value),
							Z = vals.Count > 2 ? Convert.ToDouble(vals[2].Value) : (double?) null,
							M = vals.Count > 3 ? Convert.ToDouble(vals[3].Value) : (double?) null
						};
					return true;
				}
			}
			result = null;
			return false;
		}