如何安装Himap进行时




             一.下载HiMap软件开发包v2.1版本: HiMap_sdk_v2_1.

             二.安装HiMap运行时,您需要将HiMap.Carto.dll, HiMap.Driver.dll, HiMap.Geometry.dll,

                  HiMap.MapControls.dll,HiMap.Style.dll,HiMap.CoordinateSystem, HiMap.Base , KMGisLib

                 dll 拷贝到您的应用程序所在的移动设备的目录中,例如:\ProgramFiles\ DeviceApplication1

                 "。您可以使用 Microsoft ActiveSync 或 存储卡来拷贝文件。

             三.使用VS2005自动部署KMGisLib.dll:

                 1. 在[解决方案资源管理器]窗口中的[DeviceApplication1]项目上单击鼠标右键,选择[添加]->

                  [现有项]。

                 2.找到"himap_v2_for_netcf"解压后的文件目录,在[文件类型]中选择"可执行文件 (*. exe;

                 *. dll *. ocx)"。

                 3.选择 "KMGisLib.dll" 文件和"gdalce.dll",点击[添加]按钮。

                 4.在[解决方案资源管理器]窗口中选择"KMGisLib.dll"文件和"gdalce.dll", 在[属性]窗口中,设置

                 文件属性[复制到输出目录:如果较新则复制]和[生成操作:内容]。

                 5.部署您的程序。




               1. 请您解压缩himap_v2_for_net_cf.zip文件到本地磁盘目录,您将看到下面这几个*.dll文件:

                    HiMap.Carto.dl, HiMap.Driver.dll,HiMap.Geometry.dll, HiMap.MapControls.dll, HiMap.Style

                   .dll, HiMap.CoordinateSystem.dll, HiMap.Base.dll, KMGisLib.dll.

               2. 运行Mi11crosoft Visual Studio 2005 (以下简称为VS2005), 在[文件]菜单中选择[新建]->[项

                   目]。 在[新建项目]窗口中,选择[Visual C#]->[智能设备]->[Windows Mobile 6 Professional]

                   ->[Device Application]->[确定]

              3. 在[解决方案资源管理器]中,鼠标右键单击[引用]项,选择[添加引用]。

              4. 在[添加引用]窗口中,选择[浏览]标签,选择以下7个文件:HiMap.Carto.dll,

                  HiMap.Driver.dll, HiMap.Geometry.dll, HiMap.MapControls.dll, HiMap.Style.dll,

                  HiMap.CoordinateSystem.dll, HiMap.Base.dll,点击[确定]按钮.
 
             5. 右键点击[工具]窗口的空白处,选择[选择项]。

             6. 在[选择工具箱项]窗口中,选择[.NET Framework 组件]标签,点击[浏览]按钮。

             7. 在弹出的[打开]窗口中,找到"HiMap.MapControls.dll"文件,并点击[打开]按钮。

             8. 您现在可以在[工具箱]窗口中将"MapControl"控件托拽到"Form1.cs [设计]"窗体的Form1中.

                 恭喜您! 您已经成功的在VS2005 环境中配置了HiMap控件。

  



             一. 创建项目:MyHimap

                  1. 请您将himap_v2_for_net_cf.zip文件解压到本地磁盘目录,您将看到以下文件:

                       HiMap.Base.dll, HiMap.Carto.dll, HiMap.CoordinateSystem.dll, HiMap.Driver.dll,

                       HiMap.Geometry.dll, HiMap.MapControls.dll, HiMap.Style.dll, KMGisLib.dll.

                  2. 启动Microsoft Visual Studio 2005 (以下简称为VS2005), 在[文件]菜单中选择[新建]

                       ->[项目]。

                  3. 在[新建项目]窗口中,选择[Visual C#]->[智能设备]->[Windows Mobile 6 Professional]

                      ->[Device Application], 在[名称]栏中输 入"myHiMap",->[确定]

            二. 为工程添加HImap引用

                  1. 在[解决方案资源管理器]中,鼠标右键单击[引用]项,选择[添加引用]。在[添加引用]

                      窗口中,选择[浏览]标签,选择以下7个文件: HiMap.Carto.dll, HiMap.Driver.dll,

                      HiMap.Geometry.dll, HiMap.MapControls.dll, HiMap.Style.dll,HiMap.CoordinateSystem

                     .dll, HiMap.Base.dll,点击[确定]按钮。

            三. 将Himap的.NET框架精简版组件添加到工具箱

                  1. 右键点击[工具]窗口的空白处,在弹出的菜单中选择[选择项]。

                  2. 在[选择工具箱项]窗口中,选择[.NET Framework 组件]标签,点击[浏览]按钮。

                  3. 在弹出的[打开]窗口中,找到"HiMap.MapControls.dll"文件,并点击[打开]按钮。

                  4. 在[选择工具箱项]窗口中,点击[确定]。

                  5. 添加文件成功后,"MapControl"将出现在[工具箱]中。

           四. 将HiMap的MapControl控件添加到窗体并且编写一些基础方法的代码。

                  1. 在[工具箱]窗口中找到 "MapControl" 控件,将"MapControl"控件拖拽到"Form1.cs

                       [设计]" 窗口, 设置mapControl1的属性[Dock: Fill]。

                  2. Form1.cs代码窗体,在"namespace myHiMap"上方添加"using HiMap.Carto;" 和 "

                      using HiMap.Driver;"代码。

      using HiMap.Carto;

      using HiMap.Driver;





                  3. 向Form1添加"Form1_Load"事件, 并且输入以下代码.



    //定义地图对象

     Map _map;

     private void Form1_Load(object sender, EventArgs e)

     {

     _map = new Map("test");

     mapControl1.Map = _map;

     //这个xml文件是地图图档文件

     mapControl1.Map.FromKmd("\\Storage Card\\nyc.xml");

     mapControl1.MapRefresh();

     HiMap.MapControls.Tools.ITool pTool = new HiMap.MapControls.Tools.ToolPan();

     pTool.OnCreate(this.mapControl1);

     this.mapControl1.CurTool = pTool;

     }



                  4. 使用Microsoft ActiveSync(本示例使用的是4.5.0版本)连接工具,将PC连接到Windows Mobile 5.0 for Pocket PC

                       或 Windows Mobile 6 Professional的移动设备。

                  5. 右键点击[解决方案资源管理器]窗口中的工程[myHiMap],在弹出的菜单中选择[部署]。

                  6. 在成功部署后,将himap_v2_for_net_cf.zip文件中的KMGisLib.dll文件拷贝到移动设备"\Program Files\myhimap"

                      目录中。或者,使用VS2005的部署功能将其自动部署到程序目录中,请参考"如何安装HiMap运行时"来获得这部分

                      的详细帮助。

           五. 将地图文件拷贝到移动设备,并且运行项目

                 1. 请将文件"nyc.xml, nyc_mainroads.shp, nyc_mainroads.shx, nyc_mainroads.dbf"拷贝到移动设备目录"\Storage Card"

                      ,可以使用Microsoft ActiveSync同步工具或存储卡来拷贝。

                 2. 点击VS2005中的[启动调试(F5)]按钮。

                 3. 恭喜您!您的第一个HiMap工程运行成功。


           1. HiMap.Base.dll



           

           2. HiMap.Carto.dll



           

           3. HiMap.CoordinateSystem.dll



           

           4. HiMap.Driver.dll



           

           5.HiMap.Geometry.dll



           

           6.HiMap.MapControls.dll



           

           7.HiMap.Style.dll



           



     1.摘要



               这篇文章总结了如何由地图坐标转换到屏幕坐标。



     2.预览



               由地图坐标得到屏幕坐标.

              //设置一个地图坐标点的值



     double dMapX = 123.4000;

     double dMapY = 40.3200;

     //将这个地图坐标点转换成屏幕坐标点

     System.Drawing.Point screenPoint = mapControl1.MapToScreen(dMapX, dMapY);


     //显示结果

     MessageBox.Show("屏幕 x:" + screenPoint.X.ToString() + "\r\n" + "屏幕 y:" + screenPoint.

        Y.ToString());





     1.摘要



               本文主要讲述如何将屏幕坐标转换成地图坐标

     2.详情





     //定义屏幕坐标点

     int iScreenX = 100;

     int iScreenY = 200;

     //从屏幕坐标转换到地图坐标

     IPoint mapPoint = mapControl1.PointToMapPoint(iScreenX, iScreenY);

     //显示结果

     MessageBox.Show("地图 x:"+ mapPoint.X.ToString() + "\r\n" + "地图 y:" + mapPoint.Y.

        ToString());



     1.示例:



              1. 根据经纬度位置绘制.





    //定义一个Brush对象

    Brush brush = new SolidBrush(Color.Yellow);

    //定义Pen、color和尺寸

    Pen pen = new Pen(Color.Blue, 2);

    //绘点

    mapControl.DrawPoint(pen, brush, 123.111, 41.111, 2);



               2. 根据屏幕坐标绘制.





     //定义一个矩形Rectangle

      Rectangle rectangle = new Rectangle(10, 20, 5, 5);

      //绘点

      mapControl.DrawPoint(new Pen(Color.Red), new SolidBrush(Color.Blue), rectangle);



     2.备注


               绘制的前提条件:MapControl控件必须包含图层。



     1.示例:





      //定义Pen

      Pen pen = new Pen(Color.Blue, 2);

      //定义一些以屏幕坐标为单位的点

      Point[] arrPoint = new Point[5];

      arrPoint[0].X = 40;

      arrPoint[0].Y = 30;

      arrPoint[1].X = 100;

      arrPoint[1].Y = 30;

      arrPoint[2].X = 120;

      arrPoint[2].Y = 80;

      arrPoint[3].X = 50;

      arrPoint[3].Y = 70;

      arrPoint[4].X = 40;

      arrPoint[4].Y = 90;

      //绘制线段

      mapControl.DrawLine(pen, arrPoint);



        有3个函数可以绘制临时线段.

           1. 使用屏幕点集合绘制.



     public void DrawLine(Pen pen, Point[] pts);



          2. 使用地图点集合绘制.



     public void DrawLine(Pen pen, IPoint[] pts);



         3. 使用屏幕坐标的起点、终点绘制.



     public void DrawLine(Pen pen, Point pt1, Point pt2);



     1.示例:





     //定义Pen

     Pen pen = new Pen(Color.Blue, 2);

     //定义Brush

     Brush brush = new SolidBrush(Color.Yellow);

     //为多边形定义一些屏幕坐标点

     Point[] arrPoint = new Point[4];

     arrPoint[0].X = 40;

     arrPoint[0].Y = 30;

     arrPoint[1].X = 100;

     arrPoint[1].Y = 30;

     arrPoint[2].X = 120;

     arrPoint[2].Y = 80;

     arrPoint[3].X = 50;

     arrPoint[3].Y = 70;

     //绘制多边形

     mapControl.DrawPolygon(pen,brush,arrPoint);



     2.备注:



               因为多边形包括多个点,所以必须先创建一个点集合。


     1.示例:





     //定义Pen

     Pen pen = new Pen(Color.Blue, 2);

     //绘制椭圆

     mapControl.DrawEllipse(pen, new Rectangle(30, 40, 120, 125));



     2.备注:


                有两种绘制椭圆的方法.

                   1. 使用屏幕坐标矩形来绘制.



     public void DrawEllipse(Pen pen, Rectangle rect);



                   2. 使用屏幕坐标的左x值,上y值,宽度和高度来绘制.



     public void DrawEllipse(Pen pen, int x, int y, int width, int height);





     1.摘要



              Geodatabase API可以使用多种方式查询Geodatabase中的对象。使用IQueryFilter和ISpatialFilter对象可以设置查询条件。本

                 问简短的讨论了如何使用QueryFilters查询geodatabse 对象,例如table或feature。



     2.预览



              

     3.详情



                 使用IQueryFilter接口查询一个Geodatabase Feature Class.


                   • 查询的代码.



    IFeature ift = null;

    IFeatureCursor ifc;

    IFeatureClass cls;

    //定义将要查询的字段

    string strSearchField = "";

    //定义将要查询的值

    string strQueryValue = "PAL";

    string strQueryResult = "";

    for (int i = 0; i < this._mapControl.Map.LayerCount; i++)

    {

    IFeatureLayer featureLayer = (IFeatureLayer)this._mapControl.Map.GetLayer(i);

    switch (featureLayer.GeometryType)

    {

    case GeometryType.Polyline:

    strSearchField = "HWYNAME";

    break;

    case GeometryType.Polygon:

    strSearchField = "NAME";

    break;

    case GeometryType.Point:

    strSearchField = "ObjectID";

    break;

    default:

    strSearchField = "ObjectID";

    break;

    }

    //得到一条数据

    cls = (HiMap.Carto.IFeatureClass)featureLayer.Class;

    //进行模糊查询,查询"HWYNAME"字段[char数据类型] 包含 'PAL%'值的

    string strTemp = strSearchField + " like '" + strQueryValue + "%'";

    //查询数据

    ifc = CSearch.GetFeatureCursor(_mapControl, i, strTemp);

    //定位到数据

    ift = ifc.Next();

    if (ift != null)

    {

    while (ift != null)

    {

    strQueryResult += ift.GetValue(cls.Fields.FindField(strSearchField)).ToString();

    strQueryResult += "\r\n";

    ift = ifc.Next();

    }

    }

    }

    MessageBox.Show(strQueryResult);



                   • 查询功能的子函数.



   /子函数,查询某层的数据指针

   //查询某层的数据指针

   public static IFeatureCursor GetFeatureCursor(HiMap.MapControls.MapControl map, int

   varIndex, string condition)

   {

   //获得layer对象

   IFeatureLayer lyr = (IFeatureLayer)map.Map.GetLayer(varIndex);

   IFeatureClass fcls = (IFeatureClass)lyr.Class;

   //创建query filter

   IQueryFilter qf = new QueryFilterClass();

   //设置查询条件

   qf.WhereClause = new StringBuilder(condition);

   //查询

   IFeatureCursor cur = fcls.Search(qf);

   //返回指针

   return cur;

   }

                 
          
                


     1.摘要


 

                 本文将展示如何使用HiMap进行点选查询。


     2.预览



              

     3.详情



                   创建一个继承HiMap.MapControls.Tools.ToolClass的ToolInfoClass对象来进行查询。





       using System;

       using System.Collections.Generic;

       using System.Text;

       using HiMap.Carto;

       using HiMap.Driver;

       using HiMap.Geometry;

       using HiMap.MapControls;

       using HiMap.MapControls.Tools;

       using HiMap.Style;

       using System.Windows.Forms;

       namespace NaviSoftHiMap

       {

      public class ToolInfoClass : HiMap.MapControls.Tools.ToolClass

       {

       //重写事件

       protected override void OnMouseDown(object sender, System.Windows.Forms.

       MouseEventArgse)

       {

      //创建空间查询对象

       HiMap.Carto.ISpatialFilter sf = new HiMap.Carto.SpatialFilterClass();

      //设置查询条件(范围)

      sf.Buffer = double.Parse(Settings.POISearchRadius);

       sf.QType = QueryType.Pixel;

       IPoint point = new PointClass();

       point.X = e.X;

       point.Y = e.Y;

       //设置查询的中心点

       sf.Geometry = point;

       //定义数据集

       HiMap.Carto.IFeatureClass cls;

       //定义数据指针

       HiMap.Carto.IFeatureCursor fc;

       FormList frmList = new FormList();

       //循环图层

       for (int i = 0; i < this.Map.Map.LayerCount; i++)

       {

       //获取全部数据

       cls = (HiMap.Carto.IFeatureClass)this.Map.Map.GetLayer(i).Class;

       //搜索数据

       fc = cls.Search(sf);

       //缓冲数据

       fc.Flush();

       //获得查询后的数据

       HiMap.Carto.IFeature feat = fc.Next();

       while (feat != null)

       {

       ////显示ID字段信息

       //System.Windows.Forms.MessageBox.Show("Name: " + feat.GetValue(cls.Fields.

       FindField(Settings.POISearchField)));

       if (feat.Shape.Type == GeometryType.Polyline)

       {

       frmList.listViewPOIs.Items.Add(new ListViewItem(new string[]

      {

       feat.GetValue(cls.Fields.FindField(Settings.POISearchField)).ToString(),

       ((IPolyline)feat.Shape).GetPoint(0).X.ToString(),

       ((IPolyline)feat.Shape).GetPoint(0).Y.ToString()

       }

       ));

       }

       //转到下一条数据

       feat = fc.Next();

       }

       }

       frmList.ShowDialog();

       }

       }

       }



                如想使用ToolInfoClass工具,请执行以下代码,然后您可以使用鼠标左键点击_mapControl控件查询信息。





      if (_mapControl != null)

       {

       ITool toolInfo = new ToolInfoClass();

       toolInfo.OnCreate(this._mapControl);

       this._mapControl.CurTool = toolInfo;

       }





     1.摘要



                本文将逐步的展示如何向点图层文件(shape file)增加点.



     2.详情



                首先,准备一个点图层,并且加载它。注:这里使用的点图层是通过第三方工具创建的。其中,.dbf文件表结构如下:



                 



         //1.加载点图层,并且允许编辑("edit=true")

        IDataFactory pDataFactory = new ShapeDataFactory("\\Storage Card\\");

        //这里需要使用"edit=true"参数

        IFeatureClass pFeatureClassTemp = (IFeatureClass)pDataFactory.Open("point_

           empty .shp ", true);

        IFeatureLayer pFeatureLayerTemp = new FeatureLayerClass(pFeatureClassTemp);

        mapControl1.Map.AddLayer(pFeatureLayerTemp);

        //2.批量新增点

        //将点添加到shape图层

        //使用GetLayer(0)获得要编辑的图层

        IFeatureLayer pFeatureLayer = (IFeatureLayer)this.mapControl1.Map.GetLayer(0);

        //获得FeatureClass

        IFeatureClass pFeatureClass = (IFeatureClass)pFeatureLayer.Class;

        //开始编辑

        pFeatureClass.BeginEdit();

        //批量新增点

        for (int i = 0; i < 5; i++)

        {

         //创建图元(Feature)

         IFeature pFeature = pFeatureClass.CreateFeature();

         //设置第一个字段id的值为integer类型的"System.DateTime.Now.Ticks"

         pFeature.SetValue(0, System.DateTime.Now.Ticks);

         //设置第二个字段name的值为string类型的"System.DateTime.Now.Ticks.ToString()"

         pFeature.SetValue(1, System.DateTime.Now.Ticks.ToString());

         //设置第三个字段remark的值为string类型的"System.DateTime.Now.ToString()"

         pFeature.SetValue(2, System.DateTime.Now.ToString());

         //生成点对象

         IPoint pPoint = new HiMap.Geometry.PointClass();

         //设置经度和纬度

         pPoint.X = 122.3456;

         pPoint.Y = 43.2324;

         //设置图形,赋给其点对象

         pFeature.Shape = pPoint;

         //保存图元

         pFeature.Save();

         //暂停1秒

        Thread.Sleep(1000);

         }

        //统一保存

         pFeatureClass.SaveEdit();





     1.摘要



                 本文将逐步讲述如何从一个点图层shape文件中删除一个点数据。



     2.详情



              首先,准备一个点图层,并且加载它。

               注:这里使用的点图层是通过第三方工具创建的。其中,.dbf文件表结构如下:



                   



        IFeature feature = null;

        IFeatureCursor featureCursor;

        IFeatureClass featureClass;

        for (int i = 0; i < this.mapControl1.Map.LayerCount; i++)

        {

        IFeatureLayer featureLayer = (IFeatureLayer)this.mapControl1.Map.GetLayer(i);

        //得到featureClass

        featureClass = (HiMap.Carto.IFeatureClass)featureLayer.Class;

        //查询数据

        IQueryFilter queryFilter = new QueryFilterClass();

        //设置查询条件

        queryFilter.WhereClause = new StringBuilder("Id = 1");

        featureCursor = featureClass.Search(queryFilter);

        //定位到查询到的图元

        feature = featureCursor.Next();

        if (feature != null)

        

        //开启编辑

        featureClass.BeginEdit();

        featureClass.DeleteFeature(feature);

        //结束编辑并保存结果

        featureClass.SaveEdit();

        }

        }





     1.摘要



                  本文将逐步讲述如何编辑多边形图层中线段图元的值和图形。



     2.详情



               首先,准备一个图层,并且加载它。

                注:这里使用的图层是通过第三方工具创建的。其中,.dbf文件表结构如下:



                   

       1.修改属性值





      //获取要编辑的图层

      IFeatureLayer pFeatureLayer = (IFeatureLayer)mapControl1.Map.GetLayer(0);

      //定义FeatureClass

      IFeatureClass pFeatureClass = (IFeatureClass)pFeatureLayer.Class;

      //开启编辑

      pFeatureClass.BeginEdit();

      //创建查询对象

      IQueryFilter pQueryFilter=new QueryFilterClass();

      //设置查询条件

      pQueryFilter.WhereClause=new StringBuilder("Id = 1");

      //查询数据

       IFeatureCursor pFeatureCursor = pFeatureClass.Search(pQueryFilter);

       //得到元数据

      IFeature pFeature = pFeatureCursor.Next();

      if (pFeature != null)

      {

      //修改属性值

      pFeature.SetValue(pFeatureClass.Fields.FindField("Name"), "test value");

      //保存

      pFeature.Save();

      }

      //结束编辑,批量保存

       pFeatureClass.SaveEdit();



       2. 修改图元的图形





       //获取要修改的图元所在的图层

      IFeatureLayer pFeatureLayer = (IFeatureLayer)mapControl1.Map.GetLayer(0);

      //创建FeatureClass

      IFeatureClass pFeatureClass = (IFeatureClass)pFeatureLayer.Class;

      //开启编辑

      pFeatureClass.BeginEdit();

      //创建查询器

      IQueryFilter pQueryFilter=new QueryFilterClass();

      //设置查询条件

      pQueryFilter.WhereClause=new StringBuilder("Id = 1");

      //查询数据

      IFeatureCursor pFeatureCursor = pFeatureClass.Search(pQueryFilter);

      //得到要查询的数据

      IFeature pFeature = pFeatureCursor.Next();

      if (pFeature != null)

      {

      //因为图层类型为polyline,所以使用IPloyline接口来获取图形

      HiMap.Geometry.IPolyline polyline = (HiMap.Geometry.IPolyline)pFeature.Shape;

      IPointCollection pPointCollection = (IPointCollection)polyline;

      //使用模拟数据来创建一些点

      IPoint pPoint1 = new PointClass();

      pPoint1.X = "111.2345556";

      pPoint1.Y = "23.2345556";

      IPoint pPoint2 = new PointClass();

      pPoint2.X = "112.2345556";

      pPoint2.Y = "23.3345556";

      //向线段添加点

      pPointCollection.AddPoint(pPoint1);

      pPointCollection.AddPoint(pPoint2);

      //给想要修改的图元设置新的图形

      pFeature.Shape = (IGeometry)polyline;

      //保存

      pFeature.Save();

      }

      //结束编辑,批量保存

      pFeatureClass.SaveEdit();



       3. 向多边形(polygon)图元添加新线段





      //获得要编辑的图层

      IFeatureLayer pFeatureLayer = (IFeatureLayer)mapControl1.Map.GetLayer(0);

      IFeatureClass pFeatureClass = (IFeatureClass)pFeatureLayer.Class;

      //开启编辑

      pFeatureClass.BeginEdit();

      //创建查询器

      IQueryFilter pQueryFilter=new QueryFilterClass();

      //设置查询条件

      pQueryFilter.WhereClause=new StringBuilder("Id = 1");

      //查询数据

      IFeatureCursor pFeatureCursor = pFeatureClass.Search(pQueryFilter);

      //查询到元数据

      IFeature pFeature = pFeatureCursor.Next();

      if (pFeature != null)

      {

      //因为图层类型为polyline,所以使用IPloyline接口来获取图形

      HiMap.Geometry.IPolyline polyline = (HiMap.Geometry.IPolyline)pFeature.Shape;

      //创建新的线段

      IPointCollection pPointCollection = new PolylineClass();

      //使用测试数据创建一些点

      IPoint pPoint1 = new PointClass();

      pPoint1.X = "111.2345556";

       pPoint1.Y = "23.2345556";

      IPoint pPoint2 = new PointClass();

      pPoint2.X = "112.2345556";

      pPoint2.Y = "23.3345556";

      //将点添加到新的线段

      pPointCollection.AddPoint(pPoint1);

      pPointCollection.AddPoint(pPoint2);

      HiMap.Geometry.IGeometryCollection pGeometryCollection =

      (HiMap.Geometry.IGeometryCollection)polyline;

      //将新线段添加进原始的多边形

      pGeometryCollection.AddGeometry((IGeometry)pPointCollection);

      //为要更改的图元设置新图形

      pFeature.Shape = (IGeometry)polyline;

      //保存这个图形

      pFeature.Save();

      }

      //结束编辑,批量保存

      pFeatureClass.SaveEdit();



       1. 直接加载





       //定义数据工程,指向图层文件

       HiMap.Driver.IDataFactory pDataFactory =

                                    new HiMap.Driver.Shape.ShapeDataFactory("\\Storage Card\\maps\\");

       //如果MapControl控件不包含任何Map对象,则创建Map对象

       if (mapControl1.Map == null)

       {

       HiMap.Carto.Map map = new HiMap.Carto.Map("test");

       mapControl1.Map = map;

      }

       HiMap.Carto.IFeatureClass pFeatureClass =

            (HiMap.Carto.IFeatureClass)pDataFactory.Open("one.shp",true);

       HiMap.Carto.IFeatureLayer pFeatureLayer =

                                      new HiMap.Carto.FeatureLayerClass(pFeatureClass);

       mapControl1.Map.AddLayer(pFeatureLayer);

       mapControl1.MapRefresh();



       2. 使用图档文件加载地图





       Map map = new Map("test");

      mapControl1.Map = map;

      mapControl1.FromKmd(@"\Storage Card\maps\maps.xml")



     1.摘要


                   本文将逐步讲述如何加载动态图层和向动态图层添加图形元素。

 

     2.预览



                 

     3.详情


                 将添加3个图元分别添加到3个动态图层。



       Map map = this._mapControl.Map;

       for (int i = map.LayerCount - 1; i >= 0; i--)

       {

       if (map.GetLayer(i).Name == "traceline" || map.GetLayer(i).Name

                                                      == "tracepoint1" || map.GetLayer(i).Name == "tracepoint2")

       {

       map.RemoveAtLayer(i);

       }

       }

       List fields = new List();

       MemoryFeatureClassField mfcf = new MemoryFeatureClassField();

       mfcf.FieldName = "id";

       mfcf.FieldType = MemoryFeatureClassFieldType.Int;

       mfcf.FieldLength = 4;

       mfcf.FieldDecimals = 0;

       fields.Add(mfcf);

       mfcf = new MemoryFeatureClassField();

       mfcf.FieldName = "name";

       mfcf.FieldType = MemoryFeatureClassFieldType.String;

       mfcf.FieldLength = 50;

      mfcf.FieldDecimals = 0;

       fields.Add(mfcf);

       //创建动态图层

       IFeatureClass lineclass = new MemoryFeatureClassClass("traceline", 10,

                GeometryType.Polyline, fields);

       IFeatureLayer layer = new FeatureLayerClass(lineclass);

       //layer.FeatureLayerAuto = true;

       map.AddLayer(layer);

       IFeatureLayerSimpleRender Render =

                                                 new HiMap.Carto.Render.FeatureLayerSimpleRenderClass();

       Render.PolylineStyle.SetLineSymbolWidth(0, 3);

       Render.PolylineStyle.SetLineSymbolColor(0, Color.Red);

       layer.Render = Render;

       //模拟轨迹的路线

       IPolyline line = new PolylineClass();

       //模拟轨迹的点

       IPoint pnt;

       //点1

       pnt = new PointClass();

       pnt.X = -74.0467566;

       pnt.Y = 40.83343789;

       line.AddPoint(pnt);

       //点2

       pnt = new PointClass();

       pnt.X = -74.0506850;

      pnt.Y = 40.78891604;

      line.AddPoint(pnt);

      //点3

       pnt = new PointClass();

       pnt.X = -74.0279483;

      pnt.Y = 40.79415390;

       line.AddPoint(pnt);

       //点4

       pnt = new PointClass();

       pnt.X = -73.9837232;

       pnt.Y = 40.78171397;

       line.AddPoint(pnt);

      IFeature ft = lineclass.CreateFeature();

      ft.SetValue(0, 1);

       ft.SetValue(1, "track");

       ft.Shape = line;

       ft.Save();

       //创建临时点"Orgin"

      IFeatureClass pointclass =

                   new MemoryFeatureClassClass("tracepoint1", 1, GeometryType.Point, fields);

       IFeatureLayer layer1 = new FeatureLayerClass(pointclass);

       map.AddLayer(layer1);

       IFeatureLayerSimpleRender simplerender =

      (IFeatureLayerSimpleRender)layer1.Render;

       simplerender.PointStyle.SetSymbol(0, new PointSymbolBmpClass(new StringBuilder

                    ("\\Storage Card\\BmpStyle\\101.bmp")));

       layer1.LableFieldIndex = 1;

      pointclass.BeginEdit();

       ft = pointclass.CreateFeature();

       ft.SetValue(0, "0");

       ft.SetValue(1, "Origin");

       ft.Shape = line.GetPoint(0);

       ft.Save();

       pointclass.SaveEdit();

       //创建临时点"Destination"

       IFeatureClass pointclass2 =

       new MemoryFeatureClassClass("tracepoint2", 1, GeometryType.Point, fields);

       IFeatureLayer layer2 = new FeatureLayerClass(pointclass2);

       //layer.FeatureLayerAuto = true;

       map.AddLayer(layer2);

       simplerender = (IFeatureLayerSimpleRender)layer2.Render;

       simplerender.PointStyle.SetSymbol(0, new PointSymbolBmpClass

            (new StringBuilder("\\Storage Card\\BmpStyle\\102.bmp")));

       layer2.LableFieldIndex = 1;

       pointclass2.BeginEdit();

       IFeature ftPoint2 = pointclass2.CreateFeature();

       ftPoint2.SetValue(0, "0");

       ftPoint2.SetValue(1, "Destination");

       ftPoint2.Shape = line.GetPoint(line.PointCount - 1);

       ftPoint2.Save();

       pointclass2.SaveEdit();

       double xMin = 0, yMin = 0, xMax = 0, yMax = 0;

       for (int i = 0; i < line.PointCount; i++)

      {

       IPoint p = line.GetPoint(i);

       if (i == 0)

       {

       xMin = p.X;

       yMin = p.Y;

       xMax = p.X;

       yMax = p.Y;

       }

       else

       {

       if (p.X < xMin)

       xMin = p.X;

       if (p.X > xMax)

       xMax = p.X;

       if (p.Y < yMin)

       yMin = p.Y;

       if (p.Y > yMax)

       yMax = p.Y;

       }

       }

       IPoint pt = new PointClass();

       pt.X = (xMax + xMin) / 2;

       pt.Y = (yMax + yMin) / 2;

       double scale = 0;

      if (Math.Abs(xMax - xMin) > Math.Abs(yMax - yMin))

       {

       scale = (xMax - xMin) / (this._mapControl.Map.Envelope.MaxX - this._mapControl.

              Map.Envelope.MinX) * 1.5;

       }

       else

       {

       scale = (yMax - yMin) / (this._mapControl.Map.Envelope.MaxY

         - this._mapControl.Map.Envelope.MinY) * 1.5;

      }

      this._mapControl.Map.CenterAt = pt;

      this._mapControl.Map.MapScale = this._mapControl.Map.MapScale * scale;

      this._mapControl.MapRefresh();



     1.摘要


                   本文将逐步讲述如何在同一图层显示不同的样式,即分组渲染功能。

 

     2.预览



                 

     3.详情




                 使用.NET代码在同一个图层显示不同样式。



       for (int i = 0; i < this._mapControl.Map.LayerCount; i++)

      {

      if (this._mapControl.Map.GetLayer(i).Caption.ToLower() == "nyc_mainroads")

      {

      IFeatureLayer lyr = (IFeatureLayer)this._mapControl.Map.GetLayer(i);

      IFeatureLayerGroupRender Render =

         new HiMap.Carto.Render.FeatureLayerGroupRenderClass(lyr, "HWYNAME");

      Render.DefaultPolylineStyle = new HiMap.Carto.PolylineStyleClass(1);

      Render.AddGroupValue(new StringBuilder("CONVENT AVE"));

      Render.AddGroupValue(new StringBuilder("ADAM CLAYTON POWELL JR BLVD"));

      IPolylineStyle LineStyle = new HiMap.Carto.PolylineStyleClass(1);

      LineStyle.SetLineSymbolColor(1, Color.FromArgb(255, 0, 0));

      LineStyle.SetLineSymbolWidth(1, 10);

      Render.SetPolylineStyle(new StringBuilder("CONVENT AVE"), LineStyle);

      LineStyle = new HiMap.Carto.PolylineStyleClass(1);

      LineStyle.SetLineSymbolColor(1, Color.FromArgb(0, 0, 255));

      LineStyle.SetLineSymbolWidth(1, 5);

      Render.SetPolylineStyle(new StringBuilder("ADAM CLAYTON POWELL JR BLVD"),

          LineStyle);

      IFeatureClass fclass = (IFeatureClass)lyr.Class;

      IQueryFilter qf = new QueryFilterClass();

      qf.WhereClause = new StringBuilder("HWYNAME =

           'CONVENT AVE' or HWYNAME = 'ADAM CLAYTON POWELL JR BLVD'");

      IFeatureCursor fcurosr = fclass.Search(qf);

      IFeature feature = fcurosr.Next();

      IEnvelope envlope = new EnvelopeClass();

      while (feature != null)

      {

      if (feature.Shape.Type == GeometryType.Polyline)

      {

      IPolyline polyline = (IPolyline)feature.Shape;

      this._mapControl.Map.CenterAt = polyline.GetPoint(0);

      break;

      }

      }

      lyr.Render = Render;

      this._mapControl.MapRefresh();

      break;

      }

      }



     1.摘要


                 本文将逐步讲述如何更改标注文字的样式。


     2.预览



                 

     3.详情


                使用.NET代码更改标注的字体尺寸





       for (int i = 0; i < this.mapControl1.Map.LayerCount; i++)

       {

       if (this.mapControl1.Map.GetLayer(i).Caption.ToLower() == "nyc_mainroads")

       {

       IFeatureLayer lyr = (IFeatureLayer)this.mapControl1.Map.GetLayer(i);

       //设置字体尺寸为16象素

       lyr.LabelFontSize = 16;

       //不显示重复的标注

       lyr.FeatureLayerIsAllowSameLabel = false;

       break; ;

       }

       }

      //刷新地图

      mapControl1.MapRefresh();



     1.摘要


                  本文将逐步讲述如何更改标注的优先级(权重)。



     2.预览



                 

     3.详情



              上述不同的图片展示的是nyc_mainrods图层的标注"CATHEDRALPKWY" 优先级高于"Central Park"的优先级。优先级越大,

                    被显示的可能性越大。

             使用.NET代码定义标注的优先级。



       for (int i = 0; i < this.mapControl1.Map.LayerCount; i++)

       {

       if (this.mapControl1.Map.GetLayer(i).Caption.ToLower() == "nyc_mainroads")

       {

       IFeatureLayer lyr = (IFeatureLayer)this.mapControl1.Map.GetLayer(i);

       //不显示重复标注

       lyr.FeatureLayerIsAllowSameLabel = false;

       //设置标注的优先级为1

       lyr.LabelLevel = 1;

       break;

       }

       }

      //刷新地图

      mapControl1.MapRefresh();



     1.摘要


                 本文将逐步讲述如何更改标注文字的排列样式。

 

     2.预览



        
        

     3.详情


                 使用.NET代码设置标注排列方式。





       for (int i = 0; i < this.mapControl1.Map.LayerCount; i++)

      {

       if (this.mapControl1.Map.GetLayer(i).Caption.ToLower() == "nyc_mainroads")

       {

       IFeatureLayer lyr = (IFeatureLayer)this.mapControl1.Map.GetLayer(i);

       //不显示重复标注

       lyr.FeatureLayerIsAllowSameLabel = false;

       //设置标注的排列样式为"LabelArrangementType.Along"

       lyr.LabelArrangementType = LabelArrangementType.Along;

       break;

       }

       }

      //刷新地图

      mapControl1.MapRefresh();



     1.摘要


                 本文将逐步讲述如何创建图片样式符号。

 

     2.预览



                 

     3.详情


                    图片标记样式请使用Window bitmap (BMP)文件。





       for (int i = 0; i < this.mapControl1.Map.LayerCount; i++)

      {

      if (this.mapControl1.Map.GetLayer(i).Caption.ToLower() == "nyc_pois")

      {

      //查找图层

      IFeatureLayer lyr = (IFeatureLayer)this.mapControl1.Map.GetLayer(i);

      //lyr.Render.ToSimpleRender();

      //设置图片标记符号

      HiMap.Carto.Render.IFeatureLayerSimpleRender render =

                new HiMap.Carto.Render.FeatureLayerSimpleRenderClass();

      render.PointStyle.SetSymbol(0, new PointSymbolBmpClass

               (new StringBuilder("\\Storage Card\\BmpStyle\\101.bmp")));

      lyr.Render = render;

      this.mapControl1.MapRefresh();

      break;

      }

      }



     1.摘要


                  本文将逐步描述如何创建线样式符号。

 

     2.预览



                 

     3.详情


                  使用.NET代码设定线样式。





      for (int i = 0; i < this.mapControl1.Map.LayerCount; i++)

      {

      //找到图层

      if (this.mapControl1.Map.GetLayer(i).Caption.ToLower() == "nyc_mainroads")

       {

       IFeatureLayer lyr = (IFeatureLayer)this.mapControl1.Map.GetLayer(i);

       //设置线样式

       HiMap.Carto.Render.IFeatureLayerSimpleRender Render =

                      (HiMap.Carto.Render.IFeatureLayerSimpleRender)lyr.Render;

      //更改线样式中的第0个样式为4象素宽度

       Render.PolylineStyle.SetLineSymbolWidth(0, 4);

      //更改线样式中的第0个样式为蓝色

       Render.PolylineStyle.SetLineSymbolColor(0, Color.Blue);

       mapControl1.MapRefresh();

       break;

       }

       }



     1.摘要


                  本文将讲述如何刷新及使绘图显示区域无效。



     2.详情





         //重绘显示区域

       mapControl1.MapRefresh();



                1. 指定一个点进行定位





      //创建一个点

      IPoint pPoint = new PointClass();

      pPoint.X = "111.2345556";

      pPoint.Y = "23.2345556";

      //设置地图中心点到上述点

      mapControl.Map.CenterAt = pPoint;

      //刷新地图

      mapControl.MapRefresh();



                 2. 指定一个区域进行定位



      //定义区域

      IEnvelope pEnvelope = new EnvelopeClass();

      pEnvelope.MinX = 123.38160821744314;

      pEnvelope.MaxX = 123.41495323446499;

      pEnvelope.MinY = 41.798595643189344;

      pEnvelope.MaxY = 41.835755556226417;

      //设置地图显示区域

      mapControl.Map.Envelope = pEnvelope;

      //刷新地图

      mapControl.MapRefresh();





      1.摘要



                  本文将逐步讲述如何加载动态图层和向动态图层添加图形元素。



      2.预览



                 

     3.详情



                 将添加3个图元分别添加到3个动态图层





        Map map = this._mapControl.Map;

       for (int i = map.LayerCount - 1; i >= 0; i--)

       {

       if (map.GetLayer(i).Name == "traceline" || map.GetLayer(i).Name

                                               == "tracepoint1" || map.GetLayer(i).Name == "tracepoint2")

       {

       map.RemoveAtLayer(i);

       }

       }

       List fields = new List();

       MemoryFeatureClassField mfcf = new MemoryFeatureClassField();

       mfcf.FieldName = "id";

       mfcf.FieldType = MemoryFeatureClassFieldType.Int;

       mfcf.FieldLength = 4;

       mfcf.FieldDecimals = 0;

       fields.Add(mfcf);

       mfcf = new MemoryFeatureClassField();

       mfcf.FieldName = "name";

       mfcf.FieldType = MemoryFeatureClassFieldType.String;

       mfcf.FieldLength = 50;

       mfcf.FieldDecimals = 0;

       fields.Add(mfcf);

       //创建动态图层

       IFeatureClass lineclass = new MemoryFeatureClassClass("traceline",

            10, GeometryType.Polyline, fields);

       IFeatureLayer layer = new FeatureLayerClass(lineclass);

       //layer.FeatureLayerAuto = true;

      IFeatureLayerSimpleRender Render = map.AddLayer(layer);

      Render.PolylineStyle.SetLineSymbolWidth(0, 3);

      Render.PolylineStyle.SetLineSymbolColor(0, Color.Red);

      layer.Render = Render;

      //模拟轨迹的路线

      IPolyline line = new PolylineClass();

      //模拟轨迹的点

      IPoint pnt;

      //点1

      pnt = new PointClass();

      pnt.X = -74.0467566;

      pnt.Y = 40.83343789;

      line.AddPoint(pnt);

      //点2

      pnt = new PointClass();

      pnt.X = -74.0506850;

      pnt.Y = 40.78891604;

      line.AddPoint(pnt);

      //点3

      pnt = new PointClass();

      pnt.X = -74.0279483;

      pnt.Y = 40.79415390;

      line.AddPoint(pnt);

      //点4

      pnt = new PointClass();

      pnt.X = -73.9837232;

      pnt.Y = 40.78171397;

      line.AddPoint(pnt);

      IFeature ft = lineclass.CreateFeature();

      ft.SetValue(0, 1);

      ft.SetValue(1, "track

      ft.Shape = line;

       ft.Save();

       //创建临时点"Orgin"

       IFeatureClass pointclass =

      new MemoryFeatureClassClass("tracepoint1", 1, GeometryType.Point, fields);

      IFeatureLayer layer1 = new FeatureLayerClass(pointclass);

      map.AddLayer(layer1);

      IFeatureLayerSimpleRender M simplerender

              = (IFeatureLayerSimpleRender)layer1.Render

;       simplerender.PointStyle.SetSymbol(0, new PointSymbolB

            mpClass(new StringBuilder("\\Storage Card\\BmpStyle\\101.bmp")));

      layer1.LableFieldIndex = 1;

      pointclass.BeginEdit();

      ft = pointclass.CreateFeature();

      ft.SetValue(0, "0")

      ft.SetValue(1, "Origin");

      ft.Shape = line.GetPoint(0);

      ft.Save();

      pointclass.SaveEdit();

       //创建临时点"Destination"

      IFeatureClass pointclass2 = new MemoryFeatureClassClass

             ("tracepoint2", 1, GeometryType.Point, fields);

      IFeatureLayer layer2 = new FeatureLayerClass(pointclass2);

      //layer.FeatureLayerAuto = true;

       map.AddLayer(layer2);

      simplerender = (IFeatureLayerSimpleRender)layer2.Render;

      simplerender.PointStyle.SetSymbol(0, new PointSymbolBmpClass

                              (new StringBuilder("\\Storage Card\\BmpStyle\\102.bmp")));

      layer2.LableFieldIndex = 1;

      pointclass2.BeginEdit();

      IFeature ftPoint2 = pointclass2.CreateFeature();

      ftPoint2.SetValue(0, "0");

      ftPoint2.SetValue(1, "Destination");

      ftPoint2.Shape = line.GetPoint(line.PointCount - 1);

      ftPoint2.Save();

      pointclass2.SaveEdit();

      double xMin = 0, yMin = 0, xMax = 0, yMax = 0;

      for (int i = 0; i < line.PointCount; i++)

      {

       IPoint p = line.GetPoint(i);

       if (i == 0)

       {

       xMin = p.X;

       yMin = p.Y;

       xMax = p.X;

       yMax = p.Y;

       }

       else

       {

       if (p.X < xMin)

       xMin = p.X;

       if (p.X > xMax)

       xMax = p.X;

       if (p.Y < yMin)

       yMin = p.Y;

       if (p.Y > yMax)

       yMax = p.Y;

       }

       }

      IPoint pt = new PointClass();

      pt.X = (xMax + xMin) / 2;

      pt.Y = (yMax + yMin) / 2;

      double scale = 0;

      if (Math.Abs(xMax - xMin) > Math.Abs(yMax - yMin))

      {

       scale = (xMax - xMin) / (this._mapControl.Map.Envelope.MaxX -

                        this._mapControl.Map.Envelope.MinX) * 1.5;

       }

       else

      {

       scale = (yMax - yMin) / (this._mapControl.Map.Envelope.MaxY -

            this._mapControl.Map.Envelope.MinY) * 1.5;

       }

       this._mapControl.Map.CenterAt = pt;

       this._mapControl.Map.MapScale = this._mapControl.

            Map.MapScale * scale;

       this._mapControl.MapRefresh();



     1.摘要


                  本文将逐步讲述如何闪烁图元。


     2.预览



                 

     3.详情





         IFeature ift = null;

         IFeatureCursor ifc;

         IFeatureClass cls;

         string strKeyword = "CATH";

         List list = new List();

         for (int i = 0; i < this._mapControl.Map.LayerCount; i++)

         {

         //获取FeatureClass

         cls = (HiMap.Carto.IFeatureClass)this._mapControl.Map.GetLayer(i).Class;

         ifc = GetFeatureCursor(_mapControl, i, Settings.POISearchField +

                     " like '" + strKeyword + "%'");

         list.Add(ifc);

         //定位到图元

         ift = ifc.Next();

         if (ift != null && ift.Shape.Type == GeometryType.Polyline)

         {

         IPolyline line = ((IPolyline)ift.Shape);

         double xMin = 0, yMin = 0, xMax = 0, yMax = 0;

         for (int j = 0; j < line.PointCount; j++)

         {

         IPoint p = line.GetPoint(j);

         if (j == 0)

         {

         xMin = p.X;

         yMin = p.Y;

         xMax = p.X;

         yMax = p.Y;

         }

         else

         {

         if (p.X < xMin)

         xMin = p.X;

         if (p.X > xMax)

         xMax = p.X;

         if (p.Y < yMin)

         yMin = p.Y;

         if (p.Y > yMax)

         yMax = p.Y;

         }

         }

         IPoint pt = new PointClass();

         pt.X = (xMax + xMin) / 2;

         pt.Y = (yMax + yMin) / 2;

         double scale = 0;

         if (Math.Abs(xMax - xMin) > Math.Abs(yMax - yMin))

         {

         scale = (xMax - xMin + Math.Abs(this._mapControl.PointToMapPoint(64, 0).X

         - this._mapControl.PointToMapPoint(0, 0).X)) /

         (this._mapControl.Map.Envelope.MaxX -this._mapControl.Map.Envelope.MinX);

         }

         else

         {

         scale = (yMax - yMin + Math.Abs(this._mapControl.PointToMapPoint(0, 64).Y

         - this._mapControl.PointToMapPoint(0, 0).Y)) / (this._mapControl.Map.Envelope.MaxY -

         this._mapControl.Map.Envelope.MinY);

         }

         this._mapControl.Map.CenterAt = pt;

         this._mapControl.Map.MapScale = this._mapControl.Map.MapScale * scale;

         this._mapControl.MapRefresh();

         list.Add(ifc);

         }

         }

         this._mapControl.Flash(list, Color.Red, 10, 500);



      示例:





      MessageBox.Show("经度:" + this.mapControl.Map.CenterAt.X.ToString() +

             " ;\r\n纬度:" + this.mapControl.Map.CenterAt.Y.ToString());



      示例:





                   MessageBox.Show("比例尺 = 1:" + mapControl1.Map.ScaleRuler.ToString());



      示例:





         private void menuItemRanging_Click(object sender, EventArgs e)

         {

         //参数:

         //点1的经度: 123.4567

         //点1的纬度: 41.3456

         //点2的经度: 124.4567

         //点2的纬度: 41.3457

         double distance = HiMap.CoordinateSystem.CoordinateSystemClass.Distance

                (123.4567,41.3456, 124.3456, 42.3457);

         MessageBox.Show(distance.ToString());

         }



     示例:





         if (this.mapControl.Map != null)

         {

         ICommand pCommand = new CommandBeforeView();

         pCommand.OnCreate(this.mapControl);

         pCommand.OnClick();

         }



     示例:





        if (this.mapControl.Map != null)

        {

        ICommand pCommand = new CommandAfterView();

        pCommand.OnCreate(this.mapControl);

        pCommand.OnClick();

        }



     示例:





         private void menuItemPan_Click(object sender, EventArgs e)

         {

        ITool tool = new HiMap.MapControls.Tools.ToolPan();

        tool.OnCreate(this.mapControl1);

        this.mapControl1.CurTool = tool;

         }



     示例:





        private void menuItemFullExtent_Click(object sender, EventArgs e)

        {

        if (this.mapControl.Map != null)

        {

        mapControl.Map.Envelope = mapControl.Map.FullEnvelope;

        mapControl.MapRefresh();

        }

        }

------------------------------------------------------------------------

        private void menuItemFullExtent_Click(object sender, EventArgs e)

        {

        ICommand cmd = new HiMap.MapControls.Tools.CommandFullMap();

        cmd.OnCreate(this.mapControl1);

        cmd.OnClick();

        }



     示例:





        private void menuItemZoomOut_Click(object sender, EventArgs e)

         {

         ITool tool = new HiMap.MapControls.Tools.ToolZoomOut();

         tool.OnCreate(this.mapControl1);

         this.mapControl1.CurTool = tool;

         }



     示例:





        private void menuItemZoomIn_Click(object sender, EventArgs e)

        {

         ITool tool = new HiMap.MapControls.Tools.ToolZoomIn();

         tool.OnCreate(this.mapControl1);

         this.mapControl1.CurTool = tool;

         }



     示例:





        Map map = new Map("test");

        mapControl.Map = map;

        mapControl.Map.FromKmd("\\Storage Card\\maps\\maps.xml");



     摘要:



                 本文将讲述使用HiMap进行坐标转换的必要步骤。



                 请将您的地图转换成HiMap自己的格式, 显示速度非常快.

                视频下载: [HiMap速度测试 - 加载大数据量矢量地图]

                代码下载: [HiMap_gsf_示例代码 vs2005 & vs2008]
  
                本视频显示了HiMap操作大数据量的矢量地图的速度, 我们将shp文件转换成了HiMap自己格式

                     (.gsf 格式), 然后加载, 速度非常快.

                测试地图文件<>的原始大小是: 79.5 MB, 188 MB, 和 1.95 MB, 合计: 270 MB.

                经过HiMap转换后, 总的gsf地图文件大小是: 398 MB. (其中test_file.gsf: 204 MB, test_file.kdb:

                    188 MB, test_file.kpi: 5.37 MB)



                未找到平台找到目录下的.csproj文件,将 4118C335-430C-497f-BE48-11C3316B135E 一句

                      改为 3C41C503-53EF-4c2a-8DD4-A8217CAD115E ,即可运行。



               无法找到 PInvoke DLL KMGisLib 请将gdalce.dll和KMGisLib.dll拷贝至移动设备或模拟器的

                     程序目录中,例如:\Program Files\myHiMap\KMGisLib.dll



              1.无法找到地图文件,请检查地图文件的路径。

              2.当前视野未被包含在图层设置的缩放比例范围内。

 

开始

地图数据管理

地图显示

地图属性

地图工具

图档文件

坐标系统

速度优化

常见问题

 

 

               
Copyright © 2007-2018 沈阳开沃软件有限公司 版权所有
手机:+8613332420811 电话:+862423491067
Mapwork -地理信息系统