Basic Query Windows
This commit is contained in:
parent
59f3c97c1e
commit
b5a8793281
@ -54,6 +54,15 @@
|
||||
<MenuItem x:Name="Menu_Buffer" Header="缓冲" Click="Menu_Buffer_OnClick"></MenuItem>
|
||||
<MenuItem x:Name="Menu_Intersection_Point" Header="求交点" Click="Menu_Intersection_Point_OnClick"></MenuItem>
|
||||
</MenuItem>
|
||||
<MenuItem Header="属性查询">
|
||||
<MenuItem x:Name="Menu_Attribute_Query" Header="按属性查询" Click="Menu_Attribute_Query_OnClick"></MenuItem>
|
||||
<MenuItem Header="按位置查询">
|
||||
<MenuItem x:Name="Menu_Query_Point" Header="点击选择" Click="Menu_Query_Point_OnClick"></MenuItem>
|
||||
<MenuItem x:Name="Menu_Query_Envelope" Header="拉框选择"></MenuItem>
|
||||
</MenuItem>
|
||||
<Separator></Separator>
|
||||
<MenuItem x:Name="Menu_Clear_Selection" Header="清除选择"></MenuItem>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<esri:MapView x:Name="MainMapView" Map="{Binding Map, Source={StaticResource MapViewModel}}" Margin="0,19,0,0"
|
||||
ViewpointChanged="MainMapView_OnViewpointChanged" GeoViewTapped="MainMapView_OnGeoViewTapped"
|
||||
|
||||
@ -77,6 +77,10 @@ namespace GisDevelop_Exp
|
||||
private Point _startPoint;
|
||||
|
||||
private List<Graphic> listOfClipGraphics; //几何操作时选择的图形
|
||||
|
||||
private int selByGeometryType = 0;
|
||||
|
||||
LocationQueryResultsWindow locationQueryResultsWindow ;
|
||||
|
||||
private readonly Dictionary<string, Basemap> _basemapOptions = new Dictionary<string, Basemap>()
|
||||
{
|
||||
@ -954,7 +958,7 @@ namespace GisDevelop_Exp
|
||||
m_CurOper = CURRENTOPERATION.DrawPoint;
|
||||
}
|
||||
|
||||
private void MainMapView_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
private async void MainMapView_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
IInputElement mv = (IInputElement)sender;
|
||||
MapPoint location = MainMapView.ScreenToLocation(e.GetPosition(mv));
|
||||
@ -1003,6 +1007,28 @@ namespace GisDevelop_Exp
|
||||
linesList.Add(lineGraphic);
|
||||
}
|
||||
}
|
||||
|
||||
if(selByGeometryType == 1)//检查是否为按照位置查询中的点选
|
||||
{
|
||||
IInputElement ie = (IInputElement)sender;//转换事件宿主对象为IInputElement对象
|
||||
IReadOnlyList< IdentifyLayerResult> results =await
|
||||
MainMapView.IdentifyLayersAsync(e.GetPosition(ie), 15, false);//根据鼠标点在所有图层中进行查询
|
||||
if(results!=null)//查询结果不为空
|
||||
{
|
||||
if (locationQueryResultsWindow != null &&
|
||||
locationQueryResultsWindow.IsClosed)//位置查询结果子窗体已关闭
|
||||
{
|
||||
locationQueryResultsWindow = null;//将子窗体对象置为空
|
||||
}
|
||||
if (locationQueryResultsWindow == null)
|
||||
{
|
||||
locationQueryResultsWindow = new LocationQueryResultsWindow();//构造新的子窗体对象
|
||||
}
|
||||
locationQueryResultsWindow.ResultCollection = results;//为子窗体引用查询结果集对象
|
||||
locationQueryResultsWindow.Show();//显示该子窗体
|
||||
locationQueryResultsWindow.Activate();//使子窗体处于激活状态
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void Menu_Layers_Options_OnClick(object sender, RoutedEventArgs e)
|
||||
@ -1512,5 +1538,29 @@ namespace GisDevelop_Exp
|
||||
{
|
||||
MessageBox.Show("此功能暂未实现");
|
||||
}
|
||||
|
||||
private void Menu_Attribute_Query_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
List<FeatureTable> myTables;
|
||||
myTables = new List<FeatureTable>();
|
||||
for(int i=0;i<MainMapView.Map.OperationalLayers.Count;i++)
|
||||
{
|
||||
FeatureLayer pFL = MainMapView.Map.OperationalLayers[i] as FeatureLayer;
|
||||
if(pFL != null)
|
||||
{
|
||||
myTables.Add(pFL.FeatureTable);
|
||||
}
|
||||
}
|
||||
AttributeQuery qw = new AttributeQuery();//创建新的查询窗体对象
|
||||
qw.Tables.AddRange(myTables);//为窗体对象的表集合对象添加表集合
|
||||
bool r =(bool) qw.ShowDialog();//以对话框方式显示该子窗体
|
||||
}
|
||||
|
||||
private void Menu_Query_Point_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
selByGeometryType = 1;//设置其值为1
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user