//public static GvitechModel MergeModels(GvitechModel[] arrModel, GvitechVector3[] arrOff) //{ // if (((arrModel == null) || (arrOff == null)) || (arrModel.Length != arrOff.Length)) // { // return null; // } // int length = arrModel.Length; // IModel[] modelArray = new IModel[length]; // IVector3[] vectorArray = new IVector3[length]; // for (int i = 0; i < length; i++) // { // modelArray[i] = ((arrModel[i] == null) || arrModel[i].IsNull) ? null : arrModel[i].Model; // vectorArray[i] = ((arrOff[i] == null) || arrOff[i].IsNull) ? null : arrOff[i].Vector3; // } // return new GvitechModel(MergeModels(modelArray, vectorArray)); //} public static IModel MergeModels(IModel[] arrModel, IVector3[] arrOff) { IModel model = null; try { IModel model2 = null; IDrawGroup drawGroup = null; IDrawPrimitive primitive = null; IVector3 vector = null; model = resFactory.CreateModel(); for (int i = 0; i < arrModel.Length; i++) { if (((model2 = arrModel[i]) != null) && (model2.GroupCount != 0)) { for (int j = 0; j < model2.GroupCount; j++) { drawGroup = model2.GetGroup(j); if ((drawGroup != null) && (drawGroup.PrimitiveCount != 0)) { for (int k = 0; k < drawGroup.PrimitiveCount; k++) { if (((vector = arrOff[i]) != null) && (((arrOff[i].X != 0.0) || (arrOff[i].Y != 0.0)) || (arrOff[i].Z != 0.0))) { uint num; primitive = drawGroup.GetPrimitive(k); if ((primitive != null) && ((num = primitive.VertexArray.Length) != 0)) { int num2 = (int)(num / 3); for (int m = 0; m < num2; m++) { primitive.VertexArray.Set(m * 3, primitive.VertexArray.Array[m * 3] + ((float)vector.X)); primitive.VertexArray.Set((m * 3) + 1, primitive.VertexArray.Array[(m * 3) + 1] + ((float)vector.Y)); primitive.VertexArray.Set((m * 3) + 2, primitive.VertexArray.Array[(m * 3) + 2] + ((float)vector.Z)); } } } } model.AddGroup(drawGroup); } } } } return(model); } catch (Exception exception) { return(null); } }
public static void TestDrawTriMesh(IModelPoint mp, IModel model) { ISurfaceSymbol symbol = (SurfaceSymbol)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("4D5F0624-50A1-43E2-A0EC-A9713CB25608"))); symbol.Color = 0xff0000ff; ICurveSymbol symbol2 = (CurveSymbol)Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("E02C69C4-828D-40D5-869D-DAEB189B7F6F"))); symbol2.Color = 0xffff0000; symbol.BoundarySymbol = symbol2; IMultiPolygon multiPolygon = geoFactory.CreateGeometry(gviGeometryType.gviGeometryMultiPolygon, gviVertexAttribute.gviVertexAttributeZ) as IMultiPolygon; if (multiPolygon != null) { IPolygon geometry = null; IPoint pointValue = null; for (int i = 0; i < model.GroupCount; i++) { IDrawGroup group = model.GetGroup(i); for (int j = 0; j < group.PrimitiveCount; j++) { IDrawPrimitive primitive = group.GetPrimitive(j); for (int k = 0; k < (primitive.IndexArray.Length / 3); k++) { geometry = geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; pointValue = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointValue.X = mp.X + primitive.VertexArray.Array[primitive.IndexArray.Array[k * 3] * 3]; pointValue.Y = mp.Y + primitive.VertexArray.Array[(primitive.IndexArray.Array[k * 3] * 3) + 1]; pointValue.Z = mp.Z + primitive.VertexArray.Array[(primitive.IndexArray.Array[k * 3] * 3) + 2]; geometry.ExteriorRing.AppendPoint(pointValue); pointValue = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointValue.X = mp.X + primitive.VertexArray.Array[primitive.IndexArray.Array[(k * 3) + 1] * 3]; pointValue.Y = mp.Y + primitive.VertexArray.Array[(primitive.IndexArray.Array[(k * 3) + 1] * 3) + 1]; pointValue.Z = mp.Z + primitive.VertexArray.Array[(primitive.IndexArray.Array[(k * 3) + 1] * 3) + 2]; geometry.ExteriorRing.AppendPoint(pointValue); pointValue = geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointValue.X = mp.X + primitive.VertexArray.Array[primitive.IndexArray.Array[(k * 3) + 2] * 3]; pointValue.Y = mp.Y + primitive.VertexArray.Array[(primitive.IndexArray.Array[(k * 3) + 2] * 3) + 1]; pointValue.Z = mp.Z + primitive.VertexArray.Array[(primitive.IndexArray.Array[(k * 3) + 2] * 3) + 2]; geometry.ExteriorRing.AppendPoint(pointValue); geometry.Close(); multiPolygon.AddGeometry(geometry); } } } IRenderMultiPolygon item = Ocx.ObjectManager.CreateRenderMultiPolygon(multiPolygon, symbol, Ocx.ProjectTree.RootID); item.MaxVisibleDistance = 5000000.0; tmpList.Add(item); } }
static void Main(string[] args) { try { ConnectionInfo ci = new ConnectionInfo(); ci.ConnectionType = gviConnectionType.gviConnectionFireBird2x; ci.Database = "../XXX.FDB"; IDataSource dataSouce = new DataSourceFactory().OpenDataSource(ci); string[] names = (string[])dataSouce.GetFeatureDatasetNames(); IFeatureDataSet fds = dataSouce.OpenFeatureDataset(names[0]); IResourceManager resManager = fds as IResourceManager; //没有锁时这句会报错 IEnumResName myEnumNames = resManager.GetModelNames(); while (myEnumNames.MoveNext()) { string modelName = myEnumNames.Current; IModel myModel = resManager.GetModel(modelName); if (myModel != null) { for (int i = 0; i < myModel.GroupCount; i++) { IDrawGroup myGroup = myModel.GetGroup(i); for (int j = 0; j < myGroup.PrimitiveCount; j++) { IDrawPrimitive myPv = myGroup.GetPrimitive(j); IDrawMaterial myDM = myPv.Material; if (myDM != null) { myDM.EnableLight = false; } myPv.Material = myDM; myGroup.SetPrimitive(j, myPv); } myModel.SetGroup(i, myGroup); } resManager.UpdateModel(modelName, myModel); } } //手动释放COM对象 Marshal.ReleaseComObject(fds); MessageBox.Show("完成!"); } catch { MessageBox.Show("必须插入加密锁!必须安装CityMaker Builder 7.1"); } }
private bool OpenOsgModel(string osgPath, out IModel fmodel, out IModel smodel, out IPropertySet images, out IMatrix mat) { fmodel = null; smodel = null; images = null; mat = null; IResourceFactory resFactory = new ResourceFactoryClass(); if ((resFactory == null) || !File.Exists(osgPath)) { return(false); } Dictionary <string, string> dictionary = null; IDrawGroup group = null; IDrawPrimitive primitive = null; IPropertySet set = null; string str = ""; IImage property = null; try { resFactory.CreateModelAndImageFromFileEx(osgPath, out images, out smodel, out fmodel, out mat); if ((images != null) && (images.Count > 0)) { set = new PropertySetClass(); dictionary = new Dictionary <string, string>(); foreach (string str2 in images.GetAllKeys()) { property = images.GetProperty(str2) as IImage; IImage temp = null; string filePath = string.Format(string.Format(@"{0}\..\temp\{1}.png", Application.StartupPath, Guid.NewGuid().ToString()), new object[0]); if (property.WriteFile(filePath)) { temp = resFactory.CreateImageFromFile(filePath); } str = BitConverter.ToString(ObjectIdGenerator.Generate()).Replace("-", string.Empty).ToLowerInvariant(); dictionary.Add(str2, str); set.SetProperty(str, temp); if (File.Exists(filePath)) { File.Delete(filePath); } } images = set; } if ((fmodel != null) && (fmodel.GroupCount > 0)) { for (int i = 0; i < fmodel.GroupCount; i++) { group = fmodel.GetGroup(i); if (group != null) { if (!string.IsNullOrEmpty(group.CompleteMapTextureName) && dictionary.ContainsKey(group.CompleteMapTextureName)) { group.CompleteMapTextureName = dictionary[group.CompleteMapTextureName]; } if (!string.IsNullOrEmpty(group.LightMapTextureName) && dictionary.ContainsKey(group.LightMapTextureName)) { group.LightMapTextureName = dictionary[group.LightMapTextureName]; } if (group.PrimitiveCount > 0) { for (int j = 0; j < group.PrimitiveCount; j++) { primitive = group.GetPrimitive(j); if (((primitive != null) && (primitive.Material != null)) && (!string.IsNullOrEmpty(primitive.Material.TextureName) && dictionary.ContainsKey(primitive.Material.TextureName))) { primitive.Material.TextureName = dictionary[primitive.Material.TextureName]; } } } } } } if ((smodel != null) && (smodel.GroupCount > 0)) { for (int k = 0; k < smodel.GroupCount; k++) { group = smodel.GetGroup(k); if (group != null) { if (!string.IsNullOrEmpty(group.CompleteMapTextureName) && dictionary.ContainsKey(group.CompleteMapTextureName)) { group.CompleteMapTextureName = dictionary[group.CompleteMapTextureName]; } if (!string.IsNullOrEmpty(group.LightMapTextureName) && dictionary.ContainsKey(group.LightMapTextureName)) { group.LightMapTextureName = dictionary[group.LightMapTextureName]; } if (group.PrimitiveCount > 0) { for (int m = 0; m < group.PrimitiveCount; m++) { primitive = group.GetPrimitive(m); if (((primitive != null) && (primitive.Material != null)) && (!string.IsNullOrEmpty(primitive.Material.TextureName) && dictionary.ContainsKey(primitive.Material.TextureName))) { primitive.Material.TextureName = dictionary[primitive.Material.TextureName]; } } } } } } return(true); } catch (Exception exception) { return(false); } }
void aaa(IFeatureClass fc, int index, IResourceManager resourceM) { //无条件查询,即全选 IFdeCursor sourceCursor = fc.Update(null); IRowBuffer row = null; //遍历feature while ((row = sourceCursor.NextRow()) != null) { //从feature中拿到几何属性 IGeometry geom = (IGeometry)row.GetValue(index); //确定是模型 if (geom.GeometryType == gviGeometryType.gviGeometryModelPoint) { //转换为modelPoint IModelPoint mp = (IModelPoint)geom; //mp 的转换矩阵 IMatrix mx = mp.AsMatrix(); //获取模型实例 //注意: //model可以被不同的modelPoint多次引用,需要修改模型时 //需要通过modelName判断一下,这个模型被修改过没有 IModel model = resourceM.GetModel(mp.ModelName); //提取模型节点属性 if (model != null) { #region modelInside //遍历DrawGroup for (int dgrpi = 0; dgrpi < model.GroupCount; dgrpi++) { IDrawGroup dgrp = model.GetGroup(dgrpi); if (dgrp != null) { //遍历DrawPrimitive for (int dpri = 0; dpri < dgrp.PrimitiveCount; dpri++) { IDrawPrimitive dpr = dgrp.GetPrimitive(dpri); if (dpr != null) { //获取顶点数组 float[] verArray = dpr.VertexArray.Array; //创建新的顶点数组,替换原来的 IFloatArray newArr = new FloatArray(); //遍历数组,转为点,三个成员为一组,xyz for (int veri = 0; veri < verArray.Length; veri += 3) { Vector3 vec = new Vector3(); vec.X = verArray[veri]; vec.Y = verArray[veri + 1]; vec.Z = verArray[veri + 2]; //用矩阵转到决对坐标,并修改 IVector3 refVec = mx.MultiplyVector(vec); //修改部份 refVec.X = 3.3; refVec.Y = 4.4; refVec.Z = 5.5; //修改完,减掉mp中的位移,准备塞回modle newArr.Append((float)(refVec.X - mp.X)); newArr.Append((float)(refVec.Y - mp.Y)); newArr.Append((float)(refVec.Z - mp.Z)); } //把新顶点数组塞入Primitive dpr.VertexArray = newArr; //再把Primitive更新到当前Group dgrp.SetPrimitive(dpri, dpr); } } //把组更新到当前model model.SetGroup(dgrpi, dgrp); } } //更新数据源 resourceM.UpdateModel(mp.ModelName, model); resourceM.RebuildSimplifiedModel(mp.ModelName);//重建简模 //释放资源 model.Dispose(); model = null; #endregion } //修改mp mp.SetCoords(3.3, 4.4, 5.5, mp.M, mp.Id); //塞回row row.SetValue(index, mp); } } }
public override bool Draw(out IModelPoint mp, out IModel fmodel, out IModel smodel) { base.Draw(out mp, out fmodel, out smodel); try { if (base._vtx == null) { return(false); } if ((base._vtx.Length != 1) && (base._vtx.Length != 2)) { return(false); } object renderInfo = (base._renderType == RenderType.Texture) ? ((object)base._tcNames) : ((object)base._colors); //int[] index = new int[3]; //index[1] = 1; //index[2] = 2; int[] index = new int[2]; index[1] = 1; if (!base.NewEmptyModel(index, base._renderType, renderInfo, out fmodel)) { return(false); } IDrawGroup group = null; group = fmodel.GetGroup(0); IDrawPrimitive primitive = group.GetPrimitive(0); group.GetPrimitive(1); group.GetPrimitive(2); if (base._vtx.Length == 1) { // 生成类似断头的管线20161111 IPipeSection[] dSections = new IPipeSection[] { base._sections[0], DrawGeometry.DefaultSection(base._sections[0].SecShape) }; base.DrawConSingle1(base._vtx[0], base._sections[0], ref fmodel); // 原代码 //Vector[][] dVtxs = new Vector[][] { base._vtx[0], new Vector[] { base._vtx[0][0], new Vector(base._vtx[0][0].X, base._vtx[0][0].Y, 0.0) } }; //IPipeSection[] dSections = new IPipeSection[] { base._sections[0], DrawGeometry.DefaultSection(base._sections[0].SecShape) }; //base.DrawConBetween(dVtxs, dSections, ref fmodel); } else { base.DrawConBetween(new Vector[][] { base._vtx[0], base._vtx[1] }, new IPipeSection[] { base._sections[0], base._sections[1] }, ref fmodel); Vector[] dVtx = new Vector[] { base._vtx[0][0], new Vector(base._vtx[0][0].X, base._vtx[0][0].Y, 0.0) }; base.DrawConSingle(dVtx, DrawGeometry.DefaultSection(base._sections[0].SecShape), ref fmodel); } IDrawGroup drawGroup = null; if (this._bfModel.GroupCount > 0) { for (int i = 0; i < this._bfModel.GroupCount; i++) { drawGroup = this._bfModel.GetGroup(i); fmodel.AddGroup(drawGroup); } } if (this._bsModel != null) { int[] numArray2 = new int[1]; base.NewEmptyModel(numArray2, base._renderType, renderInfo, out smodel); IDrawPrimitive primitive2 = smodel.GetGroup(0).GetPrimitive(0); primitive2.Material.CullMode = gviCullFaceMode.gviCullNone; primitive2.VertexArray = primitive.VertexArray; primitive2.NormalArray = primitive.NormalArray; primitive2.TexcoordArray = primitive.TexcoordArray; primitive2.IndexArray = primitive.IndexArray; if (this._bsModel.GroupCount > 0) { for (int j = 0; j < this._bsModel.GroupCount; j++) { drawGroup = this._bsModel.GetGroup(j); smodel.AddGroup(drawGroup); } } } return(true); } catch (Exception exception) { return(false); } }
private void cbGlass_CheckedChanged(object sender, EventArgs e) { try { if (cbGlass.Checked) { foreach (IFeatureClass fc in fcMap.Keys) { // CCTV模型设为玻璃材质 IResourceManager rm = fc.FeatureDataSet as IResourceManager; IModel model = rm.GetModel("CCTV"); int groupCount = model.GroupCount; for (int i = 0; i < groupCount; i++) { IDrawGroup group = model.GetGroup(i); int primitiveCount = group.PrimitiveCount; for (int j = 0; j < primitiveCount; j++) { IDrawPrimitive primitive = group.GetPrimitive(j); primitive.PrimitiveType = gviPrimitiveType.gviPrimitiveGlass; } } rm.UpdateModel("CCTV", model); this.axRenderControl1.RefreshModel(fc.FeatureDataSet, "CCTV"); } } else { foreach (IFeatureClass fc in fcMap.Keys) { // CCTV模型设为普通材质 IResourceManager rm = fc.FeatureDataSet as IResourceManager; IModel model = rm.GetModel("CCTV"); int groupCount = model.GroupCount; for (int i = 0; i < groupCount; i++) { IDrawGroup group = model.GetGroup(i); int primitiveCount = group.PrimitiveCount; for (int j = 0; j < primitiveCount; j++) { IDrawPrimitive primitive = group.GetPrimitive(j); primitive.PrimitiveType = gviPrimitiveType.gviPrimitiveNormal; } } rm.UpdateModel("CCTV", model); this.axRenderControl1.RefreshModel(fc.FeatureDataSet, "CCTV"); } } } catch (System.Exception ex) { if (ex.GetType().Name.Equals("UnauthorizedAccessException")) { MessageBox.Show("需要标准runtime授权"); } else { MessageBox.Show(ex.Message); } } }
public override bool Draw(out IModelPoint mp, out IModel fmodel, out IModel smodel) { List <ushort> list2 = new List <ushort>(); IPolygon polygon = null; IPolygon polygon2 = null; IPolygon polygon3 = null; IPoint pointValue = null; ITriMesh mesh = null; IDoubleArray vArray = null; IUInt16Array indexArray = null; IFloatArray array3 = null; IFloatArray array4 = null; IDoubleArray norms = null; IDrawGroup group = null; IDrawPrimitive primitive = null; IDrawPrimitive primitive2 = null; IDrawPrimitive primitive3 = null; double naN = double.NaN; double ty = double.NaN; base.Draw(out mp, out fmodel, out smodel); try { int num; int num2; List <Vector> list; polygon = DrawGeometry.geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; polygon2 = DrawGeometry.geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; polygon3 = DrawGeometry.geoFactory.CreateGeometry(gviGeometryType.gviGeometryPolygon, gviVertexAttribute.gviVertexAttributeZ) as IPolygon; if (this._route.Count > 2) { list = Maths.DisperseLine(this._route, this._pillarSection.Diameter); } else { list = this._route; } double[] vtxs = this._pillarSection.GetVtxs(); SystemLog.Instance.Log("顶点个数:" + vtxs.Length); double[] numArray = new double[list.Count]; for (num = 0; num < list.Count; num++) { if (num == 0) { numArray[num] = 0.0; } else { numArray[num] = (list[num] - list[num - 1]).Length + numArray[num - 1]; } } object renderInfo = (this._renderType == RenderType.Texture) ? ((object)this._tcNames) : ((object)this._colors); int[] index = new int[3]; index[1] = 1; index[2] = 2; if (!base.NewEmptyModel(index, this._renderType, renderInfo, out fmodel)) { return(false); } group = fmodel.GetGroup(0); SystemLog.Instance.Log("开始计算正交向量:" + DateTime.Now.ToLongTimeString()); primitive = group.GetPrimitive(0); for (num = 0; num < list.Count; num++) { Vector vector; Vector vector2; Vector vector3; if (num == 0) { vector = list[num + 1] - list[num]; } else if (num == (list.Count - 1)) { vector = list[num] - list[num - 1]; } else { vector = ((list[num] - list[num - 1])).UnitVector() + ((list[num + 1] - list[num])).UnitVector(); } Maths.GenerateComplementBasis(vector, out vector2, out vector3); vector2 = -vector2; num2 = 0; while (num2 <= this._pillarSection.SegCount) { Vector vector6; Vector vector7; (((vtxs[num2 * 2] - this._pillarSection.OffsetX) * vector2) + ((vtxs[(num2 * 2) + 1] - this._pillarSection.OffsetY) * vector3)).UnitVector(); Vector vector4 = list[num] + ((Vector)((vtxs[num2 * 2] * vector2) + (vtxs[(num2 * 2) + 1] * vector3))); Vector vector5 = (Vector)(vector4 * 1.01); if (num == 0) { pointValue = DrawGeometry.geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointValue.SetCoords(vector4.X, vector4.Y, vector4.Z, 0.0, 0); polygon.ExteriorRing.AppendPoint(pointValue); pointValue = DrawGeometry.geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointValue.SetCoords(vector5.X, vector5.Y, vector5.Z, 0.0, 0); polygon3.ExteriorRing.AppendPoint(pointValue); } else if (num == (list.Count - 1)) { pointValue = DrawGeometry.geoFactory.CreatePoint(gviVertexAttribute.gviVertexAttributeZ); pointValue.SetCoords(vector4.X, vector4.Y, vector4.Z, 0.0, 0); polygon2.ExteriorRing.AppendPoint(pointValue); } primitive.VertexArray.Append((float)vector4.X); primitive.VertexArray.Append((float)vector4.Y); primitive.VertexArray.Append((float)vector4.Z); list2.Add((ushort)((primitive.VertexArray.Length / 3) - 1)); primitive.VertexArray.Append((float)vector4.X); primitive.VertexArray.Append((float)vector4.Y); primitive.VertexArray.Append((float)vector4.Z); list2.Add((ushort)((primitive.VertexArray.Length / 3) - 1)); if (this._renderType == RenderType.Texture) { primitive.TexcoordArray.Append((float)(num2 * 1.0)); primitive.TexcoordArray.Append((float)(num * 1.0)); primitive.TexcoordArray.Append((float)(num2 * 1.0)); primitive.TexcoordArray.Append((float)(num * 1.0)); } if (num2 == 0) { vector6 = new Vector(vtxs[num2 * 2] - vtxs[(this._pillarSection.SegCount - 1) * 2], vtxs[(num2 * 2) + 1] - vtxs[((this._pillarSection.SegCount - 1) * 2) + 1], 0.0).UnitVector(); vector7 = new Vector(vtxs[(num2 + 1) * 2] - vtxs[num2 * 2], vtxs[((num2 + 1) * 2) + 1] - vtxs[(num2 * 2) + 1], 0.0).UnitVector(); } else if (num2 == this._pillarSection.SegCount) { vector6 = new Vector(vtxs[num2 * 2] - vtxs[(num2 - 1) * 2], vtxs[(num2 * 2) + 1] - vtxs[((num2 - 1) * 2) + 1], 0.0).UnitVector(); vector7 = new Vector(vtxs[2] - vtxs[num2 * 2], vtxs[3] - vtxs[(num2 * 2) + 1], 0.0).UnitVector(); } else { vector6 = new Vector(vtxs[num2 * 2] - vtxs[(num2 - 1) * 2], vtxs[(num2 * 2) + 1] - vtxs[((num2 - 1) * 2) + 1], 0.0).UnitVector(); vector7 = new Vector(vtxs[(num2 + 1) * 2] - vtxs[num2 * 2], vtxs[((num2 + 1) * 2) + 1] - vtxs[(num2 * 2) + 1], 0.0).UnitVector(); } Vector vector8 = new Vector(vector6.Y, -vector6.X, vector6.Z); primitive.NormalArray.Append((float)vector8.X); primitive.NormalArray.Append((float)vector8.Y); primitive.NormalArray.Append((float)vector8.Z); vector8 = new Vector(vector7.Y, -vector7.X, vector7.Z); primitive.NormalArray.Append((float)vector8.X); primitive.NormalArray.Append((float)vector8.Y); primitive.NormalArray.Append((float)vector8.Z); num2++; } } SystemLog.Instance.Log("结束计算正交向量:" + DateTime.Now.ToLongTimeString()); SystemLog.Instance.Log("开始添加索引数组:" + DateTime.Now.ToLongTimeString()); for (num = 0; num < (list.Count - 1); num++) { for (num2 = 0; num2 < this._pillarSection.SegCount; num2++) { primitive.IndexArray.Append(list2[((num * ((this._pillarSection.SegCount + 1) * 2)) + (num2 * 2)) + 1]); primitive.IndexArray.Append(list2[((num + 1) * ((this._pillarSection.SegCount + 1) * 2)) + ((num2 + 1) * 2)]); primitive.IndexArray.Append(list2[(((num + 1) * ((this._pillarSection.SegCount + 1) * 2)) + (num2 * 2)) + 1]); primitive.IndexArray.Append(list2[((num * ((this._pillarSection.SegCount + 1) * 2)) + (num2 * 2)) + 1]); primitive.IndexArray.Append(list2[(num * ((this._pillarSection.SegCount + 1) * 2)) + ((num2 + 1) * 2)]); primitive.IndexArray.Append(list2[((num + 1) * ((this._pillarSection.SegCount + 1) * 2)) + ((num2 + 1) * 2)]); } } SystemLog.Instance.Log("结束添加索引数组:" + DateTime.Now.ToLongTimeString()); SystemLog.Instance.Log("开始画底面顶面和线框:" + DateTime.Now.ToLongTimeString()); vArray = new DoubleArrayClass(); indexArray = new UInt16ArrayClass(); array3 = new FloatArrayClass(); norms = new DoubleArrayClass(); primitive2 = group.GetPrimitive(1); polygon.ExteriorRing.ReverseOrientation(); mesh = DrawGeometry.geoConvertor.PolygonToTriMesh(polygon); if ((mesh != null) && mesh.BatchExport(ref vArray, ref indexArray, ref array3, ref array4, ref norms)) { for (num = 0; num < vArray.Length; num++) { primitive2.VertexArray.Append((float)vArray.Array[num]); } for (num = 0; num < indexArray.Length; num++) { primitive2.IndexArray.Append(indexArray.Array[num]); } for (num = 0; num < norms.Length; num++) { primitive2.NormalArray.Append((float)norms.Array[num]); } if (this._renderType == RenderType.Texture) { for (num = 0; num < (vArray.Length / 3); num++) { this.GetTexcoord(vArray.Array[num * 3], vArray.Array[(num * 3) + 1], out naN, out ty); primitive2.TexcoordArray.Append((float)naN); primitive2.TexcoordArray.Append((float)ty); } } } vArray = new DoubleArrayClass(); indexArray = new UInt16ArrayClass(); array3 = new FloatArrayClass(); norms = new DoubleArrayClass(); primitive3 = group.GetPrimitive(2); mesh = DrawGeometry.geoConvertor.PolygonToTriMesh(polygon2); if ((mesh != null) && mesh.BatchExport(ref vArray, ref indexArray, ref array3, ref array4, ref norms)) { for (num = 0; num < vArray.Length; num++) { primitive3.VertexArray.Append((float)vArray.Array[num]); } for (num = 0; num < indexArray.Length; num++) { primitive3.IndexArray.Append(indexArray.Array[num]); } for (num = 0; num < norms.Length; num++) { primitive3.NormalArray.Append((float)norms.Array[num]); } if (this._renderType == RenderType.Texture) { for (num = 0; num < (vArray.Length / 3); num++) { this.GetTexcoord(vArray.Array[num * 3], vArray.Array[(num * 3) + 1], out naN, out ty); primitive3.TexcoordArray.Append((float)naN); primitive3.TexcoordArray.Append((float)ty); } } } SystemLog.Instance.Log("结束画底面顶面和线框:" + DateTime.Now.ToLongTimeString()); SystemLog.Instance.Log("结束调用Draw:" + DateTime.Now.ToLongTimeString()); return(true); } catch (Exception exception) { SystemLog.Instance.Log(exception); return(false); } }