Exemple #1
0
        void Read(ShapePolyline sp)
        {
            for (int p = 0; p < sp.numParts; p++)
            {
                uint max = sp.numPoints;
                if (p < sp.numParts - 1)
                {
                    max = sp.parts[p + 1];
                }

                uint len = sp.numPoints;
                if (p < sp.numParts - 1)
                {
                    len = sp.parts[p + 1] - sp.parts[p];
                }
                else
                {
                    len = sp.numPoints - sp.parts[p];
                }

                Point[] pnt = new Point[len];
                int     j   = 0;
                for (uint i = sp.parts[p]; i < max; i++)
                {
                    pnt[j].X = XTransform(sp.points[i].X);
                    pnt[j].Y = YTransform(sp.points[i].Y);
                    j++;
                }
                GPolyline gobj = new GPolyline(curType, pnt);
            }
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlon = new GLatLng(10.2, 22);

            GMap1.setCenter(latlon, 4);

            GMarker icono = new GMarker(latlon);

            GInfoWindow window = new GInfoWindow(icono, "Ejemplo de <b>infoWindow</b>", false, GListener.Event.mouseover);

            GMap1.Add(window);

            GPolygon polygon = new GPolygon();

            polygon.points.Add(new GLatLng(9, 25));
            polygon.points.Add(new GLatLng(3, 22));
            polygon.points.Add(new GLatLng(1, 26));
            polygon.close();

            GPolyline polyline = new GPolyline(polygon);

            GInfoWindow window2 = new GInfoWindow();

            //window2.gPolygon = polygon;
            //window2.html = "GPolygon";
            window2.gPolyline = polyline;
            window2.html      = "polyline";

            window2.opened      = true;
            window2.sourceEvent = GListener.Event.click;
            GMap1.Add(window2);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlng = new GLatLng(46, 21);
            GMap1.setCenter(latlng, 4);

            List<GLatLng> puntos = new List<GLatLng>();
            puntos.Add(latlng + new GLatLng(0, 8));
            puntos.Add(latlng + new GLatLng(-0.5, 4.2));
            puntos.Add(latlng);
            puntos.Add(latlng + new GLatLng(3.5, -4));
            puntos.Add(latlng + new GLatLng(4.79, +2.6));
            GPolyline linea = new GPolyline(puntos, "FF0000", 2);
            GMap1.Add(linea);

            List<GLatLng> puntos2 = new List<GLatLng>();
            puntos2.Add(latlng + new GLatLng(5, -8));
            puntos2.Add(latlng + new GLatLng(5, -6));
            puntos2.Add(latlng + new GLatLng(5, -4));
            puntos2.Add(latlng);
            puntos2.Add(latlng + new GLatLng(-5, 0));
            GPolyline linea2 = new GPolyline(puntos2);
            linea2.weight = 4;
            GMap1.Add(linea2);

            List<GLatLng> puntos3 = new List<GLatLng>();
            puntos3.Add(latlng + new GLatLng(5, -20));
            puntos3.Add(latlng + new GLatLng(5, 20));
            GPolyline linea3 = new GPolyline(puntos3, Color.DarkViolet, 4);
            linea3.geodesic = true;
            GMap1.Add(linea3);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            GMap1.Height = 500;

            GLatLng latlng = new GLatLng(46, 21);
            GMap1.setCenter(latlng, 4);

            List<GLatLng> points = new List<GLatLng>();
            points.Add(latlng + new GLatLng(0, 8));
            points.Add(latlng + new GLatLng(-0.5, 4.2));
            points.Add(latlng);
            points.Add(latlng + new GLatLng(3.5, -4));
            points.Add(latlng + new GLatLng(4.79, +2.6));
            GPolyline line = new GPolyline(points, "FF0000", 2);
            GMap1.Add(line);

            GMarker marker = new GMarker(latlng);
            GMap1.Add(marker);

            GInfoWindowOptions options = new GInfoWindowOptions();
            options.zoomLevel = 14;
            options.mapType = GMapType.GTypes.Hybrid;
            GShowMapBlowUp mBlowUp = new GShowMapBlowUp(new GLatLng(string.Format("{0}.getLatLng()", marker.ID)), options);

            GListener listener = new GListener(GMap1.GMap_Id, GListener.Event.click, string.Format(@"function(){{{0};}}", mBlowUp.ToString(GMap1.GMap_Id)));

            GMap1.Add(listener);

            GMap1.Add(new SnapToToute(marker, line));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlon = new GLatLng(10.2, 22);
            GMap1.setCenter(latlon, 4);

            GMarker icono = new GMarker(latlon);

            GInfoWindow window = new GInfoWindow(icono, "Ejemplo de <b>infoWindow</b>", false, GListener.Event.mouseover);
            GMap1.Add(window);

            GPolygon polygon = new GPolygon();
            polygon.points.Add(new GLatLng(9, 25));
            polygon.points.Add(new GLatLng(3, 22));
            polygon.points.Add(new GLatLng(1, 26));
            polygon.close();

            GPolyline polyline = new GPolyline(polygon);

            GInfoWindow window2 = new GInfoWindow();
            //window2.gPolygon = polygon;
            //window2.html = "GPolygon";
            window2.gPolyline = polyline;
            window2.html = "polyline";

            window2.opened = true;
            window2.sourceEvent = GListener.Event.click;
            GMap1.Add(window2);
        }
