示例#1
0
 public void Reset()
 {
     ScaleX.ZoomReset();
     ScaleY.ZoomReset();
     MinX = null;
     MaxX = null;
 }
示例#2
0
            public Storyboard CreateShowing(OverlaidContent target)
            {
                var content         = (PictureViewContent)target;
                var duration        = 250;
                var exponentialEase = new ExponentialEase()
                {
                    EasingMode = EasingMode.EaseOut, Exponent = 5
                };
                var transform = content.PicturePreviewControl.GetTransformTo(content.SourceControl);

                var translateX = new TranslateX(content.PicturePreviewControl)
                {
                    From = transform.TranslateX / 2, Duration = duration, EasingFunction = exponentialEase
                };
                var translateY = new TranslateY(content.PicturePreviewControl)
                {
                    From = transform.TranslateY / 2, Duration = duration, EasingFunction = exponentialEase
                };
                var scaleX = new ScaleX(content.PicturePreviewControl)
                {
                    From = transform.ScaleX + (1 - transform.ScaleX) / 2, To = 1, Duration = duration, EasingFunction = exponentialEase
                };
                var scaleY = new ScaleY(content.PicturePreviewControl)
                {
                    From = transform.ScaleY + (1 - transform.ScaleY) / 2, To = 1, Duration = duration, EasingFunction = exponentialEase
                };

                var storyboard = new Storyboard();

                storyboard.Children.Add(translateX.GetTimeline());
                storyboard.Children.Add(translateY.GetTimeline());
                storyboard.Children.Add(scaleX.GetTimeline());
                storyboard.Children.Add(scaleY.GetTimeline());
                return(storyboard);
            }
        /// <summary>
        /// Returns true if PdfScalePageParameters instances are equal
        /// </summary>
        /// <param name="input">Instance of PdfScalePageParameters to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(PdfScalePageParameters input)
        {
            if (input == null)
            {
                return(false);
            }

            return
                ((
                     FileId == input.FileId ||
                     (FileId != null &&
                      FileId.Equals(input.FileId))
                     ) &&
                 (
                     PageRange == input.PageRange ||
                     (PageRange != null &&
                      PageRange.Equals(input.PageRange))
                 ) &&
                 (
                     ScaleX == input.ScaleX ||
                     ScaleX.Equals(input.ScaleX)
                 ) &&
                 (
                     ScaleY == input.ScaleY ||
                     ScaleY.Equals(input.ScaleY)
                 ));
        }
示例#4
0
文件: Add.cs 项目: jeason0813/Asmodat
        /// <summary>
        /// adds range of new data points to series specified by name
        /// </summary>
        /// <typeparam name="TInvoker"></typeparam>
        /// <param name="name"></param>
        /// <param name="points"></param>
        /// <param name="Invoker"></param>
        public void AddRange(string name, DataPoint[] points, ChartValueType?XValueType = null, ChartValueType?YValueType = null)
        {
            if (points.Length <= 0)
            {
                return;
            }



            Invoker.Invoke((MethodInvoker)(() =>
            {
                double xMin = ScaleX.ViewMinimum;
                double xMax = ScaleX.ViewMaximum;


                foreach (DataPoint point in points)
                {
                    ChartMain.Series[name].Points.Add(point);


                    if (MinX == null || MinX.XValue > point.XValue)
                    {
                        MinX = point;
                    }
                    if (MaxX == null || MaxX.XValue < point.XValue)
                    {
                        MaxX = point;
                    }
                }

                if (XValueType != null)
                {
                    ChartMain.Series[name].XValueType = (ChartValueType)XValueType;
                }
                if (YValueType != null)
                {
                    ChartMain.Series[name].YValueType = (ChartValueType)YValueType;
                }

                Area.AxisX.IsStartedFromZero = false;
                Area.AxisY.IsStartedFromZero = false;
                Area.RecalculateAxesScale();
                Area.RecalculateAxesScale();


                DataPoint last = ChartMain.Series[name].Points.Last();
                if (!Doubles.IsNaN(xMax, xMin) && last.XValue > xMax)
                {
                    double change = (xMax - last.XValue);
                    ScaleX.Zoom(xMin + change, last.XValue);
                }


                this.RescaleY();
            }));

            UpdateTime.SetNow();
        }
