RectangleFeature.fromMap constructor
从Map创建RectangleFeature对象
Implementation
factory RectangleFeature.fromMap(Map<String, dynamic> map) {
final topLeftMap = map['topLeft'] as Map<String, dynamic>;
final topRightMap = map['topRight'] as Map<String, dynamic>;
final bottomLeftMap = map['bottomLeft'] as Map<String, dynamic>;
final bottomRightMap = map['bottomRight'] as Map<String, dynamic>;
return RectangleFeature(
topLeft: Point(
(topLeftMap['x'] as num).toDouble(),
(topLeftMap['y'] as num).toDouble(),
),
topRight: Point(
(topRightMap['x'] as num).toDouble(),
(topRightMap['y'] as num).toDouble(),
),
bottomLeft: Point(
(bottomLeftMap['x'] as num).toDouble(),
(bottomLeftMap['y'] as num).toDouble(),
),
bottomRight: Point(
(bottomRightMap['x'] as num).toDouble(),
(bottomRightMap['y'] as num).toDouble(),
),
);
}