Beispiel #1
0
        private void btnSolve_Click(object sender, EventArgs e)
        {
            Replication.Conflict conflict = conflictControl1.Conflict;
            if (conflict == null)
            {
                return;
            }

            string errMsg;

            if (!conflict.SolveConflict(out errMsg))
            {
                MessageBox.Show("Error: " + errMsg);
            }
            else
            {
                TreeNode selNode = tvConflicts.SelectedNode;
                tvConflicts.SelectedNode = (selNode.NextNode != null) ? selNode.NextNode : _rootNode;

                if (selNode.Parent.Nodes.Count == 1)
                {
                    _rootNode.Nodes.Remove(selNode.Parent);
                }
                else
                {
                    selNode.Parent.Nodes.Remove(selNode);
                }

                if (_doc != null && _doc.Application is IMapApplication)
                {
                    ((IMapApplication)_doc.Application).RefreshActiveMap(DrawPhase.All);
                }
            }
        }
Beispiel #2
0
        private void tvConflicts_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (tvConflicts.SelectedNode is GuidTreeNode)
            {
                GuidTreeNode node = (GuidTreeNode)tvConflicts.SelectedNode;

                _fc = node.FeatureClass;
                if (_fc == null)
                {
                    return;
                }

                Replication.Conflict conflict = Replication.FeatureClassConflict(_fc, node.Guid);
                if (conflict == null)
                {
                    return;
                }

                IEnvelope env = (conflict.Feature != null && conflict.Feature.Shape != null) ? conflict.Feature.Shape.Envelope.Clone() as IEnvelope : null;

                foreach (Replication.ConflictFeature cFeature in conflict.ConflictFeatures)
                {
                    if (cFeature.Feature == null || cFeature.Feature.Shape == null)
                    {
                        continue;
                    }

                    if (env == null)
                    {
                        env = cFeature.Feature.Shape.Envelope.Clone() as IEnvelope;
                    }
                    else
                    {
                        env.Union(cFeature.Feature.Shape.Envelope);
                    }
                }

                if (_doc != null && _doc.FocusMap != null &&
                    _doc.FocusMap.Display != null &&
                    _doc.Application is IMapApplication &&
                    env != null)
                {
                    Envelope e2 = new Envelope(env);
                    e2.Raise(150.0);
                    _doc.FocusMap.Display.ZoomTo(e2);
                    ((IMapApplication)_doc.Application).RefreshActiveMap(DrawPhase.All);
                }

                conflictControl1.Conflict = conflict;

                btnSolve.Enabled = btnRemove.Enabled = btnHighlight.Enabled = true;
            }
            else
            {
                conflictControl1.Conflict = null;
                btnSolve.Enabled          = btnRemove.Enabled = btnHighlight.Enabled = false;
            }
        }