Ejemplo n.º 1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            newRender = new SimpleGeometryRender();
            newRender.RenderGroupField = this.comboBox1.Text;

            ICurveSymbol newSymbol = new CurveSymbol();

            if (this.dataGridView2.Rows[0].Cells[1].Value.ToString() != "")
            {
                string colstr = this.dataGridView2.Rows[0].Cells[1].Value.ToString();
                Color  col    = Utils.HexNumberToColor(colstr);
                newSymbol.Color = col;
            }
            if (this.dataGridView2.Rows[1].Cells[1].Value.ToString() != "")
            {
                newSymbol.RepeatLength = float.Parse(this.dataGridView2.Rows[1].Cells[1].Value.ToString());
            }
            if (this.dataGridView2.Rows[2].Cells[1].Value.ToString() != "")
            {
                newSymbol.Width = float.Parse(this.dataGridView2.Rows[2].Cells[1].Value.ToString());
            }

            if (this.checkBox1.Checked)
            {
                newSymbol.ImageName = this.textBoxPicturePath.Text;
            }
            else
            {
                newSymbol.ImageName = this.textBoxPictureName.Text;
            }

            newRender.Symbol = newSymbol;
        }
Ejemplo n.º 2
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            newRender = new SimpleGeometryRender();
            newRender.RenderGroupField = this.comboBox1.Text;

            if (IsSimplePoint)
            {
                ISimplePointSymbol newSymbol = new SimplePointSymbol();
                if (this.dataGridView2.Rows[0].Cells[1].Value.ToString() != "")
                {
                    newSymbol.Alignment = StringToGviPivotAlignment(this.dataGridView2.Rows[0].Cells[1].Value.ToString());
                }
                if (this.dataGridView2.Rows[1].Cells[1].Value.ToString() != "")
                {
                    newSymbol.Size = int.Parse(this.dataGridView2.Rows[1].Cells[1].Value.ToString());
                }

                if (this.dataGridView1.Rows[0].Cells[1].Value.ToString() != "")
                {
                    string colstr = this.dataGridView1.Rows[0].Cells[1].Value.ToString();
                    Color  col    = Utils.HexNumberToColor(colstr);
                    newSymbol.FillColor = col;
                }
                if (this.dataGridView1.Rows[1].Cells[1].Value.ToString() != "")
                {
                    newSymbol.Style = StringToSimplePointStyle(this.dataGridView1.Rows[1].Cells[1].Value.ToString());
                }

                newRender.Symbol = newSymbol;
            }
            else
            {
                IImagePointSymbol newSymbol = new ImagePointSymbol();
                if (this.dataGridView2.Rows[0].Cells[1].Value.ToString() != "")
                {
                    newSymbol.Alignment = StringToGviPivotAlignment(this.dataGridView2.Rows[0].Cells[1].Value.ToString());
                }
                if (this.dataGridView2.Rows[1].Cells[1].Value.ToString() != "")
                {
                    newSymbol.Size = int.Parse(this.dataGridView2.Rows[1].Cells[1].Value.ToString());
                }

                if (this.checkBox1.Checked)
                {
                    newSymbol.ImageName = this.textBoxPicturePath.Text;
                }
                else
                {
                    newSymbol.ImageName = this.textBoxPictureName.Text;
                }

                newRender.Symbol = newSymbol;
            }
        }
