61 lines
1.4 KiB
Dart
61 lines
1.4 KiB
Dart
// ignore_for_file: public_member_api_docs, sort_constructors_first
|
|
import 'dart:convert';
|
|
|
|
class PointToMeasure {
|
|
int id;
|
|
double coordX;
|
|
double coordY;
|
|
PointToMeasure({
|
|
required this.id,
|
|
required this.coordX,
|
|
required this.coordY,
|
|
});
|
|
|
|
PointToMeasure copyWith({
|
|
int? id,
|
|
double? coordX,
|
|
double? coordY,
|
|
}) {
|
|
return PointToMeasure(
|
|
id: id ?? this.id,
|
|
coordX: coordX ?? this.coordX,
|
|
coordY: coordY ?? this.coordY,
|
|
);
|
|
}
|
|
|
|
Map<String, dynamic> toMap() {
|
|
return <String, dynamic>{
|
|
'id': id,
|
|
'coordX': coordX,
|
|
'coordY': coordY,
|
|
};
|
|
}
|
|
|
|
factory PointToMeasure.fromMap(Map<String, dynamic> map) {
|
|
return PointToMeasure(
|
|
id: map['id'] as int,
|
|
coordX: map['coordX'] as double,
|
|
coordY: map['coordY'] as double,
|
|
);
|
|
}
|
|
|
|
String toJson() => json.encode(toMap());
|
|
|
|
factory PointToMeasure.fromJson(String source) =>
|
|
PointToMeasure.fromMap(json.decode(source) as Map<String, dynamic>);
|
|
|
|
@override
|
|
String toString() =>
|
|
'PointToMeasure(id: $id, coordX: $coordX, coordY: $coordY)';
|
|
|
|
@override
|
|
bool operator ==(covariant PointToMeasure other) {
|
|
if (identical(this, other)) return true;
|
|
|
|
return other.id == id && other.coordX == coordX && other.coordY == coordY;
|
|
}
|
|
|
|
@override
|
|
int get hashCode => id.hashCode ^ coordX.hashCode ^ coordY.hashCode;
|
|
}
|