Пример #1
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;
 }
Пример #2
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));
        }
Пример #3
0
        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);
        }
Пример #4
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);
            }
        }
Пример #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GMap1.Add(new GMapUI());
            GMap1.GZoom = 2;

            GMap2.Add(new GMapUI());
            GMap2.GZoom = 2;

            List <GMarker> markers = new List <GMarker>();

            Random r = new Random();

            for (int i = 0; i < 200; i++)
            {
                GMarker gMarker = new GMarker(new GLatLng(r.Next(0, 60), r.Next(-30, 30)));
                markers.Add(gMarker);
                GListener listener = new GListener(gMarker.ID, GListener.Event.click, string.Format(@"function () {{ var w = new google.maps.InfoWindow(); w.setContent('<center>{0}</center>'); w.open({1}, {2});}}", i, GMap1.GMap_Id, gMarker.ID));
                GMap1.Add(listener);
            }

            GMap2.markerClusterer = new MarkerClusterer(markers);


            MarkerClustererStyleOptions markerClustererStyleOptions = new MarkerClustererStyleOptions();

            markerClustererStyleOptions.textColor = Color.Yellow;

            MarkerClustererOptions markerClustererOptions = new MarkerClustererOptions(60, 10);


            MarkerClustererStyleOptions styleOptionsA = new MarkerClustererStyleOptions();

            styleOptionsA.height    = 36;
            styleOptionsA.width     = 40;
            styleOptionsA.anchor_x  = 6;
            styleOptionsA.anchor_y  = 0;
            styleOptionsA.textColor = Color.Blue;
            styleOptionsA.url       = "http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/conv40.png";

            MarkerClustererStyleOptions styleOptionsB = new MarkerClustererStyleOptions();

            styleOptionsB.height    = 35;
            styleOptionsB.width     = 35;
            styleOptionsB.anchor_x  = 16;
            styleOptionsB.anchor_y  = 0;
            styleOptionsB.textColor = Color.WhiteSmoke;
            styleOptionsB.url       = "http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/people35.png";



            markerClustererOptions.markerClustererStylesOptions.Add(styleOptionsA);
            markerClustererOptions.markerClustererStylesOptions.Add(styleOptionsB);


            MarkerClusterer markerClusterer = new MarkerClusterer(markers, markerClustererOptions);

            GMap1.markerClusterer = markerClusterer;
        }
Пример #6
0
        public bool addListener(GListener listener)
        {
            ListenerWrapper wrapper = new ListenerWrapper(listener);
            bool            result  = _raw.addListener(wrapper);

            if (result)
            {
                _wrappers[listener] = wrapper;
            }
            return(result);
        }
Пример #7
0
        public bool removeListener(GListener listener)
        {
            bool result = false;

            if (_wrappers.ContainsKey(listener))
            {
                ListenerWrapper wrapper = _wrappers[listener];
                result = _raw.removeListener(wrapper);
                _wrappers.Remove(listener);
            }
            return(result);
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GMap1.Add(new GMapUI());
            GMap1.GZoom = 2;

            GMap2.Add(new GMapUI());
            GMap2.GZoom = 2;

            List<GMarker> markers = new List<GMarker>();

            Random r = new Random();
            for (int i = 0; i < 200; i++)
            {
                GMarker gMarker = new GMarker(new GLatLng(r.Next(0, 60), r.Next(-30, 30)));
                markers.Add(gMarker);
                GListener listener = new GListener(gMarker.ID, GListener.Event.click, string.Format(@"function () {{ var w = new google.maps.InfoWindow(); w.setContent('<center>{0}</center>'); w.open({1}, {2});}}", i, GMap1.GMap_Id, gMarker.ID));
                GMap1.Add(listener);
            }

            GMap2.markerClusterer = new MarkerClustererPlus(markers);

            MarkerClustererPlusStyleOptions markerClustererStyleOptions = new MarkerClustererPlusStyleOptions();
            markerClustererStyleOptions.textColor = Color.Yellow;

            MarkerClustererPlusOptions markerClustererOptions = new MarkerClustererPlusOptions(60, 10);

            MarkerClustererPlusStyleOptions styleOptionsA = new MarkerClustererPlusStyleOptions();
            styleOptionsA.height = 36;
            styleOptionsA.width = 40;
            styleOptionsA.anchor_x = 6;
            styleOptionsA.anchor_y = 0;
            styleOptionsA.textColor = Color.Blue;
            styleOptionsA.FontFamily = "Verdana";
            styleOptionsA.url = "http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/conv40.png";

            MarkerClustererPlusStyleOptions styleOptionsB = new MarkerClustererPlusStyleOptions();
            styleOptionsB.height = 35;
            styleOptionsB.width = 35;
            styleOptionsB.anchor_x = 16;
            styleOptionsB.anchor_y = 0;
            styleOptionsB.textColor = Color.WhiteSmoke;
            styleOptionsB.TextDecoration = "underline";
            styleOptionsB.url = "http://gmaps-utility-library.googlecode.com/svn/trunk/markerclusterer/1.0/images/people35.png";

            markerClustererOptions.markerClustererStylesOptions.Add(styleOptionsA);
            markerClustererOptions.markerClustererStylesOptions.Add(styleOptionsB);

            markerClustererOptions.Title = "Using Clusterer Plus";

            MarkerClustererPlus markerClusterer = new MarkerClustererPlus(markers, markerClustererOptions);

            GMap1.markerClusterer = markerClusterer;
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlng = new GLatLng(41, -3.2);

            GMap1.setCenter(latlng, 5, GMapType.GTypes.Satellite);

            GMarkerOptions mOpts = new GMarkerOptions();

            mOpts.draggable = true;
            GMarker marker = new GMarker(latlng, mOpts);

            GMap1.Add(marker);
            GListener listener = new GListener(marker.ID, GListener.Event.dragend, "alertame");

            GMap1.Add(listener);

            GMarker mkr = new GMarker();

            mkr.options            = mOpts;
            mkr.javascript_GLatLng = "mouseEvent.latLng";
            listener = new GListener(mkr.ID, GListener.Event.dragend, "alertame");
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.Append("function(mouseEvent) {");
            sb.Append(mkr.ToString(GMap1.GMap_Id));
            sb.Append(listener.ToString());
            sb.Append("}");

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

            GMap1.Add(listener2);

            GMap1.Add(new GListener(GMap1.GMap_Id, GListener.Event.moveend, "function() {alert('I Love Elvis :9P');}"));

            GPolygon polygon = new GPolygon();

            polygon.Add(latlng + new GLatLng(1, 1));
            polygon.Add(latlng + new GLatLng(2, 3));
            polygon.Add(latlng + new GLatLng(4, 4));
            polygon.close();
            GMap1.Add(polygon);

            GListener listener3 = new GListener(polygon.PolygonID, GListener.Event.click, "function(mouseEvent) {alert('Polygon clicked');}");

            GMap1.Add(listener3);
        }