Ejemplo n.º 3
0
        public PolylineRenderForm(IGeometryRender geoRender, object[] fieldNamesItems)
        {
            InitializeComponent();

            {
                this.comboBox1.Items.AddRange(fieldNamesItems);
                this.comboBox1.Text = "";

                if (geoRender != null)
                {
                    int index = Utils.getIndexFromItems(fieldNamesItems, geoRender.RenderGroupField);
                    this.comboBox1.SelectedIndex = index;
                }
            }

            ISimpleGeometryRender render = geoRender as ISimpleGeometryRender;

            if (render == null || render.Symbol == null)
            {
                ICurveSymbol tmpSymbol = new CurveSymbol();
                string[]     row1      = new string[] { "Color", tmpSymbol.Color.ToString() };
                string[]     row2      = new string[] { "RepeatLength", tmpSymbol.RepeatLength.ToString() };
                string[]     row3      = new string[] { "Width", tmpSymbol.Width.ToString() };
                object[]     rows      = new object[] { row1, row2, row3 };
                foreach (string[] rowArray in rows)
                {
                    this.dataGridView2.Rows.Add(rowArray);
                }
                this.textBoxPictureName.Text = "";
                return;
            }

            if (render.Symbol == null)
            {
                this.textBoxPictureName.Text = "";
                return;
            }

            {
                ICurveSymbol symbol = render.Symbol as ICurveSymbol;
                string[]     row1   = new string[] { "Color", symbol.Color.ToString() };
                string[]     row2   = new string[] { "RepeatLength", symbol.RepeatLength.ToString() };
                string[]     row3   = new string[] { "Width", symbol.Width.ToString() };
                object[]     rows   = new object[] { row1, row2, row3 };
                foreach (string[] rowArray in rows)
                {
                    this.dataGridView2.Rows.Add(rowArray);
                }

                this.textBoxPicturePath.Text = symbol.ImageName;
                this.textBoxPictureName.Text = symbol.ImageName;
            }
        }
Ejemplo n.º 4
0
        public ModelPointRenderForm(IGeometryRender geoRender, object[] fieldNamesItems)
        {
            InitializeComponent();

            {
                this.comboBox1.Items.AddRange(fieldNamesItems);
                this.comboBox1.Text = "";

                if (geoRender != null)
                {
                    int index = Utils.getIndexFromItems(fieldNamesItems, geoRender.RenderGroupField);
                    this.comboBox1.SelectedIndex = index;
                }
            }

            ISimpleGeometryRender render = geoRender as ISimpleGeometryRender;

            if (render == null || render.Symbol == null)
            {
                IModelPointSymbol tmpSymbol = new ModelPointSymbol();
                string[]          row1      = new string[] { "Color", tmpSymbol.Color.ToString() };
                string[]          row2      = new string[] { "EnableColor", tmpSymbol.EnableColor.ToString() };
                string[]          row3      = new string[] { "EnableTexture ", tmpSymbol.EnableTexture.ToString() };
                object[]          rows      = new object[] { row1, row2, row3 };
                foreach (string[] rowArray in rows)
                {
                    this.dataGridView2.Rows.Add(rowArray);
                }
                return;
            }

            if (render.Symbol == null)
            {
                return;
            }

            {
                IModelPointSymbol symbol = render.Symbol as IModelPointSymbol;
                string[]          row1   = new string[] { "Color", symbol.Color.ToString() };
                string[]          row2   = new string[] { "EnableColor", symbol.EnableColor.ToString() };
                string[]          row3   = new string[] { "EnableTexture ", symbol.EnableTexture.ToString() };
                object[]          rows   = new object[] { row1, row2, row3 };
                foreach (string[] rowArray in rows)
                {
                    this.dataGridView2.Rows.Add(rowArray);
                }
            }
        }
Ejemplo n.º 5
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            newRender = new SimpleGeometryRender();
            newRender.RenderGroupField = this.comboBox1.Text;

            IModelPointSymbol newSymbol = new ModelPointSymbol();

            if (this.dataGridView2.Rows[0].Cells[1].Value.ToString() != "")
            {
                string colstr = this.dataGridView2.Rows[0].Cells[1].Value.ToString();
                Color  col    = Utils.HexNumberToColor(colstr);
                newSymbol.Color = col;
            }
            if (this.dataGridView2.Rows[1].Cells[1].Value.ToString() != "")
            {
                newSymbol.EnableColor = this.dataGridView2.Rows[1].Cells[1].Value.ToString().ToLower() == "true" ? true : false;
            }
            if (this.dataGridView2.Rows[2].Cells[1].Value.ToString() != "")
            {
                newSymbol.EnableTexture = this.dataGridView2.Rows[2].Cells[1].Value.ToString().ToLower() == "true" ? true : false;
            }

            newRender.Symbol = newSymbol;
        }
