Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                //// GMap1.Version = "2.43";
                //GMap1.enableDragging = false;
                //GMap1.enableGoogleBar = true;
                GMap1.Language = "es";
                GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl));
                GLatLng latlong = new GLatLng(10.856522627179888, -84.59865722656251);         //LATITUD Y LONGITUD POR DEFECTO DEL MAPA
                GMap1.setCenter(latlong);
                GCustomCursor customCursor = new GCustomCursor(cursor.crosshair, cursor.text); //CURSOR POR DEFECTO
                GMap1.Add(customCursor);


                GMap1.Add(new GListener(GMap1.GMap_Id, GListener.Event.click,
                                        string.Format(@"
        function(event)
        {{
            if (!event) return;
            var ev = new serverEvent('Click', {0});
            ev.addArg({0}.getDiv().offsetWidth);
            ev.addArg({0}.getDiv().offsetHeight);
            ev.addArg(event.latLng.lat());
            ev.addArg(event.latLng.lng());
            ev.send();
       }}
       ", GMap1.GMap_Id)));

                //guargar estado original
                Session["lat"] = latlong.lat.ToString();
                Session["lng"] = latlong.lng.ToString();
            }
        }
Exemplo n.º 2
0
        private void caracteristicasGmap()
        {
            gmap1.enableDragging             = true;
            gmap1.enableHookMouseWheelToZoom = true;
            gmap1.enableGKeyboardHandler     = true;
            gmap1.Language  = "es";
            gmap1.BackColor = Color.White;
            gmap1.setCenter(new GLatLng(-12.1416088, -76.99181550000003), 14);

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

            gmap1.Add(customCursor);
            gmap1.Add(new GMapUI());


            gmap1.Add(new GControl(GControl.extraBuilt.TextualOnClickCoordinatesControl, new GControlPosition(GControlPosition.position.Bottom_Left)));
        }
Exemplo n.º 3
0
        //Latitud y Longitud del colegio

        private void caracteristicasGmap(string latitu, string longi)
        {
            //Centra y añade marcador al colegio (PREDETERMINADO)
            GLatLng latlng2 = new GLatLng(Convert.ToDouble(latitu), Convert.ToDouble(longi));

            gmap1.setCenter(latlng2, 15);
            GMarker m1 = new GMarker(new GLatLng(Convert.ToDouble(latitu), Convert.ToDouble(longi)));

            gmap1.Add(m1);
            configuracionMap();
            GCustomCursor customCursor = new GCustomCursor(cursor.crosshair, cursor.text);

            gmap1.Add(customCursor);
            gmap1.Add(new GMapUI());
            //Añade info
            String      html   = "<center><b>" + "" + txtCole.Text.ToString() + "<center><b>";
            GInfoWindow window = new GInfoWindow(m1, html, true);

            gmap1.Add(window);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            GCustomCursor customCursor = new GCustomCursor(cursor.crosshair, cursor.text);

            GMap1.Add(customCursor);
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MarkerManager mManager = new MarkerManager();
            double lat = 0.0;
            double longi = 0.0;

            //reset listeners, necessary for marker listener to work between postback
            GMap1.resetListeners();

            //Create default marker
            GIcon icon = new GIcon();
            icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
            icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
            icon.iconSize = new GSize(20, 28);
            icon.shadowSize = new GSize(30, 28);
            icon.iconAnchor = new GPoint(10, 18);
            icon.infoWindowAnchor = new GPoint(5, 1);

            GMap1.mapType = GMapType.GTypes.Hybrid;

            GMarkerOptions mOpts = new GMarkerOptions();
            mOpts.clickable = false;
            mOpts.icon = icon;

            //GMap1.GZoom = 3; //set zoom level
            GMap1.Key = ConfigurationSettings.AppSettings["GoogleMapKey"];
            GMap1.enableDragging = true;
            GMap1.enableGoogleBar = false;
            GMap1.Language = "en";
            GMap1.BackColor = Color.White;
            //GMap1.enableHookMouseWheelToZoom = true;
            GMap1.enableGKeyboardHandler = true;

            //Add built-in control for selecting map type
            GMap1.addControl(new GControl(GControl.preBuilt.MapTypeControl));

            //Add built-in control for zoom and pan
            //GMap1.addControl(new GControl(GControl.preBuilt.SmallZoomControl3D));
            GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl3D));

            //Custom cursor
            GCustomCursor customCursor = new GCustomCursor(cursor.crosshair, cursor.text);
            GMap1.addCustomCursor(customCursor);

            //Mark centre with a "+"
            GControl control = new GControl(GControl.extraBuilt.MarkCenter);

            //Adds a textbox which gives the coordinates of the last click
            GMap1.addControl(new GControl(GControl.extraBuilt.TextualOnClickCoordinatesControl,
                                new GControlPosition(GControlPosition.position.Bottom_Right)));

            //Add all stops to GMAP
            var stops =
                from s in JUTCLinq.Stops
                select s;

            foreach (var s in stops)
            {
                lat = s.Lattitude;
                longi = s.Longitude;
                GMarker mkr = new GMarker(new GLatLng(lat, longi));
                //GMap1.addGMarker(mkr);
                mManager.Add(mkr, 10);
                GMap1.Add(new GListener(mkr.ID, GListener.Event.click,
                                         "function(){prompt('Stop #: " + s.StopNo
                                             + ",  Location: " + s.Location + ",  Coordinates:"
                                             + "','" + s.Lattitude + "," + s.Longitude
                                             + "');"
                                             + "var hsn = document.getElementById('hidStopNo');"
                                             + "hsn.value = '" + s.StopNo + "';"
                                             + "}"));
            }

            GMap1.markerManager = mManager;

            if (!IsPostBack)
            {
                GMap1.setCenter(hwttc, 18);
            }
        }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     GCustomCursor customCursor = new GCustomCursor(cursor.crosshair, cursor.text);
     GMap1.Add(customCursor);
 }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //reset listeners, necessary for marker listener to work between postback
            GMap1.resetListeners();

            //hide objects to be hidden
            lblDistancesError.Visible = false;
            lblStopsError.Visible = false;

            //Create default marker
            GIcon icon = new GIcon();
            icon.image = "http://labs.google.com/ridefinder/images/mm_20_red.png";
            icon.shadow = "http://labs.google.com/ridefinder/images/mm_20_shadow.png";
            icon.iconSize = new GSize(20, 28);
            icon.shadowSize = new GSize(30, 28);
            icon.iconAnchor = new GPoint(10, 18);
            icon.infoWindowAnchor = new GPoint(5, 1);

            GMap1.mapType = GMapType.GTypes.Hybrid;

            GMarkerOptions mOpts = new GMarkerOptions();
            mOpts.clickable = false;
            mOpts.icon = icon;

            GMarker marker = new GMarker(hwttc, mOpts);
            //End create default marker

            /*//Begin Listener for click map
            marker.javascript_GLatLng = "point";
            GListener listener = new GListener(marker.ID, GListener.Event.dragend, "alertame");
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.Append("function(overlay, point) {");
            sb.Append("if (overlay){");
            sb.Append("alert(overlay.id);");
            sb.Append("}");
            sb.Append("else{");
            sb.Append(marker.ToString(GMap1.GMap_Id));
            sb.Append(listener.ToString());
            sb.Append("lastclick.lat = marker.point.lat;");
            sb.Append("lastclick.lng = marker.point.lng;");
            sb.Append("txtLat.text = Convert.ToToString(lastclick.lat);");
            sb.Append("txtLong.text = Convert.ToString(lastclick.lng);");
            sb.Append("}");
            sb.Append("}");

            GListener listener2 = new GListener(GMap1.GMap_Id, GListener.Event.click, sb.ToString());
            GMap1.addListener(listener2);
            //End Listener*/

            //GMap1.GZoom = 3; //set zoom level
            GMap1.Key = ConfigurationSettings.AppSettings["GoogleMapKey"];
            GMap1.enableDragging = true;
            GMap1.enableGoogleBar = false;
            GMap1.Language = "en";
            GMap1.BackColor = Color.White;
            //GMap1.enableHookMouseWheelToZoom = true;
            GMap1.enableGKeyboardHandler = true;

            //Add built-in control for selecting map type
            GMap1.addControl(new GControl(GControl.preBuilt.MapTypeControl));

            //Add built-in control for zoom and pan
            //GMap1.addControl(new GControl(GControl.preBuilt.SmallZoomControl3D));
            GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl3D));

            //Custom cursor
            GCustomCursor customCursor = new GCustomCursor(cursor.crosshair, cursor.text);
            GMap1.addCustomCursor(customCursor);

            //Mark centre with a "+"
            GControl control = new GControl(GControl.extraBuilt.MarkCenter);

            //Adds a textbox which gives the coordinates of the last click
            GMap1.addControl(new GControl(GControl.extraBuilt.TextualOnClickCoordinatesControl,
                                new GControlPosition(GControlPosition.position.Bottom_Right)));

            if (!IsPostBack)
            {
                //Set centre position of map
                GMap1.setCenter(hwttc, 18);
                //Add InfoWindow greeting
                //GInfoWindow window = new GInfoWindow(hwttc, "<b>Welcome to the HWT Transport Centre</b>");
                //GMap1.addInfoWindow(window);

                //Set up google direction capabalities
                GDirection direction = new GDirection();
                direction.autoGenerate = false;
                direction.buttonElementId = "btnPlot";
                direction.fromElementId = txtStopA.ClientID;
                direction.toElementId = txtStopB.ClientID;
                direction.divElementId = "divDirections"; direction.clearMap = true;

                // Optional
                // direction.locale = "en-En;

                GMap1.Add(direction);
            }

            //Page.RegisterClientScriptBlock("GoogleDistance", "<script language=javascript src='googleDistance.js'>");
        }
Exemplo n.º 8
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)));
        }