示例#5
0
 private void hideTransform()
 {
     label1.Hide(); label4.Hide(); label7.Hide();
     label2.Hide(); label5.Hide(); label8.Hide();
     label3.Hide(); label6.Hide(); label9.Hide();
     LocationX.Hide(); LocationY.Hide(); LocationZ.Hide();
     RotationRoll.Hide(); RotationYaw.Hide(); RotationPitch.Hide();
     ScaleX.Hide(); ScaleY.Hide(); ScaleZ.Hide();
 }
示例#6
0
 /// <summary>
 /// Сохраняются настройки компонента
 /// </summary>
 /// <param name="node">Узел с настройками</param>
 public void SaveState(XmlElement node)
 {
     node.RemoveAll();
     node.SetAttribute("ScaleX", ScaleX.ToString());
     node.SetAttribute("ScaleY", ScaleY.ToString());
     if (viewChannelsGrid != null)
     {
         viewChannelsGrid.SaveState(node.AppendChild(node.OwnerDocument.CreateElement("Channels")) as XmlElement);
     }
 }
            public override int GetHashCode()
            {
                int hashCode = -1889935131;

                hashCode = hashCode * -1521134295 + X.GetHashCode();
                hashCode = hashCode * -1521134295 + Y.GetHashCode();
                hashCode = hashCode * -1521134295 + Rotation.GetHashCode();
                hashCode = hashCode * -1521134295 + ScaleX.GetHashCode();
                hashCode = hashCode * -1521134295 + ScaleY.GetHashCode();
                return(hashCode);
            }
示例#8
0
        void ChartMain_MouseWheel(object sender, MouseEventArgs e)
        {
            Area.RecalculateAxesScale();
            double position = ChartMain.ChartAreas[0].AxisX.ScaleView.Position;
            double xMin     = ScaleX.ViewMinimum;
            double xMax     = ScaleX.ViewMaximum;
            double size     = xMax - xMin;// ChartMain.ChartAreas[0].AxisX.ScaleView.Size;

            //if (e.Location.X < 0 || e.Location.Y < 0)// || e.Location.X > 100 || e.Location.Y > 100)
            //   return;

            double cursor = 0;

            try
            {
                cursor = AxisX.PixelPositionToValue(e.Location.X);
            }
            catch { return; }

            double change = size / 3;

            double pXStart = double.NaN;
            double pXEnd   = double.NaN;

            if (e.Delta < 0 && RescaledPointsCount < ChartMain.Series[0].Points.Count)
            {
                pXStart = AxisX.PixelPositionToValue(e.Location.X) - change * 3;
                pXEnd   = AxisX.PixelPositionToValue(e.Location.X) + change * 3;

                ScaleX.Zoom(pXStart, pXEnd);
            }
            else if (e.Delta > 0 && RescaledPointsCount > 30)
            {
                pXStart = AxisX.PixelPositionToValue(e.Location.X) - change;
                pXEnd   = AxisX.PixelPositionToValue(e.Location.X) + change;
            }

            if (!Doubles.IsNaN(pXEnd, pXStart))
            {
                if (pXStart < MinX.XValue)
                {
                    pXStart = MinX.XValue;
                }
                if (pXEnd > MaxX.XValue)
                {
                    pXEnd = MaxX.XValue;
                }


                ScaleX.Zoom(pXStart, pXEnd);
                this.RescaleY();
            }
        }
