Ejemplo n.º 1
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DevExpress.XtraEditors.Controls.EditorButton btn = e.Button;
            switch (btn.Caption)
            {
            case "定位":
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                int focusedRowHandle = this.gridView1.FocusedRowHandle;
                if (focusedRowHandle == -1)
                {
                    return;
                }
                DataRow dr = this.gridView1.GetDataRow(focusedRowHandle);
                if (dr["geo"] != null && dr["Name"] != null && dr["fcName"] != null && dr["fc"] != null)
                {
                    ISurfaceSymbol ss = new SurfaceSymbolClass();
                    ss.Color = 0xcc00ff00;
                    ICurveSymbol cs = new CurveSymbolClass();
                    cs.Color          = 0xff00ff00;
                    cs.Width          = -5;
                    ss.BoundarySymbol = cs;
                    ISimplePointSymbol ps = new SimplePointSymbol();
                    ps.Size      = SystemInfo.Instance.SymbolSize;
                    ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                    IGeometry objGeo = dr["geo"] as IGeometry;
                    if (objGeo.GeometryType == gviGeometryType.gviGeometryModelPoint)
                    {
                        IModelPoint       mp  = objGeo as IModelPoint;
                        IModelPointSymbol mps = new ModelPointSymbol();
                        mps.SetResourceDataSet((dr["fc"] as IFeatureClass).FeatureDataSet);
                        mps.Color = 0xffffff00;
                        IRenderModelPoint rMP = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(mp, mps, app.Current3DMapControl.ProjectTree.RootID);
                        rMP.Glow(8000);
                        app.Current3DMapControl.ObjectManager.DelayDelete(rMP.Guid, 8000);

                        IGeometryFactory geoFact = new GeometryFactory();
                        IPoint           pt      = geoFact.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = mp.X; pt.Y = mp.Y; pt.Z = mp.Z;

                        ITableLabel tl = DrawTool.CreateTableLabel1(1);
                        tl.TitleText = dr["fcName"].ToString();
                        tl.SetRecord(0, 0, dr["Name"].ToString());
                        tl.Position = pt;

                        this._listRender.Add(tl.Guid);

                        app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                    }
                }
                break;
            }
        }
Ejemplo n.º 2
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.º 3
0
        public override void Run(object sender, System.EventArgs e)
        {
            try
            {
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null) return;
                TrackBarControl control = sender as TrackBarControl;
                if (control != null)
                {
                    double opac = double.Parse(control.EditValue.ToString()) / 100.0;
                    app.Current3DMapControl.Terrain.Opacity = opac;
                    string temp = (opac * 255.0).ToString();
                    int index = temp.IndexOf('.');
                    if (index == -1) return;
                    string stra = temp.Substring(0, index);
                    int a = int.Parse(stra);

                    //地形模型
                    List<DF3DFeatureClass> list = Dictionary3DTable.Instance.GetFeatureClassByFacilityClassName("DX3DMODEL");
                    if (list != null)
                    {
                        foreach (DF3DFeatureClass dffc in list)
                        {
                            IFeatureLayer fl = dffc.GetFeatureLayer();
                            if (fl == null) continue;

                            IModelPointSymbol mps = new ModelPointSymbol();
                            Color c = System.Drawing.Color.FromArgb(a, 255, 255, 255);
                            mps.Color = (uint)c.ToArgb();
                            mps.EnableColor = true;
                            ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                            geoRender.Symbol = mps;
                            fl.SetGeometryRender(geoRender);
                        }
                    }
                }
            }
            catch (Exception ex)
            {

            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 单击表格记录进行定位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            DataGridViewRow row = this.dataGridView1.Rows[e.RowIndex];

            if (row != null)
            {
                string            fid    = row.Cells["FID"].Value.ToString();
                IFeatureClass     fc     = row.Cells["FID"].Tag as IFeatureClass;
                IModelPoint       mp     = rowMap[fid].Modelpoint;
                IModelPointSymbol symbol = new ModelPointSymbol();
                symbol.SetResourceDataSet(fc.FeatureDataSet);
                IRenderModelPoint rmp = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(mp, symbol, rootId);
                if (rmp != null)
                {
                    //定位
                    this.axRenderControl1.Camera.FlyToObject(rmp.Guid, gviActionCode.gviActionJump);
                    //闪烁
                    rmp.Glow(2000);
                    this.axRenderControl1.ObjectManager.DelayDelete(rmp.Guid, 2000);
                }
            }
        }
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 MainForm_Load(object sender, System.EventArgs e)
        {
            // 初始化RenderControl控件
            IPropertySet ps = new PropertySet();

            ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL);
            this.axRenderControl1.Initialize(true, ps);
            this.axRenderControl1.Camera.FlyTime = 1;

            rootId = this.axRenderControl1.ObjectManager.GetProjectTree().RootID;

            // 设置天空盒

            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 = "FeatureLayerSimpleRender.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;

                // *******定义文字渲染风格*******
                ISimpleTextRender textRender = new SimpleTextRender();
                textRender.Expression = "''..$(oid)";
                ITextSymbol   textSymbol    = new TextSymbol();
                TextAttribute textAttribute = new TextAttribute();
                textAttribute.TextColor   = System.Drawing.Color.Red;
                textSymbol.TextAttribute  = textAttribute;
                textSymbol.PivotAlignment = gviPivotAlignment.gviPivotAlignBottomCenter;
                textSymbol.VerticalOffset = 10;
                // 注意:必须设置symbol,默认文字不显示
                textRender.Symbol = textSymbol;

                // *****定义几何物体渲染风格*****
                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                // 特别注意:此处设置了逻辑组字段,则需要在CreateFeatureLayer后设置组的可见性。否则,默认FeatureLayer将不可见。
                // 注意:必须用已注册RenderIndex的字段,否则CreateFeatureLayer创建不成功返回null
                geoRender.RenderGroupField = "Groupid";
                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;

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

                // *****定义几何物体渲染风格*****
                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                // 特别注意:此处设置了逻辑组字段,则需要在CreateFeatureLayer后设置组的可见性。否则,默认FeatureLayer将不可见。
                geoRender.RenderGroupField = "Groupid";
                ICurveSymbol geoSymbol = new CurveSymbol();
                geoSymbol.Color  = System.Drawing.Color.Red; //线颜色为Purple
                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;

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

                // *****定义几何物体渲染风格*****
                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                // 特别注意:此处设置了逻辑组字段,则需要在CreateFeatureLayer后设置组的可见性。否则,默认FeatureLayer将不可见。
                geoRender.RenderGroupField = "Groupid";
                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;

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

                // *****定义几何物体渲染风格*****
                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                //特别注意:此处设置了逻辑组字段,则需要在CreateFeatureLayer后设置组的可见性。否则,默认FeatureLayer将不可见。
                geoRender.RenderGroupField = "Groupid";
                IModelPointSymbol geoSymbol = new ModelPointSymbol();
                geoSymbol.Color       = System.Drawing.Color.Yellow; //模型颜色为Red
                geoSymbol.EnableColor = true;                        //需开启,否则颜色设置无效
                geoRender.Symbol      = geoSymbol;

                FeatureLayerVisualize(ci, false, "ModelPoint", textRender, geoRender);
            }
        }
