import android.app.Activity;
import android.graphics.PointF;
+import android.graphics.RectF;
import android.util.Log;
import android.view.MotionEvent;
+import android.widget.Toast;
import jp.co.olympus.camerakit.OLYCamera;
import jp.co.olympus.camerakit.OLYCameraLiveViewListener;
import jp.co.olympus.camerakit.OLYCameraStatusListener;
import jp.sfjp.gokigen.a01c.IShowInformation;
+import jp.sfjp.gokigen.a01c.R;
import jp.sfjp.gokigen.a01c.liveview.IAutoFocusFrameDisplay;
import jp.sfjp.gokigen.a01c.liveview.ICameraStatusReceiver;
-import jp.sfjp.gokigen.a01c.preference.ICameraPropertyAccessor;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.indicator.CameraStatusDisplay;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.indicator.ICameraStatusDisplay;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.listeners.CameraPropertyListenerImpl;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.listeners.CameraRecordingListenerImpl;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.listeners.CameraStatusListenerImpl;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.property.ICameraPropertyLoadSaveOperations;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.property.ILoadSaveCameraProperties;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.property.IOlyCameraProperty;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.property.IOlyCameraPropertyProvider;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.property.LoadSaveCameraProperties;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.property.OlyCameraPropertyProxy;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.takepicture.AutoFocusControl;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.takepicture.BracketingShotControl;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.takepicture.MovieRecordingControl;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.takepicture.SingleShotControl;
+import jp.sfjp.gokigen.a01c.olycamerawrapper.property.CameraPropertyLoadSaveOperations;
+import jp.sfjp.gokigen.a01c.preference.IPreferenceCameraPropertyAccessor;
/**
* OlyCameraCoordinator : Olympus Air との接続、切断の間をとりもつクラス。
private final String TAG = toString();
private final IAutoFocusFrameDisplay focusFrameDisplay;
private final OLYCamera camera;
+ private final Activity context;
// 本クラスの配下のカメラ制御クラス群
private final AutoFocusControl autoFocus;
private final SingleShotControl singleShot;
+ private final MovieRecordingControl movieControl;
+ private final BracketingShotControl bracketingShot;
private final OlyCameraPropertyProxy propertyProxy;
+ private final CameraPropertyLoadSaveOperations loadSaveOperations;
private final LoadSaveCameraProperties loadSaveCameraProperties;
private final OlyCameraConnection cameraConnection;
private final ICameraStatusDisplay cameraStatusDisplay;
private final LevelMeterHolder levelMeter;
+ private final ZoomLensHolder zoomLensHolder;
private boolean isManualFocus = false;
private boolean isAutoFocusLocked = false;
- private boolean isExposureLocked = false;
+ //private boolean isExposureLocked = false;
+
/**
* コンストラクタ
*/
public OlyCameraCoordinator(Activity context, IAutoFocusFrameDisplay focusFrameDisplay, IShowInformation showInformation, ICameraStatusReceiver receiver)
{
+ this.context = context;
this.focusFrameDisplay = focusFrameDisplay;
// OLYMPUS CAMERA クラスの初期化、リスナの設定
// 本クラスの配下のカメラ制御クラス群の設定
autoFocus = new AutoFocusControl(camera, focusFrameDisplay, this); // AF制御
- singleShot = new SingleShotControl(camera, focusFrameDisplay, this); // 撮影
+ singleShot = new SingleShotControl(camera, focusFrameDisplay, this, showInformation); // 1枚撮影
+ movieControl = new MovieRecordingControl(context, camera, showInformation); // ムービー撮影
+ bracketingShot = new BracketingShotControl(camera, focusFrameDisplay, this, showInformation); // ブラケッティング&インターバル撮影
propertyProxy = new OlyCameraPropertyProxy(camera); // カメラプロパティ
cameraStatusDisplay = new CameraStatusDisplay(propertyProxy, showInformation); // 画面表示
- this.levelMeter = new LevelMeterHolder(showInformation, android.support.v7.preference.PreferenceManager.getDefaultSharedPreferences(context).getBoolean(ICameraPropertyAccessor.SHOW_LEVEL_GAUGE_STATUS, false)); // デジタル水準器
- setCameraStatusListener(new CameraStatusListenerImpl(context, cameraStatusDisplay, levelMeter));
+ this.levelMeter = new LevelMeterHolder(showInformation, android.support.v7.preference.PreferenceManager.getDefaultSharedPreferences(context).getBoolean(IPreferenceCameraPropertyAccessor.SHOW_LEVEL_GAUGE_STATUS, false)); // デジタル水準器
+ camera.setCameraStatusListener(new CameraStatusListenerImpl(context, cameraStatusDisplay, levelMeter));
camera.setCameraPropertyListener(new CameraPropertyListenerImpl(cameraStatusDisplay));
+ camera.setRecordingListener(new CameraRecordingListenerImpl(context, showInformation));
loadSaveCameraProperties = new LoadSaveCameraProperties(context, propertyProxy, this);
+ loadSaveOperations = new CameraPropertyLoadSaveOperations(context, loadSaveCameraProperties, cameraStatusDisplay);
+ zoomLensHolder = new ZoomLensHolder(camera);
}
/**
}
/**
+ * オートフォーカスのポイントに含まれているか確認する (trueだったら含まれる)
+ *
+ */
+ @Override
+ public boolean isContainsAutoFocusPoint(MotionEvent event)
+ {
+ //// 以下の機能は、タッチイベントの受信時のみ動作させる
+ //if (event.getAction() != MotionEvent.ACTION_DOWN)
+ //{
+ // return (false);
+ //}
+ try
+ {
+ // タッチした位置を取得する
+ PointF point = focusFrameDisplay.getPointWithEvent(event);
+
+ // AFの有効座標を取得する
+ RectF rect = camera.getAutoFocusEffectiveArea();
+ //Log.v(TAG, "AF POINT (" + point.x + "," + point.y + ")");
+ //Log.v(TAG, "AF EFFECTIVE AREA (" + rect.left + "," + rect.left + ") - (" + rect.right + "," + rect.bottom + ")");
+ return (rect.contains(point.x, point.y));
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ return (false);
+ }
+
+ /**
* フォーカスロックの解除
*/
public void unlockAutoFocus()
* 画像を1枚撮影
*/
@Override
- public void singleShot() {
+ public void singleShot()
+ {
singleShot.singleShot();
+ {
+ // 撮影の表示をToastで行う (成功とか失敗とか言っていない)
+ Toast.makeText(context, R.string.shoot_camera, Toast.LENGTH_SHORT).show();
+ }
+ }
+
+ /**
+ * ムービーの撮影・停止
+ */
+ @Override
+ public void movieControl()
+ {
+ movieControl.movieControl();
+ }
+
+ /**
+ * インターバル&ブラケッティング撮影の実行
+ *
+ * @param bracketingStyle : ブラケッティングスタイル
+ * @param bracketingCount : 撮影枚数
+ * @param durationSeconds : 撮影間隔(単位:秒)
+ *
+ */
+ @Override
+ public void bracketingShot(int bracketingStyle, int bracketingCount, int durationSeconds)
+ {
+ bracketingShot.bracketingShot(bracketingStyle, bracketingCount, durationSeconds);
}
/**
@Override
public boolean isAELock()
{
- isExposureLocked = propertyProxy.isExposureLocked();
- return (isExposureLocked);
+ return (propertyProxy.isExposureLocked());
}
@Override
}
@Override
+ public ICameraPropertyLoadSaveOperations getCameraPropertyLoadSaveOperations()
+ {
+ return (loadSaveOperations);
+ }
+
+ @Override
public ILoadSaveCameraProperties getLoadSaveCameraProperties()
{
return (loadSaveCameraProperties);
}
@Override
+ public IZoomLensHolder getZoomLensHolder()
+ {
+ return (zoomLensHolder);
+ }
+
+ @Override
public ILevelGauge getLevelGauge()
{
return (levelMeter);