示例#9
0
        public override int GetHashCode()
        {
            int hashCode = -62375069;

            hashCode = hashCode * -1521134295 + ScaleX.GetHashCode();
            hashCode = hashCode * -1521134295 + SkewX.GetHashCode();
            hashCode = hashCode * -1521134295 + TransX.GetHashCode();
            hashCode = hashCode * -1521134295 + SkewY.GetHashCode();
            hashCode = hashCode * -1521134295 + ScaleY.GetHashCode();
            hashCode = hashCode * -1521134295 + TransY.GetHashCode();
            hashCode = hashCode * -1521134295 + Persp0.GetHashCode();
            hashCode = hashCode * -1521134295 + Persp1.GetHashCode();
            hashCode = hashCode * -1521134295 + Persp2.GetHashCode();
            return(hashCode);
        }
示例#10
0
 public bool Equals(Matrix2D other)
 {
     if (other == null)
     {
         return(false);
     }
     return(ScaleX.Equals(other.ScaleX) &&
            SkewX.Equals(other.SkewX) &&
            TransX.Equals(other.TransX) &&
            SkewY.Equals(other.SkewY) &&
            ScaleY.Equals(other.ScaleY) &&
            TransY.Equals(other.TransY) &&
            Persp0.Equals(other.Persp0) &&
            Persp1.Equals(other.Persp1) &&
            Persp2.Equals(other.Persp2));
 }
示例#11
0
 private void ScaleX_MouseMove(object sender, MouseEventArgs e)
 {
     if (ScaleXispress)
     {
         Point point = ScaleX.PointToClient(Control.MousePosition);
         ScaleX.Text = (point.X + tempScaleX).ToString();
         var Proinstance = nodeGraph2.Nodes[Member];
         if (ProType.Equals("ADD"))
         {
         }
         else
         {
             (Proinstance.Properties[EditedPropertise] as ZDProperty_Transform).Value.Scale.X = Convert.ToSingle(ScaleX.Text);
         }
     }
 }
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         int hashCode = 41;
         if (FileId != null)
         {
             hashCode = hashCode * 59 + FileId.GetHashCode();
         }
         if (PageRange != null)
         {
             hashCode = hashCode * 59 + PageRange.GetHashCode();
         }
         hashCode = hashCode * 59 + ScaleX.GetHashCode();
         hashCode = hashCode * 59 + ScaleY.GetHashCode();
         return(hashCode);
     }
 }
示例#13
0
            /// <summary>
            /// JointName is only checked if in both objects JointName is not NULL. Everything else is checked regardless
            /// </summary>
            /// <param name="obj"></param>
            /// <returns></returns>
            public override bool Equals(object obj)
            {
                if (!(obj is BoneAnimation animation))
                {
                    return(false);
                }
                bool result = TranslationX.SequenceEqual(animation.TranslationX) &&
                              TranslationY.SequenceEqual(animation.TranslationY) &&
                              TranslationZ.SequenceEqual(animation.TranslationZ) &&
                              RotationX.SequenceEqual(animation.RotationX) &&
                              RotationY.SequenceEqual(animation.RotationY) &&
                              RotationZ.SequenceEqual(animation.RotationZ) &&
                              ScaleX.SequenceEqual(animation.ScaleX) &&
                              ScaleY.SequenceEqual(animation.ScaleY) &&
                              ScaleZ.SequenceEqual(animation.ScaleZ);

                return(result && ((JointName != null && animation.JointName != null) ? JointName.Equals(animation.JointName) : true));
            }
示例#14
0
            public Storyboard CreateHiding(OverlaidContent target)
            {
                var content         = (PictureViewContent)target;
                var duration        = 250;
                var exponentialEase = new ExponentialEase()
                {
                    EasingMode = EasingMode.EaseOut, Exponent = 5
                };
                var transform = content.PicturePreviewControl.GetTransformTo(content.SourceControl);

                ApplyUniformToFillRule(content.PicturePreviewControl.RenderSize, content.SourceControl.RenderSize, transform);

                var translateX = new TranslateX(content.PicturePreviewControl)
                {
                    To = transform.TranslateX, Duration = duration, EasingFunction = exponentialEase
                };
                var translateY = new TranslateY(content.PicturePreviewControl)
                {
                    To = transform.TranslateY, Duration = duration, EasingFunction = exponentialEase
                };
                var scaleX = new ScaleX(content.PicturePreviewControl)
                {
                    From = 1, To = transform.ScaleX, Duration = duration, EasingFunction = exponentialEase
                };
                var scaleY = new ScaleY(content.PicturePreviewControl)
                {
                    From = 1, To = transform.ScaleY, Duration = duration, EasingFunction = exponentialEase
                };
                var background = new ValueSetterAnimation(content.LayoutControl, nameof(Background))
                {
                    Value = new SolidColorBrush(Colors.Transparent)
                };

                var storyboard = new Storyboard();

                storyboard.Children.Add(translateX.GetTimeline());
                storyboard.Children.Add(translateY.GetTimeline());
                storyboard.Children.Add(scaleX.GetTimeline());
                storyboard.Children.Add(scaleY.GetTimeline());
                storyboard.Children.Add(background.GetTimeline());
                return(storyboard);
            }
