|
41 | 41 | import android.widget.ListView;
|
42 | 42 |
|
43 | 43 | import com.github.rosjava.android_remocons.common_tools.apps.RosAppActivity;
|
| 44 | +import com.google.common.collect.Lists; |
44 | 45 |
|
| 46 | +import org.ros.android.view.visualization.layer.Layer; |
45 | 47 | import org.ros.namespace.NameResolver;
|
46 | 48 | import org.ros.node.NodeConfiguration;
|
47 | 49 | import org.ros.node.NodeMainExecutor;
|
@@ -200,27 +202,32 @@ protected void init(NodeMainExecutor nodeMainExecutor) {
|
200 | 202 | nodeConfiguration = NodeConfiguration.newPublic(InetAddressFactory
|
201 | 203 | .newNonLoopback().getHostAddress(), getMasterUri());
|
202 | 204 |
|
203 |
| - CameraControlLayer cameraControlLayer = new CameraControlLayer(this, |
204 |
| - nodeMainExecutor.getScheduledExecutorService()); |
| 205 | + CameraControlLayer cameraControlLayer = new CameraControlLayer(); |
205 | 206 | cameraControlLayer.addListener(new CameraControlListener() {
|
206 | 207 | @Override
|
207 |
| - public void onZoom(double focusX, double focusY, double factor) { |
208 |
| - } |
| 208 | + public void onZoom(float focusX, float focusY, float factor) {} |
| 209 | + |
| 210 | + @Override |
| 211 | + public void onDoubleTap(float x, float y) {} |
209 | 212 |
|
210 | 213 | @Override
|
211 |
| - public void onTranslate(float distanceX, float distanceY) { |
212 |
| - } |
| 214 | + public void onTranslate(float distanceX, float distanceY) {} |
213 | 215 |
|
214 | 216 | @Override
|
215 |
| - public void onRotate(double focusX, double focusY, double deltaAngle) { |
216 |
| - } |
| 217 | + public void onRotate(float focusX, float focusY, double deltaAngle) {} |
217 | 218 |
|
218 | 219 | });
|
219 |
| - mapView.addLayer(cameraControlLayer); |
220 | 220 | NameResolver appNameSpace = getMasterNameSpace();
|
221 | 221 | String mapTopic = remaps.get(getString(R.string.map_topic));
|
222 | 222 | occupancyGridLayer = new OccupancyGridLayer(appNameSpace.resolve(mapTopic).toString());
|
223 |
| - mapView.addLayer(occupancyGridLayer); |
| 223 | + |
| 224 | + mapView.onCreate( |
| 225 | + Lists.<Layer>newArrayList( |
| 226 | + cameraControlLayer, |
| 227 | + occupancyGridLayer |
| 228 | + ) |
| 229 | + ); |
| 230 | + |
224 | 231 | nodeMainExecutor.execute(mapView, nodeConfiguration.setNodeName("android/map_view"));
|
225 | 232 |
|
226 | 233 | updateMapList();
|
@@ -249,10 +256,13 @@ public void onFailure(RemoteException e) {
|
249 | 256 | @Override
|
250 | 257 | public void onSuccess(PublishMapResponse message) {
|
251 | 258 | safeDismissWaitingDialog();
|
252 |
| - if (!visibleMapView) { |
253 |
| - mapView.addLayer(occupancyGridLayer); |
254 |
| - visibleMapView = true; |
255 |
| - } |
| 259 | + // disabling temporarily until testing |
| 260 | + // this api got deprecated |
| 261 | + // see https://github.com/rosjava/android_apps/issues/42 |
| 262 | + // if (!visibleMapView) { |
| 263 | + // mapView.addLayer(occupancyGridLayer); |
| 264 | + // visibleMapView = true; |
| 265 | + // } |
256 | 266 | }
|
257 | 267 | });
|
258 | 268 |
|
@@ -381,8 +391,11 @@ public void onSuccess(DeleteMapResponse arg0) {
|
381 | 391 | }
|
382 | 392 | switch (radioFocusRelation) {
|
383 | 393 | case 0:
|
384 |
| - mapView.hideLayer(occupancyGridLayer); |
385 |
| - visibleMapView = false; |
| 394 | + // disabling temporarily until testing |
| 395 | + // this api got deprecated |
| 396 | + // see https://github.com/rosjava/android_apps/issues/42 |
| 397 | + //mapView.hideLayer(occupancyGridLayer); |
| 398 | + //visibleMapView = false; |
386 | 399 | radioFocus = -1;
|
387 | 400 | break;
|
388 | 401 | case 1:
|
|
0 commit comments