コード例 #1
0
 void zoomCanvas_ObjectSelected(object sender, ObjectSelectedEventArgs e)
 {
     if (!e.AffectedObject.IsLocked)
     {
         textEntry.SelectCursor(e.AffectedObject);
     }
 }
コード例 #2
0
        void zoomCanvas_ObjectDoubleTap(object sender, ObjectSelectedEventArgs e)
        {
            if (this.isLocked)
            {
                ShowView      view   = e.AffectedObject;
                Rect          bounds = view.Bounds;
                DisplayMatrix data   = view.Model.DisplayMatrix;

                double margin       = 0.95;
                double scaleFactorX = margin * zoomCanvas.ActualWidth / (view.ActualWidth * data.Scale.X);
                double scaleFactorY = margin * zoomCanvas.ActualHeight / (view.ActualHeight * data.Scale.Y);
                double scaleFactor  = Math.Min(scaleFactorX, scaleFactorY);
                Vector scale        = new Vector(scaleFactor, scaleFactor);

                DisplayMatrix newTransform = new DisplayMatrix();
                newTransform.Center      = zoomCanvas.CurrentView.Center;
                newTransform.Orientation = zoomCanvas.CurrentView.Orientation;
                newTransform.Scale       = scale;

                Point p1 = newTransform.TransformMatrix.Transform(data.Center);

                Vector offset = new Vector(zoomCanvas.ActualWidth / 2, zoomCanvas.ActualHeight / 2);
                Vector p2     = offset - new Vector(p1.X, p1.Y);

                Point center = zoomCanvas.CurrentView.Center + p2;

                ZoomViewTo(center, 0, scale);
            }
            else
            {
                showContext.SendToFront(e.AffectedObject.Model);
            }
        }
