コード例 #1
0
 public float NodeDist(IssoPoint2D pt, ComponentNode node)
 {
     // Если точка pt лежит внутри области узла, возвращаем ноль - иначе
     // возвразаем расстояние от pt до Node.Location
     if (ComponentNodeVM.Contains(node, pt, surface))
     {
         return(0f);
     }
     else
     {
         return(IssoDist.PointDst(pt, node.Location));
     }
 }
コード例 #2
0
        internal ComponentBasic GetComponent(IssoPoint2D pt1, out IssoPoint2D pt2, ComponentTypes type = ComponentTypes.ctAny)
        {
            pt2 = new IssoPoint2D()
            {
                X = pt1.X, Y = pt1.Y
            };
            if (model.CompsList.Count == 0)
            {
                return(null);
            }

            int j = 0;

            for (int i = 0; i < model.CompsList.Count; i++)
            {
                switch (model.CompsList[i].CompType)
                {
                case ComponentTypes.ctNode:
                {
                    if ((type == ComponentTypes.ctAny) || (type == ComponentTypes.ctNode))
                    {
                        if (ComponentNodeVM.Contains((ComponentNode)model.CompsList[i], pt1, surface))
                        {
                            pt2 = ((ComponentNode)model.CompsList[i]).Location;
                            return(model.CompsList[i]);
                        }
                    }
                    break;
                }

                case ComponentTypes.ctLinear:
                {
                    if ((type == ComponentTypes.ctAny) || (type == ComponentTypes.ctLinear))
                    {
                        if (ComponentLinearVM.Contains((ComponentLinear)model.CompsList[i], pt1, surface))
                        {
                            pt2 = IssoDist.PurpPoint(pt1, (ComponentLinear)model.CompsList[i]);
                            return(model.CompsList[i]);
                        }
                    }
                    break;
                }

                case ComponentTypes.ctBinding:
                {
                    if ((type == ComponentTypes.ctAny) || (type == ComponentTypes.ctBinding))
                    {
                        if (IssoBindingVM.Contains((IssoBinding)model.CompsList[i], pt1, surface))
                        {
                            pt2 = ((IssoBinding)model.CompsList[i]).LinePlace;
                            return(model.CompsList[i]);
                        }
                    }
                    break;
                }

                case ComponentTypes.ctForce:
                case ComponentTypes.ctDistributedLoad:
                {
                    if ((type == ComponentTypes.ctAny) || (type == ComponentTypes.ctForce) || (type == ComponentTypes.ctDistributedLoad))
                    {
                        if (ComponentLoadVM.Contains((ComponentLoad)model.CompsList[i], pt1, surface))
                        {
                            pt2 = ((ComponentLoad)model.CompsList[i]).AppNodes[0].Location;
                            return(model.CompsList[i]);
                        }
                    }
                    break;
                }
                }
            }

            return(null);
        }