Beispiel #1
0
    public void ReflectionTest()
    {
        AbsolutePosition ap = new AbsolutePosition();

        ap.ValuePt = 500;
        reflectionDisplayText.text = ap.ToString();
    }
Beispiel #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (relativePosition_ != null)
            {
                hash ^= RelativePosition.GetHashCode();
            }
            if (relativeVelocity_ != null)
            {
                hash ^= RelativeVelocity.GetHashCode();
            }
            if (Rcs != 0D)
            {
                hash ^= Rcs.GetHashCode();
            }
            if (Movable != false)
            {
                hash ^= Movable.GetHashCode();
            }
            if (Width != 0D)
            {
                hash ^= Width.GetHashCode();
            }
            if (Length != 0D)
            {
                hash ^= Length.GetHashCode();
            }
            if (Height != 0D)
            {
                hash ^= Height.GetHashCode();
            }
            if (Theta != 0D)
            {
                hash ^= Theta.GetHashCode();
            }
            if (absolutePosition_ != null)
            {
                hash ^= AbsolutePosition.GetHashCode();
            }
            if (absoluteVelocity_ != null)
            {
                hash ^= AbsoluteVelocity.GetHashCode();
            }
            if (Count != 0)
            {
                hash ^= Count.GetHashCode();
            }
            if (MovingFramesCount != 0)
            {
                hash ^= MovingFramesCount.GetHashCode();
            }
            return(hash);
        }
Beispiel #3
0
        /// <summary>
        /// Draws itself and it's text.
        /// </summary>
        /// <param name="sb">The spritebatch to use to draw.</param>
        public override void Draw(SpriteBatch sb)
        {
            base.Draw(sb);

            sb.DrawString(Font,
                          Text,
                          AbsolutePosition.ToVector2(),
                          CurrentTextColor,
                          0,
                          Vector2.Zero,
                          Scale,
                          SpriteEffects.None,
                          0);
        }
        protected override MutableObject Mutate(MutableObject mutable)
        {
            var absolutePosition = AbsolutePosition.GetFirstValue(mutable);

            foreach (var entry in Bounds.GetEntries(mutable))
            {
                foreach (var bound in Bounds.GetValue(entry))
                {
                    bound.transform.position = absolutePosition;
                }
            }

            return(mutable);
        }
Beispiel #5
0
        public override IEnumerator ReceivePayload(VisualPayload payload)
        {
            BoundingBox newBound = payload.VisualData.Bound.CreateDependingBound(BoundName.GetFirstValue(payload.Data));

            newBound.transform.position = AbsolutePosition.GetLastKeyValue(payload.Data);

            var newPayload = new VisualPayload(payload.Data, new VisualDescription(newBound));

            var iterator = Router.TransmitAll(newPayload);

            while (iterator.MoveNext())
            {
                yield return(null);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 軸のポジション(絶対アドレス取得)取得応答をパースする
        /// </summary>
        /// <param name="direction"></param>
        /// <param name="value"></param>
        /// <returns></returns>
        public AbsolutePosition parseReferPosition(byte[] command)
        {
            AbsolutePosition parsedPos = null;

            // コマンドデータサイズを確定して、byte配列を確保する
            if ((command[POSITION_ID] == ID_REFER_POSITION[0]) &&       // 電文IDの格納位置
                (command[POSITION_TYPE] == TYPE_RESPONSE[0]) &&         // 種別の格納位置
                (command[POSITION_RESULT] == RESULT_SUCCESS[0]))        // 処理結果の格納位置
            {
                // 絶対位置格納エリアを確保
                parsedPos = new AbsolutePosition();

                // テキストサイズを算出
                int textSize = 0;
                textSize += (command[POSITION_DATASIZE + 0] - 0x30) * 1000;
                textSize += (command[POSITION_DATASIZE + 1] - 0x30) * 100;
                textSize += (command[POSITION_DATASIZE + 2] - 0x30) * 10;
                textSize += (command[POSITION_DATASIZE + 3] - 0x30);
                textSize -= 2;      // STXとETXを除いて、テキストのみのサイズに調整

                // テキストを切り出す
                byte[] textArray = new byte[textSize];
                Array.Copy(command, POSITION_DATATEXT, textArray, 0, textSize);

                // テキストから、移動方向と移動量を抜き出す
                string   AbsPosParamText = System.Text.Encoding.ASCII.GetString(textArray);
                string[] splitText       = AbsPosParamText.Split(',');
                string   directionText   = splitText[0];
                string   valueText       = splitText[1];

                // 絶対位置格納エリアに移動方向と移動量を格納
                parsedPos.direction = directionText == "X" ? MoveDirection.X : directionText == "Y" ? MoveDirection.Y : MoveDirection.Z;
                parsedPos.value     = Int32.Parse(valueText);
            }

            return(parsedPos);
        }
Beispiel #7
0
 public void MergeFrom(RadarObstacle other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Id != 0)
     {
         Id = other.Id;
     }
     if (other.relativePosition_ != null)
     {
         if (relativePosition_ == null)
         {
             relativePosition_ = new global::Apollo.Common.Point3D();
         }
         RelativePosition.MergeFrom(other.RelativePosition);
     }
     if (other.relativeVelocity_ != null)
     {
         if (relativeVelocity_ == null)
         {
             relativeVelocity_ = new global::Apollo.Common.Point3D();
         }
         RelativeVelocity.MergeFrom(other.RelativeVelocity);
     }
     if (other.Rcs != 0D)
     {
         Rcs = other.Rcs;
     }
     if (other.Movable != false)
     {
         Movable = other.Movable;
     }
     if (other.Width != 0D)
     {
         Width = other.Width;
     }
     if (other.Length != 0D)
     {
         Length = other.Length;
     }
     if (other.Height != 0D)
     {
         Height = other.Height;
     }
     if (other.Theta != 0D)
     {
         Theta = other.Theta;
     }
     if (other.absolutePosition_ != null)
     {
         if (absolutePosition_ == null)
         {
             absolutePosition_ = new global::Apollo.Common.Point3D();
         }
         AbsolutePosition.MergeFrom(other.AbsolutePosition);
     }
     if (other.absoluteVelocity_ != null)
     {
         if (absoluteVelocity_ == null)
         {
             absoluteVelocity_ = new global::Apollo.Common.Point3D();
         }
         AbsoluteVelocity.MergeFrom(other.AbsoluteVelocity);
     }
     if (other.Count != 0)
     {
         Count = other.Count;
     }
     if (other.MovingFramesCount != 0)
     {
         MovingFramesCount = other.MovingFramesCount;
     }
 }
Beispiel #8
0
 public override string ToString() =>
 $"{AbsolutePosition.ToArc().ToZodiacString()}{(Direction == PlanetDirection.Direct ? " " : "R")}";