• 圆柱体切割


    MapGIS 10 Desktop API    
    CutGeometryByGeometry 方法  
    请参见  示例  
    MapGIS.G3DAnalysis.ModelCut 命名空间 > G3DModelCut 类 : CutGeometryByGeometry 方法 
     C# geomA 
    被切割对象,支持面、体、多面或多体,不能传空infoA 
    被切割对象的图形参数cutGeom 
    切割对象,支持面或体,不能传空refDot 
    分边参考点,可以传空resGeom1 
    与参考点同侧的切割结果1,类型与被切割对象相同,如果不需要可以传空resInfo1 
    切割对象1的图形参数,如果不需要切割结果1可以传空resGeom2 
    与参考点异侧的切割结果2,类型与被切割对象相同,如果不需要可以传空resInfo2 
    切割对象2的图形参数,如果不需要切割结果1可以传空几何切割几何,主要是面或体切割面、体、多面或多体 
    语法
    C#   
    public int CutGeometryByGeometry( 
       IGeometry3D geomA,
       GeomInfo infoA,
       IGeometry cutGeom,
       Dot3D refDot,
       IGeometry3D resGeom1,
       GeomInfo resInfo1,
       IGeometry3D resGeom2,
       GeomInfo resInfo2
    )
     
    
    参数
    geomA 
    被切割对象,支持面、体、多面或多体,不能传空
    infoA 
    被切割对象的图形参数
    cutGeom 
    切割对象,支持面或体,不能传空
    refDot 
    分边参考点,可以传空
    resGeom1 
    与参考点同侧的切割结果1,类型与被切割对象相同,如果不需要可以传空
    resInfo1 
    切割对象1的图形参数,如果不需要切割结果1可以传空
    resGeom2 
    与参考点异侧的切割结果2,类型与被切割对象相同,如果不需要可以传空
    resInfo2 
    切割对象2的图形参数,如果不需要切割结果1可以传空
    返回值
    切割成功返回1;不相交,与参考点同侧返回-1;不相交,与参考点异侧返回-2;切割失败返回0。
    示例
    C# 拷贝代码 
    using MapGIS.GeoDataBase;
    using MapGIS.GeoObjects.Geometry3D;
    using MapGIS.G3DAnalysis.ModelCut;
    using MapGIS.GeoObjects.Geometry;
    using MapGIS.G3DAnalysis.GeoModeling;
     
     Server svr = new Server();
     //连接数据源
     svr.Connect("MapGISLocal", "", "");
    
     DataBase db = svr.OpenGDB("示例数据");
     if (db != null)
     {
         //该示例是以Z轴为切割轴实现圆柱体切割功能
         SFeatureCls srcsfcls = new SFeatureCls(db);
         //打开被切割简单要素类
         bool rtn = srcsfcls.Open("景观_模型", 0);
    
         if (rtn)
         {
             //创建结果简单要素类对象,为剖切模型的结果简单要素类1。其中创建的两个结果类必须保存在数据库同一目录下
             SFeatureCls leftSfcls = new SFeatureCls();
             int leftClsID = leftSfcls.Create("gdbp://MapGisLocal/示例数据/sfcls/景观_模型_圆柱体切割cutA", srcsfcls.GeomType);
    
             //创建结果简单要素类对象,为剖切模型的结果简单要素类2
             SFeatureCls rightSfcls = new SFeatureCls();
             int rightClsID = rightSfcls.Create("gdbp://MapGisLocal/示例数据/sfcls/景观_模型_圆柱体切割cutB", srcsfcls.GeomType);
    
    
             //创建三维模型切割对象
             G3DModelCut modelCut = new G3DModelCut();
             //构建切割圆柱体对象
             GeoCir cir = new GeoCir();
    
             //设置切割圆柱参数,中心点及圆柱半径
             cir.Set(new Dot(75.4399, 90.382), 50);
             cir.DisperseToDots(10.97 / Math.Min(386, 437) * 20);
             GeoLines lines = new GeoLines();
             lines.Append(cir);
    
             GeoPolygon polygon = new GeoPolygon();
             polygon.Append(lines);
    
             //构建圆柱体
             GeoAnyEntity entity = new GeoAnyEntity();
             GeoModelCommon.CreateClosedSurByReg(entity, polygon, (float)31.5, (float)-5.25, null, 1);
    
             IGeometry3D geomtry = entity;
             if (geomtry != null)
             {
                
                 GeomInfo gInfo1 =srcsfcls.GetInfo(15);
                 GeomInfo gInfo2 = srcsfcls.GetInfo(15);
                 GeoMultiSurface geomA =srcsfcls.GetGeometry(15) as GeoMultiSurface;
                 GeoMultiSurface resGeom1=new GeoMultiSurface ();
    
                 GeoMultiSurface resGeom2=new GeoMultiSurface ();
                 Dot3D refDot=new Dot3D (0,0,0);
                 int i = modelCut.CutGeometryByGeometry(geomA, srcsfcls.GetInfo(1), geomtry, refDot, resGeom1, gInfo1, resGeom2, gInfo2);
    
                 if (i > 0)
                 {
                     leftSfcls.Append(resGeom1, null, gInfo1);
                     rightSfcls.Append(resGeom2,null, gInfo2);
                     MessageBox.Show("切割成功!");
                 }
                 else
                 {
                     MessageBox.Show("切割失败!");
                 }
                 srcsfcls.Close();
                 leftSfcls.Close();
                 rightSfcls.Close();
                 return;
             }
         }
         else
         {
             MessageBox.Show("打开失败!", "提示");
             return;
         }
     }
     
    
    请参见
    引用
    G3DModelCut 类 
    G3DModelCut 成员 
  • 相关阅读:
    关于Spring Test 小结
    排他思想---->tab选项卡
    对金额的格式化
    js 对多个id 的封装方法
    form表单数据封装成json格式并提交给服务器
    js技巧专题篇: 页面跳转
    对象流
    线程
    异常处理、常见异常说明
    数据库(概念、语法、DBMS、SQL语言:创建数据库、表格,添加、修改、删除数据记录)
  • 原文地址:https://www.cnblogs.com/leebokeyuan/p/15955265.html
Copyright © 2020-2023  润新知