Something changed in WPF version?

May 4, 2010 at 8:45 AM

Radioman,

About a week or so ago i downloaded new version. But now polygons are not on right position anymore.

They are always at lower right corner of map, most of the time out of visible part. Has somethings be changed?

 

Heru

May 4, 2010 at 8:50 AM

there is no polygons in wpf version ;/

May 4, 2010 at 8:52 AM

Radioman,

I know that there is no polygon in WPF, but i created simular myself. With some code outside your DLL.

 

Heru

May 4, 2010 at 9:10 AM

can you share some demo code by creating fork?

May 4, 2010 at 10:13 AM
Private Sub DrawPolygon(ByVal strPolygonFileName As String)

        Dim myPoint As GMap.NET.PointLatLng
        Dim iTeller As Integer = 0
        Dim myPointCollection As New Windows.Media.PointCollection
        Dim iLoop As Integer = 0
        Dim myPolygon As New Polygon
        Dim myPoints(250) As System.Windows.Point
        Dim myPointList() As System.Windows.Point

        Try
            Using objStreamReader As New StreamReader(strPolygonFileName, System.Text.Encoding.UTF8)
                While Not objStreamReader.EndOfStream
                    Dim strCoordinaten As String = objStreamReader.ReadLine()
                    Dim intPositieLNG As Integer = strCoordinaten.IndexOf("Lng", 6)
                    Dim strLat As String = strCoordinaten.Substring(5, intPositieLNG - 2 - 5)
                    Dim strLong As String = strCoordinaten.Substring(intPositieLNG + 4, strCoordinaten.Length - (intPositieLNG + 5))
                    Dim dblLat As Double = CDbl(strLat)
                    Dim dblLong As Double = CDbl(strLong)
                    myPoint = New GMap.NET.PointLatLng(dblLat, dblLong)
                    Dim p As GMap.NET.Point = GMapControl1.FromLatLngToLocal(myPoint)
                    myPoints(iTeller) = New System.Windows.Point(p.X, p.Y)
                    myPointCollection.Add(myPoints(iTeller))
                    iTeller += 1
                End While
            End Using

            myPoints(iTeller) = myPoints(0)
            ReDim myPointList(iTeller)
            For iLoop = 0 To iTeller
                myPointList(iLoop) = myPoints(iLoop)
            Next

            Dim myMarker = New GMap.NET.WindowsPresentation.GMapMarker(myPoint)
            intLaag += 1
            myPolygon.Stroke = System.Windows.Media.Brushes.Black
            myPolygon.StrokeThickness = 2
            myPolygon.Points = myPointCollection
            myPolygon.IsHitTestVisible = True
            myPolygon.ToolTip = strPolygonFileName
            myPolygon.SnapsToDevicePixels = True
            myPolygon.FillRule = FillRule.Nonzero

            myPolygon.Tag = "Polygon"
            Dim strFileName As String = strPolygontFileName

            If CInt(strFileName.Substring(strFileName.Length - 1, 1)) = 1 Then
                myPolygon.Fill = System.Windows.Media.Brushes.LightGreen
            End If

            myPolygon.Opacity = sldTransparency.Value / 100
            myMarker.Tag = strFootPrintFileName
            myMarker.Shape = myPolygon
            myMarker.ZIndex = intLaag
            GMapControl1.ZoomAndCenterMarkers(intLaag)
            myMarker.ForceUpdateLocalPosition(GMapControl1)
            GMapControl1.Markers.Add(myMarker)

        Catch
            System.Windows.MessageBox.Show(Err.Description)
        End Try

    End Sub
This code i use to draw a polygon. It is a polygon without the triangles and can not be resized by customer, but this is what i need. I use it for showing arbitral areas.
My file with coordinates looks like:
{Lat=50,2893392532918, Lng=-22,8515625}
{Lat=51,8357775204525, Lng=-22,1484375}
{Lat=52,9089020477703, Lng=-22,1484375}
{Lat=53,5403073915002, Lng=-21,796875}
{Lat=55,178867663282, Lng=-21,09375}
The coordinate file is made by an other piece of software. That is why above code has some lines for retreiving the real coordinates without {Lat=  etc.
This code work for some months, but since last update is fails.
Heru
May 4, 2010 at 10:58 AM
Edited May 4, 2010 at 11:00 AM

call myMarker.RegenerateRouteShape(GMapControl1); before adding to markers // but i guess thats works only for route

p.s. you do not need call ForceUpdateLocalPosition anymore

May 4, 2010 at 11:29 AM

Radioman,

I added myMarker.RegenerateRouteshap(GMapControl1), but this did not solve problem.

I deleted ForceUpdateLocalPosition....

 

Maybe i will try to go back to previous version to see if that will solve problem.

 

Heru

 

 

May 4, 2010 at 1:40 PM

well in wpf, marker system has not changed, so it should work, i'm interested why it stopped working, let me know

May 26, 2010 at 2:28 PM

Radioman,

Can not figure out why it stopped working. Can you send me old WPF version? Lets say 2 months old?

Want to replace current version and check if it is working again.

 

Thanks

heru

 

May 26, 2010 at 2:38 PM

there is history of more than year ;} but you don't get anything better/faster than the last version, debug find whats cause your problems instead

