public static void SelectCalle(PointD p1, PointD p2, string nombre, string tipo) { if (LMapa == null) { return; } MapWinGIS.Extents ex = new MapWinGIS.Extents(); object x = new object(); ex.SetBounds(p1.X, p1.Y, 0, p2.X, p2.Y, 0); ((MapWinGIS.Shapefile)LMapa.GetObject()).SelectShapes(ex, 0, MapWinGIS.SelectMode.INTERSECTION, ref x); int[] shapes = x as int[]; //limpiar calle anterior if (CalleSeleccionada != null) { foreach (int shape in CalleSeleccionada) { LMapa.Shapes[shape].Color = LMapa.Color; } } List <int> l = new List <int>(); foreach (int shape in shapes) { if (((MapWinGIS.Shapefile)LMapa.GetObject()).get_CellValue(IndexNombre, shape).ToString() == nombre && ((MapWinGIS.Shapefile)LMapa.GetObject()).get_CellValue(IndexTipo, shape).ToString() == tipo) { l.Add(shape); LMapa.Shapes[shape].Color = System.Drawing.Color.Red; } } CalleSeleccionada = l.Count == 0 ? null : l.ToArray(); }
//private static void Serializar(PointD punto) //{ // FileStream f = new FileStream(Ruta + @"\ubicacion.txt", FileMode.Create); // BinaryFormatter b = new BinaryFormatter(); // b.Serialize(f, punto); // f.Close(); //} public static void ZoomToPointsPaint(PointD[] points, string[] labels) { if (points.Length == 1) { ZoomToPoint(points[0]); MapWin.View.Draw.ClearDrawing(DrCarros.Value); DrCarros = MapWin.View.Draw.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList); LMapa.ClearLabels(); // pintar punto MapWin.View.Draw.DrawCircle(points[0].X, points[0].Y, 10, System.Drawing.Color.Red, true); LMapa.AddLabel(labels[0], Color.Black, points[0].X, points[0].Y - 10, MapWinGIS.tkHJustification.hjCenter); } else { double minx = double.MaxValue; double maxx = double.MinValue; double miny = double.MaxValue; double maxy = double.MinValue; MapWin.View.Draw.ClearDrawing(DrCarros.Value); LMapa.ClearLabels(); DrCarros = MapWin.View.Draw.NewDrawing(MapWinGIS.tkDrawReferenceList.dlSpatiallyReferencedList); for (int i = 0; i < points.Length; i++) { // calcular extent seleccionando los 4 puntos límite PointD p = points[i]; if (p.X < minx) { minx = p.X; } if (p.X > maxx) { maxx = p.X; } if (p.Y < miny) { miny = p.Y; } if (p.Y > maxy) { maxy = p.Y; } // pintar punto MapWin.View.Draw.DrawCircle(p.X, p.Y, 10, System.Drawing.Color.Red, true); LMapa.AddLabel(labels[i], Color.Black, p.X, p.Y - 10, MapWinGIS.tkHJustification.hjCenter); } // establecer extent MapWinGIS.Extents ex = MapWin.View.Extents; ex.SetBounds(minx - 100, miny - 100, 0, maxx + 100, maxy + 100, 0); MapWin.View.Extents = ex; } }
public ushort SalaVazia() { lock (_a) { for (ushort b = 0; b < ushort.MaxValue; b++) { //1185 if (LMapa.ContainsKey((ushort)b)) { continue; } return((ushort)b); } } return(ushort.MaxValue); }