簡體   English   中英

在按鈕單擊事件中獲取Subgurim地圖標記位置

[英]Getting Subgurim Map Marker Position in Button Click Event

我正在使用Subgurim Map根據輸入的地址設置標記。 使用GMarker,我可以將其加載到Map中。

現在這個地址可能是錯誤的或附近的實際地址。 這樣我就給客戶提供了使用不同標記設置實際地址的機會(當一個名為“ Pick Bubble”按鈕的按鈕被冒泡)

喜歡,

StringBuilder sb = new StringBuilder();
        sb.Append(txtAddress.Text.Trim());
        sb.AppendFormat(", {0}", txtCity.Text.Trim());
        sb.AppendFormat("- {0}", txtZipcode.Text.Trim());
        sb.Append(", Gujarat");
        sb.AppendFormat(", {0}", txtCountry.Text.Trim());

        GetAddressCordinates googleCordinate = new GetAddressCordinates(Constants.APP_SETTINGS.GoogleMapAPIKey);
        Coordinate cordinate = googleCordinate.GetCoordinates(sb.ToString());

        GLatLng gLatLng = new GLatLng();
        {
            gLatLng.lat = double.Parse(cordinate.Latitude.ToString());
            gLatLng.lng = double.Parse(cordinate.Longitude.ToString());
        }

        if (gLatLng != null)
        {
            GMarker gMarker;

            GIcon gIcon = new GIcon();
            gIcon.image = ResolveUrl(string.Format("~/Images/ActualFlag.png"));
            gIcon.shadow = ResolveUrl(string.Format("~/Images/Shadow.png"));
            gIcon.shadowSize = new GSize(30, 30);
            gIcon.iconSize = new GSize(24, 24);

            GMarkerOptions mOpts = new GMarkerOptions();
            mOpts.draggable = true;
            mOpts.RaiseOnDrag = true;
            mOpts.Animation = GMarkerOptions.AnimationType.Bounce;
            mOpts.icon = gIcon;

            gMarker = new GMarker(gLatLng, mOpts);

            GInfoWindow infoWindow = new GInfoWindow(gMarker, "", false);

            GMap1.addInfoWindow(infoWindow);
            //GMap1.addGMarker(gMarker);

            string jsFunction = string.Format("function(){{ var ev = new serverEvent('dragend', 0); ev.addArg({0}.getPoint().lat()); ev.addArg({0}.getPoint().lng()); ev.send(); }}", gMarker.ID);

            GListener listener = new GListener(gMarker.ID, GListener.Event.dragend, "alertame");
            GMap1.Add(listener);
            GMap1.setCenter(gLatLng);
        }

現在,我希望將這兩個標記位置放入名為“ NEXT”的按鈕中進行操作。

我將如何獲得Marker職位?

您是否嘗試將其放入GinfoWindow 如下所示:

 dir= "<input type='button' name='next'>"

變成:

 GInfoWindow infoWindow = new GInfoWindow(gMarker, dir, false);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM