本文整理汇总了C#中PolylineClass类的典型用法代码示例。如果您正苦于以下问题:C# PolylineClass类的具体用法?C# PolylineClass怎么用?C# PolylineClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PolylineClass类属于命名空间,在下文中一共展示了PolylineClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetGeometry
private IGeometry GetGeometry(IGeometry baseGeometry)
{
IGeometry geometry;
IPolyline polyline = new PolylineClass();
polyline.SpatialReference = baseGeometry.SpatialReference;
geometry = polyline as IGeometry;
IPointCollection targetPointCollection = geometry as IPointCollection;
IPointCollection basePointCollection = baseGeometry as IPointCollection;
object missing = Type.Missing;
for (int i = 0; i < basePointCollection.PointCount; i++)
{
targetPointCollection.AddPoint(basePointCollection.get_Point(i), ref missing, ref missing);
}
MakeZAware(geometry);
return geometry;
}
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:25,代码来源:PolylineGeometry.cs
示例2: GetExample2
public static IGeometry GetExample2()
{
const double FromZ = -0.1;
const double ToZ = -8;
//Extrusion: Multiple Point 2D Polyline Extruded To Generate 3D Wall Via ConstructExtrudeFromTo()
IPointCollection polylinePointCollection = new PolylineClass();
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-10, -10), ref _missing, ref _missing);
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-8, -7), ref _missing, ref _missing);
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-5, -5), ref _missing, ref _missing);
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(-3, -2), ref _missing, ref _missing);
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(0, 0), ref _missing, ref _missing);
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(3, 2), ref _missing, ref _missing);
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(5, 5), ref _missing, ref _missing);
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(8, 7), ref _missing, ref _missing);
polylinePointCollection.AddPoint(GeometryUtilities.ConstructPoint2D(10, 10), ref _missing, ref _missing);
IGeometry polylineGeometry = polylinePointCollection as IGeometry;
ITopologicalOperator topologicalOperator = polylineGeometry as ITopologicalOperator;
topologicalOperator.Simplify();
IConstructMultiPatch constructMultiPatch = new MultiPatchClass();
constructMultiPatch.ConstructExtrudeFromTo(FromZ, ToZ, polylineGeometry);
return constructMultiPatch as IGeometry;
}
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:29,代码来源:ExtrusionExamples.cs
示例3: CreateLine
/// <summary>
/// ���ݵ㼯���������Ҫ��
/// </summary>
/// <params name="featureLayer"></params>
/// <params name="lstPoint"></params>
public void CreateLine(IFeatureLayer featureLayer, List<IPoint> lstPoint, int ID)
{
//try
//{
IFeatureClass featureClass = featureLayer.FeatureClass;
if (featureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
{
IPointCollection multipoint = new MultipointClass();
if (lstPoint.Count < 2)
{
MessageBox.Show(@"��ѡ���������������ϵ�����", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
ISegmentCollection pPath = new PathClass();
ILine pLine;
ISegment pSegment;
object o = Type.Missing;
for (int i = 0; i < lstPoint.Count - 1; i++)
{
pLine = new LineClass();
pLine.PutCoords(lstPoint[i], lstPoint[i + 1]);
pSegment = pLine as ISegment;
pPath.AddSegment(pSegment, ref o, ref o);
}
IGeometryCollection pPolyline = new PolylineClass();
pPolyline.AddGeometry(pPath as IGeometry, ref o, ref o);
IDataset dataset = (IDataset)featureClass;
IWorkspace workspace = dataset.Workspace;
IWorkspaceEdit workspaceEdit = workspace as IWorkspaceEdit;
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
IFeature feature = featureClass.CreateFeature();
IGeometry geometry = pPolyline as IGeometry;
DrawCommon.HandleZMValue(feature, geometry);//����ͼ��Zֵ����
feature.Shape = pPolyline as PolylineClass;
int iFieldID = feature.Fields.FindField(GIS_Const.FIELD_BID);
feature.Value[iFieldID] = ID.ToString();
feature.Store();
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(false);
IEnvelope envelop = feature.Shape.Envelope;
DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = envelop;
DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
}
else
{
MessageBox.Show(@"��ѡ����ͼ�㡣", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
//}
//catch
//{
// return;
//}
}
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:65,代码来源:DrawTunnels.cs
示例4: CreateFeature
/// <summary>
/// ������ʵ��
/// </summary>
/// <param name="pITable">���ݱ����</param>
/// <param name="entinyNode">VCT�ռ�ʵ��ڵ�</param>
public override void CreateFeature(ITable pITable, EntityNode entinyNode)
{
try
{
IFeatureClass pFeatureCls = pITable as IFeatureClass;
this.Feature = pFeatureCls.CreateFeature();
LineNode pLineNode = entinyNode as LineNode;
if (pLineNode != null)
{
///��ʶ�븳ֵ
int dBSMIndex = -1;
dBSMIndex = this.Feature.Fields.FindField(m_strEntityIDFiled);
if (dBSMIndex != -1)
this.Feature.set_Value(dBSMIndex, pLineNode.EntityID);
///Ҫ�ش��븳ֵ
int dSYDMIndex = -1;
dSYDMIndex = this.Feature.Fields.FindField(m_strYSDMField);
if (dSYDMIndex != -1)
this.Feature.set_Value(dSYDMIndex, pLineNode.FeatureCode);
///�����ռ�����
int dLineNodeCount = pLineNode.SegmentNodes.Count;
IPointCollection pointCollection = new PolylineClass();
for (int i = 0; i < dLineNodeCount; i++)
{
//11��ʾ��������
if (Metadata.MetaDataFile.GraphConfig.GetGraphMark("LINETYPE", pLineNode.SegmentNodes[i].SegmentType.ToString()) == "BrokenLine")
{
BrokenLineNode pBLine = pLineNode.SegmentNodes[i] as BrokenLineNode;
foreach (PointInfoNode pPointInfoNode in pBLine.PointInfoNodes)
{
IPoint pPoint = new PointClass();
pPoint.PutCoords(pPointInfoNode.X, pPointInfoNode.Y);
object objType = Type.Missing;
pointCollection.AddPoint(pPoint, ref objType, ref objType);
}
}
else
{
//�������ʹ�������չ
}
}
(this.Feature as IFeature).Shape = pointCollection as IGeometry;
//feature.set_Value();
this.Feature.Store();
}
}
catch(Exception ex)
{
Logger.WriteErrorLog(ex);
}
}
开发者ID:hy1314200,项目名称:HyDM,代码行数:60,代码来源:LineEntity.cs
示例5: DrawAxis
private static void DrawAxis(IGraphicsContainer3D axesGraphicsContainer3D, IPoint axisFromPoint, IPoint axisToPoint, IColor axisColor, esriSimple3DLineStyle axisStyle, double axisWidth)
{
IPointCollection axisPointCollection = new PolylineClass();
axisPointCollection.AddPoint(axisFromPoint, ref _missing, ref _missing);
axisPointCollection.AddPoint(axisToPoint, ref _missing, ref _missing);
GeometryUtilities.MakeZAware(axisPointCollection as IGeometry);
GraphicsLayer3DUtilities.AddAxisToGraphicsLayer3D(axesGraphicsContainer3D, axisPointCollection as IGeometry, axisColor, axisStyle, axisWidth);
}
开发者ID:Esri,项目名称:arcobjects-sdk-community-samples,代码行数:11,代码来源:DrawUtilities.cs
示例6: CreateTurnGeometry
private static IGeometry CreateTurnGeometry(IPoint ptStart, IPoint ptVia, IPoint ptEnd, ISpatialReference sr)
{
IPolyline lineTurn = new PolylineClass();
lineTurn.SpatialReference = sr;
IPointCollection pcTurn = lineTurn as IPointCollection;
pcTurn.AddPoint(ptStart);
pcTurn.AddPoint(ptVia);
pcTurn.AddPoint(ptEnd);
return (IGeometry)lineTurn;
}
开发者ID:hallahan,项目名称:arcgis-osm-editor,代码行数:12,代码来源:NetworkTurns.cs
示例7: OnClick
protected override void OnClick()
{
//
// TODO: Sample code showing how to access button host
//
var referenceFactory2 = (ISpatialReferenceFactory2)new SpatialReferenceEnvironment();
ISpatialReference WGS84 = referenceFactory2.CreateSpatialReference((int)esriSRGeoCSType.esriSRGeoCS_WGS1984);
IPointCollection pointCollection = new PolylineClass();
// ------------- Ensure that both points have negative longitude values -------------------
IPoint point = new PointClass();
point.PutCoords(-170, 10); // Equivalent to 170 degrees WEST
point.SpatialReference = WGS84;
pointCollection.AddPoint(point);
point = new PointClass();
point.PutCoords(-200, 10); // Equivalent to 160 degrees EAST
point.SpatialReference = WGS84;
pointCollection.AddPoint(point);
// -----------------------------------------------------------------------
IPolyline polyline = (IPolyline)pointCollection;
polyline.SpatialReference = WGS84;
var geometryDefEdit = (IGeometryDefEdit)new GeometryDef();
geometryDefEdit.GeometryType_2 = esriGeometryType.esriGeometryPolyline;
geometryDefEdit.SpatialReference_2 = WGS84;
var field = (IFieldEdit)new Field();
field.Name_2 = "Shape";
field.Type_2 = esriFieldType.esriFieldTypeGeometry;
field.GeometryDef_2 = geometryDefEdit;
var fields = (IFieldsEdit)new Fields();
fields.AddField(field);
IWorkspaceFactory workspaceFactory = new ShapefileWorkspaceFactory();
var featureWorkspace = (IFeatureWorkspace)workspaceFactory.OpenFromFile("C:\\Temp\\", 0);
IFeatureClass featureClass = featureWorkspace.CreateFeatureClass
("test3.shp", fields, null, null, esriFeatureType.esriFTSimple, "Shape", "");
var feature = featureClass.CreateFeature();
feature.Shape = polyline;
feature.Store();
ArcMap.Application.CurrentTool = null;
}
开发者ID:ApexGIS,项目名称:developer-support,代码行数:50,代码来源:CreateLine.cs
示例8: drawLineWithText
private void drawLineWithText(IPoint startPt, IPoint endPt, string text, bool horizontal)
{
IPolyline line = new PolylineClass();
IPointCollection ptCol = line as IPointCollection;
ptCol.AddPoint(startPt);
ptCol.AddPoint(endPt);
IPoint midPt = new PointClass();
midPt.X = (startPt.X + endPt.X) / 2;
midPt.Y = (startPt.Y + endPt.Y) / 2;
if (horizontal)
{
midPt.Y = midPt.Y + textAdjustGap;
}
GisUtil.DrawPolyline(line, mapControl);
GisUtil.drawText(text, midPt, textColor, mapControl);
}
开发者ID:Leooonard,项目名称:CGXM,代码行数:16,代码来源:HouseShowcaseManager.cs
示例9: AddDxdLines
/// <summary>
/// 添加导线点线图层元素
/// </summary>
/// <params name="pnts"></params>
/// <params name="layer"></params>
public void AddDxdLines(List<IPoint> pnts, Dictionary<string, string> dics, IFeatureLayer layer, List<WirePoint> cols = null)
{
try
{
IFeatureClass Featureclass = layer.FeatureClass;
IWorkspaceEdit workspace = (IWorkspaceEdit)(Featureclass as IDataset).Workspace;
workspace.StartEditing(false);
workspace.StartEditOperation();
for (int i = 0; i < pnts.Count; i++)
{
IFeature fealin = Featureclass.CreateFeature();
IPolyline plin = new PolylineClass();
ISegmentCollection segcols = plin as ISegmentCollection;
ICurve circle = Global.commonclss.CreateCircleArc(pnts[i], Global.radius, true);
segcols.AddSegment(circle as ISegment);
fealin.Shape = plin;
if (cols != null)
{
string name = cols[i].name;
int NamePos = fealin.Fields.FindField(GIS_Const.FIELD_NAME);
fealin.set_Value(NamePos, name);
}
foreach (string key in dics.Keys)
{
int findex = fealin.Fields.FindField(key);
if (findex != -1)
{
fealin.set_Value(findex, dics[key]);
}
}
fealin.Store();
}
workspace.StopEditOperation();
workspace.StopEditing(true);
}
catch
{
throw;
}
}
开发者ID:ismethr,项目名称:gas-geological-map,代码行数:46,代码来源:ConstructParallel.cs
示例10: FlatBuffer
private IPolygon FlatBuffer(IPolyline pLline1, double pBufferDis)
{
object o = System.Type.Missing;
//分别对输入的线平移两次(正方向和负方向)
IConstructCurve pCurve1 = new PolylineClass();
pCurve1.ConstructOffset(pLline1, pBufferDis, ref o, ref o);
IPointCollection pCol = pCurve1 as IPointCollection;
IConstructCurve pCurve2 = new PolylineClass();
pCurve2.ConstructOffset(pLline1, -1 * pBufferDis, ref o, ref o);
//把第二次平移的线的所有节点翻转
IPolyline pline2 = pCurve2 as IPolyline;
pline2.ReverseOrientation();
//把第二条的所有节点放到第一条线的IPointCollection里面
IPointCollection pCol2 = pline2 as IPointCollection;
pCol.AddPointCollection(pCol2);
//用面去初始化一个IPointCollection
IPointCollection pPointCol = new PolygonClass();
pPointCol.AddPointCollection(pCol);
//把IPointCollection转换为面
IPolygon pPolygon = pPointCol as IPolygon;
//简化节点次序
pPolygon.SimplifyPreserveFromTo();
return pPolygon;
}
开发者ID:esrichina,项目名称:Engine10DevApplication,代码行数:24,代码来源:GeometryTest.cs
示例11: RotateInnerPoint
private IPoint RotateInnerPoint(IPoint oldPt)
{
IPolyline line = new PolylineClass();
IPoint centerPt = getCenterPt();
IPoint newPt = new PointClass();
IPointCollection ptCol = line as IPointCollection;
ptCol.AddPoint(centerPt);
ptCol.AddPoint(oldPt);
line = RotateGeom(line, rotateAngle, true) as IPolyline;
newPt = (line as IPointCollection).get_Point(1);
return newPt;
}
开发者ID:Leooonard,项目名称:CGXM,代码行数:14,代码来源:HouseManager.cs
示例12: rotateCornerPoint
private IPoint rotateCornerPoint(IPoint basePt, IPoint targetPt, double angle)
{
IPolyline line = new PolylineClass();
IPointCollection ptCol = line as IPointCollection;
ptCol.AddPoint(basePt);
ptCol.AddPoint(targetPt);
line = RotateGeom(line, angle, true) as IPolyline;
IPoint afterMovePt = (line as IPointCollection).get_Point(1);
targetPt = MovePoint(targetPt, afterMovePt.X - targetPt.X, afterMovePt.Y - targetPt.Y);
return targetPt;
}
开发者ID:Leooonard,项目名称:CGXM,代码行数:14,代码来源:HouseManager.cs
示例13: biImportToGraphic_ItemClick
/// <summary>
/// 从导入的坐标串中生成草图
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
void biImportToGraphic_ItemClick(object sender, ItemClickEventArgs e)
{
string filePath = "";
object pbefore = Type.Missing;
object pafter = Type.Missing;
OpenFileDialog openDlg = new OpenFileDialog();
openDlg.Filter = "Text files(*.txt)|*.txt";
IPointCollection ipPoitCol = null;
IGeometry iGeo = null;
try
{
if (_subType == 1)
{
ipPoitCol = new PolylineClass();
}
else if(_subType == 2)
{
ipPoitCol = new PolygonClass();
}
if (openDlg.ShowDialog() == DialogResult.OK)
{
filePath = openDlg.FileName;
StreamReader strRead = new StreamReader(filePath);
string strLine;
int RowCou = 0;
string strX = string.Empty;
string strY = string.Empty;
string[] strCoor = new string[2];
while ((strLine = strRead.ReadLine()) != null)
{
if (strLine != "")
{
RowCou++;
strCoor = strLine.Split(',');
double x = double.Parse(strCoor[0]);
double y = double.Parse(strCoor[1]);
if (RowCou == 1)
{
strX = strCoor[0];
strY = strCoor[1];
}
IPoint ipNewPoint = new PointClass();
ipNewPoint.PutCoords(x, y);
ipPoitCol.AddPoint(ipNewPoint, ref pbefore, ref pafter);
}
}
//如果第一个点和最后一个点不等,则再加一遍一个点的坐标
if (strX != strCoor[0] && strY != strCoor[1])
{
IPoint ipPoint = new PointClass();
ipPoint.PutCoords(double.Parse(strCoor[0]), double.Parse(strCoor[1]));
ipPoitCol.AddPoint(ipPoint, ref pbefore, ref pafter);
}
strRead.Close();
}
iGeo = ipPoitCol as IGeometry;
if (iGeo != null)
{
if (_subType == 1)
(_geometryFeedback as INewLineFeedback).Stop();
else if(_subType ==2)
(_geometryFeedback as INewPolygonFeedback).Stop();
TheReferenceInstances.TheAEditer.SketchEdit.DrawGeometry = iGeo;
_startPoint = null;
RefreshFeedBack();
}
else
{
XtraMessageBox.Show("导入的点坐标不能构成面!", "提示");
return;
}
}
catch (Exception ex)
{
throw ex;
}
}
开发者ID:trainsn,项目名称:LBS,代码行数:88,代码来源:1.cs
示例14: isIntersect
public bool isIntersect(IPolyline line)
{
//需要做四次相交, 分别是和四个边线.
//左边边线.
IPolyline boundLine = new PolylineClass();
IPointCollection ptCol = boundLine as IPointCollection;
ptCol.AddPoint(upperLeftPt);
ptCol.AddPoint(lowerLeftPt);
ITopologicalOperator tpOp = boundLine as ITopologicalOperator;
IGeometry geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
if (!geom.IsEmpty)
{
return true;
}
//右边边线.
boundLine = new PolylineClass();
ptCol = boundLine as IPointCollection;
ptCol.AddPoint(upperRightPt);
ptCol.AddPoint(lowerRightPt);
tpOp = boundLine as ITopologicalOperator;
geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
if (!geom.IsEmpty)
{
return true;
}
//上边边线.
boundLine = new PolylineClass();
ptCol = boundLine as IPointCollection;
ptCol.AddPoint(upperLeftPt);
ptCol.AddPoint(upperRightPt);
tpOp = boundLine as ITopologicalOperator;
geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
if (!geom.IsEmpty)
{
return true;
}
//下边边线.
boundLine = new PolylineClass();
ptCol = boundLine as IPointCollection;
ptCol.AddPoint(lowerLeftPt);
ptCol.AddPoint(lowerRightPt);
tpOp = boundLine as ITopologicalOperator;
geom = tpOp.Intersect(line, esriGeometryDimension.esriGeometry0Dimension);
if (!geom.IsEmpty)
{
return true;
}
return false;
}
开发者ID:Leooonard,项目名称:CGXM,代码行数:53,代码来源:HouseManager.cs
示例15: ConnectClosestFeature
//.........这里部分代码省略.........
pEditTemp = Globals.PromptAndGetEditTemplateGraphic(connectLineFLayer, "");
}
sel = pointFeatureSelection.SelectionSet as ISelectionSet2;
//sel.Update(null, false, out pointCursor);
sel.Search(null, false, out pointCursor);
while ((pointFeature = (IFeature)pointCursor.NextRow()) != null)
{
i += 1;
if (suppressDialog == false)
{
//Update progress bar
progressDialog.Description = A4LGSharedFunctions.Localizer.GetString("ConnectAsset") + i.ToString() + A4LGSharedFunctions.Localizer.GetString("Of") + total.ToString() + "." + Environment.NewLine +
A4LGSharedFunctions.Localizer.GetString("CurrentOID") + pointFeature.OID;
stepProgressor.Step();
}
ESRI.ArcGIS.esriSystem.IStatusBar statusBar = app.StatusBar;
statusBar.set_Message(0, i.ToString());
//Check if the cancel button was pressed. If so, stop process
bool boolean_Continue = trackCancel.Continue();
if (!boolean_Continue)
{
break;
}
//IFeature pNearestFeature =
pNearestFeature = Globals.GetClosestFeatureIgnoreExistingLineFeature((connectClosestLayers[k] as ConnectClosestDetails).Search_Threshold,
pointFeature.ShapeCopy, pointFLayer, connectLineFLayer, bSelectedOnly);
if (pNearestFeature == null)
break;
pNewPoly = new PolylineClass();
pNewPoly.FromPoint = pNearestFeature as IPoint;
pNewPoly.ToPoint = pointFeature.ShapeCopy as IPoint;
if (pEditTemp == null)
{
pLine = Globals.CreateFeature(pNewPoly, connectLineFLayer, editor, app, false, false, true);
}
else
{
pLine = Globals.CreateFeature(pNewPoly, pEditTemp, editor, app, false, false, true);
}
pLine.Store();
pRetFeature.Add(pLine);
}
if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow != null)
{
if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "DIGITIZED")
{
retVal.Options = "DIGITIZED";
}
else if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "ROLE")
{
retVal.Options = "ROLE";
}
else if ((connectClosestLayers[k] as ConnectClosestDetails).Reset_Flow.ToUpper() == "Ancillary".ToUpper())
{
retVal.Options = "ANCILLARY";
}
开发者ID:tuyndv,项目名称:local-government-desktop-addins,代码行数:67,代码来源:ConstructionTools.cs
示例16: LoadTempImportFC
//.........这里部分代码省略.........
}
TotalPassed++;
//add feature to temp feature class
ImportToBuffer.Shape = ImportFeature.ShapeCopy;
ImportToBuffer.set_Value(ImportToBuffer.Fields.FindField("SurveyID"), SurveyID);
ImportToBuffer.set_Value(ImportToBuffer.Fields.FindField("BATCH_ID"), BatchID);
if (FType == esriGeometryType.esriGeometryPolyline)
{
ThisFieldIndex = ImportToBuffer.Fields.FindField("Flown");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ImportToBuffer.Fields.FindField("Flown"), "N");
ThisFieldIndex = ImportToBuffer.Fields.FindField("TransectID");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ImportToBuffer.Fields.FindField("TransectID"), NextTransectID);
NextTransectID++;
NewTrnPolyline = ImportToBuffer.Shape as IPolyline;
ThisFieldIndex = ImportToBuffer.Fields.FindField("LENGTH_MTR");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, NewTrnPolyline.Length);
//add the name of the default projection
ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJECTION");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, NewTrnPolyline.SpatialReference.Name);
ThisFieldIndex = ImportToBuffer.Fields.FindField("TARGETLEN");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TargetLength);
//clone from point
TempPoint = ((ESRI.ArcGIS.esriSystem.IClone)NewTrnPolyline.FromPoint).Clone() as IPoint;
//add from point projected coords
ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJTD_X1");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.X);
ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJTD_Y1");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.Y);
//add from point geo coords
((IGeometry2)TempPoint).ProjectEx(Util.GetWGSSpatRef(), esriTransformDirection.esriTransformForward, null, false, 0, 0);
ThisFieldIndex = ImportToBuffer.Fields.FindField("DD_LONG1");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.X);
ThisFieldIndex = ImportToBuffer.Fields.FindField("DD_LAT1");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.Y);
//clone to point
TempPoint = ((ESRI.ArcGIS.esriSystem.IClone)NewTrnPolyline.ToPoint).Clone() as IPoint;
//add to point projected coords
ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJTD_X2");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.X);
ThisFieldIndex = ImportToBuffer.Fields.FindField("PROJTD_Y2");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.Y);
//add to point geo coords
((IGeometry2)TempPoint).ProjectEx(Util.GetWGSSpatRef(), esriTransformDirection.esriTransformForward, null, false, 0, 0);
ThisFieldIndex = ImportToBuffer.Fields.FindField("DD_LONG2");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.X);
ThisFieldIndex = ImportToBuffer.Fields.FindField("DD_LAT2");
if (ThisFieldIndex > -1) ImportToBuffer.set_Value(ThisFieldIndex, TempPoint.Y);
//get center point
centerPoint = new PointClass();
((ICurve)NewTrnPolyline).QueryPoint(esriSegmentExtension.esriNoExtension, 0.5, true, centerPoint);
//get elevation for transect center
CPolyline = new PolylineClass();
npsSurfaceOp.ContourAsPolyline(ThisDEM, centerPoint, out CPolyline, out Elev);
//set elevation in meters
ThisFieldIndex = ImportToBuffer.Fields.FindField("ELEV_M");
if (ThisFieldIndex > -1)
{
if (ThisDEMUnits == "feet") ImportToBuffer.set_Value(ThisFieldIndex, 0.3048 * Elev);
if (ThisDEMUnits == "meters") ImportToBuffer.set_Value(ThisFieldIndex, Elev);
}
//get elevation in feet
ThisFieldIndex = ImportToBuffer.Fields.FindField("ELEVFT");
if (ThisFieldIndex > -1)
{
if (ThisDEMUnits == "feet") ImportToBuffer.set_Value(ThisFieldIndex, Elev);
if (ThisDEMUnits == "meters") ImportToBuffer.set_Value(ThisFieldIndex, Elev * 3.2808399);
}
}
NewOIDs.Add((int)Util.SafeConvert(ImportToCursor.InsertFeature(ImportToBuffer), typeof(int)));
}
ImportFCursor = null;
ImportToCursor = null;
ImportToBuffer = null;
}
开发者ID:regan-sarwas,项目名称:NPSTransectTool,代码行数:101,代码来源:ImportTransRndPntsForm.cs
示例17: MakeHatchs
public static void MakeHatchs(IPolyline pPL, bool Ends, IPolyline pMajor, IPolyline pMinor)
{
ITopologicalOperator pTopo = pPL as ITopologicalOperator;
pTopo.Simplify();
ISegmentCollection pSCMajor = pMajor as ISegmentCollection;
ISegmentCollection pSCMinor = pMinor as ISegmentCollection;
IGeometryCollection pGC = pPL as IGeometryCollection;
IPath pPath;
IGeometryCollection pSubPL;
IMSegmentation pPLM;
object missing = Type.Missing;
IMAware pMAware;
double Mmin;
double Mmax;
int cnt = pGC.GeometryCount - 1;
for (int i = 0; i <= cnt - 1; i++)
{
pPath = pGC.get_Geometry(i) as IPath;
pSubPL = new PolylineClass();
pSubPL.AddGeometry(pPath as IGeometry, ref missing, ref missing);
pMAware = pSubPL as IMAware;
pMAware.MAware = true;
pPLM = pSubPL as IMSegmentation;
Mmin = pPLM.MMin;
Mmax = pPLM.MMax;
}
}
开发者ID:lovelll,项目名称:MyDatapreMenu,代码行数:29,代码来源:UtilityFunction.cs
示例18: OnSketchFinished
private void OnSketchFinished()
{
ConfigUtil.type = "gas";
IFeature pFeat = null;
ISegmentCollection pSegColl = null;
IEnumSegment pESeg = null;
ISegment testSegment = null;
ISegmentCollection segColTest = null;
object Missing = null;
try
{
// Send a shift-tab to hide the construction toolbar
try
{
m_editor.StartOperation();
}
catch
{
m_editor.AbortOperation();
m_editor.StartOperation();
}
bool twoPoint = false;
(ArcMap.Application.Document as IMxDocument).FocusMap.ClearSelection();
List<IFeature> pLstFeat = null;
if (Control.ModifierKeys == Keys.Control)
{
twoPoint = CreateLineWithEndPoints.CreatePoints(ArcMap.Application, ConfigUtil.GetLinePointAtEndsConfig(), m_edSketch.Geometry as IPolyline, (IFeatureLayer)m_editor.CurrentTemplate.Layer, false, out pLstFeat);
}
else
{
twoPoint = CreateLineWithEndPoints.CreatePoints(ArcMap.Application, ConfigUtil.GetLinePointAtEndsConfig(), m_edSketch.Geometry as IPolyline, (IFeatureLayer)m_editor.CurrentTemplate.Layer, true, out pLstFeat);
}
if (twoPoint)
{
pSegColl = (ISegmentCollection)m_edSketch.Geometry;
pESeg = pSegColl.EnumSegments;
pESeg.Reset();
int partIndex = 0;
int segmentIndex = 0;
pESeg.Next(out testSegment, ref partIndex, ref segmentIndex);
while (testSegment != null)
{
segColTest = new PolylineClass();
Missing = Type.Missing;
segColTest.AddSegment(testSegment, ref Missing, ref Missing);
pFeat = Globals.CreateFeature(segColTest as IGeometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
pFeat.Store();
pESeg.Next(out testSegment, ref partIndex, ref segmentIndex);
}
}
else
{
pFeat = Globals.CreateFeature(m_edSketch.Geometry, m_editor.CurrentTemplate, m_editor, ArcMap.Application, false, false, true);
pFeat.Store();
}
foreach (IFeature pFt in pLstFeat)
{
pFt.Store();
}
pLstFeat = null;
m_editor.StopOperation("Create line with points");
}
catch { }
finally
{
pFeat = null;
pSegColl = null;
pESeg = null;
testSegment = null;
segColTest = null;
Missing = null;
}
}
开发者ID:pLeBlanc93,项目名称:local-government-desktop-addins,代码行数:87,代码来源:ConstructionTools.cs
示例19: HatchDraw
//���ƣȣ��ԣã�
public static void HatchDraw(AxMapControl ppAxMapControl, ISimpleLineSymbol pHatchSymMajor, ISimpleLineSymbol pHatchSymMinor, ITextSymbol pTxtSym, IFeatureLayer pFeatLayer, bool bEnds, bool bEndsOnly, double dHatchLen, double dTxtInterval, double dHatchOffset, double dMajorAngle, bool bOverRideMajor, string graphicslayername)
{
//����ͼ��ͼ��ΪSEWER TV���ͼ��
IFeatureCursor pFeatCursor = pFeatLayer.Search(null, true);
SetGraphicsLayer(ppAxMapControl, pFeatLayer.Name, graphicslayername);
//����SEWER TV���ͼ��ͼ��
IGraphicsContainer pGraphicsContainer = ppAxMapControl.ActiveView.FocusMap.ActiveGraphicsLayer as IGraphicsContainer;
//���ͼ��ͼ��
pGraphicsContainer.DeleteAllElements();
IFeature pFeature = pFeatCursor.NextFeature();
IPolyline pMajorHatchPL = new PolylineClass();
IPolyline pMinorHatchPL = new PolylineClass();
IPolyline pPL;
IMAware pPLM;
//IMCollection pMColl;
IGeometryCollection pGeomColl;
ILineElement pLineElement;
IElement pElement = null;
int cnt;
IPath pPath;
string txt;
double txtlen;
IPath pTxtPath;
double angle;
//IPoint pTxtPt;
ISegmentCollection pSC;
ISegment pSeg;
ISegmentM pSegM;
double m1 = 0;
//double m2 = 0;
//IPoint pFromPt;
//IMarkerSymbol pMSym;
IMask pMask;
ITextElement pTextElement;
ISegmentCollection pSegment;
ISegmentCollection pPolyline;
while (pFeature != null)
{
pPL = pFeature.Shape as IPolyline;
pPLM = pPL as IMAware;
if (pPLM.M
|
请发表评论