示例#1
0
        private List <_Mark> getMarkData(List <_Db.MText> txts)
        {
            List <_Mark> parse = new List <_Mark>();

            foreach (_Db.MText txt in txts)
            {
                _Mark current = new _Mark(txt.Contents, txt.Location, txt.Layer);
                parse.Add(current);
            }

            return(parse);
        }
示例#2
0
        private List <XmlNode> findSimilar(string filter, string diam, List <XmlNode> rebars, XmlDocument xmlDoc)
        {
            List <XmlNode> similar = new List <XmlNode>();

            _Mark   u       = new _Mark(0, 10, "", filter, 0);
            XmlNode newNode = XML_Handle.newNodeHandle(u, "", xmlDoc, _c.ed);

            newNode["B2aBar"]["Dim"].InnerText = diam;

            similar = XML_Handle.findSimilar(newNode, rebars);

            return(similar);
        }
示例#3
0
        private bool matchMarkToXML(_Mark m, List <XmlNode> rows, ref Dictionary <_Mark, XmlNode> warning)
        {
            foreach (XmlNode row in rows)
            {
                XmlNode rebar = row["B2aBar"];

                if (rebar == null)
                {
                    return(false);
                }

                string type   = XML_Handle.emptyNodehandle(rebar, "Type");
                string pos_nr = XML_Handle.emptyNodehandle(rebar, "Litt");
                string diam   = XML_Handle.emptyNodehandle(rebar, "Dim");

                if (m.Position_Shape == "A")
                {
                    if (m.Position_Shape == type && m.Position_Nr.ToString() == pos_nr && m.Diameter.ToString() == diam)
                    {
                        write("Found in XML: " + m.ToString());
                        string rebarString = XML_Handle.getXMLRebarString(rebar);
                        write(rebarString);
                        write("");
                        return(true);
                    }
                }
                else
                {
                    if (m.Position_Nr.ToString() == pos_nr)
                    {
                        if (m.Position_Shape.ToString() != type)
                        {
                            warning[m] = rebar;
                        }
                        else if (m.Diameter.ToString() != diam)
                        {
                            warning[m] = rebar;
                        }

                        write("Found in XML: " + m.ToString());
                        string rebarString = XML_Handle.getXMLRebarString(rebar);
                        write(rebarString);
                        write("");
                        return(true);
                    }
                }
            }

            return(false);
        }
示例#4
0
        private List <_Mark> getMarksInArea(_Area_v2 area, List <_Mark> allmarks)
        {
            List <_Mark> marks = new List <_Mark>();

            for (int i = allmarks.Count - 1; i >= 0; i--)
            {
                _Mark mark = allmarks[i];
                if (area.isPointInArea(mark.IP))
                {
                    marks.Add(mark);
                    allmarks.RemoveAt(i);
                }
            }

            return(marks);
        }
示例#5
0
        private List <_Mark> getSummary(List <_Mark> marks)
        {
            List <_Mark> sumMarks = new List <_Mark>();

            foreach (_Mark m in marks)
            {
                if (sumMarks.Contains(m))
                {
                    int index = sumMarks.FindIndex(a => a == m);
                    sumMarks[index].Number += m.Number;
                }
                else
                {
                    _Mark nm = new _Mark(m.Number, m.Diameter, m.Position, m.Position_Shape, m.Position_Nr);
                    sumMarks.Add(nm);
                }
            }

            sumMarks = sumMarks.OrderBy(b => b.Diameter).ToList();

            List <_Mark> rows_num  = sumMarks.FindAll(x => x.Position_Shape == "A").ToList();
            List <_Mark> rows_char = sumMarks.FindAll(x => x.Position_Shape != "A").ToList();

            rows_num  = rows_num.OrderBy(b => b.Position_Nr).ToList();
            rows_char = rows_char.OrderBy(b => b.Position_Nr).ToList();

            sumMarks = new List <_Mark>();
            sumMarks.AddRange(rows_num);


            if ((rows_num.Count + rows_char.Count + 2) <= 19)
            {
                _Mark emptyRow = new _Mark(0, 0, "emptyrow", "", 0);
                sumMarks.Add(emptyRow);
                sumMarks.Add(emptyRow);
            }
            else if ((rows_num.Count + rows_char.Count + 1) <= 19)
            {
                _Mark emptyRow = new _Mark(0, 0, "emptyrow", "", 0);
                sumMarks.Add(emptyRow);
            }

            sumMarks.AddRange(rows_char);

            return(sumMarks);
        }
