-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2c0ff72
commit c1daa11
Showing
13 changed files
with
324 additions
and
177 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,5 +7,6 @@ | |
}, | ||
"LC08_L1TP_060247_20180905_20180912_01_T1_L1TP" | ||
] | ||
} | ||
}, | ||
"filter-lang": "cql2-json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,5 +21,6 @@ | |
] | ||
} | ||
] | ||
} | ||
}, | ||
"filter-lang": "cql2-json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using GeoJSON.Net.Converters; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using Stac.Api.Models; | ||
using Stac.Api.Models.Cql2; | ||
|
||
namespace Stac.Api.Converters | ||
{ | ||
public class AndOrExpressionConverter : JsonConverter | ||
{ | ||
public override bool CanConvert(Type objectType) | ||
{ | ||
return objectType == typeof(AndOrExpression); | ||
} | ||
|
||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
{ | ||
reader.DateParseHandling = DateParseHandling.None; | ||
JObject jo = JObject.Load(reader); | ||
return ReadJObject(jo, objectType, existingValue, serializer); | ||
} | ||
|
||
public AndOrExpression ReadJObject(JObject jo, Type objectType, object existingValue, JsonSerializer serializer) | ||
{ | ||
return new AndOrExpression | ||
{ | ||
Op = jo["op"].ToObject<AndOrExpressionOp>(serializer), | ||
Args = jo["args"].ToObject<List<BooleanExpression>>() | ||
}; | ||
} | ||
|
||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
{ | ||
var expression = (AndOrExpression)value; | ||
writer.WriteStartObject(); | ||
writer.WritePropertyName("op"); | ||
serializer.Serialize(writer, expression.Op); | ||
writer.WritePropertyName("args"); | ||
serializer.Serialize(writer, expression.Args); | ||
writer.WriteEndObject(); | ||
} | ||
} | ||
|
||
|
||
} |
48 changes: 48 additions & 0 deletions
48
src/Stac.Api/Converters/BinaryComparisonPredicateConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using GeoJSON.Net.Converters; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
using Stac.Api.Models; | ||
using Stac.Api.Models.Cql2; | ||
|
||
namespace Stac.Api.Converters | ||
{ | ||
public class BinaryComparisonPredicateConverter : JsonConverter | ||
{ | ||
public override bool CanConvert(Type objectType) | ||
{ | ||
return objectType == typeof(AndOrExpression); | ||
} | ||
|
||
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
{ | ||
reader.DateParseHandling = DateParseHandling.None; | ||
JObject jo = JObject.Load(reader); | ||
return ReadJObject(jo, objectType, existingValue, serializer); | ||
} | ||
|
||
public BinaryComparisonPredicate ReadJObject(JObject jo, Type objectType, object existingValue, JsonSerializer serializer) | ||
{ | ||
return new BinaryComparisonPredicate | ||
{ | ||
Op = jo["op"].ToObject<ComparisonPredicateOp>(serializer), | ||
Args = jo["args"].ToObject<ScalarOperands>() | ||
}; | ||
} | ||
|
||
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
{ | ||
var expression = (BinaryComparisonPredicate)value; | ||
writer.WriteStartObject(); | ||
writer.WritePropertyName("op"); | ||
serializer.Serialize(writer, expression.Op); | ||
writer.WritePropertyName("args"); | ||
serializer.Serialize(writer, expression.Args); | ||
writer.WriteEndObject(); | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters