コード例 #1
1
        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));
            GPolygon poligono = new GPolygon(puntos, "557799", 3, 0.5, "237464", 0.5);
            poligono.close();
            GMap1.Add(poligono);

            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));
            GPolygon poligono2 = new GPolygon(puntos2, "000000", 3, 1, "654321", 1);
            GMap1.Add(poligono2);

            GPolygon poligono3 = new GPolygon(new List<GLatLng>(), "00ff00", 3, 1, "ff0044", 1);
            poligono3.createPolygon(latlng + new GLatLng(-6, -7.5), 7, 4, Math.PI / 3);
            GMap1.Add(poligono3);
        }
コード例 #2
1
 protected string GMap1_ServerEvent(object s, GAjaxServerEventOtherArgs e)
 {
     string js = string.Empty;
     switch (e.eventName)
     {
         case "Click":
             GLatLng latlng = new GLatLng(
             Convert.ToDouble(e.eventArgs[2], new System.Globalization.CultureInfo("en-US", false)),
             Convert.ToDouble(e.eventArgs[3], new System.Globalization.CultureInfo("en-US", false)));
             GInfoWindow window = new GInfoWindow(latlng, string.Format("Window Size (px): ({0},{1}). Close Me.", e.eventArgs[0], e.eventArgs[1]));
             GListener listener = new  GListener(window.ID, GListener.Event.infowindowclose,
                                             string.Format(
                                                 @"
                                                    function()
                                                    {{
                                                       var ev = new serverEvent('InfoWindowClose', {0});
                                                       ev.addArg('My Argument');
                                                        ev.send();
                                                    }}
                                                 ",
                                                 window.ID));
             js = window.ToString(e.who) + listener.ToString();
             break;
         case "InfoWindowClose":
             js = string.Format
             ("alert('{0}: {1} - {2} - {3}')", e.eventName, e.point, e.eventArgs[0], DateTime.Now);
             break;
     }
     return js;
 }
コード例 #3
1
        private void arreglarMapa()
        {
            GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl));
            GMap1.enableHookMouseWheelToZoom = true;

            StringBuilder sb = new StringBuilder();
            sb.Append("function(marker, point) {");
            GLatLng latlng = new GLatLng("point");
            GInfoWindow window = new GInfoWindow(latlng, "<div style=\"height:140px;\"><blink>Loading...</blink></div>");
            sb.Append(window.ToString(GMap1.GMap_Id));
            sb.Append("}");

            GMap1.Add(new GListener(GMap1.GMap_Id, GListener.Event.click, sb.ToString()));

            StringBuilder sb2 = new StringBuilder();
            sb2.Append("function goTo(point){");
            GLatLng point = new GLatLng("point");
            sb2.AppendFormat("{0}.setZoom(11);", GMap1.GMap_Id);
            GMove move = new GMove(1, point);
            sb2.Append(move.ToString(GMap1.GMap_Id));
            GMarker marker = new GMarker(point);
            sb2.Append(marker.ToString(GMap1.GMap_Id));
            sb2.Append("}");
            GMap1.Add(sb2.ToString());
        }
コード例 #4
1
    protected void Submit_Click(object sender, EventArgs e)
    {
        locator.locate find = new locator.locate();
        string q = txtblood.Text;
        string r = txtZip.Text;
        string ab = find.locate0(r, q);
        string bc = find.locate1(r, q);
        string cd = find.locate2(r, q);
        string de = find.counting(r, q);

        Label1.Text = de;
        string address = ab + "," + bc + "," + cd + "," + r;
        string latitude1 = "";
        string longitude1 = "";
        // Response.Redirect("http://where.yahooapis.com/geocode?location=" +address );

        XmlTextReader xtr = new XmlTextReader("http://where.yahooapis.com/geocode?location=" + address);
        xtr.WhitespaceHandling = WhitespaceHandling.Significant;
        //Response.Write(xtr.ToString());
        try
        {
            while (xtr.Read())
            {
                if (xtr.Name.ToString() == "latitude")
                {
                    latitude1 = xtr.ReadString().ToString();
                }
                if (xtr.Name.ToString() == "longitude")
                {
                    longitude1 = xtr.ReadString().ToString();
                }

            }

            GMap2.addGMapUI(new GMapUI());
            GMapUIOptions options = new GMapUIOptions();
            GLatLng latlong = new GLatLng(double.Parse(latitude1), double.Parse(longitude1));
            GMapType.GTypes maptype = GMapType.GTypes.Normal;
            GMap2.setCenter(latlong, 15, maptype);
            //GMap2.GZoom = 9;
            PinLetter pinLetter = new PinLetter("o", Color.Red, Color.Black);

            GMap2.addGMarker(new GMarker(latlong, new GMarkerOptions(new GIcon(pinLetter.ToString(), pinLetter.Shadow()))));
            GMarker marker = new GMarker(latlong);
            GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, maptype);

            GInfoWindow mbUp = new GInfoWindow(marker, address, IWoptions);
            GMap2.addInfoWindow(mbUp);

        }
        catch (Exception)
        {
            Response.Write("invalid adress");
        }
    }
コード例 #5
0
ファイル: Custom.aspx.cs プロジェクト: Sinbad311/CloudProject
        protected void Page_Load(object sender, EventArgs e)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            GLatLng center = new GLatLng(44, 5);
            GMap1.setCenter(center);

            sb.Append("var markers=[];");
            sb.Append("function subgurim_Add()");
            sb.Append("{");
            GMarker marker = new GMarker(GMap1.GMap_Id + ".getCenter()");
            sb.Append(marker.ToString(GMap1.GMap_Id));
            sb.AppendFormat("markers.push({0})", marker.ID);
            sb.Append("}");

            sb.Append("function subgurim_Delete()");
            sb.Append("{");
            sb.Append("if (markers.length > 0) { markers.pop().setMap(null); }");
            sb.Append("}");

            sb.Append("function subgurim_Remove()");
            sb.Append("{");
            sb.Append("for (var i = 0; i < markers.length; i++) { markers[i].setMap(null); }");
            sb.Append("markers = [];");
            sb.Append("}");

            GMap1.Add(sb.ToString());
        }
コード例 #6
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);
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlng = new GLatLng(42.12, -1.145);
            GMap1.setCenter(latlng, 5, GMapType.GTypes.Hybrid);

            GMarker marker = new GMarker(latlng);
            GInfoWindowOptions windowOptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal);
            //GShowMapBlowUp mbUp = new GShowMapBlowUp(marker, false, IWoptions);
            //GMap1.addShowMapBlowUp(mbUp);
            GInfoWindow mbUp = new GInfoWindow(marker, "I'm an infoWindow", windowOptions);
            GMap1.Add(mbUp);

            GMap1.Add(new GMarker(latlng + new GLatLng(2, 1)));

            GMarkerOptions markerOptions = new GMarkerOptions();
            markerOptions.clickable = false;
            GMarker marker2 = new GMarker(latlng + new GLatLng(-1, 2.5), markerOptions);
            GMap1.Add(marker2);

            GMarker markerDraggable = new GMarker(latlng + new GLatLng(-2, -1));
            GMarkerOptions mOpts = new GMarkerOptions();
            mOpts.draggable = true;
            markerDraggable.options = mOpts;
            // string jsStart = "function() {" + GMap1.GMap_Id + ".closeInfoWindow();}";
            // string jsEnd = "function() {" + markerDraggable.ID + ".openInfoWindowHtml('<a href=\"http://www.playsudoku.biz\" target=\"_blank\">Play Sudoku</a>');}";
            string jsStart = "function() { if (typeof variable !== myInfoWindow) {myInfoWindow.close(); } }";
            string jsEnd = "function() { myInfoWindow = new google.maps.InfoWindow({ content: '<a href=\"http://www.playsudoku.biz\" target=\"_blank\">Play Sudoku</a>' }); myInfoWindow.open(" + GMap1.GMap_Id + "," + markerDraggable.ID + "); }";
            GMap1.Add(new GListener(markerDraggable.ID, GListener.Event.dragstart, jsStart));
            GMap1.Add(new GListener(markerDraggable.ID, GListener.Event.dragend, jsEnd));
            GMap1.Add(markerDraggable);
        }
コード例 #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlon = new GLatLng(10.2, 22);
            GMap1.setCenter(latlon, 4);

            /****** INFOWINDOWTAB 1 ******/

            GInfoWindowTabs iwTabs = new GInfoWindowTabs();
            iwTabs.point = latlon;

            List<GInfoWindowTab> tabs = new List<GInfoWindowTab>();
            for (int i = 0; i < 3; i++)
            {
                tabs.Add(new GInfoWindowTab("Tab " + i.ToString(), i.ToString()));
            }

            iwTabs.tabs = tabs;
            GMap1.Add(iwTabs);

            /****** INFOWINDOWTAB 2 ******/

            GInfoWindowTabs iwTabs2 = new GInfoWindowTabs();

            GMarker icono = new GMarker(new GLatLng(5, 19));

            iwTabs2.gMarker = icono;
            iwTabs2.tabs = tabs;
            GMap1.Add(iwTabs2);
        }
コード例 #9
0
        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));
        }
コード例 #10
0
ファイル: Default.aspx.cs プロジェクト: knolegsb/AspGoogleMap
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {                
                GLatLng mainLocation = new GLatLng(34.0477964, -118.2581307);

                GMap1.setCenter(mainLocation, 14);

                XPinLetter xpinLetter = new XPinLetter(PinShapes.pin_star, "H", Color.Blue, Color.White, Color.Chocolate);
                GMap1.Add(new GMarker(mainLocation, new GMarkerOptions(new GIcon(xpinLetter.ToString(), xpinLetter.Shadow()))));

                List<HotelMaster> hotels = new List<HotelMaster>();
                using (HotelDatabaseEntities dc = new HotelDatabaseEntities())
                {
                    hotels = dc.HotelMasters.Where(a => a.HotelArea.Equals("Los Angeles Downtown")).ToList();
                }

                PinIcon p;
                GMarker gm;
                GInfoWindow win;
                foreach(var i in hotels)
                {
                    p = new PinIcon(PinIcons.home, Color.Cyan);
                    gm = new GMarker(new GLatLng(Convert.ToDouble(i.LocLat), Convert.ToDouble(i.LocLong)), new GMarkerOptions(new GIcon(p.ToString(), p.Shadow())));

                    win = new GInfoWindow(gm, i.HotelName + "<a href='"+i.ReadMoreUrl+"'> Read more...</a>", false, GListener.Event.mouseover);
                    GMap1.Add(win);
                }
            }
        }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        BLLstore BLLstore = new BLLstore();
        String s = Request.QueryString["storeid"];
        Store store = new Store();
        store = BLLstore.getStore(Convert.ToInt16(s));
        comments = new List<Comment>();
        

        try
        {
            storename = store.name;
            city = store.city;
            type = store.Type.name;
            tag1 = store.tag1;
            tag2 = store.tag2;

            viewStoreMap.Width = 600;
            viewStoreMap.Height = 250;

            GLatLng p = new GLatLng(store.latitude, store.longitude);
            GMarker m = new GMarker(p);

            viewStoreMap.setCenter(p, 16);
            viewStoreMap.addGMarker(m);

            comments = BLLstore.getCommentsForStore(store.id);
            rptComments.DataSource = comments;
            rptComments.DataBind();
        }
        catch(Exception ex) {
            Response.Write(ex.Message);
        }
    }
コード例 #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);
        }
コード例 #13
0
        private void AddMarkers()
        {
            List<Tree> trees = bl.GetAllTrees("School101", "School101");
            foreach (var tree in trees)
            {
                double lat;
                if (!double.TryParse(tree.Latitude, out lat))
                    continue;
                double lng;
                if (!double.TryParse(tree.Longitude, out lng))
                    continue;

                var latlng = new GLatLng(lat, lng);
                var icon = new GIcon(Helper.GetTreeIcon(tree.TreeType));
                icon.iconSize = new GSize(10, 10);
                icon.iconAnchor = new GPoint(7, 7);
                var options = new GMarkerOptions(icon, true, Helper.GetTreeType(tree.TreeType) + " " + tree.ID);
                GMarker marker = new GMarker(latlng, options);
                map.Add(marker);

                string popupContent = string.Format(@"
                    <h2>{0} {1}</h2>
                    <p>Координати: {2}, {3}<p/>
                    <p>Точност: {4}<p/>
                    <p>Добавено на: {5}<p/>
                    ", Helper.GetTreeType(tree.TreeType), tree.ID, tree.Latitude, tree.Latitude, tree.Accuracy, tree.DateAdded);
                GListener listener = new GListener(marker.ID, GListener.Event.click, string.Format(@"
                    function () {{
                        var w = new google.maps.InfoWindow();
                        w.setContent('{0}');
                        w.open({1}, {2});
                    }}", popupContent, map.GMap_Id, marker.ID));
                map.Add(listener);
            }
        }
コード例 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng sw = new GLatLng(40, 15);
            GLatLng ne = sw + new GLatLng(5, -10.2);
            GLatLngBounds latlngbounds = new GLatLngBounds(sw, ne);

            GMap1.Add(new GMarker(latlngbounds.getNorthEast()));
            GMap1.Add(new GMarker(latlngbounds.getSouthWest()));

            GMap1.GZoom = GMap1.getBoundsZoomLevel(latlngbounds);
            GMap1.setCenter(latlngbounds.getCenter());

            GLatLng sw2 = new GLatLng(42, 7);
            GLatLng ne2 = sw2 + new GLatLng(5, 5);
            GLatLngBounds latlngbounds2 = new GLatLngBounds(sw2, ne2);

            GLatLng swBig = new GLatLng(35, 0);
            GLatLng neBig = swBig + new GLatLng(15, 15);
            GLatLngBounds latlngboundsBig = new GLatLngBounds(swBig, neBig);

            GLatLng inside = latlngbounds.getCenter();
            GLatLng outside = neBig + new GLatLng(10, 10);

            bool isInside = latlngbounds.contains(inside);
            bool isOutSide = !latlngbounds.contains(outside);
            bool intersect = latlngbounds.intersects(latlngbounds2);
            bool contains = latlngboundsBig.containsBounds(latlngbounds);
        }
コード例 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlon = new GLatLng(10.2, 22);
            GMap1.setCenter(latlon, 4);

            GInfoWindow window = new GInfoWindow(latlon, "Ejemplo de <b>infoWindow</b>");
            GMap1.Add(window);
        }
コード例 #16
0
        //    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
        protected void btnFiltrosBuscar_Click(object sender, EventArgs e)
        {
            ArrayList parametros = new ArrayList();
            parametros.Add((string.IsNullOrEmpty(txtFiltrosCodCliente.Text) ? "%%" : txtFiltrosCodCliente.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosRazonSocial.Text) ? "%%" : txtFiltrosRazonSocial.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosCuotas.Text) ? "%" : txtFiltrosCuotas.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosFlag.Text) ? "%" : txtFiltrosFlag.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosDescuento.Text) ? "%" : txtFiltrosDescuento.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosUsuarioAlta.Text) ? "%" : txtFiltrosUsuarioAlta.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosNumeroFactura.Text) ? "%" : txtFiltrosNumeroFactura.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosIP.Text) ? "%%%" : txtFiltrosIP.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosDescripcion.Text) ? "%" : txtFiltrosDescripcion.Text));

            if (!string.IsNullOrEmpty(dpFiltrosDesde.Text))
                //parametros.Add(pMetodos.ConvertmmddyyyyToyyyymmdd(dpFiltrosDesde.Text));
                parametros.Add(pMetodos.ConvertddmmyyyyToyyyymmdd(dpFiltrosDesde.Text));
            else
                parametros.Add("1900/1/1");
            if (!string.IsNullOrEmpty(dpFiltrosHasta.Text))
                //parametros.Add(pMetodos.ConvertmmddyyyyToyyyymmdd(dpFiltrosHasta.Text));
                parametros.Add(pMetodos.ConvertddmmyyyyToyyyymmdd(dpFiltrosHasta.Text));
            else
                parametros.Add("2900/1/1");

            parametros.Add(ddlFiltrosCantidadRegistros.SelectedValue.ToString());
            parametros.Add((string.IsNullOrEmpty(txtFiltrosAgrup.Text) ? "%" : txtFiltrosAgrup.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosTicket.Text) ? "%" : txtFiltrosTicket.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosCodPromo.Text) ? "%" : txtFiltrosCodPromo.Text));
            parametros.Add(ddlFiltrosFamilia.SelectedValue.ToString());

            GMap1.reset();
            //me centro en argentina
            GLatLng ubicacion = new GLatLng(-13.533406, -88.4127875);//(-35.3139685, -65.104704);//(40.381090863719436, -3.6222052574157715);
            GMap1.setCenter(ubicacion, 4);

            //Establecemos alto y ancho en px
            GMap1.Height = 600;
            GMap1.Width = 558;

            //Adiciona el control de la parte izq superior (moverse, ampliar y reducir)
            GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl));

            //GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro.
            GMap1.Add(new GControl(GControl.preBuilt.MapTypeControl));

            cargarClientesEnMapa(clientesMap);

            GMap1.enableHookMouseWheelToZoom = true;

            //Tipo de mapa a mostrar
            GMap1.mapType = GMapType.GTypes.Normal;

            //Moverse con el cursor del teclado
            GMap1.enableGKeyboardHandler = true;

            gvListadosFacturasVisa.DataSource = conFacturas.ListadoDeFacturas(parametros);
            gvListadosFacturasVisa.DataBind();
        }
コード例 #17
0
        private void setupMap()
        {
            GLatLng latLng = new GLatLng(40, 10);

            GMap1.GCenter = latLng;

            GMarker marker = new GMarker(latLng);
            GMap1.Add(marker);
        }
