artem_niko Posted February 23, 2021 Share Posted February 23, 2021 Good day! Since the Falcoln Components component developer does not respond in any way to my questions, which I asked both through private messages and via email, I receive complete ignorance and do not receive answers to questions important to me (it is very disappointing that as soon as you buy components, then the developer no longer cares about you and your questions and the developer does not want to provide support, does it, @Marlon Nardi?) Question: Why values of distance and duration calculate only from point A to point B, when I creating multi route? As result, I get not right value: But, I need get values of duration and distance from point A to point I. Code: procedure TUniFormPreviewMap.UniFSMap1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); var vJSON: string; Obj: TJsonObject; vI: Integer; begin if EventName = 'fs_directions_changed' then begin vJSON := Params.Values['directionsDisplay']; Obj := TJsonBaseObject.Parse(vJSON) as TJsonObject; try lblDistance.Text := Obj.S['distancetext']; lblDuration.Text := Obj.S['durationtext']; ClientDataSet1.CreateDataSet; ClientDataSet1.DisableControls; try ClientDataSet1.EmptyDataSet; for vI := 0 to Obj.A['steps'].Count - 1 do begin ClientDataSet1.Append; ClientDataSet1.FieldByName('sequence').AsInteger := vI + 1; ClientDataSet1.FieldByName('enc_lat_lngs').AsString := Obj.A['steps'].Values[vI].S['enc_lat_lngs']; ClientDataSet1.FieldByName('instructions').AsString := Obj.A['steps'].Values[vI].S['instructions']; ClientDataSet1.FieldByName('distance_value').AsInteger := Obj.A['steps'].Values[vI].I['distancevalue']; ClientDataSet1.FieldByName('distance_text').AsString := Obj.A['steps'].Values[vI].S['distancetext']; ClientDataSet1.FieldByName('duration_value').AsInteger := Obj.A['steps'].Values[vI].I['durationvalue']; ClientDataSet1.FieldByName('duration_text').AsString := Obj.A['steps'].Values[vI].S['durationtext']; ClientDataSet1.FieldByName('startlocation_lat').AsString := Obj.A['steps'].Values[vI].O['startlocation'].S['lat']; ClientDataSet1.FieldByName('startlocation_lng').AsString := Obj.A['steps'].Values[vI].O['startlocation'].S['lng']; ClientDataSet1.FieldByName('endlocation_lat').AsString := Obj.A['steps'].Values[vI].O['endlocation'].S['lat']; ClientDataSet1.FieldByName('endlocation_lng').AsString := Obj.A['steps'].Values[vI].O['endlocation'].S['lng']; ClientDataSet1.Post; end; finally ClientDataSet1.First; ClientDataSet1.EnableControls; end; finally Obj.Free; end; end; end; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.