Ejemplo n.º 7
0
        public MainForm()
        {
            InitializeComponent();

            // 初始化RenderControl控件
            IPropertySet ps = new PropertySet();

            ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL);
            this.axRenderControl1.Initialize(true, ps);
            this.axRenderControl1.Camera.FlyTime = 1;
            rootId = this.axRenderControl1.ObjectManager.GetProjectTree().RootID;

            // 设置天空盒

            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 + @"\BIMTIME.FDB");
                ci.Database = tmpFDBPath;
                IDataSourceFactory dsFactory = new DataSourceFactory();
                IDataSource        ds        = dsFactory.OpenDataSource(ci);
                string[]           setnames  = (string[])ds.GetFeatureDatasetNames();
                if (setnames.Length == 0)
                {
                    return;
                }
                IFeatureDataSet dataset = ds.OpenFeatureDataset(setnames[0]);
                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>();
                    IFieldInfoCollection fieldinfos = fc.GetFields();
                    for (int i = 0; i < fieldinfos.Count; i++)
                    {
                        IFieldInfo fieldinfo = fieldinfos.Get(i);
                        if (null == fieldinfo)
                        {
                            continue;
                        }
                        IGeometryDef geometryDef = fieldinfo.GeometryDef;
                        if (null == geometryDef)
                        {
                            continue;
                        }
                        geoNames.Add(fieldinfo.Name);
                    }
                    fcMap.Add(fc, geoNames);

                    bool bHasTemp = fc.HasTemporal();
                    if (bHasTemp)
                    {
                        ITemporalManager tm = fc.TemporalManager;
                        if (tm != null)
                        {
                            try
                            {
                                DateTime[] times = tm.GetKeyDatetimes();
                                for (int i = 0; i < times.Length; i++)
                                {
                                    if (keyDatetimesList.Contains(times[i]))
                                    {
                                        continue;
                                    }
                                    keyDatetimesList.Add(times[i]);
                                }
                            }
                            catch (COMException)
                            {
                            }
                        }
                    }
                }
            }
            catch (COMException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
                return;
            }

            // 设置时间轴
            keyDatetimesList.Sort();
            if (keyDatetimesList.Count > 3)
            {
                TimeSpan tsmin = keyDatetimesList[0] - dayLongLongAgo;
                this.trackBarTime.Minimum        = tsmin.Days - 1;
                this.trackBarTimeCompare.Minimum = tsmin.Days - 1;
                TimeSpan tsmax = keyDatetimesList[keyDatetimesList.Count - 2] - dayLongLongAgo;
                this.trackBarTime.Maximum        = tsmax.Days + 1;
                this.trackBarTimeCompare.Maximum = tsmax.Days + 1;
            }

            // CreateFeautureLayer
            bool hasfly = false;

            foreach (IFeatureClass fc in fcMap.Keys)
            {
                List <string> geoNames = (List <string>)fcMap[fc];
                foreach (string geoName in geoNames)
                {
                    IFeatureLayer featureLayer = this.axRenderControl1.ObjectManager.CreateFeatureLayer(
                        fc, geoName, null, null, rootId);
                    if (featureLayer == null)
                    {
                        continue;
                    }

                    #region 设置时态
                    featureLayer.EnableTemporal = true;
                    layerList.Add(featureLayer);

                    //设置curLayer的时刻
                    this.trackBarTime.Value = this.trackBarTime.Minimum;
                    DateTime d = dayLongLongAgo.AddDays((double)this.trackBarTime.Value);
                    this.labelTime.Text = d.ToString();
                    featureLayer.Time   = d;
                    #endregion

                    #region 比较规则
                    pset.SetProperty("提前", "$(starttime)");
                    featureLayer.CompareRenderRuleVariants = pset;

                    IValueMapGeometryRender render = new ValueMapGeometryRender();
                    {
                        IGeometryRenderScheme scheme = new GeometryRenderScheme();
                        IComparedRenderRule   rule   = new ComparedRenderRule();
                        rule.LookUpField     = "实际开始时间";
                        rule.CompareVariant  = "提前";
                        rule.CompareOperator = gviCompareType.gviCompareLess;
                        scheme.AddRule(rule);
                        IModelPointSymbol symbol = new ModelPointSymbol();
                        symbol.EnableColor = true;
                        symbol.Color       = System.Drawing.Color.Green;
                        scheme.Symbol      = symbol;
                        render.AddScheme(scheme);
                    }
                    {
                        IGeometryRenderScheme scheme = new GeometryRenderScheme();
                        IComparedRenderRule   rule   = new ComparedRenderRule();
                        rule.LookUpField     = "实际开始时间";
                        rule.CompareVariant  = "提前";
                        rule.CompareOperator = gviCompareType.gviCompareGreaterOrEqual;
                        scheme.AddRule(rule);
                        IModelPointSymbol symbol = new ModelPointSymbol();
                        symbol.EnableColor = false;
                        scheme.Symbol      = symbol;
                        render.AddScheme(scheme);
                    }
                    featureLayer.SetGeometryRender(render);
                    #endregion

                    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;
                        }
                        angle.Set(0, -52, 0);
                        position.Set(-13.44, -88.77, 59.28);
                        this.axRenderControl1.Camera.LookAt(position, 100, angle);
                        hasfly = true;
                    }
                }
            }

            {
                this.helpProvider1.SetShowHelp(this.axRenderControl1, true);
                this.helpProvider1.SetHelpString(this.axRenderControl1, "");
                this.helpProvider1.HelpNamespace = "FiveDShow.html";
            }
        }
