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); }
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); }
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); }
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); }
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; }
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; }
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; }
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; }