本文整理汇总了C#中FeatureLayerClass.Search方法的典型用法代码示例。如果您正苦于以下问题:C# FeatureLayerClass.Search方法的具体用法?C# FeatureLayerClass.Search怎么用?C# FeatureLayerClass.Search使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeatureLayerClass
的用法示例。
在下文中一共展示了FeatureLayerClass.Search方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GeneratePoints2
public void GeneratePoints2(string sLineLayer, string sDepthPointsLayer, double dblInterval, string strDepthField)
{
try
{
IMxDocument pmxdoc = ArcMap.Document as IMxDocument;
IMap pmap = pmxdoc.FocusMap;
IFeatureLayer pDepthSoundings = FindLayer(pmap, sDepthPointsLayer) as IFeatureLayer;
IFeatureLayer pLineLayer = FindLayer(pmap, sLineLayer) as IFeatureLayer;
IFeatureLayer pOutpoints = new FeatureLayerClass();
pOutpoints.FeatureClass = MakePointFC();
pOutpoints.Name = "Output Points";
ArcMap.Document.ActiveView.FocusMap.AddLayer(pOutpoints);
IProgressDialog2 pProgressDialog = ShowProgressIndicator("Calculating...", pLineLayer.FeatureClass.FeatureCount(null), 1);
pProgressDialog.ShowDialog();
//Set up the Outpoints cursor
IFeatureCursor pFCurOutPoints = pOutpoints.Search(null, false);
pFCurOutPoints = pOutpoints.FeatureClass.Insert(true);
//Set up the LineLayer Cursor
IFeatureCursor pFCur = pLineLayer.Search(null, false);
IFeature pLineFeature = pFCur.NextFeature();
IFeatureBuffer pFBuffer = pOutpoints.FeatureClass.CreateFeatureBuffer();
ICurve pCurve;
IPoint ppoint;
int iLineProgressCount = 1;
double dblDistance = 0;
double dblTotalDistanceCalculated = 0;
double iNumIntervals = 0;
double dblElevationDiff = 0;
double dblElevationInterval = 0;
double dblElevation = 0;
double dlbStartElevation = 0;
double dblEndElevation = 0;
pProgressDialog.Description = "Generating points for Line: " + iLineProgressCount + " of " + pLineLayer.FeatureClass.FeatureCount(null).ToString();
while (pLineFeature != null)
{
int iStartVertex = 0;
int iEndVertex = 1;
//Get the vertices of the line feature
IPointCollection4 pPointColl = pLineFeature.Shape as IPointCollection4;
//loop thru the vertices
for (int i = 0; i <= pPointColl.PointCount - 1; i++)
{
IPoint pStartPoint = pPointColl.get_Point(iStartVertex);
IPoint pEndPoint = pPointColl.get_Point(iEndVertex);
//Make an intermediate line segment between each set of vertices
IPath pPath = MakePath(pStartPoint, pEndPoint);
//Get the starting elevation from the depth point layer
dlbStartElevation = GetPointElevation(pDepthSoundings, pLineLayer, pStartPoint, strDepthField);
dblElevation = dlbStartElevation;
IPointCollection pPointForPath = null;
//Get the ending elevation from the next vertex
pEndPoint = pPointColl.get_Point(iEndVertex);
dblEndElevation = GetPointElevation(pDepthSoundings, pLineLayer, pEndPoint, strDepthField);
//If the returned elevation is 0, then there is no coincident depth point, move to the next vertex for your endpoint
if (dblEndElevation == 0)
{
//IPointCollection reshapePath = new PathClass();
object missing = Type.Missing;
pPointForPath = new PathClass();
pPointForPath.AddPoint(pStartPoint, ref missing, ref missing);
while (dblEndElevation == 0)
{
pEndPoint = pPointColl.get_Point(iEndVertex);
dblEndElevation = GetPointElevation(pDepthSoundings, pLineLayer, pEndPoint, strDepthField);
pPointForPath.AddPoint(pEndPoint, ref missing, ref missing);
//pLineSegment.Reshape(reshapePath as IPath);
if (dblEndElevation != 0)
{
break;
}
iEndVertex++;
}
}
if (pPointForPath != null)
{
pPath = pPointForPath as IPath;
}
//number of line segments based on the user's interval
iNumIntervals = Convert.ToDouble(pPath.Length / dblInterval);
dblElevationDiff = dblEndElevation - dlbStartElevation;
//The calculated elevation interval to step up each time
//.........这里部分代码省略.........
示例2: ceshiSelect
public void ceshiSelect(string shpFileName, string shpFilePath)
{
try
{
IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
IFeatureWorkspace pFeatureWorkspace = (IFeatureWorkspace)pWorkspaceFactory.OpenFromFile(shpFilePath, 0);
IFeatureLayer pFeatureLayer = new FeatureLayerClass();
pFeatureLayer.FeatureClass = pFeatureWorkspace.OpenFeatureClass(shpFileName);
//使要素处于编辑状态
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
IDataset dataset = (IDataset)pFeatureClass;
//ITable tb = (ITable)pFeatureClass;
IWorkspace workspace = dataset.Workspace;
IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;
//workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
//CopyFeatureClass(gp, selectfeature(pFeatureLayer,"VALUE>5"),@"D:\测试\searchResult.shp");
//selectfeature(pFeatureLayer, "VALUE>5");
IQueryFilter pQueryFilter = new QueryFilterClass();
IFeatureCursor pFeatureCursor = pFeatureLayer.Search(pQueryFilter, true);
IFeature pFeature = pFeatureCursor.NextFeature();
// while (pFeature != null)//遍历线图层的name,将线图层中的name和点图层中的lineName加入选择集并对两个选择集进行near,勾选location生成nearX和nearY
// {
IFeatureSelection featureSelection = pFeatureLayer as IFeatureSelection;
//string name = pFeature.get_Value(2).ToString();//线图层的name字段
pQueryFilter.WhereClause = "VALUE>5";// string.Format("name='{0}'", name);
featureSelection.SelectFeatures(pQueryFilter, esriSelectionResultEnum.esriSelectionResultNew, false);//选择线路名为name的线要素
IFeatureClass pFeatureclass = featureSelection.SelectionSet as IFeatureClass;
//这里这样写是不时就选好了那个WhereClause 另一个也是这么执行的 就是想当于你选好的 输入同的参数选择不同的 你稍等我下
//pFeature = pFeatureCursor.NextFeature();
// }
ESRI.ArcGIS.DataManagementTools.CopyFeatures copyFeatures = new CopyFeatures();
copyFeatures.in_features = pFeatureclass;// pFeatureLayer.FeatureClass;
copyFeatures.out_feature_class = @"D:\测试\searchResult3.shp";
gp.OverwriteOutput = true;
gp.Execute(copyFeatures, null);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
示例3: CalculatePoints
public void CalculatePoints(string sLineLayer, string sShorelineLayer, string sDepthLayer, double dblInterval, string ShoreDepthField, string DepthPointDepthField)
{
try
{
IMxDocument pmxdoc = ArcMap.Document as IMxDocument;
IMap pmap = pmxdoc.FocusMap;
IFeatureLayer pDepthSoundings = FindLayer(pmap, sDepthLayer) as IFeatureLayer;
IFeatureLayer pShorelineLayer = FindLayer(pmap, sShorelineLayer) as IFeatureLayer;
IFeatureLayer pLineLayer = FindLayer(pmap, sLineLayer) as IFeatureLayer;
//IFeatureLayer pOutpoints = FindLayer(pmap, sOutpoints) as IFeatureLayer;
IFeatureLayer pConnectingLines = FindLayer(pmap, "ConnectingLines") as IFeatureLayer;
IFeatureLayer pShorePoints = FindLayer(pmap, "ShorePoints") as IFeatureLayer;
IFeatureLayer pOutpoints = new FeatureLayerClass();
pOutpoints.FeatureClass = MakePointFC();
pOutpoints.Name = "Output Points";
ArcMap.Document.ActiveView.FocusMap.AddLayer(pOutpoints);
//AddField(pOutpoints, "Distance");
//AddField(pOutpoints, "Elevation");
IProgressDialog2 pProgressDialog = ShowProgressIndicator("Calculating...", pLineLayer.FeatureClass.FeatureCount(null), 1);
pProgressDialog.ShowDialog();
//Set up the Outpoints cursor
IFeatureCursor pFCurOutPoints = pOutpoints.Search(null, false);
pFCurOutPoints = pOutpoints.FeatureClass.Insert(true);
//Set up the LineLayer Cursor
IFeatureCursor pFCur = pLineLayer.Search(null, false);
IFeature pLineFeature = pFCur.NextFeature();
IFeatureBuffer pFBuffer = pOutpoints.FeatureClass.CreateFeatureBuffer();
ICurve pCurve;
IPoint ppoint;
int iLineProgressCount = 1;
double dblDistance = 0;
double dblTotalDistanceCalculated = 0;
int iNumIntervals = 0;
double dblElevationDiff = 0;
double dblElevationInterval = 0;
double dblElevation = 0;
double dlbStartElevation = 0;
double dblEndElevation = 0;
pProgressDialog.Description = "Generating points for Line: " + iLineProgressCount + " of " + pLineLayer.FeatureClass.FeatureCount(null).ToString();
while (pLineFeature != null)
{
pCurve = pLineFeature.Shape as ICurve;
pCurve.Project(pmap.SpatialReference);
//Get the Starting Elevation from the closest depth point
dlbStartElevation = GetStartElevation(pDepthSoundings, pLineLayer, pLineFeature, DepthPointDepthField);
//The Elevation for the first run IS the start elevation
dblElevation = dlbStartElevation;
//Get the ending elevation from the shoreline
dblEndElevation = GetFinalElevation(pShorelineLayer, pLineLayer, pLineFeature, ShoreDepthField);
//number of line segments based on the user's interval
iNumIntervals = Convert.ToInt32(pCurve.Length / dblInterval);
dblElevationDiff = Math.Abs(dblEndElevation - dlbStartElevation);
//The calculated elevation interval to step up each time
dblElevationInterval = dblElevationDiff / iNumIntervals;
ppoint = new PointClass();
//loop until the distance calculated hits the line length
while (dblTotalDistanceCalculated <= pCurve.Length)
{
pFBuffer.set_Value(pFBuffer.Fields.FindField("LineOID"), pLineFeature.OID);
pFBuffer.set_Value(pFBuffer.Fields.FindField("Distance"), dblDistance);
pFBuffer.set_Value(pFBuffer.Fields.FindField("Elevation"), dblElevation);
//this code set the point on the line at a distance
pCurve.QueryPoint(0, dblDistance, false, ppoint);
pFBuffer.set_Value(pFBuffer.Fields.FindField("X"), ppoint.X);
pFBuffer.set_Value(pFBuffer.Fields.FindField("Y"), ppoint.Y);
//reCalc the new distance and elevation values for the next iteration
dblDistance = dblDistance + dblInterval;
dblElevation = dblElevation + dblElevationInterval;
dblTotalDistanceCalculated = dblTotalDistanceCalculated + dblInterval;
//Insert the feature into the featureclass
pFBuffer.Shape = ppoint;
pFCurOutPoints.InsertFeature(pFBuffer);
}
//Reset the distance values back to 0 for the next feature
dblDistance = 0;
dblTotalDistanceCalculated = 0;
pLineFeature = pFCur.NextFeature();
pStepProgressor.Step();
pProgressDialog.Description = "Generating points for Line: " + iLineProgressCount + " of " + pLineLayer.FeatureClass.FeatureCount(null).ToString();
//.........这里部分代码省略.........
示例4: ExtractPointData
public void ExtractPointData(string sLineLayer, string sRasterLayer, double dblInterval,string strFileName)
{
try
{
strSaveFile = strFileName;
IMxDocument pmxdoc = ArcMap.Document as IMxDocument;
IMap pmap = pmxdoc.FocusMap;
IFeatureLayer pLineLayer = FindLayer(sLineLayer) as IFeatureLayer;
IRasterLayer pRasterLayer = FindLayer(sRasterLayer) as IRasterLayer;
//IFeatureLayer pPointLayer = FindLayer(sPointLayer) as IFeatureLayer;
IFeatureLayer pPointLayer = new FeatureLayerClass();
pPointLayer.FeatureClass = MakePointFC();
//pPointLayer.Name = "Points";
// ArcMap.Document.ActiveView.FocusMap.AddLayer(pPointLayer);
//get the Workspace from the IDataset interface on the feature class
IDataset dataset = (IDataset)pLineLayer.FeatureClass;
IWorkspace workspace = dataset.Workspace;
//Cast for an IWorkspaceEdit
IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)workspace;
//Start an edit session and operation
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
IProgressDialog2 pProgressDialog = ShowProgressIndicator("Calculating...", pLineLayer.FeatureClass.FeatureCount(null), 1);
pProgressDialog.ShowDialog();
//Set up the Outpoints cursor
IFeatureCursor pFCurOutPoints = pPointLayer.Search(null, false);
pFCurOutPoints = pPointLayer.FeatureClass.Insert(true);
//Set up the LineLayer Cursor
IFeatureCursor pFCur = pLineLayer.Search(null, false);
IFeature pLineFeature = pFCur.NextFeature();
IFeatureBuffer pFBuffer = pPointLayer.FeatureClass.CreateFeatureBuffer();
ICurve pCurve;
double dlbProcessedLength = 0;
double dblFCTotalLength = 0;
int p = 0;
while (pLineFeature != null)
{
pProgressDialog.Description = "Calculating line segment " + p.ToString() + " of: " + pLineLayer.FeatureClass.FeatureCount(null).ToString();
//create startpoint
pCurve = pLineFeature.Shape as ICurve;
pFBuffer.Shape = pCurve.FromPoint;
pFBuffer.set_Value(pFBuffer.Fields.FindField("Distance"), 0);
pFBuffer.set_Value(pFBuffer.Fields.FindField("LineOID"), pLineFeature.OID);
pFBuffer.set_Value(pFBuffer.Fields.FindField("X"), pCurve.FromPoint.X);
pFBuffer.set_Value(pFBuffer.Fields.FindField("Y"), pCurve.FromPoint.Y);
pFCurOutPoints.InsertFeature(pFBuffer);
double dblTotalDistance = pCurve.Length;
dlbProcessedLength = dblInterval;
IConstructPoint contructionPoint;
IPoint ppoint;
while (dlbProcessedLength <= dblTotalDistance)
{
contructionPoint = new PointClass();
contructionPoint.ConstructAlong(pCurve, esriSegmentExtension.esriNoExtension, dlbProcessedLength, false);
ppoint = new PointClass();
ppoint = contructionPoint as IPoint;
pFBuffer.Shape = ppoint;
//dblFCTotalLength += dblInterval;
pFBuffer.set_Value(pFBuffer.Fields.FindField("Distance"), Math.Round(dlbProcessedLength, 4));
pFBuffer.set_Value(pFBuffer.Fields.FindField("LineOID"), pLineFeature.OID);
pFBuffer.set_Value(pFBuffer.Fields.FindField("X"), ppoint.X);
pFBuffer.set_Value(pFBuffer.Fields.FindField("Y"), ppoint.Y);
pFCurOutPoints.InsertFeature(pFBuffer);
dlbProcessedLength += dblInterval;
pStepProgressor.Step();
}
dblFCTotalLength += dblInterval;
p++;
pLineFeature = pFCur.NextFeature();
}
//cleanup
pFCurOutPoints.Flush();
//.........这里部分代码省略.........
示例5: MakePolygonFeatureLayer
private IFeatureLayer MakePolygonFeatureLayer(FusionTable ft, List<RowPolygon> lstGeomsPolygon)
{
IFeatureLayer pPolyLayer = new FeatureLayerClass();
pPolyLayer.FeatureClass = MakeInMemoryFeatureClass(ft, esriGeometryType.esriGeometryPolygon);
//Set up the Outpoints cursor
IFeatureCursor pFCurOutLine = pPolyLayer.Search(null, false);
pFCurOutLine = pPolyLayer.FeatureClass.Insert(true);
IFeatureBuffer pFBuffer = pPolyLayer.FeatureClass.CreateFeatureBuffer();
IPointCollection pointCollection = null;
IPoint ppoint;
foreach (RowPolygon poly in lstGeomsPolygon)
{
pointCollection = new PolygonClass();
foreach (List<double> pt in poly.geometry.coordinates[0])
{
ppoint = new PointClass();
ppoint.X = pt[0];
ppoint.Y = pt[1];
pointCollection.AddPoint(ppoint);
}
pFBuffer.Shape = pointCollection as PolygonClass;
pFCurOutLine.InsertFeature(pFBuffer);
}
pPolyLayer.Name = "FusionTablePolygon";
return pPolyLayer;
}
示例6: MakePointFeatureLayer
private IFeatureLayer MakePointFeatureLayer(FusionTable ft, List<RowPoint> lstGeomsPoint)
{
IFeatureLayer pPointLayer = new FeatureLayerClass();
pPointLayer.FeatureClass = MakeInMemoryFeatureClass(ft, esriGeometryType.esriGeometryPoint);
//Set up the Outpoints cursor
IFeatureCursor pFCurOutPoints = pPointLayer.Search(null, false);
pFCurOutPoints = pPointLayer.FeatureClass.Insert(true);
IFeatureBuffer pFBuffer = pPointLayer.FeatureClass.CreateFeatureBuffer();
IPoint ppoint;
foreach (RowPoint pt in lstGeomsPoint)
{
ppoint = new PointClass();
ppoint.X = pt.geometry.coordinates[0];
ppoint.Y = pt.geometry.coordinates[1];
pFBuffer.Shape = ppoint;
//for (int i = 0; i <= pFBuffer.Fields.FieldCount - 1; i++)
//{
// string g = pFBuffer.Fields.get_Field(i).Name;
// foreach (string col in ft.columns)
// {
// if (col == pFBuffer.Fields.get_Field(i).Name)
// {
// pFBuffer.set_Value(pFBuffer.Fields.FindField(col), ft.rows[i]);
// }
// }
//}
pFCurOutPoints.InsertFeature(pFBuffer);
}
pPointLayer.Name = "FusionTablePoint";
return pPointLayer;
}
示例7: MakeLineFeatureLayer
private IFeatureLayer MakeLineFeatureLayer(FusionTable ft, List<RowLine> lstGeomsLine)
{
IFeatureLayer pLineLayer = new FeatureLayerClass();
pLineLayer.FeatureClass = MakeInMemoryFeatureClass(ft, esriGeometryType.esriGeometryPolyline);
//Set up the Outpoints cursor
IFeatureCursor pFCurOutLine = pLineLayer.Search(null, false);
pFCurOutLine = pLineLayer.FeatureClass.Insert(true);
IFeatureBuffer pFBuffer = pLineLayer.FeatureClass.CreateFeatureBuffer();
IPointCollection pNewLinePointColl = null;
IPoint ppoint;
foreach (RowLine line in lstGeomsLine)
{
pNewLinePointColl = new PolylineClass();
foreach (List<double> pt in line.geometry.coordinates)
{
ppoint = new PointClass();
ppoint.X = pt[0];
ppoint.Y = pt[1];
pNewLinePointColl.AddPoint(ppoint);
}
pFBuffer.Shape = pNewLinePointColl as PolylineClass;
pFCurOutLine.InsertFeature(pFBuffer);
}
pLineLayer.Name = "FusionTableLine";
return pLineLayer;
}
示例8: Calculate
public void Calculate(string sShorelineLayer, string sDepthPointsLayer, double dblInterval, string strShoreDepthField, string strDepthPointDepthField)
{
try
{
IMxDocument pmxdoc = ArcMap.Document as IMxDocument;
IMap pmap = pmxdoc.FocusMap;
IFeatureLayer pDepthSoundings = FindLayer(pmap, sDepthPointsLayer) as IFeatureLayer;
IFeatureLayer pShorelineLayer = FindLayer(pmap, sShorelineLayer) as IFeatureLayer;
//IFeatureLayer pOutpoints = FindLayer(pmap, sOutpoints) as IFeatureLayer;
IFeatureLayer pOutpoints = new FeatureLayerClass();
pOutpoints.FeatureClass = MakePointFC();
pOutpoints.Name = "Output Points";
ArcMap.Document.ActiveView.FocusMap.AddLayer(pOutpoints);
IFeatureLayer pConnectingLines = FindLayer(pmap, "ConnectingLines") as IFeatureLayer;
IFeatureLayer pShorePoints = FindLayer(pmap, "ShorePoints") as IFeatureLayer;
////Add fields if necessary
//AddField(pOutpoints, "Distance");
//AddField(pOutpoints, "Elevation");
//Set up the Outpoints cursor
IFeatureCursor pFCurOutPoints = pOutpoints.Search(null, false);
pFCurOutPoints = pOutpoints.FeatureClass.Insert(true);
IFeatureBuffer pFOutPointsBuffer = pOutpoints.FeatureClass.CreateFeatureBuffer();
//Set up the LineLayer Cursor (now using selected lines)
IFeatureSelection pShoreLineSelection = pShorelineLayer as IFeatureSelection;
if (pShoreLineSelection.SelectionSet.Count == 0)
{
MessageBox.Show("You must have at least one shoreline feature selected");
return;
}
ICursor pShorelineCursor;
IFeatureCursor pSelShoreFeatCur;
pShoreLineSelection.SelectionSet.Search(null, false, out pShorelineCursor);
pSelShoreFeatCur = pShorelineCursor as IFeatureCursor;
IFeature pShoreLineFeature = pSelShoreFeatCur.NextFeature();
//IFeatureCursor pFCur = pShorelineLayer.Search(null, false);
//IFeature pShoreLineFeature = pFCur.NextFeature();
//Set up the pConnectingLines cursor
IFeatureCursor pFCurOutLines = pConnectingLines.Search(null, false);
pFCurOutLines = pConnectingLines.FeatureClass.Insert(true);
IFeatureBuffer pFBuffer = pConnectingLines.FeatureClass.CreateFeatureBuffer();
//Set up the pShorePoints cursor
IFeatureCursor pShorePointsCursor = pShorePoints.Search(null, false);
IFeature pShorePointFeature = pShorePointsCursor.NextFeature();
IFeature pNewLineFeature = null;
IPointCollection pNewLinePointColl = null;
double dblDistance = 0;
double dblTotalDistanceCalculated = 0;
int iNumIntervals = 0;
double dblElevationDiff = 0;
double dblElevationInterval = 0;
double dblElevation = 0;
double dlbStartElevation = 0;
double dblEndElevation = 0;
int iLineProgressCount = 0;
IProgressDialog2 pProgressDialog = ShowProgressIndicator("Calculating points for shoreline vertex: ", 0, 1);
pProgressDialog.ShowDialog();
IEnvelope pCombinedEnvelope = CombineExtents(pDepthSoundings.FeatureClass, pShorelineLayer.FeatureClass);
while (pShoreLineFeature != null)
{
//IPointCollection4 pPointColl = pShoreLineFeature.Shape as IPointCollection4;
IPoint ppoint = new PointClass();
//for (int i = 0; i <= pPointColl.PointCount - 1; i++)
while (pShorePointFeature != null)
{
ppoint = pShorePointFeature.ShapeCopy as IPoint;
System.Diagnostics.Debug.WriteLine("ppoint: " + ppoint.X.ToString());
System.Diagnostics.Debug.WriteLine("shorepoint: " + pShorePointFeature.OID.ToString());
////try walking line at set intervals instead of just at vertices
//IPoint pLineVertex = new PointClass();
//pLineVertex = pPointColl.get_Point(i);
IFeatureCursor pDepthCursor = pDepthSoundings.Search(null, false);
IFeatureIndex2 pFtrInd = new FeatureIndexClass();
pFtrInd.FeatureClass = pDepthSoundings.FeatureClass;
pFtrInd.FeatureCursor = pDepthCursor;
pFtrInd.Index(null, pCombinedEnvelope);
IIndexQuery2 pIndQry = pFtrInd as IIndexQuery2;
int FtdID = 0;
double dDist2Ftr = 0;
pIndQry.NearestFeature(ppoint, out FtdID, out dDist2Ftr);
IFeature pCloseFeature = pDepthSoundings.FeatureClass.GetFeature(FtdID);
//.........这里部分代码省略.........