Exemplo n.º 1
0
 public DrawingWidget()
 {
     this.Build();
     lineColor = new Cairo.Color(Double.MaxValue,0,0);
     lineWidth = 6;
     Transparency=0.8;
     selectedTool = DrawTool.PEN;
     loaded = false;
     visible = true;
     preview=false;
 }
Exemplo n.º 2
0
 public Blackboard(IWidget widget)
     : base(widget)
 {
     Accuracy = 5;
     SelectionMode = MultiSelectionMode.Single;
     LineWidth = 2;
     Color = Color.Red1;
     LineStyle = LineStyle.Normal;
     LineType = LineType.Arrow;
     FontSize = 12;
     tool = DrawTool.Selection;
     currentZoom = 1;
     MinZoom = MaxZoom = 1;
     if (Config.SupportsZoom) {
         MaxZoom = 4;
     }
 }
Exemplo n.º 3
0
        private void radioGroup1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (this.radioGroup1.SelectedIndex)
            {
            case 0:
                if (this._drawTool != null)
                {
                    this._drawTool.OnStartDraw    -= new OnStartDraw(this.OnStartDraw);
                    this._drawTool.OnFinishedDraw -= new OnFinishedDraw(this.OnFinishedDraw);
                    this._drawTool.End();
                }
                this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.SelectOne);
                if (this._drawTool != null)
                {
                    this._drawTool.OnStartDraw    += new OnStartDraw(this.OnStartDraw);
                    this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw);
                    this._drawTool.Start();
                }
                break;

            case 1:
                if (this._drawTool != null)
                {
                    this._drawTool.OnStartDraw    -= new OnStartDraw(this.OnStartDraw);
                    this._drawTool.OnFinishedDraw -= new OnFinishedDraw(this.OnFinishedDraw);
                    this._drawTool.End();
                }
                this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Line);
                if (this._drawTool != null)
                {
                    this._drawTool.OnStartDraw    += new OnStartDraw(this.OnStartDraw);
                    this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw);
                    this._drawTool.Start();
                }
                break;
            }
        }
Exemplo n.º 4
0
        private void virtualRegion_RegionEntered(int id, int x, int y, int key)
        {
            if (selectPanel.SelectIndex < 0 || selectPanel.SelectIndex >= questIds.Count)
            {
                return;
            }

            var questConfig = ConfigData.GetQuestConfig(questIds[selectPanel.SelectIndex]);
            if (!UserProfile.InfoQuest.IsQuestFinish(questConfig.Id))
            {
                return;
            }

            string sceneQuestId = "";
            string subContext = "";
            if (id ==1)
            {
                sceneQuestId = questConfig.Quest1;
                subContext = questConfig.SubDescript1;
            }
            if (id == 2)
            {
                sceneQuestId = questConfig.Quest2;
                subContext = questConfig.SubDescript2;
            }
            if (id == 3)
            {
                sceneQuestId = questConfig.Quest3;
                subContext = questConfig.SubDescript3;
            }
            if (!string.IsNullOrEmpty(sceneQuestId))
            {
                var name = ConfigData.GetSceneQuestConfig(SceneBook.GetSceneQuestByName(sceneQuestId)).Name;
                Image image = DrawTool.GetImageByString(name, subContext, 150, Color.White);
                tooltip.Show(image, this, x, y);
            }
        }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        //進入CD
        CDing();


        //獲取範圍內敵人
        hitColliders = Physics.OverlapSphere(transform.position, _distance, 1 << LayerMask.NameToLayer("Enemy"));


        if (CanUseSkill && Input.GetKey(KeyCode.Alpha3))
        {
            DrawTool.DrawCircle(Rectangle_p, Rectangle_p.localPosition, _distance);
        }                                                                          //攻擊範圍標示

        if (Input.GetKeyUp(KeyCode.Alpha3))
        {
            UseSkill();
        }

        if (CanUseSkill && isUse && isAnimation)
        {
            CostMP();
            _particle.Play(true);
            targetColliders = hitColliders;
            HitAnimatiom();
            settle();
            StartCD();
        }
        if (isAnimation)
        {
            DrawTool.EndDraw(Rectangle_p, false);
            isUse       = false;
            isAnimation = false;
        }
    }
Exemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
        DrawTool.DrawRectangleSolid(Rectangle_p, Rectangle_p.position, _distance, transform.localScale.x * 2);//攻擊範圍標示

        //進入CD
        CDing();

        //使用技能
        if (CanUseSkill && Input.GetKeyDown(KeyCode.Alpha2))
        {
            UseSkill();
        }

        if (CanUseSkill && isUse && isAnimation)
        {
            CostMP();
            _sword = Instantiate(sword, transform.position, transform.rotation);
            _sword.transform.SetParent(transform);
            StartCD();
            settle();
        }

        //播放動畫
        if (isAnimation)
        {
            ani_time -= Time.deltaTime;
            DrawTool.Draw(Rectangle_p, true);
            if (ani_time <= 0)
            {
                ani_time = fairy_guide.length;
                Destroy(_sword);
                DrawTool.EndDraw(Rectangle_p, true);
                isAnimation = false;
            }
        }
    }
Exemplo n.º 7
0
    void drawSector()
    {
        sectors = new GameObject[layerNum * seperateNum];
        for (int i = 0; i < layerNum * seperateNum; i++)
        {
            SectorConfig c = config [i];
//			Debug.Log ("wenkan dfsdjkfjdsf "+c.angle);
            if (isHiddenColorMode)
            {
                sectors [i] = DrawTool.DrawSectorSolid(transform, transform.localPosition, c.angle, c.radius, new Color(1, 1, 1), c.rotation);
                var frame = DrawTool.DrawSector(sectors [i].transform, sectors [i].transform.localPosition, c.angle, c.radius);
//				frame.transform.parent = sectors [i].transform;
//				frame.transform.Rotate (new Vector3(0, 0, c.rotation));
//				frame.transform.Rotate(new Vector3(0,0,100));
            }
            else
            {
                sectors [i] = DrawTool.DrawSectorSolid(transform, transform.localPosition, c.angle, c.radius, new Color(c.r / 255.0f, c.g / 255.0f, c.b / 255.0f), c.rotation);
            }

            Vector3 t = sectors [i].transform.position;
            sectors [i].transform.localPosition = new Vector3(0, 0, c.radius);
            sectors [i].transform.Rotate(new Vector3(0, 0, c.rotation));
            sectors [i].name = "sector_" + i.ToString();
            sectors [i].AddComponent <SectorControl>();
            sectors [i].GetComponent <SectorControl> ().color = new float[3] {
                c.r, c.g, c.b
            };
            sectors [i].GetComponent <SectorControl>().note = globalConfig.colorMusicPair [c.r + "," + c.g + "," + c.b];



//			Texture tx = Resources.Load ("PaperTexture") as Texture;
//			circles [i].GetComponent<MeshRenderer> ().material .SetTexture ("_MainTex", tx);
        }
    }
Exemplo n.º 8
0
 private void FrmAddPipeNode_Load(object sender, EventArgs e)
 {
     app = DF3DApplication.Application;
     if (app == null || app.Current3DMapControl == null || app.Workbench == null)
     {
         this.Enabled = false;
         return;
     }
     this._dt = new DataTable();
     this._dt.Columns.Add(new DataColumn("FN", Type.GetType("System.String")));
     this._dt.Columns.Add(new DataColumn("FV", Type.GetType("System.Object")));
     this._dt.Columns.Add(new DataColumn("F", Type.GetType("System.Object")));
     this.gridControl1.DataSource = this._dt;
     LoadClassify();
     LoadProperty();
     LoadStyle();
     this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Point);
     if (this._drawTool != null)
     {
         this._drawTool.OnStartDraw    += new OnStartDraw(this.OnStartDraw);
         this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw);
         this._drawTool.Start();
     }
 }
Exemplo n.º 9
0
 void HandleConfigureObjectEvent(IBlackboardObject drawable, DrawTool tool)
 {
     if (drawable is Text) {
         if (tool == DrawTool.Text) {
             EditText (drawable as Text);
         } else if (tool == DrawTool.Player) {
             EditPlayer (drawable as Text);
         }
     }
 }
