Forgot password?
Forum ZWCAD CAD Content
Post time 2017-10-10 21:36:55

I was testing how I can use dotspatial to import ERSI shapefile
I can import streetname to Mtext

this is another sample where I was try to import Polyline but dont know how to finish it
if Someone has good knowledge in .net how to use dotspatial to import Polyline

  <CommandMethod("IMPORTSAMPLE")> _
    Public Sub importsample()


    End Sub

    Public Sub importSHP(ByVal path_file) ' This method can have any name

        Dim zwDoc As Document = Application.DocumentManager.MdiActiveDocument
        Dim ZWEd As Editor = Application.DocumentManager.MdiActiveDocument.Editor

        Dim shapeActual As FeatureSet = FeatureSet.Open(path_file)

        Dim dt As System.Data.DataTable = shapeActual.DataTable
        For row As Integer = 0 To dt.Rows.Count - 1

            Dim x = (CStr(shapeActual.Features.Item(row).Centroid.Envelope.X))
            Dim y = (CStr(shapeActual.Features.Item(row).Centroid.Envelope.Y))
            Dim Comment As Object = dt.Rows(row)("TEXTSTRING")
            Dim angle As Object = dt.Rows(row)("ANGLE")

            Dim turn As String
            turn = Replace(angle, ",", ".")

            If Not IsDBNull(Comment) Then
                Dim db As Database = Application.DocumentManager.MdiActiveDocument.Database
                Using acTrans As Transaction = db.TransactionManager.StartTransaction()

                    Dim acBlkTbl As BlockTable = acTrans.GetObject(db.BlockTableId, OpenMode.ForRead)

                    Dim acBlkTblRec As BlockTableRecord
                    acBlkTblRec = acTrans.GetObject(acBlkTbl(BlockTableRecord.ModelSpace), OpenMode.ForWrite)

                    Dim acMText As MText = New MText()
                    acMText.Location = New Point3d(x, y, 0)

                    acMText.Attachment = AttachmentPoint.MiddleCenter

                    acMText.TextHeight = 2
                    acMText.Contents = Comment
                    acMText.Layer = 0

                    acMText.Normal = Vector3d.ZAxis

                    acMText.Rotation = turn * Math.PI / 180.0
                    acTrans.AddNewlyCreatedDBObject(acMText, True)


                End Using
            End If

        zwDoc.SendStringToExecute("_zoom e ", True, False, False)

    End Sub
You have to log in before you can reply Login | Register