Beispiel #1
0
        public static void CreateVerticalLOSPatches(bool bool_0, IPoint ipoint_0, IPoint ipoint_1, IPolyline ipolyline_0,
                                                    IPolyline ipolyline_1, IGeometryCollection igeometryCollection_0, IGeometryCollection igeometryCollection_1,
                                                    out double double_0)
        {
            int i;
            IPointCollection    geometry;
            IClone              point;
            IPointCollection    triangleFanClass;
            IVector3D           vector3DClass;
            IPoint              point1;
            IPoint              point2;
            object              value                = Missing.Value;
            IGeometryCollection ipolyline0           = ipolyline_0 as IGeometryCollection;
            IMultiPatch         igeometryCollection1 = igeometryCollection_1 as IMultiPatch;

            double_0 = ipoint_1.Z;
            double magnitude = 0;
            IPoint point3    = null;

            for (i = 0; i < ipolyline0.GeometryCount; i++)
            {
                geometry = ipolyline0.Geometry[i] as IPointCollection;
                if (i == 0)
                {
                    point = geometry.Point[0] as IClone;
                    IPoint point4 = point.Clone() as IPoint;
                }
                point            = geometry as IClone;
                triangleFanClass = new TriangleFan();
                point            = ipoint_0 as IClone;
                triangleFanClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                point = geometry as IClone;
                triangleFanClass.AddPointCollection(point.Clone() as IPointCollection);
                if (i == ipolyline0.GeometryCount - 1)
                {
                    vector3DClass = new Vector3D() as IVector3D;
                    point         = ipoint_0 as IClone;
                    point1        = point.Clone() as IPoint;
                    point1.Z      = 0;
                    point         = geometry.Point[geometry.PointCount - 1] as IClone;
                    point2        = point.Clone() as IPoint;
                    point2.Z      = 0;
                    vector3DClass.ConstructDifference(point1, point2);
                    magnitude = vector3DClass.Magnitude;
                    point3    = point.Clone() as IPoint;
                    if (ipolyline_1 == null && ipoint_1.Z > geometry.Point[geometry.PointCount - 1].Z)
                    {
                        point = ipoint_1 as IClone;
                        triangleFanClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                    }
                }
                igeometryCollection_0.AddGeometry(triangleFanClass as IGeometry, ref value, ref value);
            }
            if (ipolyline_1 != null)
            {
                ipolyline0 = ipolyline_1 as IGeometryCollection;
                for (i = 0; i < ipolyline0.GeometryCount; i++)
                {
                    geometry = ipolyline0.Geometry[i] as IPointCollection;
                    point    = geometry as IClone;
                    IPointCollection ringClass = new Ring();
                    point = geometry as IClone;
                    ringClass.AddPointCollection(point.Clone() as IPointCollection);
                    if (i == ipolyline0.GeometryCount - 1)
                    {
                        vector3DClass = new Vector3D() as IVector3D;
                        point         = ipoint_0 as IClone;
                        point1        = point.Clone() as IPoint;
                        point1.Z      = 0;
                        point         = geometry.Point[geometry.PointCount - 1] as IClone;
                        point2        = point.Clone() as IPoint;
                        point2.Z      = 0;
                        vector3DClass.ConstructDifference(point1, point2);
                        if (magnitude < vector3DClass.Magnitude)
                        {
                            point    = ipoint_0 as IClone;
                            point1   = point.Clone() as IPoint;
                            point1.Z = 0;
                            point    = geometry.Point[0] as IClone;
                            point2   = point.Clone() as IPoint;
                            point2.Z = 0;
                            vector3DClass.ConstructDifference(point1, point2);
                            double num = vector3DClass.Magnitude;
                            double z   = (ipoint_0.Z - geometry.Point[0].Z) / num;
                            point = geometry.Point[geometry.PointCount - 1] as IClone;
                            IPoint z1 = point.Clone() as IPoint;
                            point2   = point.Clone() as IPoint;
                            point2.Z = 0;
                            vector3DClass.ConstructDifference(point1, point2);
                            double magnitude1 = vector3DClass.Magnitude;
                            z1.Z  = ipoint_0.Z - magnitude1 * z;
                            point = z1 as IClone;
                            ringClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                            if (!bool_0)
                            {
                                double_0 = z1.Z;
                            }
                            else
                            {
                                triangleFanClass = new TriangleFan();
                                point            = ipoint_0 as IClone;
                                triangleFanClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                                point = ipoint_1 as IClone;
                                triangleFanClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                                point = z1 as IClone;
                                triangleFanClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                                igeometryCollection_0.AddGeometry(triangleFanClass as IGeometry, ref value, ref value);
                            }
                        }
                        else if (bool_0 && ipoint_1.Z > point3.Z)
                        {
                            triangleFanClass = new TriangleFan();
                            point            = ipoint_0 as IClone;
                            triangleFanClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                            point = ipoint_1 as IClone;
                            triangleFanClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                            point = point3 as IClone;
                            triangleFanClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                            igeometryCollection_0.AddGeometry(triangleFanClass as IGeometry, ref value, ref value);
                        }
                    }
                    point = ringClass.Point[0] as IClone;
                    ringClass.AddPoint(point.Clone() as IPoint, ref value, ref value);
                    igeometryCollection_1.AddGeometry(ringClass as IGeometry, ref value, ref value);
                    igeometryCollection1.PutRingType(ringClass as IRing, esriMultiPatchRingType.esriMultiPatchRing);
                }
            }
        }