Unverified Commit f1ec6330 authored by Sparkf's avatar Sparkf 🏙️
Browse files

RealtimeMap.vue: update style of the popup; BusChartVue.vue: update station loc

parent 096a830a
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -305,7 +305,7 @@ export default {
                if ((p_nearest.properties.dist * 1000 > 100)|(dist<100)) {
                  return {
                    value: [-1, 0],
                    name: f.id,
                    name: '粤B' + f.id.slice(2,),
                    itemStyle: { color: "#222", show: false },
                    symbol: "image://https://bus.sustcra.com/bus-top-view.png",
                    symbolSize: 30,
@@ -315,7 +315,7 @@ export default {
                }
                return {
                  value: [1- f.route_dir + thisRoute * 2, dist],
                  name: f.id,
                  name: '粤B' + f.id.slice(2,),
                  itemStyle: { color: "#222" },
                  symbol: "image://https://bus.sustcra.com/bus-top-view.png",
                  symbolSize: 30,
+18 −13
Original line number Diff line number Diff line
@@ -275,27 +275,32 @@ export default {
    },

    createPopup(busData) {
      // 创建弹窗内容
      const routeDirText = busData.route_dir === 0 ? '上行 UP' : '下行 DOWN';
      let routeDirText;
      const routeCodeLastDigit = busData.route_code.slice(-1);
      if (routeCodeLastDigit === '1') {
        routeDirText = busData.route_dir === 0 ? '欣园 Joy Highland' : '工学院 COE';
      } else if (routeCodeLastDigit === '2') {
        routeDirText = busData.route_dir === 0 ? '欣园 Joy Highland' : '科研楼 Research BLDG.';
      } else {
        routeDirText = '未知'; // Fallback text in case neither condition is true
      }
      const LineColour = busData.route_code.slice(-1) === '1' ? '#f7911d': '#29abe2';
      const htmlContent = `
    <div style="line-height: 1.2;">
      <p class="car-plate" style="margin: 0; line-height: 1.2;">
      <div style="margin-top: 0; font-size: 14px; margin: 0; color: #333; font-weight: bold;">
        粤B${busData.id.slice(2,)}
      </p>
      <p style="margin: 0; line-height: 1.2;">
      </div>
      <p style="font-size: 12px; margin: 0px 0; color: #666;">
        ${busData.speed} km/h
      </p>
      <p style="margin: 0; line-height: 1.4;">
        <span style="background-color: ${LineColour}; color: white; padding: 2px 4px; border-radius: 3px;"><b>Line ${busData.route_code.slice(-1)} 号线</b></span>
      <p style="margin: 0px 0; line-height: 1.4;">
        <span style="display: inline-block; background-color: ${LineColour}; color: white; padding: 2px 6px; border-radius: 3px; font-weight: bold;">Line ${busData.route_code.slice(-1)} 号线</span>
      </p>
      <p style="margin: 0; line-height: 1.2;">
        <b>${routeDirText}</b>
      <p style="font-size: 12px; margin: 0px 0; color: #666;">
        To往: <b>${routeDirText}</b>
      </p>
      <p style="margin: 0; line-height: 1.2;">
        下站: <b>${busData.next_station_string}</b>
      <p style="font-size: 12px; margin: 0px 0; color: #666;">
        下站: <b style="color: #333;">${busData.next_station_string}</b>
      </p>
    </div>
  `;
      return new maplibre.Popup({ offset: 20 }).setHTML(htmlContent);
    },
+2 −1
Original line number Diff line number Diff line
@@ -4,9 +4,10 @@
    "features": [
        { "type": "Feature", "properties": { "name": "工学院", "dist": 0.0 }, "geometry": { "type": "Point", "coordinates": [113.9902, 22.60336] } },
        { "type": "Feature", "properties": { "name": "科研楼", "dist": 542.89970148591362 }, "geometry": { "type": "Point", "coordinates": [113.99153, 22.599643] } },
        { "type": "Feature", "properties": { "name": "号门", "dist": 907.62735789785825 }, "geometry": { "type": "Point", "coordinates": [113.990399, 22.597132] } },
        { "type": "Feature", "properties": { "name": "7号门", "dist": 907.62735789785825 }, "geometry": { "type": "Point", "coordinates": [113.990399, 22.597132] } },
        { "type": "Feature", "properties": { "name": "行政楼", "dist": 1149.0456938127084 }, "geometry": { "type": "Point", "coordinates": [113.992403, 22.597011] } },
        { "type": "Feature", "properties": { "name": "1号门", "dist": 1513.4263569176362 }, "geometry": { "type": "Point", "coordinates": [113.994898, 22.59569] } },
        { "type": "Feature", "properties": { "name": "2号门", "dist": 1752 }, "geometry": { "type": "Point", "coordinates": [113.99585,22.59788] } },
        { "type": "Feature", "properties": { "name": "3号门", "dist": 2230.3249460522952 }, "geometry": { "type": "Point", "coordinates": [113.99939, 22.599893] } },
        { "type": "Feature", "properties": { "name": "专家公寓", "dist": 2546.2198658400307 }, "geometry": { "type": "Point", "coordinates": [113.998329, 22.601975] } },
        { "type": "Feature", "properties": { "name": "教工餐厅", "dist": 2727.0013627137873 }, "geometry": { "type": "Point", "coordinates": [113.997811, 22.603325] } },