示例#6
0
        private bool promptAddRebarToXml(_Mark u)
        {
            _Ed.PromptKeywordOptions promptOptions = new _Ed.PromptKeywordOptions("");
            promptOptions.Message = "\nAdd to XML: " + u.ToString();
            promptOptions.Keywords.Add("Yes");
            promptOptions.Keywords.Add("No");
            promptOptions.AllowNone = false;
            _Ed.PromptResult promptResult = _c.ed.GetKeywords(promptOptions);

            if (promptResult.Status == _Ed.PromptStatus.OK)
            {
                if (promptResult.StringResult == "Yes")
                {
                    return(true);
                }
            }

            return(false);
        }
示例#7
0
        private List <_Mark> getSummary(List <_Mark> marks)
        {
            List <_Mark> sumMarks = new List <_Mark>();

            foreach (_Mark m in marks)
            {
                if (sumMarks.Contains(m))
                {
                    int index = sumMarks.FindIndex(a => a == m);
                    sumMarks[index].Number += m.Number;
                }
                else
                {
                    _Mark nm = new _Mark(m.Number, m.Diameter, m.Position, m.Position_Shape, m.Position_Nr);
                    sumMarks.Add(nm);
                }
            }

            return(sumMarks);
        }
示例#8
0
        private List <_Mark> getSelectedMarks()
        {
            List <_Mark> parse = new List <_Mark>();

            List <_Db.MText> selected = getSelectedText();

            foreach (_Db.MText txt in selected)
            {
                _Mark current = new _Mark(txt.Contents, txt.Location, txt.Layer.ToString());
                bool  valid   = current.validate();

                if (valid)
                {
                    parse.Add(current);
                }
                else
                {
                    write("[WARNING] - VALE VIIDE - " + txt.Contents);
                }
            }

            return(parse);
        }
示例#9
0
        private XmlNode matchMarkToXML(_Mark m, List <XmlNode> rows)
        {
            foreach (XmlNode row in rows)
            {
                XmlNode rebar = row["B2aBar"];

                if (rebar == null)
                {
                    return(null);
                }

                string type   = XML_Handle.emptyNodehandle(rebar, "Type");
                string pos_nr = XML_Handle.emptyNodehandle(rebar, "Litt");
                string diam   = XML_Handle.emptyNodehandle(rebar, "Dim");

                if (m.Position_Shape == type && m.Position_Nr.ToString() == pos_nr && m.Diameter.ToString() == diam)
                {
                    return(row);
                }
            }

            return(null);
        }
示例#10
0
        private List <_Mark> filterWrongMarks(List <_Db.MText> txts)
        {
            List <_Mark> good = new List <_Mark>();
            List <_Mark> bad  = new List <_Mark>();

            write("----- VIGADE LOETELU ALGUS -----");

            foreach (_Db.MText txt in txts)
            {
                if (txt.Contents.StartsWith("IG-"))
                {
                    continue;
                }
                if (txt.Contents.StartsWith("NEO-"))
                {
                    continue;
                }
                if (txt.Contents.StartsWith("TAGGLIST-"))
                {
                    continue;
                }
                if (txt.Contents.StartsWith("STAGHYLSA"))
                {
                    continue;
                }
                if (txt.Contents.StartsWith("WELDA"))
                {
                    continue;
                }
                if (txt.Contents.StartsWith("LYFT"))
                {
                    continue;
                }
                if (txt.Contents.StartsWith("HFV"))
                {
                    continue;
                }
                if (txt.Contents.StartsWith("6300S"))
                {
                    continue;
                }
                if (txt.Contents.StartsWith("DUBBURSPARING"))
                {
                    continue;
                }
                if (txt.Contents.Length < 6)
                {
                    continue;
                }
                if (txt.Contents.Length > 19)
                {
                    continue;
                }

                if (txt.Contents.Contains("-"))
                {
                    _Mark current = new _Mark(txt.Contents, txt.Location, txt.Layer);
                    bool  valid   = current.validate();

                    if (valid == false)
                    {
                        if (txt.Layer != _Mark.markLayerName)
                        {
                            bad.Add(current);
                            write("[VIGA] - VALE LAYER - " + current.Original);
                        }
                        else
                        {
                            bad.Add(current);
                            write("[VIGA] - VALE VIIDE - " + current.Original);
                        }
                    }
                    else
                    {
                        if (current.containsLocation(good))
                        {
                            if (!current.containsLocation(bad))
                            {
                                bad.Add(current);
                                write("[VIGA] - TOPELT - " + current.Original);
                            }
                        }
                        else
                        {
                            good.Add(current);
                        }
                    }
                }
            }

            write("----- VIGADE LOETELU LÕPP -----");

            return(bad);
        }