コード例 #18
0
ファイル: Tweet.aspx.cs プロジェクト: mohm4z/TwitterAPI
        protected void Page_Load(object sender, EventArgs e)
        {
            dt.Columns.Add("Tweet");
            dt.Columns.Add("User");
            dt.Columns.Add("Location");
            dt.Columns.Add("Longitude");
            dt.Columns.Add("latitude");
            dt.Columns.Add("TweetCount");

            tokens.AccessToken = "140219230-Mww3rqC22jsEeGrwyWzfgGtzXNlPonroTyyFaE6F";

            tokens.AccessTokenSecret = "fNao9nGu9fgmxYtcF0UXoVMCcAGoBzkRPRfl7ujA2il1b";

            tokens.ConsumerKey = "2VqPg2xyY8A7ziLmRk5SaRaSL";

            tokens.ConsumerSecret = "ccJGxDaBDgyvrn6UGQFmQd0RNLXn3qRcTbg8rKZo01bmrK0EH5";

            TwitterResponse<TwitterSearchResultCollection> result = TwitterSearch.Search(tokens, "#ACME",  new SearchOptions());

            TwitterSearchResultCollection results = result.ResponseObject;
            List<TwitterSearchResult> resultList = results.ToList();

            foreach (var item in resultList)
            {
                string longtu = "";
                string lattu = "";

                try 
                {
                    longtu = item.Geo.Coordinates[0].Longitude.ToString();
                    lattu = item.Geo.Coordinates[0].Latitude.ToString();
                }
                catch (Exception) { }

                if (longtu != "" && lattu != "")
                {
                    GLatLng mainLocation = new GLatLng(Convert.ToDouble(longtu), Convert.ToDouble(lattu));
                    GMap1.setCenter(mainLocation, 5);

                    PinIcon p;
                    GMarker gm;
                    GInfoWindow win;

                    p = new PinIcon(PinIcons.home, Color.Cyan);
                    gm = new GMarker(new GLatLng(Convert.ToDouble(longtu), Convert.ToDouble(lattu)),
                        new GMarkerOptions(new GIcon(p.ToString(), p.Shadow())));

                    win = new GInfoWindow(gm, "" + "", false, GListener.Event.mouseover);
                    GMap1.Add(win);
                }

                dt.Rows.Add(item.Text, item.User.Name, item.User.Location,longtu , lattu,item.User.ListedCount);
            }

            GridView1.DataSource = dt;
            GridView1.DataBind();
        }
コード例 #19
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latLng = new GLatLng(40, 0);
            GMarker marker = new GMarker(latLng);
            marker.AddMarkerTracker();

            GMap1.Add(marker);

            GMap1.GCenter = latLng + new GLatLng(8, 8);
        }
コード例 #20
0
        protected string GMap1_MarkerClick(object s, GAjaxServerEventArgs e)
        {
            GLatLng latLng = new GLatLng(40, 10);

            GMap1.GCenter = latLng;
            GMap1.resetInfoWindows();

            GMap1.GZoom = 6;
            return string.Empty;
        }
コード例 #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlong = new GLatLng(15.2, 10.9);
            GMapType.GTypes maptype = GMapType.GTypes.Hybrid;
            //GMap1.setCenter(latlong);
            //GMap1.setCenter(latlong, 4);
            GMap1.setCenter(latlong, 4, maptype);

            GMap1.Add(new GControl(GControl.extraBuilt.TextualCoordinatesControl));
        }
コード例 #22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng sw = new GLatLng(64, 20);
            GLatLng ne = new GLatLng(65, 29);

            GMap1.setCenter((sw / 2) + (ne / 2));

            GGroundOverlay groundOverlay = new GGroundOverlay("http://googlemaps.subgurim.net/images/logo.jpg", new GLatLngBounds(sw, ne));

            GMap1.Add(groundOverlay);
        }
コード例 #23
0
ファイル: Map.aspx.cs プロジェクト: salam73/bsiraq
        protected void Page_Load(object sender, EventArgs e)
        {
            //مواقع البيوت على الخريطه

            //some test

            //مدينة بغداد
            GLatLng latlng = new GLatLng(33.303708016355245, 44.3720680475235);
            GLatLng latlng1 = new GLatLng(33.30494095074294, 44.3713653087616);
            GLatLng latlng2 = new GLatLng(33.306223184015565, 44.37358617782593);
            //مدينة كربلاء
            GLatLng latlng3 = new GLatLng(32.615039238431486, 44.03835028409958);
            GLatLng latlng4 = new GLatLng(32.61548656961024, 44.03770387172699);
            GLatLng latlng5 = new GLatLng(32.61622759816053, 44.037339091300964);

            GMap1.enableHookMouseWheelToZoom = true;

            GMap1.setCenter(latlng, 7, GMapType.GTypes.Hybrid);

            //اضهار صورة مقربة للموقع

            //GMarker marker = new GMarker(latlng);
            //GInfoWindowOptions IWoptions = new GInfoWindowOptions(17, GMapType.GTypes.Hybrid);
            //GShowMapBlowUp mbUp = new GShowMapBlowUp(marker, false, IWoptions);
            //gMap.addShowMapBlowUp(mbUp);

            GInfoWindowTabs iwTabs = new GInfoWindowTabs();

            GMarker icono1 = new GMarker(latlng);
            iwTabs.gMarker = icono1;
            iwTabs.point = latlng;

            List<GInfoWindowTab> tabs = new List<GInfoWindowTab>();

                tabs.Add(new GInfoWindowTab("معلومات عامه " , "نكتب بعض المعلومات"));
                tabs.Add(new GInfoWindowTab("صور ", "نضغ بعض الصور"));
                tabs.Add(new GInfoWindowTab("الإتصال ", "<div class='info'  >الإتصال بالمكتب العقاري</div>"));

            iwTabs.tabs = tabs;
            GMap1.addInfoWindowTabs(iwTabs);

            GMarker icono2 = new GMarker(latlng3);
            GInfoWindow window2 = new GInfoWindow(icono2, "عماره <b>عماره سلام ان شاء الله</b>", false, GListener.Event.click);
            GMap1.addInfoWindow(window2);

            GInfoWindowTabs iwTabs2 = new GInfoWindowTabs();

            GMarker icono = new GMarker(latlng5);

            iwTabs2.gMarker = icono;
            iwTabs2.tabs = tabs;
            GMap1.addInfoWindowTabs(iwTabs2);
        }
コード例 #24
0
ファイル: Locales.aspx.cs プロジェクト: Jnapalynch/Integrador
    protected void Page_Load(object sender, EventArgs e)
    {
        GMap1.Visible = true; GMap2.Visible = false; GMap3.Visible = false;

        if (cbodistritos.SelectedValue.ToString() == "1")
        {
            lbldireccion.Text = "Av. Oscar R. Benavides, 4706 - Bellavista";

            GLatLng latlng = new GLatLng(-12.053183880322681, -77.09490269422531);
            GMap1.setCenter(latlng, 17, GMapType.GTypes.Hybrid);

            GMarker marker = new GMarker(latlng);
            GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal);
            GInfoWindow mbUp = new GInfoWindow(marker, "Av. Oscar R. Benavides, 4706 - Bellavista", IWoptions);
            GMap1.addInfoWindow(mbUp);

            GMap1.addGMarker(new GMarker(latlng + new GLatLng(2, 1)));
            GMap1.enableHookMouseWheelToZoom = true;
        }

        else if (cbodistritos.SelectedValue.ToString() == "2")
        {
            lbldireccion.Text = "Av. Arequipa 2210 - Lince";
            GMap2.Visible = true; GMap1.Visible = false; GMap3.Visible = false;
            GLatLng latlng = new GLatLng(-12.086198524323004, -77.0346736907959);
            GMap2.setCenter(latlng, 17, GMapType.GTypes.Hybrid);

            GMarker marker = new GMarker(latlng);
            GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal);
            GInfoWindow mbUp = new GInfoWindow(marker, "Av. Arequipa 2210 - Lince", IWoptions);
            GMap2.addInfoWindow(mbUp);

            GMap2.addGMarker(new GMarker(latlng + new GLatLng(2, 1)));
            GMap2.enableHookMouseWheelToZoom = true;
        }

        else if (cbodistritos.SelectedValue.ToString() == "3")
        {
            lbldireccion.Text = "Av. Larco 2210 - Miraflores";
            GMap3.Visible = true; GMap2.Visible = false; GMap1.Visible = false;
            GLatLng latlng = new GLatLng(-12.120984474783656, -77.02883720397949);
            GMap3.setCenter(latlng, 17, GMapType.GTypes.Hybrid);

            GMarker marker = new GMarker(latlng);
            GInfoWindowOptions IWoptions = new GInfoWindowOptions(12, GMapType.GTypes.Normal);
            GInfoWindow mbUp = new GInfoWindow(marker, "Av. Larco 2210 - Miraflores", IWoptions);
            GMap3.addInfoWindow(mbUp);

            GMap3.addGMarker(new GMarker(latlng + new GLatLng(2, 1)));
            GMap3.enableHookMouseWheelToZoom = true;
        }
    }
コード例 #25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng ll1 = new GLatLng(41, 1);
            GLatLng ll2 = new GLatLng(39, 0);

            GMap1.Add(new GControl(GControl.preBuilt.SmallMapControl));
            GMap1.Add(new GCustomCursor(cursor.crosshair, cursor.help));
            GMap1.Add(new GControl(GControl.extraBuilt.TextualOnClickCoordinatesControl, new GControlPosition(GControlPosition.position.Top_Right)));
            GMap1.Add(new GInfoWindow(ll1, "Hello!!"));
            GMap1.Add(new GMove(1500, ll2));
            GMap1.Add(new GMove(2000, ll1));
            GMap1.Add(new GeoCoding());
        }
コード例 #26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlon = new GLatLng(41.65, 0.91);
            GMap1.setCenter(latlon, 4);

            GInfoWindowOptions options = new GInfoWindowOptions();
            options.zoomLevel = 14;
            options.mapType = GMapType.GTypes.Hybrid;

            GShowMapBlowUp mBlowUp = new GShowMapBlowUp(new GMarker(latlon), options);

            GMap1.Add(mBlowUp);
        }
