GSMEthesis commited on
Commit
55aed2e
·
verified ·
1 Parent(s): a168835

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -48
app.py CHANGED
@@ -1001,77 +1001,72 @@ def create_ride_map():
1001
 
1002
  m = folium.Map(location=[(origin[0] + destination[0]) / 2, (origin[1] + destination[1]) / 2], zoom_start=13)
1003
 
1004
- purple = "#6a0dad"
1005
 
1006
- # مبدأ - دایره + لیبل
1007
  folium.Marker(
1008
  location=origin,
1009
  tooltip="مبدا",
 
 
 
 
 
 
1010
  icon=folium.DivIcon(
1011
  html=f"""
1012
- <div style="display: flex; align-items: center; direction: rtl;">
1013
- <div style="
1014
- width: 12px;
1015
- height: 12px;
1016
- background-color: {purple};
1017
- border-radius: 50%;
1018
- margin-left: 6px;
1019
- "></div>
1020
- <div style="
1021
- background-color: white;
1022
- border: 2px solid {purple};
1023
- border-radius: 6px;
1024
- padding: 2px 8px;
1025
- color: {purple};
1026
- font-weight: bold;
1027
- font-size: 13px;
1028
- font-family: sans-serif;
1029
- box-shadow: 0 1px 3px rgba(0,0,0,0.3);
1030
- ">
1031
- مبدا
1032
- </div>
1033
  </div>
1034
  """
1035
  )
1036
  ).add_to(m)
1037
 
1038
- # مقصد - آیکون پرچم + لیبل
1039
  folium.Marker(
1040
  location=destination,
1041
  tooltip="مقصد",
 
 
 
 
 
 
1042
  icon=folium.DivIcon(
1043
  html=f"""
1044
- <div style="display: flex; align-items: center; direction: rtl;">
1045
- <div style="
1046
- width: 0;
1047
- height: 0;
1048
- border-left: 8px solid {purple};
1049
- border-top: 6px solid transparent;
1050
- border-bottom: 6px solid transparent;
1051
- margin-left: 6px;
1052
- "></div>
1053
- <div style="
1054
- background-color: white;
1055
- border: 2px solid {purple};
1056
- border-radius: 6px;
1057
- padding: 2px 8px;
1058
- color: {purple};
1059
- font-weight: bold;
1060
- font-size: 13px;
1061
- font-family: sans-serif;
1062
- box-shadow: 0 1px 3px rgba(0,0,0,0.3);
1063
- ">
1064
- مقصد
1065
- </div>
1066
  </div>
1067
  """
1068
  )
1069
  ).add_to(m)
1070
 
1071
- # خط بین مسیر
1072
  folium.PolyLine(
1073
  [origin, destination],
1074
- color=purple,
1075
  weight=4,
1076
  opacity=0.8,
1077
  dash_array="5,5"
 
1001
 
1002
  m = folium.Map(location=[(origin[0] + destination[0]) / 2, (origin[1] + destination[1]) / 2], zoom_start=13)
1003
 
1004
+ purple_hex = "#6a0dad"
1005
 
1006
+ # مبدأ: آیکون دایره (با icon='circle')
1007
  folium.Marker(
1008
  location=origin,
1009
  tooltip="مبدا",
1010
+ icon=folium.Icon(color="purple", icon="circle", prefix="fa")
1011
+ ).add_to(m)
1012
+
1013
+ # لیبل برای مبدأ با رنگ بنفش خاص
1014
+ folium.Marker(
1015
+ location=[origin[0] + 0.001, origin[1]], # کمی بالاتر برای دیده شدن
1016
  icon=folium.DivIcon(
1017
  html=f"""
1018
+ <div style="
1019
+ color: {purple_hex};
1020
+ font-weight: bold;
1021
+ font-size: 13px;
1022
+ font-family: sans-serif;
1023
+ background-color: white;
1024
+ border: 2px solid {purple_hex};
1025
+ border-radius: 6px;
1026
+ padding: 2px 8px;
1027
+ box-shadow: 0 1px 3px rgba(0,0,0,0.3);
1028
+ text-align: center;
1029
+ ">
1030
+ مبدا
 
 
 
 
 
 
 
 
1031
  </div>
1032
  """
1033
  )
1034
  ).add_to(m)
1035
 
1036
+ # مقصد: آیکون پرچم
1037
  folium.Marker(
1038
  location=destination,
1039
  tooltip="مقصد",
1040
+ icon=folium.Icon(color="purple", icon="flag", prefix="fa")
1041
+ ).add_to(m)
1042
+
1043
+ # لیبل برای مقصد
1044
+ folium.Marker(
1045
+ location=[destination[0] + 0.001, destination[1]],
1046
  icon=folium.DivIcon(
1047
  html=f"""
1048
+ <div style="
1049
+ color: {purple_hex};
1050
+ font-weight: bold;
1051
+ font-size: 13px;
1052
+ font-family: sans-serif;
1053
+ background-color: white;
1054
+ border: 2px solid {purple_hex};
1055
+ border-radius: 6px;
1056
+ padding: 2px 8px;
1057
+ box-shadow: 0 1px 3px rgba(0,0,0,0.3);
1058
+ text-align: center;
1059
+ ">
1060
+ مقصد
 
 
 
 
 
 
 
 
 
1061
  </div>
1062
  """
1063
  )
1064
  ).add_to(m)
1065
 
1066
+ # خط مسیر
1067
  folium.PolyLine(
1068
  [origin, destination],
1069
+ color=purple_hex,
1070
  weight=4,
1071
  opacity=0.8,
1072
  dash_array="5,5"