Helper class to perform manipulation of the tree nodes
        internal PropertyMappingsNodeDecorator(CopyTaskNodeDecorator parent, TreeNode mappingsNode)
        {
            Parent                = parent;
            _node                 = mappingsNode;
            _treeView             = _node.TreeView;
            _selectedPropertyMenu = BuildSelectedPropertyContextMenu(Parent.TargetClass, OnMapProperty, OnRemovePropertyMapping, OnMapAutoCreate);
            _conversionOptions    = new Dictionary <string, PropertyConversionNodeDecorator>();
            SortedList <string, PropertyDefinition> props = new SortedList <string, PropertyDefinition>();

            foreach (PropertyDefinition pd in Parent.SourceClass.Properties)
            {
                if (pd.PropertyType == PropertyType.PropertyType_DataProperty || pd.PropertyType == PropertyType.PropertyType_GeometricProperty)
                {
                    props.Add(pd.Name, pd);
                }
            }
            foreach (PropertyDefinition prop in props.Values)
            {
                this.AddProperty(prop);
            }

            _node.ContextMenuStrip = new ContextMenuStrip();
            var item = _node.ContextMenuStrip.Items.Add("Auto-Map", null, OnAutoMap);

            item.ToolTipText = "Maps each un-mapped property to a property of the same name (will be created if doesn't exist)";
        }
