GnomeSurferPro.ViewModels.VisualGene.VisualGene C# (CSharp) Method

VisualGene() public method

public VisualGene ( IGene model, double pixelsPerBasePair ) : System
model IGene
pixelsPerBasePair double
return System
        public VisualGene(IGene model, double pixelsPerBasePair)
        {
            _model = model;
            _name = model.Name;
            _leftPosition = model.LeftBasePair * pixelsPerBasePair;
            _length = (model.RightBasePair - model.LeftBasePair) * pixelsPerBasePair;
            _direction = model.IsForward ? GeneDirection.Forward : GeneDirection.Reverse;
            _locusTag = model.LocusTag;

            // Define the points in the pentagon container
            _pentagonPoints = new PointCollection(5);
            double rectangleLength = _length > _height / 2 ? _length - _height / 2 : 0;
            if (_direction == GeneDirection.Forward)
            {
                
                _pentagonPoints.Add(new Point(0, 0));
                _pentagonPoints.Add(new Point(rectangleLength, 0));
                _pentagonPoints.Add(new Point(_length, _height / 2));
                _pentagonPoints.Add(new Point(rectangleLength, _height));
                _pentagonPoints.Add(new Point(0, _height));
            }
            else
            {
                _pentagonPoints.Add(new Point(0, _height / 2));
                _pentagonPoints.Add(new Point(_height / 2, _height));
                _pentagonPoints.Add(new Point(_height / 2 + rectangleLength, _height));
                _pentagonPoints.Add(new Point(_height / 2 + rectangleLength, 0));
                _pentagonPoints.Add(new Point(_height / 2, 0));
            }
        }