Ejemplo n.º 6
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            newRender = new SimpleGeometryRender();
            newRender.RenderGroupField = this.comboBox1.Text;

            ISurfaceSymbol newSurfaceSymbol  = new SurfaceSymbol();
            ICurveSymbol   newBoundarySymbol = new CurveSymbol();

            if (this.dataGridView2.Rows[0].Cells[1].Value.ToString() != "")
            {
                string colstr = this.dataGridView2.Rows[0].Cells[1].Value.ToString();
                Color  col    = Utils.HexNumberToColor(colstr);
                newSurfaceSymbol.Color = col;
            }
            if (this.dataGridView2.Rows[1].Cells[1].Value.ToString() != "")
            {
                newSurfaceSymbol.EnableLight = this.dataGridView2.Rows[1].Cells[1].Value.ToString().ToLower() == "true" ? true : false;
            }
            if (this.dataGridView2.Rows[2].Cells[1].Value.ToString() != "")
            {
                newSurfaceSymbol.RepeatLengthU = float.Parse(this.dataGridView2.Rows[2].Cells[1].Value.ToString());
            }
            if (this.dataGridView2.Rows[3].Cells[1].Value.ToString() != "")
            {
                newSurfaceSymbol.RepeatLengthV = float.Parse(this.dataGridView2.Rows[3].Cells[1].Value.ToString());
            }
            if (this.dataGridView2.Rows[4].Cells[1].Value.ToString() != "")
            {
                newSurfaceSymbol.Rotation = float.Parse(this.dataGridView2.Rows[4].Cells[1].Value.ToString());
            }
            if (this.dataGridView2.Rows[5].Cells[1].Value.ToString() != "")
            {
                string colstr = this.dataGridView2.Rows[5].Cells[1].Value.ToString();
                Color  col    = Utils.HexNumberToColor(colstr);
                newBoundarySymbol.Color = col;
            }
            if (this.dataGridView2.Rows[6].Cells[1].Value.ToString() != "")
            {
                newBoundarySymbol.RepeatLength = float.Parse(this.dataGridView2.Rows[6].Cells[1].Value.ToString());
            }
            if (this.dataGridView2.Rows[7].Cells[1].Value.ToString() != "")
            {
                newBoundarySymbol.Width = float.Parse(this.dataGridView2.Rows[7].Cells[1].Value.ToString());
            }

            if (this.checkBoxSurface.Checked)
            {
                newSurfaceSymbol.ImageName = this.textBoxSurfacePicturePath.Text;
            }
            else
            {
                newSurfaceSymbol.ImageName = this.textBoxSurfacePictureName.Text;
            }

            if (this.checkBoxCurve.Checked)
            {
                newBoundarySymbol.ImageName = this.textBoxCurvePicturePath.Text;
            }
            else
            {
                newBoundarySymbol.ImageName = this.textBoxCurvePictureName.Text;
            }

            newSurfaceSymbol.BoundarySymbol = newBoundarySymbol;
            newRender.Symbol = newSurfaceSymbol;
        }
