伟景行Citymaker三维Gis加载FDB数据

更新时间:2023-06-23 08:08:40 阅读: 评论:0

伟景⾏Citymaker三维Gis加载FDB数据
FDB是伟景⾏平台数据存储的格式,可以保存在本地也可以存储在后台数据库中,本代码是从本地加载FDB⽂件。
//连接信息对象,⽤于数据源的创建或打
IConnectionInfo ci = new ConnectionInfo();
//指定数据源连接类型
ci.ConnectionType = gviConnectionType.gviConnectionFireBird2x;
string tmpFDBPath = ConfigurationManager.AppSettings["fdbFile"];//获取FDB⽂件路径 ci.Databa = tmpFDBPath;
//数据源⼯⼚,负责数据源的打开
IDataSourceFactory dsFactory = new DataSourceFactory();
//打开数据源
IDataSource ds = dsFactory.OpenDataSource(ci);
//获取数据集名集合
string[] tnames = (string[])ds.GetFeatureDatatNames();
if (tnames.Length == 0)
return;
fcMap = new Hashtable();
for (int j = 0; j < tnames.Length; j++)
{
IFeatureDataSet datat = ds.OpenFeatureDatat(tnames[j]);
datatCRS = datat.SpatialReference;source code
string[] fcnames = (string[])datat.GetNamesByType(gviDataSetType.gviDataSetFeatureClassTabl
e);                            if (fcnames.Length == 0)
return;
幽默foreach (string name in fcnames)
{
IFeatureClass fc = datat.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);empirical>market
if (null == fieldinfo)
continue;
IGeometryDef geometryDef = fieldinfo.GeometryDef;
if (null == geometryDef)
continue;
geoNames.Add(fieldinfo.Name);
}
fcMap.Add(fc, geoNames);
}
}
bool hasfly = fal;
foreach (IFeatureClass fc in fcMap.Keys)
{
List<string> geoNames = (List<string>)fcMap[fc];
foreach (string geoName in geoNames)
{
if (!geoName.Equals("Geometry"))
continue;
IFeatureLayer featureLayer = this.axRenderControl.ObjectManager.CreateFeatureLayer(                            fc, geoName, null, null, rootId);
IFieldInfoCollection fieldinfos = fc.GetFields();wash的过去式
IFieldInfo fieldinfo = fieldinfos.Get(fieldinfos.IndexOf(geoName));
IGeometryDef geometryDef = fieldinfo.GeometryDef;
env = geometryDef.Envelope;
//定位到元素
建筑工程项目管理
if (!hasfly)
珠海翻译公司>上海 健身 私教{
if (env == null || (env.MaxX == 0.0 && env.MaxY == 0.0 && env.MaxZ == 0.0 &&
env.MinX == 0.0 && env.MinY == 0.0 && env.MinZ == 0.0))
continue;
IEulerAngle angle = new EulerAngle();
angle.Set(0, -20, 0);
一整天英语
if (geoFactory == null)
geoFactory = new GeometryFactory();
IPoint pos = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
pos.SpatialCRS = datatCRS;
pos.Position = env.Center;
this.axRenderControl.Camera.LookAt2(pos, 200, angle);
}
hasfly = true;
quest}
}

本文发布于:2023-06-23 08:08:40,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/78/1019670.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:数据源   数据   上海   连接   代码
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图