-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMap.PRG
More file actions
165 lines (164 loc) · 4.48 KB
/
Map.PRG
File metadata and controls
165 lines (164 loc) · 4.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
Public _Form1
_Form1=CreateObject("Form1")
_Form1.show
RETURN
**VFP应用程式算法群(12787940) 行者孙 :QQ310727570
DEFINE CLASS Form1 AS form
Top = 63
Left = 173
Height = 450
Width = 600
DoCreate = .T.
Caption = "IP地图导航"
BackColor =RGB( 247,239,202)
Name = "Form1"
PROCEDURE Init
this.AddObject("MAPWEB","_classname1")
this.AddObject("web","_classname2")
this.AddObject("Label6","_classname3")
this.AddObject("Shape12","_classname4")
this.AddObject("Command1","_classname5")
this.AddObject("Text1","_classname6")
SET SAFETY OFF
TEXT TO main NOSHOW
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Maps JavaScript API Example: Controls</title>
<script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
type="text/javascript"></script>
<script type="text/javascript">
var xmlDoc;
function initialize()
{
var map;
xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = false;
//xmlDoc.onreadystatechange = readxml;
xmlDoc.load("testWebStudents.xml");
if (GBrowserIsCompatible())
{
//----------------------------------------------------------------
var mapOptions = {
googleBarOptions : {
style : "new"
}
}
//----------------------------------------------------------------
if(xmlDoc.readyState == 4)
{
//------------------Xml Code-----------------------------
var lat=xmlDoc.documentElement.childNodes[0].text;
var longi=xmlDoc.documentElement.childNodes[1].text;
//-------------------map code-----------------------------
map = new GMap2(document.getElementById("map_canvas"),mapOptions);
map.setCenter(new GLatLng(lat,longi),9);
map.setUIToDefault();
var latlng = new GLatLng(lat,longi);
map.addOverlay(new GMarker(latlng));
map.enableGoogleBar();
//-------------------map end-------------------------------
}
}
}
</script>
</head>
<body onload="initialize()" onunload="GUnload()" topmargin="0" leftmargin="0" rightmargin="0">
<div id="map_canvas" style="width:590px; height: 450px"></div>
</body>
</html>
ENDTEXT
STRTOFILE(main,'main.html')
ENDPROC
ENDDEFINE
DEFINE CLASS _classname1 AS olecontrol
oleclass='Shell.Explorer.2'
Visible=.T.
Top = 24
Left = 0
Height = 420
Width = 600
Name = "MAPWEB"
PROCEDURE NavigateError
LPARAMETERS pdisp, url, frame, statuscode, cancel
MESSAGEBOX('无法获取数据')
ENDPROC
ENDDEFINE
DEFINE CLASS _classname2 AS olecontrol
oleclass='Shell.Explorer.2'
Visible=.T.
Top = 228
Left = 948
Height = 36
Width = 60
Name = "web"
PROCEDURE DocumentComplete
LPARAMETERS pdisp, url
IF url="http://www.ip2location.com/demo.aspx?ip="+ALLTRIM(thisform.text1.value)
VIEWSTATEValue=STRCONV(thisform.web.document.Form1.__VIEWSTATE.value,14)
Latitude=thisform.web.object.Document.getElementById("dgLookup__ctl2_lblILatitude").innerText &&经度
Longitude=thisform.web.object.Document.getElementById("dgLookup__ctl2_lblILongitude").innerText &&纬度
SET TEXTMERGE ON
TEXT TO testWebStudents NOSHOW
<?xml version="1.0"?>
<wroot><Latitude><<Latitude>></Latitude><longitutde><<Longitude>></longitutde></wroot>
ENDTEXT
STRTOFILE(testWebStudents,'testWebStudents.xml')
thisform.mapWEB.navigate2(FULLPATH("main.html"))
ENDI
ENDPROC
PROCEDURE NavigateError
LPARAMETERS pdisp, url, frame, statuscode, cancel
MESSAGEBOX('无法获取数据')
ENDPROC
ENDDEFINE
DEFINE CLASS _classname3 AS label
Visible=.T.
AutoSize = .T.
FontSize = 11
BackStyle = 0
Caption = "请输入要查询的IP地址:"
Height = 19
Left = 2
Top = 3
Width = 175
Name = "Label6"
ENDDEFINE
DEFINE CLASS _classname4 AS shape
Visible=.T.
Top = 0
Left = 0
Height = 24
Width = 600
BackStyle = 0
BorderColor =RGB( 128,128,255)
Rotation = 12
Name = "Shape12"
ENDDEFINE
DEFINE CLASS _classname5 AS commandbutton
Visible=.T.
Top = 0
Left = 492
Height = 25
Width = 108
Caption = "查询IP地图"
Name = "Command1"
PROCEDURE Click
thisform.WEB.navigate2("http://www.ip2location.com/demo.aspx?ip="+ALLTRIM(thisform.text1.value))
ENDPROC
ENDDEFINE
DEFINE CLASS _classname6 AS textbox
Visible=.T.
FontSize = 10
BackStyle = 0
Height = 22
Left = 168
SpecialEffect = 1
Top = 1
Width = 325
BackColor =RGB( 247,239,202)
BorderColor =RGB( 247,239,202)
Name = "Text1"
ENDDEFINE