Exemple #1
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;
            }
        }