Namespace BallisticCalculator.Reticle.Draw

Brief

The classes to draw a reticle and trajectory parameters as SVG image.

Details

To draw a reticle use ReticleDrawController.

Example:

    using BallisticCalculator.Reticle;
    using BallisticCalculator.Reticle.Data;
    using BallisticCalculator.Reticle.Draw;
    ...
    var reticle = new MilDotReticle();
    var canvas = SvgCanvasFactory.Create("reticle", "2in", "2in");
    var controller = new ReticleDrawController(reticle, canvas);
    controller.DrawReticle();
    string svg = SvgCanvasFactory.ToSvg(canvas);

If you need to draw a reticle on a Graphics, please use SVG draw library.

Example

    using BallisticCalculator.Reticle;
    using BallisticCalculator.Reticle.Data;
    using BallisticCalculator.Reticle.Draw;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.Xml;
    using Svg;

    ...
    var svg = SvgCanvasFactory.ToSvg(canvas);
    XmlDocument xmlDocument = new XmlDocument();
    xmlDocument.LoadXml(svg);
    var svgDocument = SvgDocument.Open(xmlDocument);
    var bm = svgDocument.Draw(1024, 1024);

You can also implement IReticleCanvas for Graphics. The example of such implementation is avaiable in git repository.

Classes

IReticleCanvas

The interface to a reticle canvas

IReticleCanvasPath

The interface to a path on a reticle canvas.

ReticleDrawController

The controller to draw a reticle on a canvas.

SvgCanvasFactory

The factory to create an SVG drawing canvas

back