diff options
author | Melanie Thielker | 2014-03-18 02:16:00 +0100 |
---|---|---|
committer | Melanie | 2014-03-18 00:50:00 +0000 |
commit | a53272c5fbc4d4db8cc4ece1ec3d4497ac5595d2 (patch) | |
tree | 5bf1ce52eab95772437e2fece7bee84c958b6c3b /OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | |
parent | Fix a bug in previous commit 01520bb where I accidentally saved OtherCleanTim... (diff) | |
download | opensim-SC_OLD-a53272c5fbc4d4db8cc4ece1ec3d4497ac5595d2.zip opensim-SC_OLD-a53272c5fbc4d4db8cc4ece1ec3d4497ac5595d2.tar.gz opensim-SC_OLD-a53272c5fbc4d4db8cc4ece1ec3d4497ac5595d2.tar.bz2 opensim-SC_OLD-a53272c5fbc4d4db8cc4ece1ec3d4497ac5595d2.tar.xz |
Add delete maptile ability to MapImageService - yet untested
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs b/OpenSim/Services/Connectors/MapImage/MapImageServicesConnector.cs index cc485f7..725204d 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; |