Ejemplo n.º 1
0
        private void Document_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            int idx = 0;

            MapToolRender.MapObject mapObj = null;
            switch (e.PropertyName)
            {
            case "MapObjects":
                mapObj = sender as MapToolRender.MapObject;
                if (Doc.Document.Instance.MapObjects.Contains(mapObj))
                {
                    mapObjects.Add(mapObj);
                    mapObj.PropertyChanged += MapObj_PropertyChanged;
                    mapObjects.ResetBindings();
                }
                break;

            case "SelectedObject":
                mapObj = Doc.Document.Instance.SelectedObject as MapToolRender.MapObject;
                if (mapObj == null)
                {
                    return;
                }
                if (mapObjects.Contains(mapObj))
                {
                    listBox1.SelectedItem = mapObj;
                }
                break;
            }
        }
Ejemplo n.º 2
0
        private void DuplicateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var items = listBox1.SelectedItems;

            if (items.Count <= 0)
            {
                return;
            }

            var objArray = new MapToolRender.MapObject[items.Count];

            items.CopyTo(objArray, 0);
            foreach (var obj in objArray)
            {
                var o = obj as MapToolRender.RenderObject;
                if (o == null)
                {
                    continue;
                }
                var newObj = o.Clone();
                if (newObj == null)
                {
                    continue;
                }
                Doc.Document.Instance.AddObject(newObj);
                //TODO: 트리에서 복제되었을 때 메인 프레임에서 삭제되었음을 알 수 있게 처리 해야함
            }
        }
Ejemplo n.º 3
0
        private void DeleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listBox1.SelectedItems.Count <= 0)
            {
                return;
            }
            var items = new MapToolRender.MapObject[listBox1.SelectedItems.Count];

            listBox1.SelectedItems.CopyTo(items, 0);
            foreach (var item in items)
            {
                if (Doc.Document.Instance.MapObjects.Contains(item))
                {
                    Doc.Document.Instance.RemoveObject(item);
                    mapObjects.Remove(item);
                }
            }
            mapObjects.ResetBindings();
        }