POST
|
My code is gonna below: private void EagleEye_Load(object sender, EventArgs e) {
toolbar.SetBuddyControl(map_main.Object);
toc.SetBuddyControl(map_main.Object);
}
#region Even on Main map
//Update extend map.
private void map_main_OnExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnExtentUpdatedEvent e) {
IRgbColor rgb = new RgbColorClass(); //The color of the Outline.
rgb.Red = 255;
rgb.Green = 0;
rgb.Blue = 0;
rgb.Transparency = 255;
ISimpleLineSymbol outLine = new SimpleLineSymbolClass(); //The outline.
outLine.Color = rgb;
outLine.Width = 3; //The width of the outline.
rgb = new RgbColorClass(); //The fill color.
rgb.Red = 255;
rgb.Green = 0;
rgb.Blue = 0;
rgb.Transparency = 0;
ISimpleFillSymbol fill = new SimpleFillSymbolClass(); //The fill style.
fill.Outline = outLine;
fill.Color = rgb;
IRectangleElement rectangle = new RectangleElementClass(); //The selection element.
IElement rectangleElement = rectangle as IElement;
IFillShapeElement shape = rectangleElement as IFillShapeElement;
shape.Symbol = fill;
rectangleElement.Geometry = (IEnvelope)e.newEnvelope;
IGraphicsContainer mapContainer = map_eagle.Map as IGraphicsContainer;
mapContainer.DeleteAllElements(); //Delete elements in the hawkeye map.
mapContainer.AddElement((IElement)shape, 0);
IActiveView view = mapContainer as IActiveView;
view.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
//Replace map.
private void map_main_OnMapReplaced(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMapReplacedEvent e) {
map_eagle.Map.AddLayer(this.GetOverviewLayer(map_main.Map));
map_eagle.Extent = map_main.FullExtent;
map_eagle.ActiveView.Refresh();
}
private void map_main_OnFullExtentUpdated(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnFullExtentUpdatedEvent e) {
map_eagle.Map.AddLayer(this.GetOverviewLayer(map_main.Map));
map_eagle.Extent = map_main.FullExtent; //Change the hawkeye map extent as the main map.
map_eagle.Refresh();
}
#endregion
#region Even on Halkeye map.
private void map_eagle_OnMouseMove(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseMoveEvent e) {
if(e.button == 1) {
IPoint p = new PointClass();
p.PutCoords(e.mapX, e.mapY);
map_main.CenterAt(p);
map_main.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
}
private void map_eagle_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e) {
if(map_main.LayerCount > 0) { //Has layer.
if(e.button == 1) { //Left click.
IPoint p = new PointClass();
p.PutCoords(e.mapX, e.mapY);
map_main.CenterAt(p);
}
else if(e.button == 2) { //Right click.
map_main.Extent = map_eagle.TrackRectangle();
}
else throw new ArgumentNullException("???????????!");
map_main.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
}
#endregion
/// <summary>
/// Get the maxnum extent layer.
/// </summary>
/// <param name="map">The map that contains the layers..</param>
/// <returns>the maxnum extent layer</returns>
private ILayer GetOverviewLayer(IMap map) {
if(map.LayerCount <= 0) throw new ArgumentNullException("None layer!");
ILayer maxLayer = map.get_Layer(0);
for(int i = 1; i < map.LayerCount; i++) {
if(map.get_Layer(i).AreaOfInterest.Width > maxLayer.AreaOfInterest.Width)
maxLayer = map.get_Layer(i);
}
return maxLayer;
} It seems that I refresh so much or someting else,and I always want to search for improving the performance. Could you launch someting? Thanks very much.
... View more
10-04-2013
08:10 PM
|
0
|
0
|
726
|
POST
|
I am not sure I follow. The license initializer may or may not be used in your code. Typically that gets added to the project when you use an esri template. I don't know what type of project, form, console, library you have. It might be called in the application initialization events, in the main function of a class or in the load of a form. The best thing is to search for references to it in your code. I have overviewed the code in the initializer,but I do't know which is something we talk about,It seems unabvious.you know that,therefore I do not how to search for the reference. Thanks all the same.
... View more
10-01-2013
06:45 PM
|
0
|
0
|
224
|
POST
|
Hi, my friends,I am new to the ArcEngine,but counld you launch me what's done when the Buddy property of ToolbarControl is set to a MapControl. Here is the code: private void Form1_Load(object sender, EventArgs e) {
toolbar.SetBuddyControl(map_main);//Set the MapControl as the Buddy control of ToolBar.
toc.SetBuddyControl(map_main);
} The toolbar is not active when I add the two sentence codes when the form loads.But when I manual set the Buddy property of the ToolBar,you know that,when the ToolBar is activate when running the App. Or this two actions do not do the same work? I always think that they do the same work,is'n it? Thanks for your time.
... View more
10-01-2013
02:16 AM
|
0
|
0
|
437
|
POST
|
The license initializer initializes the ArcGIS (engine runtime, advanced etc.) that is necessary to use ArcObjects components. Without a license attempting to use ArcObjects classes will fail. Thanks for answering. It seems that the license do something,and that is what I thought about,but can you just launch me sth. such as If the initializer launch the code or not.I mean that the work is done behind or lauch us the code about that.
... View more
09-30-2013
08:57 PM
|
0
|
0
|
224
|
POST
|
I am confuse about the "syc. about Map And PageLayout". As I posted a thread before, the same issue about this.But nobody reply.Sad about saying this. Here is the siple code: //Swith page between "Map" and "PageLayout".
private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) {
if (tab_control.SelectedIndex == 0) { //Switch to the Map View page.
toolbar.SetBuddyControl(map);
toc.SetBuddyControl(map);
}
else if (tab_control.SelectedIndex == 1) { //Switch to the PageLayout page.
toolbar.SetBuddyControl(page_layout);
toc.SetBuddyControl(page_layout);
}
}
private void FormMain_Load(object sender, EventArgs e) {
//Set the Map as the buddies for the ToolBar and TOCControl.
toolbar.SetBuddyControl(map);
toc.SetBuddyControl(map);
} If this code run in a App that is not contain a stuff called "LicenseInitializer.cs". The App will auto shut down when I switch the Page "Map" to "PageLayout".That is to say,I just do not know what the sfuff "LicenseInitializer.cs" do, the APP runs normal when switch the same way.
... View more
09-29-2013
08:19 PM
|
0
|
4
|
452
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|