Example #1
0
        private void seismicCubeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            /*
             * Send object code is o
             * Object Type for Seismic Cube is 0
             */
            /*tryclass o1 = new tryclass(1, 'a');
             * tryclass o2 = new tryclass(2, 'b');
             * tryclass o3 = new tryclass(3, 'c');
             * List<string> ObjList = new List<string>();
             * List<tryclass> obj = new List<tryclass>();
             * ObjList.Add("1");
             * ObjList.Add("2");
             * ObjList.Add("3");
             * obj.Add(o1);
             * obj.Add(o2);
             * obj.Add(o3);*/
            List <SeismicCube> col      = Discuss.getAllSeismicCubes();
            List <string>      colNames = new List <string>();

            foreach (SeismicCube cube in col)
            {
                colNames.Add(cube.Name);
            }
            objSelect selector = new objSelect("Select an object", colNames);

            if (selector.ShowDialog() == DialogResult.OK && objSelect.SelectedIndex >= 0)
            {
                try
                {
                    String name = colNames[objSelect.SelectedIndex];
                    ClientForm.sendObject = col[objSelect.SelectedIndex];
                    string      fileName = Path.GetTempFileName().Split('.')[0] + ".segy";
                    ISegyFormat segyFormat;
                    segyFormat = CoreSystem.GetService <ISegyFormat>();
                    segyFormat.ExportSeismic3D(fileName, col[objSelect.SelectedIndex]);
                    FileInfo f = new FileInfo(fileName);
                    swSender.WriteLine(add + "\"4\"" + myIp + "\"1987\"" + fileName + "\"" + f.Length + "\"1");
                    //swSender.WriteLine(add + "\"o\"0\"" + myIp + "\"1987\"" + name);     // address"o"1"myIp"1987"objname
                    swSender.Flush();
                    this.UpdateLog("Request has been sent for Seismic Cube transfer");
                    messageBox.Lines = null;
                }
                catch
                {
                    MessageBox.Show("Error Sending Seismic cube!", "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
        public void convertToSeismic(string fileName)
        {
            // Check if parent collection contains any 2D data
            SeismicCollection coll = (SeismicCollection)FTReciever.parent;

            while (coll.MemberType == typeof(SeismicLine2DCollection))
            {
                MessageBox.Show("The Seismic Collection you selected was of SeismicLine2DCollection");
                List <SeismicCollection> cols  = Discuss.getAllSeismicCollections();
                List <string>            names = new List <string>();
                foreach (SeismicCollection col in cols)
                {
                    names.Add(col.Name);
                }
                objSelect selector = new objSelect("Select a Seismic collection to add the cube to", names);
                if (selector.ShowDialog() == DialogResult.Cancel)
                {
                    return;
                }
                coll = cols[objSelect.SelectedIndex];
            }
            // Get Service

            ISegyFormat segyFormat = CoreSystem.GetService <ISegyFormat>();
            // Find property version
            IPropertyVersionService pvService = PetrelSystem.PropertyVersionService;
            ITemplate       seisTemplate      = PetrelUnitSystem.TemplateGroupSeismicColor.SeismicDefault;
            PropertyVersion pv   = pvService.FindOrCreate(PetrelSystem.GetGlobalPropertyVersionContainer(), seisTemplate);
            SeismicCube     cube = SeismicCube.NullObject;

            // Lock the parent
            using (ITransaction txn = DataManager.NewTransaction())
            {
                try
                {
                    txn.Lock(coll);
                    cube = segyFormat.ImportSeismic3D(fileName, (SeismicCollection)FTReciever.parent, "", Domain.ELEVATION_DEPTH, pv);
                }
                catch (InvalidOperationException e)
                {
                    MessageBox.Show(e.Message);
                }
                finally
                {
                    txn.Commit();
                }
            }
        }