示例#15
0
        internal void Write(EndianBinaryWriter writer)
        {
            writer.Write((short)Shader);
            writer.Write(UnkownFlag);

            ScaleXOrigin.Write(writer);
            ScaleYOrigin.Write(writer);

            PositionX.Write(writer);
            PositionY.Write(writer);

            Rotation.Write(writer);

            ScaleX.Write(writer);
            ScaleY.Write(writer);

            Opacity.Write(writer);

            writer.Write(UnknownInt);
        }
示例#16
0
        public void DisplayInfo(Player p)
        {
            p.Message("Bot {0} &S({1}) has:", ColoredName, name);
            p.Message("  Owner: &f{0}", string.IsNullOrEmpty(Owner) ? "no one" : p.FormatNick(Owner));
            if (!String.IsNullOrEmpty(AIName))
            {
                p.Message("  AI: &f{0}", AIName);
            }
            if (hunt || kill)
            {
                p.Message("  Hunt: &f{0}&S, Kill: %f{1}", hunt, kill);
            }
            if (SkinName != name)
            {
                p.Message("  Skin: &f{0}", SkinName);
            }
            if (Model != "humanoid")
            {
                p.Message("  Model: &f{0}", Model);
            }
            if (!(ScaleX == 0 && ScaleY == 0 && ScaleZ == 0))
            {
                p.Message("  X scale: &a{0}&S, Y scale: &a{1}&S, Z scale: &a{2}",
                          ScaleX == 0 ? "none" : ScaleX.ToString(),
                          ScaleY == 0 ? "none" : ScaleY.ToString(),
                          ScaleZ == 0 ? "none" : ScaleZ.ToString()
                          );
            }

            if (String.IsNullOrEmpty(ClickedOnText))
            {
                return;
            }
            ItemPerms perms = CommandExtraPerms.Find("About", 1) ?? new ItemPerms(LevelPermission.AdvBuilder);

            if (!perms.UsableBy(p.Rank))
            {
                return;                          //don't show bot's ClickedOnText if player isn't allowed to see message block contents
            }
            p.Message("  Clicked-on text: {0}", ClickedOnText);
        }
示例#17
0
        private Storyboard CreateInteractionIndicationAnimation()
        {
            var scaleX = new ScaleX(LayoutControl)
            {
                From = 1, To = 1.3, Duration = 250, EasingFunction = new BackEase()
                {
                    EasingMode = EasingMode.EaseOut
                }
            };
            var scaleY = new ScaleY(LayoutControl)
            {
                From = 1, To = 1.3, Duration = 250, EasingFunction = new BackEase()
                {
                    EasingMode = EasingMode.EaseOut
                }
            };

            var storyboard = new Storyboard();

            storyboard.Children.Add(scaleX.GetTimeline());
            storyboard.Children.Add(scaleY.GetTimeline());
            return(storyboard);
        }
        internal void Write(EndianBinaryWriter writer)
        {
            TransferMode.Write(writer);

            if (writer.AddressSpace == AddressSpace.Int64)
            {
                writer.WriteNulls(4);
            }

            AnchorX.Write(writer);
            AnchorY.Write(writer);
            PositionX.Write(writer);
            PositionY.Write(writer);
            Rotation.Write(writer);
            ScaleX.Write(writer);
            ScaleY.Write(writer);
            Opacity.Write(writer);

            writer.ScheduleWriteOffsetIf(Video3D != null, 8, AlignmentMode.Left, () =>
            {
                Video3D.Write(writer);
            });
        }
        internal void Read(EndianBinaryReader reader)
        {
            TransferMode.Read(reader);

            if (reader.AddressSpace == AddressSpace.Int64)
            {
                reader.SeekCurrent(4);
            }

            AnchorX.Read(reader);
            AnchorY.Read(reader);
            PositionX.Read(reader);
            PositionY.Read(reader);
            Rotation.Read(reader);
            ScaleX.Read(reader);
            ScaleY.Read(reader);
            Opacity.Read(reader);

            reader.ReadOffset(() =>
            {
                Video3D = new LayerVideo3D();
                Video3D.Read(reader);
            });
        }
