Beispiel #1
0
 // Token: 0x06000105 RID: 261 RVA: 0x00005152 File Offset: 0x00003352
 public Edge3(Orientation orientation, ICurve3 curve, ICurve2 curveOnSurface, double startParameter, double endParameter, Vector3 startVertex, Vector3 endVertex)
 {
     this.Orientation    = orientation;
     this.Curve          = curve;
     this.CurveOnSurface = curveOnSurface;
     this.StartParameter = startParameter;
     this.EndParameter   = endParameter;
     this.StartVertex    = startVertex;
     this.EndVertex      = endVertex;
 }
Beispiel #2
0
 // Token: 0x06000104 RID: 260 RVA: 0x000050EC File Offset: 0x000032EC
 public Edge3(Orientation orientation, ICurve3 curve, ICurve2 curveOnSurface, double startParameter, double endParameter)
 {
     this.Orientation    = orientation;
     this.Curve          = curve;
     this.CurveOnSurface = curveOnSurface;
     this.StartParameter = startParameter;
     this.EndParameter   = endParameter;
     this.StartVertex    = this.Curve.EvalAt(this.StartParameter);
     this.EndVertex      = this.Curve.EvalAt(this.EndParameter);
 }
 // Token: 0x060000EB RID: 235 RVA: 0x00004E14 File Offset: 0x00003014
 public SurfaceOfRevolution(Vector3 origin, UnitVector3 direction, ICurve3 meridian)
 {
     this.Origin    = origin;
     this.Direction = direction;
     this.Meridian  = meridian;
 }
        /// <summary>
        /// 形状相似值
        /// </summary>
        /// <returns></returns>
        public double PolylineShapeSimilarValue()
        {
            try
            {
                IPointCollection targetPointCollection = (IPointCollection)targetFeature.Shape;
                IPointCollection sourcePointCollection = (IPointCollection)sourceFeature.Shape;

                ICurve3 targetCurve = targetFeature.Shape as ICurve3;
                ICurve3 sourceCurve = sourceFeature.Shape as ICurve3;

                IGeometryCollection targetGeometryCollection = targetFeature.Shape as IGeometryCollection;
                IGeometryCollection sourceGeometryCollection = sourceFeature.Shape as IGeometryCollection;
                //要素(feature)不是multipart feature
                if (targetGeometryCollection.GeometryCount == 1 && sourceGeometryCollection.GeometryCount == 1)
                {
                    Dictionary <int, double> targetLengthDic = new Dictionary <int, double>();
                    Dictionary <int, double> targetAreaDic   = new Dictionary <int, double>();

                    Dictionary <int, double> sourceLengthDic = new Dictionary <int, double>();
                    Dictionary <int, double> sourceAreaDic   = new Dictionary <int, double>();

                    //待匹配图层
                    PolylineAngleStatistics(targetPointCollection, targetCurve.Length, ref targetLengthDic, ref targetAreaDic);
                    //源图层
                    PolylineAngleStatistics(sourcePointCollection, sourceCurve.Length, ref sourceLengthDic, ref sourceAreaDic);

                    int i = 0;
                    int j = 0;
                    Dictionary <double, double> targetLengthAngleDic = new Dictionary <double, double>();
                    Dictionary <double, double> sourceLengthAngleDic = new Dictionary <double, double>();
                    //建立长度、面积的字典映射
                    for (i = 0; i < targetLengthDic.Count; i++)
                    {
                        if (!targetLengthAngleDic.ContainsKey(targetLengthDic[i]))
                        {
                            targetLengthAngleDic.Add(targetLengthDic[i], targetAreaDic[i]);
                        }
                    }
                    for (j = 0; j < sourceLengthDic.Count; j++)
                    {
                        if (!sourceLengthAngleDic.ContainsKey(sourceLengthDic[j]))
                        {
                            sourceLengthAngleDic.Add(sourceLengthDic[j], sourceAreaDic[j]);
                        }
                    }

                    Dictionary <int, double> tempDic = new Dictionary <int, double>();
                    tempDic = SortLengthsValue(targetLengthDic, sourceLengthDic);
                    Collection <double> area = new Collection <double>();

                    for (i = 0; i < tempDic.Count - 1; i++)
                    {
                        double ta;
                        if (targetLengthAngleDic.ContainsKey(tempDic[i]) && sourceLengthAngleDic.ContainsKey(tempDic[i]))
                        {
                            if (i == 0)
                            {
                                ta = (targetLengthAngleDic[tempDic[i]] - sourceLengthAngleDic[tempDic[i]]) * tempDic[i];
                            }
                            else
                            {
                                ta = (targetLengthAngleDic[tempDic[i]] - sourceLengthAngleDic[tempDic[i]]) * (tempDic[i] - tempDic[i - 1]);
                            }
                            if (ta < 0)
                            {
                                ta = -ta;
                            }
                            area.Add(ta);
                        }
                        else if (targetLengthAngleDic.ContainsKey(tempDic[i]) && !sourceLengthAngleDic.ContainsKey(tempDic[i]))
                        {
                            int m = i + 1;
                            while (!sourceLengthAngleDic.ContainsKey(tempDic[m]))
                            {
                                m++;
                            }

                            if (i == 0)
                            {
                                ta = (targetLengthAngleDic[tempDic[i]] - sourceLengthAngleDic[tempDic[m]]) * tempDic[i];
                            }
                            else
                            {
                                ta = (targetLengthAngleDic[tempDic[i]] - sourceLengthAngleDic[tempDic[m]]) * (tempDic[i] - tempDic[i - 1]);
                            }
                            if (ta < 0)
                            {
                                ta = -ta;
                            }
                            area.Add(ta);
                        }

                        else if (!targetLengthAngleDic.ContainsKey(tempDic[i]) && sourceLengthAngleDic.ContainsKey(tempDic[i]))
                        {
                            int n = i + 1;
                            while (!targetLengthAngleDic.ContainsKey(tempDic[n]))
                            {
                                n++;
                            }
                            if (i == 0)
                            {
                                ta = (targetLengthAngleDic[tempDic[n]] - sourceLengthAngleDic[tempDic[i]]) * tempDic[i];
                            }
                            else
                            {
                                ta = (targetLengthAngleDic[tempDic[n]] - sourceLengthAngleDic[tempDic[i]]) * (tempDic[i] - tempDic[i - 1]);
                            }
                            if (ta < 0)
                            {
                                ta = -ta;
                            }
                            area.Add(ta);
                        }
                    }

                    double shapeSimilar;
                    double areaA = targetLengthDic[0] * targetAreaDic[0];
                    double areaB = sourceLengthDic[0] * sourceAreaDic[0];
                    double last;
                    if (tempDic.Count > 1)
                    {
                        if (targetLengthAngleDic[targetLengthDic[targetLengthDic.Count - 1]] > sourceLengthAngleDic[sourceLengthDic[sourceLengthDic.Count - 1]])
                        {
                            last = (targetLengthAngleDic[targetLengthDic[targetLengthDic.Count - 1]] - sourceLengthAngleDic[sourceLengthDic[sourceLengthDic.Count - 1]]) * (tempDic[tempDic.Count - 1] - tempDic[tempDic.Count - 2]);
                            area.Add(last);
                        }
                        else
                        {
                            last = (targetLengthAngleDic[targetLengthDic[targetLengthDic.Count - 1]] - sourceLengthAngleDic[sourceLengthDic[sourceLengthDic.Count - 1]]) * (tempDic[tempDic.Count - 1] - tempDic[tempDic.Count - 2]);
                            last = -last;
                            area.Add(last);
                        }

                        for (i = 1; i < targetLengthDic.Count; i++)
                        {
                            areaA = areaA + (targetLengthDic[i] - targetLengthDic[i - 1]) * targetAreaDic[i];
                        }

                        for (j = 1; j < sourceLengthDic.Count; j++)
                        {
                            areaB = areaB + (sourceLengthDic[j] - sourceLengthDic[j - 1]) * sourceAreaDic[j];
                        }

                        double areaSum = 0;
                        for (i = 0; i < area.Count; i++)
                        {
                            areaSum = areaSum + area[i];
                        }

                        double areaU = (areaA + areaB - areaSum) / 2;
                        shapeSimilar = areaU / (areaU + areaSum);
                        return(shapeSimilar);
                    }
                    else
                    {
                        if (areaA > areaB)
                        {
                            shapeSimilar = areaB / areaA;
                        }
                        else
                        {
                            shapeSimilar = areaA / areaB;
                        }
                        return(shapeSimilar);
                    }
                }
                //要素(feature)是multipart feature
                else
                {
                    if (targetGeometryCollection.GeometryCount > 1 && sourceGeometryCollection.GeometryCount == 1)
                    {
                        ITopologicalOperator top = targetFeature.Shape as ITopologicalOperator;
                        IRelationalOperator  relationalOperator = top.Buffer(0.0002) as IRelationalOperator;
                        if (relationalOperator.Contains(sourceFeature.Shape))
                        {
                            return(1);
                        }
                        else
                        {
                            return(0);
                        }
                    }
                    else
                    {
                        ITopologicalOperator top = sourceFeature.Shape as ITopologicalOperator;
                        IRelationalOperator  relationalOperator = top.Buffer(0.0002) as IRelationalOperator;
                        if (relationalOperator.Contains(targetFeature.Shape))
                        {
                            return(1);
                        }
                        else
                        {
                            return(0);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //20170916
                MessageBox.Show(ex.Message);
                return(0);
                //throw;
            }
        }