Пример #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            GLatLng latlng = new GLatLng(41, -3.2);
            GMap1.setCenter(latlng, 5, GMapType.GTypes.Satellite);

            GMarkerOptions mOpts = new GMarkerOptions();
            mOpts.draggable = true;
            GMarker marker = new GMarker(latlng, mOpts);
            GMap1.Add(marker);
            GListener listener = new GListener(marker.ID, GListener.Event.dragend, "alertame");
            GMap1.Add(listener);

            GMarker mkr = new GMarker();
            mkr.options = mOpts;
            mkr.javascript_GLatLng = "mouseEvent.latLng";
            listener = new GListener(mkr.ID, GListener.Event.dragend, "alertame");
            System.Text.StringBuilder sb = new System.Text.StringBuilder();

            sb.Append("function(mouseEvent) {");
            sb.Append(mkr.ToString(GMap1.GMap_Id));
            sb.Append(listener.ToString());
            sb.Append("}");

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

            GMap1.Add(new GListener(GMap1.GMap_Id, GListener.Event.moveend, "function() {alert('I Love Elvis :9P');}"));

            GPolygon polygon = new GPolygon();
            polygon.Add(latlng + new GLatLng(1, 1));
            polygon.Add(latlng + new GLatLng(2, 3));
            polygon.Add(latlng + new GLatLng(4, 4));
            polygon.close();
            GMap1.Add(polygon);

            GListener listener3 = new GListener(polygon.PolygonID, GListener.Event.click, "function(mouseEvent) {alert('Polygon clicked');}");
            GMap1.Add(listener3);
        }
Пример #11
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));
        }
Пример #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            gMap.setCenter(_latlng, 7, GMapType.GTypes.Hybrid);
            gMap.enableHookMouseWheelToZoom = true;

            //show the postion on the map
            gMap.addControl(new GControl(GControl.extraBuilt.TextualCoordinatesControl));

            //show the cursor on the map
            gMap.addControl(new GControl(GControl.extraBuilt.MarkCenter));

            gMap.setCenter(_latlng, 5, GMapType.GTypes.Satellite);

            var mOpts = new GMarkerOptions {draggable = true};

            var mkr = new GMarker {options = mOpts, javascript_GLatLng = "point"};

            var sb = "function(overlay, point) {if (overlay){alert(overlay.id);} else{#ID#}}";
            sb = sb.Replace("#ID#", mkr.ToString(gMap.GMap_Id));

            var listener2 = new GListener(gMap.GMap_Id, GListener.Event.click, sb);
            gMap.addListener(listener2);
        }
Пример #13
0
 public void removeListener(GListener listener)
 {
     _raw.removeListener((com.glympse.android.toolbox.listener.GListener)listener.raw());
 }
Пример #14
0
 public bool addListener(GListener listener)
 {
     return(_raw.addListener((com.glympse.android.toolbox.listener.GListener)listener.raw()));
 }
Пример #15
0
 public bool removeListener(GListener listener)
 {
     return(_source.removeListener(listener));
 }
Пример #16
0
        /**
         * GSource section
         */

        public bool addListener(GListener listener)
        {
            return(_source.addListener(listener));
        }
Пример #17
0
 public ListenerWrapper(GListener listener)
 {
     _listener = listener;
 }