wince的map入门

(1)形成Cache

image

(2)加工Cache:

D:/Program Files/ArcGIS/DeveloperKit/SamplesNET/Server/Mobile_Applications/Extractor_WinCSharp/Extractor_Win/CSharp/bin/Debug/Extractor.exe

image

(3)code:

ESRI.ArcGIS.Mobile.MapCache mapCache1 = new ESRI.ArcGIS.Mobile.MapCache();

map1.MapCache = mapCache1;
          // mapCache.Url = "http://superstring/arcgis/services/dem/MapServer/MobileServer";
           mapCache1.StoragePath = @"/Temp/dem";
           // mapCache.Create();
           if (!mapCache1.IsValid)
           {
               MessageBox.Show("Map Cache is not valid!");
               return;
           }
           try
           {
               mapCache1.Open();
           }
           catch
           {
               MessageBox.Show("Cannot open map cache");
           }
 
image 
(4)范围查询:
// Mouse down map coordinate private Coordinate m_startCoordinate; // Mouse up map coordinate private Coordinate m_endCoordinate;private void map1_MouseDown(object sender, ESRI.ArcGIS.Mobile.MapMouseEventArgs e)
     {
         m_startCoordinate = e.MapCoordinate;
     } 

     private void map1_MouseUp(object sender, ESRI.ArcGIS.Mobile.MapMouseEventArgs e)
     {
         // Last coordinate used to create an envelope to query features
         m_endCoordinate = e.MapCoordinate; 

         // Finds features that are completely contain in the envelope
         FindFeaturesInEnvelope(); 

     } 

     private void FindFeaturesInEnvelope()
     {
         // Creates a new envelope based on those coordinates
         Envelope envelope = new Envelope(m_startCoordinate, m_endCoordinate); 

         // Retrieves the first layer in the map
         FeatureLayer featureLayer = map1.MapLayers[0].Layer as FeatureLayer; 

         if (featureLayer == null)
             return; 

         // Creates a instance of a query filter. Query filter uses the dragged map rectangle and
         // it will search for all features in layer index = 0, that are contained in this geometry.
         QueryFilter spatialQueryFilter = new QueryFilter(envelope, EsriGeometricRelationship.Contain); 

         // Querying the feature layer
         FeatureLayerDataTable featureLayerDataTable = featureLayer.GetDataTable(spatialQueryFilter); 

         // If feature layer data table has no rows back
         if (featureLayerDataTable.Rows.Count == 0)
         {
             MessageBox.Show("No features found");
             return;
         } 

         // If rows back, grabs the first row and geometry column in order to get the feature's geometry
         // and highlight it in order to locate the feature in the map
         Geometry geometry = featureLayerDataTable.Rows[0][featureLayerDataTable.GeometryColumnIndex] as Geometry; 

         // if no geometry
         if (geometry == null)
             return; 

         Pen p = new Pen(Color.Red);
         SolidBrush brush = new SolidBrush(Color.White); 

         // If geometry is valid, the map will rendered it 3 times every 150 milliseconds.
         map1.FlashGeometry(p, brush, 15, 150, 3, geometry);
     }
 
 
 
 
 
 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值