-
September 11th, 2012, 12:47 PM
#1
Classes and Interfaces.... Code included, what is wrong...?
Goal
A) read the points (X1, Y1, X2, Y2 and so on) of a shapeline and store them
B) divide the line(s) in parts of 10meter and being able to assign values to each part
I have trouble to convert the old vb6 approach with TYPES and arrays and DIMs to visual studio. So far I did this.... for GOAL A.
I have made a class, which you will find below, where I declared all variables used by using an interface..... the array containing the coordinates must be public... so it coordinates could be used in drawingroutines...
Then I made a second class which handles reading the shapefile. And suddenly it gets confusing... I will implement only the relevant parts of the code below....
Code:
Imports DMCviewer.BaanShapePuntDecl
Public class ReadBaanShapePoint
Private Sub LeesBAANASLijnen(ByVal FileNumber As Integer, ByRef Offset As Long, ByVal FileType As Integer)
Dim X1 As Double, Y1 As Double, X2 As Double, Y2 As Double
Dim iBaanShapePunt() As BaanShapePuntDecl
Dim Vertex as long
for count = 200 to 275
Vertex += 1
<< HERE X1, Y1, X2, Y2 get a value>>
iBaanShapePunt(vertex).X1lineShape = CSng(X1)
iBaanShapePunt(vertex).X2lineShape = CSng(X2)
iBaanShapePunt(vertex).Y1lineShape = CSng(Y1)
iBaanShapePunt(vertex).Y2lineShape = CSng(Y2)
next
End sub
End class
The question is, will this work, or are there any big mistakes as I assume/feel there are.....
Below the declaration interface of the lineshape points
Code:
Public Class BaanShapePuntDecl
REM ************************************************
REM * Variable for the shape axis
REM ************************************************
Implements iBaanShapePunt
Public Interface iBaanShapePunt
Property X1lineShape As Single
Property Y1lineShape As Single
Property X2lineShape As Single
Property Y2lineShape As Single
End Interface
Public arraylist As iBaanShapePunt
Sub New(ByVal a, ByVal b, ByVal c, ByVal d)
a = X1lineShape
b = Y1lineShape
c = X2lineShape
d = Y2lineShape
End Sub
Public Property X1lineShape As Single Implements iBaanShapePunt.X1lineShape
Get
Return X1lineShape
End Get
Set(ByVal value As Single)
End Set
End Property
Public Property X2lineShape As Single Implements iBaanShapePunt.X2lineShape
Get
Return X2lineShape
End Get
Set(ByVal value As Single)
End Set
End Property
Public Property Y1lineShape As Single Implements iBaanShapePunt.Y1lineShape
Get
Return Y1lineShape
End Get
Set(ByVal value As Single)
End Set
End Property
Public Property Y2lineShape As Single Implements iBaanShapePunt.Y2lineShape
Get
Return Y2lineShape
End Get
Set(ByVal value As Single)
End Set
End Property
End Class
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|