142 lines
5.1 KiB
Dart
142 lines
5.1 KiB
Dart
|
// import 'dart:math';
|
||
|
|
||
|
// import 'package:flutter/material.dart';
|
||
|
// import '../../models/config/model.dart';
|
||
|
// import 'skyPlotView.dart';
|
||
|
|
||
|
// class DrawSkyPlot {
|
||
|
// double width = 500;
|
||
|
// double height = 500;
|
||
|
// late Canvas ctx;
|
||
|
// Map legend = {};
|
||
|
// final Paint _paint = Paint();
|
||
|
// Path path = Path();
|
||
|
// bool isPortrait = false;
|
||
|
// SkyController controller;
|
||
|
// DrawSkyPlot(op, this.controller) {
|
||
|
// ctx = op['ctx']; // canvas dom 对象
|
||
|
// height = op['height']; // 画布高
|
||
|
// width = op['width']; // 画布宽
|
||
|
// _paint
|
||
|
// ..color = Colors.black
|
||
|
// ..strokeWidth = 3
|
||
|
// ..style = PaintingStyle.stroke;
|
||
|
// MediaQueryData mediaQueryData =
|
||
|
// MediaQueryData.fromView(WidgetsBinding.instance.window);
|
||
|
// final orientation = mediaQueryData.orientation;
|
||
|
// // 横屏竖屏宽高重新设置
|
||
|
// if (orientation == Orientation.portrait) {
|
||
|
// height = op['width'];
|
||
|
// isPortrait = true;
|
||
|
// } else {
|
||
|
// width = op['height'];
|
||
|
// isPortrait = false;
|
||
|
// }
|
||
|
// }
|
||
|
|
||
|
// //外圈
|
||
|
// drawSkyPlotCircle() {
|
||
|
// double x = width / 2;
|
||
|
// double y = height / 2;
|
||
|
// double r = height / 2.5;
|
||
|
// ctx.drawCircle(Offset(x, y), r, _paint);
|
||
|
// ctx.drawCircle(Offset(x, y), r * 2 / 3, _paint);
|
||
|
// ctx.drawCircle(Offset(x, y), r / 3, _paint);
|
||
|
// path.moveTo(x - r, y);
|
||
|
// path.lineTo(x + r, y);
|
||
|
// path.moveTo(x, y - r);
|
||
|
// path.lineTo(x, y + r);
|
||
|
// path.moveTo(x + cos(30 * (pi / 180)) * r, y + sin(30 * (pi / 180)) * r);
|
||
|
// path.lineTo(x - cos(30 * (pi / 180)) * r, y - sin(30 * (pi / 180)) * r);
|
||
|
// path.moveTo(x + cos(60 * (pi / 180)) * r, y + sin(60 * (pi / 180)) * r);
|
||
|
// path.lineTo(x - cos(60 * (pi / 180)) * r, y - sin(60 * (pi / 180)) * r);
|
||
|
// path.moveTo(x + cos(60 * (pi / 180)) * r, y - sin(60 * (pi / 180)) * r);
|
||
|
// path.lineTo(x - cos(60 * (pi / 180)) * r, y + sin(60 * (pi / 180)) * r);
|
||
|
// path.moveTo(x - cos(60 * (pi / 180)) * r, y + sin(60 * (pi / 180)) * r);
|
||
|
// path.lineTo(x + cos(60 * (pi / 180)) * r, y - sin(60 * (pi / 180)) * r);
|
||
|
// path.moveTo(x + cos(30 * (pi / 180)) * r, y - sin(30 * (pi / 180)) * r);
|
||
|
// path.lineTo(x - cos(30 * (pi / 180)) * r, y + sin(30 * (pi / 180)) * r);
|
||
|
// path.moveTo(x - cos(30 * (pi / 180)) * r, y + sin(30 * (pi / 180)) * r);
|
||
|
// path.lineTo(x + cos(30 * (pi / 180)) * r, y - sin(30 * (pi / 180)) * r);
|
||
|
// ctx.drawPath(path, _paint);
|
||
|
|
||
|
// Map textList = {
|
||
|
// '0': Offset(x, y - r - 25),
|
||
|
// '30': Offset(
|
||
|
// x + cos(60 * (pi / 180)) * r, y - sin(60 * (pi / 180)) * r - 25),
|
||
|
// '60': Offset(
|
||
|
// x + cos(30 * (pi / 180)) * r + 10, y - sin(30 * (pi / 180)) * r - 10),
|
||
|
// '90': Offset(x + r + 10, y - 5),
|
||
|
// '120': Offset(
|
||
|
// x + cos(30 * (pi / 180)) * r, y + sin(30 * (pi / 180)) * r + 5),
|
||
|
// '150': Offset(
|
||
|
// x + cos(60 * (pi / 180)) * r, y + sin(60 * (pi / 180)) * r + 5),
|
||
|
// '180': Offset(x - 10, y + r),
|
||
|
// '210': Offset(
|
||
|
// x - cos(60 * (pi / 180)) * r - 20, y + sin(60 * (pi / 180)) * r + 10),
|
||
|
// '240': Offset(
|
||
|
// x - cos(30 * (pi / 180)) * r - 30, y + sin(30 * (pi / 180)) * r + 5),
|
||
|
// '270': Offset(x - r - 35, y - 5),
|
||
|
// '300': Offset(
|
||
|
// x - cos(30 * (pi / 180)) * r - 37, y - sin(30 * (pi / 180)) * r - 20),
|
||
|
// '330': Offset(
|
||
|
// x - cos(60 * (pi / 180)) * r - 30, y - sin(60 * (pi / 180)) * r - 25)
|
||
|
// };
|
||
|
// textList.forEach((key, offset) {
|
||
|
// TextPainter(
|
||
|
// text: TextSpan(
|
||
|
// text: key,
|
||
|
// style: const TextStyle(color: Colors.black, fontSize: 20)),
|
||
|
// textDirection: TextDirection.ltr,
|
||
|
// )
|
||
|
// ..layout()
|
||
|
// ..paint(ctx, offset);
|
||
|
// });
|
||
|
// }
|
||
|
|
||
|
// getCircles(GpsSignal chartData) {
|
||
|
// legend = {};
|
||
|
// double x = width / 3;
|
||
|
// double y = height / 2;
|
||
|
// double maxr = height / 4.2;
|
||
|
// double r = 12;
|
||
|
// List svData = controller.svData;
|
||
|
// for (int i = 0; i < svData.length; i++) {
|
||
|
// SvItem item = svData[i];
|
||
|
// int elev = item.ea;
|
||
|
|
||
|
// if (elev == -45) continue;
|
||
|
// double azi = item.aa * pi / 180;
|
||
|
// // console.log(elev,azi);
|
||
|
// double cx = (x + sin(azi) * (-elev) * (180 / 90) * maxr / 180);
|
||
|
// double cy = (y - (cos(azi) * (-elev) * (180 / 90) * maxr / 180));
|
||
|
// int prn = item.sn;
|
||
|
// String sys = item.name;
|
||
|
// int index = controller.sVTypes.indexWhere((item) => item == sys);
|
||
|
|
||
|
// LegendItem legendItem = controller.legend[sys];
|
||
|
// if (legendItem.show) {
|
||
|
// _paint.color = controller.colors[index];
|
||
|
// _paint.style = PaintingStyle.fill;
|
||
|
// // this.ctx.fillStyle = colors[index];
|
||
|
|
||
|
// ctx.drawCircle(Offset(cx, cy), r, _paint);
|
||
|
|
||
|
// TextPainter(
|
||
|
// text: TextSpan(
|
||
|
// text: prn.toString(),
|
||
|
// style: const TextStyle(
|
||
|
// color: Colors.white,
|
||
|
// fontSize: 16,
|
||
|
// )),
|
||
|
// textDirection: TextDirection.ltr,
|
||
|
// )
|
||
|
// ..layout()
|
||
|
// ..paint(ctx, Offset(cx - 10, cy - 7));
|
||
|
// }
|
||
|
|
||
|
// // }
|
||
|
// }
|
||
|
// }
|
||
|
// }
|