Esempio n. 1
0
        /// <summary>
        /// 判断两个包络是否系统兼容一致
        /// 主要用于地图缩放到指定的包络时不要频繁刷新
        /// </summary>
        /// <param name="envelope1">ESRI包络几何形状接口1</param>
        /// <param name="envelope2">ESRI包络几何形状接口2</param>
        /// <returns>是否</returns>
        public static bool IsCompatibleEnvlope(IEnvelope envelope1, IEnvelope envelope2)
        {
            bool isCompatible = false;

            if (IsHighLevelGeometry(envelope1) && IsHighLevelGeometry(envelope2))
            {
                isCompatible = (envelope1 as IRelationalOperator).Disjoint(envelope2);
                if (!isCompatible)
                {
                    if ((envelope1 as IArea).Area >= (envelope2 as IArea).Area)
                    {
                        isCompatible = (envelope1 as IRelationalOperator).Contains(envelope2);
                    }
                    else
                    {
                        isCompatible = (envelope2 as IRelationalOperator).Contains(envelope1);
                    }
                    if (isCompatible)
                    {
                        object lpEnvelope1 = new Envelope();
                        SystemUtility.ObjectCopy(envelope1, ref lpEnvelope1);
                        object lpEnvelope2 = new Envelope();
                        SystemUtility.ObjectCopy(envelope2, ref lpEnvelope2);
                        if ((envelope1 as IArea).Area >= (envelope2 as IArea).Area)
                        {
                            (lpEnvelope2 as IEnvelope).Expand(1.001, 1.001, true);
                            isCompatible = (lpEnvelope1 as IRelationalOperator).Contains((IEnvelope)lpEnvelope2);
                            return(!isCompatible);
                        }
                        else
                        {
                            (lpEnvelope1 as IEnvelope).Expand(1.001, 1.001, true);
                            isCompatible = (lpEnvelope2 as IRelationalOperator).Contains((IEnvelope)lpEnvelope1);
                            return(!isCompatible);
                        }
                    }
                }
            }
            return(isCompatible);
        }
Esempio n. 2
0
 /// <summary>
 /// 获取几何形状的边线,对于面几何形状就是外型边线
 /// </summary>
 /// <param name="geometry">查询的几何形状</param>
 /// <returns>几何形状的边线</returns>
 public static IPolycurve GeometryLineShape(IGeometry geometry)
 {
     if (IsValidGeometry(geometry) && geometry is IPolycurve)
     {
         try
         {
             IPolycurve lineShape    = new Polyline() as IPolycurve;
             object     shapeLineObj = (object)lineShape;
             SystemUtility.ObjectCopy(geometry, ref shapeLineObj);
             lineShape = (IPolycurve)shapeLineObj;
             return(lineShape);
         }
         catch
         {
             return(null);
         }
     }
     else
     {
         return(null);
     }
 }