Esempio n. 1
0
        private IElement method_1(object object_1)
        {
            if (object_1 is DBNull)
            {
                return(null);
            }
            IMemoryBlobStream o    = object_1 as IMemoryBlobStream;
            IPropertySet      set  = new PropertySetClass();
            IObjectStream     pstm = new ObjectStreamClass
            {
                Stream = o
            };
            IPersistStream stream3 = set as IPersistStream;

            stream3.Load(pstm);
            IElement property = null;

            try
            {
                property = set.GetProperty("Element") as IElement;
            }
            catch (Exception)
            {
            }
            ComReleaser.ReleaseCOMObject(stream3);
            ComReleaser.ReleaseCOMObject(set);
            ComReleaser.ReleaseCOMObject(o);
            set = null;
            return(property);
        }
Esempio n. 2
0
        private IElement method_2(object object_0)
        {
            IMemoryBlobStream o    = object_0 as IMemoryBlobStream;
            IPropertySet      set  = new PropertySetClass();
            IObjectStream     pstm = new ObjectStreamClass
            {
                Stream = o
            };

            ESRI.ArcGIS.esriSystem.IPersistStream stream3 = set as ESRI.ArcGIS.esriSystem.IPersistStream;
            stream3.Load(pstm);
            IElement property = null;

            try
            {
                property = set.GetProperty("Element") as IElement;
            }
            catch (Exception)
            {
            }
            ComReleaser.ReleaseCOMObject(stream3);
            ComReleaser.ReleaseCOMObject(set);
            ComReleaser.ReleaseCOMObject(o);
            set = null;
            return(property);
        }
Esempio n. 3
0
        private string method_0(object object_0)
        {
            if (object_0 is DBNull)
            {
                return("");
            }
            IMemoryBlobStream o    = object_0 as IMemoryBlobStream;
            IPropertySet      set  = new PropertySetClass();
            IObjectStream     pstm = new ObjectStreamClass {
                Stream = o
            };
            IPersistStream stream3 = set as IPersistStream;

            stream3.Load(pstm);
            string str2 = "";

            try
            {
                str2 = set.GetProperty("TK").ToString();
            }
            catch (Exception)
            {
            }
            ComReleaser.ReleaseCOMObject(stream3);
            ComReleaser.ReleaseCOMObject(set);
            ComReleaser.ReleaseCOMObject(o);
            set = null;
            return(str2);
        }
Esempio n. 4
0
        private IFeatureRenderer ReadRender(string filename)
        {
            System.IO.FileStream input  = new System.IO.FileStream(filename, FileMode.Open);
            BinaryReader         reader = new BinaryReader(input);
            int count = reader.ReadInt32();

            byte[]            buffer  = reader.ReadBytes(count);
            IMemoryBlobStream stream2 = new MemoryBlobStreamClass();
            IObjectStream     pstm    = new ObjectStreamClass
            {
                Stream = stream2
            };

            ((IMemoryBlobStreamVariant)stream2).ImportFromVariant(buffer);
            IPropertySet set = new PropertySetClass();

            (set as IPersistStream).Load(pstm);
            return(set.GetProperty("Render") as IFeatureRenderer);
        }
Esempio n. 5
0
        //加载影像数据到SDE数据库
        private void button4_Click(object sender, EventArgs e)
        {
            this.openFileDialog1.Filter      = "TIFF file (*.tif)|*.tif";
            this.openFileDialog1.Title       = "打开影像数据";
            this.openFileDialog1.Multiselect = false;
            string fileName = "";

            if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                fileName = this.openFileDialog1.FileName;
                string filepath;
                string file;
                int    lastIndex;
                lastIndex = fileName.LastIndexOf(@"\");
                filepath  = fileName.Substring(0, lastIndex);
                file      = fileName.Substring(lastIndex + 1);

                //导入SDE数据库
                rasterWorkspace = workspace as IRasterWorkspaceEx;
                IWorkspaceFactory tifwpf           = new RasterWorkspaceFactoryClass();
                IWorkspace        tifwp            = tifwpf.OpenFromFile(filepath, 0);
                IRasterWorkspace  tifrwp           = tifwp as IRasterWorkspace;
                IRasterDataset    rasterDataset    = tifrwp.OpenRasterDataset(file);
                IRasterDataset    sdeRasterDataset = null;
                lastIndex = file.LastIndexOf(@".");
                file      = file.Substring(0, lastIndex);
                try
                {
                    sdeRasterDataset = rasterWorkspace.OpenRasterDataset(file);
                }
                catch (Exception Ex)
                {
                }
                if (sdeRasterDataset == null)
                {
                    IGeoDataset geoDataset = rasterDataset as IGeoDataset;
                    IRasterSdeServerOperation rasterSdeServeroperation;

                    IBasicRasterSdeConnection sdeCon = new BasicRasterSdeLoader();
                    IPropertySet propertySet         = new PropertySetClass();
                    propertySet = workspace.ConnectionProperties;
                    //建立与SDE数据库的连接
                    sdeCon.ServerName        = propertySet.GetProperty("server").ToString();
                    sdeCon.Instance          = propertySet.GetProperty("instance").ToString();
                    sdeCon.UserName          = propertySet.GetProperty("user").ToString();
                    sdeCon.Password          = "******";
                    sdeCon.Database          = propertySet.GetProperty("database").ToString();
                    sdeCon.SdeRasterName     = file;
                    sdeCon.InputRasterName   = fileName;
                    rasterSdeServeroperation = sdeCon as IRasterSdeServerOperation;
                    //保存影像数据到SDE数据库中
                    rasterSdeServeroperation.Create();
                    rasterSdeServeroperation.Update();
                    rasterSdeServeroperation.ComputeStatistics();
                    IRasterLayer rasterLayer = new RasterLayerClass();
                    sdeRasterDataset = rasterWorkspace.OpenRasterDataset(file);
                    rasterLayer.CreateFromDataset(sdeRasterDataset);
                    this.axMapControl1.Map.AddLayer(rasterLayer as ILayer);
                    this.axMapControl1.Extent = this.axMapControl1.FullExtent;
                    this.axMapControl1.Refresh();
                }
            }
        }