Exemple #1
0
        public TextRenderForm(ITextRender textRender, object[] fields)
        {
            InitializeComponent();
            cols = fields;

            // ITextRender
            {
                if (textRender == null)
                {
                    this.textBox1.Text = "";
                }
                else
                {
                    this.textBox1.Text = textRender.Expression.ToString();
                }
            }

            // ISimpleTextRender
            IToolTipTextRender render = textRender as IToolTipTextRender;

            if (render == null)
            {
                render = new ToolTipTextRender();
            }

            string[] row1 = new string[] { "DynamicPlacement", render.DynamicPlacement.ToString() };
            string[] row2 = new string[] { "MinimizeOverlap", render.MinimizeOverlap.ToString() };
            string[] row3 = new string[] { "RemoveDuplicate", render.RemoveDuplicate.ToString() };
            object[] rows = new object[] { row1, row2, row3 };
            foreach (string[] rowArray in rows)
            {
                this.dataGridView2.Rows.Add(rowArray);
            }
        }
Exemple #2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // 初始化RenderControl控件
            IPropertySet ps = new PropertySet();

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

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

            // 设置天空盒

            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;
            }

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

            layerEnvelopeMap = new Hashtable();
            layerFcMap       = new Hashtable();

            // 可视化Point类型FeatureLayer
            {
                IConnectionInfo ci = new ConnectionInfo();
                ci.ConnectionType = gviConnectionType.gviConnectionFireBird2x;
                string tmpFDBPath = (strMediaPath + @"\point.FDB");
                ci.Database = tmpFDBPath;

                // *******定义文字渲染风格*******
                IToolTipTextRender textRender = new ToolTipTextRender();
                textRender.Expression = "''..$(oid)";

                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                IImagePointSymbol     geoSymbol = new ImagePointSymbol(); //将点以图片的形式显示出来
                geoSymbol.ImageName = "huang.png";                        //使用素材库里存在的图片
                geoSymbol.Size      = 25;
                geoRender.Symbol    = geoSymbol;

                FeatureLayerVisualize(ci, true, "Point", textRender, geoRender);
            }
            // 可视化Polyline类型FeatureLayer
            {
                IConnectionInfo ci = new ConnectionInfo();
                ci.ConnectionType = gviConnectionType.gviConnectionFireBird2x;
                string tmpFDBPath = (strMediaPath + @"\polyline.FDB");
                ci.Database = tmpFDBPath;

                // *******定义文字渲染风格*******
                IToolTipTextRender textRender = new ToolTipTextRender();
                textRender.Expression = "''..$(oid)";

                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                ICurveSymbol          geoSymbol = new CurveSymbol();
                geoSymbol.Color  = System.Drawing.Color.Purple; //线颜色为Purple
                geoSymbol.Width  = 5;
                geoRender.Symbol = geoSymbol;

                FeatureLayerVisualize(ci, false, "Polyline", textRender, geoRender);
            }

            // 可视化Polygon类型FeatureLayer
            {
                IConnectionInfo ci = new ConnectionInfo();
                ci.ConnectionType = gviConnectionType.gviConnectionFireBird2x;
                string tmpFDBPath = (strMediaPath + @"\polygon.FDB");
                ci.Database = tmpFDBPath;

                // *******定义文字渲染风格*******
                IToolTipTextRender textRender = new ToolTipTextRender();
                textRender.Expression = "''..$(oid)";

                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                ISurfaceSymbol        geoSymbol = new SurfaceSymbol();
                geoSymbol.Color  = System.Drawing.Color.Yellow; //面填充色为Yellow
                geoRender.Symbol = geoSymbol;

                FeatureLayerVisualize(ci, false, "Polygon", textRender, geoRender);
            }

            // 可视化ModelPoint类型FeatureLayer
            {
                IConnectionInfo ci = new ConnectionInfo();
                ci.ConnectionType = gviConnectionType.gviConnectionFireBird2x;
                string tmpFDBPath = (strMediaPath + @"\community.FDB");
                ci.Database = tmpFDBPath;

                // *******定义文字渲染风格*******
                IToolTipTextRender textRender = new ToolTipTextRender();
                textRender.Expression = "''..$(oid)";

                FeatureLayerVisualize(ci, false, "ModelPoint", textRender, null);
            }
        }