Exemplo n.º 2
0
        internal OptionsNodeDecorator(CopyTaskNodeDecorator parent, TreeNode optionsNode)
        {
            Parent = parent;
            _node  = optionsNode;

            InitContextMenus();

            //Options - Delete Target
            TreeNode delTargetNode = new TreeNode("Delete Target");

            delTargetNode.ToolTipText      = "Delete all features on the feature class before copying (true: enabled, false: disabled)";
            delTargetNode.Name             = OPT_DEL_TARGET;
            delTargetNode.ContextMenuStrip = ctxDeleteTarget;

            //Options - Source Class Filter
            TreeNode srcFilterNode = new TreeNode("Source Class Filter");

            srcFilterNode.ToolTipText      = "The filter to apply to the source query where the features will be copied from";
            srcFilterNode.Name             = OPT_CLS_FILTER;
            srcFilterNode.ContextMenuStrip = ctxSourceFilter;

            //Options - Flatten Geometries
            TreeNode flattenNode = new TreeNode("Flatten Geometries");

            flattenNode.ToolTipText      = "If true, will strip all Z and M coordinates from geometries being copied";
            flattenNode.Name             = OPT_FLATTEN;
            flattenNode.ContextMenuStrip = ctxFlatten;

            //Options - Force WKB
            TreeNode forceWkbNode = new TreeNode("Force WKB Geometry");

            forceWkbNode.ToolTipText      = "If true, will force the input geometry to be WKB compliant";
            forceWkbNode.Name             = OPT_FORCEWKB;
            forceWkbNode.ContextMenuStrip = ctxForceWkb;

            _node.Nodes.Add(delTargetNode);
            _node.Nodes.Add(srcFilterNode);
            _node.Nodes.Add(flattenNode);
            _node.Nodes.Add(forceWkbNode);

            //Set default values to avoid any nasty surprises
            this.Delete       = false;
            this.SourceFilter = string.Empty;
            this.Flatten      = false;
            this.ForceWkb     = false;

            //Test for batch support
            using (FdoFeatureService svc = Parent.GetTargetConnection().CreateFeatureService())
            {
                if (svc.SupportsBatchInsertion())
                {
                    TreeNode batchNode = new TreeNode("Insert Batch Size");
                    batchNode.ToolTipText      = "The batch size to use for batch insert. If set to 0, normal insert will be used";
                    batchNode.ContextMenuStrip = ctxBatchSize;
                    _node.Nodes.Add(batchNode);
                    //Set default values to avoid any nasty surprises
                    this.BatchSize = 0;
                }
            }
        }
 internal ExpressionMappingsNodeDecorator(CopyTaskNodeDecorator parent, TreeNode exprsNode)
 {
     _conv = new Dictionary<string, PropertyConversionNodeDecorator>();
     Parent = parent;
     _node = exprsNode;
     _treeView = _node.TreeView;
     InitContextMenus();
     _node.ContextMenuStrip = _mappingsMenu;
 }
 internal ExpressionMappingsNodeDecorator(CopyTaskNodeDecorator parent, TreeNode exprsNode)
 {
     _conv     = new Dictionary <string, PropertyConversionNodeDecorator>();
     Parent    = parent;
     _node     = exprsNode;
     _treeView = _node.TreeView;
     InitContextMenus();
     _node.ContextMenuStrip = _mappingsMenu;
 }
        internal OptionsNodeDecorator(CopyTaskNodeDecorator parent, TreeNode optionsNode)
        {
            Parent = parent;
            _node = optionsNode;

            InitContextMenus();

            //Options - Delete Target
            TreeNode delTargetNode = new TreeNode("Delete Target");
            delTargetNode.ToolTipText = "Delete all features on the feature class before copying (true: enabled, false: disabled)";
            delTargetNode.Name = OPT_DEL_TARGET;
            delTargetNode.ContextMenuStrip = ctxDeleteTarget;

            //Options - Source Class Filter
            TreeNode srcFilterNode = new TreeNode("Source Class Filter");
            srcFilterNode.ToolTipText = "The filter to apply to the source query where the features will be copied from";
            srcFilterNode.Name = OPT_CLS_FILTER;
            srcFilterNode.ContextMenuStrip = ctxSourceFilter;

            //Options - Flatten Geometries
            TreeNode flattenNode = new TreeNode("Flatten Geometries");
            flattenNode.ToolTipText = "If true, will strip all Z and M coordinates from geometries being copied";
            flattenNode.Name = OPT_FLATTEN;
            flattenNode.ContextMenuStrip = ctxFlatten;

            //Options - Force WKB
            TreeNode forceWkbNode = new TreeNode("Force WKB Geometry");
            forceWkbNode.ToolTipText = "If true, will force the input geometry to be WKB compliant";
            forceWkbNode.Name = OPT_FORCEWKB;
            forceWkbNode.ContextMenuStrip = ctxForceWkb;

            _node.Nodes.Add(delTargetNode);
            _node.Nodes.Add(srcFilterNode);
            _node.Nodes.Add(flattenNode);
            _node.Nodes.Add(forceWkbNode);

            //Set default values to avoid any nasty surprises
            this.Delete = false;
            this.SourceFilter = string.Empty;
            this.Flatten = false;
            this.ForceWkb = false;

            //Test for batch support
            using (FdoFeatureService svc = Parent.GetTargetConnection().CreateFeatureService())
            {
                if (svc.SupportsBatchInsertion())
                {
                    TreeNode batchNode = new TreeNode("Insert Batch Size");
                    batchNode.ToolTipText = "The batch size to use for batch insert. If set to 0, normal insert will be used";
                    batchNode.ContextMenuStrip = ctxBatchSize;
                    _node.Nodes.Add(batchNode);
                    //Set default values to avoid any nasty surprises
                    this.BatchSize = 0;
                }
            }
        }
        internal PropertyMappingsNodeDecorator(CopyTaskNodeDecorator parent, TreeNode mappingsNode)
        {
            Parent = parent;
            _node = mappingsNode;
            _treeView = _node.TreeView;
            _selectedPropertyMenu = BuildSelectedPropertyContextMenu(Parent.TargetClass, OnMapProperty, OnRemovePropertyMapping, OnMapAutoCreate);
            _conversionOptions = new Dictionary<string, PropertyConversionNodeDecorator>();
            SortedList<string, PropertyDefinition> props = new SortedList<string, PropertyDefinition>();
            foreach (PropertyDefinition pd in Parent.SourceClass.Properties)
            {
                if (pd.PropertyType == PropertyType.PropertyType_DataProperty || pd.PropertyType == PropertyType.PropertyType_GeometricProperty)
                {
                    props.Add(pd.Name, pd);
                }
            }
            foreach (PropertyDefinition prop in props.Values)
            {
                this.AddProperty(prop);
            }

            _node.ContextMenuStrip = new ContextMenuStrip();
            var item = _node.ContextMenuStrip.Items.Add("Auto-Map", null, OnAutoMap);
            item.ToolTipText = "Maps each un-mapped property to a property of the same name (will be created if doesn't exist)";
        }