Ejemplo n.º 1
0
        internal static SpatialAnalysisOperationEventBase DeserializeSpatialAnalysisOperationEventBase(JsonElement element)
        {
            Optional <string> threshold = default;
            Optional <SpatialAnalysisOperationFocus> focus = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("threshold"))
                {
                    threshold = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("focus"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    focus = new SpatialAnalysisOperationFocus(property.Value.GetString());
                    continue;
                }
            }
            return(new SpatialAnalysisOperationEventBase(threshold.Value, Optional.ToNullable(focus)));
        }
        internal static SpatialAnalysisPersonDistanceEvent DeserializeSpatialAnalysisPersonDistanceEvent(JsonElement element)
        {
            Optional <SpatialAnalysisPersonDistanceEventTrigger> trigger = default;
            Optional <string> outputFrequency          = default;
            Optional <string> minimumDistanceThreshold = default;
            Optional <string> maximumDistanceThreshold = default;
            Optional <string> threshold = default;
            Optional <SpatialAnalysisOperationFocus> focus = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("trigger"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    trigger = new SpatialAnalysisPersonDistanceEventTrigger(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("outputFrequency"))
                {
                    outputFrequency = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("minimumDistanceThreshold"))
                {
                    minimumDistanceThreshold = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("maximumDistanceThreshold"))
                {
                    maximumDistanceThreshold = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("threshold"))
                {
                    threshold = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("focus"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    focus = new SpatialAnalysisOperationFocus(property.Value.GetString());
                    continue;
                }
            }
            return(new SpatialAnalysisPersonDistanceEvent(threshold.Value, Optional.ToNullable(focus), Optional.ToNullable(trigger), outputFrequency.Value, minimumDistanceThreshold.Value, maximumDistanceThreshold.Value));
        }