private static void SetShp(Layer PointLayer, Fornix fornix) { if (-1 == PointLayer.FindFieldIndex("trend", 0)) { FieldDefn oFieldName0 = new FieldDefn("trend", FieldType.OFTReal); oFieldName0.SetWidth(50); oFieldName0.SetPrecision(7); PointLayer.CreateField(oFieldName0, 1); } if (-1 == PointLayer.FindFieldIndex("incli", 0)) { FieldDefn oFieldName1 = new FieldDefn("incli", FieldType.OFTReal); oFieldName1.SetWidth(50); oFieldName1.SetPrecision(7); PointLayer.CreateField(oFieldName1, 1); } if (-1 == PointLayer.FindFieldIndex("dip", 0)) { FieldDefn oFieldName2 = new FieldDefn("dip", FieldType.OFTReal); oFieldName2.SetWidth(50); oFieldName2.SetPrecision(7); PointLayer.CreateField(oFieldName2, 1); } for (int i = 0; i < (int)PointLayer.GetFeatureCount(0); ++i) { Vertex vertex = fornix.outSide.upvers.getVer(i); Feature pointFeature = PointLayer.GetFeature(i); pointFeature.SetField("trend", vertex.occurrence.trend); pointFeature.SetField("incli", vertex.occurrence.inclination); pointFeature.SetField("dip", vertex.occurrence.dip); PointLayer.SetFeature(pointFeature); //更改其值 pointFeature.Dispose(); //释放对象 } }
public void createInByOut(Fornix fornix) { this.upvers.clear(); this.lowvers.clear(); this.upvers.addVerCollection(fornix.outSide.upvers); this.lowvers.addVerCollection(fornix.outSide.lowvers); }
/// <summary> /// 生成穹窿模型侧面 /// </summary> /// <param name="fornix"></param> /// <param name="preFornix"></param> private static void createSide(Fornix fornix, Fornix preFornix, double FornixDip) { VertexCollection vcDown = new VertexCollection();//底面顶点集合 Vertex vertexUp, vertexDown; double dip = FornixDip; //根据产状生成底面顶点 for (int i = 1; i < fornix.outSide.countUpVers() - 1; ++i) { vertexUp = fornix.outSide.getUpver(i); vertexUp.calOccuurence(fornix.outSide.getUpver(i - 1), fornix.outSide.getUpver(i + 1), dip); vertexDown = new Vertex(); vertexDown.createDownVer(vertexUp); vertexDown.ID = _verNum++; vcDown.addVer(vertexDown); } vertexUp = fornix.outSide.getUpver(fornix.outSide.countUpVers() - 1); vertexUp.calOccuurence(fornix.outSide.getUpver(fornix.outSide.countUpVers() - 2), fornix.outSide.getUpver(0), dip); vertexDown = new Vertex(); vertexDown.createDownVer(vertexUp); vertexDown.ID = _verNum++; vcDown.addVer(vertexDown); vertexUp = fornix.outSide.getUpver(0); vertexUp.calOccuurence(fornix.outSide.getUpver(fornix.outSide.countUpVers() - 1), fornix.outSide.getUpver(1), dip); vertexDown = new Vertex(); vertexDown.createDownVer(vertexUp); vertexDown.ID = _verNum++; vcDown.addVer(vertexDown); //生成地层外侧面 fornix.createOutSideLowvers(vcDown); _verNum -= fornix.createOutSide(); //生成前一地层的内侧面 if (preFornix != null) { preFornix.createInSide(fornix); } }
/// <summary> /// 由带值点要素生成穹窿模型 /// </summary> private static void createFornixModelByPoint() { string path = @"E:\Users\LiuXianyu\Documents\ExperimentData\myProject\FornixModelingGDAL\Data\LingYanShan\Export\fornix1.obj"; string imgpath = @"E:\Users\LiuXianyu\Documents\ExperimentData\myProject\FornixModelingGDAL\Data\LingYanShan\lingyan.img"; _RasterPoints = DEMServer.getVersFromDEM(imgpath); //_RasterPoints = new VertexCollection(); //Vertex tempVer = new Vertex(); //tempVer.X(139741.0); //tempVer.Y(175806.0); //tempVer.Z(300.0); //tempVer.innerPoint = true; //_RasterPoints.addVer(tempVer); Fornix preFornix = null; ReadShp(@"E:\Users\LiuXianyu\Documents\ExperimentData\myProject\FornixModelingGDAL\Data\LingYanShan\codedata\vertex1\lyspv1.shp"); ReadShp(@"E:\Users\LiuXianyu\Documents\ExperimentData\myProject\FornixModelingGDAL\Data\LingYanShan\codedata\vertex1\lyspv2.shp"); ReadShp(@"E:\Users\LiuXianyu\Documents\ExperimentData\myProject\FornixModelingGDAL\Data\LingYanShan\codedata\vertex1\lyspv3.shp"); foreach (Layer PointLayer in layers) { //读入一个地层 Fornix fornix = new Fornix(PointLayer.GetName()); VertexCollection vcUp = new VertexCollection(); fornix.dip = PointLayer.GetFeature(0).GetFieldAsDouble("dip"); for (int i = 0; i < (int)PointLayer.GetFeatureCount(0); ++i) { Vertex vertex = new Vertex(); vertex.ID = _verNum++; vertex.X(PointLayer.GetFeature(i).GetFieldAsDouble("POINT_X")); vertex.Y(PointLayer.GetFeature(i).GetFieldAsDouble("POINT_Y")); //vertex.Z(PointLayer.GetFeature(i).GetFieldAsDouble("RASTERVALU")); vertex.Z(DEMServer.GetElevation(vertex.X(), vertex.Y())); vcUp.addVer(vertex); } if (vcUp.Count < 3) { MessageBox.Show("地层产状点不足!"); } //生成侧面上顶点 fornix.createOutSideUpvers(vcUp); //侧面生成 createSide(fornix, preFornix, fornix.dip); //将顶面边界点产状信息插回shp中 //SetShp(PointLayer, fornix); //组合 _fornixs.Add(fornix); preFornix = fornix; } foreach (Fornix fornix in _fornixs) { //基于相邻顶边,生成顶面 fornix.createUpFace(_RasterPoints); //基于相邻底边,生成底面 fornix.createDownFace(); } //打印obj ObjWriter.writeFornixObj(_fornixs, path, _verNum); }
public void createInSide(Fornix foxnix) { this.inSide.createInByOut(foxnix); }