Ejemplo n.º 8
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            // 初始化RenderControl控件
            IPropertySet ps = new PropertySet();

            ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL);
            this.axRenderControl1.Initialize(true, ps);
            this.axRenderControl1.Camera.FlyTime = 1;

            rootId = this.axRenderControl1.ObjectManager.GetProjectTree().RootID;

            // 设置天空盒

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

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

                // *******定义文字渲染风格*******
                IValueMapTextRender textRender = new ValueMapTextRender();
                textRender.Expression = "''..$(Name)";

                {
                    TextAttribute textAttribute = new TextAttribute();
                    textAttribute.TextColor = System.Drawing.Color.Yellow;
                    textAttribute.Font      = "黑体";
                    textAttribute.TextSize  = 15;

                    ITextSymbol textSymbol = new TextSymbol();
                    textSymbol.TextAttribute  = textAttribute;
                    textSymbol.PivotAlignment = gviPivotAlignment.gviPivotAlignBottomCenter;

                    IUniqueValuesRenderRule uniqValRule = new UniqueValuesRenderRule();
                    uniqValRule.LookUpField = "type";
                    uniqValRule.AddValue("写字楼");

                    ITextRenderScheme textScheme = new TextRenderScheme();
                    textScheme.Symbol = textSymbol;
                    textScheme.AddRule(uniqValRule);
                    textRender.AddScheme(textScheme);
                }

                {
                    TextAttribute textAttribute = new TextAttribute();
                    textAttribute.TextColor = Color.Black;
                    textAttribute.TextSize  = 11;
                    textAttribute.Font      = "华文新魏";

                    ITextSymbol textSymbol = new TextSymbol();
                    textSymbol.TextAttribute  = textAttribute;
                    textSymbol.PivotAlignment = gviPivotAlignment.gviPivotAlignBottomCenter;

                    IUniqueValuesRenderRule uniqValRule = new UniqueValuesRenderRule();
                    uniqValRule.LookUpField = "type";
                    uniqValRule.AddValue("别墅");

                    ITextRenderScheme textScheme = new TextRenderScheme();
                    textScheme.Symbol = textSymbol;
                    textScheme.AddRule(uniqValRule);
                    textRender.AddScheme(textScheme);
                }

                {
                    TextAttribute textAttribute = new TextAttribute();
                    textAttribute.TextColor = Color.Red;
                    textAttribute.TextSize  = 20;
                    textAttribute.Font      = "幼圆";

                    ITextSymbol textSymbol = new TextSymbol();
                    textSymbol.TextAttribute  = textAttribute;
                    textSymbol.PivotAlignment = gviPivotAlignment.gviPivotAlignBottomCenter;

                    IUniqueValuesRenderRule uniqValRule = new UniqueValuesRenderRule();
                    uniqValRule.LookUpField = "type";
                    uniqValRule.AddValue("商场");

                    ITextRenderScheme textScheme = new TextRenderScheme();
                    textScheme.Symbol = textSymbol;
                    textScheme.AddRule(uniqValRule);
                    textRender.AddScheme(textScheme);
                }

                // *****定义几何物体渲染风格*****
                IValueMapGeometryRender geoRender = new ValueMapGeometryRender();
                {
                    IRangeRenderRule rangeRule = new RangeRenderRule();
                    rangeRule.LookUpField = "storey";
                    rangeRule.MaxValue    = 3;
                    rangeRule.MinValue    = 0;
                    rangeRule.IncludeMin  = false;

                    IModelPointSymbol geoSymbol = new ModelPointSymbol();
                    geoSymbol.Color       = Color.Yellow; //模型颜色为浅黄
                    geoSymbol.EnableColor = true;         //需开启,否则颜色设置无效

                    IGeometryRenderScheme grs = new GeometryRenderScheme();
                    grs.AddRule(rangeRule);
                    grs.Symbol = geoSymbol;
                    geoRender.AddScheme(grs);
                }
                {
                    IRangeRenderRule rangeRule = new RangeRenderRule();
                    rangeRule.LookUpField = "storey";
                    rangeRule.MaxValue    = 9;
                    rangeRule.MinValue    = 3;
                    rangeRule.IncludeMin  = false;

                    IModelPointSymbol geoSymbol = new ModelPointSymbol();
                    geoSymbol.Color       = Color.YellowGreen; //模型颜色为中黄
                    geoSymbol.EnableColor = true;              //需开启,否则颜色设置无效

                    IGeometryRenderScheme grs = new GeometryRenderScheme();
                    grs.AddRule(rangeRule);
                    grs.Symbol = geoSymbol;
                    geoRender.AddScheme(grs);
                }
                {
                    IRangeRenderRule rangeRule = new RangeRenderRule();
                    rangeRule.LookUpField = "storey";
                    rangeRule.MaxValue    = 12;
                    rangeRule.MinValue    = 9;
                    rangeRule.IncludeMin  = false;

                    IModelPointSymbol geoSymbol = new ModelPointSymbol();
                    geoSymbol.Color       = Color.Red; //模型颜色为深黄
                    geoSymbol.EnableColor = true;      //需开启,否则颜色设置无效

                    IGeometryRenderScheme grs = new GeometryRenderScheme();
                    grs.AddRule(rangeRule);
                    grs.Symbol = geoSymbol;
                    geoRender.AddScheme(grs);
                }
                {
                    IRangeRenderRule rangeRule = new RangeRenderRule();
                    rangeRule.LookUpField = "storey";
                    rangeRule.MaxValue    = 15;
                    rangeRule.MinValue    = 12;
                    rangeRule.IncludeMin  = false;

                    IModelPointSymbol geoSymbol = new ModelPointSymbol();
                    geoSymbol.Color       = Color.PowderBlue; //模型颜色为深黄
                    geoSymbol.EnableColor = true;             //需开启,否则颜色设置无效

                    IGeometryRenderScheme grs = new GeometryRenderScheme();
                    grs.AddRule(rangeRule);
                    grs.Symbol = geoSymbol;
                    geoRender.AddScheme(grs);
                }
                {
                    IGeometryRenderScheme geoSchemeOther = new GeometryRenderScheme();
                    geoRender.AddScheme(geoSchemeOther);
                }

                FeatureLayerVisualize(ci, true, "建筑", textRender, geoRender);
            }

            {
                this.helpProvider1.SetShowHelp(this.axRenderControl1, true);
                this.helpProvider1.SetHelpString(this.axRenderControl1, "");
                this.helpProvider1.HelpNamespace = "FeatureLayerValueMapRender.html";
            }
        }
