Ejemplo n.º 1
0
        public void BuildPhaseIncompatibleSection(Node strtNode, List<Node> disabledList, Dictionary<Point, List<Node>> pointList, Dictionary<Point, List<Section>> lineList, bool buildInCompatible = false)
        {
            Queue<Node> q = new Queue<Node>();
            if (strtNode != null)
            {
                q.Enqueue(strtNode);
                while (q.Count > 0)
                {
                    Node pnd = q.Dequeue();
                    if (pnd != null)
                    {
                        if (pnd.uid == "{9539f02b-8fa8-4a6e-8f12-ca630422009b}")
                        {

                        }
                        if (!StatusExtensions.IsDisabled(pnd.status))
                        {
                            double x1 = pnd.x;
                            double y1 = pnd.y;
                            int parentPhaseCode = pnd.phaseCode;
                            int xFloor = Convert.ToInt32(Math.Floor(x1));
                            int yFloor = Convert.ToInt32(Math.Floor(y1));
                            Point Pt1 = new Point(xFloor, yFloor);
                            var nearestSections = new List<Section>();
                            if (lineList.ContainsKey(Pt1)) nearestSections = lineList[Pt1];
                            var strtSec = from row in nearestSections
                                          where !ConnExists(row.uid) &&
                                          (ConnectionBuffer(row.x, row.y, x1, y1, row.tox, row.toy, row, true, false))
                                          select row;
                            foreach (var item in strtSec)
                            {
                                if (item.uid == "{9a7bdd5e-7203-4274-aa50-521306474f07}")
                                {

                                }
                                if (item.uid == "{b168c622-48f7-487d-afbb-193bbe730b7c}")
                                {

                                }
                                if (item.uid == "{050dd67b-3b9b-4f4d-9a84-d5b24eebdb52}")
                                {

                                }
                                if (ClassIDRules.IsAdjJunction(pnd))
                                {
                                    if (!ClassIDRules.AdjRuleSucceeds(pnd, item))
                                    {
                                        continue;
                                    }
                                }
                                Section sect = null;
                                Node cnd = null;
                                string sectGUID = item.uid;

                                if (!NetworkUtil.VerifyNodePCWithParents(pnd, -1, false))
                                {
                                    pnd.phaseCode = NetworkUtil.GetParentPCSum(pnd);
                                }
                                if (!NotIncompatible(pnd, item.phaseCode) && !buildInCompatible)
                                {
                                    phaseErrorQueue.Add(pnd);
                                    continue;
                                }
                                //NetworkUtil.DownsectionPCAdjustment(pnd, item);//not here later
                                _sectionGUIDList.Add(sectGUID);
                                double toX = item.tox;
                                double toY = item.toy;
                                if (StatusExtensions.IsAgainstFlow(item.status))
                                {
                                    toX = item.x;
                                    toY = item.y;
                                }
                                int ToxFloor = Convert.ToInt32(Math.Floor(toX));
                                int ToyFloor = Convert.ToInt32(Math.Floor(toY));
                                Point currentPt = new Point(ToxFloor, ToyFloor);
                                var nearestPoints = new List<Node>();
                                if (pointList.ContainsKey(currentPt)) nearestPoints = pointList[currentPt];
                                var childNodes = from row in nearestPoints
                                                 where (NodeBuffer(row.x, row.y, toX, toY))
                                                 select row;
                                string Child = null;
                                int CNPhaseCode = 0;
                                int CNStatus = Constants.Disconnected;
                                string uid = sectGUID;
                                if (!_sectionList.ContainsKey(sectGUID))
                                {
                                    sect = new Section();
                                    _sectionList.Add(sect.uid, sect);
                                    sect.uid = uid;
                                }
                                else
                                {
                                    sect = _sectionList[sectGUID];
                                }
                                int status = item.status;
                                int phaseCode = item.phaseCode;
                                sect.phaseCode = phaseCode;
                                sect.status = status;
                                if (childNodes.Count() == 0)
                                {
                                    double childX = toX;
                                    double childY = toY;
                                    Guid id = Guid.NewGuid();
                                    Child = "{" + id.ToString() + "}";
                                    CNPhaseCode = sect.phaseCode;
                                    cnd = new Node(Child, CNStatus, CNPhaseCode);
                                    UpdateNetJnStatus(cnd, status);
                                    CNStatus = cnd.status;
                                    cnd.phaseCode = CNPhaseCode;
                                    cnd.classID = -1;//ntInfo.networkClassIds[ClassIDRules.NetJunction];
                                    cnd.oid = -1;
                                    cnd.x = childX;
                                    cnd.y = childY;
                                    AddPointsToPointList(cnd, pointList);
                                    _nodeList.Add(Child, cnd);
                                    q.Enqueue(cnd);
                                    DataRow drNetJn = dtNetJnList.NewRow();
                                    drNetJn["x"] = childX;
                                    drNetJn["y"] = childY;
                                    drNetJn["Tox"] = DBNull.Value;
                                    drNetJn["Toy"] = DBNull.Value;
                                    drNetJn["oid"] = "-1";
                                    drNetJn["uid"] = Child;
                                    drNetJn["adjuid"] = DBNull.Value;
                                    drNetJn["phaseCode"] = CNPhaseCode;
                                    drNetJn["constructedphaseCode"] = CNPhaseCode;
                                    drNetJn["status"] = CNStatus;
                                    drNetJn["type"] = 0;
                                    drNetJn["ClassID"] = -1;//ntInfo.networkClassIds[ClassIDRules.NetJunction];
                                    dtNetJnList.Rows.Add(drNetJn);
                                }
                                else
                                {
                                    foreach (var drChild in childNodes)//always one child will be considered
                                    {
                                        if (drChild.uid == "{1669a2ce-2e60-460d-95eb-8e1e9fc07c15}")
                                        {

                                        }
                                        if (drChild.isAdj)
                                        {
                                            continue; }
                                        if (ClassIDRules.IsAdjGroupNode(drChild))
                                        {
                                            drChild.isAdj = true;
                                            double childX = toX;
                                            double childY = toY;
                                            Guid id = Guid.NewGuid();
                                            Child = "{" + id.ToString() + "}";
                                            CNPhaseCode = sect.phaseCode;
                                            cnd = new Node(Child, CNStatus, CNPhaseCode);
                                            UpdateNetJnStatus(cnd, status);
                                            CNStatus = cnd.status;
                                            cnd.phaseCode = CNPhaseCode;
                                            cnd.classID = -1;
                                            cnd.oid = -1;
                                            cnd.x = childX;
                                            cnd.y = childY;
                                            AddPointsToPointList(cnd, pointList);
                                            _nodeList.Add(Child, cnd);
                                            q.Enqueue(cnd);
                                            DataRow drNetJn = dtNetJnList.NewRow();
                                            drNetJn["x"] = childX;
                                            drNetJn["y"] = childY;
                                            drNetJn["Tox"] = DBNull.Value;
                                            drNetJn["Toy"] = DBNull.Value;
                                            drNetJn["oid"] = "-1";
                                            drNetJn["uid"] = Child;
                                            drNetJn["adjuid"] = drChild.uid;
                                            drNetJn["phaseCode"] = CNPhaseCode;
                                            drNetJn["constructedphaseCode"] = CNPhaseCode;
                                            drNetJn["status"] = CNStatus;
                                            drNetJn["type"] = 0;
                                            drNetJn["ClassID"] = -1;
                                            dtNetJnList.Rows.Add(drNetJn);
                                            cnd.adjacentNode = drChild;
                                            q.Enqueue(drChild);
                                        }
                                        else
                                        {
                                            UpdateNodeStatus(drChild, true);
                                            cnd = drChild;
                                            Child = drChild.uid;
                                            q.Enqueue(drChild);
                                        }
                                        break;
                                    }
                                }
                                UpdateNodeStatus(pnd, true, false);
                                sect.parentNode = pnd;
                                sect.childNode = cnd;
                                if (pnd.childList.ContainsKey(sect.uid))
                                {
                                    pnd.childList.Remove(sect.uid);
                                    pnd.childList.Add(sect.uid, sect);
                                }
                                else pnd.childList.Add(sect.uid, sect);
                                if (cnd.parentList.ContainsKey(sect.uid))
                                {
                                    cnd.parentList.Remove(sect.uid);
                                    cnd.parentList.Add(sect.uid, sect);
                                }
                                else cnd.parentList.Add(sect.uid, sect);
                                if (ContainsAdjNode(cnd))
                                {
                                    if (cnd.adjacentNode.parentList.ContainsKey(sect.uid))
                                    {
                                        cnd.adjacentNode.parentList.Remove(sect.uid);
                                        cnd.adjacentNode.parentList.Add(sect.uid, sect);
                                    }
                                    else cnd.adjacentNode.parentList.Add(sect.uid, sect);
                                }
                            }
                        }
                        else
                        {
                            disabledList.Add(pnd);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void AddPointsToLineList(Section dr, Dictionary<Point, List<Section>> lineList)
        {
            int xFloor = Convert.ToInt32(Math.Floor(dr.x));
            int xCeiling = Convert.ToInt32(Math.Ceiling(dr.x));

            int yFloor = Convert.ToInt32(Math.Floor(dr.y));
            int yCeiling = Convert.ToInt32(Math.Ceiling(dr.y));

            int toxFloor = Convert.ToInt32(Math.Floor(dr.tox));
            int toxCeiling = Convert.ToInt32(Math.Ceiling(dr.tox));

            int toyFloor = Convert.ToInt32(Math.Floor(dr.toy));
            int toyCeiling = Convert.ToInt32(Math.Ceiling(dr.toy));

            //add same section as value to 8 key points
            //1,2 xfloor
            Point Pt = new Point(xFloor, yFloor);
            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
            Pt = new Point(xFloor, yCeiling);
            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
            //3, 4 xceiling
            Pt = new Point(xCeiling, yFloor);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }

            Pt = new Point(xCeiling, yCeiling);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }

            //5, 6 ToxFloor
            Pt = new Point(toxFloor, toyFloor);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
            Pt = new Point(toxFloor, toyCeiling);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }

            //7, 8 ToxCeiling
            Pt = new Point(toxCeiling, toyFloor);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
            Pt = new Point(toxFloor, toyCeiling);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
        }
Ejemplo n.º 3
0
 public void BuildDisconnected(Queue<Node> q, Dictionary<Point, List<Node>> pointList, Dictionary<Point, List<Section>> lineList)
 {
     while (q.Count > 0)
     {
         bool isAdjNode = false;
         Node pnd = q.Dequeue();
         Node adjNode = null;
         string adjUID = "";
         if (pnd != null)
         {
             double x1 = pnd.x;
             double y1 = pnd.y;
             int parentPhaseCode = pnd.phaseCode;
             int xFloor = Convert.ToInt32(Math.Floor(x1));
             int yFloor = Convert.ToInt32(Math.Floor(y1));
             Point Pt1 = new Point(xFloor, yFloor);
             var nearestSections = new List<Section>();
             if (lineList.ContainsKey(Pt1)) nearestSections = lineList[Pt1];
             var strtSec = from row in nearestSections
                           where !ConnExists(row.uid) &&
                           (ConnectionBufferDisconnected(row.x, row.y, x1, y1, row.tox, row.toy, row))
                           select row;
             foreach (var item in strtSec)
             {
                 if (ClassIDRules.IsAdjJunction(pnd))
                 {
                     if (!ClassIDRules.AdjRuleSucceeds(pnd, item)) continue;
                 }
                 Section sect = null;
                 Node cnd = null;
                 string sectGUID = item.uid;
                 _sectionGUIDList.Add(sectGUID);
                 double toX = item.tox;
                 double toY = item.toy;
                 if (StatusExtensions.IsAgainstFlow(item.status))
                 {
                     toX = item.x;
                     toY = item.y;
                 }
                 int ToxFloor = Convert.ToInt32(Math.Floor(toX));
                 int ToyFloor = Convert.ToInt32(Math.Floor(toY));
                 Point currentPt = new Point(ToxFloor, ToyFloor);
                 var nearestPoints = new List<Node>();
                 if (pointList.ContainsKey(currentPt)) nearestPoints = pointList[currentPt];
                 var childNodes = from row in nearestPoints
                                  where (NodeBuffer(row.x, row.y, toX, toY))
                                  select row;
                 string Child = null;
                 int CNPhaseCode = 0;
                 int CNStatus = Constants.Disconnected;
                 string uid = sectGUID;
                 if (!_sectionList.ContainsKey(sectGUID))
                 {
                     sect = new Section();
                     _sectionList.Add(sect.uid, sect);
                     sect.uid = uid;
                 }
                 else
                 {
                     sect = _sectionList[sectGUID];
                 }
                 int status = item.status;
                 int phaseCode = item.phaseCode;
                 sect.phaseCode = phaseCode;
                 sect.status = status;
                 if (childNodes.Count() == 0)
                 {
                     double childX = toX;
                     double childY = toY;
                     Guid id = Guid.NewGuid();
                     Child = "{" + id.ToString() + "}";
                     CNPhaseCode = sect.phaseCode;
                     cnd = new Node(Child, CNStatus, CNPhaseCode);
                     UpdateNetJnStatus(cnd, status);
                     CNStatus = cnd.status;
                     cnd.phaseCode = CNPhaseCode;
                     cnd.classID = -1;//ntInfo.networkClassIds[ClassIDRules.NetJunction];
                     cnd.oid = -1;
                     cnd.x = childX;
                     cnd.y = childY;
                     AddPointsToPointList(cnd, pointList);
                     _nodeList.Add(Child, cnd);
                     q.Enqueue(cnd);
                     DataRow drNetJn = dtNetJnList.NewRow();
                     drNetJn["x"] = childX;
                     drNetJn["y"] = childY;
                     drNetJn["Tox"] = DBNull.Value;
                     drNetJn["Toy"] = DBNull.Value;
                     drNetJn["oid"] = "-1";
                     drNetJn["uid"] = Child;
                     drNetJn["adjuid"] = DBNull.Value;
                     drNetJn["phaseCode"] = CNPhaseCode;
                     drNetJn["status"] = CNStatus;
                     drNetJn["type"] = 0;
                     drNetJn["ClassID"] = -1;//ntInfo.networkClassIds[ClassIDRules.NetJunction];
                     dtNetJnList.Rows.Add(drNetJn);
                 }
                 else
                 {
                     foreach (var drChild in childNodes)//always one child will be considered
                     {
                         if (drChild.isAdj) { continue; }
                         if (ClassIDRules.IsAdjGroupNode(drChild))
                         {
                             drChild.isAdj = true;
                             double childX = toX;
                             double childY = toY;
                             Guid id = Guid.NewGuid();
                             Child = "{" + id.ToString() + "}";
                             CNPhaseCode = sect.phaseCode;
                             cnd = new Node(Child, CNStatus, CNPhaseCode);
                             UpdateNetJnStatus(cnd, status);
                             CNStatus = cnd.status;
                             cnd.phaseCode = CNPhaseCode;
                             cnd.classID = -1;//ntInfo.networkClassIds[ClassIDRules.NetJunction];
                             cnd.oid = -1;
                             cnd.x = childX;
                             cnd.y = childY;
                             AddPointsToPointList(cnd, pointList);
                             _nodeList.Add(Child, cnd);
                             q.Enqueue(cnd);
                             DataRow drNetJn = dtNetJnList.NewRow();
                             drNetJn["x"] = childX;
                             drNetJn["y"] = childY;
                             drNetJn["Tox"] = DBNull.Value;
                             drNetJn["Toy"] = DBNull.Value;
                             drNetJn["oid"] = "-1";
                             drNetJn["uid"] = Child;
                             drNetJn["adjuid"] = drChild.uid;
                             drNetJn["phaseCode"] = CNPhaseCode;
                             drNetJn["status"] = CNStatus;
                             drNetJn["type"] = 0;
                             drNetJn["ClassID"] = -1;
                             dtNetJnList.Rows.Add(drNetJn);
                             cnd.adjacentNode = drChild;
                             q.Enqueue(drChild);
                         }
                         else
                         {
                             cnd = drChild;
                             Child = drChild.uid;
                             q.Enqueue(drChild);
                         }
                         break;
                     }
                 }
                 sect.parentNode = pnd;
                 sect.childNode = cnd;
                 if (pnd.childList.ContainsKey(sect.uid))
                 {
                     pnd.childList.Remove(sect.uid);
                     pnd.childList.Add(sect.uid, sect);
                 }
                 else pnd.childList.Add(sect.uid, sect);
                 if (cnd.parentList.ContainsKey(sect.uid))
                 {
                     cnd.parentList.Remove(sect.uid);
                     cnd.parentList.Add(sect.uid, sect);
                 }
                 else cnd.parentList.Add(sect.uid, sect);
                 if (ContainsAdjNode(cnd))
                 {
                     if (cnd.adjacentNode.parentList.ContainsKey(sect.uid))
                     {
                         cnd.adjacentNode.parentList.Remove(sect.uid);
                         cnd.adjacentNode.parentList.Add(sect.uid, sect);
                     }
                     else cnd.adjacentNode.parentList.Add(sect.uid, sect);
                 }
             }
         }
     }
 }
Ejemplo n.º 4
0
 public bool ConnectionBufferDisconnected(double x1, double y1, double a, double b, double x2, double y2, Section dr)
 {
     int existingStatus = dr.status;
     bool ans1 = ((Math.Pow(x1 - a, 2) + Math.Pow(y1 - b, 2)) < (ntInfo.snappingTolerance * ntInfo.snappingTolerance));
     bool ans2 = ((Math.Pow(x2 - a, 2) + Math.Pow(y2 - b, 2)) < (ntInfo.snappingTolerance * ntInfo.snappingTolerance));
     //dr.status = StatusExtensions.Connect(existingStatus);
     if (ans1 && existingStatus == (Constants.Disconnected))
     {
         dr.status = Constants.WithFlow + Constants.Disconnected;
     }
     else if (ans2 && existingStatus == (Constants.Disconnected))
     {
         dr.status = Constants.AgainstFlow + Constants.Disconnected;
     }
     else
     {
         if (ans1)
         {
             dr.status = Constants.WithFlow + Constants.Disconnected;
         }
         else if (ans2)
         {
             dr.status = Constants.AgainstFlow + Constants.Disconnected;
         }
     }
     return ans1 || ans2;
 }
Ejemplo n.º 5
0
        public void BuildConnection(Node strtNode, List<Node> disabledList, Dictionary<Point, List<Node>> pointList, Dictionary<Point, List<Section>> lineList, bool BuildUnenergized)
        {
            bool firstNode = true;
            Queue<Node> q = new Queue<Node>();
            if (strtNode != null)
            {
                q.Enqueue(strtNode);
                while (q.Count > 0)
                {
                    Node pnd = q.Dequeue();
                    if (pnd != null)
                    {
                        if (pnd.uid == "{2848a674-18a9-4238-bd97-943a3c6f0f15}")
                        {

                        }
                        if (!StatusExtensions.IsDisabled(pnd.status) || (firstNode && BuildUnenergized))
                        {
                            firstNode = false;
                            double x1 = pnd.x;
                            double y1 = pnd.y;
                            int parentPhaseCode = pnd.phaseCode;
                            int xFloor = Convert.ToInt32(Math.Floor(x1));
                            int yFloor = Convert.ToInt32(Math.Floor(y1));
                            Point Pt1 = new Point(xFloor, yFloor);
                            var nearestSections = new List<Section>();
                            if (lineList.ContainsKey(Pt1)) nearestSections = lineList[Pt1];
                            var strtSec = from row in nearestSections
                                          where !ConnExists(row.uid) &&
                                          (ConnectionBuffer(row.x, row.y, x1, y1, row.tox, row.toy, row, BuildUnenergized))
                                          select row;
                            foreach (var item in strtSec)
                            {
                                if (ClassIDRules.IsAdjJunction(pnd))
                                {
                                    if (!ClassIDRules.AdjRuleSucceeds(pnd, item)) continue;
                                }
                                Section sect = null;
                                Node cnd = null;
                                string sectGUID = item.uid;
                                if (sectGUID == "{705ec8f6-0176-4d7f-8820-4ad83bd92337}")
                                {

                                }
                                if (sectGUID == "{9f9bb3e5-95ff-42c3-88af-a5e109004196}")
                                {

                                }
                                if (sectGUID == "{050dd67b-3b9b-4f4d-9a84-d5b24eebdb52}")
                                {

                                }
                                if (NetworkUtil.DownsectionPCCompatible(pnd, item.phaseCode, -1, false))
                                {
                                    _sectionGUIDList.Add(sectGUID);
                                    double toX = item.tox;
                                    double toY = item.toy;
                                    if (StatusExtensions.IsAgainstFlow(item.status))
                                    {
                                        toX = item.x;
                                        toY = item.y;
                                    }
                                    int ToxFloor = Convert.ToInt32(Math.Floor(toX));
                                    int ToyFloor = Convert.ToInt32(Math.Floor(toY));
                                    Point currentPt = new Point(ToxFloor, ToyFloor);
                                    var nearestPoints = new List<Node>();
                                    if (pointList.ContainsKey(currentPt)) nearestPoints = pointList[currentPt];
                                    var childNodes = from row in nearestPoints
                                                     where (NodeBuffer(row.x, row.y, toX, toY))
                                                     select row;
                                    string Child = null;
                                    int CNPhaseCode = 0;
                                    int CNStatus = Constants.Disconnected;
                                    string uid = sectGUID;
                                    if (!_sectionList.ContainsKey(sectGUID))
                                    {
                                        sect = new Section();
                                        _sectionList.Add(sect.uid, sect);
                                        sect.uid = uid;
                                    }
                                    else
                                    {
                                        sect = _sectionList[sectGUID];
                                    }
                                    int status = item.status;
                                    int phaseCode = item.phaseCode;
                                    sect.phaseCode = phaseCode;
                                    sect.status = status;
                                    if (childNodes.Count() == 0)
                                    {
                                        double childX = toX;
                                        double childY = toY;
                                        Guid id = Guid.NewGuid();
                                        Child = "{" + id.ToString() + "}";
                                        CNPhaseCode = sect.phaseCode;
                                        cnd = new Node(Child, CNStatus, CNPhaseCode);
                                        UpdateNetJnStatus(cnd, status);
                                        CNStatus = cnd.status;
                                        cnd.phaseCode = CNPhaseCode;
                                        cnd.classID = -1;//ntInfo.networkClassIds[ClassIDRules.NetJunction];
                                        cnd.oid = -1;
                                        cnd.x = childX;
                                        cnd.y = childY;
                                        AddPointsToPointList(cnd, pointList);
                                        _nodeList.Add(Child, cnd);
                                        q.Enqueue(cnd);
                                        DataRow drNetJn = dtNetJnList.NewRow();
                                        drNetJn["x"] = childX;
                                        drNetJn["y"] = childY;
                                        drNetJn["Tox"] = DBNull.Value;
                                        drNetJn["Toy"] = DBNull.Value;
                                        drNetJn["oid"] = "-1";
                                        drNetJn["uid"] = Child;
                                        drNetJn["adjuid"] = DBNull.Value;
                                        drNetJn["phaseCode"] = CNPhaseCode;
                                        drNetJn["constructedphaseCode"] = CNPhaseCode;
                                        drNetJn["status"] = CNStatus;
                                        drNetJn["type"] = 0;
                                        drNetJn["ClassID"] = -1;//ntInfo.networkClassIds[ClassIDRules.NetJunction];
                                        dtNetJnList.Rows.Add(drNetJn);
                                    }
                                    else
                                    {
                                        foreach (var drChild in childNodes)//always one child will be considered
                                        {
                                            if (drChild.uid == "{1669a2ce-2e60-460d-95eb-8e1e9fc07c15}")
                                            {

                                            }
                                            if (drChild.isAdj)
                                            {
                                                continue; }
                                            if (ClassIDRules.IsAdjGroupNode(drChild))
                                            {
                                                drChild.isAdj = true;
                                                double childX = toX;
                                                double childY = toY;
                                                Guid id = Guid.NewGuid();
                                                Child = "{" + id.ToString() + "}";
                                                CNPhaseCode = sect.phaseCode;
                                                cnd = new Node(Child, CNStatus, CNPhaseCode);
                                                UpdateNetJnStatus(cnd, status);
                                                CNStatus = cnd.status;
                                                cnd.phaseCode = CNPhaseCode;
                                                cnd.classID = -1;
                                                cnd.oid = -1;
                                                cnd.x = childX;
                                                cnd.y = childY;
                                                AddPointsToPointList(cnd, pointList);
                                                _nodeList.Add(Child, cnd);
                                                q.Enqueue(cnd);
                                                DataRow drNetJn = dtNetJnList.NewRow();
                                                drNetJn["x"] = childX;
                                                drNetJn["y"] = childY;
                                                drNetJn["Tox"] = DBNull.Value;
                                                drNetJn["Toy"] = DBNull.Value;
                                                drNetJn["oid"] = "-1";
                                                drNetJn["uid"] = Child;
                                                drNetJn["adjuid"] = drChild.uid;
                                                drNetJn["phaseCode"] = CNPhaseCode;
                                                drNetJn["constructedphaseCode"] = CNPhaseCode;
                                                drNetJn["status"] = CNStatus;
                                                drNetJn["type"] = 0;
                                                drNetJn["ClassID"] = -1;
                                                dtNetJnList.Rows.Add(drNetJn);
                                                cnd.adjacentNode = drChild;
                                                q.Enqueue(drChild);
                                            }
                                            else
                                            {
                                                UpdateNodeStatus(drChild, BuildUnenergized);
                                                cnd = drChild;
                                                Child = drChild.uid;
                                                q.Enqueue(drChild);
                                            }
                                            break;
                                        }
                                    }
                                    UpdateNodeStatus(pnd, BuildUnenergized);
                                    sect.parentNode = pnd;
                                    sect.childNode = cnd;
                                    if (pnd.childList.ContainsKey(sect.uid))
                                    {
                                        pnd.childList.Remove(sect.uid);
                                        pnd.childList.Add(sect.uid, sect);
                                    }
                                    else pnd.childList.Add(sect.uid, sect);
                                    if (cnd.parentList.ContainsKey(sect.uid))
                                    {
                                        cnd.parentList.Remove(sect.uid);
                                        cnd.parentList.Add(sect.uid, sect);
                                    }
                                    else cnd.parentList.Add(sect.uid, sect);
                                    if (ContainsAdjNode(cnd))
                                    {
                                        if (cnd.adjacentNode.parentList.ContainsKey(sect.uid))
                                        {
                                            cnd.adjacentNode.parentList.Remove(sect.uid);
                                            cnd.adjacentNode.parentList.Add(sect.uid, sect);
                                        }
                                        else cnd.adjacentNode.parentList.Add(sect.uid, sect);
                                    }
                                    if (NetworkUtil.DownsectionPCCompatibleWithSection(sect, cnd, -1, false))
                                    {
                                        phaseErrorList.Add(pnd);
                                        continue;
                                    }
                                }
                                else
                                {
                                    phaseErrorList.Add(pnd);
                                }
                            }
                        }
                        else
                        {
                            disabledList.Add(pnd);
                        }
                    }

                }
            }
        }
Ejemplo n.º 6
0
 public static bool AdjRuleSucceeds(Section sec)
 {
     if (secondary.Contains(sec.classID))
         return true;
     return false;
 }
Ejemplo n.º 7
0
        public bool ConnectionBuffer(double x1, double y1, double a, double b, double x2, double y2, Section dr, bool populatingUnenergized = false, bool mark128 = false)
        {
            if (dr.uid == "{9f9bb3e5-95ff-42c3-88af-a5e109004196}")
            {

            }
            if (dr.uid == "{705ec8f6-0176-4d7f-8820-4ad83bd92337}")
            {

            }
            int existingStatus = dr.status;
            bool ans1 = ((Math.Pow(x1 - a, 2) + Math.Pow(y1 - b, 2)) < (ntInfo.snappingTolerance * ntInfo.snappingTolerance));
            bool ans2 = ((Math.Pow(x2 - a, 2) + Math.Pow(y2 - b, 2)) < (ntInfo.snappingTolerance * ntInfo.snappingTolerance));
            //dr.status = StatusExtensions.Connect(existingStatus);
            if (!populatingUnenergized)
            {
                if (ans1 && existingStatus == (Constants.Disconnected))
                {
                    dr.status = Constants.WithFlow + Constants.Energized; //with flow
                }
                else if (ans2 && existingStatus == (Constants.Disconnected))
                {
                    dr.status = Constants.AgainstFlow + Constants.Energized; //against the flow
                }
                else
                {
                    if (ans1)
                    {
                        dr.status = Constants.WithFlow + Constants.Energized; //with flow
                    }
                    else if (ans2)
                    {
                        dr.status = Constants.AgainstFlow + Constants.Energized; //against the flow
                    }
                }
            }
            else
            {
                if (ans1 && existingStatus == (Constants.Disconnected))
                {
                    dr.status = Constants.WithFlow + Constants.Unenergized; //with flow
                }
                else if (ans2 && existingStatus == (Constants.Disconnected))
                {
                    dr.status = Constants.AgainstFlow + Constants.Unenergized; //against the flow
                }
                else
                {
                    if (ans1)
                    {
                        dr.status = Constants.WithFlow + Constants.Unenergized; //with flow
                    }
                    else if (ans2)
                    {
                        dr.status = Constants.AgainstFlow + Constants.Unenergized; //against the flow
                    }
                }
                if (mark128 == true) dr.phaseCode = 128;
            }
            return ans1 || ans2;
        }
Ejemplo n.º 8
0
 public bool InsertConnectivity(Section sec)
 {
     try
     {
         string query = "insert into fta_connectivity  WITH (SNAPSHOT) (uid, PhaseCode, ParentNode, PNstatus, PNPhaseCode, ChildNode, CNStatus, CNPhaseCode,status,sessionid, deleted) VALUES(" + sec.uid + "," + sec.phaseCode + "," + sec.parentNode != null ? sec.parentNode.uid : DBNull.Value +
            "," + sec.parentNode != null ? sec.parentNode.status.ToString() : "0" + "," + sec.parentNode != null ? sec.parentNode.phaseCode.ToString() : "0" +
            "," + sec.childNode != null ? sec.childNode.uid : DBNull.Value + "," + sec.childNode != null ? sec.childNode.status.ToString() : "0" + "," + sec.childNode != null ? sec.childNode.phaseCode.ToString() : "0" +
                 ", " + sec.status + "," + Constants.SessionID + "," + 0 + ")";
         using (SqlConnection conn = new SqlConnection(conStr))
         {
             using (SqlCommand cmd = new SqlCommand(query, conn))
             {
                 conn.ConnectionString = conStr;
                 cmd.Connection = conn;
                 cmd.CommandType = CommandType.Text;
                 conn.Open();
                 cmd.ExecuteNonQuery();
                 conn.Close();
                 return true;
             }
         }
     }
     catch (Exception exc)
     {
         //log exc
     }
     return false;
 }
Ejemplo n.º 9
0
 public bool InsertElementSection(Section sec)
 {
     try
     {
         string query = "insert into fta_elements WITH (SNAPSHOT)(uid, oid, x, y,status,sessionid, deleted) VALUES(" + sec.uid + "," + sec.oid + "," + sec.x + "," + sec.y +
                 "," + sec.status + "," + Constants.SessionID + "," + 0 + ")";
         using (SqlConnection conn = new SqlConnection(conStr))
         {
             using (SqlCommand cmd = new SqlCommand(query, conn))
             {
                 conn.ConnectionString = conStr;
                 cmd.Connection = conn;
                 cmd.CommandType = CommandType.Text;
                 conn.Open();
                 cmd.ExecuteNonQuery();
                 conn.Close();
                 return true;
             }
         }
     }
     catch (Exception exc)
     {
         //log exc
     }
     return false;
 }
Ejemplo n.º 10
0
        public void AddPointsToLineList(Section dr)
        {
            int xFloor = Convert.ToInt32(Math.Floor(dr.x));
            int xCeiling = Convert.ToInt32(Math.Ceiling(dr.x));

            int yFloor = Convert.ToInt32(Math.Floor(dr.y));
            int yCeiling = Convert.ToInt32(Math.Ceiling(dr.y));

            int toxFloor = Convert.ToInt32(Math.Floor(dr.tox));
            int toxCeiling = Convert.ToInt32(Math.Ceiling(dr.tox));

            int toyFloor = Convert.ToInt32(Math.Floor(dr.toy));
            int toyCeiling = Convert.ToInt32(Math.Ceiling(dr.toy));

            Point Pt = new Point(xFloor, yFloor);
            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
            Pt = new Point(xFloor, yCeiling);
            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
            //3, 4 xceiling
            Pt = new Point(xCeiling, yFloor);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }

            Pt = new Point(xCeiling, yCeiling);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }

            //5, 6 ToxFloor
            Pt = new Point(toxFloor, toyFloor);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
            Pt = new Point(toxFloor, toyCeiling);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }

            //7, 8 ToxCeiling
            Pt = new Point(toxCeiling, toyFloor);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
            Pt = new Point(toxFloor, toyCeiling);

            if (lineList.ContainsKey(Pt))
            {
                lineList[Pt].Add(dr);
            }
            else
            {
                lineList[Pt] = new List<Section>();
                lineList[Pt].Add(dr);
            }
        }
