Public Class Gallery Inherits ESRI.ArcGISExplorer.Application.Gallery 'Use the ArcGIS_E3SDK environment variable here. It points to the install 'location of the ArcGIS Explorer developer kit, i.e. C:\Program Files\Explorer\DeveloperKit. Dim _strImage As String = Environment.GetEnvironmentVariable("ArcGIS_E3SDK") + "\\...\\Styles\\SymbolImages\\Points of Interest\\Information.png" Public Sub New() Dim btnImage As Image = Image.FromFile(_strImage) Dim myGalleryItem As GalleryItem = New GalleryItem("MyGalleryItem", btnImage, "Click on the map to add graphic") Me.Items.Add(myGalleryItem) End Sub Public Overrides Sub OnClick(ByVal item As GalleryItem) Dim md As MapDisplay = Application.ActiveMapDisplay 'Track the point on the map of the mouse click Dim trackPoint As ESRI.ArcGISExplorer.Geometry.Point = md.TrackPoint() 'Turn the Point in to a Graphic Dim pointGraphic As Graphic = New Graphic(trackPoint) 'Set the Graphic's symbol to the same as the Gallery Image (Access the Symbol through Marker) pointGraphic.Symbol = Symbol.Marker.PointsOfInterest.Information 'Add the graphic to the map md.Graphics.Add(pointGraphic) End Sub End Class
Public Class Gallery Inherits ESRI.ArcGISExplorer.Application.Gallery 'Use the ArcGIS_E3SDK environment variable here. It points to the install 'location of the ArcGIS Explorer developer kit, i.e. C:\Program Files\Explorer\DeveloperKit. Dim _strImage As String = Environment.GetEnvironmentVariable("ArcGIS_E3SDK") + "\\..\\Styles\\SymbolImages\\Points of Interest\\Information.png" Public Sub New() Dim envVar As String = Environment.GetEnvironmentVariable("ArcGIS_E3SDK") System.Windows.Forms.MessageBox.Show(String.Format("Check Environment Variable points to DeveloperKit location on disk: {0}", envVar)) Dim btnImage As Image = Image.FromFile(_strImage) If (btnImage Is Nothing) Then System.Windows.Forms.MessageBox.Show("btnImage is Nothing") End If Dim myGalleryItem As GalleryItem = New GalleryItem("MyGalleryItem", btnImage, "Click on the map to add graphic") Me.Items.Add(myGalleryItem) If (Not Me.Items.Count = 1) Then System.Windows.Forms.MessageBox.Show("Did not find 1 GalleryItem") End If End Sub Public Overrides Sub OnClick(ByVal item As GalleryItem) Dim md As MapDisplay = Application.ActiveMapDisplay 'Track the point on the map of the mouse click Dim trackPoint As ESRI.ArcGISExplorer.Geometry.Point = md.TrackPoint() If (trackPoint Is Nothing) Then System.Windows.Forms.MessageBox.Show("Tracked Point is nothing") ElseIf (trackPoint.IsEmpty) Then System.Windows.Forms.MessageBox.Show("Tracked Point has no geometry") End If 'Turn the Point in to a Graphic Dim pointGraphic As Graphic = New Graphic(trackPoint) If (md Is Nothing) Then System.Windows.Forms.MessageBox.Show("New Graphic is nothing") End If 'Set the Graphic's symbol to the same as the Gallery Image (Access the Symbol through Marker) pointGraphic.Symbol = Symbol.Marker.PointsOfInterest.Information If (pointGraphic.Symbol Is Nothing) Then System.Windows.Forms.MessageBox.Show("Graphic Symbol is nothing") End If 'Add the graphic to the map md.Graphics.Add(pointGraphic) System.Windows.Forms.MessageBox.Show(String.Format("Number of graphics in map = {0}", md.Graphics.Count)) End Sub End Class
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.