top_item_feature.dart 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import 'package:fis_measure/interfaces/process/items/item.dart';
  2. import 'package:fis_measure/interfaces/process/items/item_feature.dart';
  3. import 'package:flutter/painting.dart';
  4. import 'item_feature.dart';
  5. import 'top_item.dart';
  6. abstract class TopMeasureItemFeature extends MeasureItemFeature {
  7. TopMeasureItemFeature(ITopMeasureItem refItem) : super(refItem);
  8. @override
  9. TopMeasureItem get refItem => super.refItem as TopMeasureItem;
  10. @override
  11. void paint(Canvas canvas, Size size) {
  12. for (var item in refItem.childItems) {
  13. for (var feature in item.measuredFeatures) {
  14. if (feature.checkCanPaint()) {
  15. feature.paint(canvas, size);
  16. }
  17. }
  18. item.feature?.paint(canvas, size);
  19. }
  20. }
  21. @override
  22. void setZoomRect(Rect? rect) {
  23. zoomRect = rect;
  24. final List<IMeasureItemFeature> measureFeatures =
  25. refItem.childItems.expand((item) => item.measuredFeatures).toList();
  26. for (var feature in measureFeatures) {
  27. feature.setZoomRect(zoomRect);
  28. }
  29. for (var item in refItem.childItems) {
  30. item.feature?.setZoomRect(rect);
  31. }
  32. }
  33. }