Code Behind Page Page /BusinessClasses/GService.cs (C#)
Used by Page /Include/GService.asmx (C#)
1: //   Google Maps User Control for ASP.Net version 1.0:  
2: //   ========================  
3: //   Copyright (C) 2008  Shabdar Ghata    
4: //   Email : ghata2002@gmail.com  
5: //   URL : http://www.shabdar.org  
6:   
7: //   This program is free software: you can redistribute it and/or modify  
8: //   it under the terms of the GNU General Public License as published by  
9: //   the Free Software Foundation, either version 3 of the License, or  
10: //   (at your option) any later version.  
11:   
12: //   This program is distributed in the hope that it will be useful,  
13: //   but WITHOUT ANY WARRANTY; without even the implied warranty of  
14: //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
15: //   GNU General Public License for more details.  
16:   
17: //   You should have received a copy of the GNU General Public License  
18: //   along with this program.  If not, see <http://www.gnu.org/licenses/>.  
19:   
20: //   This program comes with ABSOLUTELY NO WARRANTY.  
21:   
22: using System;  
23: using System.Web;  
24: using System.Collections;  
25: using System.Web.Services;  
26: using System.Web.Services.Protocols;  
27: using System.Web.Script.Services;  
28:   
29:   
30: /// <summary>  
31: /// Summary description for GService  
32: /// </summary>  
33: [WebService(Namespace = "http://tempuri.org/")]  
34: [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]  
35: [ScriptService]  
36: public class GService : System.Web.Services.WebService  
37: {  
38:   
39:     public GService () {  
40:   
41:         //Uncomment the following line if using designed components    
42:         //InitializeComponent();    
43:     }  
44:   
45:     //[WebMethod]  
46:     //public string HelloWorld(string YourName) {  
47:     //    return "Hello "+YourName;  
48:     //}  
49:     [WebMethod(EnableSession = true)]  
50:     public void SetLatLon(string pID, double pLatitude, double pLongitude)  
51:     {  
52:         GoogleObject objGoogleNew = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
53:         GoogleObject objGoogleOld = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"];  
54:         objGoogleNew.Points[pID].Latitude = pLatitude;  
55:         objGoogleNew.Points[pID].Longitude = pLongitude;  
56:         objGoogleOld.Points[pID].Latitude = pLatitude;  
57:         objGoogleOld.Points[pID].Longitude = pLongitude;  
58:     }  
59:   
60:     [WebMethod(EnableSession = true)]  
61:     public void SetZoom(string pID, int pZoomLevel)  
62:     {  
63:         GoogleObject objGoogleNew = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
64:         GoogleObject objGoogleOld = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"];  
65:         objGoogleNew.ZoomLevel = pZoomLevel;  
66:         objGoogleOld.ZoomLevel = pZoomLevel;  
67:     }  
68:   
69:     //This method will be used once map centering is complete. This will set RecenterMap flag to false. So next time map will not recenter automatically.  
70:     [WebMethod(EnableSession = true)]  
71:     public void RecenterMapComplete()  
72:     {  
73:         GoogleObject objGoogleNew = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
74:         GoogleObject objGoogleOld = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"];  
75:         objGoogleNew.RecenterMap=false;  
76:         objGoogleOld.RecenterMap = false;  
77:     }  
78:   
79:     [WebMethod(EnableSession = true)]  
80:     public GoogleObject GetGoogleObject()  
81:     {  
82:         GoogleObject objGoogle =  (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
83:   
84:         System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"] = new GoogleObject(objGoogle);  
85:         return objGoogle;  
86:     }  
87:   
88:   
89:     [WebMethod(EnableSession = true)]  
90:     public GoogleObject GetOptimizedGoogleObject()  
91:     {  
92:         GoogleObject objGoogleNew = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT"];  
93:         GoogleObject objGoogleOld = (GoogleObject)System.Web.HttpContext.Current.Session["GOOGLE_MAP_OBJECT_OLD"];  
94:         GoogleObject objGoogle = new GoogleObject();  
95:   
96:         if (objGoogleOld != null)  
97:         {  
98:             for (int i = 0; i < objGoogleNew.Points.Count; i++)  
99:             {  
100:                 string pointStatus = "";  
101:                 GooglePoint NewPoint = objGoogleNew.Points[i];  
102:                 GooglePoint OldPoint = objGoogleOld.Points[NewPoint.ID];  
103:                 //if old point not found, means this is a new point.  
104:                 if (OldPoint == null)  
105:                 {  
106:                     pointStatus = "N"; //New
107:                 }  
108:                 else  
109:                 {  
110:                     //If old point found and old not equal to new point, means it's value is changed.  
111:                     if (!OldPoint.Equals(NewPoint))  
112:                     {  
113:                         pointStatus = "C"; //Changed
114:                     }  
115:                     //Remove found point from old object. This is to reduce iteration in next loop.  
116:                     objGoogleOld.Points.Remove(OldPoint.ID);  
117:                 }  
118:                 if (pointStatus != "")  
119:                 {  
120:                     //If new point is changed, add it in list which is to be sent to client.  
121:                     NewPoint.PointStatus = pointStatus;  
122:                     objGoogle.Points.Add(NewPoint);  
123:                 }  
124:             }  
125:             //Loop through rest of old points to mark them as deleted.  
126:             for (int i = 0; i < objGoogleOld.Points.Count; i++)  
127:             {  
128:                 GooglePoint OldPoint = objGoogleOld.Points[i];  
129:                 OldPoint.PointStatus = "D";  
130:                 objGoogle.Points.Add(OldPoint);  
131:             }  
132:   
133:             //********************************************  
134:             for (int i = 0; i < objGoogleNew.Polylines.Count; i++)  
135:             {  
136:                 string lineStatus = "";  
137:                 GooglePolyline NewLine = objGoogleNew.Polylines[i];  
138:                 GooglePolyline OldLine = objGoogleOld.Polylines[NewLine.ID];  
139:                 //if old point not found, means this is a new point.  
140:                 if (OldLine == null)  
141:                 {  
142:                     lineStatus = "N"; //New
143:                 }  
144:                 else  
145:                 {  
146:                     //If old point found and old not equal to new point, means it's value is changed.  
147:                     if (!OldLine.Equals(NewLine))  
148:                     {  
149:                         lineStatus = "C"; //Changed
150:                     }  
151: There is a limit of 150 source code lines in the evaluation version
152: There is a limit of 150 source code lines in the evaluation version
153: There is a limit of 150 source code lines in the evaluation version
154: There is a limit of 150 source code lines in the evaluation version
155: There is a limit of 150 source code lines in the evaluation version
156: There is a limit of 150 source code lines in the evaluation version
157: There is a limit of 150 source code lines in the evaluation version
158: There is a limit of 150 source code lines in the evaluation version
159: There is a limit of 150 source code lines in the evaluation version
160: There is a limit of 150 source code lines in the evaluation version
161: There is a limit of 150 source code lines in the evaluation version
162: There is a limit of 150 source code lines in the evaluation version
163: There is a limit of 150 source code lines in the evaluation version
164: There is a limit of 150 source code lines in the evaluation version
165: There is a limit of 150 source code lines in the evaluation version
166: There is a limit of 150 source code lines in the evaluation version
167: There is a limit of 150 source code lines in the evaluation version
168: There is a limit of 150 source code lines in the evaluation version
169: There is a limit of 150 source code lines in the evaluation version
170: There is a limit of 150 source code lines in the evaluation version
171: There is a limit of 150 source code lines in the evaluation version
172: There is a limit of 150 source code lines in the evaluation version
173: There is a limit of 150 source code lines in the evaluation version
174: There is a limit of 150 source code lines in the evaluation version
175: There is a limit of 150 source code lines in the evaluation version
176: There is a limit of 150 source code lines in the evaluation version
177: There is a limit of 150 source code lines in the evaluation version
178: There is a limit of 150 source code lines in the evaluation version
179: There is a limit of 150 source code lines in the evaluation version
180: There is a limit of 150 source code lines in the evaluation version
181: There is a limit of 150 source code lines in the evaluation version
182: There is a limit of 150 source code lines in the evaluation version
183: There is a limit of 150 source code lines in the evaluation version
184: There is a limit of 150 source code lines in the evaluation version
185: There is a limit of 150 source code lines in the evaluation version
186: There is a limit of 150 source code lines in the evaluation version
187: There is a limit of 150 source code lines in the evaluation version
188: There is a limit of 150 source code lines in the evaluation version
189: There is a limit of 150 source code lines in the evaluation version
190: There is a limit of 150 source code lines in the evaluation version
191: There is a limit of 150 source code lines in the evaluation version
192: There is a limit of 150 source code lines in the evaluation version
193: There is a limit of 150 source code lines in the evaluation version
194: There is a limit of 150 source code lines in the evaluation version
195: There is a limit of 150 source code lines in the evaluation version
196: There is a limit of 150 source code lines in the evaluation version
197: There is a limit of 150 source code lines in the evaluation version
198: There is a limit of 150 source code lines in the evaluation version
199: There is a limit of 150 source code lines in the evaluation version
200: There is a limit of 150 source code lines in the evaluation version
201: There is a limit of 150 source code lines in the evaluation version
202: There is a limit of 150 source code lines in the evaluation version
203: There is a limit of 150 source code lines in the evaluation version
204: There is a limit of 150 source code lines in the evaluation version
205: There is a limit of 150 source code lines in the evaluation version
206: There is a limit of 150 source code lines in the evaluation version
207: There is a limit of 150 source code lines in the evaluation version
208: There is a limit of 150 source code lines in the evaluation version
209: There is a limit of 150 source code lines in the evaluation version
210: There is a limit of 150 source code lines in the evaluation version
211: There is a limit of 150 source code lines in the evaluation version
212: There is a limit of 150 source code lines in the evaluation version
213: There is a limit of 150 source code lines in the evaluation version
214: There is a limit of 150 source code lines in the evaluation version
215: There is a limit of 150 source code lines in the evaluation version
216: There is a limit of 150 source code lines in the evaluation version
217: There is a limit of 150 source code lines in the evaluation version
218: There is a limit of 150 source code lines in the evaluation version
219: There is a limit of 150 source code lines in the evaluation version
220: There is a limit of 150 source code lines in the evaluation version
221: There is a limit of 150 source code lines in the evaluation version

.NET Documentation Tool is © 2002 - 2009 Winnersh Triangle Web Solutions Limited.