コード例 #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng sw = new GLatLng(64, 20);
            GLatLng ne = new GLatLng(65, 29);

            GMap1.setCenter((sw / 2) + (ne / 2));

            GScreenOverlay screenOverlay = new GScreenOverlay("http://googlemaps.subgurim.net/images/logo.jpg",
                                                              new GScreenPoint(0, 21, unitEnum.pixels, unitEnum.pixels),
                                                              new GScreenPoint(0, 0),
                                                              new GScreenSize(0, 0));

            GMap1.Add(screenOverlay);
        }
コード例 #28
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl));
            GMap1.Add(new GControl(GControl.preBuilt.MapTypeControl));

            GLatLng latlng = new GLatLng(42.12, -1.145);

            if (!Page.IsPostBack)
            {
                GMap1.setCenter(latlng, 5, GMapType.GTypes.Hybrid);
            }

            GMap1.Add(new GMarker(latlng + new GLatLng(2, 1)));
        }
コード例 #29
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latLng = new GLatLng(41, -7);

            int colorEnumLength = 11;
            int sizeEnumLength = 3;
            double latStep = -1;
            double lngStep = 0.4;
            string msg = "Subgurim Google Maps";

            int iLat = 0;
            int iLng = 0;

            Random r = new Random();
            foreach (char c in msg)
            {
                if (c == ' ')
                {
                    iLat++;
                    continue;
                }

                GLatLng latlngAux = latLng + new GLatLng(latStep * iLat + r.NextDouble() * 0.4, lngStep * iLng);

                int randomColor = r.Next(colorEnumLength);
                StaticGMarker.ColorEnum color = (StaticGMarker.ColorEnum)randomColor;

                int randomSize = r.Next(2, sizeEnumLength);
                StaticGMarker.SizeEnum size = (StaticGMarker.SizeEnum)randomSize;

                StaticGMarker staticGMarker = new StaticGMarker(latlngAux, size, color, c);
                StaticGMap1.addStaticGMarker(staticGMarker);

                iLng++;
            }

            //StaticGMap1.GZoom = 5;

            StaticPath path = new StaticPath();
            path.colorNet = Color.FromArgb(255, 0, 80);
            path.weight = 5;
            path.alpha = 150;

            path.points.Add(new GLatLng(41, -5));
            path.points.Add(new GLatLng(41, -4));
            path.points.Add(new GLatLng(40, -4));
            path.points.Add(new GLatLng(39, -2));

            StaticGMap1.addStaticPath(path);
        }
コード例 #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                GLatLng ubicacion = new GLatLng(40.381090863719436, -3.6222052574157715);
                GMap1.setCenter(ubicacion, 15);

                //Establecemos alto y ancho en px
                GMap1.Height = 560;
                GMap1.Width = 660;

                //Adiciona el control de la parte izq superior (moverse, ampliar y reducir)
                GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl));

                //GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro.
                GMap1.Add(new GControl(GControl.preBuilt.MapTypeControl));

                //Con esto podemos definir el icono que se mostrara en la ubicacion
                //#region Crear Icono
                //GIcon iconPropio = new GIcon();
                //iconPropio.image = "../images/iconBuilding.png";
                //iconPropio.shadow = "../images/iconBuildingS.png";
                //iconPropio.iconSize = new GSize(32, 32);
                //iconPropio.shadowSize = new GSize(29, 16);
                //iconPropio.iconAnchor = new GPoint(10, 18);
                //iconPropio.infoWindowAnchor = new GPoint(10, 9);
                //#endregion

                //Pone la marca de gota de agua con el nombre de la ubicacion
                GMarker marker = new GMarker(ubicacion);
                string strMarker = "<div style='width: 250px; height: 185px'><b>" +
                    "<span style='color:#ff7e00'>es</span>ASP.NET</b><br>" +
                    " C/ C/ Nombre de Calle, No X <br /> 28031 Madrid, España <br />" +
                    "Tel: +34 902 00 00 00 <br />Fax: +34 91 000 00 00<br />" +
                    "Web: <a href='http://www.esASP.net/' class='txtBKM' >www.esASP.net</a>" +
                    "<br />Email: <a href='mailto:[email protected]' class='txtBKM'>" +
                    "[email protected]</a><br><br></div>";
                GInfoWindow window = new GInfoWindow(marker, strMarker, true);
                GMap1.Add(window);

                GMap1.enableHookMouseWheelToZoom = true;

                //Tipo de mapa a mostrar
                GMap1.mapType = GMapType.GTypes.Normal;

                //Moverse con el cursor del teclado
                GMap1.enableGKeyboardHandler = true;
            }
        }
コード例 #31
0
        private void BindData(SelectedHotelsEntities db, GLatLng point, double distance)
        {
            int?hotelTypeId = null;

            if (Settings["hoteltype"] != null)
            {
                hotelTypeId = Convert.ToInt32(Settings["hoteltype"]);
            }
            var location = DbGeography.FromText(String.Format("POINT({0} {1})", point.lng, point.lat));
            var hotels   = from hotel in db.Products.Where(p => !p.IsDeleted).OfType <Hotel>()
                           let dist = hotel.Location.Distance(location) * .00062
                                      where
                                      !hotel.IsDeleted && hotel.Location != null && hotel.Location.Latitude != null &&
                                      hotel.Location.Longitude != null &&
                                      dist <= distance &&
                                      (hotelTypeId == null || hotel.HotelTypeId == hotelTypeId)
                                      select new HotelView
            {
                Id               = hotel.Id,
                Name             = hotel.Name,
                Number           = hotel.Number,
                UnitCost         = hotel.UnitCost,
                Description      = hotel.Description,
                URL              = hotel.URL,
                Image            = hotel.Image,
                ExtraDescription = hotel.ExtraDescription,
                CurrencyCode     = hotel.CurrencyCode,
                Rooms            = hotel.Rooms,
                Star             = hotel.Star,
                CustomerRating   = hotel.CustomerRating,
                Address          = hotel.Address,
                PostCode         = hotel.PostCode,
                Location         = hotel.Location,
                Distance         = dist,
                GeoName          = hotel.GeoName
            };

            if (Session["filter"] != null)
            {
                hotels =
                    hotels.Where(
                        p =>
                        p.Name.ToLower().Contains(TextBoxFilter.Text.ToLower()) ||
                        p.Description.ToLower().Contains(TextBoxFilter.Text.ToLower()));
                LabelFilteredBy.Text      = String.Format("and filtered by \"{0}\"", TextBoxFilter.Text);
                LabelFilteredBy.Visible   = true;
                ButtonClearFilter.Visible = true;
            }
            else
            {
                LabelFilteredBy.Visible   = false;
                ButtonClearFilter.Visible = false;
            }
            List <HotelView> hotelList = null;

            Enums.SortCriteriaEnum sortCriteria = (Enums.SortCriteriaEnum)Enum.Parse(typeof(Enums.SortCriteriaEnum), DropDownListSortCriterias.SelectedValue);
            switch (sortCriteria)
            {
            case Enums.SortCriteriaEnum.Name:
                hotels = hotels.OrderBy(h => h.Name);
                break;

            case Enums.SortCriteriaEnum.PriceAsc:
                hotels = hotels.OrderBy(h => h.UnitCost);
                break;

            case Enums.SortCriteriaEnum.PriceDesc:
                hotels = hotels.OrderByDescending(h => h.UnitCost);
                break;

            case Enums.SortCriteriaEnum.RatingAsc:
                hotels = hotels.OrderBy(h => h.Star);
                break;

            case Enums.SortCriteriaEnum.RatingDesc:
                hotels = hotels.OrderByDescending(h => h.Star);
                break;

            case Enums.SortCriteriaEnum.DistanceAsc:
                hotels = hotels.OrderBy(h => h.Distance);
                break;

            case Enums.SortCriteriaEnum.DistanceDesc:
                hotels = hotels.OrderByDescending(h => h.Distance);
                break;
            }
            ListViewContent.DataSource = hotels.ToList();
            ListViewContent.DataBind();

            var count = hotels.Count();

            DataPagerContent.Visible  = count > DataPagerContent.PageSize;
            DataPagerContent2.Visible = count > DataPagerContent2.PageSize;
            LabelCount.Text           = count.ToString();

            int i = DataPagerContent.StartRowIndex + 1;

            foreach (var hotel in hotels.Skip(DataPagerContent.StartRowIndex).Take(DataPagerContent.PageSize))
            {
                GLatLng       gLatLng       = new GLatLng(hotel.Location.Latitude.Value, hotel.Location.Longitude.Value);
                PinLetter     pinLetter     = new PinLetter(i.ToString(), Color.FromArgb(0xB4, 0x97, 0x59), Color.Black);
                var           markerOptions = new GMarkerOptions(new GIcon(pinLetter.ToString(), pinLetter.Shadow()), hotel.Name.Replace("'", "´"));
                GMarker       marker        = new GMarker(gLatLng, markerOptions);
                StringBuilder sb            = new StringBuilder();
                sb.Append(hotel.Name);
                sb.AppendFormat("<br />Address:&nbsp;{0}", hotel.Address);
                GInfoWindow window = new GInfoWindow(marker, sb.ToString(), false);
                locationGMap.addInfoWindow(window);
                i++;
            }
        }