Ejemplo n.º 7
0
        public PolygonRenderForm(IGeometryRender geoRender, object[] fieldNamesItems)
        {
            InitializeComponent();

            {
                this.comboBox1.Items.AddRange(fieldNamesItems);
                this.comboBox1.Text = "";

                if (geoRender != null)
                {
                    int index = Utils.getIndexFromItems(fieldNamesItems, geoRender.RenderGroupField);
                    this.comboBox1.SelectedIndex = index;
                }
            }

            ISimpleGeometryRender render = geoRender as ISimpleGeometryRender;

            if (render == null || render.Symbol == null)
            {
                ISurfaceSymbol tmpSurfaceSymbol = new SurfaceSymbol();
                string[]       row1             = new string[] { "Color", tmpSurfaceSymbol.Color.ToString() };
                string[]       row2             = new string[] { "EnableLight", tmpSurfaceSymbol.EnableLight.ToString() };
                string[]       row3             = new string[] { "RepeatLengthU", tmpSurfaceSymbol.RepeatLengthU.ToString() };
                string[]       row4             = new string[] { "RepeatLengthV", tmpSurfaceSymbol.RepeatLengthV.ToString() };
                string[]       row5             = new string[] { "Rotation", tmpSurfaceSymbol.Rotation.ToString() };
                ICurveSymbol   tmpCurveSymbol   = new CurveSymbol();
                string[]       row6             = new string[] { "BoundaryColor", tmpCurveSymbol.Color.ToString() };
                string[]       row7             = new string[] { "RepeatLength", tmpCurveSymbol.RepeatLength.ToString() };
                string[]       row8             = new string[] { "Width", tmpCurveSymbol.Width.ToString() };
                object[]       rows             = new object[] { row1, row2, row3, row4, row5, row6, row7, row8 };
                foreach (string[] rowArray in rows)
                {
                    this.dataGridView2.Rows.Add(rowArray);
                }
                return;
            }

            if (render.Symbol == null)
            {
                this.textBoxSurfacePictureName.Text = "";
                return;
            }

            {
                ISurfaceSymbol surfaceSymbol  = render.Symbol as ISurfaceSymbol;
                ICurveSymbol   boundarySymbol = surfaceSymbol.BoundarySymbol as ICurveSymbol;
                if (boundarySymbol != null)
                {
                    string[] row1  = new string[] { "Color", surfaceSymbol.Color.ToString() };
                    string[] row2  = new string[] { "EnableLight", surfaceSymbol.EnableLight.ToString() };
                    string[] row3  = new string[] { "RepeatLengthU", surfaceSymbol.RepeatLengthU.ToString() };
                    string[] row4  = new string[] { "RepeatLengthV", surfaceSymbol.RepeatLengthV.ToString() };
                    string[] row5  = new string[] { "Rotation", surfaceSymbol.Rotation.ToString() };
                    string[] row6  = new string[] { "BoundaryColor", boundarySymbol.Color.ToString() };
                    string[] row7  = new string[] { "RepeatLength", boundarySymbol.RepeatLength.ToString() };
                    string[] row8  = new string[] { "Width", boundarySymbol.Width.ToString() };
                    object[] rows2 = new object[] { row1, row2, row3, row4, row5, row6, row7, row8 };
                    foreach (string[] rowArray in rows2)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }
                    this.textBoxCurvePictureName.Text = boundarySymbol.ImageName;
                    this.textBoxCurvePicturePath.Text = boundarySymbol.ImageName;
                }
                else
                {
                    ICurveSymbol boundarySymbolNew = new CurveSymbol();
                    string[]     row1  = new string[] { "Color", surfaceSymbol.Color.ToString() };
                    string[]     row2  = new string[] { "EnableLight", surfaceSymbol.EnableLight.ToString() };
                    string[]     row3  = new string[] { "RepeatLengthU", surfaceSymbol.RepeatLengthU.ToString() };
                    string[]     row4  = new string[] { "RepeatLengthV", surfaceSymbol.RepeatLengthV.ToString() };
                    string[]     row5  = new string[] { "Rotation", surfaceSymbol.Rotation.ToString() };
                    string[]     row6  = new string[] { "BoundaryColor", boundarySymbolNew.Color.ToString() };
                    string[]     row7  = new string[] { "RepeatLength", boundarySymbolNew.RepeatLength.ToString() };
                    string[]     row8  = new string[] { "Width", boundarySymbolNew.Width.ToString() };
                    object[]     rows2 = new object[] { row1, row2, row3, row4, row5, row6, row7, row8 };
                    foreach (string[] rowArray in rows2)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }
                    this.textBoxCurvePictureName.Text = "";
                    this.textBoxCurvePicturePath.Text = "";
                }

                this.textBoxSurfacePictureName.Text = surfaceSymbol.ImageName;
                this.textBoxSurfacePicturePath.Text = surfaceSymbol.ImageName;
            }
        }
