private void dibujarVelocidadMaxima(Graphics grafico, VelocidadMaxima velocidadMaxima) { int x = (int)velocidadMaxima.X; int y = (int)velocidadMaxima.Y; Color color = Color.Red; if(Modificar.eliminarSeñaleticas && Modificar.estaSobre(velocidadMaxima)) { color = Configuracion.COLORRESALTAR; } int suma = 0; if (velocidadMaxima.Velocidad > 99) suma = 3; if (velocidadMaxima.obtenerOrientacionSimple () == Elemento.VERTICAL) { grafico.FillEllipse (new SolidBrush (Color.White), x-11, y, 20, 20); grafico.DrawEllipse (new Pen (color, 3), x-11, y, 20, 20); grafico.DrawString (""+velocidadMaxima.Velocidad, new Font ("Arial", 7, FontStyle.Bold), new SolidBrush (Color.Black), new RectangleF (x-(6+suma), y+5, 36, 16)); this.dibujarID (grafico, velocidadMaxima.Id, Elemento.HORIZONTAL, x-12, y+22); } else if(velocidadMaxima.obtenerOrientacionSimple () == Elemento.HORIZONTAL) { grafico.FillEllipse (new SolidBrush (Color.White), x, y+28, 20, 20); grafico.DrawEllipse (new Pen (color, 3), x, y+28, 20, 20); grafico.DrawString (""+velocidadMaxima.Velocidad, new Font ("Arial", 7, FontStyle.Bold), new SolidBrush (Color.Black), new RectangleF (x+5-suma, y+33, 36, 16)); this.dibujarID (grafico, velocidadMaxima.Id, Elemento.HORIZONTAL, x-2, y+50); } }
public static bool estaSobre(VelocidadMaxima elemento) { int x = (int)elemento.X+10; int y = (int)elemento.Y+10; int xR = Modificar.posX; int yR = Modificar.posY; if (elemento.obtenerOrientacionSimple () == Elemento.VERTICAL) x -= 11; else if (elemento.obtenerOrientacionSimple () == Elemento.HORIZONTAL) y += 28; double distancia = Math.Pow(Math.Pow(y - yR, 2) + Math.Pow(x-xR, 2), 0.5); if(distancia <= 10) { idElementoEliminar = elemento.Id; return true; } if (idElementoEliminar == elemento.Id) idElementoEliminar = -1; return false; }