0

如何使用goolemap api 3在.net中的googlemap中的相同点上显示多个图标

下面是我的代码

public void selectTrainings(string strQuery)
    {
        try
        {
            clsTblMembers objtblMember = new clsTblMembers();
            objtblMember.StrEmail = strQuery.ToString();
            DataTable dt = objtblMember.SelectSearch();
            if (dt != null)
            {
                int i;
                for (i = 0; i < dt.Rows.Count; i++)
                {
                    if (dt.Rows[i]["Latitude"].ToString() != "" && dt.Rows[i]["Longitude"].ToString() != "")
                    {

                        string StrLat = dt.Rows[i]["Latitude"].ToString();
                        string StrLon = dt.Rows[i]["Longitude"].ToString();
                        double Numlat;
                        bool isNumlat = double.TryParse(StrLat, out Numlat);
                        double Numlon;
                        bool isNumlon = double.TryParse(StrLon, out Numlon);
                        if ((isNumlat) && (isNumlon))
                        {
                            //coordinates datatype =double;
                            m1 = new MapControl.MapMarker();
                            m1.Latitude = Convert.ToDouble(dt.Rows[i]["Latitude"].ToString());
                            m1.Longitude = Convert.ToDouble(dt.Rows[i]["Longitude"].ToString());
                            getTraining(Convert.ToInt32(dt.Rows[i]["intId"].ToString()), Convert.ToInt32(dt.Rows[i]["intTypeId"].ToString()), dt.Rows[i]["strCode"].ToString(), dt.Rows[i]["strConductedBy"].ToString(), dt.Rows[i]["dtFromDate"].ToString(), dt.Rows[i]["dtToDate"].ToString(), dt.Rows[i]["strName"].ToString(), dt.Rows[i]["strUC"].ToString(), dt.Rows[i]["strVillage"].ToString());
                            if (dt.Rows[i]["intTypeId"].ToString() == "1")
                            {
                                m1.Title ="CMST - "+ dt.Rows[i]["strCode"].ToString();
                                m1.Image = "mapIcons/t1.png";
                            }
                            else if (dt.Rows[i]["intTypeId"].ToString() == "2")
                            {
                                m1.Title = "LMST - " + dt.Rows[i]["strCode"].ToString();
                                m1.Image = "mapIcons/t2.png";
                            }
                            else if (dt.Rows[i]["intTypeId"].ToString() == "3")
                            {
                                m1.Title = " Govt.Official Training - " + dt.Rows[i]["strCode"].ToString();
                                m1.Image = "mapIcons/t3.png";
                            }
                            else if (dt.Rows[i]["intTypeId"].ToString() == "4")
                            {
                                m1.Title = "Gender Based Violence - " + dt.Rows[i]["strCode"].ToString(); 
                                m1.Image = "mapIcons/pg.png";
                            }
                            else if (dt.Rows[i]["intTypeId"].ToString() == "5")
                            {
                                m1.Title = "Human Rights - " + dt.Rows[i]["strCode"].ToString();         
                                m1.Image = "mapIcons/ph.png";
                            }
                            else
                            {
                                m1.Title = "Livelihoods Skills Training - " + dt.Rows[i]["strCode"].ToString();                                    
                                m1.Image = "mapIcons/t4.png";
                            }

                            m1.ImageSize1 = 32.0;
                            m1.ImageSize2 = 37.0;
                            m1.ImagePoint1 = 0;
                            m1.ImagePoint2 = 0;
                            m1.ImagePoint3 = 16.0;
                            m1.ImagePoint4 = 18.0;

                            m1.Shadow = "mapIcons/shadow.png";
                            m1.ShadowSize1 = 51.0;
                            m1.ShadowSize2 = 37.0;
                            m1.ShadowPoint1 = 0;
                            m1.ShadowPoint2 = 0;
                            m1.ShadowPoint3 = 16.0;
                            m1.ShadowPoint4 = 18.0;

                            GoogleMap.Markers.Add(m1);

                        }
                    }

                }
            }

        }
        catch (Exception ex)
        {

        }
    }
4

0 回答 0