Esempio n. 1
0
 public Vector3 GetStart(float frame)
 {
     return(new Vector3(
                PosX.GetFrameValue(frame),
                PosY.GetFrameValue(frame),
                PosZ.GetFrameValue(frame)));
 }
Esempio n. 2
0
        /// <summary>
        /// Serialize to XML
        /// </summary>
        /// <param name="writer"></param>
        public virtual void Serialize(XmlWriter writer)
        {
            writer.WriteStartElement("Scenario");
            writer.WriteAttributeString("Type", "FORM");
            writer.WriteAttributeString("Version", "1");
            writer.WriteAttributeString("Name", Name);

            writer.WriteStartElement("Form");

            writer.WriteAttributeString("X", PosX.ToString());
            writer.WriteAttributeString("Y", PosY.ToString());
            writer.WriteAttributeString("W", Width.ToString());
            writer.WriteAttributeString("H", Height.ToString());

            foreach (string key in Properties.Keys)
            {
                writer.WriteStartElement("Property");
                writer.WriteAttributeString("Name", key);
                writer.WriteValue(Properties[key]);
                writer.WriteEndElement();
            }

            // Form
            writer.WriteEndElement();

            // Scenario
            writer.WriteEndElement();
        }
Esempio n. 3
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            // ushort axis = GetAxis(); //轴号
            double dcurrent_speedX = 0, dcurrent_speedY = 0, dcurrent_speedZ = 0, dcurrent_speedW = 0; //速度值
            //  double dunitPosX, dunitPosY, dunitPosZ, dunitPosW; //脉冲当量转换后指令值
            int PosX, PosY, PosZ, PosW;                                                                //脉冲值

            LTDMC.dmc_read_current_speed_unit(_CardID, 0, ref dcurrent_speedX);                        // 读取轴当前速度
            LTDMC.dmc_read_current_speed_unit(_CardID, 1, ref dcurrent_speedY);
            LTDMC.dmc_read_current_speed_unit(_CardID, 2, ref dcurrent_speedZ);
            LTDMC.dmc_read_current_speed_unit(_CardID, 3, ref dcurrent_speedW);
            txtCurrentSpeedX.Text = dcurrent_speedX.ToString();
            txtCurrentSpeedY.Text = dcurrent_speedY.ToString();
            txtCurrentSpeedZ.Text = dcurrent_speedZ.ToString();
            txtCurrentSpeedW.Text = dcurrent_speedW.ToString();
            //LTDMC.dmc_get_position_unit(_CardID, 0, ref dunitPosX); //读取指定轴指令位置值
            //txtFinalPosY.Text = dunitPosX.ToString();
            PosX = LTDMC.dmc_get_position(_CardID, 0);//读取指定轴的脉冲值
            PosY = LTDMC.dmc_get_position(_CardID, 1);
            PosZ = LTDMC.dmc_get_position(_CardID, 2);
            PosW = LTDMC.dmc_get_position(_CardID, 3);
            txtCurrentPosX.Text = PosX.ToString();
            txtCurrentPosY.Text = PosY.ToString();
            txtCurrentPosZ.Text = PosZ.ToString();
            txtCurrentPosW.Text = PosW.ToString();
            if (LTDMC.dmc_check_done(_CardID, 0) == 0) // 读取指定轴运动状态
            {
                txtStateX.Text = "运行中";
            }
            else
            {
                txtStateX.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 1) == 0) // 读取指定轴运动状态
            {
                txtStateY.Text = "运行中";
            }
            else
            {
                txtStateY.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 2) == 0) // 读取指定轴运动状态
            {
                txtStateZ.Text = "运行中";
            }
            else
            {
                txtStateZ.Text = "停止中";
            }
            if (LTDMC.dmc_check_done(_CardID, 3) == 0) // 读取指定轴运动状态
            {
                txtStateW.Text = "运行中";
            }
            else
            {
                txtStateW.Text = "停止中";
            }
        }