Ejemplo n.º 9
0
        private void GetData()
        {
            string   whereClause = _dict[_currentClass];
            SubClass sc          = _currentClass;

            if (sc.Parent == null)
            {
                return;
            }
            string[] arrFc3DId = sc.Parent.Fc3D.Split(';');
            if (arrFc3DId == null)
            {
                return;
            }
            foreach (string fc3DId in arrFc3DId)
            {
                DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fc3DId);
                if (dffc == null)
                {
                    continue;
                }
                FacilityClass facc = dffc.GetFacilityClass();
                IFeatureClass fc   = dffc.GetFeatureClass();
                if (fc == null || facc == null || facc.Name != this._facType)
                {
                    continue;
                }
                List <DFDataConfig.Class.FieldInfo> facFields = facc.FieldInfoCollection;
                if (facFields == null || facFields.Count == 0)
                {
                    return;
                }

                ISpatialFilter filter = new SpatialFilter();
                filter.SpatialRel    = gviSpatialRel.gviSpatialRelIntersects;
                filter.Geometry      = this._geo;
                filter.GeometryField = "FootPrint";
                filter.WhereClause   = whereClause;
                _count = fc.GetCount(filter);
                if (_num > _count || _count == 0)
                {
                    return;
                }

                filter.ResultBeginIndex = _num - 1;
                filter.ResultLimit      = 1;
                IFdeCursor cursor = null;
                IRowBuffer row    = null;
                try
                {
                    cursor = fc.Search(filter, false);
                    if ((row = cursor.NextRow()) != null)
                    {
                        #region 定位
                        int geoindex = row.FieldIndex("Geometry");
                        if (geoindex == -1 || !(row.GetValue(geoindex) is IModelPoint))
                        {
                            continue;
                        }
                        DF3DApplication app = DF3DApplication.Application;
                        if (app != null && app.Current3DMapControl != null)
                        {
                            IModelPoint       geo = row.GetValue(geoindex) as IModelPoint;
                            IModelPointSymbol mps = new ModelPointSymbol();
                            mps.SetResourceDataSet(fc.FeatureDataSet);
                            IRenderGeometry render = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(geo, mps, app.Current3DMapControl.ProjectTree.RootID);
                            //app.Current3DMapControl.Camera.FlyToObject(render.Guid, gviActionCode.gviActionJump);
                            render.Glow(5000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(render.Guid, 5000);

                            ITableLabel tl = DrawTool.CreateTableLabel1(1);
                            tl.TitleText = "属性查询";
                            tl.SetRecord(0, 0, dffc.ToString());
                            IPoint ptTL          = null;
                            int    geoshapeindex = row.FieldIndex("Shape");
                            if (geoshapeindex != -1)
                            {
                                if (!row.IsNull(geoshapeindex))
                                {
                                    IGeometry geoShape = row.GetValue(geoshapeindex) as IGeometry;
                                    if (geoShape.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                                    {
                                        double         x         = 0;
                                        double         y         = 0;
                                        double         z         = 0;
                                        IMultiPolyline mPolyline = geoShape as IMultiPolyline;
                                        for (int m = 0; m < mPolyline.GeometryCount; m++)
                                        {
                                            IPolyline polyline = mPolyline.GetPolyline(m);
                                            IPoint    pttemp   = polyline.Midpoint;
                                            x += pttemp.X;
                                            y += pttemp.Y;
                                            z += pttemp.Z;
                                        }
                                        x      = x / mPolyline.GeometryCount;
                                        y      = y / mPolyline.GeometryCount;
                                        z      = z / mPolyline.GeometryCount;
                                        ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                                        ptTL.X = x;
                                        ptTL.Y = y;
                                        ptTL.Z = z;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                                    {
                                        double        x        = 0;
                                        double        y        = 0;
                                        double        z        = 0;
                                        IMultiPolygon mPolygon = geoShape as IMultiPolygon;
                                        for (int m = 0; m < mPolygon.GeometryCount; m++)
                                        {
                                            IPolygon polygon = mPolygon.GetPolygon(m);
                                            IPoint   pttemp  = polygon.Centroid;
                                            x += pttemp.X;
                                            y += pttemp.Y;
                                            z += pttemp.Z;
                                        }
                                        x      = x / mPolygon.GeometryCount;
                                        y      = y / mPolygon.GeometryCount;
                                        z      = z / mPolygon.GeometryCount;
                                        ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                                        ptTL.X = x;
                                        ptTL.Y = y;
                                        ptTL.Z = z;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPolyline)
                                    {
                                        ptTL = (geoShape as IPolyline).Midpoint;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPoint)
                                    {
                                        ptTL = geoShape as IPoint;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPolygon)
                                    {
                                        ptTL = (geoShape as IPolygon).Centroid;
                                    }
                                }
                            }
                            if (ptTL != null)
                            {
                                tl.Position = ptTL;
                            }
                            else
                            {
                                tl.Position = geo;
                            }
                            app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                            app.Current3DMapControl.ObjectManager.DelayDelete(tl.Guid, 5000);
                        }

                        #endregion

                        foreach (DFDataConfig.Class.FieldInfo facField in facFields)
                        {
                            if (!facField.CanQuery)
                            {
                                continue;
                            }
                            int index = row.FieldIndex(facField.Name);
                            if (index != -1 && !row.IsNull(index))
                            {
                                object     obj  = row.GetValue(index);
                                string     str  = "";
                                IFieldInfo fiFC = row.Fields.Get(index);
                                switch (fiFC.FieldType)
                                {
                                case gviFieldType.gviFieldBlob:
                                case gviFieldType.gviFieldUnknown:
                                case gviFieldType.gviFieldGeometry:
                                    continue;

                                case gviFieldType.gviFieldFloat:
                                case gviFieldType.gviFieldDouble:
                                    double d;
                                    if (double.TryParse(obj.ToString(), out d))
                                    {
                                        str = d.ToString("0.00");
                                    }
                                    break;

                                default:
                                    str = obj.ToString();
                                    break;
                                }
                                DataRow dr = this._dtShow.NewRow();
                                dr["Property"] = facField.ToString();
                                dr["Value"]    = str;
                                this._dtShow.Rows.Add(dr);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    if (cursor != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                        cursor = null;
                    }
                    if (row != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                        row = null;
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private void GetData()
        {
            if (this.cbLayer.SelectedItem == null)
            {
                return;
            }
            DF3DFeatureClass dffc = this.cbLayer.SelectedItem as DF3DFeatureClass;

            if (dffc == null)
            {
                return;
            }
            IFeatureClass fc = dffc.GetFeatureClass();

            if (fc == null)
            {
                return;
            }

            if (_num > _count || _count == 0)
            {
                return;
            }

            ISpatialFilter filter = this._filter;

            filter.ResultBeginIndex = _num - 1;
            filter.ResultLimit      = 1;
            IFdeCursor cursor = null;
            IRowBuffer row    = null;

            try
            {
                cursor = fc.Search(filter, false);
                if ((row = cursor.NextRow()) != null)
                {
                    #region 定位
                    int             geoindex = row.FieldIndex("Geometry");
                    DF3DApplication app      = DF3DApplication.Application;
                    if (geoindex != -1 && !row.IsNull(geoindex) && app != null && app.Current3DMapControl != null)
                    {
                        ISurfaceSymbol ss = new SurfaceSymbolClass();
                        ss.Color = 0xcc00ff00;
                        ICurveSymbol cs = new CurveSymbolClass();
                        cs.Color          = 0xff00ff00;
                        cs.Width          = -5;
                        ss.BoundarySymbol = cs;
                        ISimplePointSymbol ps = new SimplePointSymbol();
                        ps.Size      = SystemInfo.Instance.SymbolSize;
                        ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                        IGeometry geo  = row.GetValue(geoindex) as IGeometry;
                        IPoint    ptTL = null;
                        if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                        {
                            double         x         = 0;
                            double         y         = 0;
                            double         z         = 0;
                            IMultiPolyline mPolyline = geo as IMultiPolyline;
                            for (int m = 0; m < mPolyline.GeometryCount; m++)
                            {
                                IPolyline polyline = mPolyline.GetPolyline(m);
                                IPoint    pttemp   = polyline.Midpoint;
                                x += pttemp.X;
                                y += pttemp.Y;
                                z += pttemp.Z;
                            }
                            x      = x / mPolyline.GeometryCount;
                            y      = y / mPolyline.GeometryCount;
                            z      = z / mPolyline.GeometryCount;
                            ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            ptTL.X = x;
                            ptTL.Y = y;
                            ptTL.Z = z;
                            IRenderMultiPolyline rMPolyline = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolyline(mPolyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                            rMPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rMPolyline.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rMPolyline.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rMPolyline.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                        {
                            double        x        = 0;
                            double        y        = 0;
                            double        z        = 0;
                            IMultiPolygon mPolygon = geo as IMultiPolygon;
                            for (int m = 0; m < mPolygon.GeometryCount; m++)
                            {
                                IPolygon polygon = mPolygon.GetPolygon(m);
                                IPoint   pttemp  = polygon.Centroid;
                                x += pttemp.X;
                                y += pttemp.Y;
                                z += pttemp.Z;
                            }
                            x      = x / mPolygon.GeometryCount;
                            y      = y / mPolygon.GeometryCount;
                            z      = z / mPolygon.GeometryCount;
                            ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            ptTL.X = x;
                            ptTL.Y = y;
                            ptTL.Z = z;
                            IRenderMultiPolygon rMPolygon = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(mPolygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                            rMPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rMPolygon.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rMPolygon.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rMPolygon.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPolyline)
                        {
                            IPolyline polyline = geo as IPolyline;
                            ptTL = polyline.Midpoint;
                            IRenderPolyline rPolyline = app.Current3DMapControl.ObjectManager.CreateRenderPolyline(polyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                            rPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rPolyline.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPolyline.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPolyline.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPoint)
                        {
                            IPoint point = geo as IPoint;
                            ptTL = point;
                            IRenderPoint rPoint = app.Current3DMapControl.ObjectManager.CreateRenderPoint(point, ps, app.Current3DMapControl.ProjectTree.RootID);
                            rPoint.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPoint.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPoint.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPolygon)
                        {
                            IPolygon polygon = geo as IPolygon;
                            ptTL = polygon.Centroid;
                            IRenderPolygon rPolygon = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                            rPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rPolygon.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPolygon.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPolygon.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryModelPoint)
                        {
                            ptTL = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            IModelPoint mp = geo as IModelPoint;
                            ptTL.X = mp.X;
                            ptTL.Y = mp.Y;
                            ptTL.Z = mp.Z;
                            IModelPointSymbol mps = new ModelPointSymbol();
                            mps.SetResourceDataSet(fc.FeatureDataSet);
                            IRenderGeometry render = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(mp, mps, app.Current3DMapControl.ProjectTree.RootID);
                            render.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(render.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(render.Guid, gviActionCode.gviActionJump);
                        }
                        if (ptTL != null)
                        {
                            ITableLabel tl = DrawTool.CreateTableLabel1(1);
                            tl.TitleText = "属性查询";
                            tl.SetRecord(0, 0, dffc.ToString());
                            if (ptTL != null)
                            {
                                tl.Position = ptTL;
                            }
                            app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                            app.Current3DMapControl.ObjectManager.DelayDelete(tl.Guid, 8000);
                        }
                    }
                    #endregion
                    FacilityClass facc = dffc.GetFacilityClass();
                    if (facc == null)
                    {
                        IFieldInfoCollection fiCol = fc.GetFields();
                        for (int i = 0; i < fiCol.Count; i++)
                        {
                            IFieldInfo fi  = fiCol.Get(i);
                            object     obj = row.GetValue(i);
                            string     str = "";
                            switch (fi.FieldType)
                            {
                            case gviFieldType.gviFieldBlob:
                            case gviFieldType.gviFieldUnknown:
                            case gviFieldType.gviFieldGeometry:
                                continue;

                            case gviFieldType.gviFieldFloat:
                            case gviFieldType.gviFieldDouble:
                                double d;
                                if (double.TryParse(obj.ToString(), out d))
                                {
                                    str = d.ToString("0.00");
                                }
                                break;

                            default:
                                str = obj.ToString();
                                break;
                            }
                            DataRow dr = this._dtShow.NewRow();
                            dr["Property"] = string.IsNullOrEmpty(fi.Alias) ? fi.Name : fi.Alias;
                            dr["Value"]    = str;
                            this._dtShow.Rows.Add(dr);
                        }
                    }
                    else
                    {
                        List <DFDataConfig.Class.FieldInfo> facFields = facc.FieldInfoCollection;
                        if (facFields != null)
                        {
                            foreach (DFDataConfig.Class.FieldInfo facField in facFields)
                            {
                                if (!facField.CanQuery)
                                {
                                    continue;
                                }
                                int index = row.FieldIndex(facField.Name);
                                if (index != -1 && !row.IsNull(index))
                                {
                                    object     obj  = row.GetValue(index);
                                    string     str  = "";
                                    IFieldInfo fiFC = row.Fields.Get(index);
                                    switch (fiFC.FieldType)
                                    {
                                    case gviFieldType.gviFieldBlob:
                                    case gviFieldType.gviFieldUnknown:
                                    case gviFieldType.gviFieldGeometry:
                                        continue;

                                    case gviFieldType.gviFieldFloat:
                                    case gviFieldType.gviFieldDouble:
                                        double d;
                                        if (double.TryParse(obj.ToString(), out d))
                                        {
                                            str = d.ToString("0.00");
                                        }
                                        break;

                                    default:
                                        str = obj.ToString();
                                        break;
                                    }
                                    DataRow dr = this._dtShow.NewRow();
                                    dr["Property"] = facField.ToString();
                                    dr["Value"]    = str;
                                    this._dtShow.Rows.Add(dr);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (cursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                    cursor = null;
                }
                if (row != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                    row = null;
                }
            }
        }
Ejemplo n.º 11
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.º 12
0
        private void MainForm_Load(object sender, System.EventArgs e)
        {
            // 初始化RenderControl控件
            IPropertySet ps = new PropertySet();

            ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL);
            this.axRenderControl1.Initialize(true, ps);
            this.axRenderControl1.Camera.FlyTime = 1;

            rootId = this.axRenderControl1.ObjectManager.GetProjectTree().RootID;

            // 设置天空盒

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

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

            layerEnvelopeMap = new Hashtable();

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

                // *****定义几何物体渲染风格*****
                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                //-- 配置为简单点 --
                ISimplePointSymbol geoSymbol = new SimplePointSymbol();
                geoSymbol.Script = "<Size>$(Groupid)*10</Size><FillColor>$(OBJECTID)</FillColor>";
                //-- 配置为图片点 --
                //IImagePointSymbol geoSymbol = new ImagePointSymbol();
                //geoSymbol.Script = "<Size>$(Groupid)*10</Size><ImageName>$(ImageName)</ImageName>";
                geoRender.Symbol = geoSymbol;

                type = LayerType.Point;
                FeatureLayerVisualize(ci, true, "Point", null, geoRender, type);
            }

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

                // *****定义几何物体渲染风格*****
                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                ICurveSymbol          geoSymbol = new CurveSymbol();
                geoSymbol.Script = "<Color>System.Drawing.Color.Yellow</Color><Width>$(Groupid)*10</Width><ImageName>$(ImageName)</ImageName><RepeatLength>100</RepeatLength>";
                geoRender.Symbol = geoSymbol;

                type = LayerType.Polyline;
                FeatureLayerVisualize(ci, false, "Polyline", null, geoRender, type);
            }

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

                // *****定义几何物体渲染风格*****
                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                //-- 配置为简单面 --
                //ISurfaceSymbol geoSymbol = new SurfaceSymbol();
                //geoSymbol.Script = "<Color>$(CommunitID)</Color>";
                //-- 配置为立体矩形 --
                IPolygon3DSymbol geoSymbol = new Polygon3DSymbol();
                geoSymbol.Script = "<Color>$(CommunitID)</Color><Height>$(oid)</Height>";
                ICurveSymbol curveSymbol = new CurveSymbol();
                curveSymbol.Script       = "<Color>$(CommunitID)</Color>";
                geoSymbol.BoundarySymbol = curveSymbol;
                geoRender.Symbol         = geoSymbol;

                type = LayerType.Polygon;
                FeatureLayerVisualize(ci, false, "Polygon", null, geoRender, type);
            }

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

                // *****定义几何物体渲染风格*****
                ISimpleGeometryRender geoRender = new SimpleGeometryRender();
                IModelPointSymbol     geoSymbol = new ModelPointSymbol();
                geoSymbol.Script      = "<Color>System.Drawing.Color.Yellow</Color>";
                geoSymbol.EnableColor = true;  // 记得要开启!
                geoRender.Symbol      = geoSymbol;

                type = LayerType.ModelPoint;
                FeatureLayerVisualize(ci, false, "ModelPoint", null, geoRender, type);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 定位和闪烁
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            int           featureId       = int.Parse((sender as DataGridView).CurrentRow.Cells[0].Value.ToString());
            IFeatureClass curFeatureClass = null;

            switch (tabControl1.SelectedTab.Name)
            {
            case "tabPage0Road":
            {
                foreach (IFeatureClass fc in fcMap.Keys)
                {
                    if (fc.Name == "Road")
                    {
                        curFeatureClass = fc;
                    }
                }
            }
            break;

            case "tabPage1Building":
            {
                foreach (IFeatureClass fc in fcMap.Keys)
                {
                    if (fc.Name == "Building")
                    {
                        curFeatureClass = fc;
                    }
                }
            }
            break;

            case "tabPage2Trees":
            {
                foreach (IFeatureClass fc in fcMap.Keys)
                {
                    if (fc.Name == "Trees")
                    {
                        curFeatureClass = fc;
                    }
                }
            }
            break;

            case "tabPage3Facility":
            {
                foreach (IFeatureClass fc in fcMap.Keys)
                {
                    if (fc.Name == "Facility")
                    {
                        curFeatureClass = fc;
                    }
                }
            }
            break;

            case "tabPage4LandScape":
            {
                foreach (IFeatureClass fc in fcMap.Keys)
                {
                    if (fc.Name == "Landscape")
                    {
                        curFeatureClass = fc;
                    }
                }
            }
            break;
            }

            string       filterString = string.Format("oid={0}", featureId);
            IQueryFilter filter       = new QueryFilter();

            filter.WhereClause = filterString;
            IFdeCursor cursor = null;

            try
            {
                cursor = curFeatureClass.Search(filter, true);
                if (cursor != null)
                {
                    IRowBuffer fdeRow = null;
                    if ((fdeRow = cursor.NextRow()) != null)
                    {
                        int nPos = fdeRow.FieldIndex("Geometry");
                        if (nPos != -1 && !fdeRow.IsNull(nPos))
                        {
                            IModelPoint       mp     = fdeRow.GetValue(nPos) as IModelPoint; // 从库中读取值
                            IModelPointSymbol symbol = new ModelPointSymbol();
                            symbol.SetResourceDataSet(curFeatureClass.FeatureDataSet);
                            IRenderModelPoint rmp = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(mp, symbol, rootId);
                            if (rmp != null)
                            {
                                // 定位
                                this.axRenderControl1.Camera.FlyToObject(rmp.Guid, gviActionCode.gviActionJump);
                                // 闪烁
                                rmp.Glow(2000);
                                this.axRenderControl1.ObjectManager.DelayDelete(rmp.Guid, 2000);
                            }
                        }
                    }
                }
            }
            catch (COMException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
            }
            finally
            {
                if (cursor != null)
                {
                    //Marshal.ReleaseComObject(cursor);
                    cursor = null;
                }
            }
        }
Ejemplo n.º 14
0
        void axRenderControl1_RcMouseClickSelect(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender)
        {
            //删除包围框
            for (int i = 0; i < rPolylinelist.Count; i++)
            {
                this.axRenderControl1.ObjectManager.DeleteObject((rPolylinelist[i] as IRenderPolyline).Guid);
            }
            rPolylinelist.Clear();
            for (int i = 0; i < rPolylinelistWhole.Count; i++)
            {
                this.axRenderControl1.ObjectManager.DeleteObject((rPolylinelistWhole[i] as IRenderPolyline).Guid);
            }
            rPolylinelistWhole.Clear();

            for (int i = 0; i < tableLabelList.Count; i++)
            {
                this.axRenderControl1.ObjectManager.DeleteObject((tableLabelList[i] as ITableLabel).Guid);
            }
            tableLabelList.Clear();

            for (int i = 0; i < modelpointList.Count; i++)
            {
                this.axRenderControl1.ObjectManager.DeleteObject((modelpointList[i] as IRenderModelPoint).Guid);
            }
            modelpointList.Clear();

            if (rpl1 != null)
            {
                this.axRenderControl1.ObjectManager.DeleteObject(rpl1.Guid);
            }
            if (rpl2 != null)
            {
                this.axRenderControl1.ObjectManager.DeleteObject(rpl2.Guid);
            }

            this.axRenderControl1.HighlightHelper.SetRegion(null);

            if (EventSender == gviMouseSelectMode.gviMouseSelectClick)
            {
                IPickResult pr = PickResult;
                if (pr == null)
                {
                    return;
                }
                if (pr.Type == gviObjectType.gviObject3DTileLayer)
                {
                    if (Mode == 1)
                    {
                        IPoint intersectPoint          = IntersectPoint;
                        IRelationalOperator2D relation = intersectPoint as IRelationalOperator2D;

                        foreach (IFeatureClass fc in fcMap.Keys)
                        {
                            List <string> geoNames = fcMap[fc] as List <string>;
                            if (geoNames.Count == 0)
                            {
                                continue;
                            }

                            IFdeCursor        cursor = null;
                            IRowBuffer        row    = null;
                            List <IRowBuffer> list   = new List <IRowBuffer>();
                            try
                            {
                                ISpatialFilter filter = new SpatialFilter();
                                filter.Geometry      = intersectPoint;
                                filter.SpatialRel    = gviSpatialRel.gviSpatialRelEnvelope;
                                filter.GeometryField = "Geometry";
                                cursor = fc.Search(filter, false);
                                while ((row = cursor.NextRow()) != null)
                                {
                                    list.Add(row);
                                }
                                //开始遍历
                                foreach (IRowBuffer r in list)
                                {
                                    int geometryIndex = -1;
                                    geometryIndex = r.FieldIndex(geoNames[0].ToString());
                                    if (geometryIndex != -1)
                                    {
                                        IGeometry polygon = r.GetValue(geometryIndex) as IGeometry;
                                        if (relation.Within2D(polygon))
                                        {
                                            this.axRenderControl1.HighlightHelper.SetRegion(polygon);
                                        }
                                    }
                                }
                            }
                            catch (System.Exception ex)
                            {
                                if (ex.GetType().Name.Equals("UnauthorizedAccessException"))
                                {
                                    MessageBox.Show("需要标准runtime授权");
                                }
                                else
                                {
                                    MessageBox.Show(ex.Message);
                                }
                            }
                            finally
                            {
                                if (cursor != null)
                                {
                                    //System.Runtime.InteropServices.//Marshal.ReleaseComObject(cursor);
                                    cursor = null;
                                }
                            }

                            if (Mask != gviModKeyMask.gviModKeyCtrl && Mask != gviModKeyMask.gviModKeyShift)
                            {
                                if (list.Count > 0)
                                {
                                    break;
                                }
                            }
                        }
                    }
                    else if (Mode == 2)
                    {
                        this.axRenderControl1.Camera.GetCamera2(out cameraPoint, out cameraAngle);
                        IProximityOperator disOperator = cameraPoint as IProximityOperator;
                        double             length      = disOperator.Distance3D(IntersectPoint);
                        //向相机方向延伸n米:n跟眼睛到交点距离有关,当距离远时n大,当距离近时n小。
                        factor = length * 0.001;

                        IPoint    aimingPoint      = this.axRenderControl1.Camera.GetAimingPoint2(IntersectPoint, cameraAngle, factor);
                        IPoint    sourcePoint      = this.axRenderControl1.Camera.GetAimingPoint2(IntersectPoint, cameraAngle, -factor);
                        IPolyline intersetPolyline = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline;
                        intersetPolyline.SpatialCRS = _currentCRS;
                        intersetPolyline.AppendPoint(sourcePoint);
                        //瓦片焦点可能在ModelPoint内部,导致拾取不上。因此要向intersectPoint内外各拉一定距离。
                        //intersetPolyline.AppendPoint(IntersectPoint);
                        intersetPolyline.AppendPoint(aimingPoint);

                        ICurveSymbol cs = new CurveSymbol();
                        cs.Color = System.Drawing.Color.Yellow;
                        cs.Width = -5;
                        rpl1     = this.axRenderControl1.ObjectManager.CreateRenderPolyline(intersetPolyline, cs, rootId);
                        rpl1.Glow(-1);

                        //IPolyline intersetPolyline2 = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolyline, gviVertexAttribute.gviVertexAttributeZ) as IPolyline;
                        //intersetPolyline2.AppendPoint(cameraPoint);
                        //intersetPolyline2.AppendPoint(IntersectPoint);
                        //cs.Color = System.Drawing.Color.Yellow;
                        //rpl2 = this.axRenderControl1.ObjectManager.CreateRenderPolyline(intersetPolyline2, cs, rootId);
                        //rpl2.Glow(-1);


                        foreach (IFeatureClass fc in fcMap.Keys)
                        {
                            ISpatialFilter sp = new SpatialFilter();
                            sp.Geometry      = intersetPolyline;
                            sp.SpatialRel    = gviSpatialRel.gviSpatialRelIntersects;
                            sp.GeometryField = "Geometry";
                            IFdeCursor cursor = null;
                            try
                            {
                                cursor = fc.Search(sp, false);
                                IRowBuffer row = null;
                                while ((row = cursor.NextRow()) != null)
                                {
                                    int         index = row.FieldIndex("Geometry");
                                    IModelPoint mp    = row.GetValue(index) as IModelPoint;
                                    //DrawEnvelope(mp.Envelope, mp.SpatialCRS, out rPolylinelist);
                                    //rPolylinelistWhole.AddRange(rPolylinelist);

                                    //创建RenderModelPoint,显示轮廓线
                                    //IModelPointSymbol mps = new ModelPointSymbol();
                                    //mps.Color = 0; //防止与瓦片同时显示时打架
                                    //mps.EnableColor = true;
                                    //mps.SetResourceDataSet(fc.FeatureDataSet);
                                    //IRenderModelPoint rmp = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(mp, mps, rootId);
                                    //rmp.ShowOutline = true;
                                    //modelpointList.Add(rmp);

                                    //创建RenderModelPoint,禁止深度检测
                                    IModelPointSymbol mps = new ModelPointSymbol();
                                    mps.Color         = System.Drawing.Color.Red;
                                    mps.EnableColor   = true;
                                    mps.EnableTexture = false;
                                    mps.SetResourceDataSet(fc.FeatureDataSet);
                                    IRenderModelPoint rmp = this.axRenderControl1.ObjectManager.CreateRenderModelPoint(mp, mps, rootId);
                                    rmp.DepthTestMode = gviDepthTestMode.gviDepthTestDisable; //防止与瓦片同时显示时打架
                                    modelpointList.Add(rmp);

                                    //创建TableLabel
                                    if (fde_point == null)
                                    {
                                        fde_point = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                                    }
                                    fde_point.Position   = mp.Position;
                                    fde_point.SpatialCRS = mp.SpatialCRS;
                                    tableLabelList.Add(DrawTableLabel(row, fde_point));
                                }
                            }
                            catch (COMException ex)
                            {
                                System.Diagnostics.Trace.WriteLine(ex.Message);
                            }
                            finally
                            {
                                if (cursor != null)
                                {
                                    //System.Runtime.InteropServices.//Marshal.ReleaseComObject(cursor);
                                    cursor = null;
                                }
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 15
0
        public MainForm()
        {
            InitializeComponent();

            // 初始化RenderControl控件
            IPropertySet ps = new PropertySet();

            ps.SetProperty("RenderSystem", gviRenderSystem.gviRenderOpenGL);
            this.axRenderControl1.Initialize(true, ps);
            this.axRenderControl1.Camera.FlyTime = 1;
            rootId = this.axRenderControl1.ObjectManager.GetProjectTree().RootID;

            // 设置天空盒
            flag = Application.StartupPath.LastIndexOf("Samples");
            if (flag > -1)
            {
                string  tmpSkyboxPath = Path.Combine(Application.StartupPath.Substring(0, flag), @"Samples\Media\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 = Path.Combine(Application.StartupPath.Substring(0, flag), @"Samples\Media\SDKDEMO.FDB");
                ci.Database = tmpFDBPath;
                IDataSourceFactory dsFactory = new DataSourceFactory();
                IDataSource        ds        = dsFactory.OpenDataSource(ci);
                string[]           setnames  = (string[])ds.GetFeatureDatasetNames();
                if (setnames.Length == 0)
                {
                    return;
                }
                IFeatureDataSet dataset = ds.OpenFeatureDataset(setnames[0]);
                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>();
                    IFieldInfoCollection fieldinfos = fc.GetFields();
                    for (int i = 0; i < fieldinfos.Count; i++)
                    {
                        IFieldInfo fieldinfo = fieldinfos.Get(i);
                        if (null == fieldinfo)
                        {
                            continue;
                        }
                        IGeometryDef geometryDef = fieldinfo.GeometryDef;
                        if (null == geometryDef)
                        {
                            continue;
                        }
                        geoNames.Add(fieldinfo.Name);
                    }
                    fcMap.Add(fc, geoNames);
                }
            }
            catch (COMException ex)
            {
                System.Diagnostics.Trace.WriteLine(ex.Message);
                return;
            }

            // 设置时间轴
            this.trackBarTime.Minimum = 0;
            this.trackBarTime.Maximum = 4;

            // CreateFeautureLayer
            bool hasfly = false;

            foreach (IFeatureClass fc in fcMap.Keys)
            {
                List <string> geoNames = (List <string>)fcMap[fc];
                foreach (string geoName in geoNames)
                {
                    IFeatureLayer featureLayer = this.axRenderControl1.ObjectManager.CreateFeatureLayer(
                        fc, geoName, null, null, rootId);
                    if (featureLayer == null)
                    {
                        continue;
                    }

                    if (fc.Name.Equals("Building") && geoName.Equals("Geometry"))
                    {
                        pset = new PropertySet();
                        pset.SetProperty("type", this.trackBarTime.Minimum);
                        featureLayer.CompareRenderRuleVariants = pset;

                        IValueMapGeometryRender render = new ValueMapGeometryRender();
                        {
                            IGeometryRenderScheme scheme = new GeometryRenderScheme();
                            IComparedRenderRule   rule   = new ComparedRenderRule();
                            rule.LookUpField     = "BuildType";
                            rule.CompareVariant  = "type";
                            rule.CompareOperator = gviCompareType.gviCompareEqual;
                            scheme.AddRule(rule);
                            IModelPointSymbol symbol = new ModelPointSymbol();
                            symbol.EnableColor = true;
                            symbol.Color       = System.Drawing.Color.Green;
                            scheme.Symbol      = symbol;
                            render.AddScheme(scheme);
                        }
                        {
                            IGeometryRenderScheme scheme = new GeometryRenderScheme();
                            IComparedRenderRule   rule   = new ComparedRenderRule();
                            rule.LookUpField     = "BuildType";
                            rule.CompareVariant  = "type";
                            rule.CompareOperator = gviCompareType.gviCompareLessOrEqual;
                            scheme.AddRule(rule);
                            render.AddScheme(scheme);
                        }
                        featureLayer.SetGeometryRender(render);
                        buildlayer = 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;
                        }
                        angle.Set(0, -30, 0);
                        this.axRenderControl1.Camera.LookAt(env.Center, 300, angle);
                        hasfly = true;
                    }
                }
            }

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