Exemplo n.º 10
0
 public void SetDrawTool(DrawTool t)
 {
     Tool = t;
 }
Exemplo n.º 11
0
 static public void DravTools(DrawTool tool)
 {
     tool.Drav();
 }
 public DrawPanelToolsChangedEventsArgs(DrawTool tool)
 {
     Tool = tool;
 }
Exemplo n.º 13
0
        private void AxRenderControl3D_RcMouseClickSelect(object sender, Gvitech.CityMaker.Controls._IRenderControlEvents_RcMouseClickSelectEvent e)
        {
            IFdeCursor cursor = null;
            IRowBuffer row    = null;

            try
            {
                IPickResult pr = e.pickResult;
                if (pr.Type == gviObjectType.gviObjectFeatureLayer && pr is IFeatureLayerPickResult)
                {
                    IFeatureLayerPickResult flpr = pr as IFeatureLayerPickResult;
                    int           oid            = flpr.FeatureId;
                    IFeatureLayer fl             = flpr.FeatureLayer;
                    if (this._dictFeatureClass.ContainsKey(fl.FeatureClassId))
                    {
                        IFeatureClass fc = this._dictFeatureClass[fl.FeatureClassId];
                        if (fc == null)
                        {
                            return;
                        }
                        IQueryFilter filter = new QueryFilter();
                        filter.WhereClause = "oid = " + oid;
                        cursor             = fc.Search(filter, true);
                        IFieldInfoCollection        fiCol = fc.GetFields();
                        Dictionary <string, string> dict  = new Dictionary <string, string>();
                        if ((row = cursor.NextRow()) != null)
                        {
                            for (int i = 0; i < fiCol.Count; i++)
                            {
                                IFieldInfo fi  = fiCol.Get(i);
                                object     obj = row.GetValue(i);
                                if (obj == null)
                                {
                                    continue;
                                }
                                string str = "";
                                switch (fi.FieldType)
                                {
                                case gviFieldType.gviFieldBlob:
                                case gviFieldType.gviFieldUnknown:
                                case gviFieldType.gviFieldGeometry:
                                    break;

                                case gviFieldType.gviFieldFloat:
                                case gviFieldType.gviFieldDouble:
                                    double d;
                                    if (double.TryParse(obj.ToString(), out d))
                                    {
                                        str = d.ToString("0.00");
                                    }
                                    break;

                                default:
                                    str = obj.ToString();
                                    break;
                                }
                                if (!string.IsNullOrEmpty(str.Trim()))
                                {
                                    string temp = fi.Name + "(" + fi.Alias + ")";
                                    dict[temp] = str;
                                }
                            }
                        }
                        #region
                        ITableLabel tl = DrawTool.CreateTableLabel2(dict.Count);
                        tl.TitleText = "属性查询";
                        int num = 0;
                        foreach (KeyValuePair <string, string> kv in dict)
                        {
                            string k = kv.Key;
                            string v = kv.Value;
                            tl.SetRecord(num, 0, k);
                            tl.SetRecord(num, 1, v);
                            num++;
                        }
                        tl.Position = e.intersectPoint;
                        allTLGuid.Add(tl.Guid);
                        #endregion
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 14
0
 protected virtual void OnDrawingtoolbox1DrawToolChanged(DrawTool tool)
 {
     drawingwidget1.DrawTool = tool;
 }
Exemplo n.º 15
0
 private void virtualRegion_RegionEntered(int id, int x, int y, int key)
 {
     {
         var region = vRegion.GetRegion(id) as PictureRegion;
         if (region != null)
         {
             var regionType = region.GetVType();
             if (regionType == PictureRegionCellType.Item)
             {
                 Image image = HItemBook.GetPreview(key);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == PictureRegionCellType.Equip)
             {
                 Equip equip = new Equip(key);
                 Image image = equip.GetPreview();
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == PictureRegionCellType.Bless)
             {
                 Image image = BlessBook.GetPreview(key);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == PictureRegionCellType.People)
             {
                 Image image = PeopleBook.GetPreview(key);
                 tooltip.Show(image, parent, x, y);
             }
         }
     }
     {
         var region = vRegion.GetRegion(id) as ImageRegion;
         if (region != null)
         {
             var regionType = region.GetVType();
             if (regionType == ImageRegionCellType.Gold)
             {
                 string resStr = string.Format("黄金:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == ImageRegionCellType.Food)
             {
                 string resStr = string.Format("食物:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == ImageRegionCellType.Health)
             {
                 string resStr = string.Format("生命:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == ImageRegionCellType.Mental)
             {
                 string resStr = string.Format("精神:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
             else if (regionType == ImageRegionCellType.Exp)
             {
                 string resStr = string.Format("经验值:{0}", region.Parm);
                 Image  image  = DrawTool.GetImageByString(resStr, 100);
                 tooltip.Show(image, parent, x, y);
             }
         }
     }
 }
Exemplo n.º 16
0
 private void PickCircleTool(object sender, RoutedEventArgs e)
 {
     tool = state.reset(DrawingState.Tool.DRAW_VERTEX);
 }
Exemplo n.º 17
0
 /// <summary>
 /// 橡皮擦
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnEraser_Click(object sender, EventArgs e)
 {
     this.tool = DrawTool.Eraser;
     ShowToolState();
 }
Exemplo n.º 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnRetancle_Click(object sender, EventArgs e)
 {
     this.tool = DrawTool.Rectangle;
     ShowToolState();
 }
Exemplo n.º 19
0
 /// <summary>
 /// 线条
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnLine_Click(object sender, EventArgs e)
 {
     this.tool = DrawTool.Line;
     ShowToolState();
 }
Exemplo n.º 20
0
        private void virtualRegion_RegionEntered(int id, int x, int y, int key)
        {
            if (cid == -1 || !Enabled)
            {
                return;
            }

            if (id == 3)
            {
                Image image = DrawTool.GetImageByString("品质:" + HSTypes.I2Quality(key - 1), 100);
                tooltip.Show(image, parent, x, y);
                return;
            }
            else if (id == 4)
            {
                if (key > 0)
                {
                    Image image = DrawTool.GetImageByString("职业限定:" + ConfigData.GetJobConfig(key + JobConfig.Indexer.NewBie).Name, 100);
                    tooltip.Show(image, parent, x, y);
                }
                return;
            }

            var cardType = card.GetCardType();

            if (cardType == CardTypes.Monster)
            {
                MonsterConfig monsterConfig = ConfigData.GetMonsterConfig(cid);
                if (id == 1)
                {
                    Image image = DrawTool.GetImageByString("种族:" + HSTypes.I2CardTypeSub(monsterConfig.Type), 100);
                    tooltip.Show(image, parent, x, y);
                }
                else
                {
                    Image image = GetTerrainImage(monsterConfig.Attr, monsterConfig.BuffImmune, monsterConfig.AttrDef);
                    tooltip.Show(image, parent, x, y);
                }
            }
            else if (cardType == CardTypes.Weapon)
            {
                WeaponConfig weaponConfig = ConfigData.GetWeaponConfig(cid);
                if (id == 1)
                {
                    Image image = DrawTool.GetImageByString("类型:" + HSTypes.I2CardTypeSub(weaponConfig.Type) + HSTypes.I2CardTypeDesSub(weaponConfig.Type), 150);
                    tooltip.Show(image, parent, x, y);
                }
                else
                {
                    Image image = DrawTool.GetImageByString("属性:" + HSTypes.I2Attr(weaponConfig.Attr), 100);
                    tooltip.Show(image, parent, x, y);
                }
            }
            else if (cardType == CardTypes.Spell)
            {
                SpellConfig spellConfig = ConfigData.GetSpellConfig(cid);
                if (id == 1)
                {
                    Image image = DrawTool.GetImageByString("类型:" + HSTypes.I2CardTypeSub(spellConfig.Type), 100);
                    tooltip.Show(image, parent, x, y);
                }
                else
                {
                    Image image = DrawTool.GetImageByString("属性:" + HSTypes.I2Attr(spellConfig.Attr), 100);
                    tooltip.Show(image, parent, x, y);
                }
            }
        }
Exemplo n.º 21
0
        public void SetCursorForTool(DrawTool tool)
        {
            string cursorStr = null;

            Gdk.Cursor cursor = null;

            if (widget.GdkWindow == null)
            {
                return;
            }

            switch (tool)
            {
            case DrawTool.Line:
                cursorStr = "arrow";
                break;

            case DrawTool.Cross:
                cursorStr = "cross";
                break;

            case DrawTool.Text:
                cursorStr = "text";
                break;

            case DrawTool.Counter:
                cursorStr = "number";
                break;

            case DrawTool.Ellipse:
            case DrawTool.CircleArea:
                cursorStr = "ellipse";
                break;

            case DrawTool.Rectangle:
            case DrawTool.RectangleArea:
                cursorStr = "rect";
                break;

            case DrawTool.Angle:
                cursorStr = "angle";
                break;

            case DrawTool.Pen:
                cursorStr = "freehand";
                break;

            case DrawTool.Eraser:
                cursorStr = "eraser";
                break;

            case DrawTool.Player:
                cursorStr = "player";
                break;

            case DrawTool.Zoom:
                cursorStr = "zoom";
                break;

            case DrawTool.CanMove:
                cursorStr = "hand_opened";
                break;

            case DrawTool.Move:
                cursorStr = "hand_closed";
                break;

            case DrawTool.Selection:
                cursorStr = "hand_select";
                break;

            default:
                cursor = null;
                break;
            }
            if (cursorStr == null)
            {
                widget.GdkWindow.Cursor = cursor;
            }
            else
            {
                Image  img = App.Current.ResourcesLocator.LoadImage(Path.Combine("images/cursors", cursorStr));
                Cursor c   = new Cursor(widget.Display, img.Value, 0, 0);
                widget.GdkWindow.Cursor = c;
            }
        }
    public override void OnInspectorGUI()
    {
        DebugDistanceAngle d = target as DebugDistanceAngle;

        EditorGUILayout.LabelField("请把角色放在Resources文件夹中,点击Play之后将通过Resources进行加载");
        canGetDragEvent = EditorGUILayout.Toggle("通过拖拽获取角色路径", canGetDragEvent);
        EditorGUILayout.LabelField("角色路径");
        if (canGetDragEvent)
        {
            if (Event.current.type == EventType.DragExited)
            {
                if (DragAndDrop.paths != null && DragAndDrop.paths.Length > 0)
                {
                    string s = DragAndDrop.paths[0];
                    s           = s.Substring(s.IndexOf("Resources/"));
                    s           = s.Remove(0, "Resources/".Length);
                    s           = s.Substring(0, s.IndexOf('.'));
                    d.modelName = s;
                }
            }
        }
        d.modelName = EditorGUILayout.TextArea(d.modelName);

        // d.animationName = EditorGUILayout.TextField("动画名字", d.animationName);

        EditorGUILayout.LabelField("播放进度");
        d.time = EditorGUILayout.Slider(d.time, 0, 1);

        d.drawType = (DrawType)EditorGUILayout.EnumPopup("绘制类型", d.drawType);
        Debug.Log(d.drawType);
        switch (d.drawType)
        {
        case DrawType.DrawSector:
            EditorGUILayout.LabelField("绘制空心扇形");
            EditorGUILayout.LabelField("角度");
            d.angle = EditorGUILayout.Slider(d.angle, 0, 180);
            EditorGUILayout.LabelField("半径");
            d.radius = EditorGUILayout.Slider(d.radius, 0, 10);
            break;


        case DrawType.DrawCircle:
            EditorGUILayout.LabelField("绘制空心圆");
            EditorGUILayout.LabelField("半径");
            d.radius = EditorGUILayout.Slider(d.radius, 0, 10);
            break;


        case DrawType.DrawRectangle:
            EditorGUILayout.LabelField("绘制空心长方形");
            EditorGUILayout.LabelField("长度");
            d.length = EditorGUILayout.Slider(d.length, 0, 10);
            EditorGUILayout.LabelField("宽度");
            d.width = EditorGUILayout.Slider(d.width, 0, 10);
            break;


        case DrawType.DrawRectangle2D:
            EditorGUILayout.LabelField("绘制空心长方形2D");
            EditorGUILayout.LabelField("距离");
            d.distance = EditorGUILayout.Slider(d.distance, 0, 10);
            EditorGUILayout.LabelField("长度");
            d.length = EditorGUILayout.Slider(d.length, 0, 10);
            EditorGUILayout.LabelField("宽度");
            d.width = EditorGUILayout.Slider(d.width, 0, 10);
            break;


        case DrawType.DrawSectorSolid:
            EditorGUILayout.LabelField("绘制实心扇形");
            EditorGUILayout.LabelField("角度");
            d.angle = EditorGUILayout.Slider(d.angle, 0, 180);
            EditorGUILayout.LabelField("半径");
            d.radius = EditorGUILayout.Slider(d.radius, 0, 10);
            break;


        case DrawType.DrawCircleSolid:
            EditorGUILayout.LabelField("绘制实心圆");
            EditorGUILayout.LabelField("半径");
            d.radius = EditorGUILayout.Slider(d.radius, 0, 10);
            break;


        case DrawType.DrawRectangleSolid:
            EditorGUILayout.LabelField("绘制实心长方形");
            EditorGUILayout.LabelField("长度");
            d.length = EditorGUILayout.Slider(d.length, 0, 10);
            EditorGUILayout.LabelField("宽度");
            d.width = EditorGUILayout.Slider(d.width, 0, 10);
            break;


        case DrawType.DrawRectangleSolid2D:
            EditorGUILayout.LabelField("绘制实心长方形2D");
            EditorGUILayout.LabelField("距离");
            d.distance = EditorGUILayout.Slider(d.distance, 0, 10);
            EditorGUILayout.LabelField("长度");
            d.length = EditorGUILayout.Slider(d.length, 0, 10);
            EditorGUILayout.LabelField("宽度");
            d.width = EditorGUILayout.Slider(d.width, 0, 10);
            break;


        default:
            break;
        }

        if (tempGo != null)
        {
            DestroyImmediate(tempGo);
        }


        GameObject go = d.gameObject;

        tempGo = null;
        switch (d.drawType)
        {
        case DrawType.DrawSector:
            DrawTool.DrawSector(go.transform, go.transform.position, d.angle, d.radius);
            break;

        case DrawType.DrawCircle:
            DrawTool.DrawCircle(go.transform, go.transform.position, d.radius);
            break;

        case DrawType.DrawRectangle:
            DrawTool.DrawRectangle(go.transform, go.transform.position, d.length, d.width);
            break;

        case DrawType.DrawRectangle2D:
            DrawTool.DrawRectangle2D(go.transform, d.distance, d.length, d.width);
            break;

        case DrawType.DrawSectorSolid:
            tempGo = DrawTool.DrawSectorSolid(go.transform, go.transform.position, d.angle, d.radius);
            break;

        case DrawType.DrawCircleSolid:
            tempGo = DrawTool.DrawCircleSolid(go.transform, go.transform.position, d.radius);
            break;

        case DrawType.DrawRectangleSolid:
            tempGo = DrawTool.DrawRectangleSolid(go.transform, go.transform.position, d.length, d.width);
            break;

        case DrawType.DrawRectangleSolid2D:
            //  DrawTool.DrawRectangleSolid2D(go.transform, d.distance, d.length, d.width);
            break;

        default:
            break;
        }
    }
Exemplo n.º 23
0
        private void repositoryItemButtonEdit1_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            DevExpress.XtraEditors.Controls.EditorButton btn = e.Button;
            switch (btn.Caption)
            {
            case "定位":
                DF3DApplication app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                int focusedRowHandle = this.gridView1.FocusedRowHandle;
                if (focusedRowHandle == -1)
                {
                    return;
                }
                DataRow dr = this.gridView1.GetDataRow(focusedRowHandle);
                if (dr["geo"] != null && dr["Name"] != null && dr["fcName"] != null)
                {
                    ISurfaceSymbol ss = new SurfaceSymbolClass();
                    ss.Color = 0xcc00ff00;
                    ICurveSymbol cs = new CurveSymbolClass();
                    cs.Color          = 0xff00ff00;
                    cs.Width          = -5;
                    ss.BoundarySymbol = cs;
                    ISimplePointSymbol ps = new SimplePointSymbol();
                    ps.Size      = SystemInfo.Instance.SymbolSize;
                    ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                    IGeometry objGeo = dr["geo"] as IGeometry;
                    IPoint    pt     = null;
                    if (objGeo.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                    {
                        double         x         = 0;
                        double         y         = 0;
                        double         z         = 0;
                        IMultiPolyline mPolyline = objGeo as IMultiPolyline;
                        for (int m = 0; m < mPolyline.GeometryCount; m++)
                        {
                            IPolyline polyline = mPolyline.GetPolyline(m);
                            IPoint    pttemp   = polyline.Midpoint;
                            x += pttemp.X;
                            y += pttemp.Y;
                            z += pttemp.Z;
                        }
                        x    = x / mPolyline.GeometryCount;
                        y    = y / mPolyline.GeometryCount;
                        z    = z / mPolyline.GeometryCount;
                        pt   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = x;
                        pt.Y = y;
                        pt.Z = z;
                        IRenderMultiPolyline rMPolyline = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolyline(mPolyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                        rMPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rMPolyline.Glow(8000);
                        this._listRender.Add(rMPolyline.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                    {
                        double        x        = 0;
                        double        y        = 0;
                        double        z        = 0;
                        IMultiPolygon mPolygon = objGeo as IMultiPolygon;
                        for (int m = 0; m < mPolygon.GeometryCount; m++)
                        {
                            IPolygon polygon = mPolygon.GetPolygon(m);
                            IPoint   pttemp  = polygon.Centroid;
                            x += pttemp.X;
                            y += pttemp.Y;
                            z += pttemp.Z;
                        }
                        x    = x / mPolygon.GeometryCount;
                        y    = y / mPolygon.GeometryCount;
                        z    = z / mPolygon.GeometryCount;
                        pt   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                        pt.X = x;
                        pt.Y = y;
                        pt.Z = z;
                        IRenderMultiPolygon rMPolygon = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(mPolygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                        rMPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rMPolygon.Glow(8000);
                        this._listRender.Add(rMPolygon.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPolyline)
                    {
                        IPolyline polyline = objGeo as IPolyline;
                        pt = polyline.Midpoint;
                        IRenderPolyline rPolyline = app.Current3DMapControl.ObjectManager.CreateRenderPolyline(polyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                        rPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rPolyline.Glow(8000);
                        this._listRender.Add(rPolyline.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPoint)
                    {
                        IPoint point = objGeo as IPoint;
                        pt = point;
                        IRenderPoint rPoint = app.Current3DMapControl.ObjectManager.CreateRenderPoint(point, ps, app.Current3DMapControl.ProjectTree.RootID);
                        rPoint.Glow(8000);
                        this._listRender.Add(rPoint.Guid);
                    }
                    else if (objGeo.GeometryType == gviGeometryType.gviGeometryPolygon)
                    {
                        IPolygon polygon = objGeo as IPolygon;
                        pt = polygon.Centroid;
                        IRenderPolygon rPolygon = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                        rPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                        rPolygon.Glow(8000);
                        this._listRender.Add(rPolygon.Guid);
                    }
                    else
                    {
                        return;
                    }

                    ITableLabel tl = DrawTool.CreateTableLabel1(1);
                    tl.TitleText = dr["fcName"].ToString();
                    tl.SetRecord(0, 0, dr["Name"].ToString());
                    tl.Position = pt;

                    this._listRender.Add(tl.Guid);

                    app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                }
                break;
            }
        }
Exemplo n.º 24
0
 private void BtnLinje_Click(object sender, EventArgs e)
 {
     ChangeToClickDetect();
     toolMethod = DrawLine;
 }
Exemplo n.º 25
0
 private void PickEdgeTool(object sender, RoutedEventArgs e)
 {
     tool = state.reset(DrawingState.Tool.DRAW_EDGE);
 }
Exemplo n.º 26
0
 private void Paint()
 {
     DrawTool.DoAction(_currentPoint);
     Repaint();
 }
Exemplo n.º 27
0
 private void PickRemoveEdgeTool(object sender, RoutedEventArgs e)
 {
     tool = state.reset(DrawingState.Tool.REMOVE_EDGE);
 }
Exemplo n.º 28
0
        public static Image GetPreview(int id)
        {
            HItemConfig hItemConfig = ConfigData.GetHItemConfig(id);

            if (hItemConfig.Id <= 0)
            {
                return(DrawTool.GetImageByString("unknown", 100));
            }

            ControlPlus.TipImage tipData = new ControlPlus.TipImage();
            tipData.AddTextNewLine(hItemConfig.Name, HSTypes.I2RareColor(hItemConfig.Rare), 20);
            if (hItemConfig.IsUsable)
            {
                if (hItemConfig.SubType == HItemTypes.Fight)
                {
                    tipData.AddTextNewLine("       战斗中双击使用", "Red");
                }
                else if (hItemConfig.SubType == HItemTypes.Seed)
                {
                    tipData.AddTextNewLine("       农场中双击使用", "Red");
                }
                else
                {
                    tipData.AddTextNewLine("       双击使用", "Green");
                }
            }
            else if (hItemConfig.SubType == HItemTypes.Task)
            {
                tipData.AddTextNewLine("       任务物品", "DarkBlue");
            }
            else if (hItemConfig.SubType == HItemTypes.Material)
            {
                tipData.AddTextNewLine(string.Format("       材料(稀有度:{0})", hItemConfig.Rare), "White");
            }
            else
            {
                tipData.AddTextNewLine("", "White");
            }
            tipData.AddTextNewLine(string.Format("       等级:{0}", hItemConfig.Level), "White");
            tipData.AddTextNewLine("", "White");
            tipData.AddTextLines(hItemConfig.Descript, "White", 20, true);
            if (hItemConfig.SubType == HItemTypes.RandomCard)
            {
                var consumerConfig = ConfigData.GetItemConsumerConfig(hItemConfig.Id);
                int totalRate      = 0;
                foreach (var rate in consumerConfig.RandomCardRate)
                {
                    totalRate += rate;
                }
                tipData.AddLine();
                tipData.AddTextNewLine("抽卡概率", "White");
                tipData.AddTextNewLine("", "White");
                tipData.AddImage(HSIcons.GetIconsByEName("gem5"));
                tipData.AddText(string.Format("{0:0}%  ", (float)consumerConfig.RandomCardRate[3] * 100 / totalRate), "White");
                tipData.AddImage(HSIcons.GetIconsByEName("gem4"));
                tipData.AddText(string.Format("{0:0}%  ", (float)consumerConfig.RandomCardRate[2] * 100 / totalRate), "White");
                tipData.AddLine();
            }
            tipData.AddTextNewLine(string.Format("出售价格:{0}", GameResourceBook.InGoldSellItem(hItemConfig.Rare, hItemConfig.ValueFactor)), "Yellow");
            tipData.AddImage(HSIcons.GetIconsByEName("res1"));
            tipData.AddImageXY(GetHItemImage(id), 8, 8, 48, 48, 7, 24, 32, 32);

            return(tipData.Image);
        }
Exemplo n.º 29
0
 private void PickRemoveVertexTool(object sender, RoutedEventArgs e)
 {
     tool = state.reset(DrawingState.Tool.REMOVE_VERTEX);
 }
Exemplo n.º 30
0
        }                                //中心图片缩放


        public override void ShowTip(ImageToolTip tooltip, Control form, int x, int y)
        {
            var    regionType = GetVType();
            string resStr     = "";

            if (regionType == ImageRegionCellType.Gold)
            {
                resStr = string.Format("黄金:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Lumber)
            {
                resStr = string.Format("木材:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Stone)
            {
                resStr = string.Format("石材:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Mercury)
            {
                resStr = string.Format("水银:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Carbuncle)
            {
                resStr = string.Format("红宝石:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Sulfur)
            {
                resStr = string.Format("硫磺:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Gem)
            {
                resStr = string.Format("水晶:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Food)
            {
                resStr = string.Format("食物:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Health)
            {
                resStr = string.Format("生命:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Mental)
            {
                resStr = string.Format("精神:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Exp)
            {
                resStr = string.Format("经验值:{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Str)
            {
                resStr = string.Format("力量(副本属性)+{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Agi)
            {
                resStr = string.Format("敏捷(副本属性)+{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Intl)
            {
                resStr = string.Format("智慧(副本属性)+{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Perc)
            {
                resStr = string.Format("感知(副本属性)+{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.Endu)
            {
                resStr = string.Format("耐力(副本属性)+{0}", Parm);
            }
            else if (regionType == ImageRegionCellType.BuildEp)
            {
                resStr = string.Format("城堡建筑能量+{0}", Parm);
            }

            tooltip.Show(DrawTool.GetImageByString(resStr, 120), form, x, y);
        }
Exemplo n.º 31
0
        private void GetData()
        {
            if (this.cbLayer.SelectedItem == null)
            {
                return;
            }
            DF3DFeatureClass dffc = this.cbLayer.SelectedItem as DF3DFeatureClass;

            if (dffc == null)
            {
                return;
            }
            IFeatureClass fc = dffc.GetFeatureClass();

            if (fc == null)
            {
                return;
            }

            if (_num > _count || _count == 0)
            {
                return;
            }

            ISpatialFilter filter = this._filter;

            filter.ResultBeginIndex = _num - 1;
            filter.ResultLimit      = 1;
            IFdeCursor cursor = null;
            IRowBuffer row    = null;

            try
            {
                cursor = fc.Search(filter, false);
                if ((row = cursor.NextRow()) != null)
                {
                    #region 定位
                    int             geoindex = row.FieldIndex("Geometry");
                    DF3DApplication app      = DF3DApplication.Application;
                    if (geoindex != -1 && !row.IsNull(geoindex) && app != null && app.Current3DMapControl != null)
                    {
                        ISurfaceSymbol ss = new SurfaceSymbolClass();
                        ss.Color = 0xcc00ff00;
                        ICurveSymbol cs = new CurveSymbolClass();
                        cs.Color          = 0xff00ff00;
                        cs.Width          = -5;
                        ss.BoundarySymbol = cs;
                        ISimplePointSymbol ps = new SimplePointSymbol();
                        ps.Size      = SystemInfo.Instance.SymbolSize;
                        ps.FillColor = Convert.ToUInt32(SystemInfo.Instance.FillColor, 16);
                        IGeometry geo  = row.GetValue(geoindex) as IGeometry;
                        IPoint    ptTL = null;
                        if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                        {
                            double         x         = 0;
                            double         y         = 0;
                            double         z         = 0;
                            IMultiPolyline mPolyline = geo as IMultiPolyline;
                            for (int m = 0; m < mPolyline.GeometryCount; m++)
                            {
                                IPolyline polyline = mPolyline.GetPolyline(m);
                                IPoint    pttemp   = polyline.Midpoint;
                                x += pttemp.X;
                                y += pttemp.Y;
                                z += pttemp.Z;
                            }
                            x      = x / mPolyline.GeometryCount;
                            y      = y / mPolyline.GeometryCount;
                            z      = z / mPolyline.GeometryCount;
                            ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            ptTL.X = x;
                            ptTL.Y = y;
                            ptTL.Z = z;
                            IRenderMultiPolyline rMPolyline = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolyline(mPolyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                            rMPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rMPolyline.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rMPolyline.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rMPolyline.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                        {
                            double        x        = 0;
                            double        y        = 0;
                            double        z        = 0;
                            IMultiPolygon mPolygon = geo as IMultiPolygon;
                            for (int m = 0; m < mPolygon.GeometryCount; m++)
                            {
                                IPolygon polygon = mPolygon.GetPolygon(m);
                                IPoint   pttemp  = polygon.Centroid;
                                x += pttemp.X;
                                y += pttemp.Y;
                                z += pttemp.Z;
                            }
                            x      = x / mPolygon.GeometryCount;
                            y      = y / mPolygon.GeometryCount;
                            z      = z / mPolygon.GeometryCount;
                            ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            ptTL.X = x;
                            ptTL.Y = y;
                            ptTL.Z = z;
                            IRenderMultiPolygon rMPolygon = app.Current3DMapControl.ObjectManager.CreateRenderMultiPolygon(mPolygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                            rMPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rMPolygon.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rMPolygon.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rMPolygon.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPolyline)
                        {
                            IPolyline polyline = geo as IPolyline;
                            ptTL = polyline.Midpoint;
                            IRenderPolyline rPolyline = app.Current3DMapControl.ObjectManager.CreateRenderPolyline(polyline, cs, app.Current3DMapControl.ProjectTree.RootID);
                            rPolyline.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rPolyline.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPolyline.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPolyline.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPoint)
                        {
                            IPoint point = geo as IPoint;
                            ptTL = point;
                            IRenderPoint rPoint = app.Current3DMapControl.ObjectManager.CreateRenderPoint(point, ps, app.Current3DMapControl.ProjectTree.RootID);
                            rPoint.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPoint.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPoint.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryPolygon)
                        {
                            IPolygon polygon = geo as IPolygon;
                            ptTL = polygon.Centroid;
                            IRenderPolygon rPolygon = app.Current3DMapControl.ObjectManager.CreateRenderPolygon(polygon, ss, app.Current3DMapControl.ProjectTree.RootID);
                            rPolygon.HeightStyle = gviHeightStyle.gviHeightOnEverything;
                            rPolygon.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(rPolygon.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(rPolygon.Guid, gviActionCode.gviActionJump);
                        }
                        else if (geo.GeometryType == gviGeometryType.gviGeometryModelPoint)
                        {
                            ptTL = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                            IModelPoint mp = geo as IModelPoint;
                            ptTL.X = mp.X;
                            ptTL.Y = mp.Y;
                            ptTL.Z = mp.Z;
                            IModelPointSymbol mps = new ModelPointSymbol();
                            mps.SetResourceDataSet(fc.FeatureDataSet);
                            IRenderGeometry render = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(mp, mps, app.Current3DMapControl.ProjectTree.RootID);
                            render.Glow(8000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(render.Guid, 8000);
                            app.Current3DMapControl.Camera.FlyToObject(render.Guid, gviActionCode.gviActionJump);
                        }
                        if (ptTL != null)
                        {
                            ITableLabel tl = DrawTool.CreateTableLabel1(1);
                            tl.TitleText = "属性查询";
                            tl.SetRecord(0, 0, dffc.ToString());
                            if (ptTL != null)
                            {
                                tl.Position = ptTL;
                            }
                            app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                            app.Current3DMapControl.ObjectManager.DelayDelete(tl.Guid, 8000);
                        }
                    }
                    #endregion
                    FacilityClass facc = dffc.GetFacilityClass();
                    if (facc == null)
                    {
                        IFieldInfoCollection fiCol = fc.GetFields();
                        for (int i = 0; i < fiCol.Count; i++)
                        {
                            IFieldInfo fi  = fiCol.Get(i);
                            object     obj = row.GetValue(i);
                            string     str = "";
                            switch (fi.FieldType)
                            {
                            case gviFieldType.gviFieldBlob:
                            case gviFieldType.gviFieldUnknown:
                            case gviFieldType.gviFieldGeometry:
                                continue;

                            case gviFieldType.gviFieldFloat:
                            case gviFieldType.gviFieldDouble:
                                double d;
                                if (double.TryParse(obj.ToString(), out d))
                                {
                                    str = d.ToString("0.00");
                                }
                                break;

                            default:
                                str = obj.ToString();
                                break;
                            }
                            DataRow dr = this._dtShow.NewRow();
                            dr["Property"] = string.IsNullOrEmpty(fi.Alias) ? fi.Name : fi.Alias;
                            dr["Value"]    = str;
                            this._dtShow.Rows.Add(dr);
                        }
                    }
                    else
                    {
                        List <DFDataConfig.Class.FieldInfo> facFields = facc.FieldInfoCollection;
                        if (facFields != null)
                        {
                            foreach (DFDataConfig.Class.FieldInfo facField in facFields)
                            {
                                if (!facField.CanQuery)
                                {
                                    continue;
                                }
                                int index = row.FieldIndex(facField.Name);
                                if (index != -1 && !row.IsNull(index))
                                {
                                    object     obj  = row.GetValue(index);
                                    string     str  = "";
                                    IFieldInfo fiFC = row.Fields.Get(index);
                                    switch (fiFC.FieldType)
                                    {
                                    case gviFieldType.gviFieldBlob:
                                    case gviFieldType.gviFieldUnknown:
                                    case gviFieldType.gviFieldGeometry:
                                        continue;

                                    case gviFieldType.gviFieldFloat:
                                    case gviFieldType.gviFieldDouble:
                                        double d;
                                        if (double.TryParse(obj.ToString(), out d))
                                        {
                                            str = d.ToString("0.00");
                                        }
                                        break;

                                    default:
                                        str = obj.ToString();
                                        break;
                                    }
                                    DataRow dr = this._dtShow.NewRow();
                                    dr["Property"] = facField.ToString();
                                    dr["Value"]    = str;
                                    this._dtShow.Rows.Add(dr);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                if (cursor != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                    cursor = null;
                }
                if (row != null)
                {
                    System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                    row = null;
                }
            }
        }
Exemplo n.º 32
0
 private void SetTool(ToolStripButton btn, DrawTool tool)
 {
     if (btn.Checked)
     {
         SelectedTool = tool;
         UncheckOtherTools(btn);
     }
     else
         btn.Checked = true;
 }
Exemplo n.º 33
0
        public void SetCursorForTool(DrawTool tool)
        {
            string cursorStr = null;
            Gdk.Cursor cursor = null;

            switch (tool) {
            case DrawTool.Line:
                cursorStr = "arrow";
                break;
            case DrawTool.Cross:
                cursorStr = "cross";
                break;
            case DrawTool.Text:
                cursorStr = "text";
                break;
            case DrawTool.Counter:
                cursorStr = "number";
                break;
            case DrawTool.Ellipse:
            case DrawTool.CircleArea:
                cursorStr = "ellipse";
                break;
            case DrawTool.Rectangle:
            case DrawTool.RectangleArea:
                cursorStr = "rect";
                break;
            case DrawTool.Angle:
                cursorStr = "angle";
                break;
            case DrawTool.Pen:
                cursorStr = "freehand";
                break;
            case DrawTool.Eraser:
                cursorStr = "eraser";
                break;
            case DrawTool.Player:
                cursorStr = "player";
                break;
            case DrawTool.Zoom:
                cursorStr = "zoom";
                break;
            case DrawTool.CanMove:
                cursorStr = "hand_opened";
                break;
            case DrawTool.Move:
                cursorStr = "hand_closed";
                break;
            case DrawTool.Selection:
                cursorStr = "hand_select";
                break;
            default:
                cursor = null;
                break;
            }
            if (cursorStr == null) {
                widget.GdkWindow.Cursor = cursor;
            } else {
                Image img = Image.LoadFromFile (Path.Combine (Config.ImagesDir, "cursors", cursorStr));
                Cursor c = new Cursor (widget.Display, img.Value, 0, 0);
                widget.GdkWindow.Cursor = c;
            }
        }
Exemplo n.º 34
0
 private void SetBackColor()
 {
     backColor = DrawTool.ConvertColor(Parent.BackColor, 0.9);
     this.textBox1.BackColor = backColor;
 }
Exemplo n.º 35
0
        private void GetData()
        {
            string   whereClause = _dict[_currentClass];
            SubClass sc          = _currentClass;

            if (sc.Parent == null)
            {
                return;
            }
            string[] arrFc3DId = sc.Parent.Fc3D.Split(';');
            if (arrFc3DId == null)
            {
                return;
            }
            foreach (string fc3DId in arrFc3DId)
            {
                DF3DFeatureClass dffc = DF3DFeatureClassManager.Instance.GetFeatureClassByID(fc3DId);
                if (dffc == null)
                {
                    continue;
                }
                FacilityClass facc = dffc.GetFacilityClass();
                IFeatureClass fc   = dffc.GetFeatureClass();
                if (fc == null || facc == null || facc.Name != this._facType)
                {
                    continue;
                }
                List <DFDataConfig.Class.FieldInfo> facFields = facc.FieldInfoCollection;
                if (facFields == null || facFields.Count == 0)
                {
                    return;
                }

                ISpatialFilter filter = new SpatialFilter();
                filter.SpatialRel    = gviSpatialRel.gviSpatialRelIntersects;
                filter.Geometry      = this._geo;
                filter.GeometryField = "FootPrint";
                filter.WhereClause   = whereClause;
                _count = fc.GetCount(filter);
                if (_num > _count || _count == 0)
                {
                    return;
                }

                filter.ResultBeginIndex = _num - 1;
                filter.ResultLimit      = 1;
                IFdeCursor cursor = null;
                IRowBuffer row    = null;
                try
                {
                    cursor = fc.Search(filter, false);
                    if ((row = cursor.NextRow()) != null)
                    {
                        #region 定位
                        int geoindex = row.FieldIndex("Geometry");
                        if (geoindex == -1 || !(row.GetValue(geoindex) is IModelPoint))
                        {
                            continue;
                        }
                        DF3DApplication app = DF3DApplication.Application;
                        if (app != null && app.Current3DMapControl != null)
                        {
                            IModelPoint       geo = row.GetValue(geoindex) as IModelPoint;
                            IModelPointSymbol mps = new ModelPointSymbol();
                            mps.SetResourceDataSet(fc.FeatureDataSet);
                            IRenderGeometry render = app.Current3DMapControl.ObjectManager.CreateRenderModelPoint(geo, mps, app.Current3DMapControl.ProjectTree.RootID);
                            //app.Current3DMapControl.Camera.FlyToObject(render.Guid, gviActionCode.gviActionJump);
                            render.Glow(5000);
                            app.Current3DMapControl.ObjectManager.DelayDelete(render.Guid, 5000);

                            ITableLabel tl = DrawTool.CreateTableLabel1(1);
                            tl.TitleText = "属性查询";
                            tl.SetRecord(0, 0, dffc.ToString());
                            IPoint ptTL          = null;
                            int    geoshapeindex = row.FieldIndex("Shape");
                            if (geoshapeindex != -1)
                            {
                                if (!row.IsNull(geoshapeindex))
                                {
                                    IGeometry geoShape = row.GetValue(geoshapeindex) as IGeometry;
                                    if (geoShape.GeometryType == gviGeometryType.gviGeometryMultiPolyline)
                                    {
                                        double         x         = 0;
                                        double         y         = 0;
                                        double         z         = 0;
                                        IMultiPolyline mPolyline = geoShape as IMultiPolyline;
                                        for (int m = 0; m < mPolyline.GeometryCount; m++)
                                        {
                                            IPolyline polyline = mPolyline.GetPolyline(m);
                                            IPoint    pttemp   = polyline.Midpoint;
                                            x += pttemp.X;
                                            y += pttemp.Y;
                                            z += pttemp.Z;
                                        }
                                        x      = x / mPolyline.GeometryCount;
                                        y      = y / mPolyline.GeometryCount;
                                        z      = z / mPolyline.GeometryCount;
                                        ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                                        ptTL.X = x;
                                        ptTL.Y = y;
                                        ptTL.Z = z;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryMultiPolygon)
                                    {
                                        double        x        = 0;
                                        double        y        = 0;
                                        double        z        = 0;
                                        IMultiPolygon mPolygon = geoShape as IMultiPolygon;
                                        for (int m = 0; m < mPolygon.GeometryCount; m++)
                                        {
                                            IPolygon polygon = mPolygon.GetPolygon(m);
                                            IPoint   pttemp  = polygon.Centroid;
                                            x += pttemp.X;
                                            y += pttemp.Y;
                                            z += pttemp.Z;
                                        }
                                        x      = x / mPolygon.GeometryCount;
                                        y      = y / mPolygon.GeometryCount;
                                        z      = z / mPolygon.GeometryCount;
                                        ptTL   = (new GeometryFactory()).CreatePoint(gviVertexAttribute.gviVertexAttributeZ);
                                        ptTL.X = x;
                                        ptTL.Y = y;
                                        ptTL.Z = z;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPolyline)
                                    {
                                        ptTL = (geoShape as IPolyline).Midpoint;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPoint)
                                    {
                                        ptTL = geoShape as IPoint;
                                    }
                                    else if (geoShape.GeometryType == gviGeometryType.gviGeometryPolygon)
                                    {
                                        ptTL = (geoShape as IPolygon).Centroid;
                                    }
                                }
                            }
                            if (ptTL != null)
                            {
                                tl.Position = ptTL;
                            }
                            else
                            {
                                tl.Position = geo;
                            }
                            app.Current3DMapControl.Camera.FlyToObject(tl.Guid, gviActionCode.gviActionFlyTo);
                            app.Current3DMapControl.ObjectManager.DelayDelete(tl.Guid, 5000);
                        }

                        #endregion

                        foreach (DFDataConfig.Class.FieldInfo facField in facFields)
                        {
                            if (!facField.CanQuery)
                            {
                                continue;
                            }
                            int index = row.FieldIndex(facField.Name);
                            if (index != -1 && !row.IsNull(index))
                            {
                                object     obj  = row.GetValue(index);
                                string     str  = "";
                                IFieldInfo fiFC = row.Fields.Get(index);
                                switch (fiFC.FieldType)
                                {
                                case gviFieldType.gviFieldBlob:
                                case gviFieldType.gviFieldUnknown:
                                case gviFieldType.gviFieldGeometry:
                                    continue;

                                case gviFieldType.gviFieldFloat:
                                case gviFieldType.gviFieldDouble:
                                    double d;
                                    if (double.TryParse(obj.ToString(), out d))
                                    {
                                        str = d.ToString("0.00");
                                    }
                                    break;

                                default:
                                    str = obj.ToString();
                                    break;
                                }
                                DataRow dr = this._dtShow.NewRow();
                                dr["Property"] = facField.ToString();
                                dr["Value"]    = str;
                                this._dtShow.Rows.Add(dr);
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    if (cursor != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(cursor);
                        cursor = null;
                    }
                    if (row != null)
                    {
                        System.Runtime.InteropServices.Marshal.ReleaseComObject(row);
                        row = null;
                    }
                }
            }
        }
Exemplo n.º 36
0
        public override void Run(object sender, EventArgs e)
        {
            try
            {
                app = DF3DApplication.Application;
                if (app == null || app.Current3DMapControl == null)
                {
                    return;
                }
                this._geoFact = new GeometryFactory();
                Map3DCommandManager.Push(this);
                DF3DFeatureClass dffc = CommonUtils.Instance().CurEditLayer;
                if (dffc != null)
                {
                    this._facType         = dffc.GetFacilityClassName();
                    _strGeometryFieldName = "";
                    if (this._facType == "PipeLine" || this._facType == "PipeNode" || this._facType == "PipeBuild" || this._facType == "PipeBuild1")
                    {
                        _strGeometryFieldName = "Shape";
                    }
                    else
                    {
                        IFeatureLayer fl = dffc.GetFeatureLayer();
                        if (fl != null)
                        {
                            _strGeometryFieldName = fl.GeometryFieldName;
                        }
                    }
                    if (!string.IsNullOrEmpty(_strGeometryFieldName))
                    {
                        IFeatureClass fc = dffc.GetFeatureClass();
                        if (fc != null)
                        {
                            IFieldInfoCollection fiCol = fc.GetFields();
                            int index = fiCol.IndexOf(_strGeometryFieldName);
                            if (index != -1)
                            {
                                IFieldInfo fi = fiCol.Get(index);
                                if (fi.GeometryDef != null)
                                {
                                    this._geoType = fi.GeometryDef.GeometryColumnType;
                                }
                            }
                        }
                        switch (this._geoType)
                        {
                        case gviGeometryColumnType.gviGeometryColumnModelPoint:
                            //添加方式:1、鼠标添加;2、文件添加
                            FrmInsertModel dlg = new FrmInsertModel();
                            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                            {
                                string filePath = dlg.FilePath;
                                string ext      = Path.GetExtension(filePath);
                                if (File.Exists(filePath))
                                {
                                    int insertType = dlg.InsertType;
                                    if (insertType == 0 && ext.ToLower() == ".osg")
                                    {
                                        this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType._3DModel);
                                        if (this._drawTool != null)
                                        {
                                            (this._drawTool as Draw3DModel).Set3DModelFilePath(filePath);
                                            this._drawTool.OnStartDraw    += new OnStartDraw(this.OnStartDraw);
                                            this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw);
                                            this._drawTool.Start();
                                        }
                                    }
                                    else if (insertType == 1 && ext.ToLower() == ".xml")
                                    {
                                    }
                                }
                            }
                            break;

                        case gviGeometryColumnType.gviGeometryColumnPoint:
                            if (this._facType == "PipeNode")
                            {    // 添加附属设施或者管点
                            }
                            else
                            {    // 添加点
                                this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Point);
                                if (this._drawTool != null)
                                {
                                    this._drawTool.OnStartDraw    += new OnStartDraw(this.OnStartDraw);
                                    this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw);
                                    this._drawTool.Start();
                                }
                            }
                            break;

                        case gviGeometryColumnType.gviGeometryColumnPolyline:
                            if (this._facType == "PipeLine" || this._facType == "PipeBuild" || this._facType == "PipeBuild1")
                            {    // 选择管线或辅助样式
                            }
                            else
                            {    // 添加线
                                this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Polyline);
                                if (this._drawTool != null)
                                {
                                    this._drawTool.OnStartDraw    += new OnStartDraw(this.OnStartDraw);
                                    this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw);
                                    this._drawTool.Start();
                                }
                            }
                            break;

                        case gviGeometryColumnType.gviGeometryColumnPolygon:
                            if (this._facType == "PipeBuild" || this._facType == "PipeBuild1")
                            {    // 选择管线辅助样式
                            }
                            else
                            {    // 添加面
                                this._drawTool = DrawToolService.Instance.CreateDrawTool(DrawType.Polygon);
                                if (this._drawTool != null)
                                {
                                    this._drawTool.OnStartDraw    += new OnStartDraw(this.OnStartDraw);
                                    this._drawTool.OnFinishedDraw += new OnFinishedDraw(this.OnFinishedDraw);
                                    this._drawTool.Start();
                                }
                            }
                            break;

                        default:
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
        }
Exemplo n.º 37
0
    public override void ToolBar()
    {
        base.ToolBar();

        GUILayout.Box("Misc", EditorStyles.toolbarDropDown);
        Rect miscRect = GUILayoutUtility.GetLastRect();

        if (MyGUI.ButtonMouseDown(miscRect))
        {
            var misc = PopupWindow.ShowAtPosition <MiscPopup>(new Rect(miscRect.x, miscRect.y + miscRect.height, 120f, 60));
            misc.Setup(TilerMap);
        }

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        GUI.enabled = TilerMapEditFunctions.Undo.IsUndo();
        if (GUILayout.Button("<", EditorStyles.toolbarButton))
        {
            TilerMapEditFunctions.Undo.PerformUndo();
            Repaint();
        }
        GUI.enabled = TilerMapEditFunctions.Undo.IsRedo();
        if (GUILayout.Button(">", EditorStyles.toolbarButton))
        {
            TilerMapEditFunctions.Undo.PerformRedo();
            Repaint();
        }
        GUI.enabled = true;

        EditorGUILayout.Space();
        EditorGUILayout.Space();
        EditorGUILayout.Space();

        if (MyGUI.HasToggledPositive(DrawTool is PaintTool, "P", EditorStyles.toolbarButton))
        {
            DrawTool = new PaintTool(this, DrawTool.GetBrush() as NormalBrush);
            Repaint();
        }
        if (MyGUI.HasToggledPositive(DrawTool is FillTool, "F", EditorStyles.toolbarButton))
        {
            DrawTool = new FillTool(this, DrawTool.GetBrush() as NormalBrush);
            Repaint();
        }
        if (MyGUI.HasToggledPositive(DrawTool is ReplaceTool, "R", EditorStyles.toolbarButton))
        {
            DrawTool = new ReplaceTool(this, DrawTool.GetBrush() as NormalBrush);
            Repaint();
        }

        EditorGUILayout.Space();

        if (GUILayout.Button("O", EditorStyles.toolbarButton))
        {
            var p = _camera.transform.position;
            p.x = 0;
            p.z = 0;
            _camera.transform.position = p;
        }

        EditorGUILayout.Space();

        //var currentIndex = _mapIndex;
        //_mapIndex = EditorGUILayout.Popup(_mapIndex, _mapNames, EditorStyles.toolbarPopup);

        //options = new[] { "CanJump", "CanShoot", "CanSwim" };
        //flags = EditorGUILayout.MaskField("Layers", 1, options, EditorStyles.toolbarPopup);

        GUILayout.Box("Layers", EditorStyles.toolbarDropDown);
        Rect last = GUILayoutUtility.GetLastRect();

        if (MyGUI.ButtonMouseDown(last))
        {
            var height = 20 * _tilerMaps.Count + 20;// +25;

            var lp = PopupWindow.ShowAtPosition <LayerPopup>(new Rect(last.x, last.y + last.height, 150f, height));
            lp.Setup(_mapIndex, _mapMask, _tilerMaps, SetMapChange, SetMapMask, Save);
            GUIUtility.ExitGUI();
        }

        /*if (currentIndex != _mapIndex)
         * {
         *  Save();
         *  SetMap(_mapIndex);
         * }*/
    }
Exemplo n.º 38
0
 protected virtual void OnDrawingtoolbox1DrawToolChanged(DrawTool tool)
 {
     drawingwidget1.DrawTool = tool;
 }
Exemplo n.º 39
0
    private void MouseEvents()
    {
        var e = Event.current;

        var rect = Parent.position;

        rect.x      += 2;
        rect.y      += ToolbarHeight + 2;
        rect.width  -= RightWidth + 4;
        rect.height -= ToolbarHeight + 4;

        var mousePos = GUIUtility.GUIToScreenPoint(e.mousePosition);

        if (!rect.Contains(mousePos))
        {
            return;
        }

        // Left mouse button events
        if (Event.current.button == 0 && !NoRightMouseAltInput())
        {
            if (e.type == EventType.MouseDown)
            {
                TilerMapEditFunctions.Undo.NewUndo();

                Paint();
                _lastPlaced = _currentPoint;
                _isPainting = true;
            }
            if (e.type == EventType.MouseDrag)
            {
                if (_isPainting && _lastPlaced != _currentPoint)
                {
                    Paint();
                    _lastPlaced = _currentPoint;
                }
            }
        }

        // Right mouse button events
        if (Event.current.button == 1 || NoRightMouseAltInput())
        {
            if (e.type == EventType.MouseDown)
            {
                _isDraggingCopy = true;
                _startCopyPoint = _currentPoint;
            }
            if (e.type == EventType.MouseUp)
            {
                if (_isDraggingCopy)
                {
                    var properties = new List <Brush>();

                    var start = new Point
                    {
                        X = Math.Min(_currentPoint.X, _startCopyPoint.X),
                        Y = Math.Min(_currentPoint.Y, _startCopyPoint.Y)
                    };

                    var count = new Point
                    {
                        X = Math.Abs(_currentPoint.X - _startCopyPoint.X) + 1,
                        Y = Math.Abs(_currentPoint.Y - _startCopyPoint.Y) + 1
                    };

                    for (var y = start.Y; y < start.Y + count.Y; y++)
                    {
                        for (var x = start.X; x < start.X + count.X; x++)
                        {
                            var p = new Point(x, y);
                            properties.Add(TilerMap.GetTileBrush(p));
                        }
                    }

                    var copy = new CopyBrush(properties.ToArray(), new Point(count.X, count.Y));

                    if (DrawTool is PaintTool)
                    {
                        DrawTool.SetBrush(copy);
                    }
                    else
                    {
                        DrawTool = new PaintTool(this, copy);
                    }

                    Repaint();

                    _isDraggingCopy = false;
                }
            }
        }

        if (e.type == EventType.MouseDrag)
        {
            if (Event.current.button == 2)
            {
                PanWindow();
                Repaint();
            }
        }
        else if (e.type == EventType.ScrollWheel)
        {
            _height += Event.current.delta.y / 10f;
            _height  = Mathf.Clamp(_height, -1, 5);
            SetCameraHeight();
            Repaint();
        }

        if (e.type == EventType.MouseDrag || e.type == EventType.MouseMove || e.type == EventType.ScrollWheel)
        {
            GetGridPoint();
        }
    }
Exemplo n.º 40
0
 private void BtnRektangel_Click(object sender, EventArgs e)
 {
     ChangeToClickDetect();
     toolMethod = DrawRectangle;
 }
Exemplo n.º 41
0
    private void DrawSelectionBox()
    {
        var tileSize = TilerMap.CellSize / TilerMap.TilesPerCell;
        var offset   = new Vector2(TilerMap.transform.position.x, TilerMap.transform.position.z);

        if (_isDraggingCopy)
        {
            var start = new Point
            {
                X = Math.Min(_currentPoint.X, _startCopyPoint.X),
                Y = Math.Min(_currentPoint.Y, _startCopyPoint.Y)
            };

            var count = new Point
            {
                X = Math.Abs(_currentPoint.X - _startCopyPoint.X) + 1,
                Y = Math.Abs(_currentPoint.Y - _startCopyPoint.Y) + 1
            };

            var p = new Vector2(start.X * TilerMap.TileSize, start.Y * TilerMap.TileSize) + offset - new Vector2(tileSize / 2f, tileSize / 2f);

            var y = TilerMap.transform.position.y;

            // /2 for int round
            var right = count.X * tileSize;
            var top   = count.Y * tileSize;

            var verts = new[]
            {
                new Vector3(p.x, y, p.y),
                new Vector3(p.x, y, p.y + top),
                new Vector3(p.x + right, y, p.y + top),
                new Vector3(p.x + right, y, p.y)
            };

            Handles.DrawSolidRectangleWithOutline(verts, new Color(1, 1, 1, 0.2f), Color.white);
        }
        else
        {
            var p = new Vector2(_currentPoint.X * TilerMap.TileSize, _currentPoint.Y * TilerMap.TileSize) + offset;
            var y = TilerMap.transform.position.y;
            var r = tileSize / 2f;

            var brush = DrawTool.GetBrush();

            // /2 for int round
            var right  = r + (brush.BrushSize.X / 2) * 2 * r;
            var left   = r + ((brush.BrushSize.X - 1) / 2) * 2 * r;
            var top    = r + (brush.BrushSize.Y / 2) * 2 * r;
            var bottom = r + ((brush.BrushSize.Y - 1) / 2) * 2 * r;



            var verts = new[]
            {
                new Vector3(p.x - left, y, p.y - bottom),
                new Vector3(p.x - left, y, p.y + top),
                new Vector3(p.x + right, y, p.y + top),
                new Vector3(p.x + right, y, p.y - bottom)
            };

            Handles.DrawSolidRectangleWithOutline(verts, new Color(1, 1, 1, 0.2f), Color.white);
        }
    }
Exemplo n.º 42
0
 private void BtnEllips_Click(object sender, EventArgs e)
 {
     ChangeToClickDetect();
     toolMethod = DrawEllipse;
 }
Exemplo n.º 43
0
        void DrawToolsPanel_CheckedChanged(object sender, EventArgs e)
        {
            if (sender is RadioButton)
            {
                RadioButton rb = sender as RadioButton;
                if (rb.Tag == null)
                    return;

                DrawTool drawTool;
                drawTool = (DrawTool)Int32.Parse(rb.Tag.ToString());

                _selectedTool = drawTool;

                if (DrawToolChanged != null)
                    DrawToolChanged(this, new DrawPanelToolsChangedEventsArgs(drawTool));
            }
        }