zoukankan      html  css  js  c++  java
  • 计算是否通视,如果不通视,返回遮挡点

    计算是否通视,如果不通视,返回遮挡点

    //计算是否通视,如果不通视,返回遮挡点
            /// <summary>
            /// 给定点点坐标和文字内容,添加文字
            /// </summary>
            /// <param name="tmpFromPnt">通视的起点</param>
            /// <param name="tmpToPnt">通视的终点</param>
            /// <param name="tmpIntersectPnt">第一个遮挡点</param>
            public bool Visibility(CoordTransform.Pnt3D tmpFromPnt, CoordTransform.Pnt3D tmpToPnt, ref CoordTransform.Pnt3D tmpIntersectPnt)
            {
                IRasterLayer pRasterLayer = pTmpMainWin.pCurrentMap.Map.get_Layer(DemLyrIndex) as IRasterLayer;
                IRasterSurface pRasterSurface = new RasterSurfaceClass();
                pRasterSurface.PutRaster(pRasterLayer.Raster, 0);
                ISurface pSurface = pRasterSurface as ISurface;
                //IGeoDatabaseBridge2 pBridge = new GeoDatabaseBridge2Class();

                IPoint pPoint = new PointClass();
                IPolyline pVPolyline = null;
                IPolyline pInPolyline = null;
                object pRef = 0.13;
                bool pBool = true;

                bool ReturnValue = true;

                IGeoDataset geoDt = pRasterLayer.Raster as IGeoDataset;
                ISpatialReference spatialreference = geoDt.SpatialReference;

                IPoint pPoint1 = new PointClass();
                IPoint pPoint2 = new PointClass();

                ////获取Dem的高程
                pPoint1.Project(spatialreference);
                pPoint2.Project(spatialreference);
                pPoint.Project(spatialreference);

                pPoint1.X = tmpFromPnt.X;
                pPoint1.Y = tmpFromPnt.Y;
                pPoint1.Z = tmpFromPnt.Z;

                pPoint2.X = tmpToPnt.X;
                pPoint2.Y = tmpToPnt.Y;
                pPoint2.Z = tmpToPnt.Z;

                IGeoDatabaseBridge2 pbridge2 = (IGeoDatabaseBridge2)new GeoDatabaseHelperClass();
                pbridge2.GetLineOfSight(pSurface, pPoint1, pPoint2, out pPoint, out pVPolyline, out pInPolyline, out pBool, false, false, ref pRef);

                if (pBool == false)
                {
                    tmpIntersectPnt = new CoordTransform.Pnt3D();
                    tmpIntersectPnt.X = pPoint.X;
                    tmpIntersectPnt.Y = pPoint.Y;
                    tmpIntersectPnt.Z = pPoint.Z;

                    ReturnValue = false;
                }
                else
                {
                    tmpIntersectPnt = new CoordTransform.Pnt3D();
                    tmpIntersectPnt.X = pPoint2.X;
                    tmpIntersectPnt.Y = pPoint2.Y;
                    tmpIntersectPnt.Z = pPoint2.Z;

                    ReturnValue = true;
                }
                return ReturnValue;
            }

  • 相关阅读:
    泛海精灵Alpha阶段回顾
    [Scrum]1.6
    【Scrum】1.5
    泛海精灵 Beta计划 (草案)
    【scrum】1.7
    学术搜索的Bug
    Linux下查看文件和文件夹大小
    求7的34次方
    去除给定的字符串中左边、右边、中间的所有空格的实现
    身份证18位验证
  • 原文地址:https://www.cnblogs.com/yuxuetaoxp/p/3259694.html
Copyright © 2011-2022 走看看