Commit 3a8b6873 authored by Benoît Minisini's avatar Benoît Minisini

Merge branch 'master' of gitlab.com:gambas/gambas

parents f812d812 13120e91
......@@ -3,15 +3,22 @@
Private hMap As New Map
Private hImage As Image
Public Sub Form_Open()
Dim hbound As MapBounds
'hMap.AddTile("gg", "https://khms{s}.google.fr/kh/v={version}&src=app&x={x}&y={y}&z={z}&s=Galile", ["version": "145"]).SubDomains = ["0", "1", "2"]
'hImg = Scanners["hpaio:/net/HP_LaserJet_MFP_M426fdn?ip=192.168.1.25"].Scan()
'MapView1.Map.AddTile("gmap", "https://khms0.google.com/kh/v={version}?x={x}&y={y}&z={z}", ["version": "821"]).Copyright = "google"
MapView1.Map.AddTile("OpenStreetMap", "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", Null).Copyright = "© OpenStreetMap contributors"
MapView1.Map.Center = MapPoint(48.866667, 2.333333)
MapView1.Map.Zoom = 5
MapView1.Map.Zoom = 10
MapView1.Map.AddShape("Shape").AddCircle("cir", MapPoint(48.866667, 2.333333), 2000)
MapView1.Map["Shape"].AddPoint("p", MapPoint(48.866667, 2.333333))
MapView1.Map["Shape"].AddPoint("p2", MapPoint(48.866222, 2.360583))
'himage = hMap.Grab(hMap.Bounds, 200, 200, 17)
Print MapPoint(48.866667, 2.333333).Distance(MapPoint(48.866667, 2.333333), MapPoint(48.866222, 2.360583))
hbound = MapView1.Map["Shape"]["cir"].Bounds
Print MapPoint.Distance(hbound.TopLeft, MapPoint(hbound.Top, hbound.Right))
End
......
......@@ -27,7 +27,7 @@ End
''
'' © 2002-2008 Chris Veness [http://www.movable-type.co.uk/scripts/latlong-vincenty.html]
''
Public Sub Distance(PointA As MapPoint, PointB As MapPoint) As Float
Static Public Sub Distance(PointA As MapPoint, PointB As MapPoint) As Float
Dim eLon1 As Float = PointA.Lon
Dim eLat1 As Float = PointA.Lat
......
......@@ -139,14 +139,21 @@ End
Public Sub AddCircle(Key As String, Center As MapPoint, Radius As Float, Optional {Color} As Integer, Optional LineWidth As Integer) As _ShapeItem
Dim hItem As _ShapeItem
Dim P1, P2, P3, P4 As MapPoint
If $aShapeNames.Exist(Key) Then Error.Raise("This key already exist")
hItem = New _ShapeItem(Key) As "Item"
If Not IsMissing({Color}) Then hItem.Color = Color
If Not IsMissing(LineWidth) Then hItem.LineWidth = LineWidth
hItem.Type = Circle
hItem.Center = Center
hItem.Bounds.TopLeft = MapPoint.From(Center, -45, Radius)
hItem.Bounds.BottomRight = MapPoint.From(Center, 135, Radius)
P1 = MapPoint.From(Center, 0, Radius)
P2 = MapPoint.From(Center, 90, Radius)
P3 = MapPoint.From(Center, 180, Radius)
P4 = MapPoint.From(Center, 270, Radius)
hItem.Bounds.TopLeft = MapPoint(P1.Lat, P4.Lon)
hItem.Bounds.BottomRight = MapPoint(P3.Lat, P2.Lon)
$aShapes.Add(hItem)
$aShapeNames.Add(Key)
......
......@@ -109,29 +109,28 @@ void XMLDocument_Open(Document *doc, const char *fileName, const size_t lenFileN
void XMLDocument_SetContent(Document *doc, const char *content, const size_t len)
{
char *posStart = 0, *posEnd = 0;
const char *posStart = 0, *posEnd = 0;
if(doc->docType == XMLDocumentType)
{
//On cherche le début du prologue XML
posStart = (char*)memchrs(content, len, "<?xml ", 6);
posStart = (const char*)memchrs(content, len, "<?xml ", 6);
if(posStart)//On cherche la fin du prologue XML
{
posEnd = (char*)memchrs(posStart, len - (posStart - content), "?>", 2);
posEnd = (const char*)memchrs(posStart, len - (posStart - content), "?>", 2);
posEnd += 2;
}
}
else
{
//On cherche le début du prologue XML
posStart = (char*)memchrs(content, len, "<!DOCTYPE ", 10);
if(!posStart) posStart = (char*)memchrs(content, len, "<!doctype ", 10);
posStart = strcasestr(content, "<!DOCTYPE ");
//On cherche la fin du prologue XML
if(posStart)
{
posEnd = (char*)memchr(posStart, '>', len - (posStart - content));
posEnd = (const char*)memchr(posStart, '>', len - (posStart - content));
if(posEnd)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment