Exemple #1
0
        //      Procedure SaveToCompoundDoc(const FileName : TFileName;
        //  const OriginX, OriginY : Integer);

        public void LoadFromCompoundDoc(NFFFile owner, BinaryReader reader, string Filename)
        {
            reader.BaseStream.Position = owner.StreamInfoList.Locate(Filename).Offset;

            //try
            //fSuppressAssertions:= True;
            LoadFromNFFStream(reader, Consts.NullDouble, Consts.NullDouble, true, NFFFileVersion.Version_Undefined);
            //  finally
            //fSuppressAssertions:= False;
            //end;
        }
Exemple #2
0
        //  procedure OnGuidanceAlignmentAdded(Sender: TEnhancedObjectList; Item: TObject); virtual;

        // public
        //    property Grids : TNFFGridList read FGrids;
        //    property ThreeDLineDesignGridFile : TNFF3DGridLineworkFile read F3DLineDesignGridFile;

        //    property GridSize : Integer read FGridSize write SetGridSize;

        //    property GridOriginX : Integer read FGridOriginX;
        //    property GridOriginY : Integer read FGridOriginY;

        //    property Surfaces : TNFFSurfaceList read FSurfaces;
        //    property ReferenceSurfaces : TNFFVerticalOffsetList read FReferenceSurfaces;

        //    Property XMLDataIslands : TNFFXMLDataIslandList read FXMLDataIslands;
        //    Property Gestalt : TNFFGestaltDataIsland read FGestalt write FGestalt;

        //    Property RelatedStreams : TNFFRelatedStreamList read FRelatedStreams;

        //    property AvoidanceZoneType : TNFFAvoidanceZoneType read FAvoidanceZoneType write FAvoidanceZoneType;
        //    Property AvoidanceZoneUndergroundServicesRadius : Double read FAvoidanceZoneUndergroundServicesRadius write FAvoidanceZoneUndergroundServicesRadius;

        public static NFFFile CreateFromFile(string AFileName)
        {
            NFFFile Result;

            // Create a NFFFile instance based on the extension of <AFileName>
            var NFFFileExtension = Path.GetExtension(AFileName);

            if (string.Compare(NFFFileExtension, ".svd", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                Result = new NFFFile(NFFFileType.SVDFile);
            }
            else
            if (string.Compare(NFFFileExtension, ".svl", StringComparison.InvariantCultureIgnoreCase) == 0)
            {
                //TODO - oR Lang - cEnhancement :
                //  Could do a bit extra here to detect whether the svl file is a Site Background
                //   or Avoidance Zone design and instantiate NFFFile descendants as appropriate.
                //  Doesn't matter at present as the descendants only differ in the way a new NFF
                //  file is populated from a DXF

                Result = new NFFFile(NFFFileType.SVLFile);
            }
            else
            {
                // Invalid file name or unrecognised extension
                throw new IOException("NFFFile.CreateFromFile. Invalid file name or unrecognised extension");
            }

            if (!Result.LoadFromFile(AFileName))
            {
                throw new IOException("NFFFile.CreateFromFile. Cannot load file");
            }

            Result.ErrorStatus = NFFErrorStatus.OK;
            return(Result);
        }