ArcGIS Explorer Component Help |
Point..::.ToString Method |
Point Class Example See Also |
Returns a string representation of this Point.
Namespace:
ESRI.ArcGISExplorer.GeometryAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public override string ToString() |
Visual Basic (Declaration) |
---|
Public Overrides Function ToString As String |
Return Value
A string representing this Point.Remarks
This override of Object.ToString returns a string containing the coordinates of the Point. If this Point is a new object which has not yet had any coordinates set (IsEmpty is trueTruetruetrue (True in Visual Basic), then the returned string will specifically indicate that the shape is empty.
This method is useful while debugging for quickly checking on the status or location of a specific Point; all the information in the returned value can also be retrieved using other properties and methods on Point.
Examples
The code below demonstrates the creation of a Point object using a parameterized constructor to set the coordinates and CoordinateSystem
of the Point. The Point is then added as a Note to the current map in the application, and the overridden ToString method is used to
add information about the Point to the Popup of the new Note.
The Point variable is declared using the full namespace, to avoid clashes with the System.Drawing.Point class.
CopyC#
// Create a new Multipoint, using the British National Grid CoordinateSystem. ESRI.ArcGISExplorer.Geometry.Point benNevis = new ESRI.ArcGISExplorer.Geometry.Point(-5.004, 56.797, CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.Europe.BritishNationalGrid); // Create a Note using the Point geometry. Note benNevisNote = new Note("Ben Nevis", benNevis, Symbol.Marker.Recreation.Mountain); // Populate the Note popup with information about the Point geometry using the ToString method. StringBuilder info = new StringBuilder(@"<p><a href=""http://en.wikipedia.org/wiki/Ben_Nevis"">Ben Nevis</a></p>"); info.AppendLine(@"<p>" + benNevis.ToString() + @"</p>"); MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; benNevisNote.Popup.Content = info.ToString(); // Add the Note to the current Map. disp.Map.ChildItems.Add(benNevisNote);
CopyVB.NET
' Create a new Multipoint, using the British National Grid CoordinateSystem. Dim benNevis As ESRI.ArcGISExplorer.Geometry.Point = New ESRI.ArcGISExplorer.Geometry.Point(-5.004, 56.797, CoordinateSystem.ProjectedCoordinateSystems.NationalGrids.Europe.BritishNationalGrid) ' Create a Note using the Point geometry. Dim benNevisNote As Note = New Note("Ben Nevis", benNevis, Symbol.Marker.Recreation.Mountain) ' Populate the Note popup with information about the Point geometry using the ToString method. Dim info As StringBuilder = New StringBuilder("<p><a href=""http://en.wikipedia.org/wiki/Ben_Nevis"">Ben Nevis</a></p>") info.AppendLine("<p>" + benNevis.ToString() + "</p>") Dim disp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay benNevisNote.Popup.Content = info.ToString() ' Add the Note to the current Map. disp.Map.ChildItems.Add(benNevisNote)