コード例 #1
0
        // Done!
        private static void TranslateShape(Point location, WorkAreaState was)
        {
            float dx = was.LastMousePosition.X - location.X;
            float dy = was.LastMousePosition.Y - location.Y;

            was.SelectedShape.ConcreteNode.Translate(dx, dy, 0, was.Scale);
        }
コード例 #2
0
 // Done!
 private static void SafeInvoker(EventHandler eh, WorkAreaState was)
 {
     if (eh != null)
     {
         eh.Invoke(was, null);
     }
 }
コード例 #3
0
        // Done!
        private static void TranslateVector(Point location, Vector v, WorkAreaState was)
        {
            float dx = was.LastMousePosition.X - location.X;
            float dy = was.LastMousePosition.Y - location.Y;

            v.Translate(dx, dy, 0, was.Scale);
        }
コード例 #4
0
 // Done!
 private static Artifact SetState(WorkAreaState was, Artifact a)
 {
     if (a == Artifact.None)
     {
         return(was.SelectedArtifact = a);
     }
     return(was.SelectedArtifact = was.LastSelectedArtifact = a);
 }
コード例 #5
0
        // Done!
        private void MoveAll(Point p, WorkAreaState was)
        {
            float dx = was.LastMousePosition.X - p.X;
            float dy = was.LastMousePosition.Y - p.Y;

            was.DeltaX -= dx;
            was.DeltaY -= dy;
            was.DeltaZ -= 0;

            this.ComposeImageGuide();
            this.ForceUpdate();
        }
コード例 #6
0
 // Done!
 private static Artifact GetDetectedArtifact(WorkAreaState was)
 {
     if (was.SelectedExit != null)
     {
         return(Artifact.Exit);
     }
     if (was.SelectedAnchor != null)
     {
         return(Artifact.Anchor);
     }
     return(was.SelectedShape != null ? Artifact.Geometry : Artifact.None);
 }
コード例 #7
0
        // Done!
        private void SetScale(WorkAreaState was)
        {
            var v = was.Scale;

            if (v == 1)
            {
                this.scale.Value = 0;
            }
            else if (v > 0)
            {
                this.scale.Value = (int)(was.Scale - 1);
            }
            else if (v < 0)
            {
                this.scale.Value = (int)-(Math.Pow(was.Scale, -1) + 1);
            }
        }
コード例 #8
0
        //// Done!
        //[Conditional(Constants.ConditionalDebug)]
        //private void GenerateData()
        //{
        //    Random r = new Random();

        //    int count1 = r.Next(2, 6);
        //    const int offset = 0;

        //    for (int i = 0; i < count1; ++i)
        //    {
        //        // Generate Node and VisualMapNode
        //        var node = new MapNode(Name = i.ToString(), NodeType.Geometry) { Level = 0 };
        //        var vmn = new VisualMapNode() { Visuals = new MapVisuals { Geometry = Helpers.GeneratePen(r) }, ConcreteNode = node };

        //        // Generate Geometry
        //        int count2 = r.Next(2, 6);
        //        for (int k = 0; k < count2; ++k)
        //        {
        //            node.Geometry.Add(new Vector(r.Next(offset, this.nodeController.Width), r.Next(offset, this.nodeController.Height)));
        //        }

        //        if (VisualMap.Count > 0)
        //        {
        //            // Generate Exits
        //            int count3 = r.Next(2, 6);
        //            for (int k = 0; k < count3; ++k)
        //            {
        //                var e = new MapNode(NodeType.Exit)
        //                {
        //                    Level = 0,
        //                    Parent = node,
        //                    Location = new Vector(r.Next(offset, this.nodeController.Width), r.Next(offset, this.nodeController.Height)),

        //                };
        //                e.Exits.Add(VisualMap[r.Next(0, VisualMap.Count - 1)].ConcreteNode);
        //                node.Exits.Add(e);
        //            }
        //        }

        //        VisualMap.Add(vmn);
        //    }
        //}

        #endregion

        // Done!
        #region Events

        // Done!
        #region Other

        // Done!
        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);
            this.drawArea = new RectangleF(0, 0, this.workArea.Width, this.workArea.Height);
            if (this.WorkAreaState != null)
            {
                if (this.workArea.Width != 0 && this.workArea.Height != 0)
                {
                    this.WorkAreaState.Width  = this.workArea.Width;
                    this.WorkAreaState.Height = this.workArea.Height;
                }
                this.WorkAreaState.IsDirty = true;
                this.ComposeImageGuide();
            }

            if (this.WorkAreaState != null && this.WorkAreaState.HighQuality == true)
            {
                this.WorkAreaState = WorkAreaState.LowQuality(this.WorkAreaState);
                this.ForceUpdate();
                return;
            }

            this.ForceUpdate();
        }
コード例 #9
0
 // Done!
 private static void TranslateExit(Point location, WorkAreaState was)
 {
     TranslateVector(location, was.SelectedExit.Location, was);
 }
コード例 #10
0
        // Done!
        #region Translate

        // Done!
        private static void TranslateAnchor(Point location, WorkAreaState was)
        {
            TranslateVector(location, was.SelectedAnchor, was);
        }