ArcObjects Library Reference  

CustomLayerInfo_VBNet

About the Find near features REST SOE Sample

[C#]

CustomLayerInfo_VBNet.cs


[Visual Basic .NET]

CustomLayerInfo_VBNet.vb

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports ESRI.ArcGIS.esriSystem
Imports ESRI.ArcGIS.Geometry
Imports ESRI.ArcGIS.Carto
Imports ESRI.ArcGIS.SOESupport

Namespace FindNearFeaturesRestSOE_VBNet
    Public Class CustomLayerInfo_VBNet
        Private privateName As String
        Public Property Name() As String
            Get
                Return privateName
            End Get
            Set(ByVal value As String)
                privateName = value
            End Set
        End Property
        Private privateID As Integer
        Public Property ID() As Integer
            Get
                Return privateID
            End Get
            Set(ByVal value As Integer)
                privateID = value
            End Set
        End Property
        Private privateExtent As IEnvelope
        Public Property Extent() As IEnvelope
            Get
                Return privateExtent
            End Get
            Set(ByVal value As IEnvelope)
                privateExtent = value
            End Set
        End Property

        Public Sub New(ByVal mapLayerInfo As IMapLayerInfo)
            Me.Name = mapLayerInfo.Name
            Me.ID = mapLayerInfo.ID
            Me.Extent = mapLayerInfo.Extent
        End Sub

        Public Function ToJsonObject() As JsonObject
            Dim jsonBytes() As Byte = ESRI.ArcGIS.SOESupport.Conversion.ToJson(CType(Me.Extent, IGeometry))
            Dim env As New JsonObject(Encoding.UTF8.GetString(jsonBytes))

            Dim jo As New JsonObject()
            jo.AddString("name", Name)
            jo.AddLong("id", ID)
            jo.AddJsonObject("extent", env)

            Return jo
        End Function
    End Class
End Namespace