Ejemplo n.º 11
0
 public bool DeleteElementSection(Section sec)
 {
     try
     {
         string query = "update fta_elements WITH (SNAPSHOT) set deleted = 1 where uid =" + sec.uid;
         using (SqlConnection conn = new SqlConnection(conStr))
         {
             using (SqlCommand cmd = new SqlCommand(query, conn))
             {
                 conn.ConnectionString = conStr;
                 cmd.Connection = conn;
                 cmd.CommandType = CommandType.Text;
                 conn.Open();
                 cmd.ExecuteNonQuery();
                 conn.Close();
                 return true;
             }
         }
     }
     catch (Exception exc)
     {
         //log exc
     }
     return false;
 }
        public static void DownsectionPCCorrection(Node parentNode, Section childSection)
        {
            int parentPCAccumilated = 128;
            int parentPC = 128;
            int parentConstrPC = parentNode.constructedPhaseCode;
            int constrChildPC = childSection.constructedPhaseCode;
            foreach (Section sec in parentNode.parentList.Values)
            {
                parentPCAccumilated = PhaseCodeUtil.AddPhaseCodes(parentPC, sec.phaseCode);
            }
            if (!StatusExtensions.IsNetJunction(parentNode.status))
            {
                if (PhaseCodeUtil.IsPhaseCodePresent(parentConstrPC, parentPCAccumilated)) // may add phase here
                {
                    if (!StatusExtensions.IsYDTransformer(parentNode.status))
                    {
                        parentNode.phaseCode = parentPCAccumilated;
                    }
                }
                else if (PhaseCodeUtil.IsPhaseCodePresent(parentPCAccumilated, parentConstrPC))
                {
                    parentNode.phaseCode = parentConstrPC;
                }
                else if (!PhaseCodeUtil.HaveCommonPhaseCodes(parentPCAccumilated, parentConstrPC))
                {
                    parentNode.phaseCode = 128;
                }
            }
            if (StatusExtensions.IsNetJunction(parentNode.status))
            {
                parentPC = parentPCAccumilated;
            }
            else
                parentPC = parentNode.phaseCode;
            int existingChildPC = childSection.phaseCode;
            if (PhaseCodeUtil.IsPhaseCodePresent(constrChildPC, parentPC)) // may add phase here
            {
                childSection.phaseCode = parentPC;
            }
            else if (PhaseCodeUtil.IsPhaseCodePresent(parentPC, constrChildPC))
            {
                childSection.phaseCode = constrChildPC;
            }
            else if (!PhaseCodeUtil.HaveCommonPhaseCodes(parentPC, constrChildPC))
            {
                childSection.phaseCode = 128;
            }
            if (childSection.phaseCode != 128)
            {
                if (StatusExtensions.IsUnenergized(childSection.status))
                    StatusExtensions.Energize(childSection.status);

            }
            else
            {
                if (!StatusExtensions.IsUnenergized(childSection.status))
                {
                    StatusExtensions.Unenerize(childSection.status);
                    childSection.status += Constants.Unenergized;
                }
            }
            if (StatusExtensions.IsDisconnected(childSection.status))
                StatusExtensions.Connect(childSection.status);
        }
 public static void FlipSection(Section sec)
 {
     Node parentNode = sec.parentNode;
     Node childNode = sec.childNode;
     sec.childNode = parentNode;
     sec.parentNode = childNode;
     childNode.parentList.Remove(sec.uid);
     childNode.childList.Add(sec.uid, sec);
 }
 public static void FlipDigitized(Section sec)
 {
     if (StatusExtensions.IsAgainstFlow(sec.status)) sec.status = Constants.WithFlow;
     else if (StatusExtensions.IsWithFlow(sec.status)) sec.status = Constants.AgainstFlow;
 }
