public ObjectBase(Dictionary <string, Animation> animations, IAlignment alignemt = null, float frameRate = 0.5f, bool loops = true,
                          string initialAnimation = "", bool pause = true, bool visible = true,
                          float x = 0, float y = 0, float xScale = 0, float yScale = 0, float rotation = 0)
        {
            _animations = animations;
            _alignemt   = alignemt;
            _frameRate  = frameRate;
            _loops      = loops;
            Visible     = visible;

            _currentAnimation = initialAnimation != "" ? animations[initialAnimation] : animations.Values.First();
            if (pause)
            {
                _currentAnimation.Pause();
            }

            if (alignemt == null)
            {
                alignemt = Alignments.TrueCenter;
            }
            _alignemt = alignemt;

            Position = new Vector2(x, y);
            Scale    = new Vector2(xScale, yScale);
            Rotation = rotation;
        }
Beispiel #2
0
 public StationComputer(IAlignment alignment, IProfile profile)
 {
     (this.Profile, this.Alignment) = (profile, alignment);
     ProfileSegments   = Profile.GetSegments();
     AlignmentSegments = Alignment.GetSegments();
     GetStartAndEndStations();
     ValidateStationSegments();
 }
 private void AppendAlignment(CellFormat format, IAlignment alignment)
 {
     if (alignment.Horizontal != HorizontalAlignment.General || alignment.Vertical != VerticalAlignment.None)
     {
         var currentAlignment = new Alignment();
         if (alignment.Horizontal != HorizontalAlignment.General)
         {
             currentAlignment.Horizontal = (HorizontalAlignmentValues)(int)alignment.Horizontal;
         }
         if (alignment.Vertical != VerticalAlignment.None)
         {
             currentAlignment.Vertical = (VerticalAlignmentValues)(int)alignment.Vertical;
         }
         format.Alignment      = currentAlignment;
         format.ApplyAlignment = true;
     }
 }
Beispiel #4
0
        public void Run()
        {
            int           N      = Inputs.Count;
            List <string> values = new List <string>();

            for (int i = 0; i < N; i++)
            {
                string text = Inputs[i];
                values.Add(text);
            }
            AlignmentFactory alignmentFactory = new AlignmentFactory();
            IAlignment       aligner          = alignmentFactory.Create(alignment);
            int max = values.Select(x => x.Length).Max();

            foreach (string v in values)
            {
                Console.WriteLine(aligner.Align(v, max));
            }
        }
 public SampleViewDeconstructor(IAlignment alignment) =>
 (_alignment) = (alignment);
Beispiel #6
0
 public PolyFitter(IAlignment alignment, IProfile profile, IPolyline polyline)
 {
     (_alignment, _profile, _polyline) = (alignment, profile, polyline);
     _computer = new StationComputer(_alignment, _profile);
 }
Beispiel #7
0
        public Entity MakeDrawable(String resourceUrl, Int32 zIndex, FitType fitType, IAlignment alignment)
        {
            ResourceUrl = resourceUrl;
            ZIndex = zIndex;
            FitType = fitType;
            Alignment = alignment;

            IsDrawable = true;
            return this;
        }
Beispiel #8
0
 public StationComputerTests(ITestOutputHelper output)
 {
     Alignment   = Substitute.For <IAlignment>();
     Profile     = Substitute.For <IProfile>();
     this.output = output;
 }