Esempio n. 4
0
        private void _SetPositionY(double posY)
        {
            yPos.Content     = "Position in Y axis: " + Math.Round(posY * 1000, 3).ToString() + " millimeters";
            actualPosition.y = posY;

            timePY.Add(actualTime);

            PosY.Add(posY);
        }
Esempio n. 5
0
        public override string ToString()
        {
            string corral = "Corral(" + PosX.ToString() + ", " + PosY.ToString() + ")";

            if (HasKid)
            {
                corral += " <<with " + Kid.ToString() + ">>";
            }
            return(corral);
        }
Esempio n. 6
0
        // ---------------------------------------------------------------------------------------------------------------------------------------------------------
        /// <summary>
        /// Bends in mutual opposite directions the specified visual connectors which represents an auto-reference.
        /// </summary>
        public void BendAutoRefConnectors(VisualConnector OriginConnector, VisualConnector TargetConnector)
        {
            double Toleration = 20.0;
            double Expansion = Toleration * 2.0;
            double PosX, PosY;
            bool   TooCloseX, TooCloseY;
            var    PrimaryCenter   = this.MainSymbol.BaseCenter;
            var    SecondaryCenter = (OriginConnector.OriginSymbol == this.MainSymbol
                                   ? OriginConnector.TargetSymbol.BaseCenter
                                   : OriginConnector.OriginSymbol.BaseCenter);

            if (OriginConnector.IntermediatePosition == Display.NULL_POINT)
            {
                PosX      = PrimaryCenter.X;
                PosY      = SecondaryCenter.Y;
                TooCloseX = PosX.IsCloseTo(SecondaryCenter.X, Toleration);
                TooCloseY = PosY.IsCloseTo(PrimaryCenter.Y, Toleration);

                if (TooCloseX)
                {
                    PosX = PrimaryCenter.X - Expansion;
                    PosY = (PrimaryCenter.Y + SecondaryCenter.Y) / 2.0;
                }

                if (TooCloseY)
                {
                    PosY = SecondaryCenter.Y - Expansion;
                    PosX = (PrimaryCenter.X + SecondaryCenter.X) / 2.0;
                }

                OriginConnector.IntermediatePosition = new Point(PosX, PosY);
            }

            if (TargetConnector.IntermediatePosition == Display.NULL_POINT)
            {
                PosX      = SecondaryCenter.X;
                PosY      = PrimaryCenter.Y;
                TooCloseX = PosX.IsCloseTo(PrimaryCenter.X, Toleration);
                TooCloseY = PosY.IsCloseTo(SecondaryCenter.Y, Toleration);

                if (TooCloseX)
                {
                    PosX = SecondaryCenter.X + Expansion;
                    PosY = (PrimaryCenter.Y + SecondaryCenter.Y) / 2.0;
                }

                if (TooCloseY)
                {
                    PosY = PrimaryCenter.Y + Expansion;
                    PosX = (PrimaryCenter.X + SecondaryCenter.X) / 2.0;
                }

                TargetConnector.IntermediatePosition = new Point(PosX, PosY);
            }
        }
Esempio n. 7
0
 public void Show()
 {
     _body_.Visible = true;
     Active         = true;
     _body_.Show();
     #if DEBUG
     int maxx = PosX + Width;
     int maxy = PosY + Height;
     _body_.Text = PosX.ToString() + '-' + maxx.ToString() + "::" + PosY.ToString() + '-' + maxy.ToString();
     #endif
 }
Esempio n. 8
0
        public override int GetHashCode()
        {
            if (IsEmpty)
            {
                return(0);
            }

            return(State.GetHashCode()
                   ^ PosX.GetHashCode() ^ PosY.GetHashCode()
                   ^ Width.GetHashCode() ^ Height.GetHashCode());
        }
