コード例 #1
0
        protected override void AddSpecifiedAttributes()
        {
            AddAttribute(PropertyHelper.GetDescription(() => RouteId), RouteId);

            if (RoutingMode != null)
            {
                AddAttribute(RoutingMode);
            }
            if (Waypoints != null)
            {
                foreach (var wp in Waypoints)
                {
                    AddAttribute(wp);
                }
            }
            if (JsonAttributes != null)
            {
                AddAttribute(JsonAttributes);
            }
            if (GeneralizationTolerances != null)
            {
                AddAttribute(GeneralizationTolerances);
            }

            AddAttribute(new JsonRepresentation(JsonAttribute.Include_TypeElement, JsonAttribute.UsePluralNamingForCollections, JsonAttribute.SupressJsonResponseObjectWrapper));

            if (RequestId != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => RequestId), RequestId);
            }
            if (Departure != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Departure), ((DateTime)Departure).ToString("s"));
            }
            if (UnitSystem != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => UnitSystem), EnumHelper.GetDescription(UnitSystem));
            }
            if (ViewBounds != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ViewBounds), ViewBounds.GetAttributeValue());
            }
            if (InstructionFormat != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => InstructionFormat), EnumHelper.GetDescription(InstructionFormat));
            }
            if (Language != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Language), EnumHelper.GetDescription(Language));
            }
            if (JsonCallback != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => JsonCallback), JsonCallback);
            }
            if (Representation != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Representation), EnumHelper.GetDescription(Representation));
            }
            if (RouteAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => RouteAttributes), string.Join(",", RouteAttributes.Select(ra => EnumHelper.GetDescription(ra))));
            }
            if (LegAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => LegAttributes), string.Join(",", LegAttributes.Select(la => EnumHelper.GetDescription(la))));
            }
            if (ManeuverAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ManeuverAttributes), string.Join(",", ManeuverAttributes.Select(ma => EnumHelper.GetDescription(ma))));
            }
            if (LinkAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => LinkAttributes), string.Join(",", LinkAttributes.Select(la => EnumHelper.GetDescription(la))));
            }
            if (ReturnElevation != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ReturnElevation), ReturnElevation.ToString().ToLower());
            }
        }
