/// <summary>Koordinaten verschieben</summary> /// <param name="tRW"></param> /// <param name="tHW"></param> /// <param name="tHO"></param> /// <param name="settings"></param> public Boolean translateCoords(Double tRW, Double tHW, Double tHO) { Boolean hasAnyChanged = false; 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--; } if ((sLnrEnd - sLnrStart) <= 0) { sLnrStart = sLnrEnd = -1; } } if (Double.IsNaN(tRW)) { tRW = 0.0; } if (Double.IsNaN(tHW)) { tHW = 0.0; } if (Double.IsNaN(tHO)) { tHO = 0.0; } foreach (ClassCADdyPunkt item in Punkte) { if ((sLnrStart >= 0) && (sLnrEnd >= 0)) { if ((item.LineNumber >= sLnrStart) && (item.LineNumber <= sLnrEnd)) { item.Rechtswert += tRW; item.Hochwert += tHW; item.Hoehe += tHO; hasAnyChanged = true; } } else { item.Rechtswert += tRW; item.Hochwert += tHW; item.Hoehe += tHO; hasAnyChanged = true; } } return(hasAnyChanged); }
/// <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); }