Esempio n. 9
0
 public override void WriteXml(XmlWriter writer)
 {
     WriteXmlAttributes(writer);
     writer.WriteAttributeString("x", PosX.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("y", PosY.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("text-anchor", Anchor.ToString());
     writer.WriteAttributeString("dominant-baseline", DominantBaseline.ToString());
     writer.WriteAttributeString("font-size", $"{_style.Size.ToString(CultureInfo.InvariantCulture)}px");
     writer.WriteAttributeString("font-family", $"{_style.Font}");
     writer.WriteValue(Label);
     writer.WriteEndElement();
 }
Esempio n. 10
0
    public void ReceiveTelemetry(TelemetryPayload payload)
    {
        // set position
        PosX.SetToNumber(Mathf.RoundToInt(payload.posx / 1000.0f));
        PosY.SetToNumber(Mathf.RoundToInt(payload.posy / 1000.0f));
        PosZ.SetToNumber(Mathf.RoundToInt(payload.posz / 1000.0f));

        // x is the y-dim and y is heading
        RotX.SetToNumber(Mathf.RoundToInt(payload.roty));
        var heading = (payload.rotx < 100) ? Mathf.CeilToInt(payload.rotx * -1) : Mathf.CeilToInt(360 - payload.rotx);

        RotY.SetToNumber(heading);
    }
Esempio n. 11
0
        protected override IAsyncResult BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, object state)
        {
            Window currWindow = ActiveWindow.Get(context);

            try
            {
                if (currWindow == null)
                {
                    PropertyDescriptor property = context.DataContext.GetProperties()[WindowActive.OpenBrowsersPropertyTag];
                    if (property == null)
                    {
                        property = context.DataContext.GetProperties()[WindowAttach.OpenBrowsersPropertyTag];
                    }
                    if (property != null)
                    {
                        currWindow = property.GetValue(context.DataContext) as Window;
                    }
                }
                Win32Api.Rect rect = new Win32Api.Rect();
                Win32Api.GetWindowRect((IntPtr)currWindow.getWindowHwnd(), out rect);
                int oldWidth  = rect.Right - rect.Left;
                int oldHeight = rect.Bottom - rect.Top;
                int oldPosX   = rect.Left;
                int oldPosY   = rect.Top;

                int newPosX   = PosX.Get(context);
                int newPosY   = PosY.Get(context);
                int newWidth  = Width.Get(context);
                int newHeight = Height.Get(context);

                int defPosX   = newPosX == 0 ? oldPosX : newPosX;
                int defPosY   = newPosY == 0 ? oldPosY : newPosY;
                int defWidth  = newWidth == 0 ? oldWidth : newWidth;
                int defHeight = newHeight == 0 ? oldHeight : newHeight;

                Win32Api.MoveWindow(currWindow.getWindowHwnd(), defPosX, defPosY, defWidth, defHeight, true);
            }
            catch (Exception e)
            {
                SharedObject.Instance.Output(SharedObject.enOutputType.Error, "关闭窗口错误产生", e.Message);
                if (ContinueOnError.Get(context))
                {
                }
                else
                {
                    throw;
                }
            }
            m_Delegate = new runDelegate(Run);
            return(m_Delegate.BeginInvoke(callback, state));
        }
Esempio n. 12
0
 public override string ToString()
 {
     return(String.Format("[{0}][{1}],[{2}],[{3}],[{4}],[{5}],[{6}],[{7}],[{8}],[{9}]", (Frame + 1).ToString().PadLeft(5),
                          PosX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          PosY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          PosZ.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotZ.ToString().ToFixedString(size, ' ').PadRight(padding),
                          RotW.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaX.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaY.ToString().ToFixedString(size, ' ').PadRight(padding),
                          ScaZ.ToString().ToFixedString(size, ' ').PadRight(padding)));
 }
Esempio n. 13
0
 public override void WriteXml(XmlWriter writer)
 {
     WriteXmlAttributes(writer);
     if (!string.IsNullOrWhiteSpace(Id))
     {
         writer.WriteAttributeString("id", Id);
     }
     if (!string.IsNullOrWhiteSpace(Label))
     {
         writer.WriteAttributeString("label", Label);
     }
     writer.WriteAttributeString("cx", PosX.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("cy", PosY.ToString(CultureInfo.InvariantCulture));
     writer.WriteAttributeString("r", Radius.ToString(CultureInfo.InvariantCulture));
     writer.WriteEndElement();
 }
Esempio n. 14
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Name.Length != 0)
        {
            hash ^= Name.GetHashCode();
        }
        if (PosX != 0F)
        {
            hash ^= PosX.GetHashCode();
        }
        if (PosY != 0F)
        {
            hash ^= PosY.GetHashCode();
        }
        if (PosZ != 0F)
        {
            hash ^= PosZ.GetHashCode();
        }
        if (RotX != 0F)
        {
            hash ^= RotX.GetHashCode();
        }
        if (RotY != 0F)
        {
            hash ^= RotY.GetHashCode();
        }
        if (RotZ != 0F)
        {
            hash ^= RotZ.GetHashCode();
        }
        if (Hp != 0)
        {
            hash ^= Hp.GetHashCode();
        }
        if (BossHp != 0)
        {
            hash ^= BossHp.GetHashCode();
        }
        if (Target != 0)
        {
            hash ^= Target.GetHashCode();
        }
        return(hash);
    }
        /// <summary>
        /// The MovingTextOptionsWindow nees a <see cref="RgbLibrary.MovingText"/> object.
        /// <para>
        /// <list type="bullet">
        /// <listheader>
        /// <description>The user can change the properties:</description>
        /// </listheader>
        /// <item>
        /// <description>
        /// Color
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// Text
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// FontSize
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// Position in x-achses
        /// </description>
        /// </item>
        /// <item>
        /// <description>
        /// Position in y-achses
        /// </description>
        /// <item>
        /// <description>
        /// Scroll Mode
        /// </description>
        /// </item>
        /// </item>
        /// </list>
        /// </para>
        /// </summary>
        /// <param name="movingText"></param>
        public MovingTextOptionsWindow(MovingText movingText)
        {
            InitializeComponent();
            this.movingText    = movingText;
            this.SizeToContent = System.Windows.SizeToContent.WidthAndHeight;
            this.Topmost       = true;


            Binding ColorBinding = new Binding("ColorPalette");

            ColorBinding.Source = this.movingText;
            ColorBinding.Mode   = BindingMode.TwoWay;
            Palettes.SetBinding(ComboBox.TextProperty, ColorBinding);

            Binding TextBinding = new Binding("Text");

            TextBinding.Source = this.movingText;
            TextBinding.Mode   = BindingMode.TwoWay;
            TextBinding.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;
            Text.SetBinding(TextBox.TextProperty, TextBinding);

            Binding FontSizeBinding = new Binding("FontSize");

            FontSizeBinding.Source = this.movingText;
            FontSizeBinding.Mode   = BindingMode.TwoWay;
            FontSize.SetBinding(Slider.ValueProperty, FontSizeBinding);

            Binding ModeBinding = new Binding("Mode");

            ModeBinding.Source = this.movingText;
            ModeBinding.Mode   = BindingMode.TwoWay;
            Selected_Objects.SetBinding(ComboBox.SelectedValueProperty, ModeBinding);

            Binding PosYBinding = new Binding("PosY");

            PosYBinding.Source = this.movingText;
            PosYBinding.Mode   = BindingMode.TwoWay;
            PosY.SetBinding(Slider.ValueProperty, PosYBinding);

            Binding PosXBinding = new Binding("PosX");

            PosXBinding.Source = this.movingText;
            PosXBinding.Mode   = BindingMode.TwoWay;
            PosX.SetBinding(Slider.ValueProperty, PosXBinding);
        }
