Exemplo n.º 1
0
        public bool Noi2Objs(CFOUNDNODE pFoundNode)
        {
            bool result = false;

            checked
            {
                if (pFoundNode.FoundObject.GetObjType() == OBJECTTYPE.Curve | pFoundNode.FoundObject.GetObjType() == OBJECTTYPE.Line)
                {
                    NodesShapeGraphic nodesShapeGraphic = (NodesShapeGraphic)pFoundNode.FoundObject;
                    if (pFoundNode.NodeIndex == 0 | pFoundNode.NodeIndex == nodesShapeGraphic.Nodes.Count - 1)
                    {
                        CFOUNDNODE cFOUNDNODE = this.Tim2ndNode(pFoundNode);
                        if (pFoundNode.NodeIndex == 0)
                        {
                            nodesShapeGraphic.ReverseNodes();
                        }
                        if (cFOUNDNODE.NodeIndex == 0)
                        {
                            NodesShapeGraphic nodesShapeGraphic2 = (NodesShapeGraphic)cFOUNDNODE.FoundObject;
                            if (nodesShapeGraphic2.Nodes.Count > 1)
                            {
                                int arg_A1_0 = 1;
                                int num      = nodesShapeGraphic2.Nodes.Count - 1;
                                for (int i = arg_A1_0; i <= num; i++)
                                {
                                    nodesShapeGraphic.Nodes.Add(nodesShapeGraphic2.Nodes[i]);
                                }
                            }
                            this.m_GObjs.Remove(cFOUNDNODE.FoundObject);
                            result = true;
                        }
                        else if (cFOUNDNODE.NodeIndex > 0)
                        {
                            NodesShapeGraphic nodesShapeGraphic3 = (NodesShapeGraphic)cFOUNDNODE.FoundObject;
                            if (nodesShapeGraphic3.Nodes.Count > 1)
                            {
                                for (int j = nodesShapeGraphic3.Nodes.Count - 2; j >= 0; j += -1)
                                {
                                    nodesShapeGraphic.Nodes.Add(nodesShapeGraphic3.Nodes[j]);
                                }
                            }
                            this.m_GObjs.Remove(cFOUNDNODE.FoundObject);
                            result = true;
                        }
                    }
                }
                return(result);
            }
        }
Exemplo n.º 2
0
        public CFOUNDNODE FindNodeAtPoint(AxMap pMap, PointF pt)
        {
            CFOUNDNODE cFOUNDNODE = new CFOUNDNODE();
            float      num        = (float)(this.m_Zoom / pMap.Zoom);

            num = Conversions.ToSingle(Operators.MultiplyObject(num, Interaction.IIf(this.m_MWidth > 0f, pMap.MapScreenWidth / this.m_MWidth, 1)));
            float num2;
            float num3;

            pMap.ConvertCoord(ref num2, ref num3, ref this.m_GocX, ref this.m_GocY, ConversionConstants.miMapToScreen);
            Matrix matrix = new Matrix();

            matrix.Translate(-num2, -num3, MatrixOrder.Append);
            matrix.Scale(1f / num, 1f / num, MatrixOrder.Append);
            PointF[] array = new PointF[]
            {
                pt
            };
            matrix.TransformPoints(array);
            PointF pt2 = new PointF(array[0].X, array[0].Y);

            checked
            {
                CFOUNDNODE result;
                for (int i = this.m_GObjs.Count - 1; i >= 0; i += -1)
                {
                    GraphicObject graphicObject = this.m_GObjs[i];
                    int           num4          = graphicObject.FindNodeAtPoint(pt2, 4f);
                    if (num4 > -1)
                    {
                        int nodeIndex = num4;
                        cFOUNDNODE.FoundObject = graphicObject;
                        cFOUNDNODE.NodeIndex   = nodeIndex;
                        result = cFOUNDNODE;
                        return(result);
                    }
                }
                result = null;
                return(result);
            }
        }
Exemplo n.º 3
0
        private CFOUNDNODE Tim2ndNode(CFOUNDNODE pFoundNode)
        {
            CFOUNDNODE cFOUNDNODE = new CFOUNDNODE();

            cFOUNDNODE.NodeIndex = -1;
            checked
            {
                try
                {
                    IEnumerator enumerator = this.m_GObjs.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        GraphicObject graphicObject = (GraphicObject)enumerator.Current;
                        if ((graphicObject.GetObjType() == OBJECTTYPE.Curve | graphicObject.GetObjType() == OBJECTTYPE.Line) && graphicObject != pFoundNode.FoundObject)
                        {
                            NodesShapeGraphic nodesShapeGraphic  = (NodesShapeGraphic)graphicObject;
                            NodesShapeGraphic nodesShapeGraphic2 = (NodesShapeGraphic)pFoundNode.FoundObject;
                            if (nodesShapeGraphic.Nodes[0].X == nodesShapeGraphic2.Nodes[pFoundNode.NodeIndex].X & nodesShapeGraphic.Nodes[0].Y == nodesShapeGraphic2.Nodes[pFoundNode.NodeIndex].Y)
                            {
                                cFOUNDNODE.FoundObject = graphicObject;
                                cFOUNDNODE.NodeIndex   = 0;
                            }
                            else if (nodesShapeGraphic.Nodes[nodesShapeGraphic.Nodes.Count - 1].X == nodesShapeGraphic2.Nodes[pFoundNode.NodeIndex].X & nodesShapeGraphic.Nodes[nodesShapeGraphic.Nodes.Count - 1].Y == nodesShapeGraphic2.Nodes[pFoundNode.NodeIndex].Y)
                            {
                                cFOUNDNODE.FoundObject = graphicObject;
                                cFOUNDNODE.NodeIndex   = nodesShapeGraphic.Nodes.Count - 1;
                            }
                        }
                    }
                }
                finally
                {
                    IEnumerator enumerator;
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                return(cFOUNDNODE);
            }
        }
Exemplo n.º 4
0
        public void MoveNodeTo(AxMap pMap, CFOUNDNODE ENode, PointF pt)
        {
            float num = (float)(this.m_Zoom / pMap.Zoom);

            num = Conversions.ToSingle(Operators.MultiplyObject(num, Interaction.IIf(this.m_MWidth > 0f, pMap.MapScreenWidth / this.m_MWidth, 1)));
            float num2;
            float num3;

            pMap.ConvertCoord(ref num2, ref num3, ref this.m_GocX, ref this.m_GocY, ConversionConstants.miMapToScreen);
            Matrix        matrix      = new Matrix();
            GraphicObject foundObject = ENode.FoundObject;

            matrix.Translate(-num2, -num3, MatrixOrder.Append);
            matrix.Scale(1f / num, 1f / num, MatrixOrder.Append);
            PointF[] array = new PointF[]
            {
                pt
            };
            matrix.TransformPoints(array);
            PointF pt2 = new PointF(array[0].X, array[0].Y);

            foundObject.MoveNodeTo(ENode.NodeIndex, pt2);
        }