aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs')
-rw-r--r--OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs60
1 files changed, 60 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
index 30bfb70..267dd71 100644
--- a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
+++ b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs
@@ -86,6 +86,66 @@ namespace OpenSim.Services.Connectors
86 m_ServerURI = serviceURI.TrimEnd('/'); 86 m_ServerURI = serviceURI.TrimEnd('/');
87 } 87 }
88 88
89 public bool RemoveMapTile(int x, int y, out string reason)
90 {
91 reason = string.Empty;
92 int tickstart = Util.EnvironmentTickCount();
93 Dictionary<string, object> sendData = new Dictionary<string, object>();
94 sendData["X"] = x.ToString();
95 sendData["Y"] = y.ToString();
96
97 string reqString = ServerUtils.BuildQueryString(sendData);
98 string uri = m_ServerURI + "/removemap";
99
100 try
101 {
102 string reply = SynchronousRestFormsRequester.MakeRequest("POST",
103 uri,
104 reqString);
105 if (reply != string.Empty)
106 {
107 Dictionary<string, object> replyData = ServerUtils.ParseXmlResponse(reply);
108
109 if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "success"))
110 {
111 return true;
112 }
113 else if (replyData.ContainsKey("Result") && (replyData["Result"].ToString().ToLower() == "failure"))
114 {
115 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Delete failed: {0}", replyData["Message"].ToString());
116 reason = replyData["Message"].ToString();
117 return false;
118 }
119 else if (!replyData.ContainsKey("Result"))
120 {
121 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: reply data does not contain result field");
122 }
123 else
124 {
125 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: unexpected result {0}", replyData["Result"].ToString());
126 reason = "Unexpected result " + replyData["Result"].ToString();
127 }
128
129 }
130 else
131 {
132 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Map post received null reply");
133 }
134 }
135 catch (Exception e)
136 {
137 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: Exception when contacting map server at {0}: {1}", uri, e.Message);
138 }
139 finally
140 {
141 // This just dumps a warning for any operation that takes more than 100 ms
142 int tickdiff = Util.EnvironmentTickCountSubtract(tickstart);
143 m_log.DebugFormat("[MAP IMAGE CONNECTOR]: map tile deleted in {0}ms", tickdiff);
144 }
145
146 return false;
147 }
148
89 public bool AddMapTile(int x, int y, byte[] jpgData, out string reason) 149 public bool AddMapTile(int x, int y, byte[] jpgData, out string reason)
90 { 150 {
91 reason = string.Empty; 151 reason = string.Empty;