Exemplo n.º 1
0
        protected TransformResults Transform(CancellationToken cancellationToken, DataSchema dataSchema, TransformResults input,
                                             TransformStack transformStack)
        {
            if (transformStack == null || transformStack.StackIndex >= transformStack.RowTransforms.Count)
            {
                return(input);
            }
            cancellationToken.ThrowIfCancellationRequested();
            if (transformStack.Predecessor != null)
            {
                input = Transform(cancellationToken, dataSchema, input, transformStack.Predecessor);
            }
            var filter = transformStack.CurrentTransform as RowFilter;

            if (filter != null)
            {
                var filteredRows = new PivotedRows(Filter(cancellationToken, dataSchema, filter, input.PivotedRows),
                                                   input.PivotedRows.ItemProperties);
                filteredRows = Sort(cancellationToken, dataSchema, filter, filteredRows);
                return(new TransformResults(input, filter, filteredRows));
            }
            var pivotSpec = transformStack.CurrentTransform as PivotSpec;

            if (pivotSpec != null)
            {
                var pivotedRows = GroupAndTotaler.GroupAndTotal(cancellationToken, dataSchema, pivotSpec, input.PivotedRows);
                return(new TransformResults(input, pivotSpec, pivotedRows));
            }
            return(input);
        }
Exemplo n.º 2
0
        public void TransformStack_TranlateSaveRestore_Verify()
        {
            using (var context = new Eto.Wpf.Platform().Context)
            {
                var current           = Matrix.Create();
                var stack             = new Stack <IMatrix>();
                Action <IMatrix> push = m => {
                    stack.Push(current);
                    m.Append(current);
                    current = m;
                };
                Action pop = () => current = stack.Pop();

                var target = new TransformStack(push, pop);

                Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 0f, 0f));

                target.SaveTransform();                 // Save

                target.TranslateTransform(5f, 5f);
                Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 5f, 5f));

                target.SaveTransform();

                target.TranslateTransform(10f, 10f);
                Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 15f, 15f));

                target.RestoreTransform();
                Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 5f, 5f));

                target.RestoreTransform();
                Assert.IsTrue(MatrixTests.Equals(current, 1f, 0f, 0f, 1f, 0f, 0f));
            }
        }
Exemplo n.º 3
0
        private ToolStripMenuItem MakeTransformStackMenuItem(DataSchema dataSchema, TransformStack transformStack)
        {
            var toolStripMenuItem = new ToolStripMenuItem();

            if (transformStack.CurrentTransform == null)
            {
                toolStripMenuItem.Text = Resources.NavBar_MakeTransformStackMenuItem_No_Transforms;
            }
            else
            {
                toolStripMenuItem.Text        = transformStack.CurrentTransform.Summary;
                toolStripMenuItem.ToolTipText = transformStack.CurrentTransform.GetDescription(dataSchema);
                if (transformStack.CurrentTransform is PivotSpec)
                {
                    toolStripMenuItem.Image = Resources.Pivot;
                }
                else if (transformStack.CurrentTransform is RowFilter)
                {
                    toolStripMenuItem.Image = Resources.Filter;
                }
                toolStripMenuItem.ImageTransparentColor = Color.Magenta;
            }
            toolStripMenuItem.Click += (sender, args) =>
            {
                BindingListSource.BindingListView.TransformStack = transformStack;
            };
            return(toolStripMenuItem);
        }
Exemplo n.º 4
0
 public QueryParameters SetTransformStack(TransformStack value)
 {
     return(new QueryParameters(this)
     {
         TransformStack = value
     });
 }
Exemplo n.º 5
0
        public TransformResults GetPartialResults(TransformStack transformStack)
        {
            if (Parent == null)
            {
                return(this);
            }
            var parentResults = Parent.GetPartialResults(transformStack);

            if (!ReferenceEquals(parentResults, Parent))
            {
                return(parentResults);
            }
            int transformIndex = Depth - 1;

            if (transformIndex >= transformStack.RowTransforms.Count ||
                !Equals(RowTransform, transformStack.RowTransforms[transformIndex]))
            {
                return(parentResults);
            }
            return(this);
        }
Exemplo n.º 6
0
 internal TransformVolume(Volume root)
 {
     Root           = root;
     transformStack = Transform3.NewTransformStack();
 }
Exemplo n.º 7
0
 public QueryParameters ChangeTransformStack(TransformStack value)
 {
     return(ChangeProp(ImClone(this), im => im.TransformStack = value));
 }
Exemplo n.º 8
0
 public QueryParameters(ViewInfo viewInfo, TransformStack rowTransform, ListSortDescriptionCollection sortDescriptions)
 {
     ViewInfo       = viewInfo;
     TransformStack = rowTransform;
 }