private void btnParadero_Click(object sender, EventArgs e) { if (!modoAgregarRuta) { ParaderoButton btn = (ParaderoButton)sender; int indiceParadero = btn.indiceParadero; if (previousIndice != -1) { double distance = GeoCodeCalc.CalcDistance(paraderos[previousIndice].Latitud, paraderos[previousIndice].Longitud, paraderos[indiceParadero].Latitud, paraderos[indiceParadero].Longitud, GeoCodeCalcMeasurement.Meters); paraderos[previousIndice].addConexion(indiceParadero, distance); paraderos[indiceParadero].addConexion(previousIndice, distance); Panel p = (Panel)btn.Parent; System.Drawing.Graphics gr = p.CreateGraphics(); gr.DrawLine(new Pen(new SolidBrush(Color.Blue), 3), paraderos[previousIndice].btn.x, paraderos[previousIndice].btn.y, btn.x, btn.y); previousIndice = -1; } else { previousIndice = indiceParadero; } } }
public Nodo(int x, int y, double lat, double lng, int pIndice, System.Windows.Forms.Form c) { Latitud = lat; Longitud = lng; indice = pIndice; conexiones = new List <Arista>(); btn = new ParaderoButton(x, y, indice); btn.Parent = c; this.x = x; this.y = y; }
public void Dibujar(System.Drawing.Graphics gr, System.Windows.Forms.Form c) { //gr.FillEllipse(new SolidBrush(color), x - 5 / 2, y - 5 / 2, 10, 10); if (btn == null) { btn = new ParaderoButton(x, y, indice); btn.Parent = c; } //string p = Directory.GetCurrentDirectory(); //Image i = Image.FromFile(p + @"\marker.png"); //gr.DrawImage(i, x - i.Width / 2, y - i.Height); }