Ejemplo n.º 8
0
        public PointRenderForm(IGeometryRender geoRender, object[] fieldNamesItems, bool isSimplePoint)
        {
            InitializeComponent();
            IsSimplePoint = isSimplePoint;

            {
                this.comboBox1.Items.AddRange(fieldNamesItems);
                this.comboBox1.Text = "";

                if (geoRender != null)
                {
                    int index = Utils.getIndexFromItems(fieldNamesItems, geoRender.RenderGroupField);
                    this.comboBox1.SelectedIndex = index;
                }
            }

            ISimpleGeometryRender render = geoRender as ISimpleGeometryRender;

            if (render == null)
            {
                if (isSimplePoint)
                {
                    this.dataGridView1.Enabled      = true;
                    this.checkBox1.Enabled          = false;
                    this.textBoxPictureName.Enabled = false;
                    this.textBoxPicturePath.Enabled = false;

                    ISimplePointSymbol tmpSymbol = new SimplePointSymbol();
                    string[]           row1      = new string[] { "Alignment", tmpSymbol.Alignment.ToString() };
                    string[]           row2      = new string[] { "Size", tmpSymbol.Size.ToString() };
                    object[]           rows      = new object[] { row1, row2 };
                    foreach (string[] rowArray in rows)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }

                    string[] row11 = new string[] { "FillColor", tmpSymbol.FillColor.ToString() };
                    string[] row12 = new string[] { "Style", tmpSymbol.Style.ToString() };
                    object[] rows2 = new object[] { row11, row12 };
                    foreach (string[] rowArray in rows2)
                    {
                        this.dataGridView1.Rows.Add(rowArray);
                    }
                    return;
                }
                else
                {
                    this.dataGridView1.Enabled      = false;
                    this.checkBox1.Enabled          = true;
                    this.textBoxPictureName.Enabled = true;

                    IImagePointSymbol tmpSymbol = new ImagePointSymbol();
                    string[]          row1      = new string[] { "Alignment", tmpSymbol.Alignment.ToString() };
                    string[]          row2      = new string[] { "Size", tmpSymbol.Size.ToString() };
                    object[]          rows      = new object[] { row1, row2 };
                    foreach (string[] rowArray in rows)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }

                    this.textBoxPictureName.Text = "";
                    return;
                }
            }

            if (render.Symbol == null)
            {
                return;
            }

            if (isSimplePoint)
            {
                this.dataGridView1.Enabled      = true;
                this.checkBox1.Enabled          = false;
                this.textBoxPictureName.Enabled = false;
                this.textBoxPicturePath.Enabled = false;

                ISimplePointSymbol symbol = render.Symbol as ISimplePointSymbol;
                if (symbol != null)
                {
                    string[] row1 = new string[] { "Alignment", symbol.Alignment.ToString() };
                    string[] row2 = new string[] { "Size", symbol.Size.ToString() };
                    object[] rows = new object[] { row1, row2 };
                    foreach (string[] rowArray in rows)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }

                    string[] row11 = new string[] { "FillColor", symbol.FillColor.ToString() };
                    string[] row12 = new string[] { "Style", symbol.Style.ToString() };
                    object[] rows2 = new object[] { row11, row12 };
                    foreach (string[] rowArray in rows2)
                    {
                        this.dataGridView1.Rows.Add(rowArray);
                    }
                }
                else
                {
                    ISimplePointSymbol tmpSymbol = new SimplePointSymbol();
                    string[]           row1      = new string[] { "Alignment", tmpSymbol.Alignment.ToString() };
                    string[]           row2      = new string[] { "Size", tmpSymbol.Size.ToString() };
                    object[]           rows      = new object[] { row1, row2 };
                    foreach (string[] rowArray in rows)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }

                    string[] row11 = new string[] { "FillColor", tmpSymbol.FillColor.ToString() };
                    string[] row12 = new string[] { "Style", tmpSymbol.Style.ToString() };
                    object[] rows2 = new object[] { row11, row12 };
                    foreach (string[] rowArray in rows2)
                    {
                        this.dataGridView1.Rows.Add(rowArray);
                    }
                }
            }
            else
            {
                this.dataGridView1.Enabled      = false;
                this.checkBox1.Enabled          = true;
                this.textBoxPictureName.Enabled = true;

                IImagePointSymbol symbol = render.Symbol as IImagePointSymbol;
                if (symbol != null)
                {
                    string[] row1 = new string[] { "Alignment", symbol.Alignment.ToString() };
                    string[] row2 = new string[] { "Size", symbol.Size.ToString() };
                    object[] rows = new object[] { row1, row2 };
                    foreach (string[] rowArray in rows)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }

                    this.textBoxPicturePath.Text = symbol.ImageName;
                    this.textBoxPictureName.Text = symbol.ImageName;
                }
                else
                {
                    IImagePointSymbol tmpSymbol = new ImagePointSymbol();
                    string[]          row1      = new string[] { "Alignment", tmpSymbol.Alignment.ToString() };
                    string[]          row2      = new string[] { "Size", tmpSymbol.Size.ToString() };
                    object[]          rows      = new object[] { row1, row2 };
                    foreach (string[] rowArray in rows)
                    {
                        this.dataGridView2.Rows.Add(rowArray);
                    }

                    this.textBoxPictureName.Text = "";
                }
            }
        }