Ejemplo n.º 15
0
        public static void FillElementsFromDB()
        {
            DataTable dtElements = dbutil.GetElements();
            foreach (DataRow dr in dtElements.Rows)
            {
                int type = (dr["type"] == null || dr["type"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["type"]);
                string guid = (dr["UID"] == null || dr["UID"] == DBNull.Value) ? "" : dr["UID"].ToString();
                string adjuid = (dr["adjuid"] == null || dr["adjuid"] == DBNull.Value) ? "" : dr["adjuid"].ToString();
                int oid = (dr["oid"] == null || dr["oid"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["oid"]);
                int status = ((dr["status"] == null || dr["status"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["status"]));
                int phaseCode = (dr["phaseCode"] == null || dr["phaseCode"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["phaseCode"]);
                int constructedPhaseCode = (dr["constructedPhaseCode"] == null || dr["constructedPhaseCode"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["constructedPhaseCode"]);
                double x = (dr["x"] == null || dr["x"] == DBNull.Value) ? 0 : Convert.ToDouble(dr["x"]);
                double y = (dr["y"] == null || dr["y"] == DBNull.Value) ? 0 : Convert.ToDouble(dr["y"]);
                double toX = (dr["toX"] == null || dr["toX"] == DBNull.Value) ? 0 : Convert.ToDouble(dr["toX"]);
                double toY = (dr["toY"] == null || dr["toY"] == DBNull.Value) ? 0 : Convert.ToDouble(dr["toY"]);
                int classID = (dr["classID"] == null || dr["classID"] == DBNull.Value) ? 0 : Convert.ToInt32(dr["classID"]);
                if (guid == "{9f9bb3e5-95ff-42c3-88af-a5e109004196}")
                {

                }
                //fill nodes and sections
                if (type == 0 ) //fill node list
                {
                    if (!_nodeList.ContainsKey(guid))
                    {
                        Node nd = new Node();
                        nd.uid = guid;
                        if (!string.IsNullOrEmpty(adjuid))
                        {
                            if (!_nodeList.ContainsKey(adjuid))
                            {
                                Node adjnd = new Node();
                                adjnd.uid = adjuid;
                                adjnd.isAdj = true;
                                nd.adjacentNode = adjnd;
                                _nodeList.Add(adjuid, adjnd);
                            }
                            else
                            {
                                nd.adjacentNode = _nodeList[adjuid];
                            }

                        }
                        nd.x = x;
                        nd.y = y;
                        nd.objectId = oid;
                        nd.oid = oid;
                        nd.status = status;
                        nd.phaseCode = phaseCode;
                        nd.constructedPhaseCode = constructedPhaseCode;
                        nd.classID = classID;
                        _nodeList.Add(guid, nd);
                    }
                    else
                    {
                        Node nd = _nodeList[guid];
                        nd.x = x;
                        nd.y = y;
                        nd.oid = oid;
                        nd.objectId = oid;
                        nd.status = status;
                        nd.phaseCode = phaseCode;
                        nd.constructedPhaseCode = constructedPhaseCode;
                        nd.classID = classID;
                        if (!string.IsNullOrEmpty(adjuid))
                        {
                            if (!_nodeList.ContainsKey(adjuid))
                            {
                                Node adjnd = new Node();
                                adjnd.uid = adjuid;
                                adjnd.isAdj = true;
                                nd.adjacentNode = adjnd;
                            }
                            else
                            {
                                nd.adjacentNode = _nodeList[adjuid];
                            }

                        }
                    }
                }

                else if (type == 1 && !_sectionList.ContainsKey(guid))
                {
                    Section sec = new Section();
                    sec.uid = guid;
                    sec.x = x;
                    sec.y = y;
                    sec.tox = toX;
                    sec.toy = toY;
                    sec.objectId = oid;
                    sec.oid = oid;
                    sec.status = status;
                    sec.classID = classID;
                    sec.phaseCode = phaseCode;
                    sec.constructedPhaseCode = constructedPhaseCode;
                    _sectionList.Add(guid, sec);
                }
            }
        }
Ejemplo n.º 16
0
 //public bool BulkUpdateConnectivity(List<Section> lst)
 //{
 //    try
 //    {
 //        foreach (Section sec in lst)
 //        {
 //            string query = "update fta_connectivity  WITH (SNAPSHOT) set PhaseCode = " + sec.phaseCode + ", ParentNode = " + sec.ParentNode != null ? sec.ParentNode.uid : DBNull.Value +
 //               ", PNstatus = " + sec.ParentNode != null ? sec.ParentNode.status.ToString() : "0" + ", PNPhaseCode =" + sec.ParentNode != null ? sec.ParentNode.phaseCode.ToString() : "0" +
 //               ", ChildNode = " + sec.ChildNode != null ? sec.ChildNode.uid : DBNull.Value + ", CNStatus = " + sec.ChildNode != null ? sec.ChildNode.status.ToString() : "0" + ", CNPhaseCode =" + sec.ChildNode != null ? sec.ChildNode.phaseCode.ToString() : "0" +
 //                    ",status = " + sec.status + ",sessionid = " + Constants.SessionID + ", deleted = " + 0 +
 //                    " where uid = " + sec.uid;
 //            using (SqlConnection conn = new SqlConnection(conStr))
 //            {
 //                using (SqlCommand cmd = new SqlCommand(query, conn))
 //                {
 //                    conn.ConnectionString = conStr;
 //                    cmd.Connection = conn;
 //                    cmd.CommandType = CommandType.Text;
 //                    conn.Open();
 //                    cmd.ExecuteNonQuery();
 //                    conn.Close();
 //                    return true;
 //                }
 //            }
 //        }
 //    }
 //    catch (Exception exc)
 //    {
 //        //log exc
 //    }
 //    return false;
 //}
 public bool UpdateConnectivity(Section sec)
 {
     try
     {
         string query = "update fta_connectivity  WITH (SNAPSHOT) set PhaseCode = " + sec.phaseCode + ", ParentNode = " + sec.parentNode != null ? sec.parentNode.uid : DBNull.Value +
            ", PNstatus = " + sec.parentNode != null ? sec.parentNode.status.ToString() : "0" + ", PNPhaseCode =" + sec.parentNode != null ? sec.parentNode.phaseCode.ToString() : "0" +
            ", ChildNode = " + sec.childNode != null ? sec.childNode.uid : DBNull.Value + ", CNStatus = " + sec.childNode != null ? sec.childNode.status.ToString() : "0" + ", CNPhaseCode =" + sec.childNode != null ? sec.childNode.phaseCode.ToString() : "0" +
                 ",status = " + sec.status + ",sessionid = " + Constants.SessionID + ", deleted = " + 0 +
                 " where uid = " + sec.uid;
         using (SqlConnection conn = new SqlConnection(conStr))
         {
             using (SqlCommand cmd = new SqlCommand(query, conn))
             {
                 conn.ConnectionString = conStr;
                 cmd.Connection = conn;
                 cmd.CommandType = CommandType.Text;
                 conn.Open();
                 cmd.ExecuteNonQuery();
                 conn.Close();
                 return true;
             }
         }
     }
     catch (Exception exc)
     {
         //log exc
     }
     return false;
 }
        public void AddSection(EditObject eObj)
        {
            Section newSect = new Section();
            newSect.uid = eObj.UID;
            if (eObj.Connectivity.parentNode == null)
            {
                IPolyline ln = (IPolyline)eObj.shape;
                Node FromNetJn = CreateNetJn(eObj);
                FromNetJn.x = ln.FromPoint.X;
                FromNetJn.y = ln.FromPoint.Y;
                eObj.Connectivity.parentNode = FromNetJn;
                StaticStuff._nodeList.Add(FromNetJn.uid, FromNetJn);
                ExtensionInfo.checkFlow.AddPointsToPointList(FromNetJn);
                Node toNetJn = CreateNetJn(eObj);
                toNetJn.x = ln.ToPoint.X;
                toNetJn.y = ln.ToPoint.Y;
                eObj.Connectivity.childNode = toNetJn;
                StaticStuff._nodeList.Add(toNetJn.uid, toNetJn);
                ExtensionInfo.checkFlow.AddPointsToPointList(toNetJn);
            }
            else if (eObj.Connectivity.childNode == null)
            {
                Node netJn = CreateNetJn(eObj);
                IPolyline ln = (IPolyline)eObj.shape;
                if (StatusExtensions.IsWithFlow(eObj.Connectivity.status))
                {
                    netJn.x = ln.ToPoint.X;
                    netJn.y = ln.ToPoint.Y;
                }
                else if (StatusExtensions.IsAgainstFlow(eObj.Connectivity.status))
                {
                    netJn.x = ln.FromPoint.X;
                    netJn.y = ln.FromPoint.Y; ;
                }
                eObj.Connectivity.childNode = netJn;
                StaticStuff._nodeList.Add(netJn.uid, netJn);
                ExtensionInfo.checkFlow.AddPointsToPointList(netJn);
            }
            newSect.phaseCode = eObj.Connectivity.phaseCode;
            newSect.classID = eObj.CLSID;
            newSect.status = eObj.Connectivity.status;
            if (StatusExtensions.IsWithFlow(eObj.Connectivity.status))
            {
                newSect.x = eObj.Connectivity.parentNode.x;
                newSect.y = eObj.Connectivity.parentNode.y;
                newSect.tox = eObj.Connectivity.childNode.x;
                newSect.toy = eObj.Connectivity.childNode.y;
            }
            else if (StatusExtensions.IsAgainstFlow(eObj.Connectivity.status))
            {
                newSect.x = eObj.Connectivity.childNode.x;
                newSect.y = eObj.Connectivity.childNode.y;
                newSect.tox = eObj.Connectivity.parentNode.x;
                newSect.toy = eObj.Connectivity.parentNode.y;
            }

            newSect.classID = eObj.CLSID;
            newSect.phaseCode = eObj.Connectivity.phaseCode;
            newSect.parentNode = eObj.Connectivity.parentNode;
            newSect.childNode = eObj.Connectivity.childNode;
            if (newSect.parentNode.childList == null)
                newSect.parentNode.childList = new Dictionary<string, Section>();
            newSect.parentNode.childList.Add(newSect.uid, newSect);
            if (newSect.childNode.parentList == null)
                newSect.childNode.parentList = new Dictionary<string, Section>();
            newSect.childNode.parentList.Add(newSect.uid, newSect);

            StaticStuff._sectionList.Add(newSect.uid, newSect);
            ExtensionInfo.checkFlow.AddPointsToLineList(newSect);
        }
Ejemplo n.º 18
0
 public static bool AdjRuleSucceeds(Node nd, Section sec)
 {
     if (nd != null && nd.adjacentNode != null && AdjGroup.Contains(nd.adjacentNode.classID) && primary.Contains(sec.classID))
         return true;
     return false;
 }