1

I am working on a sample ArcGIS Engine project which tries to map two versions difference on an AxImapControl

i created two mapcontrol which first one loads the MXD file and for second one i make a deep cloning copy of map object using IObjectCopy interface and then change the version of copied object and the load the map in mapcontrol.

but when i load map to second mapcontrol, two mapcontrols are showing the target version which i want to display on second map.

deep cloning in second map's parent form constructor

   IObjectCopy esriObjectCopy = new ObjectCopyClass();

        System.Object copyTarget = axMapControl1.ActiveView.FocusMap;

        esriObjectCopy.Overwrite(pMap, ref copyTarget);

change version after deep cloning

 ESRI.ArcGIS.Carto.IBasicMap basicMap = axMapControl1.ActiveView.FocusMap as ESRI.ArcGIS.Carto.IBasicMap;
        IChangeDatabaseVersion oIChangeDatabaseVersion = new ChangeDatabaseVersionClass();
        ISet set = oIChangeDatabaseVersion.Execute(_ParentVersion, _ChildVersion, basicMap);
2

Problem Solved

pMap is Input arg MainMap and axMapControl1.ActiveView.FocusMap is Input arg ChildMap

    IObjectCopy esriObjectCopy = new ObjectCopyClass();
    System.Object copyTarget = axMapControl1.ActiveView.FocusMap;
    System.Object copySource = pMap;
    esriObjectCopy.Overwrite(copySource , ref copyTarget);
    IBasicMap basicMap = axMapControl1.ActiveView.FocusMap as IBasicMap;
    IChangeDatabaseVersion oIChangeDatabaseVersion = new ChangeDatabaseVersionClass();
   oIChangeDatabaseVersion.Execute(_ParentVersion, _ChildVersion, basicMap);
   esriObjectCopy.Overwrite(copySource , pMap);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.