示例#20
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));
    }
示例#21
0
        public string ToRawAss(string styleFormat = DefaultAssStyleFormat)
        {
            var sb = new StringBuilder();

            sb.Append("Style: ");
            var format = styleFormat.ToLowerInvariant().Substring(8).Split(',');

            for (int i = 0; i < format.Length; i++)
            {
                string f = format[i].Trim();
                if (f == "name")
                {
                    sb.Append(Name);
                }
                else if (f == "fontname")
                {
                    sb.Append(FontName);
                }
                else if (f == "fontsize")
                {
                    sb.Append(FontSize.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "primarycolour")
                {
                    sb.Append(AdvancedSubStationAlpha.GetSsaColorString(Primary));
                }
                else if (f == "secondarycolour")
                {
                    sb.Append(AdvancedSubStationAlpha.GetSsaColorString(Secondary));
                }
                else if (f == "outlinecolour")
                {
                    sb.Append(AdvancedSubStationAlpha.GetSsaColorString(Outline));
                }
                else if (f == "backcolour")
                {
                    sb.Append(AdvancedSubStationAlpha.GetSsaColorString(Background));
                }
                else if (f == "bold")
                {
                    sb.Append(BoolToRawSsa(Bold));
                }
                else if (f == "italic")
                {
                    sb.Append(BoolToRawSsa(Italic));
                }
                else if (f == "underline")
                {
                    sb.Append(BoolToRawSsa(Underline));
                }
                else if (f == "strikeout")
                {
                    sb.Append(BoolToRawSsa(Strikeout));
                }
                else if (f == "outline")
                {
                    sb.Append(OutlineWidth.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "shadow")
                {
                    sb.Append(ShadowWidth.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "alignment")
                {
                    sb.Append(Alignment);
                }
                else if (f == "marginl")
                {
                    sb.Append(MarginLeft);
                }
                else if (f == "marginr")
                {
                    sb.Append(MarginRight);
                }
                else if (f == "marginv")
                {
                    sb.Append(MarginVertical);
                }
                else if (f == "borderstyle")
                {
                    sb.Append(BorderStyle);
                }
                else if (f == "encoding")
                {
                    sb.Append('1');
                }
                else if (f == "strikeout")
                {
                    sb.Append('0');
                }
                else if (f == "scalex")
                {
                    sb.Append(ScaleX.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "scaley")
                {
                    sb.Append(ScaleY.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "spacing")
                {
                    sb.Append(Spacing.ToString(CultureInfo.InvariantCulture));
                }
                else if (f == "angle")
                {
                    sb.Append(Angle.ToString(CultureInfo.InvariantCulture));
                }

                sb.Append(',');
            }

            var s = sb.ToString().Trim();

            return(s.Substring(0, s.Length - 1));
        }
示例#22
0
        public void UpdateRange <TInvoker>(TInvoker Invoker, string name, DataPoint[] points, ChartValueType?XValueType = null, ChartValueType?YValueType = null) where TInvoker : Control
        {
            if (points.Length <= 0)
            {
                return;
            }

            if (Invoker != null)
            {
                //lock (Locker[ChartMain])
                Abbreviate.FormsControls.Invoke(Invoker, () => UpdateRange <TInvoker>(null, name, points, XValueType, YValueType));
                UpdateTime.SetNow();
                return;
            }



            double xMin = ScaleX.ViewMinimum;
            double xMax = ScaleX.ViewMaximum;

            bool found = false;

            foreach (DataPoint point in points)
            {
                found = false;
                for (int i = ChartMain.Series[name].Points.Count - 1; i >= 0; i--)
                {
                    if (ChartMain.Series[name].Points[i].XValue == point.XValue)
                    {
                        ChartMain.Series[name].Points[i] = point;
                        found = true;
                        break;
                    }
                }
                //else if (ChartMain.Series[name].Points[i].XValue < point.XValue) break;

                if (!found)
                {
                    ChartMain.Series[name].Points.Add(point);
                }


                if (MinX == null || MinX.XValue > point.XValue)
                {
                    MinX = point;
                }
                if (MaxX == null || MaxX.XValue < point.XValue)
                {
                    MaxX = point;
                }
            }

            if (XValueType != null)
            {
                ChartMain.Series[name].XValueType = (ChartValueType)XValueType;
            }
            if (YValueType != null)
            {
                ChartMain.Series[name].YValueType = (ChartValueType)YValueType;
            }

            Area.AxisX.IsStartedFromZero = false;
            Area.AxisY.IsStartedFromZero = false;
            Area.RecalculateAxesScale();
            Area.RecalculateAxesScale();


            DataPoint last = ChartMain.Series[name].Points.Last();

            if (!Doubles.IsNaN(xMax, xMin) && last.XValue > xMax)
            {
                double change = (xMax - last.XValue);
                ScaleX.Zoom(xMin + change, last.XValue);
            }


            this.RescaleY();
        }
示例#23
0
        void ChartMain_MouseWheel(object sender, MouseEventArgs e)
        {
            if (ChartMain.Series.IsNullOrEmpty())
            {
                return;
            }

            ZoomPointNow = (Point2D)MousePosition;


            Area.RecalculateAxesScale();
            double position = ChartMain.ChartAreas[0].AxisX.ScaleView.Position;
            double xMin     = ScaleX.ViewMinimum;
            double xMax     = ScaleX.ViewMaximum;
            double size     = xMax - xMin;// ChartMain.ChartAreas[0].AxisX.ScaleView.Size;

            //if (e.Location.X < 0 || e.Location.Y < 0)// || e.Location.X > 100 || e.Location.Y > 100)
            //   return;

            double cursor = 0;

            try
            {
                cursor = AxisX.PixelPositionToValue(e.Location.X);
            }
            catch { return; }

            double change = size / 3;

            double pXStart = double.NaN;
            double pXEnd   = double.NaN;

            int    locationX     = e.Location.X;
            double positionValue = AxisX.PixelPositionToValue(locationX);

            //If mouse is not moved zoom toward origin cursor
            if (ZoomPointOrigin == ZoomPointNow)
            {
                positionValue = CursorPosition.X;
            }



            if (e.Delta < 0 && RescaledPointsCount < ChartMain.Series[0].Points.Count)
            {
                pXStart = positionValue - change * 3;
                pXEnd   = positionValue + change * 3;

                ScaleX.Zoom(pXStart, pXEnd);
            }
            else if (e.Delta > 0 && RescaledPointsCount > 30)
            {
                pXStart = positionValue - change;
                pXEnd   = positionValue + change;
            }

            if (!Doubles.IsNaN(pXEnd, pXStart))
            {
                if (pXStart < MinX.XValue)
                {
                    pXStart = MinX.XValue;
                }
                if (pXEnd > MaxX.XValue)
                {
                    pXEnd = MaxX.XValue;
                }


                ScaleX.Zoom(pXStart, pXEnd);
                this.RescaleY();
            }

            ZoomPointOrigin = (Point2D)MousePosition;
        }