コード例 #32
0
    protected void Page_Load(object sender, EventArgs e)
    {
        GLatLng latLng = new GLatLng(39.1, -94.58);
        //creating markers with latitude and logitude, plus pushpin window and adding window in Gmap Control
        GIcon icon = new GIcon();

        //Stadium pins with window info

        GMarker     marker = new GMarker(new GLatLng(36.166461, -86.771289), icon);
        GInfoWindow window = new GInfoWindow(marker, "Titans , Zip Code = 37891");

        GMap1.Add(window);
        GMarker     marker1 = new GMarker(new GLatLng(40.812194, -74.076983), icon);
        GInfoWindow window1 = new GInfoWindow(marker1, "Giants , Zip Code = 10001");

        GMap1.Add(window1);
        GMarker     marker2 = new GMarker(new GLatLng(40.446786, -80.015761), icon);
        GInfoWindow window2 = new GInfoWindow(marker2, "Steelers, Zip Code = 15202");

        GMap1.Add(window2);
        GMarker     marker3 = new GMarker(new GLatLng(35.225808, -80.852861), icon);
        GInfoWindow window3 = new GInfoWindow(marker3, "Panthers, Zip Code = 28202");

        GMap1.Add(window3);
        GMarker     marker4 = new GMarker(new GLatLng(39.277969, -76.622767), icon);
        GInfoWindow window4 = new GInfoWindow(marker4, "Ravens, Zip Code = 21203");

        GMap1.Add(window4);
        GMarker     marker5 = new GMarker(new GLatLng(27.975967, -82.50335), icon);
        GInfoWindow window5 = new GInfoWindow(marker5, "Buccaneers, Zip Code = 33607");

        GMap1.Add(window5);
        GMarker     marker6 = new GMarker(new GLatLng(39.760056, -86.163806), icon);
        GInfoWindow window6 = new GInfoWindow(marker6, "Colts, Zip Code = 46201");

        GMap1.Add(window6);
        GMarker     marker7 = new GMarker(new GLatLng(44.973881, -93.258094), icon);
        GInfoWindow window7 = new GInfoWindow(marker7, "Vikings, Zip Code = 56760");

        GMap1.Add(window7);
        GMarker     marker8 = new GMarker(new GLatLng(33.5277, -112.262608), icon);
        GInfoWindow window8 = new GInfoWindow(marker8, "Cardinals, Zip Code = 85001");

        GMap1.Add(window8);
        GMarker     marker9 = new GMarker(new GLatLng(32.747778, -97.092778), icon);
        GInfoWindow window9 = new GInfoWindow(marker9, "Cowboys, Zip Code = 75203");

        GMap1.Add(window9);
        GMarker     marker10 = new GMarker(new GLatLng(33.757614, -84.400972), icon);
        GInfoWindow window10 = new GInfoWindow(marker10, "Falcons, Zip code = 30303");

        GMap1.Add(window10);
        GMarker     marker11 = new GMarker(new GLatLng(40.812194, -74.076983), icon);
        GInfoWindow window11 = new GInfoWindow(marker11, "Jets, Zip Code = 10001");

        GMap1.Add(window11);
        GMarker     marker12 = new GMarker(new GLatLng(39.743936, -105.020097), icon);
        GInfoWindow window12 = new GInfoWindow(marker12, "Broncos, Zip Code = 28037");

        GMap1.Add(window12);
        GMarker     marker13 = new GMarker(new GLatLng(25.957919, -80.238842), icon);
        GInfoWindow window13 = new GInfoWindow(marker13, "Dolphins, Zip Code = 33102");

        GMap1.Add(window13);
        GMarker     marker14 = new GMarker(new GLatLng(39.900775, -75.167453), icon);
        GInfoWindow window14 = new GInfoWindow(marker14, "Eagles, Zip Code = 19092");

        GMap1.Add(window14);
        GMarker     marker15 = new GMarker(new GLatLng(41.862306, -87.616672), icon);
        GInfoWindow window15 = new GInfoWindow(marker15, "Bears, Zip Code = 60602");

        GMap1.Add(window15);
        GMarker     marker16 = new GMarker(new GLatLng(42.090925, -71.26435), icon);
        GInfoWindow window16 = new GInfoWindow(marker16, "Patriots, Zip Code = 58647");

        GMap1.Add(window16);
        GMarker     marker17 = new GMarker(new GLatLng(38.907697, -76.864517), icon);
        GInfoWindow window17 = new GInfoWindow(marker17, "Redskins, Zip Code = 20575");

        GMap1.Add(window17);
        GMarker     marker18 = new GMarker(new GLatLng(44.501306, -88.062167), icon);
        GInfoWindow window18 = new GInfoWindow(marker18, "Packers, Zip Code = 54301");

        GMap1.Add(window18);
        GMarker     marker19 = new GMarker(new GLatLng(32.783117, -117.119525), icon);
        GInfoWindow window19 = new GInfoWindow(marker19, "Chargers, Zip Code = 92103");

        GMap1.Add(window19);
        GMarker     marker20 = new GMarker(new GLatLng(29.950931, -90.081364), icon);
        GInfoWindow window20 = new GInfoWindow(marker20, "Saints, Zip Code = 70112");

        GMap1.Add(window20);
        GMarker     marker21 = new GMarker(new GLatLng(29.684781, -95.410956), icon);
        GInfoWindow window21 = new GInfoWindow(marker21, "Texans, Zip Code = 77002");

        GMap1.Add(window21);
        GMarker     marker22 = new GMarker(new GLatLng(42.773739, -78.786978), icon);
        GInfoWindow window22 = new GInfoWindow(marker22, "Bills, Zip code = 14202");

        GMap1.Add(window22);
        GMarker     marker23 = new GMarker(new GLatLng(37.713486, -122.386256), icon);
        GInfoWindow window23 = new GInfoWindow(marker23, "49ers, Zip Code = 94102");

        GMap1.Add(window23);
        GMarker     marker24 = new GMarker(new GLatLng(30.323925, -81.637356), icon);
        GInfoWindow window24 = new GInfoWindow(marker24, "Jaguars, Zip Code = 32099");

        GMap1.Add(window24);
        GMarker     marker25 = new GMarker(new GLatLng(41.506022, -81.699564), icon);
        GInfoWindow window25 = new GInfoWindow(marker25, "Browns, Zip Code = 44114");

        GMap1.Add(window25);
        GMarker     marker26 = new GMarker(new GLatLng(37.751411, -122.200889), icon);
        GInfoWindow window26 = new GInfoWindow(marker26, "Raiders, Zip Code = 94502");

        GMap1.Add(window26);
        GMarker     marker27 = new GMarker(new GLatLng(39.048914, -94.484039), icon);
        GInfoWindow window27 = new GInfoWindow(marker27, "Chiefs, Zip Code = 66027");

        GMap1.Add(window27);
        GMarker     marker28 = new GMarker(new GLatLng(38.632975, -90.188547), icon);
        GInfoWindow window28 = new GInfoWindow(marker28, "Rams, Zip Code = 63101");

        GMap1.Add(window28);
        GMarker     marker29 = new GMarker(new GLatLng(47.595153, -122.331625), icon);
        GInfoWindow window29 = new GInfoWindow(marker29, "Seahawks, Zip Code = 98102");

        GMap1.Add(window29);
        GMarker     marker30 = new GMarker(new GLatLng(39.095442, -84.516039), icon);
        GInfoWindow window30 = new GInfoWindow(marker30, "Bengals, Zip Code = 45202");

        GMap1.Add(window30);
        GMarker     marker31 = new GMarker(new GLatLng(42.340156, -83.045808), icon);
        GInfoWindow window31 = new GInfoWindow(marker31, "Lions, Zip Code = 48205");

        GMap1.Add(window31);

        GMap1.Height  = 350;
        GMap1.Width   = 990;
        GMap1.GCenter = latLng;
        GMap1.GZoom   = 4;
    }
コード例 #33
0
        private void BuildMap()
        {
            dt = BD.GetTable();
            Double lat, lng;

            if (dt.Rows.Count > 0)
            {
                foreach (DataRow row in dt.Rows)
                {
                    lat = Convert.ToDouble(row["latitud"].ToString().Replace('.', ','));
                    lng = Convert.ToDouble(row["longitud"].ToString().Replace('.', ','));
                    GLatLng latLng = new GLatLng(lat, lng);



                    GIcon icon = new GIcon();
                    icon.image  = "https://www.google.es/maps/vt/icon/name=icons/spotlight/spotlight-poi-medium.png&scale=2?scale=1";
                    icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";

                    GMarkerOptions mOpts = new GMarkerOptions();
                    mOpts.clickable = true;
                    mOpts.icon      = icon;
                    GMarker marker = new GMarker(latLng, mOpts);
                    //GMap1.Add(marker);

                    GInfoWindow window = new GInfoWindow(marker,
                                                         string.Format(
                                                             @"<span style='color:blue;'>{0} </span><br />
                                                               <span ><b>Latitutd:</b></span> {1} <br /> 
                                                               <span ><b>Longitud:</b>:</span> {2} <br />
                                                               <b>aForo:</b> {3}",
                                                             row["name_branch"].ToString(),
                                                             row["latitud"].ToString(),
                                                             row["longitud"].ToString(),
                                                             row["aforo"].ToString()
                                                             ),
                                                         true);
                    GMap1.Add(window);
                }
            }

            KeyDragZoom keyDragZoom = new KeyDragZoom();

            keyDragZoom.key       = KeyDragZoom.HotKeyEnum.ctrl;
            keyDragZoom.boxStyle  = "{border: '4px solid #FFFF00'}";
            keyDragZoom.VeilStyle = "{backgroundColor: 'black', opacity: 0.2, cursor: 'crosshair'}";

            GMap1.Add(keyDragZoom);

            GCustomCursor customCursor = new GCustomCursor(cursor.crosshair, cursor.text);

            GMap1.Add(customCursor);

            GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl));

            GMap1.Add(new GListener(GMap1.GMap_Id, GListener.Event.zoomend,
                                    string.Format(@"
                   function(oldLevel, newLevel)
                   {{
                      if ((newLevel > 7) || (newLevel < 4))
                      {{
                          var ev = new serverEvent('AdvancedZoom', {0});
                          ev.addArg(newLevel);
                          ev.send();
                      }}
                   }}
                   ", GMap1.GMap_Id)));
        }
コード例 #34
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);
        }
