Ejemplo n.º 1
0
 /// <summary>
 /// 将当前renderModelPoint所在的位置插入MotionPath中
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnInsertWaypoint_Click(object sender, EventArgs e)
 {
     if (renderModelPoint != null)
     {
         IModelPoint modelPoint = renderModelPoint.GetFdeGeometry() as IModelPoint;
         IMatrix     matrix     = new Matrix();
         matrix = modelPoint.AsMatrix();
         motionPath.AddWaypointByMatrix(matrix, motionPath.TotalDuration + 4);
     }
 }
Ejemplo n.º 2
0
        void axRenderControl1_RcMouseClickSelect_Edit(IPickResult PickResult, IPoint IntersectPoint, gviModKeyMask Mask, gviMouseSelectMode EventSender)
        {
            this.axRenderControl1.FeatureManager.UnhighlightAll();

            // 置空
            currentGeometry = null;
            _buffer         = null;
            _featureLayer   = null;

            if (PickResult != null)
            {
                switch (PickResult.Type)
                {
                case gviObjectType.gviObjectFeatureLayer:
                {
                    IFeatureLayerPickResult flpr = PickResult as IFeatureLayerPickResult;
                    int fid = flpr.FeatureId;
                    //加载多FeatureClass时要每次重新获取
                    _featureClass = (IFeatureClass)fcGUIDMap[flpr.FeatureLayer.FeatureClassId];
                    _featureLayer = flpr.FeatureLayer;

                    IFdeCursor cursor = null;
                    try
                    {
                        _buffer = _featureClass.CreateRowBuffer();
                        QueryFilter filter = new QueryFilter();
                        //filter.AddSubField("oid");  //注意:StartEditFeatureGeometry里必须传入一个完整的rowbuffer,所以这里不能限定字段
                        filter.WhereClause = "oid =" + fid;
                        cursor             = _featureClass.Search(filter, false);
                        IRowBuffer row = null;
                        if ((row = cursor.NextRow()) != null)
                        {
                            _buffer = row as IRowBuffer;
                            int pos = _buffer.FieldIndex("Geometry");
                            oldfdeGeometry = _buffer.GetValue(pos) as IGeometry;
                        }
                    }
                    catch (COMException ex)
                    {
                        System.Diagnostics.Trace.WriteLine(ex.Message);
                    }
                    finally
                    {
                    }

                    this.axRenderControl1.FeatureManager.HighlightFeature(_featureClass, fid, System.Drawing.Color.Yellow);
                    EditGeometry();
                }
                break;

                case gviObjectType.gviObjectRenderModelPoint:
                {
                    IRenderModelPointPickResult flpr = PickResult as IRenderModelPointPickResult;
                    rmodelpoint     = flpr.ModelPoint;
                    currentGeometry = rmodelpoint;
                    oldfdeGeometry  = rmodelpoint.GetFdeGeometry();
                    EditGeometry();
                }
                break;

                case gviObjectType.gviObjectRenderPoint:
                {
                    IRenderPointPickResult flpr = PickResult as IRenderPointPickResult;
                    rpoint          = flpr.Point;
                    currentGeometry = rpoint;
                    EditGeometry();
                }
                break;

                case gviObjectType.gviObjectRenderPolyline:
                {
                    IRenderPolylinePickResult flpr = PickResult as IRenderPolylinePickResult;
                    rpolyline       = flpr.Polyline;
                    currentGeometry = rpolyline;
                    EditGeometry();
                }
                break;

                case gviObjectType.gviObjectRenderPolygon:
                {
                    IRenderPolygonPickResult flpr = PickResult as IRenderPolygonPickResult;
                    rpolygon        = flpr.Polygon;
                    currentGeometry = rpolygon;
                    EditGeometry();
                }
                break;
                }
            }
        }