// <summary>ソースコード：>ＨＹＳＳＯＰ河川横断面形状構成点クラス</summary>
// <author>CommonMP</author>

using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.Serialization;

using CommonMP.HYSSOP.Interface.HSData;

namespace CommonMP.HYSSOP.CoreImpl.HSData
{
    /// <summary><para>class outline:</para>
    /// <para>河川横断面形状構成点クラス</para>
    /// </summary>
    /// <remarks><para>history:</para>
    /// <para>[CommonMP][ver 1.0.0][2009/09/17][新規作成]</para>
    /// </remarks>
    [Serializable]
    public class HySGeoRiverCrossSectionShapePoint : HySDataRoot, HySVersionManagement
    {

        /// <summary>断面構成点ID文字列</summary>
        private HySString m_csIDString;
        /// <summary>X座標値</summary>
        private double m_dXValue;
        /// <summary>H座標値</summary>
        private double m_dHValue;

   
        /// <summary><para>method outline:</para>
        /// <para>デフォルトコンストラクタ</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> HySGeoRiverCrossSectionShapePoint csDt = new HySGeoRiverCrossSectionShapePoint() 
        /// </para>
        /// </example>
        /// <param name="">無し</param>
        /// <returns>生成インスタンス</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>なし</para>
        /// </remarks>
        public HySGeoRiverCrossSectionShapePoint()
        {
            //バージョン情報設定
            SetNowVersion();
        }

        /// <summary><para>method outline:</para>
        /// <para>断面構成点ID文字列設定</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> SetIDString( csIDString ) </para>
        /// </example>
        /// <param name="csIDString">断面構成点ID文字列</param>
        /// <returns>無し</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>無し</para>
        /// </remarks>
        public void SetIDString(HySString csIDString)
        {
            m_csIDString = csIDString;
        }

        /// <summary><para>method outline:</para>
        /// <para>断面構成点ID文字列取得</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> HySString csIDString = GetIDString( ) </para>
        /// </example>
        /// <param name="">無し</param>
        /// <returns>断面構成点ID文字列</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>無し</para>
        /// </remarks>
        public HySString GetIDString()
        {
            return m_csIDString;
        }

        /// <summary><para>method outline:</para>
        /// <para>X座標値設定</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> SetXValue( dValue ) </para>
        /// </example>
        /// <param name="dValue">X座標値</param>
        /// <returns>無し</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>無し</para>
        /// </remarks>
        public void SetXValue(double dValue)
        {
            m_dXValue = dValue;
        }

        /// <summary><para>method outline:</para>
        /// <para>X座標値取得</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> double dXValue = GetXValue( ) </para>
        /// </example>
        /// <param name="">無し</param>
        /// <returns>X座標値</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>無し</para>
        /// </remarks>
        public double GetXValue()
        {
            return m_dXValue;
        }

        /// <summary><para>method outline:</para>
        /// <para>H座標値設定</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> SetHValue( dValue ) </para>
        /// </example>
        /// <param name="dValue">H座標値</param>
        /// <returns>無し</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>無し</para>
        /// </remarks>
        public void SetHValue(double dValue)
        {
            m_dHValue = dValue;
        }

        /// <summary><para>method outline:</para>
        /// <para>H座標値取得</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> double dValue = GetHValue( ) </para>
        /// </example>
        /// <param name="">無し</param>
        /// <returns>H座標値</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>無し</para>
        /// </remarks>
        public double GetHValue()
        {
            return m_dHValue;
        }


        // ================================================
        //   バージョンアップ時の下位互換性を保つ為の処理
        // ================================================
        /// <summary>保存バージョン情報</summary>
        private string m_sDecodedVersion;
        /// <summary><para>method outline:</para>
        /// <para>バージョン情報取得</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> string sDecodedVersion = GetDecodedVersion()</para>
        /// </example>
        /// <param name="">無し</param>
        /// <returns>string 保存バージョン情報</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>メンバー変数に設定されているバージョン情報を返す</para>
        /// </remarks>
        public string GetDecodedVersion()
        {
            return m_sDecodedVersion;
        }
        /// <summary><para>method outline:</para>
        /// <para>バージョン情報取得</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> string sVersion = GetNowVersion()</para>
        /// </example>
        /// <param name="">無し</param>
        /// <returns>string 現在のバージョン情報</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>無し</para>
        /// </remarks>
        public string GetNowVersion()
        {
            return "1.00";
        }
        /// <summary><para>method outline:</para>
        /// <para>バージョン情報設定</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> SetNowVersion()</para>
        /// </example>
        /// <param name="">無し</param>
        /// <returns>無し</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>現在のバージョン情報をメンバー変数に設定する</para>
        /// </remarks>
        public void SetNowVersion()
        {
            m_sDecodedVersion = GetNowVersion();
        }
        /// <summary><para>method outline:</para>
        /// <para>復元後の整合性確保処理</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> PostDeserialize( ) </para>
        /// </example>
        /// <param name="">無し</param>
        /// <returns>無し</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>シリアライズされた旧バージョン情報を復元する際、過去の整合性をとる時に使用する
        /// バージョンによって変数等追加がない場合には、実装の必要がない
        /// </para>
        /// </remarks>
        public virtual void PostDeserialize()
        {
            if (GetDecodedVersion() != GetNowVersion())
            {
                //旧バージョンから順にバージョンを上げて行く
                switch (GetDecodedVersion())
                {
                    case "1.00":
                        break;
                }
                SetNowVersion();
            }
        }
        /// <summary><para>method outline:</para>
        /// <para>逆シリアル化時追加処理</para>
        /// </summary>
        /// <example><para>usage:</para>
        /// <para> IDeserializationCallback.OnDeserialization(csObj)</para>
        /// </example>
        /// <param name="csObj">ダミー</param>
        /// <returns>無し</returns>
        /// <exception cref="">無し</exception>
        /// <remarks><para>remarks:</para>
        /// <para>予約処理</para>
        /// </remarks>
        void IDeserializationCallback.OnDeserialization(Object csObj)
        {
            PostDeserialize();
        }
    }
}