Esempio n. 16
0
    public override int GetHashCode()
    {
        int hash = 1;

        if (Name.Length != 0)
        {
            hash ^= Name.GetHashCode();
        }
        if (PosX != 0F)
        {
            hash ^= PosX.GetHashCode();
        }
        if (PosY != 0F)
        {
            hash ^= PosY.GetHashCode();
        }
        if (PosZ != 0F)
        {
            hash ^= PosZ.GetHashCode();
        }
        if (RotX != 0F)
        {
            hash ^= RotX.GetHashCode();
        }
        if (RotY != 0F)
        {
            hash ^= RotY.GetHashCode();
        }
        if (RotZ != 0F)
        {
            hash ^= RotZ.GetHashCode();
        }
        if (Hp != 0)
        {
            hash ^= Hp.GetHashCode();
        }
        if (IsHit != false)
        {
            hash ^= IsHit.GetHashCode();
        }
        return(hash);
    }
Esempio n. 17
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (PosX != null)
         {
             hashCode = hashCode * 59 + PosX.GetHashCode();
         }
         if (PosY != null)
         {
             hashCode = hashCode * 59 + PosY.GetHashCode();
         }
         if (ItemId != null)
         {
             hashCode = hashCode * 59 + ItemId.GetHashCode();
         }
         return(hashCode);
     }
 }
