Exemplo n.º 1
0
        /// <summary>Setzt den vorhanden Code auf den angegebenen Code</summary>
        /// <param name="oldCode"></param>
        /// <param name="newCode"></param>
        /// <returns>true = es wurde mind. ein Code geändert</returns>
        public Boolean setOldCodeToNewCode(String oldCode, String newCode)
        {
            Boolean allPoints     = false;
            Boolean hasAnyChanged = false;

            if (ClassStringTools.IsNullOrWhiteSpace(oldCode))
            {
                oldCode = "*";
            }
            if (!ClassStringTools.IsNullOrWhiteSpace(newCode))
            {
                ClassRegexTools regexT = null;
                if (oldCode == "*")
                {
                    allPoints = true;
                }
                else
                {
                    regexT = new ClassRegexTools(oldCode);
                }
                foreach (ClassCADdyPunkt item in Punkte)
                {
                    if (allPoints || regexT.isMatch(item.Code))
                    {
                        item.Code     = newCode;
                        hasAnyChanged = true;
                    }
                }
            }
            return(hasAnyChanged);
        }
Exemplo n.º 2
0
        /// <summary>Setzt die Punktnummern auf den angegebenen Code</summary>
        /// <param name="pointnumber"></param>
        /// <param name="newCode"></param>
        /// <returns>true = es wurde mind. ein Code geändert</returns>
        public Boolean setPointNumberToCode(String pointnumber, String newCode)
        {
            Boolean allPoints     = false;
            Boolean hasAnyChanged = false;

            if (ClassStringTools.IsNullOrWhiteSpace(pointnumber))
            {
                pointnumber = "*";
            }
            if (!ClassStringTools.IsNullOrWhiteSpace(newCode))
            {
                IScintillaGateway editor = new ScintillaGateway(PluginBase.GetCurrentScintilla());
                int sLnrStart            = -1;
                int sLnrEnd = -1;
                if (editor != null)
                {
                    sLnrStart = editor.LineFromPosition(editor.GetSelectionStart());
                    sLnrEnd   = editor.LineFromPosition(editor.GetSelectionEnd());
                    if (editor.GetColumn(editor.GetSelectionEnd()) < 2)
                    {
                        sLnrEnd--;
                    }
                }
                ClassRegexTools regexT = null;
                if (pointnumber == "*")
                {
                    allPoints = true;
                }
                else
                {
                    regexT = new ClassRegexTools(pointnumber);
                }
                foreach (ClassCADdyPunkt item in Punkte)
                {
                    if (allPoints || regexT.isMatch(item.Punktnummer))
                    {
                        if ((sLnrStart >= 0) && (sLnrEnd >= 0))
                        {
                            if ((item.LineNumber >= sLnrStart) && (item.LineNumber <= sLnrEnd))
                            {
                                item.Code     = newCode;
                                hasAnyChanged = true;
                            }
                        }
                        else
                        {
                            item.Code     = newCode;
                            hasAnyChanged = true;
                        }
                    }
                }
            }
            return(hasAnyChanged);
        }
Exemplo n.º 3
0
        /// <summary>Setzt die Punktnummern auf den angegebenen Code</summary>
        /// <param name="pointnumber"></param>
        /// <param name="i_d"></param>
        /// <returns>true = es wurde mind. ein Code geändert</returns>
        public Boolean setPointNumberToIDe(String pointnumber, Double i_d)
        {
            Boolean allPoints     = false;
            Boolean hasAnyChanged = false;

            if (ClassStringTools.IsNullOrWhiteSpace(pointnumber))
            {
                pointnumber = "*";
            }
            if (!Double.IsNaN(i_d))
            {
                ClassRegexTools regexT = null;
                if (pointnumber == "*")
                {
                    allPoints = true;
                }
                else
                {
                    regexT = new ClassRegexTools(pointnumber);
                }
                foreach (ClassCADdyStandpunkt item in standpunkte)
                {
                    if (allPoints || regexT.isMatch(item.Punktnummer.Substring(1)))
                    {
                        item.I        = i_d;
                        hasAnyChanged = true;
                    }
                    foreach (ClassCADdyZielung ziel in item.Zielungen)
                    {
                        if (allPoints || regexT.isMatch(ziel.Zielpunkt))
                        {
                            ziel.D        = i_d;
                            hasAnyChanged = true;
                        }
                    }
                }
            }
            return(hasAnyChanged);
        }