コード例 #1
0
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="filename">file to read and parse</param>
        public MstsShapeFile(string filename)
        {
            var file = SBR.Open(filename);

            shape = new MstsShape(file.ReadSubBlock());
            file.VerifyEndOfBlock();
        }
コード例 #2
0
        /// <summary>
        /// Open file dirty work
        /// </summary>
        protected override void doOpenFile()
        {
            string        file = fileOpener.FileName;
            MstsShapeFile sf   = null;

            if (!string.IsNullOrWhiteSpace(file))
            {
                try
                {
                    sf = new MstsShapeFile(fileOpener.FileName);
                }
                catch (Exception ex)
                {
                    Balloon(catalog.GetString("Error processing file '{0}':\n{1}", file, ex.Message));
                }

                if (sf != null)
                {
                    s    = sf.shape;
                    name = Path.GetFileNameWithoutExtension(file);

                    txtBB1.Text = string.Format(CultureInfo.InvariantCulture, "{0}", s.MinPoint.X);
                    txtBB2.Text = string.Format(CultureInfo.InvariantCulture, "{0}", s.MinPoint.Y);
                    txtBB3.Text = string.Format(CultureInfo.InvariantCulture, "{0}", s.MinPoint.Z);
                    txtBB4.Text = string.Format(CultureInfo.InvariantCulture, "{0}", s.MaxPoint.X);
                    txtBB5.Text = string.Format(CultureInfo.InvariantCulture, "{0}", s.MaxPoint.Y);
                    txtBB6.Text = string.Format(CultureInfo.InvariantCulture, "{0}", s.MaxPoint.Z);

                    txtEngSize1.Text = string.Format(CultureInfo.InvariantCulture, "{0}", Math.Abs(s.MaxPoint.X - s.MinPoint.X));
                    txtEngSize2.Text = string.Format(CultureInfo.InvariantCulture, "{0}", Math.Abs(s.MaxPoint.Y - s.MinPoint.Y));
                    txtEngSize3.Text = string.Format(CultureInfo.InvariantCulture, "{0}", Math.Abs(s.MaxPoint.Z - s.MinPoint.Z));

                    txtRefDesc.Text = name;

                    tabControl.Enabled = true;
                    setSaveButton(tabControl.SelectedIndex);
                    base.doOpenFile();
                }
            }
        }