Ejemplo n.º 1
0
        /// <summary>
        /// Create the suface
        /// </summary>
        /// <param name="solidSurfaceName">Name of the surface</param>
        /// <param name="simplifySurface">Apply simplify
        /// operation</param>
        private static void CreateSolidSurface(
            string solidSurfaceName, bool simplifySurface)
        {
            // open or create the new surface
            TinSurface newSurface   = null;
            ObjectId   newSurfaceId = Util.GetSurfaceId(solidSurfaceName);

            if (!newSurfaceId.IsNull)
            {
                // open, remove all points and operations
                newSurface = _trans.GetObject(newSurfaceId,
                                              OpenMode.ForWrite) as TinSurface;
                newSurface.DeleteVertices(newSurface.Vertices);
            }
            else
            {
                // create and open
                newSurfaceId = TinSurface.Create(_db, solidSurfaceName);
                newSurface   = _trans.GetObject(newSurfaceId,
                                                OpenMode.ForWrite) as TinSurface;
            }

            // add the newly created points
            newSurface.AddVertices(_newPoints);

            // simplify surface
            if (simplifySurface)
            {
                SurfaceSimplifyOptions simplifyOptions = new
                                                         SurfaceSimplifyOptions(SurfaceSimplifyType.PointRemoval);
                simplifyOptions.MaximumChangeInElevation    = 0.0001;
                simplifyOptions.UseMaximumChangeInElevation = true;
                newSurface.SimplifySurface(simplifyOptions);
            }
        }