示例#1
0
        /// <summary>
        /// GET ELEVATION VALUES OF VERTEX
        /// </summary>
        /// <param name="analysisSurface">Analysis surface</param>
        /// <param name="vertex">object vertex</param>
        /// <returns>elevation of vertex</returns>
        internal static double GetSurfaceElevation(AnalysisSurface analysisSurface, IPoint vertex)
        {
            // GET ELEVATION AT POINT LOCATION
            double elevation = analysisSurface.Surface.GetElevation(vertex);

            // MAKE SURE WE HAVE A VALID ELEVATION VALUE
            if (analysisSurface.Surface.IsVoidZ(elevation))
            {
                throw new SurfaceUtilityException("Portion of the input feature falls outside the surface");
            }

            return(elevation);
        }
示例#2
0
        /// <summary>
        /// INTERPOLATE ELEVATION VALUES FOR VERTICES
        /// </summary>
        /// <param name="analysisSurface">Analysis surface</param>
        /// <param name="vertices">Enumeration of vertices</param>
        internal static void InterpolateVertices(AnalysisSurface analysisSurface, IEnumVertex vertices)
        {
            // RESET ENUM
            vertices.Reset();

            // ITERATE VERTICES
            IPoint outVertex;
            int    partIndex;
            int    vertexIndex;

            vertices.Next(out outVertex, out partIndex, out vertexIndex);
            while (outVertex != null)
            {
                // GET ELEVATION AT POINT LOCATION
                double elev = Helper.GetSurfaceElevation(analysisSurface, outVertex);

                // ASSIGN Z USING ELEVATION
                outVertex.Z = elev;

                // GET NEXT VERTEX
                vertices.Next(out outVertex, out partIndex, out vertexIndex);
            }
        }
示例#3
0
        /// <summary>
        /// GET NODATA VALUE BASED ON PIXEL TYPE
        /// </summary>
        /// <param name="analysisSurface">object analysis surface</param>
        /// <returns>Object represents the NoData value</returns>
        internal static object GetDefaultNoDataValue(AnalysisSurface analysisSurface)
        {
            object defaultNoDataValue = null;

            // RASTER PROPERTIES
            IRasterProps rasterProps = (IRasterProps)analysisSurface.Raster;
            object       noDataValue = rasterProps.NoDataValue;

            switch (rasterProps.PixelType)
            {
            /*
             * case rstPixelType.PT_U1:
             *  defaultNoDataValue =.MinValue;
             *  break;
             * case rstPixelType.PT_U2:
             *  defaultNoDataValue = .MinValue;
             *  break;
             * case rstPixelType.PT_U4:
             *  defaultNoDataValue = .MinValue;
             *  break;
             */
            case rstPixelType.PT_CHAR:
                sbyte[] sbyteValue = (sbyte[])((noDataValue != null) ? (sbyte[])noDataValue : new sbyte[] { sbyte.MinValue });
                defaultNoDataValue = sbyteValue[0];
                break;

            case rstPixelType.PT_UCHAR:
                byte[] byteValue = (byte[])((noDataValue != null) ? (byte[])noDataValue : new byte[] { byte.MinValue });
                defaultNoDataValue = byteValue[0];
                break;

            case rstPixelType.PT_SHORT:
            case rstPixelType.PT_CSHORT:
                short[] shortValue = (short[])((noDataValue != null) ? (short[])noDataValue : new short[] { short.MinValue });
                defaultNoDataValue = shortValue[0];
                break;

            case rstPixelType.PT_USHORT:
                ushort[] ushortValue = (ushort[])((noDataValue != null) ? (ushort[])noDataValue : new ushort[] { ushort.MinValue });
                defaultNoDataValue = ushortValue[0];
                break;

            case rstPixelType.PT_LONG:
            case rstPixelType.PT_CLONG:
                long[] longValue = (long[])((noDataValue != null) ? (long[])noDataValue : new long[] { long.MinValue });
                defaultNoDataValue = longValue[0];
                break;

            case rstPixelType.PT_ULONG:
                uint[] ulongValue = (uint[])((noDataValue != null) ? (uint[])noDataValue : new uint[] { uint.MinValue });
                defaultNoDataValue = ulongValue[0];
                break;

            case rstPixelType.PT_FLOAT:
            case rstPixelType.PT_COMPLEX:
                float[] floatValue = (float[])((noDataValue != null) ? (float[])noDataValue : new float[] { float.MinValue });
                defaultNoDataValue = floatValue[0];
                break;

            case rstPixelType.PT_DOUBLE:
            case rstPixelType.PT_DCOMPLEX:
                double[] doubleValue = (double[])((noDataValue != null) ? (double[])noDataValue : new double[] { double.MinValue });
                defaultNoDataValue = doubleValue[0];
                break;

            case rstPixelType.PT_UNKNOWN:
                break;

            default:
                break;
            }

            return(defaultNoDataValue);
        }