Ejemplo n.º 9
0
        private void btnApply_Click(object sender, System.EventArgs e)
        {
            string script = this.txtScript.Text.Trim();

            if (script != "")
            {
                IGeometryRender render = selectedLayer.GetGeometryRender();
                if (render != null)
                {
                    if (render.RenderType == gviRenderType.gviRenderSimple)
                    {
                        ISimpleGeometryRender simpleRender = render as ISimpleGeometryRender;
                        IGeometrySymbol       geoSymbol    = simpleRender.Symbol;
                        geoSymbol.Script    = script;
                        simpleRender.Symbol = geoSymbol;
                        if (!selectedLayer.SetGeometryRender(simpleRender))
                        {
                            MessageBox.Show("错误码为:" + this.axRenderControl1.GetLastError());
                        }
                    }
                }
                else
                {
                    ISimpleGeometryRender simpleRender = new SimpleGeometryRender();
                    switch (type)
                    {
                    case LayerType.ModelPoint:
                    {
                        IModelPointSymbol mps = new ModelPointSymbol();
                        mps.Script          = script;
                        simpleRender.Symbol = mps;
                    }
                    break;

                    case LayerType.Polyline:
                    {
                        ICurveSymbol cs = new CurveSymbol();
                        cs.Script           = script;
                        simpleRender.Symbol = cs;
                    }
                    break;

                    case LayerType.Point:
                    {
                        if (script.Contains("<ImageName>"))
                        {
                            IImagePointSymbol ips = new ImagePointSymbol();
                            ips.Script          = script;
                            simpleRender.Symbol = ips;
                        }
                        else
                        {
                            ISimplePointSymbol sps = new SimplePointSymbol();
                            sps.Script          = script;
                            simpleRender.Symbol = sps;
                        }
                    }
                    break;

                    case LayerType.Polygon:
                    {
                        if (script.Contains("<Height>"))
                        {
                            IPolygon3DSymbol p3s = new Polygon3DSymbol();
                            p3s.Script          = script;
                            simpleRender.Symbol = p3s;
                        }
                        else
                        {
                            ISurfaceSymbol ss = new SurfaceSymbol();
                            ss.Script           = script;
                            simpleRender.Symbol = ss;
                        }
                    }
                    break;
                    }
                    if (!selectedLayer.SetGeometryRender(simpleRender))
                    {
                        MessageBox.Show("错误码为:" + this.axRenderControl1.GetLastError());
                    }
                }
            }
            else
            {
                selectedLayer.SetGeometryRender(null);
            }
        }
