本文整理汇总了C#中PointClass.ConstructAlong方法的典型用法代码示例。如果您正苦于以下问题:C# PointClass.ConstructAlong方法的具体用法?C# PointClass.ConstructAlong怎么用?C# PointClass.ConstructAlong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointClass
的用法示例。
在下文中一共展示了PointClass.ConstructAlong方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cmdOK_Click
private void cmdOK_Click(object sender, EventArgs e)
{
//calc distance between points
double dbp = 0;
if (rbNOP.Checked)
dbp = m_polyline.Length / (int.Parse(txtNOP.Text) + 1);
else
dbp = int.Parse(txtDist.Text);
m_editor.StartOperation();
this.Cursor = Cursors.WaitCursor;
//create points at distance between points up to total length
for (double d = dbp; d < m_polyline.Length; d += dbp)
{
IConstructPoint contructionPoint = new PointClass();
contructionPoint.ConstructAlong(m_polyline, esriSegmentExtension.esriNoExtension,d,false);
CreatePoint(contructionPoint as IPoint);
}
//create points at start and end of sketch
if (chkEnds.Checked)
{
CreatePoint(m_polyline.FromPoint);
CreatePoint(m_polyline.ToPoint);
}
this.Cursor = Cursors.Default;
m_editor.StopOperation(A4LGSharedFunctions.Localizer.GetString("CrtPtsAlongLine"));
this.Close();
}
示例2: 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();
//.........这里部分代码省略.........
示例3: ConstructMiddlePoint
private IPoint ConstructMiddlePoint(IPolyline pline, double distance)
{
IConstructPoint constructpnt = new PointClass(); ;
constructpnt.ConstructAlong(pline, esriSegmentExtension.esriNoExtension, distance, false);
return constructpnt as IPoint;
}