May 26, 2010 at 3:07 PM

Radioman,

 

My hope was to try old version to check if something is changed in your underlaying code.

If i debug and step into each line in code they all have the expected values.

 

So i can not figure out what is going wrong. 

 

Heru

May 26, 2010 at 3:12 PM

so what's wrong? ;}

May 31, 2010 at 12:39 PM

Radioman,

 

Can i include in some way a screendump to clearify what is happening?

 

Thanx,

Heru

May 31, 2010 at 12:48 PM

please include whatever you have

May 31, 2010 at 1:26 PM

Radioman,

The question is (for me) HOW to include jpeg in reply?

Heru

 

May 31, 2010 at 1:58 PM

click html, then write: <img src="picture.jpg" />

May 31, 2010 at 2:15 PM
<img src="c:\sample.jpeg" />
May 31, 2010 at 2:17 PM

Does this work?

May 31, 2010 at 2:20 PM

sorry i have no access to your C disk ;D

May 31, 2010 at 2:54 PM

Radioman,

 

OH, really ;-).

My mistake, i thought that the image would be included in the message...

So i have to upload it to some kind of website?

 

 

May 31, 2010 at 3:41 PM
Edited May 31, 2010 at 3:43 PM

 

May 31, 2010 at 3:45 PM
Edited Jun 1, 2010 at 8:01 AM

http://www.gmap.ruijbroek.nl/Sample.JPG

 

This is image of what is happening now.

Normaly there is one polygon with one or more polygons in it.

This polygon should be projected somewhere between afrika and australia...

 

Heru

May 31, 2010 at 4:19 PM

can you update to the latest version and zipp all your project or test with 'wrong' stuff ? ;}

Jun 1, 2010 at 10:33 AM

Radioman,

I have downloaded latest version. Now i have 2 questions..

1) What is best way to change to newest version without getting all the errors

2) I can not drag "GMapControl" to Grid, just GMapControlNew is possible. Need to use GMapControlNew?

 

Heru

 

 

 

Jun 1, 2010 at 10:39 AM

no, it's just for testing, use usual, everything is the same

Jun 1, 2010 at 10:54 AM

Radioman,

Probably i am doing something wrong. I can not drag GMapControl, just GMapControlNew can be dragged to canvas.

Even when i delete GMAPControlNew from Toolbox, i can not drag/drop GMapControl...

 

Heru

Jun 1, 2010 at 10:56 AM

just add it in xaml

Jun 1, 2010 at 12:41 PM

Radioman,

With new version got error:

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

Additional information:  Kan bestand of assembly WPFToolkit, Version=3.5.40128.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35 of een van de afhankelijkheden hiervan niet laden. Het systeem kan het opgegeven bestand niet vinden.  Error in markup file 'Rainbow;component/mainwindow.xaml' Line 1 Position 9.

 

Does new version rely on other WPFToolkit version?

 

Heru

Jun 1, 2010 at 12:44 PM

control does not relay of any toolkit

Jun 1, 2010 at 6:45 PM

Radioman,

I have several times now switched to new version but every time got problems while starting application.

Can not get error fixed.....

 

Heru

 

 

Jun 1, 2010 at 6:53 PM

..seems that it's not maps control problem ;}

Jun 1, 2010 at 6:58 PM

.... Could be, but the strange thing is as soon as i switch back to 1.0.0.0 / 1.5.0.0 / 1.0.65.0 version error doesn't appear any more.

 

Jun 1, 2010 at 7:04 PM

you miss something ;}

Jun 2, 2010 at 10:55 AM

Radioman,

 

What am i missing (except my last trip to Indonesia)??

Heru

Jun 2, 2010 at 3:42 PM

i have no idea, check wpf demos xaml ;}

Jun 10, 2010 at 4:25 PM

Radioman,

Still can't find answer... So before i go back to older version of control i want to discus something:

When i put all coördinates in messagebox and show them just before put them in polygon, they all have values which falls inside of visible part of GmapControl.

Maybe something changed with forceupfate... or something in WPF??

 

Heru

 

 

Jun 10, 2010 at 9:04 PM

nop

Jun 14, 2010 at 9:19 AM

Radioman,

 

Solved? the problem...

When i use newest version it doesn't work. With or without : myMarker.ForceUpdateLocalPosition(GMapControl1)

With older version (1.4.9.2/1.0.0.0/1.0.65.0) it is working (without:  myMarker.ForceUpdateLocalPosition(GMapControl1)

When i put in myMarker.ForceUpdateLocalPosition(GMapControl1) again, problem pops up again...

 

Heru


 

Jun 14, 2010 at 9:34 AM

you are doing something specific, can't help much if you don't share what ;}