Based on the 3 sdnmap tutorial, an application is built.ProgramFrame. When running, use eagleeye to operate the map. If an exception occurs, the main map control can be displayed normally when you right-click the eagleeye frame. When you left-click the eagleeye, the main map control becomes blank. At first, I thought it was not displayed. Later, I checked and found that the map moved a lot to the east. Removed from the current view range. The primary map control and eagleeye control are loaded with the same map. If you try another map, the function is normal.
Later it was found that an exception occurred because the secondary map contains different coordinate systems. Although it can be normally superimposed and displayed together, the map coordinates obtained through parameter E in the mousemove event are inconsistent with those obtained from the primary map, the eagleeye control is abnormal.
The main map control contains the following layers:
1. Dem WGS-1984 coordinate system.
2. Perimeter. SHP Xi'an 1980 Coordinate System
Add a map to the eagleeye ControlCodeAs follows:
This. axmapcontrol2.addlayer (this. axmapcontrol1.map. get_layer (this. axmapcontrol1.layercount-I ));
To ensure data display consistency, add the last layer of mapcontrol1 before adding data. Therefore, the first layer added to the eagleeye control is the border. SHP. The Coordinate System of the control is the Xi'an 1980 coordinate system, and the layers subsequently added are automatically converted to the coordinate system. The coordinate system of the main map control is the first layer, that is, the wgs1984 coordinate system. Therefore, the eagleeye control and the main map control have different spatial references, leading to an exception in the eagleeye operation.
Solution:
To make the eagleeye control consistent with the space reference of the main map control, add the following code:
Axmapcontrol2.spatialreference = axmapcontrol1.spatialreference;