(1)形成Cache
(2)加工Cache:
D:/Program Files/ArcGIS/DeveloperKit/SamplesNET/Server/Mobile_Applications/Extractor_WinCSharp/Extractor_Win/CSharp/bin/Debug/Extractor.exe
(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");
}
(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);
}