本文整理汇总了C#中PolylineClass.AddGeometry方法的典型用法代码示例。如果您正苦于以下问题:C# PolylineClass.AddGeometry方法的具体用法?C# PolylineClass.AddGeometry怎么用?C# PolylineClass.AddGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PolylineClass
的用法示例。
在下文中一共展示了PolylineClass.AddGeometry方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
//}
}
示例2: 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;
}
}
示例3: MakeHatchesEndsOnly
public static void MakeHatchesEndsOnly(IPolyline pPL, bool Ends, IPolyline pMajor, IPolyline pMinor, double dHatchLen, double dTxtInterval, double dHatchOffset)
{
//���������
ITopologicalOperator pTopo = pPL as ITopologicalOperator;
pTopo.Simplify();
//���ǽ��ڶμ����д洢HATCH
ISegmentCollection pSCMajor = pMajor as ISegmentCollection;
ISegmentCollection pSCMinor = pMinor as ISegmentCollection;
//Break the polyline into parts here ... Ideally, there should be one part
//per route. In cases where there is mSEETARD than one part, and there is no physical
// separation in the parts, the results can look like they are wrong (i.e. there
//appears to be text where there should not be).
IGeometryCollection pGC = pPL as IGeometryCollection;
int cnt = pGC.GeometryCount - 1;
object missing = Type.Missing;
object distances;
double dist;
for (int i = 0; i <= pGC.GeometryCount - 1; i++)
{
IPath pPath = pGC.get_Geometry(i) as IPath;
IGeometryCollection pSubPL = new PolylineClass();
pSubPL.AddGeometry(pPath, ref missing, ref missing);
IMAware pMAware = pSubPL as IMAware;
pMAware.MAware = true;
IMSegmentation pPLM = pSubPL as IMSegmentation;
double Mmin = pPLM.MMin;
double Mmax = pPLM.MMax;
ISegment pSeg = MakeOneHatch(pSubPL as IPolyline, Mmin, Mmin, 1, dTxtInterval, dHatchLen, dHatchOffset);
if (pSeg.Length >= ((Math.Abs(dHatchLen) * 0.5) + 0.001))
pSCMajor.AddSegment(pSeg, ref missing, ref missing);
else
pSCMinor.AddSegment(pSeg, ref missing, ref missing);
distances = pPLM.GetDistancesAtM(false, Mmax);
IArray pArray = (IArray)distances;
for (int j = 0; j <= pArray.Count - 1; j++)
{
dist = (double)pArray.get_Element(j);
pSeg = MakeOneHatch(pSubPL as IPolyline, dist, Mmax, 1, dTxtInterval, dHatchLen, dHatchOffset);
if (pSeg.Length >= (Math.Abs(dHatchLen) * 0.5) + 0.001)
{
pSCMajor.AddSegment(pSeg, ref missing, ref missing);
}
else
{
pSCMinor.AddSegment(pSeg, ref missing, ref missing);
}
}
}
pMajor.SimplifyNetwork();
pMinor.SimplifyNetwork();
}
示例4: DrawCircleByCenterAndRadius
private void DrawCircleByCenterAndRadius(ILayer pLayer, IBezierCurveGEN pCircularArc, IScreenDisplay pScreenDisplay)
{
object o = Type.Missing;
if (pLayer != null)
{
ISegmentCollection pSegmentCollection = null;
pSegmentCollection = new PathClass();
if (pLayer is IFeatureLayer)
{
IFeatureLayer pFeatureLayer = pLayer as IFeatureLayer;
IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
if (pFeatureClass != null)
{
ISegment pSegment = pCircularArc as ISegment;
pSegmentCollection.AddSegment(pSegment, ref o, ref o);
IGeometryCollection pPolyline = new PolylineClass();
//ͨ��IGeometryCollectionΪPolyline�������Path����
pPolyline.AddGeometry(pSegmentCollection as IGeometry, ref o, ref o);
m_pMap.ClearSelection();
IFeature pCircleFeature = pFeatureClass.CreateFeature();
pCircleFeature.Shape = pPolyline as PolylineClass;
pCircleFeature.Store();
m_pMap.SelectFeature(m_pCurrentLayer, pCircleFeature);
IActiveView pActiveView = (IActiveView)m_pMap;
m_hookHelper.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
//�ֲ�ˢ��
IInvalidArea pInvalidArea = new InvalidAreaClass();
pInvalidArea.Add(pPolyline);
pInvalidArea.Display = m_hookHelper.ActiveView.ScreenDisplay;
pInvalidArea.Invalidate((short)esriScreenCache.esriAllScreenCaches);
}
}
}
}
示例5: CreateLine
///方法1:根据点要素直接生产线要素,《参考绘制巷道》
/// <summary>
/// 根据点集坐标绘制线要素
/// </summary>
/// <params name="featureLayer"></params>
/// <params name="lstPoint"></params>
public static void CreateLine(IFeatureLayer featureLayer, List<IPoint> lstPoint, string 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(false);
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("BID");
feature.Value[iFieldID] = ID.ToString();
feature.Store();
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(true);
IEnvelope envelop = feature.Shape.Envelope;
DataEditCommon.g_pMyMapCtrl.ActiveView.Extent = envelop;
GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.Extent.Expand(1.5, 1.5, true);
GIS.Common.DataEditCommon.g_pMyMapCtrl.Map.SelectFeature(featureLayer, feature);
GIS.Common.DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewAll, null, null);
//DataEditCommon.g_pMyMapCtrl.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, null, null);
}
else
{
MessageBox.Show(@"请选择线图层。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch
{
return;
}
}
示例6: createpolyline
private void createpolyline(IPointCollection ippoints)
{
ISegmentCollection ppath = new PathClass();
IGeometryCollection ppolyline = new PolylineClass();
if (ippoints.PointCount >= 2)
{
int i;
for (i = 0; i < ippoints.PointCount - 1; i++)
{
ILine pline = new LineClass();
pline.PutCoords(ippoints.get_Point(i), ippoints.get_Point(i + 1));
ISegment psegment = pline as ISegment;
object o = Type.Missing;
ppath.AddSegment(psegment, ref o, ref o);
ppolyline.AddGeometry(ppath as IGeometry, ref o, ref o);
}
ipPolyResult = ppolyline as IPolyline;
}
}
示例7: createpolygon
private void createpolygon(IPointCollection ippoints)
{
ISegmentCollection ppath = new PathClass();
IGeometryCollection ppolyline = new PolylineClass();
if (ippoints.PointCount >= 3)
{
int i;
object o = Type.Missing;
if (ippoints.PointCount >= 4)
{
ippoints.RemovePoints(ippoints.PointCount - 2, 1);
}
ippoints.AddPoint(ippoints.get_Point(0));
for (i = 0; i < ippoints.PointCount - 1; i++)
{
ILine pline = new LineClass();
pline.PutCoords(ippoints.get_Point(i), ippoints.get_Point(i + 1));
ISegment psegment = pline as ISegment;
ppath.AddSegment(psegment, ref o, ref o);
ppolyline.AddGeometry(ppath as IGeometry, ref o, ref o);
}
ipPolyResult = ppolyline as IPolyline;
ISegmentCollection pRing = new RingClass();
IGeometryCollection pGeometryColl = new PolygonClass();
for (int j = 0; j < ppolyline.GeometryCount; j++)
{
pRing.AddSegmentCollection(ppolyline.get_Geometry(j) as ISegmentCollection);
pGeometryColl.AddGeometry(pRing as IGeometry, ref o, ref o);
}
ipolygon = pGeometryColl as IPolygon;
}
}
示例8: CreateDongShi
private void CreateDongShi(IPoint P0, IPoint P1, IPoint P2, IPoint P3, string hdid, string bid)
{
ISegmentCollection pPath = new PathClass();
//��һ���߶�
ILine pLine = new LineClass();
pLine.PutCoords(P0, P1);
//QI��ISegment
ISegment pSegment = pLine as ISegment;
//����һ��Path����
System.Object o = Type.Missing;
//ͨ��ISegmentCollection�ӿ�ΪPath�������Segment����
pPath.AddSegment(pSegment, ref o, ref o);
//�ڶ����߶�
ILine pLine2 = new LineClass();
pLine2.PutCoords(P1, P2);
ISegment pSegment2 = pLine2 as ISegment;
//����һ��Path����
//ͨ��ISegmentCollection�ӿ�ΪPath�������Segment����
pPath.AddSegment(pSegment2, ref o, ref o);
//�������߶�
ILine pLine3 = new LineClass();
pLine3.PutCoords(P2, P3);
ISegment pSegment3 = pLine3 as ISegment;
//����һ��Path����
//ͨ��ISegmentCollection�ӿ�ΪPath�������Segment����
pPath.AddSegment(pSegment3, ref o, ref o);
IGeometryCollection pPolyline = new PolylineClass();
//ͨ��IGeometryCollectionΪPolyline�������Path����
pPolyline.AddGeometry(pPath as IGeometry, ref o, ref o);
if (m_pDongshiFeatureLayer != null)
{
System.Collections.Generic.List<ziduan> list = new System.Collections.Generic.List<ziduan>();
list.Add(new ziduan(GIS_Const.FIELD_HDID, hdid));
list.Add(new ziduan(GIS_Const.FIELD_BID, bid));
DataEditCommon.CreateNewFeature(m_pDongshiFeatureLayer, pPolyline as IGeometry,list);
m_hookHelper.ActiveView.Refresh();
}
}
示例9: HasTangentCurveMatchFeatures
public bool HasTangentCurveMatchFeatures(IFeatureClass FeatureClass, IPolycurve inPolycurve, string WhereClause,
double AngleToleranceTangentCompareInDegrees, double StraightLinesBreakLessThanInDegrees, double MaximumDeltaInDegrees, double ExcludeTangentsShorterThan,
out int outFoundTangentCurvesCount, ref List<string> CurveInfoFromNeighbours)
{
outFoundTangentCurvesCount = 0;
ILine pOriginalChord = new Line();
pOriginalChord.PutCoords(inPolycurve.FromPoint, inPolycurve.ToPoint);
IVector3D vecOriginalSelected = new Vector3DClass();
vecOriginalSelected.PolarSet(pOriginalChord.Angle, 0, 1);
int idxRadius = FeatureClass.FindField("RADIUS");
if (idxRadius == -1)
return false;
int idxCenterPointID = FeatureClass.FindField("CENTERPOINTID");
if (idxCenterPointID == -1)
return false;
object val = null;
IGeometryBag pGeomBag = new GeometryBagClass();
IGeometryCollection pGeomColl = (IGeometryCollection)pGeomBag;
IGeometry MultiPartPolyLine = new PolylineClass(); //qi
IGeoDataset pGeoDS = (IGeoDataset)FeatureClass;
ISpatialReference spatialRef = pGeoDS.SpatialReference;
MultiPartPolyLine.SpatialReference = spatialRef;
IGeometryCollection geometryCollection2 = MultiPartPolyLine as IGeometryCollection;
ILine pTangentLineAtEnd = new Line(); //new
ILine pTangentLineAtStart = new Line(); //new
object objMissing = Type.Missing;
for (int i = 0; i < 2; i++)
{
ILine pThisLine = null;
if (i == 0)
{
inPolycurve.QueryTangent(esriSegmentExtension.esriExtendAtTo, 1.0, true, 0.2, pTangentLineAtEnd);
pThisLine = new Line();
pThisLine.PutCoords(pTangentLineAtEnd.FromPoint, pTangentLineAtEnd.ToPoint);
pGeomColl.AddGeometry(pThisLine);
}
else
{
inPolycurve.QueryTangent(esriSegmentExtension.esriExtendAtFrom, 0.0, true, 0.2, pTangentLineAtStart);
pThisLine = new Line();
pThisLine.PutCoords(pTangentLineAtStart.FromPoint, pTangentLineAtStart.ToPoint);
pGeomColl.AddGeometry(pThisLine);
}
//Create a new path for each line.
ISegmentCollection newPath = new PathClass();
newPath.AddSegment((ISegment)pThisLine, ref objMissing, ref objMissing);
//The spatial reference associated with geometryCollection will be assigned to all incoming paths and segments.
geometryCollection2.AddGeometry(newPath as IGeometry, ref objMissing, ref objMissing);
}
//now buffer the lines
IGeometryCollection outBufferedGeometryCol = new GeometryBagClass();
for (int jj = 0; jj < geometryCollection2.GeometryCount; jj++)
{
IPath pPath = geometryCollection2.get_Geometry(jj) as IPath;
IGeometryCollection pPolyL = new PolylineClass();
pPolyL.AddGeometry((IGeometry)pPath);
ITopologicalOperator topologicalOperator = (ITopologicalOperator)pPolyL;
IPolygon pBuffer = topologicalOperator.Buffer(0.1) as IPolygon;
outBufferedGeometryCol.AddGeometry(pBuffer, ref objMissing, ref objMissing);
}
ITopologicalOperator pUnionedBuffers = null;
pUnionedBuffers = new PolygonClass() as ITopologicalOperator;
pUnionedBuffers.ConstructUnion((IEnumGeometry)outBufferedGeometryCol);
ISpatialFilter pSpatFilt = new SpatialFilter();
pSpatFilt.WhereClause = WhereClause;
pSpatFilt.SpatialRel = esriSpatialRelEnum.esriSpatialRelIntersects;
pSpatFilt.SearchOrder = esriSearchOrder.esriSearchOrderSpatial;
pSpatFilt.Geometry = (IGeometry)pUnionedBuffers;
IFeatureCursor pFeatCursLines = null;
try
{
pFeatCursLines = FeatureClass.Search(pSpatFilt, false);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return false;
}
IVector3D vecFoundGeom = new Vector3DClass();
IFeature pFeat = pFeatCursLines.NextFeature();
bool bHasTangentStraightLineAtJunction = false;
List<int> lstLargeBreak = new List<int>();
while (pFeat != null)
{
//.........这里部分代码省略.........
示例10: FlashGeometry
public void FlashGeometry(IGeometry Geom, IScreenDisplay Display, IColor Color, int Size, int Interval)
{
if (Geom == null)
return;
short Cache = Display.ActiveCache;
Display.ActiveCache = (short)esriScreenCache.esriNoScreenCache;
Display.StartDrawing(0, Cache);
if (Geom.GeometryType == esriGeometryType.esriGeometryLine || Geom.GeometryType == esriGeometryType.esriGeometryCircularArc)
{
ILineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
ISymbol pSymbol = (ISymbol)pSimpleLineSymbol;
pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //erase itself when drawn twice
pSimpleLineSymbol.Width = Size;
pSimpleLineSymbol.Color = Color;
Display.SetSymbol((ISymbol)pSimpleLineSymbol);
ISegmentCollection pPath = new PathClass();
pPath.AddSegment((ISegment)Geom);
IGeometryCollection pPolyL = new PolylineClass();
pPolyL.AddGeometry((IGeometry)pPath);
Display.DrawPolyline((IGeometry)pPolyL);
System.Threading.Thread.Sleep(Interval);
Display.DrawPolyline((IGeometry)pPolyL);
}
else if (Geom.GeometryType == esriGeometryType.esriGeometryPolyline)
{
ILineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
ISymbol pSymbol = (ISymbol)pSimpleLineSymbol; //'QI
pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //erase itself when drawn twice
pSimpleLineSymbol.Width = Size;
pSimpleLineSymbol.Color = Color;
Display.SetSymbol((ISymbol)pSimpleLineSymbol);
Display.DrawPolyline(Geom);
System.Threading.Thread.Sleep(Interval);
Display.DrawPolyline(Geom);
}
else if (Geom.GeometryType == esriGeometryType.esriGeometryPolygon)
{
ISimpleFillSymbol pSimpleFillSymbol = new SimpleFillSymbolClass();
ISymbol pSymbol = (ISymbol)pSimpleFillSymbol;
pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen; //erase itself when drawn twice
pSimpleFillSymbol.Color = Color;
Display.SetSymbol((ISymbol)pSimpleFillSymbol);
Display.DrawPolygon(Geom);
System.Threading.Thread.Sleep(Interval);
Display.DrawPolygon(Geom);
}
else if (Geom.GeometryType == esriGeometryType.esriGeometryPoint)
{
ISimpleMarkerSymbol pSimpleMarkersymbol = new SimpleMarkerSymbolClass();
ISymbol pSymbol = (ISymbol)pSimpleMarkersymbol;
pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;
pSimpleMarkersymbol.Color = Color;
pSimpleMarkersymbol.Size = Size;
Display.SetSymbol((ISymbol)pSimpleMarkersymbol);
Display.DrawPoint(Geom);
System.Threading.Thread.Sleep(Interval);
Display.DrawPoint(Geom);
}
Display.FinishDrawing();
//reset the cache
Display.ActiveCache = Cache;
}
示例11: drawXZZ
//.........这里部分代码省略.........
pTrans2D = txtPoints[i] as ITransform2D;
//旋转要素
pTrans2D.Rotate(pt, Angle);
ITextSymbol pTextSymbol = new TextSymbolClass();
pTextSymbol.Angle = angle;
var elementTxt = new TextElementClass
{
Geometry = pTrans2D as IGeometry,
FontName = "微软雅黑",
Size = 12 * bili,
SymbolID = 0,
Symbol=pTextSymbol
};
if (i == txtPoints.Count - 1)
{
elementTxt.Text = num1.ToString(); // 最后一条横线的数值
elementTxt.VerticalAlignment = esriTextVerticalAlignment.esriTVATop; // 显示在线下边
featureAnno.set_Value(featureAnno.Fields.FindField("strType"), 2);
}
else
{
elementTxt.Text = datasources[i].Value.ToString();
elementTxt.VerticalAlignment = esriTextVerticalAlignment.esriTVABottom;
featureAnno.set_Value(featureAnno.Fields.FindField("strType"), datasources[i].Key);
}
AnnoFeature.Annotation = elementTxt;
featureAnno.set_Value(featureAnno.Fields.FindField("strAngle"), -angle);
featureAnno.set_Value(featureAnno.Fields.FindField("strX"), pt.X);
featureAnno.set_Value(featureAnno.Fields.FindField("strY"), pt.Y);
featureAnno.set_Value(featureAnno.Fields.FindField("strScale"), bili);
featureAnno.set_Value(featureAnno.Fields.FindField("strIndex"), i+1);
featureAnno.set_Value(featureAnno.Fields.FindField("BID"), bid);
pTrans2D = featureAnno.Shape as ITransform2D;
pTrans2D.Rotate(pt, -Angle);
enveloplist.Add(((IGeometry)pTrans2D).Envelope);
AnnoCursor.InsertFeature(featureAnno);
}
// 生成线
var polyline = new PolylineClass();
for (int i = 0; i < enveloplist.Count; i++)
{
// 计算注记的终点
IPoint toPoint = new PointClass();
if (i % 2 == 0)
{
toPoint.X = enveloplist[i].XMax;
}
else
{
toPoint.X = enveloplist[i].XMin;
}
toPoint.Y = lineStartPoints[i].Y;
var line = new PathClass
{
FromPoint = lineStartPoints[i],
ToPoint = toPoint
};
polyline.AddGeometry(line);
}
var featureLine = lineLayer.FeatureClass.CreateFeatureBuffer();
pTrans2D = polyline as ITransform2D;
pTrans2D.Rotate(pt, Angle);
IPolyline mline = pTrans2D as IPolyline;
GIS.Common.DataEditCommon.ZMValue(featureLine,mline);
featureLine.Shape = mline;
featureLine.set_Value(featureLine.Fields.FindField("BID"), bid);
polylineCursor.InsertFeature(featureLine);
}
AnnoCursor.Flush();
polygonTopCursor.Flush();
polylineCursor.Flush();
if (edit)
{
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(true);
DataEditCommon.g_pMyMapCtrl.ActiveView.Refresh();
}
return true;
}
catch (Exception ex)
{
if (edit)
{
workspaceEdit.AbortEditOperation();
workspaceEdit.StopEditing(false);
}
System.Windows.Forms.MessageBox.Show(ex.Message);
return false;
}
}