zoukankan      html  css  js  c++  java
  • cFactory.CombineFeatures(features);

     求助:创建折线出错
    我的代码如下:
    long count = points.GetCount() - 1;
    CMapXFeatures features;
    CMapXFeature feature;
    CMapXPoints linePoints;
    linePoints.CreateDispatch(linePoints.GetClsid());
    for (long i = 1; i <= count; i++) {
     linePoints.RemoveAll();
     linePoints.Add(points.Item(i));
     linePoints.Add(points.Item(i + 1));
     COleVariant vtPoints;
     vtPoints.vt = VT_DISPATCH;
     vtPoints.pdispVal = linePoints.m_lpDispatch;
     vtPoints.pdispVal->AddRef();
     feature = cFactory.CreateLine(vtPoints,vtStyle);
     features.Add(feature);
    }
     
    cFactory.CreateCollectionFeature(features)
    feature=cFactory.CombineFeatures(features);
    执行最后一句cFactory.CombineFeatures(features);时,报异常 。
    另外,我还问一下,创建折线有没有其它方法。我用这种方式来做对不对啊


    Private Sub mnuEditConsociate_Click()
    On Error Resume Next
    Dim Layer As MapXLib.Layer
    Dim Ftr As MapXLib.Feature
    Dim Ftrs As MapXLib.Features
    Dim FtrCombined As MapXLib.Feature
    Dim StyCombined As New MapXLib.Style
    Dim FtrType As MapXLib.FeatureEditModeConstants

       
        If Trim(cbLayers.Text) = "" Then Exit Sub
        Set Layer = Map.Layers(Trim(cbLayers.Text))
       
        If Layer.Selection.Count <= 1 Then
             MsgBox "至少选择两个编辑对象!"
            Exit Sub
        End If
       
        Set Ftrs = Layer.Selection
       
       
       
        '生成合并后的新图元,并添加到地图
        Set Ftr = Map.FeatureFactory.CombineFeatures(Ftrs)
        Layer.AddFeature Ftr
       
        '设置合并后新图元的样式为合并前图元的样式
        Set StyCombined = Ftrs(1).Style.Clone
        FtrCombined.Style = StyCombined
        FtrCombined.Update
       
        '删除合并前的图元
        For Each Ftr In Ftrs
            Layer.DeleteFeature Ftr
        Next Ftr
       
        '使合并后的图元处于选中状态
        Layer.Selection.Replace FtrCombined
    End Sub

  • 相关阅读:
    centos7查看yum安装的软件及路径
    CentOS7图形界面与命令行界面切换(转载)
    vmware安装centos7
    如何在IE11中设置兼容模式?设置的具体方法
    docker批量删除容器、镜像
    在Linux Centos 7.2 上安装指定版本Docker 17.03
    如何避免命令 rm -rf 的悲剧
    python django整理(五)配置favicon.ico,解决警告Not Found: /favicon.ico(转载)
    Ubuntu终端命令行缩短显示路径
    virtualenv 虚拟环境依赖安装
  • 原文地址:https://www.cnblogs.com/googlegis/p/2978901.html
Copyright © 2011-2022 走看看