コード例 #3
0
 /// <summary>
 /// 使当前被选中对象所在的图层为当前图层
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void m_sceneControl_ObjectSelected(object sender, ObjectSelectedEventArgs e)
 {
     try
     {
         if (e.Count > 0)
         {
             Selection3D[] selection  = m_sceneContorl.Scene.FindSelection(true);
             Recordset     recordeset = selection[0].ToRecordset();
             geometry = recordeset.GetGeometry() as Geometry3D;
             if (geometry.Type == GeometryType.GeoLine3D)
             {
                 //ButtonFlyLine.Enabled = true;
             }
             else
             {
                 //ButtonFlyLineStop.Enabled = false;
                 //ButtonFlyLine.Enabled = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #4
0
        void scon_ObjectSelected(object sender, ObjectSelectedEventArgs e)
        {
            //scon.Scene.Layers[0].Selection.ToRecordset();

            Test m_Lis = new Test();

            scon.AddFrameListener(m_Lis);
        }
コード例 #5
0
        protected virtual void OnObjectSelected(ObjectSelectedEventArgs e)
        {
            var handler = ObjectSelected;

            if (handler != null)
            {
                handler(this, e);
            }
        }
コード例 #6
0
 private void mSceneControlObjectSelected(object sender, ObjectSelectedEventArgs e)
 {
     // 无对象被选中
     if (e.Count == 0)
     {
         MessageBox.Show("未选择对象!");
     }
     //有对象选中
     else if (e.Count > 0)
     {
         DrawCirle(mPoint3D);
         mSceneControl.Action = Action3D.Pan2;
     }
 }
コード例 #7
0
        void m_sceneControl_ObjectSelected(object sender, ObjectSelectedEventArgs e)
        {
            //Recordset recordset = null;
            //Selection3D[] selection3d = null;
            try
            {
                //有对象选中
                if (e.Count > 0)
                {
                    m_sceneControl.Action = Action3D.Pan2;

                    //selection3d = m_sceneControl.Scene.FindSelection(true);
                    //recordset = selection3d[0].ToRecordset();

                    //GeoStyle3D style = new GeoStyle3D();
                    //style.FillForeColor = Color.Red;

                    //GeoPoint3D sourcepoint = recordset.GetGeometry() as GeoPoint3D;

                    //GeoRegion3D geoRegion3D = recordset.GetGeometry() as GeoRegion3D;

                    //m_sampleDesignerRun.SetRegionPoint(geoRegion3D);
                    //// 源点
                    //if (m_pointType == 0)
                    //{
                    //    m_layerNetNode.Selection.Style = style;

                    //    GeoPoint3D sourcepoint = recordset.GetGeometry() as GeoPoint3D;
                    //    m_sourcePoints.Add(sourcepoint.ID);
                    //    if (m_sourcePoints.Count > 1)
                    //    {
                    //        m_layerNetNode.Selection.AddRange(m_sourcePoints.ToArray());
                    //    }
                    //    else
                    //    {
                    //        m_layerNetNode.Selection.Add(m_sourcePoints[0]);
                    //    }

                    //    m_layerNetNode.Selection.UpdateData();
                    //}
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #8
0
        private void mSceneControlObject(object sender, ObjectSelectedEventArgs e)
        {
            try
            {
                // 无对象被选中
                if (e.Count == 0)
                {
                    return;
                }
                //有对象选中
                else if (e.Count > 0)
                {
                    switch (mComBoBoxValue)
                    {
                    case "管径": DiametLabel();
                        break;

                    case "埋深": PlaceDepthLabel();
                        break;

                    case "坐标": coordLabel();
                        break;

                    case "ID": IdLabel();
                        break;

                    case "材质": MaterialLabel();
                        break;

                    case "权属": OwnerLabel();
                        break;

                    case "名称": NameLabel();
                        break;

                    case "流向": FlowLabel();
                        break;
                    }
                }
            }
            catch (Exception)
            {
            }
        }
コード例 #9
0
        private void mSceneControlQuery(object sender, ObjectSelectedEventArgs e)
        {
            // 无对象被选中
            if (e.Count == 0)
            {
                MessageBox.Show("未选择对象!");
            }
            //有对象选中

            else if (e.Count > 0 && mIndex == 1)
            {
                AttQuery(mDataGridAtt);
            }
            else if (e.Count > 0 && mIndex == 2)
            {
                OwnerQuery();
            }
            else if (e.Count > 0 && mIndex == 3)
            {
                UnitsQuery();
            }
            else if (e.Count > 0 && mIndex == 4)
            {
                MaterQuery();
            }
            else if (e.Count > 0 && mIndex == 5)
            {
                MeasureQuery();
            }
            else if (e.Count > 0 && mIndex == 6)
            {
                DiametQuery();
            }
            else if (e.Count > 0 && mIndex == 7)
            {
                AppendQuery();
            }
        }
コード例 #10
0
 private void SetObject(ObjectSelectedEventArgs e)
 {
     focusObject = null;
     setSlidersToObject(e.FocusObject);
     focusObject = e.FocusObject;
 }
コード例 #11
0
        void mSceneControlSelected(object sender, ObjectSelectedEventArgs e)
        {
            Recordset recordset = null;

            Selection3D[] selection3d = null;
            mGeoLine3D = new GeoLine3D();
            //水平及竖直净距
            if (mSceneControl.Action == Action3D.Select && mFlag == 1 ||
                mSceneControl.Action == Action3D.Select && mFlag == 2)
            {
                if (e.Count > 0)
                {
                    selection3d = mSceneControl.Scene.FindSelection(true);
                    recordset   = selection3d[0].ToRecordset();
                    if (recordset.GetGeometry().Type != mGeoLine3D.Type)
                    {
                        MessageBox.Show("请选择三维线对象!");
                    }
                    else
                    {
                        mGeoLine3D = recordset.GetGeometry() as GeoLine3D;
                        if (TempGeoLine.Count > 0 && TempGeoLine[0].Bounds == mGeoLine3D.Bounds)
                        {
                            MessageBox.Show("请不要选择同一条三维线对象!");
                        }
                        else
                        {
                            mTextPoint3Ds.Add(mGeoLine3D.InnerPoint3D);
                            TempGeoLine.Add(mGeoLine3D);
                        }
                    }
                    if (TempGeoLine.Count == 2)
                    {
                        this.SetPoint(TempGeoLine);
                    }
                }
            }
            //覆土分析
            if (mSceneControl.Action == Action3D.Select && mFlag == 3)
            {
                string str = "";
                object obj;
                selection3d = mSceneControl.Scene.FindSelection(true);
                recordset   = selection3d[0].ToRecordset();
                if (e.Count > 0)
                {
                    selection3d = mSceneControl.Scene.FindSelection(true);
                    recordset   = selection3d[0].ToRecordset();
                    if (recordset.GetGeometry().Type != mGeoLine3D.Type)
                    {
                        MessageBox.Show("请选择三维线对象!");
                    }
                    else
                    {
                        mGeoLine3D = recordset.GetGeometry() as GeoLine3D;
                        mTextPoint3Ds.Add(mGeoLine3D.InnerPoint3D);
                        Point3D cPoint3D = new Point3D(mGeoLine3D.InnerPoint3D.X, mGeoLine3D.InnerPoint3D.Y, 0);
                        mTextPoint3Ds.Add(cPoint3D);
                        for (int i = 0; i < recordset.FieldCount; i++)
                        {
                            str = recordset.GetFieldInfos()[i].Name;
                            if (str == "BottomAltitude")
                            {
                                obj       = recordset.GetFieldValue(i);
                                mAltitude = Convert.ToDouble(obj);
                            }
                            if (str == "PipeDiameter")
                            {
                                obj       = recordset.GetFieldValue(i);
                                mDiameter = new double[] { Convert.ToDouble(obj) };
                            }
                        }
                    }
                    GetCoverRusult();
                }
            }
            //碰撞检测
            if (mSceneControl.Action == Action3D.Select && mFlag == 4)
            {
                if (e.Count > 0)
                {
                    string str = "";
                    object obj;
                    selection3d = mSceneControl.Scene.FindSelection(true);
                    recordset   = selection3d[0].ToRecordset();
                    if (recordset.GetGeometry().Type != mGeoLine3D.Type)
                    {
                        MessageBox.Show("请选择三维线对象!");
                    }
                    else
                    {
                        mGeoLine3D = recordset.GetGeometry() as GeoLine3D;
                        if (TempGeoLine.Count > 0 && TempGeoLine[0].Bounds == mGeoLine3D.Bounds)
                        {
                            MessageBox.Show("请不要选择同一条三维线对象!");
                        }
                        else if (TempGeoLine.Count > 0 && recordset.Dataset.Name == TempRecordset.Dataset.Name)
                        {
                            MessageBox.Show("请不要选择同一数据集线对象!");
                        }
                        else
                        {
                            mTextPoint3Ds.Add(mGeoLine3D.InnerPoint3D);
                            TempGeoLine.Add(mGeoLine3D);
                            TempRecordset = recordset;
                            for (int i = 0; i < recordset.FieldCount; i++)
                            {
                                str = recordset.GetFieldInfos()[i].Name;
                                if (str == "PipeDiameter")
                                {
                                    obj = recordset.GetFieldValue(i);
                                    if (TempGeoLine.Count == 2)
                                    {
                                        mDiameter[1] = Convert.ToDouble(obj);
                                    }
                                    else
                                    {
                                        mDiameter    = new double[2];
                                        mDiameter[0] = Convert.ToDouble(obj);
                                    }
                                }
                            }
                        }
                    }
                    if (TempGeoLine.Count == 2)
                    {
                        this.SetPoint(TempGeoLine);
                    }
                }
            }
        }
コード例 #12
0
        void mSceneControlObjectSelectedFlow(object sender, ObjectSelectedEventArgs e)
        {
            Recordset recordset = null;

            Selection3D[] selection3d = null;
            try
            {
                // 无对象被选中
                if (e.Count == 0)
                {
                    MessageBox.Show("未选择对象!");
                }
                //有对象选中
                if (e.Count > 0)
                {
                    mSceneControl.Action = Action3D.Pan2;

                    selection3d = mSceneControl.Scene.FindSelection(true);
                    selection3d[0].Style.LineColor = Color.Blue;
                    recordset = selection3d[0].ToRecordset();
                    string[] StrName  = new string[recordset.FieldCount];
                    bool     PipeFlag = false;
                    string   PipeType = null;
                    //判断是否为管线或管点对象 ,若不是 则提示选择管点或管线对象
                    for (int i = 0; i < recordset.FieldCount; i++)
                    {
                        StrName[i] = recordset.GetFieldInfos()[i].Name;
                        if (StrName[i] == "PipeType")
                        {
                            PipeFlag = true;
                            break;
                        }
                    }
                    if (PipeFlag == true)
                    {
                        PipeType = recordset.GetFieldValue("PipeType").ToString();
                        switch (PipeType.Trim())
                        {
                        case "给水":
                            network    = mUseData.SupplyWaterNetWork;
                            mLayerName = "给水管网@127.0.0.1_UnderPipeLine";
                            break;

                        case "排水":
                            network    = mUseData.OutWaterNetWork;
                            mLayerName = "排水管网@127.0.0.1_UnderPipeLine";
                            break;

                        default:
                            MessageBox.Show("请选择其他类型管线对象");
                            break;
                        }
                        if (network != null)
                        {
                            mPipeId1 = Convert.ToInt32(recordset.GetFieldValue("SmID"));
                            Geometry     geo           = recordset.GetGeometry();
                            GeometryType recordsetType = geo.Type;
                            if (recordsetType == GeometryType.GeoLine3D)
                            {
                                MessageBox.Show("当前选择管线ID为" + mPipeId1.ToString().Trim());
                                mSeachFlag        = "Line";
                                mConnectSeachFlag = "Line";
                            }
                            else if (recordsetType == GeometryType.GeoPoint3D)
                            {
                                MessageBox.Show("当前选择管点ID为" + mPipeId1.ToString().Trim());
                                mConnectSeachFlag = "Node";
                                mSeachFlag        = "Node";
                            }
                        }
                    }
                    else
                    {
                        MessageBox.Show("请选择管点管线对象");
                    }
                }
            }
            catch (System.Exception ex)
            {
                Trace.Write(ex.Message);
            }
            finally
            {
                if (recordset != null)
                {
                    recordset.Close();
                    recordset.Dispose();
                }
            }
        }
コード例 #13
0
 private void ObjectSelected(object sender, ObjectSelectedEventArgs e)
 {
     Controller.ObjectSelected(e.SelectedObject);
 }
コード例 #14
0
ファイル: Canvas.cs プロジェクト: xyfc/PrimitiveCanvas
 /// <summary>
 /// Called when an object was selected.
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnObjectSelected(ObjectSelectedEventArgs e)
 {
     this.ObjectSelected?.Invoke(this, e);
 }
コード例 #15
0
ファイル: KensaYoteiMap.cs プロジェクト: 25cm/HelloWorld
        private void mwView1_ObjectSelected(object sender, ObjectSelectedEventArgs e)
        {
            // TODO Clickイベントとの使い分けは検討
            // アイコン移動操作用に選択オブジェクトを保持
            currentMoveTraget = (Guid)e.ObjectID;

            // 選択アイコン点滅タイマーを起動
            iconBlinkTimer.Enabled = true;
        }
コード例 #16
0
 private void SetObject(ObjectSelectedEventArgs e)
 {
     focusObject = e.FocusObject;
 }
コード例 #17
0
        void mSceneControlObjectSelectedCon(object sender, ObjectSelectedEventArgs e)
        {
            mIsPipe1Selected = true;
            Recordset recordset = null;

            Selection3D[] selection3d = null;
            try
            {
                // 无对象被选中
                if (e.Count == 0)
                {
                    MessageBox.Show("未选择对象!");
                }
                //有对象选中
                if (e.Count > 0)
                {
                    mSceneControl.Action = Action3D.Pan2;
                    selection3d          = mSceneControl.Scene.FindSelection(true);
                    recordset            = selection3d[0].ToRecordset();
                    switch (mFlag)//判断是第几个被选中的点 第一个点用于获得图层 网络数据集等,第二个点要判断是否与一 一致
                    {
                        #region case1

                    case 1: mPipeTypeConId1 = recordset.GetFieldValue("PipeType").ToString().Trim();
                        switch (mPipeTypeConId1)
                        {
                        case "给水":
                            mConNetWorkName = mUseData.SupplyWaterNetWork;
                            mConLayerName   = "给水管网@127.0.0.1_UnderPipeLine";
                            mPipeAltitude   = -2;
                            break;

                        case "排水":
                            mConNetWorkName = mUseData.OutWaterNetWork;
                            mConLayerName   = "排水管网@127.0.0.1_UnderPipeLine";
                            mPipeAltitude   = -3.5;
                            break;

                        default:
                            MessageBox.Show("请选择其他类型管线");
                            mFlag = 0;
                            break;
                        }
                        if (mConNetWorkName != null)
                        {
                            mPipeConId1 = Convert.ToInt32(recordset.GetFieldValue("SmID"));
                            Geometry geo1 = recordset.GetGeometry();
                            recordsetTypeConId1 = geo1.Type;
                            if (recordsetTypeConId1 == GeometryType.GeoLine3D)
                            {
                                MessageBox.Show("当前选择管线ID为" + mPipeConId1.ToString());
                            }
                            else if (recordsetTypeConId1 == GeometryType.GeoPoint3D)
                            {
                                MessageBox.Show("当前选择管点ID为" + mPipeConId1.ToString());
                            }
                            else
                            {
                                MessageBox.Show("请选择管点或管线对象");
                            }
                        }
                        break;
                        #endregion

                        #region case2

                    case 2:
                        //判断图层-----------------------------------
                        mPipeTypeConId2 = recordset.GetFieldValue("PipeType").ToString().Trim();
                        if (mPipeTypeConId2 != mPipeTypeConId1 || mPipeTypeConId2 == null)
                        {
                            MessageBox.Show("请选择" + mPipeTypeConId1 + "管线对象");
                            break;
                        }
                        //----------------------------------------------------

                        //判断类型--------------------------------------
                        Geometry geo2 = recordset.GetGeometry();
                        recordsetTypeConId2 = geo2.Type;
                        if (recordsetTypeConId2 != recordsetTypeConId1)
                        {
                            MessageBox.Show("请选择当前图层" + recordsetTypeConId1.ToString() + "对象");
                            break;
                        }
                        mPipeConId2 = Convert.ToInt32(recordset.GetFieldValue("SmID"));
                        if (recordsetTypeConId2 == GeometryType.GeoLine3D)
                        {
                            MessageBox.Show("当前选择管线ID为" + mPipeConId2.ToString());
                        }
                        else if (recordsetTypeConId2 == GeometryType.GeoPoint3D)
                        {
                            MessageBox.Show("当前选择管点ID为" + mPipeConId2.ToString());
                        }
                        //------------------------------------------------
                        break;
                        #endregion

                    default:
                        break;
                    }
                }
            }
            catch (System.Exception ex)
            {
                Trace.Write(ex.Message);
            }
            finally
            {
                if (recordset != null)
                {
                    recordset.Close();
                    recordset.Dispose();
                }
            }
        }