|
@@ -1,4 +1,5 @@
|
|
|
import 'dart:ui';
|
|
|
+import 'dart:math' as math;
|
|
|
|
|
|
import 'package:fis_measure/interfaces/date_types/point.dart';
|
|
|
import 'package:fis_measure/interfaces/enums/items.dart';
|
|
@@ -11,9 +12,28 @@ import 'package:fis_measure/process/items/item_feature.dart';
|
|
|
import 'package:fis_measure/utils/canvas.dart';
|
|
|
|
|
|
class Ray extends MeasureItem<RayFeature> {
|
|
|
- Ray(ItemMeta meta, IMeasureItem? parent) : super(meta, parent);
|
|
|
+ double _initializeAngle = 0;
|
|
|
+ double _initializeAngleVal = 0;
|
|
|
+ bool _switchInitialAngle = false;
|
|
|
+ Ray(ItemMeta meta, IMeasureItem? parent) : super(meta, parent) {
|
|
|
+ initializeAngle = 45;
|
|
|
+ }
|
|
|
+
|
|
|
+ double get initializeAngle => _initializeAngle;
|
|
|
+ set initializeAngle(double value) {
|
|
|
+ if (value != _initializeAngle) {
|
|
|
+ _initializeAngleVal = value;
|
|
|
+ _updateInitializeAngle();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- final double initializeAngle = 0;
|
|
|
+ bool get switchInitialAngle => _switchInitialAngle;
|
|
|
+ set switchInitialAngle(bool value) {
|
|
|
+ if (value != _switchInitialAngle) {
|
|
|
+ _switchInitialAngle = value;
|
|
|
+ _updateInitializeAngle();
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
@override
|
|
|
bool onExecuteMouse(PointInfo args) {
|
|
@@ -50,6 +70,11 @@ class Ray extends MeasureItem<RayFeature> {
|
|
|
ray.calculator = RayDepthCal(ray);
|
|
|
return ray;
|
|
|
}
|
|
|
+
|
|
|
+ void _updateInitializeAngle() {
|
|
|
+ int switchNumber = switchInitialAngle ? -1 : 1;
|
|
|
+ _initializeAngle = _initializeAngleVal * switchNumber;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
class RayFeature extends MeasureItemFeature {
|
|
@@ -87,8 +112,22 @@ class RayFeature extends MeasureItemFeature {
|
|
|
final offset = convert2ViewPoint(size, point).toOffset();
|
|
|
final left = Offset(0, offset.dy);
|
|
|
final right = Offset(size.width, offset.dy);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
canvas.drawDashLine(left, right, 1, 10, paintPan);
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
var idText = '$id.${refItem.displayName}';
|
|
|
drawCustomId(canvas, size, right, idText);
|
|
|
}
|