Exemple #1
0
        private void btnEditComputed_Click(object sender, EventArgs e)
        {
            ListViewItem item     = lstComputed.SelectedItems[0];
            string       alias    = item.SubItems[0].Text;
            string       exprText = "";

            using (var expr = OSGeo.FDO.Expression.Expression.Parse(item.SubItems[1].Text))
            {
                using (var comp = new OSGeo.FDO.Expression.ComputedIdentifier(alias, expr))
                {
                    exprText = comp.ToString();
                }
            }
            exprText = ExpressionEditor.EditExpression(_conn, _presenter.SelectedClass, null, exprText, ExpressionMode.Normal);
            if (exprText != null)
            {
                //Test to see if it is a computed identifier
                using (var expr = OSGeo.FDO.Expression.Expression.Parse(exprText))
                {
                    var comp = expr as OSGeo.FDO.Expression.ComputedIdentifier;
                    if (comp != null)
                    {
                        exprText = comp.Expression.ToString();
                        alias    = GetExpressionAlias(comp.Name);
                    }
                    else
                    {
                        alias = GetExpressionAlias("Expr0");
                    }
                }
                item.SubItems[0].Text = alias;
                item.SubItems[1].Text = exprText;
            }
        }
        private void btnGroupFilter_Click(object sender, EventArgs e)
        {
            string expr = txtGroupFilter.Text;

            expr = ExpressionEditor.EditExpression(_conn, _presenter.SelectedClass, null, expr, ExpressionMode.Filter);
            if (expr != null)
            {
                txtGroupFilter.Text = expr;
            }
        }
        private void btnEditComputed_Click(object sender, EventArgs e)
        {
            ListViewItem item = lstComputed.SelectedItems[0];
            string       expr = item.SubItems[1].Text;

            expr = ExpressionEditor.EditExpression(_conn, _presenter.SelectedClass, null, expr, ExpressionMode.Normal);
            if (expr != null)
            {
                item.SubItems[1].Text = expr;
            }
        }
Exemple #4
0
 private void txtFilter_Enter(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.Filter))
     {
         string filter = ExpressionEditor.EditExpression(_conn, _presenter.SelectedClass, null, this.Filter, ExpressionMode.Filter);
         if (filter != null)
         {
             this.Filter = filter;
         }
     }
     else
     {
         this.Filter = ExpressionEditor.NewExpression(_conn, _presenter.SelectedClass, null, ExpressionMode.Filter);
     }
 }
Exemple #5
0
        private void InitContextMenus()
        {
            ctxDeleteTarget = new ContextMenuStrip();
            ctxSourceFilter = new ContextMenuStrip();
            ctxBatchSize    = new ContextMenuStrip();
            ctxFlatten      = new ContextMenuStrip();
            ctxForceWkb     = new ContextMenuStrip();

            //Delete Target
            ctxDeleteTarget.Items.Add("True", null, delegate { this.Delete = true; });
            ctxDeleteTarget.Items.Add("False", null, delegate { this.Delete = false; });

            //Source Filter
            ctxSourceFilter.Items.Add("Set Filter", null, delegate {
                string filter    = this.SourceFilter;
                string newFilter = ExpressionEditor.EditExpression(Parent.GetSourceConnection(), Parent.SourceClass, null, filter, ExpressionMode.Filter);
                if (filter != newFilter)
                {
                    this.SourceFilter = newFilter;
                }
            });
            ctxSourceFilter.Items.Add("Clear", null, delegate { this.SourceFilter = string.Empty; });

            //Flatten Geometries
            ctxFlatten.Items.Add("True", null, delegate { this.Flatten = true; });
            ctxFlatten.Items.Add("False", null, delegate { this.Flatten = false; });

            //Force wkb
            ctxForceWkb.Items.Add("True", null, delegate { this.ForceWkb = true; });
            ctxForceWkb.Items.Add("False", null, delegate { this.ForceWkb = false; });

            //Batch Size
            ctxBatchSize.Items.Add("Set Size", null, delegate {
                string result = MessageService.ShowInputBox("Batch Size", "Set batch size", this.BatchSize.ToString());
                int size;
                while (!int.TryParse(result, out size))
                {
                    result = MessageService.ShowInputBox("Batch Size", "Set batch size", result);
                    if (result == null) //cancelled
                    {
                        return;
                    }
                }
                this.BatchSize = size;
            });
        }
Exemple #6
0
        private void PromptRightFilter()
        {
            var connMgr = ServiceManager.Instance.GetService <FdoConnectionManager>();
            var conn    = connMgr.GetConnection(this.SelectedRightConnection);

            using (var svc = conn.CreateFeatureService())
            {
                using (ClassDefinition cd = svc.GetClassByName(this.SelectedRightSchema, this.SelectedRightClass))
                {
                    var expr = ExpressionEditor.EditExpression(conn, cd, null, txtRightFilter.Text, ExpressionMode.Filter);
                    if (expr != null)
                    {
                        txtRightFilter.Text = expr;
                    }
                }
            }
        }
        private void OnEditExpression(object sender, EventArgs e)
        {
            TreeNode exprNode = _treeView.SelectedNode;

            Debug.Assert(exprNode.Tag != null);

            ExpressionMappingInfo expr = exprNode.Tag as ExpressionMappingInfo;

            if (expr != null)
            {
                string newExpr = ExpressionEditor.EditExpression(Parent.GetSourceConnection(), Parent.SourceClass, null, expr.Expression, ExpressionMode.Normal);
                if (newExpr != null) //null = cancel
                {
                    exprNode.ToolTipText = "Expression: " + newExpr;
                    expr.Expression      = newExpr;
                }
            }
        }
 private void txtUpdateFilter_Click(object sender, EventArgs e)
 {
     if (_classDef == null)
     {
         using (FdoFeatureService service = _conn.CreateFeatureService())
         {
             _classDef = service.GetClassByName(this.ClassName);
         }
     }
     if (!string.IsNullOrEmpty(this.Filter))
     {
         string filter = ExpressionEditor.EditExpression(_conn, _classDef, null, this.Filter, ExpressionMode.Filter);
         if (filter != null)
         {
             this.Filter = filter;
         }
     }
     else
     {
         this.Filter = ExpressionEditor.NewExpression(_conn, _classDef, null, ExpressionMode.Filter);
     }
 }
Exemple #9
0
        private void btnFilter_Click(object sender, EventArgs e)
        {
            var cls = cmbClass.SelectedItem as ClassDefinition;

            if (cls != null)
            {
                var aliasedClasses = new Dictionary <string, ClassDefinition>();
                aliasedClasses.Add(txtJoinClassAlias.Text, cls);

                bool found = false;
                foreach (FeatureSchema fs in (FeatureSchemaCollection)cmbSchema.DataSource)
                {
                    if (fs.Name == _primarySchemaName)
                    {
                        foreach (ClassDefinition cd in fs.Classes)
                        {
                            if (cd.Name == _primaryClassName)
                            {
                                aliasedClasses.Add(_primaryClassAlias, cd);
                                found = true;
                                break;
                            }
                        }
                    }

                    if (found)
                    {
                        break;
                    }
                }

                string expr = ExpressionEditor.EditExpression(_conn, cls, aliasedClasses, txtJoinFilter.Text, ExpressionMode.Filter);
                if (expr != null)
                {
                    txtJoinFilter.Text = expr;
                }
            }
        }