0

Using below code to trying ring/circle on map Using ASPMAP LIb in vb.net

  Dim aTmp(), cName As String
  Dim oAspMapLayer As Layer
  Dim oDynLayer As DynamicLayer
  Dim i, iLayerIndex, iNewLayerIndex, iMaxLayerIndex As Integer
  Dim oCoordSys As New CoordSystem(AspMap.CoordSystemCode.GCS_WGS84)
  Dim oRecordset As AspMap.Recordset
  oDynLayer = New AspMap.DynamicLayer()

  oAspMapLayer = m_MapSrv(NP_REG_LAYER)
  oRecordset = oAspMapLayer.Recordset

  Dim oShape As New AspMap.Shape
  'oShape = JoinShapes(oAspMapLayer.Recordset, "shape")
  Dim x As Double = CLng(cData.Split(";")(0))
  Dim y As Double = CLng(cData.Split(";")(1))

  Dim radius As Double = distance
  oShape.MakeCircle(x, y, radius)
  oDynLayer.Add(oShape, cIsoType)


  iMaxLayerIndex = -1
  If (cLayerName = "") Then
      For i = 0 To m_MapSrv.LayerCount - 1
          cName = m_MapSrv.Layer(i).Name
          If (InStr(cName, NP_ISO_PFX) = 1) Then
              aTmp = cName.Split("_")
              Integer.TryParse(aTmp(2), iLayerIndex)
              If (iLayerIndex > iMaxLayerIndex) Then
                  iMaxLayerIndex = iLayerIndex
              End If
          End If
      Next
      cLayerName = NP_ISO_PFX & (iMaxLayerIndex + 1)
  End If
  iLayerIndex = m_MapSrv.GetLayerIndex(cLayerName)
  If (iLayerIndex >= 0) Then
      m_MapSrv.RemoveLayer(cLayerName)
  End If
  oAspMapLayer = m_MapSrv.AddLayer(oDynLayer)
  oAspMapLayer.Name = cLayerName
  oAspMapLayer.CoordinateSystem = New CoordSystem(AspMap.CoordSystemCode.GCS_WGS84)
  iNewLayerIndex = m_MapSrv.GetLayerIndex(cLayerName)
  If (iLayerIndex >= 0) Then
      m_MapSrv.MoveLayer(iNewLayerIndex, iLayerIndex)
  Else
      Dim oLayer As New MapLayer With {
          .Name = cLayerName,
          .Pen = cPen,
          .Brush = cBrush,
          .Symbol = cSymbol,
          .LayGroupType = LAYER_GROUP_TYPE.GR_GRE,
          .Visible = True,
          .InfoToolSelectable = False,
          .LabelToolSelectable = False,
          .UseCustomStyle = False}
      m_Layers.Add(oLayer)
  End If
3
  • 2
    What is your question? (please edit)
    – Berend
    Commented Jul 10 at 9:31
  • I am using ASPMAP lib to generate map using sharp file. I want to draw circle/ring on map giving radius and coordinates. Commented Jul 10 at 13:01
  • 1
    Please add that information to your question, rather than in a comment. And can you also explain what is not working now?
    – Berend
    Commented Jul 10 at 13:47

0

Browse other questions tagged or ask your own question.