コード例 #35
0
        private void CargarMapa(string region, string provincia, string comuna, string direccion, GLatLng coordenadas)
        {
            //GLatLng ubicacion = new GLatLng(coordenadas);
            GMap1.setCenter(coordenadas, 15);
            GMap1.Height = 460;
            GMap1.Width  = 560;
            //Adiciona el control de la parte izq superior (moverse, ampliar y reducir)
            GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl));
            //GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro.
            GMap1.addControl(new GControl(GControl.preBuilt.MapTypeControl));
            //Pone la marca de gota de agua con el nombre de la ubicacion
            GMarker marker    = new GMarker(coordenadas);
            string  strMarker = "<div style='width: 185px; height: 100px'><b>" +
                                "SGME_MAPS</b><br> " + region + "<br />" + comuna + ", " + provincia + "<br />" +
                                "" + direccion + "</div>";
            GInfoWindow window = new GInfoWindow(marker, strMarker, true);

            GMap1.addInfoWindow(window);
            GMap1.enableHookMouseWheelToZoom = true;
            //Tipo de mapa a mostrar
            GMap1.mapType = GMapType.GTypes.Normal;
            //Moverse con el cursor del teclado
            GMap1.enableGKeyboardHandler = true;
            GMap1.ShowMapTypeControl     = true;



            //GMap1.GZoom = 9;
            //GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl));

            //GeoCoding geoCoding = new GeoCoding();

            //geoCoding.show = GeoCoding.ShowEnum.infowindow;
            //geoCoding.openedOnLoad = true;
            //geoCoding.errorText = "Not found";
            //geoCoding.buttonText = "Search";
            //geoCoding.infoText = "GeoCode";
            //geoCoding.baseCountryCode = "au"; // Search Newcastle, and you'll find it elsewhere...
            //// geoCoding.viewport = new GLatLngBounds(new GLatLng(44, 14), new GLatLng(46, 16));

            //geoCoding.showErrorCode = true;
            //GMap1.Add(geoCoding);

            //Con esto podemos definir el icono que se mostrara en la ubicacion
            //#region Crear Icono
            //GIcon iconPropio = new GIcon();
            //iconPropio.image = "../images/iconBuilding.png";
            //iconPropio.shadow = "../images/iconBuildingS.png";
            //iconPropio.iconSize = new GSize(32, 32);
            //iconPropio.shadowSize = new GSize(29, 16);
            //iconPropio.iconAnchor = new GPoint(10, 18);
            //iconPropio.infoWindowAnchor = new GPoint(10, 9);
            //#endregion
        }
コード例 #36
0
        /// <summary>
        /// Bearings to.
        /// </summary>
        /// <param name="sourceLat">The source lat.</param>
        /// <param name="lat">The lat.</param>
        /// <param name="sourceLon">The source lon.</param>
        /// <param name="lng">The LNG.</param>
        /// <returns>System.Double.</returns>
        public static double BearingTo(double sourceLat, double lat, double sourceLon, double lng)
        {
            var source = new GLatLng(sourceLat, sourceLon);

            return(source.RhumbBearingTo(lat, lng));
        }
コード例 #37
0
        public void AddSitesToMap(int wsc_id, int office_id, int trip_id)
        {
            int         rowCount     = 0;
            double      lat          = 0;
            double      latAvg       = 0;
            double      latMin       = 0;
            double      latMax       = 0;
            double      latPrev      = 0;
            double      lng          = 0;
            double      lngAvg       = 0;
            double      lngMin       = 0;
            double      lngMax       = 0;
            double      lngPrev      = 0;
            int         MapZoomLevel = 0;
            string      site_tp_cd   = null;
            GLatLng     latlon       = default(GLatLng);
            GMarker     marker       = default(GMarker);
            GInfoWindow window       = default(GInfoWindow);
            string      winText      = "";
            string      trip_nm      = "";
            int         i            = 0;

            var SiteList = db.vFieldTripSites.Where(p => p.trip_id == trip_id).ToList();

            foreach (var site in SiteList)
            {
                string site_no = site.site_no.Trim();

                if ((!object.ReferenceEquals(site.dec_lat_va, DBNull.Value)))
                {
                    lat = (double)site.dec_lat_va;
                }
                if ((!object.ReferenceEquals(site.dec_long_va, DBNull.Value)))
                {
                    lng = (double)site.dec_long_va;
                }

                if (lat == 0 | lng == 0)
                {
                    i += 1;
                }
                else
                {
                    site_tp_cd = site.site_tp_cd;
                    trip_nm    = site.trip_full_nm;

                    if (lat != latPrev & lng != lngPrev)
                    {
                        winText = "";
                    }
                    else
                    {
                        winText = winText + "<hr />";
                    }

                    winText = winText + "<b>" + site_no + " " + site.station_nm + "<br />" +
                              trip_nm + "</b><br /><br />" +
                              "<a href=\"https://sims.water.usgs.gov/SIMS/StationInfo.aspx?site_id=" + site.site_id.ToString() + "\" target=\"_blank\">SIMS Station Information Page</a><br />" +
                              "<a href=\"http://waterdata.usgs.gov/nwis/nwisman/?site_no=" + site_no + "\" target=\"_blank\">NWIS Web</a>";

                    latAvg = latAvg + lat;
                    lngAvg = lngAvg + lng;
                    if (i == 0)
                    {
                        latMin = lat;
                        latMax = lat;
                        lngMin = lng;
                        lngMax = lng;
                    }
                    else
                    {
                        if (lat < latMin)
                        {
                            latMin = lat;
                        }
                        if (lat > latMax)
                        {
                            latMax = lat;
                        }
                        if (lng < lngMin)
                        {
                            lngMin = lng;
                        }
                        if (lng > lngMax)
                        {
                            lngMax = lng;
                        }
                    }

                    latlon = new GLatLng(lat, lng);
                    marker = new GMarker(latlon, GetMarkerOpts());
                    window = new GInfoWindow(marker, winText, false, GListener.Event.click);
                    GMap.addInfoWindow(window);

                    latPrev = lat;
                    lngPrev = lng;

                    i += 1;
                }
            }

            rowCount = SiteList.Count();

            if (rowCount == 0)
            {
                SetupBasicGMapDisplay(wsc_id);
            }
            else
            {
                //zoom/center map based on markers
                latAvg       = (latAvg / i);
                lngAvg       = (lngAvg / i);
                MapZoomLevel = GetMapZoomLevel(latMin, latMax, lngMin, lngMax);
                GMap.setCenter(new GLatLng(latAvg, lngAvg), MapZoomLevel);
            }
            lblResultsCount.Text = "Sites returned: " + rowCount.ToString();
        }
