Пример #1
0
        void renderer_GetNodeName(string nodeName)
        {
            GetNodeNameEventHandler temp = GetNodeName;

            if (temp != null)
            {
                temp(nodeName);
            }
        }
Пример #2
0
        internal void ProcessMouseCoordinates(object stateInfo)
        {
            KeyValuePair <MouseEventArgs, CultureInfo> kvp = (KeyValuePair <MouseEventArgs, CultureInfo>)stateInfo;
            MouseEventArgs e = kvp.Key;
            CultureInfo    currentCulture = kvp.Value;

            try
            {
                float absoluteX = (float)e.X / g.VisibleClipBounds.Width;
                float absoluteY = 1 - (float)e.Y / g.VisibleClipBounds.Height;

                float pointX;
                float pointY;
                float distance;

                List <TeleportNodeDistance> points = graphLayer.GetClosestPoint(absoluteX, absoluteY, out pointX, out pointY, out distance);

                if (distance < Settings.Default.MinimalDistanceToTeleportNode)
                {
                    Console.WriteLine("Hit mouse {0} {1}", absoluteX, absoluteY);
                    Console.WriteLine("Hit node at {0} {1}", pointX, pointY);

                    offScreenDC.DrawImage(offScreenInitialImage, 0, 0);

                    offScreenDC.DrawEllipse(pen, pointX * g.VisibleClipBounds.Width - 2, (1 - pointY) * g.VisibleClipBounds.Height - 2, 4, 4);
                    //offScreenDC.DrawEllipse(pen, kvp.Value.AbsoluteX * g.VisibleClipBounds.Width - 2, (1 - kvp.Value.AbsoluteY) * g.VisibleClipBounds.Height - 2, 4, 4);

                    //unsortedPoints.Sort(new TeleportPointDistanceComparer());
                    TeleportNode point = points[0].point;

                    DrawConnectedPaths(pen, point);

                    g.DrawImage(offScreenCurrentImage, 0, 0, g.VisibleClipBounds.Width, g.VisibleClipBounds.Height);

                    GetNodeNameEventHandler temp = GetNodeName;
                    if (temp != null)
                    {
                        temp(point.Names[currentCulture]);
                    }
                }
            }
            catch (InvalidOperationException ex)
            {
                InvalidOperationException ex2 = ex;
                //throw;
            }
        }