コード例 #1
0
 void lyr_Initialized(object sender, EventArgs e)
 {
     ESRI.ArcGIS.Samples.Kml.KmlLayer lyr = sender as ESRI.ArcGIS.Samples.Kml.KmlLayer;
     //DebugConsole.debug(lyr.Graphics.Count.ToString());
     try
     {
         _map.Layers.Add(lyr);
     }
     catch (Exception ex)
     {
         DebugConsole.debug("MapHelper: " + ex.ToString());
     }
     //throw new NotImplementedException();
 }
コード例 #2
0
        public void addKmlLayer(string kmlUri, string layerID, double opacity)
        {
            try
            {
                if (layerID == "")
                {
                    layerID = Guid.NewGuid().ToString();
                }
                ESRI.ArcGIS.Samples.Kml.KmlLayer lyr = new ESRI.ArcGIS.Samples.Kml.KmlLayer();
                lyr.Initialized += new EventHandler <EventArgs>(lyr_Initialized);
                lyr.ProxyUrl     = "../ProxyHandler.ashx";
                lyr.Source       = new Uri(kmlUri);
                lyr.Opacity      = opacity;
                lyr.ID           = layerID;
                lyr.Visible      = true;

                lyr.Initialize();
                //_map.Layers.Add(lyr);
            }
            catch (Exception ex)
            {
                MessageBox.Show("HapHelper: " + ex.ToString(), "Error", MessageBoxButton.OK);
            }
        }