Libella megjelnítése mérőrúdhoz, transzverzális rajzolása az aktuális kitűzendő ponthoz
This commit is contained in:
@@ -1,7 +1,10 @@
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:terepi_seged/services/coord_converter_service.dart';
|
||||
import 'package:terepi_seged/services/gnss/gnss_service.dart';
|
||||
import 'package:terepi_seged/services/stakeout_service.dart';
|
||||
|
||||
@@ -43,12 +46,59 @@ class StakeoutMapLayers extends StatelessWidget {
|
||||
strokeWidth: 2,
|
||||
));
|
||||
}
|
||||
// Transzverzális az aktuális célnál: a vonalra merőleges segédvonal
|
||||
// ±30 m hosszan, 10 m-enkénti méter-címkékkel — terepi akadálynál
|
||||
// e mentén látszik, hova tolható el a pont.
|
||||
final transversal = <LatLng>[];
|
||||
final transversalTicks = <Marker>[];
|
||||
if (target != null && Get.isRegistered<CoordConverterService>()) {
|
||||
final lb = svc.lineBearingAt(target);
|
||||
if (lb != null) {
|
||||
final perpRad = (lb + 90) * math.pi / 180;
|
||||
LatLng at(double d) {
|
||||
final y = target.planEovY + d * math.sin(perpRad);
|
||||
final x = target.planEovX + d * math.cos(perpRad);
|
||||
final w = CoordConverterService.to.eovToWgsPoint(y, x);
|
||||
return LatLng(w.y, w.x);
|
||||
}
|
||||
|
||||
transversal
|
||||
..add(at(-30))
|
||||
..add(at(30));
|
||||
|
||||
for (final d in const [-30.0, -20.0, -10.0, 10.0, 20.0, 30.0]) {
|
||||
transversalTicks.add(Marker(
|
||||
point: at(d),
|
||||
width: 24,
|
||||
height: 16,
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.orange.withOpacity(0.85),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
d.abs().toStringAsFixed(0),
|
||||
style: const TextStyle(
|
||||
fontSize: 9,
|
||||
color: Colors.white,
|
||||
fontWeight: FontWeight.w700),
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
// 300 pont fölött a címkék csak a célon (teljesítmény).
|
||||
final showLabels = points.length <= 300;
|
||||
|
||||
return Stack(children: [
|
||||
PolylineLayer(polylines: [
|
||||
if (transversal.isNotEmpty)
|
||||
Polyline(
|
||||
points: transversal,
|
||||
color: Colors.orange.withValues(alpha: 0.8),
|
||||
strokeWidth: 2),
|
||||
...linePolys,
|
||||
if (hasPos && target != null)
|
||||
Polyline(
|
||||
@@ -61,6 +111,7 @@ class StakeoutMapLayers extends StatelessWidget {
|
||||
),
|
||||
]),
|
||||
MarkerLayer(markers: [
|
||||
...transversalTicks,
|
||||
for (final p in points)
|
||||
Marker(
|
||||
point: LatLng(p.planLat, p.planLon),
|
||||
|
||||
Reference in New Issue
Block a user