private void ConfigureStyleButtons() { m_PickedStyle = LineStyle.DefaultValue; this.SuspendLayout(); switch (m_ToolType) { case DrawingToolType.Pencil: ConfigureButtonsForBrushes(); break; case DrawingToolType.Cross2D: // /!\ This is actually used for Track Line. ConfigureButtonsForTrackLines(); break; case DrawingToolType.Line2D: default: ConfigureButtonsForLines(); break; } this.ResumeLayout(true); }
public static AbstractDrawing FromXml(XmlTextReader _xmlReader, PointF _scale) { DrawingCross2D dc = new DrawingCross2D(0, 0, 0, 0); while (_xmlReader.Read()) { if (_xmlReader.IsStartElement()) { if (_xmlReader.Name == "CenterPoint") { Point p = XmlHelper.PointParse(_xmlReader.ReadString(), ';'); dc.m_CenterPoint = new Point((int)((float)p.X * _scale.X), (int)((float)p.Y * _scale.Y)); } else if (_xmlReader.Name == "LineStyle") { dc.m_PenStyle = LineStyle.FromXml(_xmlReader); } else if (_xmlReader.Name == "InfosFading") { dc.m_InfosFading.FromXml(_xmlReader); } else { // forward compatibility : ignore new fields. } } else if (_xmlReader.Name == "Drawing") { break; } else { // Fermeture d'un tag interne. } } dc.RescaleCoordinates(dc.m_fStretchFactor, dc.m_DirectZoomTopLeft); return(dc); }
public static AbstractDrawing FromXml(XmlTextReader _xmlReader, PointF _scale) { DrawingPencil dp = new DrawingPencil(); while (_xmlReader.Read()) { if (_xmlReader.IsStartElement()) { if (_xmlReader.Name == "PointList") { ParsePointList(dp, _xmlReader, _scale); } else if (_xmlReader.Name == "LineStyle") { dp.m_PenStyle = LineStyle.FromXml(_xmlReader); } else if (_xmlReader.Name == "InfosFading") { dp.m_InfosFading.FromXml(_xmlReader); } else { // forward compatibility : ignore new fields. } } else if (_xmlReader.Name == "Drawing") { break; } else { // Fermeture d'un tag interne. } } dp.RescaleCoordinates(dp.m_fStretchFactor, dp.m_DirectZoomTopLeft); return(dp); }
public override void RecallDecoration() { m_PenStyle = m_MemoPenStyle.Clone(); }
public override void MemorizeDecoration() { m_MemoPenStyle = m_PenStyle.Clone(); }
public override void UpdateDecoration(LineStyle _style) { m_PenStyle.Update(_style, false, true, true); }
public override void UpdateDecoration(LineStyle _style) { throw new Exception(String.Format("{0}, The method or operation is not implemented.", this.ToString())); }
public abstract void UpdateDecoration(LineStyle _style);
public override void UpdateDecoration(LineStyle _style) { // Actually not used for now. m_PenStyle.Update(_style, false, true, true); }
public void Load(string _filePath) { log.Debug("Loading color profile from xml file."); XmlReader reader = new XmlTextReader(_filePath); if (reader != null) { try { while (reader.Read()) { if ((reader.IsStartElement()) && (reader.Name == "KinoveaColorProfile")) { while (reader.Read()) { if (reader.IsStartElement()) { // TODO: Do not try to read from older format (1.1) switch (reader.Name) { case "Angle2D": m_DecorationAngle2D = ParseTextDecorationEntry(reader, reader.Name); break; case "Chrono": m_DecorationChrono = ParseTextDecorationEntry(reader, reader.Name); break; case "Cross2D": m_DecorationCross2D = ParseLineStyleEntry(reader, reader.Name); break; case "Line2D": m_DecorationLine2D = ParseLineStyleEntry(reader, reader.Name); break; case "Pencil": m_DecorationPencil = ParseLineStyleEntry(reader, reader.Name); break; case "Text": m_DecorationText = ParseTextDecorationEntry(reader, reader.Name); break; default: // DrawingTool from a newer file format... // We don't have a holder variable for it: ignore. break; } #region old format 1.1 /* * switch (reader.Name) * { * case "TextColorRGB": * m_ColorText = XmlHelper.ColorParse(reader.ReadString(), ';'); * break; * case "PencilColorRGB": * m_ColorPencil = XmlHelper.ColorParse(reader.ReadString(), ';'); * break; * case "PencilSize": * m_StylePencil.Size = int.Parse(reader.ReadString()); * break; * case "Cross2DColorRGB": * m_ColorCross2D = XmlHelper.ColorParse(reader.ReadString(), ';'); * break; * case "Line2DColorRGB": * m_ColorLine2D = XmlHelper.ColorParse(reader.ReadString(), ';'); * break; * case "Line2DSize": * m_StyleLine2D.Size = int.Parse(reader.ReadString()); * break; * case "Line2DStartArrow": * m_StyleLine2D.StartArrow = bool.Parse(reader.ReadString()); * break; * case "Line2DEndArrow": * m_StyleLine2D.EndArrow = bool.Parse(reader.ReadString()); * break; * case "Angle2DColorRGB": * m_ColorAngle2D = XmlHelper.ColorParse(reader.ReadString(), ';'); * break; * case "ChronoColorRGB": * m_ColorChrono = XmlHelper.ColorParse(reader.ReadString(), ';'); * break; * default: * // Parameter from a newer file format... * // We don't have a holder variable for it: ignore. * break; * }*/ #endregion } else if (reader.Name == "KinoveaColorProfile") { break; } else { // Fermeture d'un tag interne. } } } } } catch (Exception) { log.Error("Error happenned while parsing color profile. We'll keep the default values."); log.Error("File we tried to read was :" + _filePath); } finally { reader.Close(); } } }