Ejemplo n.º 10
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // 初始化RenderControl控件
            IPropertySet ps = new PropertySet();

            ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL);
            this.axRenderControl1.Initialize(true, ps);

            rootId = this.axRenderControl1.ObjectManager.GetProjectTree().RootID;
            this.axRenderControl1.Camera.FlyTime = 1;

            // 设置天空盒

            if (System.IO.Directory.Exists(strMediaPath))
            {
                string  tmpSkyboxPath = strMediaPath + @"\skybox";
                ISkyBox skybox        = this.axRenderControl1.ObjectManager.GetSkyBox(0);
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageBack, tmpSkyboxPath + "\\1_BK.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageBottom, tmpSkyboxPath + "\\1_DN.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageFront, tmpSkyboxPath + "\\1_FR.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageLeft, tmpSkyboxPath + "\\1_LF.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageRight, tmpSkyboxPath + "\\1_RT.jpg");
                skybox.SetImagePath(gviSkyboxImageIndex.gviSkyboxImageTop, tmpSkyboxPath + "\\1_UP.jpg");
            }
            else
            {
                MessageBox.Show("请不要随意更改SDK目录名");
                return;
            }

            // 加载FDB场景
            try
            {
                IConnectionInfo ci = new ConnectionInfo();
                ci.ConnectionType = gviConnectionType.gviConnectionFireBird2x;
                string tmpFDBPath = (strMediaPath + @"\BIM.FDB");
                ci.Database = tmpFDBPath;
                IDataSourceFactory dsFactory = new DataSourceFactory();
                ds = dsFactory.OpenDataSource(ci);
                string[] setnames = (string[])ds.GetFeatureDatasetNames();
                if (setnames.Length == 0)
                {
                    return;
                }
                dataset = ds.OpenFeatureDataset(setnames[0]);   //此处把dataset作为全局对象,以便后面调用
                string[] fcnames = (string[])dataset.GetNamesByType(gviDataSetType.gviDataSetFeatureClassTable);
                if (fcnames.Length == 0)
                {
                    return;
                }
                fcMap = new Hashtable(fcnames.Length);
                foreach (string name in fcnames)
                {
                    IFeatureClass fc = dataset.OpenFeatureClass(name);
                    // 找到空间列字段
                    List <string> geoNames = new List <string>();
                    fieldinfos = fc.GetFields();
                    for (int i = 0; i < fieldinfos.Count; i++)
                    {
                        IFieldInfo fieldinfo = fieldinfos.Get(i);
                        if (null == fieldinfo)
                        {
                            continue;
                        }

                        //找出设置了域的字段
                        IDomain domain = fieldinfo.Domain;
                        if (domain != null)
                        {
                            if (!fieldNamesHasDomain.Contains(fieldinfo.Name))
                            {
                                fieldNamesHasDomain.Add(fieldinfo.Name);
                            }
                        }

                        IGeometryDef geometryDef = fieldinfo.GeometryDef;
                        if (null == geometryDef)
                        {
                            continue;
                        }
                        geoNames.Add(fieldinfo.Name);
                    }
                    fcMap.Add(fc, geoNames);
                }

                //设置可供选择的字段
                comboBoxDomains.DataSource = fieldNamesHasDomain.ToArray();
                if (fieldNamesHasDomain.Count > 0)
                {
                    comboBoxDomains.SelectedIndex = 0;
                }
                SetDomainTree();
            }
            catch (COMException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
                return;
            }

            // CreateFeautureLayer
            bool hasfly = false;

            layerList = new List <IFeatureLayer>();
            foreach (IFeatureClass fc in fcMap.Keys)
            {
                List <string> geoNames = (List <string>)fcMap[fc];
                foreach (string geoName in geoNames)
                {
                    ISimpleGeometryRender georender = null;
                    if (comboBoxDomains.SelectedIndex >= 0 && fieldNamesHasDomain.Count > 0)
                    {
                        georender = new SimpleGeometryRender();
                        georender.RenderGroupField = fieldNamesHasDomain[comboBoxDomains.SelectedIndex];
                    }
                    IFeatureLayer featureLayer = this.axRenderControl1.ObjectManager.CreateFeatureLayer(fc, geoName, null, georender, rootId);
                    layerList.Add(featureLayer);

                    if (!hasfly)
                    {
                        IFieldInfoCollection fieldinfos  = fc.GetFields();
                        IFieldInfo           fieldinfo   = fieldinfos.Get(fieldinfos.IndexOf(geoName));
                        IGeometryDef         geometryDef = fieldinfo.GeometryDef;
                        IEnvelope            env         = geometryDef.Envelope;
                        if (env == null || (env.MaxX == 0.0 && env.MaxY == 0.0 && env.MaxZ == 0.0 &&
                                            env.MinX == 0.0 && env.MinY == 0.0 && env.MinZ == 0.0))
                        {
                            continue;
                        }
                        IEulerAngle angle = new EulerAngle();
                        angle.Set(0, -20, 0);
                        this.axRenderControl1.Camera.LookAt(env.Center, 1000, angle);
                    }
                    hasfly = true;
                }
            }

            //绑定事件
            this.comboBoxDomains.SelectedIndexChanged += new System.EventHandler(this.comboBoxDomains_SelectedIndexChanged);

            {
                this.helpProvider1.SetShowHelp(this.axRenderControl1, true);
                this.helpProvider1.SetHelpString(this.axRenderControl1, "");
                this.helpProvider1.HelpNamespace = "DomainTree.html";
            }
        }