drawArcOfPoints method
void
drawArcOfPoints(
- Canvas canvas,
- Size canvasSize, {
- Color color = const Color.fromRGBO(128, 128, 128, 1),
- int? elementAttributeRow,
- List<
ElementAttributes> ? allElementAttributes, - Offset centerOffset = const Offset(0, 0),
- double rectSize = 20,
- int nbElements = 10,
- double angleArcDegres = 90,
- double angleOffset = 0,
- double rayonArc = 100,
- double rectRadius = 0,
- bool? hiliteFronde = false,
Implementation
void drawArcOfPoints(Canvas canvas, Size canvasSize,
{Color color = const Color.fromRGBO(128, 128, 128, 1),
int? elementAttributeRow,
List<ElementAttributes>? allElementAttributes,
Offset centerOffset = const Offset(0, 0),
double rectSize = 20,
int nbElements = 10,
double angleArcDegres = 90,
double angleOffset = 0,
double rayonArc = 100,
double rectRadius = 0,
bool? hiliteFronde = false}) {
if (nbElements == 1) {
double angle = 0 + angleOffset;
if (elementAttributeRow != null && allElementAttributes != null) {
for (ElementAttributes element in allElementAttributes) {
if (element.row == elementAttributeRow && element.position == 0) {
color = returnTheDotColor(element);
}
}
}
rectPainting(
canvas,
canvasSize,
color,
rectSize,
(centerOffset.dx + rayonArc * math.sin(angle.degreesToRadians))
.toDouble(),
(centerOffset.dy + rayonArc * -math.cos(angle.degreesToRadians))
.toDouble(),
radius: rectRadius);
} else {
double angleDebut = (-angleArcDegres / 2) + angleOffset;
double angleFin = (angleArcDegres / 2) + angleOffset;
if (elementAttributeRow != null && allElementAttributes != null) {
for (ElementAttributes element in allElementAttributes) {
if (element.row == elementAttributeRow && element.position == 0) {
color = returnTheDotColor(element);
}
}
}
rectPainting(
canvas,
canvasSize,
color,
rectSize,
(centerOffset.dx + rayonArc * math.sin(angleDebut.degreesToRadians))
.toDouble(),
(centerOffset.dy + rayonArc * -math.cos(angleDebut.degreesToRadians))
.toDouble(),
radius: rectRadius);
int maxLoop = 0;
for (var i = 1; i < nbElements - 1; i++) {
double angle = ((angleArcDegres / (nbElements - 1) * i) + angleDebut);
if (elementAttributeRow != null && allElementAttributes != null) {
for (ElementAttributes element in allElementAttributes) {
if (element.row == elementAttributeRow && element.position == i) {
color = returnTheDotColor(element);
}
}
}
rectPainting(
canvas,
canvasSize,
color,
rectSize,
(centerOffset.dx + rayonArc * math.sin(angle.degreesToRadians))
.toDouble(),
(centerOffset.dy + rayonArc * -math.cos(angle.degreesToRadians))
.toDouble(),
radius: rectRadius);
maxLoop = i;
}
if (elementAttributeRow != null && allElementAttributes != null) {
for (ElementAttributes element in allElementAttributes) {
if (element.row == elementAttributeRow &&
element.position == maxLoop + 1) {
color = returnTheDotColor(element);
}
}
}
rectPainting(
canvas,
canvasSize,
color,
rectSize,
(centerOffset.dx + rayonArc * math.sin(angleFin.degreesToRadians))
.toDouble(),
(centerOffset.dy + rayonArc * -math.cos(angleFin.degreesToRadians))
.toDouble(),
radius: rectRadius);
}
}