コード例 #2
0
        protected override void AddSpecifiedAttributes()
        {
            //Add IRequestAttribute types
            AddAttribute(RoutingMode);
            foreach (var wp in Waypoints)
            {
                AddAttribute(wp);
            }
            if (Resolution != null)
            {
                AddAttribute(Resolution);
            }
            if (JsonAttributes != null)
            {
                AddAttribute(JsonAttributes);
            }
            if (GeneralizationTolerances != null)
            {
                AddAttribute(GeneralizationTolerances);
            }
            if (VehicleType != null)
            {
                AddAttribute(VehicleType);
            }
            if (ConsumptionModel != null)
            {
                AddAttribute(ConsumptionModel);
            }
            if (CustomConsumptionDetails != null)
            {
                AddAttribute(CustomConsumptionDetails);
            }

            AddAttribute(new JsonRepresentation(JsonAttribute.Include_TypeElement, JsonAttribute.UsePluralNamingForCollections, JsonAttribute.SupressJsonResponseObjectWrapper));

            //Other parameters
            if (RequestId != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => RequestId), RequestId);
            }
            if (AvoidAreas != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => AvoidAreas), string.Join("!", AvoidAreas.Select(aa => aa.GetAttributeValue()).ToArray()));
            }
            if (AvoidLinks != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => AvoidLinks), string.Join(",", AvoidLinks.Select(al => al.GetAttributeValue()).ToArray()));
            }
            if (AvoidSeasonalClosures != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => AvoidSeasonalClosures), AvoidSeasonalClosures.ToString().ToLower());
            }
            if (AvoidTurns != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => AvoidTurns), string.Join(",", AvoidTurns.Select(at => EnumHelper.GetDescription(at))));
            }
            if (ExcludeZones != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ExcludeZones), string.Join(",", ExcludeZones));
            }
            if (ExcludeCountries != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ExcludeCountries), string.Join(",", ExcludeCountries));
            }
            if (Departure != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Departure), ((DateTime)Departure).ToString("s"));
            }
            if (Arrival != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Arrival), ((DateTime)Arrival).ToString("s"));
            }
            if (Alternatives != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Alternatives), Alternatives.ToString());
            }
            if (UnitSystem != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => UnitSystem), EnumHelper.GetDescription(UnitSystem));
            }
            if (ViewBounds != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ViewBounds), ViewBounds.GetAttributeValue());
            }
            if (InstructionFormat != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => InstructionFormat), EnumHelper.GetDescription(InstructionFormat));
            }
            if (Language != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Language), EnumHelper.GetDescription(Language));
            }
            if (JsonCallback != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => JsonCallback), JsonCallback);
            }
            if (Representation != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Representation), EnumHelper.GetDescription(Representation));
            }
            if (RouteAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => RouteAttributes), string.Join(",", RouteAttributes.Select(ra => EnumHelper.GetDescription(ra))));
            }
            if (LegAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => LegAttributes), string.Join(",", LegAttributes.Select(la => EnumHelper.GetDescription(la))));
            }
            if (ManeuverAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ManeuverAttributes), string.Join(",", ManeuverAttributes.Select(ma => EnumHelper.GetDescription(ma))));
            }
            if (LinkAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => LinkAttributes), string.Join(",", LinkAttributes.Select(la => EnumHelper.GetDescription(la))));
            }
            if (LineAttributes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => LineAttributes), string.Join(",", LineAttributes.Select(la => EnumHelper.GetDescription(la))));
            }

            if (MaxNumberOfChanges != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => MaxNumberOfChanges), MaxNumberOfChanges.ToString());
            }
            if (AvoidTransportTypes != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => AvoidTransportTypes), string.Join(",", AvoidTransportTypes.Select(tt => EnumHelper.GetDescription(tt))));
            }

            if (WalkTimeMultiplier != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => WalkTimeMultiplier), WalkTimeMultiplier.Value.ToString(HereAPISession.Culture));
            }
            if (WalkSpeed != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => WalkSpeed), WalkSpeed.Value.ToString(HereAPISession.Culture));
            }
            if (WalkRadius != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => WalkRadius), WalkRadius.Value.ToString(HereAPISession.Culture));
            }
            if (CombineChange != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => CombineChange), CombineChange.ToString().ToLower());
            }
            if (TruckType != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => TruckType), EnumHelper.GetDescription(TruckType));
            }
            if (TrailersCount != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => TrailersCount), TrailersCount.ToString());
            }

            if (ShippedHazardousGoods != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ShippedHazardousGoods), string.Join(",", ShippedHazardousGoods.Select(sg => EnumHelper.GetDescription(sg))));
            }

            if (LimitedWeight != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => LimitedWeight), LimitedWeight.Value.ToString(HereAPISession.Culture));
            }
            if (WeightPerAxle != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => WeightPerAxle), WeightPerAxle.Value.ToString(HereAPISession.Culture));
            }
            if (Height != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Height), Height.Value.ToString(HereAPISession.Culture));
            }
            if (Width != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Width), Width.Value.ToString(HereAPISession.Culture));
            }
            if (Length != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => Length), Length.Value.ToString(HereAPISession.Culture));
            }

            if (TunnelCategory != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => TunnelCategory), EnumHelper.GetDescription(TunnelCategory));
            }
            if (TruckRestrictionPenalty != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => TruckRestrictionPenalty), EnumHelper.GetDescription(TruckRestrictionPenalty));
            }

            if (ReturnElevation != null)
            {
                AddAttribute(PropertyHelper.GetDescription(() => ReturnElevation), ReturnElevation.ToString().ToLower());
            }
        }