/*! * 功能 计算路面声压级并离散 * 参数 sourcePath源文件路径 * resultPath 结果文件路径 * splitLength 分割长度 * timeType 计算时段 * 返回值 路面声压级 * 版本号 1.0 * 作者 樊晓剑 * 创建时间 2016年7月12日 * 修改时间 */ public Layer getSource(Layer sourceLayer, Layer resultLayer, float splitLength, String timeType, int frequency) { LineSourcePartition bean = new LineSourcePartition(); FeatureDefn resultDefn = sourceLayer.GetLayerDefn(); //字段名 Feature resultFeature = null; //循环获取要素 Geometry roadPoint = null; //离散节点 double height = 0; //高度 double LW = 0; //声功率级 while ((resultFeature = sourceLayer.GetNextFeature()) != null) { //根据所选要素获取相关属性 height = resultFeature.GetFieldAsDouble("HEIGHT_G"); LW = getRoadLW(resultFeature, timeType); //计算道路声功率级 Queue <Geometry> LineSource = bean.staticPartition(10, resultFeature.GetGeometryRef()); //公路声源离散 //离散结果生成新的图层 while (LineSource.Count > 0) { roadPoint = LineSource.Dequeue(); Feature feature = new Feature(resultDefn); feature.SetGeometry(roadPoint.Centroid()); feature.SetField("HEIGHT_G", height); feature.SetField("PWLs", SourceStrength.getLineSource(LW, roadPoint.Length())); //离散后声功率级 feature.SetField("FREQUENCY", frequency); //频率 resultLayer.CreateFeature(feature); } } return(resultLayer); }