コード例 #38
0
    private void BindGmapData()
    {
        var sites = _siteBL.GetSitesForMap().ToList();

        if (sites.Count == 0)
        {
            GMap1.setCenter(new GLatLng(16.109833, 107.201294), 6);
            return;
        }
        List <string> groups = (from s in sites
                                select s.DisplayGroup).Distinct().ToList();

        if (!IsPostBack)
        {
            int i = 0;
            foreach (string g in groups)
            {
                Telerik.Web.UI.RadTreeNode parent = new Telerik.Web.UI.RadTreeNode(g);
                trvSites.Nodes.Add(parent);
                var gSites = (from s1 in sites
                              where s1.DisplayGroup == g
                              select s1).ToList();

                foreach (t_Sites gS in gSites)
                {
                    Telerik.Web.UI.RadTreeNode child = new Telerik.Web.UI.RadTreeNode(gS.Location, gS.SiteAliasName);
                    child.NavigateUrl = String.Format("javascript:open_Window({0});", i.ToString());
                    parent.Nodes.Add(child);
                    i++;
                }
            }
            trvSites.ExpandAllNodes();
        }
        GLatLngBounds gLatLngBounds = new GLatLngBounds();

        double   forwardIndex = 0;
        double   reveseIndex  = 0;
        DateTime?lastForwardIndexTimeStamp = null;
        DateTime?lastReverseIndexTimeStamp = null;
        double?  index          = 0;
        DateTime?indexTimeStamp = null;

        GIcon icon = new GIcon();

        icon.image            = System.Configuration.ConfigurationManager.AppSettings["gMarkerIcon"];
        icon.iconSize         = new GSize(20, 20);
        icon.shadowSize       = new GSize(20, 20);
        icon.iconAnchor       = new GPoint(6, 20);
        icon.infoWindowAnchor = new GPoint(5, 1);

        GIcon icon_alrm = new GIcon();

        icon_alrm.image            = System.Configuration.ConfigurationManager.AppSettings["gMarkerIconError"];
        icon_alrm.iconSize         = new GSize(20, 20);
        icon_alrm.shadowSize       = new GSize(20, 20);
        icon_alrm.iconAnchor       = new GPoint(6, 20);
        icon_alrm.infoWindowAnchor = new GPoint(5, 1);

        GMap1.resetCustomInsideJS();
        GMap1.resetCustomJS();
        GMap1.resetInfoWindows();
        GMap1.resetMarkers();

        //Alarm display
        List <string>   listSiteAlarm = new List <string>();
        OleDbConnection aCnn          = new OleDbConnection("");

        aCnn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data source=C:\PMAC\PMACSITE.MDB";
        try
        {
            aCnn.Open();
            OleDbCommand    aCmd = new OleDbCommand("SELECT [Id] FROM [ALARMLOG] WHERE Priority LIKE 'H' OR Priority LIKE 'L' GROUP BY [Id]", aCnn);
            OleDbDataReader aRdr = aCmd.ExecuteReader();
            while (aRdr.Read())
            {
                listSiteAlarm.Add(aRdr[0].ToString());
            }
            aCnn.Close();
            aCnn.Dispose();
        }
        catch (Exception ex)
        {
            //throw ex;
        }

        StringBuilder sb = new StringBuilder();

        sb.Append("markers = [];");
        sb.Append("lablelMarkers = [];");
        sb.Append("function add_Window()");
        sb.Append("{");
        string formatedAliasName;

        bool flag = false;

        foreach (string g in groups)
        {
            var gSites = (from s1 in sites
                          where s1.DisplayGroup == g
                          select s1).ToList();

            foreach (var s in gSites)
            {
                formatedAliasName = Clean(s.SiteAliasName);
                //formatedAliasName = s.SiteAliasName.Replace(' ', '_').Replace('.', '_').Replace('+','_').Replace('-','_');
                var channels = _channelConfigurationBL.GetChannelConfigurationsByLoggerID(s.LoggerId);
                forwardIndex = 0;
                reveseIndex  = 0;
                foreach (var c in channels)
                {
                    if (c.ForwardFlow == true)
                    {
                        forwardIndex = c.LastIndex ?? 0;
                        lastForwardIndexTimeStamp = c.IndexTimeStamp;
                    }
                    else if (c.ReverseFlow == true)
                    {
                        reveseIndex = c.LastIndex ?? 0;
                        lastReverseIndexTimeStamp = c.IndexTimeStamp;
                    }
                }
                index          = forwardIndex - reveseIndex;
                indexTimeStamp = lastForwardIndexTimeStamp ?? lastReverseIndexTimeStamp;

                string label = "";
                label += "<div id='l_" + formatedAliasName + "' >";
                label += "<div class='lblSiteName'>" + formatedAliasName + "</div>";
                label += "<table border='0' cellpadding='3' cellspacing='0'>";

                string html = "";

                html += "<div class=\"text\">"
                        + "Alias Name"
                        + ": "
                        + s.SiteAliasName
                        + "</div>";
                html += "<div class=\"text\">"
                        + "Vị trí"
                        + ": "
                        + s.Location
                        + "</div>";
                html += "<div class=\"text\">"
                        + "Cỡ ống"
                        + ": "
                        + s.PipeSize
                        + "</div>";
                html += "<div class=\"text\">"
                        + "Chỉ số"
                        + ": "
                        + string.Format("{0:0.0}", index) + " (" + (indexTimeStamp != null ? ((DateTime)indexTimeStamp).ToString("dd/MM/yyyy HH:mm:ss") : "") + ")"
                        + "</div>";
                html += "<table border=\"0\" cellpadding=\"3\" cellspacing=\"0\" style=\"width:auto;height=auto;\">";
                html += "<tr><td class=\"tblHeader\">"
                        + "Kênh"
                        + "</td><td class=\"tblHeader\">"
                        + "Mô tả"
                        + "</td><td class=\"tblHeader\">"
                        + "Ngày giờ"
                        + "</td><td class=\"tblHeader\">"
                        + "Giá trị"
                        + "</td><td class=\"tblHeader\">"
                        + "Đơn vị"
                        + "</td></tr>";

                flag = false;

                foreach (var c in channels)
                {
                    html += "<tr><td class=\"cellCenter\">"
                            + c.ChannelId
                            + "</td><td class=\"cellCenter\">"
                            + c.ChannelName
                            + "</td><td class=\"cellCenter imp\">"
                            + (c.TimeStamp == null ? "NO DATA" : ((DateTime)c.TimeStamp).ToString("dd/MM/yyyy HH:mm"))
                            + "</td><td class=\"cellRight imp\">"
                            + string.Format(culture, "{0:0.0}", c.LastValue)
                            + "</td><td class=\"cellLeft\">"
                            + c.Unit
                            + "</td></tr>";

                    if ((c.Pressure2 == true && c.Pressure1 == false && flag == false) || (c.Pressure2 == false && c.Pressure1 == true && flag == false))
                    {
                        label += "<tr><td class='cellCenterLbl'>"
                                 + (c.LastValue == null ? "NO DATA" : string.Format(culture, "{0:0.0}", c.LastValue))
                                 //+ "</td><td class='cellCenterLbl'>"
                                 //+ c.Unit
                                 + "</td></tr>";

                        flag = true;
                    }
                }

                html  += "</table>";
                label += "</table></div>";

                GMarkerOptions markerOptions = new GMarkerOptions();
                if (listSiteAlarm.Contains(s.LoggerId) || s.t_Logger_Configurations.Alarm == true)
                {
                    markerOptions.icon = icon_alrm;
                }
                else
                {
                    markerOptions.icon = icon;
                }

                markerOptions.Animation = GMarkerOptions.AnimationType.Bounce;

                GLatLng loc    = new GLatLng((double)s.Latitude, (double)s.Longitude);
                GMarker marker = new GMarker(loc, markerOptions);
                marker.ID = "m_" + formatedAliasName;
                GInfoWindow infoWindow = new GInfoWindow(marker, html);
                sb.Append(infoWindow.ToString(GMap1.GMap_Id));

                sb.AppendFormat("var {0} = new MarkerWithLabel(", "l_m_" + formatedAliasName);
                sb.Append("{");
                sb.AppendFormat(culture, "position: new google.maps.LatLng({0}, {1}),", (double)s.Latitude, (double)s.Longitude);
                sb.Append("draggable: false,");
                sb.Append("raiseOnDrag: false,");
                sb.AppendFormat("map: {0},", GMap1.GMap_Id);
                sb.AppendFormat("labelContent: \"{0}\",", label);
                var isMobile = BrowserDetected();
                if (!isMobile)
                {
                    if (s.LabelAnchorX == null || s.LabelAnchorY == null)
                    {
                        sb.Append("labelAnchor: new google.maps.Point(15, 0),");
                    }
                    else
                    {
                        sb.AppendFormat("labelAnchor: new google.maps.Point({0}, {1}),", s.LabelAnchorX, s.LabelAnchorY);
                    }
                }
                else
                {
                    sb.Append("labelAnchor: new google.maps.Point(30, 0),");
                }
                //if (s.LabelLat != s.Latitude || s.LabelLng != s.Longitude)
                //{
                //    GLatLng lStart = new GLatLng((double)s.Latitude, (double)s.Longitude);
                //    GLatLng lEnd = new GLatLng((double)s.LabelLat, (double)s.LabelLng);
                //    List<GLatLng> collection = new List<GLatLng>();
                //    collection.Add(lStart);
                //    collection.Add(lEnd);
                //    GPolyline line = new GPolyline(collection, "0000FF", 2);
                //    GMap1.Add(line);
                //}
                sb.Append("icon: {}");
                sb.Append("});");

                sb.AppendFormat("{0}.setVisible(display);", "l_m_" + formatedAliasName);

                sb.AppendFormat("google.maps.event.addListener({0}, 'click', function (e) ", "l_m_" + formatedAliasName);
                sb.Append("{");
                sb.AppendFormat("google.maps.event.trigger({0}, 'click')", marker.ID);
                sb.Append("});");

                sb.AppendFormat("markers.push({0});", marker.ID);
                sb.AppendFormat("lablelMarkers.push({0});", "l_m_" + formatedAliasName);

                gLatLngBounds.extend(loc);
            }
        }

        //On Page reload
        sb.AppendFormat("google.maps.event.addListener({0}, 'center_changed', function()", GMap1.GMap_Id);
        sb.Append("{");
        sb.AppendFormat("center={0}.getCenter();", GMap1.GMap_Id);
        sb.Append("});");
        sb.AppendFormat("{0}.setCenter(center);", GMap1.GMap_Id);

        //	create the ContextMenu object
        sb.AppendFormat("var contextMenu = new ContextMenu({0}, contextMenuOptions);", GMap1.GMap_Id);

        //	display the ContextMenu on a Map right click
        sb.AppendFormat("google.maps.event.addListener({0}, 'rightclick', function (mouseEvent)", GMap1.GMap_Id);
        sb.Append("{contextMenu.show(mouseEvent.latLng);});");

        sb.Append("google.maps.event.addListener(contextMenu, 'menu_item_selected', function (latLng, eventName) {");
        sb.Append("switch (eventName) {");
        sb.Append("case 'hide_click':");
        sb.Append("for (var i = 0; i < lablelMarkers.length; i++) {");
        sb.Append("lablelMarkers[i].setVisible(false);");
        sb.Append("display=false;");
        sb.Append("}");
        sb.Append("break;");
        sb.Append("case 'show_click':");
        sb.Append("for (var i = 0; i < lablelMarkers.length; i++) {");
        sb.Append("lablelMarkers[i].setVisible(true);");
        sb.Append("display=true;");
        sb.Append("}");
        sb.Append("break;");
        sb.Append("}");
        sb.Append("});");

        //Zoom max
        sb.AppendFormat("google.maps.event.addListener({0}, 'zoom_changed', function ()", GMap1.GMap_Id);
        sb.Append("{");
        sb.AppendFormat("var _zoom = {0}.getZoom();", GMap1.GMap_Id);
        sb.AppendFormat("if(_zoom < {0})", System.Configuration.ConfigurationManager.AppSettings["gZoomMinForLabel"]);
        sb.Append("{");
        sb.Append("for (var i = 0; i < lablelMarkers.length; i++) {");
        sb.Append("lablelMarkers[i].setVisible(false);");
        sb.Append("display=false;");
        sb.Append("}");
        sb.Append("}");
        sb.Append("else");
        sb.Append("{");
        sb.Append("for (var i = 0; i < lablelMarkers.length; i++) {");
        sb.Append("lablelMarkers[i].setVisible(true);");
        sb.Append("display=true;");
        sb.Append("}");
        sb.Append("}");
        sb.Append("});");


        //fitBounds
        //if (!IsPostBack)
        //{
        //    sb.Append("var myBounds = new google.maps.LatLngBounds(); ");
        //    sb.AppendFormat("var ne = new google.maps.LatLng({0},{1});", gLatLngBounds.ne.lat.ToString(), gLatLngBounds.ne.lng.ToString());
        //    sb.AppendFormat("var sw = new google.maps.LatLng({0},{1});", gLatLngBounds.sw.lat.ToString(), gLatLngBounds.sw.lng.ToString());
        //    sb.Append("myBounds.extend(ne);myBounds.extend(sw);");
        //    sb.AppendFormat("{0}.fitBounds(myBounds);", GMap1.GMap_Id);
        //}
        if (!IsPostBack)
        {
            sb.AppendFormat("{0}.setZoom({1});", GMap1.GMap_Id, System.Configuration.ConfigurationManager.AppSettings["gZoomInit"]);
            sb.AppendFormat("{0}.setCenter(new google.maps.LatLng({1}, {2}));"
                            , GMap1.GMap_Id, System.Configuration.ConfigurationManager.AppSettings["gLatInit"]
                            , System.Configuration.ConfigurationManager.AppSettings["gLngInit"]);
        }


        sb.Append("}");
        GMap1.Add(sb.ToString());
        GMap1.Add("add_Window();", true);
    }