Esempio n. 18
0
        /// <summary>
        /// Returns true if FloorplanHotspotConfigBean instances are equal
        /// </summary>
        /// <param name="input">Instance of FloorplanHotspotConfigBean to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(FloorplanHotspotConfigBean input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     PosX == input.PosX ||
                     (PosX != null &&
                      PosX.Equals(input.PosX))
                     ) &&
                 (
                     PosY == input.PosY ||
                     (PosY != null &&
                      PosY.Equals(input.PosY))
                 ) &&
                 (
                     ItemId == input.ItemId ||
                     (ItemId != null &&
                      ItemId.Equals(input.ItemId))
                 ));
        }
Esempio n. 19
0
    private void Update()
    {
        if (AnimationDir == 1)
        {
            T += Time.deltaTime * AnimationSpeed;
            if (T >= 1.0f)
            {
                T = 1.0f;
                if (ReverseOnFinish)
                {
                    AnimationDir = -1;
                }
                else
                {
                    AnimationDir = 0;
                }
            }
        }
        else if (AnimationDir == -1)
        {
            T -= Time.deltaTime * AnimationSpeed;
            if (T <= 0.0f)
            {
                T            = 0.0f;
                AnimationDir = 0;
            }
        }

        tr.localPosition = new Vector3(PosX.Evaluate(T), PosY.Evaluate(T), PosZ.Evaluate(T)) +
                           startPos;
        tr.localScale = new Vector3(startScale.x * ScaleX.Evaluate(T),
                                    startScale.y * ScaleY.Evaluate(T),
                                    startScale.z * ScaleZ.Evaluate(T));
        tr.localEulerAngles = new Vector3(tr.localEulerAngles.x, tr.localEulerAngles.y,
                                          startRot + Rot.Evaluate(T));
    }
Esempio n. 20
0
 public override string ToString()
 {
     return("Kid<" + Id + ">(" + PosX.ToString() + ", " + PosY.ToString() + ")");
 }
Esempio n. 21
0
 public override string ToString()
 {
     return(string.Format("What={0};ItemId={1};ItemPlayer={2};PosX={3};PosY={4};Units={5}", GetType().ToString(), ItemId, ItemPlayer, PosX.ToString("F"), PosY.ToString("F"), numberOfUnits));
 }
Esempio n. 22
0
 internal unsafe Vector3 GetPosition(float index)
 {
     return(new Vector3(PosX.GetFrameValue(index), PosY.GetFrameValue(index), PosZ.GetFrameValue(index)));
 }
Esempio n. 23
0
 public override string ToString()
 {
     return("Dirt(" + PosX.ToString() + ", " + PosY.ToString() + ")");
 }
Esempio n. 24
0
 public override string ToString()
 {
     return("Obstacle(" + PosX.ToString() + ", " + PosY.ToString() + ")");
 }
Esempio n. 25
0
 private void UpdatePos()
 {
     transform.localPosition = new Vector3(PosX * offsetX, PosY * offsetY, 0);
     transform.name          = PosX.ToString() + PosY.ToString();
 }
Esempio n. 26
0
        public string getResponseString()
        {
            string responseString = "(" + PosX.ToString() + "," + PosY.ToString() + ")";

            return(responseString);
        }