本文整理汇总了C#中AxMapControl.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# AxMapControl.Refresh方法的具体用法?C# AxMapControl.Refresh怎么用?C# AxMapControl.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AxMapControl
的用法示例。
在下文中一共展示了AxMapControl.Refresh方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddLayersToEagleEye
public static void AddLayersToEagleEye(AxMapControl axMapControl1,AxMapControl axMapControl2)
{
// 当主地图显示控件的地图更换时,鹰眼中的地图也跟随更换
axMapControl2.Map = new MapClass();
axMapControl2.ClearLayers();
// 添加主地图控件中的所有图层到鹰眼控件中
for (int i = axMapControl1.LayerCount - 1; i >= 0; i--)
{
axMapControl2.AddLayer(axMapControl1.get_Layer(i));
}
// 设置 MapControl 显示范围至数据的全局范围
axMapControl2.Extent = axMapControl1.Extent;
// 刷新鹰眼控件地图
axMapControl2.Refresh();
}
示例2: FullExtend
/// <summary>
/// 全屏显示
/// </summary>
public static void FullExtend(AxMapControl axMapControl)
{
if (axMapControl == null)
{
return;
}
IEnvelope env = new EnvelopeClass() as IEnvelope;
env.PutCoords(21256119.5385824, 4381043.1259153, 21812540.059758, 4846733.37736962);
axMapControl.ActiveView.Extent = env;
axMapControl.Refresh();
//ICommand pCommand;
//pCommand = new ESRI.ArcGIS.Controls.ControlsMapFullExtentCommand();
//pCommand.OnCreate(axMapControl.Object);
//pCommand.OnClick();
}
示例3: QueryByBuffer
//查询
public static void QueryByBuffer(AxMapControl axMapControl)
{
// IDataset data = null;
ILayer layer = axMapControl.get_Layer(0);
IFeatureLayer featureLayer = layer as IFeatureLayer;
//获取featurelayer的featureClass
IFeatureClass featureClass = featureLayer.FeatureClass;
IFeature feature = null;
IQueryFilter queryFilter = new QueryFilterClass();
IFeatureCursor featureCursor;
queryFilter.WhereClause = "NAME";
featureCursor = featureClass.Search(queryFilter, true);
feature = featureCursor.NextFeature();
if (feature != null)
{
axMapControl.Map.SelectFeature(axMapControl.get_Layer(axMapControl.Map.LayerCount), feature);
axMapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
axMapControl.MousePointer = ESRI.ArcGIS.Controls.esriControlsMousePointer.esriPointerCrosshair;
IGeometry geometry = null;
geometry = axMapControl.TrackPolygon();
//geometry = axMapControl.get_Layer(axMapControl.Map.LayerCount - 1) as IGeometry;
axMapControl.Map.SelectByShape(geometry, null, false);
axMapControl.Refresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
}
示例4: OperateMapDoc
public static void OperateMapDoc(AxMapControl axMapControl1, AxMapControl axMapControl2, string strOperateType)
{
OpenFileDialog OpenFileDialog = new OpenFileDialog();
SaveFileDialog SaveFileDialog = new SaveFileDialog();
OpenFileDialog.Filter = "地图文档文件(*.mxd)|*.mxd";
SaveFileDialog.Filter = "地图文档文件(*.mxd)|*.mxd";
string strDocFileN = string.Empty;
pMapDocument = new MapDocumentClass();
switch (strOperateType)
{
case "NewDoc":
{
SaveFileDialog.Title = "输入需要新建地图文档的名称";
SaveFileDialog.ShowDialog();
strDocFileN = SaveFileDialog.FileName;
if (strDocFileN == string.Empty)
return;
pMapDocument.New(strDocFileN);
pMapDocument.Open(strDocFileN, "");
axMapControl1.Map = pMapDocument.get_Map(0);
break;
}
case "OpenDoc":
{
OpenFileDialog.Title = "输入需要加载的地图文档";
OpenFileDialog.ShowDialog();
strDocFileN = OpenFileDialog.FileName;
if (strDocFileN == string.Empty)
return;
pMapDocument.Open(strDocFileN, "");
for (int i = 0; i < pMapDocument.MapCount; i++)
{
axMapControl1.Map = pMapDocument.get_Map(i);
//axMapControl2.Map = pMapDocument.get_Map(i);
}
axMapControl1.Refresh();
break;
}
case "SaveDoc":
{
if (pMapDocument.get_IsReadOnly(pMapDocument.DocumentFilename) == true)
{
MessageBox.Show("此地图为只读文档", "信息提示");
return;
}
pMapDocument.Save(pMapDocument.UsesRelativePaths, true);
MessageBox.Show("保存成功!", "信息提示");
break;
}
case "SaveDocAS":
{
SaveFileDialog.Filter = "地图文档另存";
SaveFileDialog.ShowDialog();
strDocFileN = SaveFileDialog.FileName;
if (strDocFileN == string.Empty)
return;
if (strDocFileN == pMapDocument.DocumentFilename)
{
pMapDocument.Save(pMapDocument.UsesRelativePaths, true);
MessageBox.Show("保存成功!", "信息提示");
break;
}
else
{
pMapDocument.SaveAs(strDocFileN, true, true);
MessageBox.Show("保存成功", "信息提示");
}
break;
}
default:
break;
}
}
示例5: AddTransTempEle
/// <summary> �ڵ�ͼ�ؼ����������ʱͼԪ/// </summary>
/// <param name="pMapCtrl">��ͼ�ؼ�</param>
/// <param name="pGeo">Envelope��Polygon����ʵ��</param>
/// <param name="bAutoClear">�Ƿ����ԭ������</param>
public void AddTransTempEle(AxMapControl pMapCtrl, IGeometry pGeo, bool bAutoClear)
{
try
{
if (pMapCtrl == null) return;
if (pGeo == null) return;
if (pGeo.IsEmpty) return;
IGeometry pPolygon = null;
if (pGeo is IEnvelope)
{
object Miss = Type.Missing;
pPolygon = new PolygonClass();
IGeometryCollection pGeoColl = pPolygon as IGeometryCollection;
pGeoColl.AddGeometry(pGeo, ref Miss, ref Miss);
}
else if (pGeo is IPolygon)
{
(pGeo as ITopologicalOperator).Simplify();
pPolygon = pGeo;
}
else
{
MessageBox.Show("����ʵ�����Ͳ�ƥ��", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
//��ȡ��Ҫ�ز�
IFeatureLayer pFlyr = null;
for (int i = 0; i < pMapCtrl.LayerCount; i++)
{
if (pMapCtrl.get_Layer(i).Name == "TransTemp")
{
pFlyr = pMapCtrl.get_Layer(i) as IFeatureLayer;
break;
}
}
//����ʱ�㲻������Ҫ����
if (pFlyr == null)
{
pFlyr = AddFeatureLayerByMemoryWS(pMapCtrl, pMapCtrl.SpatialReference);
if (pFlyr == null)
{
MessageBox.Show("��������ʱͼ�㷢���쳣", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
}
IFeatureClass pFC = pFlyr.FeatureClass;
if (bAutoClear)
{
if (pFC.FeatureCount(null) > 0)
{
IFeatureCursor pFCursor = pFC.Search(null, false);
if (pFCursor != null)
{
IFeature pFeature = pFCursor.NextFeature();
if (pFeature != null)
{
while (pFeature != null)
{
pFeature.Delete();
pFeature = pFCursor.NextFeature();
}
}
System.Runtime.InteropServices.Marshal.ReleaseComObject(pFCursor);
}
}
}
//����Ҫ��
IFeature pNFeature = pFC.CreateFeature();
pNFeature.Shape = pPolygon;
pNFeature.set_Value(pFC.FindField("Code"), "1");
pNFeature.Store();
pMapCtrl.Refresh(esriViewDrawPhase.esriViewGeography, pFlyr, pFlyr.AreaOfInterest);
}
catch (Exception Err)
{
MessageBox.Show(Err.Message, "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}