Exemple #6
0
        public GObject Create()
        {
            GObject obj = null;

            switch (type.GeomType)
            {
            case GeomType.Point:
                obj = new GPoint(type, Points[0]);
                break;

            case GeomType.Caption:
                obj = new GCaption(type, Points[0]);
                break;

            case GeomType.Polyline:
                obj = new GPolyline(type, Points);
                break;

            case GeomType.Polygon:
                obj = new GPolygon(type, Points);
                break;
            }
            if (obj != null)
            {
                app.ShowProperties(obj);
            }
            app.Lib.Selection.Clear();
            app.CheckRepaint(this);
            app.UpdateControls();
            return(obj);
        }
Exemple #7
0
        private void ReadPolyline(DXFObject dxf, GType gType)
        {
            Point[] pnt = new Point[dxf.points.Count];
            for (int i = 0; i < dxf.points.Count; i++)
            {
                pnt[i].X = (int)(dxf.points[i].X * 100.0);
                pnt[i].Y = (int)(dxf.points[i].Y * 100.0);

                pointcount++;
                UpdateBounds(pnt[i]);
            }
            unitcount++;
            GPolyline gobj = new GPolyline(gType, pnt);
        }
Exemple #8
0
        void Read(MIFLine mp, GType gType)
        {
            Point[] pnt = new Point[2];
            pnt[0].X = (int)((mp.point1.X * 100.0));
            pnt[0].Y = (int)((mp.point1.Y * 100.0));
            pnt[1].X = (int)((mp.point2.X * 100.0));
            pnt[1].Y = (int)((mp.point2.Y * 100.0));

            UpdateBounds(pnt[0]);
            UpdateBounds(pnt[1]);
            GPolyline gobj = new GPolyline(gType, pnt);

            SetCaption(gobj);
            SetName(gobj);
        }
Exemple #9
0
        void Read(MIFPolyline mp, GType gType)
        {
            for (int p = 0; p < mp.parts; p++)
            {
                Point[] pnt = new Point[mp.points[p].Length];
                for (int i = 0; i < mp.points[p].Length; i++)
                {
                    pnt[i].X = (int)((mp.points[p][i].X * 100.0));
                    pnt[i].Y = (int)((mp.points[p][i].Y * 100.0));

                    UpdateBounds(pnt[i]);
                }
                GPolyline gobj = new GPolyline(gType, pnt);
                SetCaption(gobj);
                SetName(gobj);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            bool[] habilitar = { true, false, false, false, false, false, false, false };
            VisibleTexto(habilitar);
            GMap1.resetMarkers();
            GMap1.resetScreenOverlays();
            GMap1.resetInfoWindows();
            if ((List <Punto>)Session["listaPunto"] != null)
            {
                listaPunto = (List <Punto>)Session["listaPunto"];
            }

            GMap1.enableDragging = false; // mover el mapa con el mouse
            GMap1.Language       = "es";  //lenguaje

            //Establecemos alto y ancho en px
            GMap1.Height = 570;
            //GMap1.Width = 760;
            GMap1.enableHookMouseWheelToZoom = true; // permitir zoom con la rueda del mouse



            //GLatLng ubicacion = new GLatLng(-77.5, -2);
            GMapType.GTypes maptype = GMapType.GTypes.Normal;

            GMap1.setCenter(ubicacion, 7, maptype);
            List <GLatLng> puntos = new List <GLatLng>();

            if (DropDownList1.SelectedValue == "Linea" && listaPunto.Count > 0)
            {
                foreach (var p in listaPunto)
                {
                    GLatLng latLng = new GLatLng(Convert.ToDouble(p.latitud), Convert.ToDouble(p.longitud));
                    puntos.Add(latLng);
                }
                //puntos.Add(ubicacion);
            }

            GPolyline linea = new GPolyline(puntos, "FF0000", 2);

            GMap1.Add(linea);


            BuildMap();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            GMap1.Height = 500;

            GLatLng latlng = new GLatLng(46, 21);

            GMap1.setCenter(latlng, 4);

            List <GLatLng> points = new List <GLatLng>();

            points.Add(latlng + new GLatLng(0, 8));
            points.Add(latlng + new GLatLng(-0.5, 4.2));
            points.Add(latlng);
            points.Add(latlng + new GLatLng(3.5, -4));
            points.Add(latlng + new GLatLng(4.79, +2.6));
            GPolyline line = new GPolyline(points, "FF0000", 2);

            GMap1.Add(line);


            GMarker marker = new GMarker(latlng);

            GMap1.Add(marker);


            GInfoWindowOptions options = new GInfoWindowOptions();

            options.zoomLevel = 14;
            options.mapType   = GMapType.GTypes.Hybrid;
            GShowMapBlowUp mBlowUp = new GShowMapBlowUp(new GLatLng(string.Format("{0}.getLatLng()", marker.ID)), options);


            GListener listener = new GListener(GMap1.GMap_Id, GListener.Event.click, string.Format(@"function(){{{0};}}", mBlowUp.ToString(GMap1.GMap_Id)));

            GMap1.Add(listener);

            GMap1.Add(new SnapToToute(marker, line));
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlng = new GLatLng(46, 21);

            GMap1.setCenter(latlng, 4);

            List <GLatLng> puntos = new List <GLatLng>();

            puntos.Add(latlng + new GLatLng(0, 8));
            puntos.Add(latlng + new GLatLng(-0.5, 4.2));
            puntos.Add(latlng);
            puntos.Add(latlng + new GLatLng(3.5, -4));
            puntos.Add(latlng + new GLatLng(4.79, +2.6));
            GPolyline linea = new GPolyline(puntos, "FF0000", 2);

            GMap1.Add(linea);

            List <GLatLng> puntos2 = new List <GLatLng>();

            puntos2.Add(latlng + new GLatLng(5, -8));
            puntos2.Add(latlng + new GLatLng(5, -6));
            puntos2.Add(latlng + new GLatLng(5, -4));
            puntos2.Add(latlng);
            puntos2.Add(latlng + new GLatLng(-5, 0));
            GPolyline linea2 = new GPolyline(puntos2);

            linea2.weight = 4;
            GMap1.Add(linea2);

            List <GLatLng> puntos3 = new List <GLatLng>();

            puntos3.Add(latlng + new GLatLng(5, -20));
            puntos3.Add(latlng + new GLatLng(5, 20));
            GPolyline linea3 = new GPolyline(puntos3, Color.DarkViolet, 4);

            linea3.geodesic = true;
            GMap1.Add(linea3);
        }
Exemple #13
0
        public DataTable evaluarCercanos(DataSet dsProfesores, double km)
        {
            /*KM es el rango de distancias para el que debe buscar*/

            DataTable  dtAux  = dsProfesores.Tables[0].Clone();
            DtoColegio cole   = new DtoColegio();
            CtrColegio ctrcol = new CtrColegio();

            cole.codColegio = int.Parse(Session["r"].ToString());

            ctrcol.consultarColegio(cole);
            txtCole.Text = cole.nombre;
            lblLat2.Text = cole.latitud.ToString();
            lblLng2.Text = cole.longitud.ToString();
            double lat, lng, aux = 50;

            foreach (DataTable thisTable in dsProfesores.Tables)
            {
                foreach (DataRow row in thisTable.Rows) //Para cada fila evalua la distancia
                {
                    lat = Double.Parse(row["latitud"].ToString());
                    lng = Double.Parse(row["longitud"].ToString());
                    double dist = distancia(lat, lng, Double.Parse(cole.latitud.ToString()), Double.Parse(cole.longitud.ToString()));

                    if (row["diasDisponible"].ToString().Contains(lbldia.Text))
                    {
                        if (dist < km)
                        {
                            dtAux.ImportRow(row); //Si la distancia es menor al rango "km" entonces importa la fila a mi tabla auxiliar

                            //Pinta marcador del profesor
                            GLatLng latlng  = new GLatLng(lat, lng);
                            GLatLng latlng2 = new GLatLng(Convert.ToDouble(cole.latitud.ToString()), Convert.ToDouble(cole.longitud.ToString()));

                            GIcon icon = new GIcon();
                            icon.labeledMarkerIconOptions = new LabeledMarkerIconOptions(Color.Gold, Color.White, "P", Color.Green);
                            GMarker     ii     = new GMarker(latlng, icon);
                            GInfoWindow window = new GInfoWindow(ii, "" + row["nombres"]);

                            //Pinta la linea entre profesor y colegio
                            List <GLatLng> puntos = new List <GLatLng>();
                            puntos.Add(latlng);
                            puntos.Add(latlng2);
                            GPolyline linea = new GPolyline(puntos, "FF0000", 2);
                            gmap1.Add(linea);
                            gmap1.Add(ii);
                            if (dist < aux)
                            {
                                //busca la mejor distancia
                                dista.Text   = "La mejor distancia es del profesor " + row["nombres"] + " " + row["apPaterno"] + " con " + dist.ToString() + " km de distancia.";
                                aux          = dist;
                                idProfe.Text = "" + row["codPersona"];
                            }
                            else
                            {
                            }
                        }
                        if (dtAux.Rows.Count == 0)
                        {
                            btnAmpliarRango.Enabled = true;
                        }
                    }
                }
            }

            return(dtAux);
        }