Tango: removed seekbar for FOV(use pinch zoom instead), show UI on single tap instead of swipe down

This commit is contained in:
matlabbe
2017-08-03 11:52:18 -04:00
parent 82fd5b36a8
commit c0c288e0d9
6 changed files with 49 additions and 58 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
####################### #######################
SET(RTABMAP_MAJOR_VERSION 0) SET(RTABMAP_MAJOR_VERSION 0)
SET(RTABMAP_MINOR_VERSION 13) SET(RTABMAP_MINOR_VERSION 13)
SET(RTABMAP_PATCH_VERSION 1) SET(RTABMAP_PATCH_VERSION 2)
SET(RTABMAP_VERSION SET(RTABMAP_VERSION
${RTABMAP_MAJOR_VERSION}.${RTABMAP_MINOR_VERSION}.${RTABMAP_PATCH_VERSION}) ${RTABMAP_MAJOR_VERSION}.${RTABMAP_MINOR_VERSION}.${RTABMAP_PATCH_VERSION})
+1 -1
View File
@@ -2,7 +2,7 @@
<!-- BEGIN_INCLUDE(manifest) --> <!-- BEGIN_INCLUDE(manifest) -->
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.introlab.rtabmap" package="com.introlab.rtabmap"
android:versionCode="54" android:versionCode="55"
android:versionName="@RTABMAP_VERSION@"> android:versionName="@RTABMAP_VERSION@">
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.CAMERA" />
+21 -17
View File
@@ -63,11 +63,8 @@ GestureCamera::~GestureCamera() { delete cam_parent_transform_; }
void GestureCamera::OnTouchEvent(int touch_count, TouchEvent event, float x0, void GestureCamera::OnTouchEvent(int touch_count, TouchEvent event, float x0,
float y0, float x1, float y1) { float y0, float x1, float y1) {
if (camera_type_ == kFirstPerson) {
return;
}
if (touch_count == 1) { if (camera_type_!=kFirstPerson && touch_count == 1) {
switch (event) { switch (event) {
case kTouch0Down: { case kTouch0Down: {
cam_start_angle_ = cam_cur_angle_; cam_start_angle_ = cam_cur_angle_;
@@ -100,6 +97,7 @@ void GestureCamera::OnTouchEvent(int touch_count, TouchEvent event, float x0,
float abs_y = y0 - y1; float abs_y = y0 - y1;
start_touch_dist_ = std::sqrt(abs_x * abs_x + abs_y * abs_y); start_touch_dist_ = std::sqrt(abs_x * abs_x + abs_y * abs_y);
cam_start_dist_ = GetPosition().z; cam_start_dist_ = GetPosition().z;
cam_start_fov_ = this->getFOV();
// center touch // center touch
touch0_start_position_.x = (x0+x1)/2.0f; touch0_start_position_.x = (x0+x1)/2.0f;
@@ -111,25 +109,31 @@ void GestureCamera::OnTouchEvent(int touch_count, TouchEvent event, float x0,
float abs_y = y0 - y1; float abs_y = y0 - y1;
float dist = start_touch_dist_ - std::sqrt(abs_x * abs_x + abs_y * abs_y); float dist = start_touch_dist_ - std::sqrt(abs_x * abs_x + abs_y * abs_y);
cam_cur_dist_ = tango_gl::util::Clamp(cam_start_dist_ + dist * kZoomSpeed, if(camera_type_ == kFirstPerson)
kCamViewMinDist, kCamViewMaxDist);
this->SetOrthoMode(camera_type_ == kTopOrtho);
if(camera_type_ == kTopOrtho)
{ {
this->SetOrthoScale(cam_cur_dist_); this->SetFieldOfView(tango_gl::util::Clamp(cam_start_fov_ + dist * kZoomSpeed*10.0f, 45, 90));
} }
else
{
cam_cur_dist_ = tango_gl::util::Clamp(cam_start_dist_ + dist * kZoomSpeed,
kCamViewMinDist, kCamViewMaxDist);
glm::vec2 touch_center_position((x0+x1)/2.0f, (y0+y1)/2.0f); this->SetOrthoMode(camera_type_ == kTopOrtho);
glm::vec2 offset; if(camera_type_ == kTopOrtho)
offset.x = (touch_center_position.x - touch0_start_position_.x) * kMoveSpeed; {
offset.y = (touch_center_position.y - touch0_start_position_.y) * kMoveSpeed; this->SetOrthoScale(cam_cur_dist_);
touch0_start_position_ = touch_center_position; }
StartCameraToCurrentTransform(); glm::vec2 touch_center_position((x0+x1)/2.0f, (y0+y1)/2.0f);
glm::vec2 offset;
offset.x = (touch_center_position.x - touch0_start_position_.x) * kMoveSpeed;
offset.y = (touch_center_position.y - touch0_start_position_.y) * kMoveSpeed;
touch0_start_position_ = touch_center_position;
anchor_offset_ += glm::rotate(cam_parent_transform_->GetRotation(), glm::vec3(-offset.x, offset.y, 0)); StartCameraToCurrentTransform();
anchor_offset_ += glm::rotate(cam_parent_transform_->GetRotation(), glm::vec3(-offset.x, offset.y, 0));
}
break; break;
} }
default: { break; } default: { break; }
@@ -81,6 +81,7 @@ class GestureCamera : public Camera {
glm::quat cam_cur_target_rot_; glm::quat cam_cur_target_rot_;
float cam_start_dist_; float cam_start_dist_;
float cam_start_fov_;
float cam_cur_dist_; float cam_cur_dist_;
glm::vec3 anchor_offset_; glm::vec3 anchor_offset_;
+1 -1
View File
@@ -118,7 +118,7 @@
android:text="@string/close_visualization" /> android:text="@string/close_visualization" />
<SeekBar <SeekBar
android:id="@+id/seekBar_fov" android:id="@+id/seekBar_ortho_cut"
android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:rotation="270" android:rotation="270"
@@ -193,7 +193,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
private Button mButtonCloseVisualization; private Button mButtonCloseVisualization;
private Button mButtonSaveOnDevice; private Button mButtonSaveOnDevice;
private Button mButtonShareOnSketchfab; private Button mButtonShareOnSketchfab;
private SeekBar mSeekBarFov; private SeekBar mSeekBarOrthoCut;
private SeekBar mSeekBarGrid; private SeekBar mSeekBarGrid;
private String mOpenedDatabasePath = ""; private String mOpenedDatabasePath = "";
@@ -309,20 +309,13 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
} }
}); });
mSeekBarFov = (SeekBar)findViewById(R.id.seekBar_fov); mSeekBarOrthoCut = (SeekBar)findViewById(R.id.seekBar_ortho_cut);
mSeekBarFov.setMax(45); mSeekBarOrthoCut.setMax(120);
mSeekBarFov.setProgress(20); mSeekBarOrthoCut.setProgress(80);
mSeekBarFov.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { mSeekBarOrthoCut.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override @Override
public void onProgressChanged(SeekBar seekBar, int progressValue, boolean fromUser) { public void onProgressChanged(SeekBar seekBar, int progressValue, boolean fromUser) {
if(mButtonCameraView.getSelectedItemPosition() == 0) RTABMapLib.setOrthoCropFactor((float)(120-progressValue)/20.0f - 3.0f);
{
RTABMapLib.setFOV((float)progressValue+45.0f);
}
else if(mButtonCameraView.getSelectedItemPosition() == 3)
{
RTABMapLib.setOrthoCropFactor((float)(120-progressValue)/20.0f - 3.0f);
}
resetNoTouchTimer(); resetNoTouchTimer();
} }
@@ -743,17 +736,12 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
RTABMapLib.setCamera(type); RTABMapLib.setCamera(type);
mButtonCameraView.setSelection(type, true); mButtonCameraView.setSelection(type, true);
mSeekBarFov.setVisibility(type!=0 && type!=3?View.INVISIBLE:View.VISIBLE); mSeekBarOrthoCut.setVisibility(type!=3?View.INVISIBLE:View.VISIBLE);
mSeekBarGrid.setVisibility(mSeekBarGrid.isEnabled() && type==3?View.VISIBLE:View.INVISIBLE); mSeekBarGrid.setVisibility(mSeekBarGrid.isEnabled() && type==3?View.VISIBLE:View.INVISIBLE);
if(type==0)
{
mSeekBarFov.setMax(45);
mSeekBarFov.setProgress(20);
}
if(type==3) if(type==3)
{ {
mSeekBarFov.setMax(120); mSeekBarOrthoCut.setMax(120);
mSeekBarFov.setProgress(80); mSeekBarOrthoCut.setProgress(80);
} }
} }
@@ -761,6 +749,9 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
public void onClick(View v) { public void onClick(View v) {
// Handle button clicks. // Handle button clicks.
switch (v.getId()) { switch (v.getId()) {
case R.id.gl_surface_view:
break;
case R.id.pause_button: case R.id.pause_button:
pauseMapping(); pauseMapping();
break; break;
@@ -830,22 +821,17 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
return true; return true;
} }
@Override @Override
public boolean onFling( public boolean onSingleTapConfirmed(MotionEvent event) {
MotionEvent e1, if(!DISABLE_LOG) Log.i(TAG, "onSingleTapConfirmed");
MotionEvent e2, if(mHudVisible)
float velocityX, {
float velocityY) { notouchHandler.removeCallbacks(notouchCallback);
if(!DISABLE_LOG) Log.i(TAG, String.format("onFling velocityY=%f", velocityY)); notouchHandler.postDelayed(notouchCallback, 0);
if(velocityY < -1000) }
{ else
notouchHandler.removeCallbacks(notouchCallback); {
notouchHandler.postDelayed(notouchCallback, 0); resetNoTouchTimer(true);
} }
else if(velocityY > 1000)
{
resetNoTouchTimer(true);
}
return true; return true;
} }
} }
@@ -1484,7 +1470,7 @@ public class RTABMapActivity extends Activity implements OnClickListener, OnItem
} }
mButtonCameraView.setVisibility(mHudVisible?View.VISIBLE:View.INVISIBLE); mButtonCameraView.setVisibility(mHudVisible?View.VISIBLE:View.INVISIBLE);
mButtonBackfaceShown.setVisibility(mHudVisible && (mItemRenderingMesh.isChecked() || mItemRenderingTextureMesh.isChecked())?View.VISIBLE:View.INVISIBLE); mButtonBackfaceShown.setVisibility(mHudVisible && (mItemRenderingMesh.isChecked() || mItemRenderingTextureMesh.isChecked())?View.VISIBLE:View.INVISIBLE);
mSeekBarFov.setVisibility(mHudVisible && (mButtonCameraView.getSelectedItemPosition() == 0 || mButtonCameraView.getSelectedItemPosition() == 3)?View.VISIBLE:View.INVISIBLE); mSeekBarOrthoCut.setVisibility(mHudVisible && mButtonCameraView.getSelectedItemPosition() == 3?View.VISIBLE:View.INVISIBLE);
mSeekBarGrid.setVisibility(mHudVisible && mSeekBarGrid.isEnabled() && mButtonCameraView.getSelectedItemPosition() == 3?View.VISIBLE:View.INVISIBLE); mSeekBarGrid.setVisibility(mHudVisible && mSeekBarGrid.isEnabled() && mButtonCameraView.getSelectedItemPosition() == 3?View.VISIBLE:View.INVISIBLE);
} }