コード例 #39
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var childTabs = TabController.GetTabsByParent(TabId, PortalId);

            if (childTabs.Count() > 0)
            {
                DetailsTabId = childTabs[0].TabID;
            }
            if (childTabs.Count() > 1)
            {
                EditTabId = childTabs[1].TabID;
            }

            try
            {
                if (!IsPostBack)
                {
                    LoadPersistentSettings();

                    StringBuilder sb = new StringBuilder();

                    sb.Append("var markersArray=[];");
                    sb.Append("function clearOverlays() {");
                    sb.Append("   for (var i = 0; i < markersArray.length; i++ ) {");
                    sb.Append("     markersArray[i].setMap(null);");
                    sb.Append("   }");
                    sb.Append("   markersArray = [];");
                    sb.Append("}");

                    locationGMap.Add(sb.ToString());

                    using (SelectedHotelsEntities db = new SelectedHotelsEntities())
                    {
#if DEBUGDB
                        db.Database.Log = logInfo => MyLogger.Log(logInfo, PortalSettings);
#endif
                        PanelCategories.Visible = false;
                        PanelProducts.Width     = Unit.Pixel(870);

                        GeoName geoName = db.GeoNames.SingleOrDefault(gn => gn.Name == "London" && gn.CountryCode == "GB");
                        GLatLng point   = new GLatLng(geoName.Location.Latitude.Value, geoName.Location.Longitude.Value);
                        if (Session["HiddenFieldX"] == null && Session["Location"] == null)
                        {
                            if (Settings["location"] != null)
                            {
                                var location = Settings["location"].ToString();
                                var geoNames = db.GeoNames.Where(gn => gn.Name.ToLower() == location.ToLower())
                                               .OrderByDescending(gn => gn.Population)
                                               .ThenByDescending(gn => gn.ModificationDate);
                                if (geoNames.Any())
                                {
                                    geoName = geoNames.FirstOrDefault();
                                    Session["HiddenFieldX"] = geoName.Location.Latitude.Value;
                                    Session["HiddenFieldY"] = geoName.Location.Longitude.Value;
                                }
                            }
                        }
                        else if (Session["Location"] != null)
                        {
                            var location = Session["Location"].ToString();
                            var geoNames = db.GeoNames.Where(gn => gn.Name.ToLower() == location.ToLower())
                                           .OrderByDescending(gn => gn.Population)
                                           .ThenByDescending(gn => gn.ModificationDate);
                            if (geoNames.Any())
                            {
                                geoName = geoNames.FirstOrDefault();
                                if (geoName.Location.Latitude != null && geoName.Location.Longitude != null)
                                {
                                    Session["HiddenFieldX"] = geoName.Location.Latitude.Value;
                                    Session["HiddenFieldY"] = geoName.Location.Longitude.Value;
                                }
                            }
                        }
                        else if (Session["HiddenFieldX"] != null)
                        {
                            point = new GLatLng(Convert.ToDouble(Session["HiddenFieldX"]), Convert.ToDouble(Session["HiddenFieldY"]));
                            var location = DbGeography.FromText(String.Format("POINT({0} {1})", point.lng, point.lat));
                            geoName = db.GeoNames.Where(gn => gn.FeatureClass == "P").OrderBy(gn => gn.Location.Distance(location)).First();
                        }

                        point = new GLatLng(Convert.ToDouble(Session["HiddenFieldX"]), Convert.ToDouble(Session["HiddenFieldY"]));
                        LabelSelectedLocation.Text = geoName.Name;

                        double distance = double.Parse(DropDownListDistance.SelectedValue);
                        ResetMap(point, distance);
                        CreateMarker(point);

                        BindData(db, point, distance);

                        SavePersistentSetting();
                    }
                }
            }
            catch (Exception ex)
            {
                Exceptions.ProcessModuleLoadException(this, ex);
            }
        }
コード例 #40
0
        //    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "openModal();", true);
        protected void btnFiltrosBuscar_Click(object sender, EventArgs e)
        {
            ArrayList parametros = new ArrayList();

            parametros.Add((string.IsNullOrEmpty(txtFiltrosCodCliente.Text) ? "%%" : txtFiltrosCodCliente.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosRazonSocial.Text) ? "%%" : txtFiltrosRazonSocial.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosCuotas.Text) ? "%" : txtFiltrosCuotas.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosFlag.Text) ? "%" : txtFiltrosFlag.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosDescuento.Text) ? "%" : txtFiltrosDescuento.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosUsuarioAlta.Text) ? "%" : txtFiltrosUsuarioAlta.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosNumeroFactura.Text) ? "%" : txtFiltrosNumeroFactura.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosIP.Text) ? "%%%" : txtFiltrosIP.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosDescripcion.Text) ? "%" : txtFiltrosDescripcion.Text));

            if (!string.IsNullOrEmpty(dpFiltrosDesde.Text))
            {
                //parametros.Add(pMetodos.ConvertmmddyyyyToyyyymmdd(dpFiltrosDesde.Text));
                parametros.Add(pMetodos.ConvertddmmyyyyToyyyymmdd(dpFiltrosDesde.Text));
            }
            else
            {
                parametros.Add("1900/1/1");
            }
            if (!string.IsNullOrEmpty(dpFiltrosHasta.Text))
            {
                //parametros.Add(pMetodos.ConvertmmddyyyyToyyyymmdd(dpFiltrosHasta.Text));
                parametros.Add(pMetodos.ConvertddmmyyyyToyyyymmdd(dpFiltrosHasta.Text));
            }
            else
            {
                parametros.Add("2900/1/1");
            }

            parametros.Add(ddlFiltrosCantidadRegistros.SelectedValue.ToString());
            parametros.Add((string.IsNullOrEmpty(txtFiltrosAgrup.Text) ? "%" : txtFiltrosAgrup.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosTicket.Text) ? "%" : txtFiltrosTicket.Text));
            parametros.Add((string.IsNullOrEmpty(txtFiltrosCodPromo.Text) ? "%" : txtFiltrosCodPromo.Text));
            parametros.Add(ddlFiltrosFamilia.SelectedValue.ToString());


            GMap1.reset();
            //me centro en argentina
            GLatLng ubicacion = new GLatLng(-13.533406, -88.4127875);//(-35.3139685, -65.104704);//(40.381090863719436, -3.6222052574157715);

            GMap1.setCenter(ubicacion, 4);

            //Establecemos alto y ancho en px
            GMap1.Height = 600;
            GMap1.Width  = 558;

            //Adiciona el control de la parte izq superior (moverse, ampliar y reducir)
            GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl));

            //GControl.preBuilt.MapTypeControl: permite elegir un tipo de mapa y otro.
            GMap1.Add(new GControl(GControl.preBuilt.MapTypeControl));

            cargarClientesEnMapa(clientesMap);

            GMap1.enableHookMouseWheelToZoom = true;

            //Tipo de mapa a mostrar
            GMap1.mapType = GMapType.GTypes.Normal;

            //Moverse con el cursor del teclado
            GMap1.enableGKeyboardHandler = true;


            gvListadosFacturasVisa.DataSource = conFacturas.ListadoDeFacturas(parametros);
            gvListadosFacturasVisa.DataBind();
        }