示例#1
0
        private void AddBranchLayerAndTool()
        {
            var branches = new EventedList<IBranch>();
            branchLayer.DataSource = new FeatureCollection(branches, typeof(Branch));

            //reachLayer.VectorLayer.Name = "reaches";
            branchLayer.Enabled = true;
            branchLayer.Style = new VectorStyle
                                    {
                                        Fill = new SolidBrush(Color.Tomato),
                                        Symbol = null,
                                        Line = new Pen(Color.Turquoise, 3)
                                    };
            mapControl.Map.Layers.Insert(0, branchLayer);

            var newLineTool = new NewLineTool(branchLayer) {AutoCurve = true, MinDistance = 0};
            mapControl.Tools.Add(newLineTool);
            //newLineTool.EditorLayer = reachLayer;

            //BranchNodeTopology t = new BranchNodeTopology();

            //t.Branches = reachLayer.DataSource;
            //t.Nodes = nodeLayer.DataSource;
            // MoveTool.Endoperation += t.endMove();

        }
        public void CollectionChangedReplaceDataItemsResultInCollectionChangedForAdapter()
        {
            //create a list of dataItem containing urls
            IEventedList<IDataItem> dataItems = new EventedList<IDataItem>();
            var oldUrl = new Url();
            var newUrl = new Url();
            var dataItem = new DataItem(oldUrl);
            dataItems.Add(dataItem);

            //adapter for the list
            var adapter = new DataItemListAdapter<Url>(dataItems);

            int callCount = 0;
            adapter.CollectionChanged += (sender, e) =>
            {
                callCount++;
                Assert.AreEqual(NotifyCollectionChangedAction.Replace,e.Action);
                Assert.AreEqual(adapter, sender);
                Assert.AreEqual(newUrl, e.Item);
                //discutable but current eventedlist implementation does this
                Assert.AreEqual(-1, e.OldIndex);
                Assert.AreEqual(0, e.Index);
            };

            //action! replace one dataitem with another
            dataItems[0] = new DataItem(newUrl);
            Assert.AreEqual(1, callCount);
        }
示例#3
0
 public CollectionChangedAspectTestClass()
 {
     ListContainers = new EventedList<CollectionChangedAspectTestClass>();
     Integers = new EventedList<int>();
     NoBubblingIntegers = new EventedList<int>();
     Lists = new EventedList<IEventedList<int>>();
 }
示例#4
0
        public void CreateFromCollection()
        {
            EventedList<SampleFeature> features = new EventedList<SampleFeature>();

            features.Add(new SampleFeature());
            features.Add(new SampleFeature());
            features.Add(new SampleFeature());

            features[0].Geometry = GeometryFromWKT.Parse("LINESTRING (20 20, 20 30, 30 30, 30 20, 40 20)");
            features[1].Geometry = GeometryFromWKT.Parse("LINESTRING (30 30, 30 40, 40 40, 40 30, 50 30)");
            features[2].Geometry = GeometryFromWKT.Parse("LINESTRING (40 40, 40 50, 50 50, 50 40, 60 40)");

            FeatureCollection featureCollection = new FeatureCollection {Features = features};

            Map map = new Map();
            
            VectorLayer vectorLayer = new VectorLayer();
            vectorLayer.DataSource = featureCollection;
            
            map.Layers.Add(vectorLayer);

            Assert.AreEqual(3, vectorLayer.DataSource.GetFeatureCount());
            Assert.AreEqual("LineString", vectorLayer.DataSource.GetGeometryByID(0).GeometryType);

            // ShowMap(map);
        }
示例#5
0
        public void List_Clear()
        {
            var lst = new EventedList<string, string>("CONTEXT", false);

              var first = true;
              lst.GetReadOnlyEvent = (_) => false;

              lst.Add("a");
              lst.Add("b");
              lst.Add("c");

              Assert.AreEqual(3, lst.Count);

              lst.ChangeEvent = (l, ct, p, idx, v) =>
                            {
                              Assert.AreEqual( EventedList<string, string>.ChangeType.Clear, ct);
                              Assert.AreEqual( first ? EventPhase.Before : EventPhase.After, p);
                              Assert.AreEqual( -1, idx);
                              Assert.AreEqual( null, v);
                              first = false;
                            };

              lst.Clear();
              Assert.AreEqual( 0, lst.Count);
        }
示例#6
0
        /// <summary>
        /// Default Constructor
        /// </summary>
        /// <param name="manager"></param>
        public DetoxChatWindow(Manager manager)
            : base(manager)
        {
            // Initialize class properties..
            this._messages = new EventedList<ChatMessage>();
            this._messages.ItemAdded += ChatMessages_OnItemAdded;
            this._isBackgroundVisible = true;

            // Initialize base control..
            base.Init();
            base.Width = 350;
            base.Height = 150;
            base.Alpha = 255;
            base.MinimumWidth = 64;
            base.MinimumHeight = 64;
            base.CanFocus = true;
            base.Movable = true;
            base.Resizable = true;
            base.ClientArea.Draw += ClientArea_OnDraw;
            //
            //
            //
            this._chatInput = new TextBox(manager);
            this._chatInput.Init();
            this._chatInput.Anchor = Anchors.Left | Anchors.Right | Anchors.Bottom;
            this._chatInput.AutoSelection = false;
            this._chatInput.Detached = false;
            this._chatInput.Left = 0;
            this._chatInput.Top = base.Height - this._chatInput.Height;
            this._chatInput.Visible = true;
            this._chatInput.KeyDown += ChatInput_OnKeyDown;
            this._chatInput.FocusGained += ChatInput_OnFocusGained;
            this._chatInput.FocusLost += ChatInput_OnFocusLost;
            //
            //
            //
            this._chatScroller = new ScrollBar(manager, Orientation.Vertical)
                {
                    Anchor = Anchors.Right | Anchors.Top | Anchors.Bottom,
                    Left = base.Width - 16,
                    PageSize = 1,
                    Range = 1,
                    Top = 2,
                    Value = 0
                };
            this._chatScroller.ValueChanged += ChatScroller_OnValueChanged;
            this._chatScroller.Init();
            //
            //
            //
            base.Add(this._chatInput, false);
            base.Add(this._chatScroller, false);
            manager.Add(this);

            // Update the control positions..
            this.PositionControls();
            base.Left = 5;
            base.Top = Terraria.MainGame.Window.ClientBounds.Height - base.Height - 5;
        }
示例#7
0
        public void UpdateFolderParent()
        {
            Folder folder = new Folder();
            Folder childFolder = new Folder();
            EventedList<Folder>folders=new EventedList<Folder>();
            folders.Add(childFolder);
            folder.Folders = folders;
            Assert.AreEqual(folder, childFolder.Parent);

        }
示例#8
0
        public void ItemReplaced()
        {
            var eventedList = new EventedList<int>();

            var called = false;
            eventedList.Add(1);
            eventedList.CollectionChanged += delegate { called = true; };
            eventedList[0] = 2;
            Assert.IsTrue(called);
        }
示例#9
0
文件: Node.cs 项目: lishxi/_SharpMap
 public Node(string name)
 {
     Name = name;
     
     // Do not replace with backing field: logic might be overriden in derived classes
     IncomingBranches = new EventedList<IBranch>();
     OutgoingBranches = new EventedList<IBranch>();
     NodeFeatures = new EventedList<INodeFeature>();
     Attributes = new DictionaryFeatureAttributeCollection();
 }
示例#10
0
        public void CollectionChangedWhenValueIsRemoved()
        {
            var eventedList = new EventedList<int>();

            var called = false;
            eventedList.Add(1);
            eventedList.CollectionChanged += delegate { called = true; };
            eventedList.Remove(1);
            Assert.IsTrue(called);
        }
示例#11
0
 public Branch(string name, INode fromNode, INode toNode, double length)
 {
     // Do not replace with backing field; virtual setter in derived classes can have added logic; eek!
     BranchFeatures = new EventedList<IBranchFeature>();
     Attributes = new DictionaryFeatureAttributeCollection();
     Source = fromNode;
     Target = toNode;
     this.length = length;
     Name = name;
     OrderNumber = -1; //-1 -> not a part of a chain of branches
 }
示例#12
0
        public void AddFeatureUsingGeometry()
        {
            EventedList<SampleFeature> features = new EventedList<SampleFeature>();

            FeatureCollection featureCollection = new FeatureCollection {Features = features};

            IGeometry geometry = GeometryFromWKT.Parse("LINESTRING (20 20, 20 30, 30 30, 30 20, 40 20)");
            featureCollection.Add(geometry);

            Assert.AreEqual(1, features.Count);
            Assert.IsTrue(features[0].Geometry is ILineString);
        }
示例#13
0
        public void UpdateDataItemOwner()
        {
            EventedList<IDataItem> dataItems = new EventedList<IDataItem>();
            DataItem dataItem = new DataItem();
            dataItems.Add(dataItem);
            Folder folder = new Folder {DataItems = dataItems};
            Assert.AreEqual(folder, dataItem.Owner);

            EventedList<IDataItem> dataItems2 = new EventedList<IDataItem>();
            DataItem dataItem2 = new DataItem();
            dataItems2.Add(dataItem2);
            folder.DataItems = dataItems2;
        }
示例#14
0
 public void CollectionChangedWhenValueIsAdded()
 {
     var eventedList = new EventedList<object>();
     var callCount = 0;
     var item = new object();
     eventedList.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
                                          {
                                              Assert.AreEqual(eventedList, sender);
                                              Assert.AreEqual(item, e.Item);
                                              callCount++;
                                          };
     eventedList.Add(item);
     Assert.AreEqual(1, callCount);
 }
示例#15
0
文件: Node.cs 项目: lishxi/_SharpMap
        public Node(string name)
        {
            Name = name;
            
            incomingBranches = new EventedList<IBranch>();
            outgoingBranches = new EventedList<IBranch>();

            ((INotifyCollectionChanged)incomingBranches).CollectionChanged += ConnectedBranches_CollectionChanged;
            ((INotifyCollectionChanged)outgoingBranches).CollectionChanged += ConnectedBranches_CollectionChanged;

            // Do not replace with backing field?; see Branch
            NodeFeatures = new EventedList<INodeFeature>();
            Attributes = new DictionaryFeatureAttributeCollection();
            IsBoundaryNode = true;
        }
示例#16
0
        private void AddCulvertLayerAndTool()
        {
            
            var culverts = new EventedList<TestBranchFeature>();
            culvertLayer.DataSource = new FeatureCollection {Features = culverts};
            //culvertLayer.VectorLayer.Name = "culverts"; 
            culvertLayer.Enabled = true;
            culvertLayer.Style = new VectorStyle();
            culvertLayer.Style.Fill = new SolidBrush(Color.Tomato);
            culvertLayer.Style.Symbol = null;
            culvertLayer.Style.Line = new Pen(Color.Turquoise, 3);
            mapControl.Map.Layers.Insert(0, culvertLayer);

            //mapControl.SnappingStrategiesByLayer[culvertLayer].Add(
            //    new SnapStrategy(branchLayer, SnapRole.FreeAtObject, 40));

            var newNodeTool = new NewNodeTool(culvertLayer);
            mapControl.Tools.Add(newNodeTool);
        }
示例#17
0
        public void CollectionChangedAddToDataItemsResultInCollectionChangedForAdapter()
        {
            IEventedList < IDataItem > dataItems  = new EventedList<IDataItem>();

            var adapter = new DataItemListAdapter<Url>(dataItems);

            var url = new Url();
            int callCount = 0;
            adapter.CollectionChanged += (sender, e) =>
                                             {
                                                 callCount++;
                                                 Assert.AreEqual(adapter, sender);
                                                 Assert.AreEqual(url, e.Item);
                                                 Assert.AreEqual(0, e.Index);
                                             };
            //action! add
            dataItems.Add(new DataItem(url));
            Assert.AreEqual(1,callCount);
        }
示例#18
0
        public Branch(string name, INode fromNode, INode toNode, double length)
        {
            Source = fromNode;
            Target = toNode;

            this.length = length;
            
/*
            if(length != 0)
            {
                IsLengthCustom = true;
            }
*/

            Name = name;

            // Do not replace with backing field; virtual setter in derived classes can have added logic; eek!
            BranchFeatures = new EventedList<IBranchFeature>();
            Attributes = new DictionaryFeatureAttributeCollection();
        }
示例#19
0
        public void UnsubscribeFromOldItemOnReplace()
        {
            var eventedList = new EventedList<MockClassWithTwoProperties>();

            var aPropertyChangeCount = 0;
            var listPropertyChangeCount = 0;

            var a = new MockClassWithTwoProperties {StringProperty = "a"};

            eventedList.Add(a);

            eventedList.PropertyChanged += delegate { listPropertyChangeCount++; };
            a.PropertyChanged += delegate { aPropertyChangeCount++; };

            // replace item
            eventedList[0] = new MockClassWithTwoProperties {StringProperty = "second a"};

            a.StringProperty = "a2";

            Assert.AreEqual(0, listPropertyChangeCount);
            Assert.AreEqual(1, aPropertyChangeCount);
        }
示例#20
0
        public void CollectionChangedRemoveDataItemsResultInCollectionChangedForAdapter()
        {
            //create a list of dataItem containing urls
            IEventedList<IDataItem> dataItems = new EventedList<IDataItem>();
            var url = new Url();
            var dataItem = new DataItem(url);
            dataItems.Add(dataItem);

            //adapter for the list
            var adapter = new DataItemListAdapter<Url>(dataItems);

            int callCount = 0;
            adapter.CollectionChanged += (sender, e) =>
            {
                callCount++;
                Assert.AreEqual(adapter, sender);
                Assert.AreEqual(url, e.Item);
                Assert.AreEqual(0, e.Index);
            };

            //action! remove the url from the dataitems list
            dataItems.Remove(dataItem);
            Assert.AreEqual(1, callCount);
        }
示例#21
0
 private void pages_Changed(object sender, EventedList <WizardPage> .ListChangedEventArgs <WizardPage> e)
 {
     Refresh();
 }
示例#22
0
 void m_uut_AboutToRemoveItems(EventedList <string> list, Predicate <string> match)
 {
     m_responses += "m_uut_AboutToRemoveItems" + " " + match + " | ";
 }
示例#23
0
 public Network()
 {
     Nodes    = new EventedList <INode>();
     Branches = new EventedList <IBranch>();
 }
示例#24
0
        public void EventedListTest1()
        {
            var l = new EventedList <EClass>(new[] { new EClass(1), new EClass(2) });

            Assert.That(l.Count, Is.EqualTo(2));
        }
示例#25
0
 /// <summary>
 /// Initializes a new group layer
 /// </summary>
 /// <param name="layername">Name of layer</param>
 public GroupLayer(string layername)
 {
     Layers  = new EventedList <ILayer>();
     Name    = layername;
     created = true;
 }
示例#26
0
 void m_uut_AboutToReplaceItem(EventedList <string> list, string oldItem, string newItem)
 {
     m_responses += "m_uut_AboutToReplaceItem" + " " + oldItem + " with " + newItem + " | ";
 }
示例#27
0
 public void List_SwitchContext_1()
 {
     var lst = new EventedList<string, string>("CONTEXT", false);
       Assert.AreEqual("CONTEXT", lst.Context);
       Assert.IsFalse(lst.ContextReadOnly);
       lst.Context = "yesyes";
       Assert.AreEqual("yesyes", lst.Context);
 }
示例#28
0
文件: Map.cs 项目: lishxi/_SharpMap
        /// <summary>
        /// Initializes a new map
        /// </summary>
        /// <param name="size">Size of map in pixels</param>
        public Map(Size size)
        {
            name = "map";

            _MaximumZoom = double.MaxValue;
            _MinimumZoom = 0;
            _Center = GeometryFactory.CreateCoordinate(0, 0);
            _Zoom = 1000;
            _PixelAspectRatio = 1.0;

            Size = size;

            Layers = new EventedList<ILayer>();

            BackColor = Color.Transparent;
            mapTransform = new Matrix();
            mapTransformInverted = new Matrix();

            UpdateDimensions();
        }
示例#29
0
        /// <summary>
        /// Initializes a new map
        /// </summary>
        public MapControl()
        {
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw |
                ControlStyles.UserPaint, true);

            LostFocus     += MapBox_LostFocus;
            base.AllowDrop = true;

            tools = new EventedList <IMapTool>();

            tools.CollectionChanged += tools_CollectionChanged;
            // Visible = true, kalo ingin nampilin Arah Utara
            var northArrowTool = new NorthArrowTool(this)
            {
                Anchor  = AnchorStyles.Right | AnchorStyles.Top,
                Visible = false
            };

            Tools.Add(northArrowTool);

            var scaleBarTool = new ScaleBarTool(this)
            {
                Size    = new Size(230, 50),
                Anchor  = AnchorStyles.Right | AnchorStyles.Bottom,
                Visible = true
            };

            Tools.Add(scaleBarTool);
            // Visible = true, utuk menampilkan legend Map
            //legendTool = new LegendTool(this) {Anchor = AnchorStyles.Left | AnchorStyles.Top, Visible = false};
            //Tools.Add(legendTool);

            queryTool = new QueryTool(this);
            Tools.Add(queryTool);

            // add commonly used tools

            zoomHistoryTool = new ZoomHistoryTool(this);
            Tools.Add(zoomHistoryTool);

            panZoomTool = new PanZoomTool(this);
            Tools.Add(panZoomTool);

            wheelPanZoomTool = new PanZoomUsingMouseWheelTool(this)
            {
                WheelZoomMagnitude = 0.8
            };                                                                                   //-2};
            Tools.Add(wheelPanZoomTool);

            rectangleZoomTool = new ZoomUsingRectangleTool(this);
            Tools.Add(rectangleZoomTool);

            fixedZoomInTool = new FixedZoomInTool(this);
            Tools.Add(fixedZoomInTool);

            fixedZoomOutTool = new FixedZoomOutTool(this);
            Tools.Add(fixedZoomOutTool);

            selectTool = new SelectTool {
                IsActive = true
            };
            Tools.Add(selectTool);

            // Active = true, biar bisa move point...
            moveTool = new MoveTool {
                Name          = "Move selected vertices",
                FallOffPolicy = FallOffPolicyRule.None,
                IsActive      = true
            };
            Tools.Add(moveTool);

            linearMoveTool = new MoveTool
            {
                Name          = "Move selected vertices (linear)",
                FallOffPolicy = FallOffPolicyRule.Linear
            };
            Tools.Add(linearMoveTool);

            deleteTool = new DeleteTool();
            Tools.Add(deleteTool);

            measureTool = new MeasureTool(this);
            tools.Add(measureTool);

            profileTool = new CoverageProfileTool(this)
            {
                Name = "Make grid profile"
            };
            tools.Add(profileTool);

            curvePointTool = new CurvePointTool();
            Tools.Add(curvePointTool);

            drawPolygonTool = new DrawPolygonTool();
            Tools.Add(drawPolygonTool);

            snapTool = new SnapTool();
            Tools.Add(snapTool);

            var toolTipTool = new ToolTipTool();

            Tools.Add(toolTipTool);

            MapTool fileHandlerTool = new FileDragHandlerTool();

            Tools.Add(fileHandlerTool);

            Width  = 100;
            Height = 100;

            mapPropertyChangedEventHandler =
                new DelayedEventHandler <PropertyChangedEventArgs>(map_PropertyChanged_Delayed)
            {
                SynchronizingObject = this,
                FireLastEventOnly   = true,
                FullRefreshDelay    = 300,
                Filter = (sender, e) => sender is ILayer ||
                         sender is VectorStyle ||
                         sender is ITheme,
                Enabled = false
            };
            mapCollectionChangedEventHandler =
                new DelayedEventHandler <NotifyCollectionChangingEventArgs>(map_CollectionChanged_Delayed)
            {
                SynchronizingObject = this,
                FireLastEventOnly   = true,
                FullRefreshDelay    = 300,
                Filter = (sender, e) => sender is Map ||
                         sender is ILayer,
                Enabled = false
            };

            Map = new Map(ClientSize)
            {
                Zoom = 100
            };
        }
示例#30
0
		private void Pages_Reset(object sender, EventedList<WizardPage>.ListChangedEventArgs<WizardPage> e)
		{
			WizardPage curPage = selectedPage;
			SelectedPage = null;
			contentArea.Controls.Clear();
			foreach (var item in Pages)
				Pages_AddItemHandler(item, false);
			if (Pages.Count > 0)
				SelectedPage = Pages.Contains(curPage) ? curPage : Pages[0];
		}
示例#31
0
		private void Pages_AddItem(object sender, EventedList<WizardPage>.ListChangedEventArgs<WizardPage> e)
		{
			Pages_AddItemHandler(e.Item, !initializing);
		}
示例#32
0
 void m_uut_AboutToAddItem(EventedList <string> list, string item)
 {
     m_responses += "m_uut_AboutToAddItem" + " " + item + " | ";
 }
示例#33
0
 void m_uut_RemovedItem(EventedList <string> list, string item)
 {
     m_responses += "m_uut_RemovedItem" + " " + item + " | ";
 }
示例#34
0
        /// <summary>
        /// Initializes a new map
        /// </summary>
        public MapControl()
        {
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw |
                ControlStyles.UserPaint, true);

            LostFocus += MapBox_LostFocus;
            AllowDrop  = true;

            tools = new EventedList <IMapTool>();

            tools.CollectionChanged += tools_CollectionChanged;

            var northArrowTool = new NorthArrowTool(this);

            northArrowTool.Anchor  = AnchorStyles.Right | AnchorStyles.Top;
            northArrowTool.Visible = false; // activate using commands
            Tools.Add(northArrowTool);

            var scaleBarTool = new ScaleBarTool(this);

            scaleBarTool.Size    = new Size(230, 50);
            scaleBarTool.Anchor  = AnchorStyles.Right | AnchorStyles.Bottom;
            scaleBarTool.Visible = true;
            Tools.Add(scaleBarTool);

            legendTool = new LegendTool(this)
            {
                Anchor = AnchorStyles.Left | AnchorStyles.Top, Visible = false
            };
            Tools.Add(legendTool);

            queryTool = new QueryTool(this);
            Tools.Add(queryTool);

            // add commonly used tools

            zoomHistoryTool = new ZoomHistoryTool(this);
            Tools.Add(zoomHistoryTool);

            panZoomTool = new PanZoomTool(this);
            Tools.Add(panZoomTool);

            wheelZoomTool = new ZoomUsingMouseWheelTool(this);
            wheelZoomTool.WheelZoomMagnitude = 0.8;
            Tools.Add(wheelZoomTool);

            rectangleZoomTool = new ZoomUsingRectangleTool(this);
            Tools.Add(rectangleZoomTool);

            fixedZoomInTool = new FixedZoomInTool(this);
            Tools.Add(fixedZoomInTool);

            fixedZoomOutTool = new FixedZoomOutTool(this);
            Tools.Add(fixedZoomOutTool);

            selectTool = new SelectTool {
                IsActive = true
            };
            Tools.Add(selectTool);

            moveTool               = new MoveTool();
            moveTool.Name          = "Move selected vertices";
            moveTool.FallOffPolicy = FallOffPolicyRule.None;
            Tools.Add(moveTool);

            linearMoveTool               = new MoveTool();
            linearMoveTool.Name          = "Move selected vertices (linear)";
            linearMoveTool.FallOffPolicy = FallOffPolicyRule.Linear;
            Tools.Add(linearMoveTool);

            deleteTool = new DeleteTool();
            Tools.Add(deleteTool);

            measureTool = new MeasureTool(this);
            tools.Add(measureTool);

            profileTool      = new GridProfileTool(this);
            profileTool.Name = "Make grid profile";
            tools.Add(profileTool);

            curvePointTool = new CurvePointTool();
            Tools.Add(curvePointTool);

            snapTool = new SnapTool();
            Tools.Add(snapTool);

            var toolTipTool = new ToolTipTool();

            Tools.Add(toolTipTool);

            MapTool fileHandlerTool = new FileDragHandlerTool();

            Tools.Add(fileHandlerTool);

            Tools.Add(new ExportMapToImageMapTool());

            Width  = 100;
            Height = 100;

            mapPropertyChangedEventHandler =
                new SynchronizedDelayedEventHandler <PropertyChangedEventArgs>(map_PropertyChanged_Delayed)
            {
                FireLastEventOnly = true,
                Delay2            = 300,
                Filter            = (sender, e) => sender is ILayer ||
                                    sender is VectorStyle ||
                                    sender is ITheme,
                SynchronizeInvoke = this,
                Enabled           = false
            };
            mapCollectionChangedEventHandler =
                new SynchronizedDelayedEventHandler <NotifyCollectionChangedEventArgs>(map_CollectionChanged_Delayed)
            {
                FireLastEventOnly = true,
                Delay2            = 300,
                Filter            = (sender, e) => sender is Map ||
                                    sender is ILayer,
                SynchronizeInvoke = this,
                Enabled           = false
            };

            Map = new Map(ClientSize)
            {
                Zoom = 100
            };
        }
示例#35
0
 void m_uut_ContentsChanged(EventedList <string> list)
 {
     m_responses += "m_uut_ContentsChanged" + " | ";
 }
示例#36
0
 protected Theme()
 {
     ThemeItems = new EventedList <IThemeItem>();
 }
示例#37
0
 public void List_SwitchContext_2()
 {
     var lst = new EventedList<string, string>("CONTEXT", true);
       Assert.AreEqual("CONTEXT", lst.Context);
       Assert.IsTrue(lst.ContextReadOnly);
       lst.Context = "yesyes";
 }
示例#38
0
 void m_uut_AboutToAddItems(EventedList <string> list, System.Collections.Generic.IEnumerable <string> collection)
 {
     m_responses += "m_uut_AboutToAddItems" + " " + collection + " | ";
 }
示例#39
0
        public void List_Readonly()
        {
            var lst = new EventedList<string, string>("CONTEXT", false);

              var ro = false;

              lst.GetReadOnlyEvent = (l) => ro;

              lst.Add("a");
              lst.Add("b");
              lst.Add("c");

              Assert.AreEqual(3, lst.Count);
              ro = true;

              Assert.Throws<NFXException>(() =>  lst.Add("d"));
        }
示例#40
0
		private EventedList<ConsoleMessage> GetFilteredBuffer(List<byte> filter) {
			EventedList<ConsoleMessage> ret = new EventedList<ConsoleMessage>();

			if (filter.Count > 0) {
				for (int i = 0; i < buffer.Count; i++) {
					if (filter.Contains(((ConsoleMessage)buffer[i]).Channel)) {
						ret.Add(buffer[i]);
					}
				}
				return ret;
			} else
				return buffer;
		}
示例#41
0
        public void EventedListTest()
        {
            var l = new EventedList <EClass>();

            Assert.That(l.Count, Is.EqualTo(0));
        }
示例#42
0
 public WaveServer() : base()
 {
     m_Prefixes = new EventedList <string, WaveServer>(this, true);
     m_Prefixes.GetReadOnlyEvent = (l) => Status != ControlStatus.Inactive;
 }
示例#43
0
        public static INetwork CreateMockNetwork()
        {
            var network = mocks.Stub <INetwork>();

            // branche
            var branch1 = mocks.Stub <IBranch>();
            var branch2 = mocks.Stub <IBranch>();

            branch1.Name     = "branch1";
            branch2.Name     = "branch2";
            branch1.Length   = 100;
            branch2.Length   = 100;
            branch1.Geometry = GeometryFromWKT.Parse("LINESTRING (0 0, 100 0)");
            branch2.Geometry = GeometryFromWKT.Parse("LINESTRING (100 0, 200 10)");

            var branches = new EventedList <IBranch>(new[] { branch1, branch2 });

            network.Branches = branches;

            branch1.Network        = network;
            branch1.BranchFeatures = new EventedList <IBranchFeature>();

            branch2.Network        = network;
            branch2.BranchFeatures = new EventedList <IBranchFeature>();

            branch1.Network = network;
            branch2.Network = network;


            // nodes
            var node1 = mocks.Stub <INode>();
            var node2 = mocks.Stub <INode>();
            var node3 = mocks.Stub <INode>();

            node1.Name     = "node1";
            node2.Name     = "node2";
            node3.Name     = "node2";
            node1.Geometry = GeometryFromWKT.Parse("POINT (0 0)");
            node2.Geometry = GeometryFromWKT.Parse("POINT (100 0)");
            node3.Geometry = GeometryFromWKT.Parse("POINT (200 10)");

            node1.IncomingBranches = new List <IBranch>();
            node2.IncomingBranches = new List <IBranch> {
                branch1
            };
            node3.IncomingBranches = new List <IBranch> {
                branch2
            };

            node1.OutgoingBranches = new List <IBranch> {
                branch1
            };
            node2.OutgoingBranches = new List <IBranch> {
                branch2
            };
            node3.OutgoingBranches = new List <IBranch>();

            branch1.Source = node1;
            branch1.Target = node2;
            branch2.Source = node2;
            branch2.Target = node3;

            var nodes = new EventedList <INode>(new[] { node1, node2, node3 });

            network.Nodes = nodes;
            node1.Network = network;
            node2.Network = network;
            node3.Network = network;

            // node feature
            var nodeFeature1 = mocks.Stub <INodeFeature>();

            nodeFeature1.Name     = "nodeFeature1";
            nodeFeature1.Geometry = GeometryFromWKT.Parse("POINT (0 0)");
            nodeFeature1.Node     = node1;

            // new[] { nodeFeature1 }
            var nodeFeatures = new List <INodeFeature>();

            Expect.Call(network.NodeFeatures).Return(nodeFeatures).Repeat.Any();

            nodeFeature1.Network = network;

            // branch feature
            var branchFeature1 = mocks.Stub <IBranchFeature>();

            branchFeature1.Name     = "branchFeature1";
            branchFeature1.Geometry = GeometryFromWKT.Parse("POINT (50 0)");
            branchFeature1.Branch   = branch1;

            // new[] { branchFeature1 }
            var branchFeatures = new List <IBranchFeature>();

            Expect.Call(network.BranchFeatures).Return(branchFeatures).Repeat.Any();

            branchFeature1.Network = network;
            mocks.ReplayAll();

            return(network);
        }
示例#44
0
 public GdalFunctionStore()
 {
     state          = GdalState.Closed;
     TypeConverters = new List <ITypeConverter>();
     Functions      = new EventedList <IFunction>();
 }
示例#45
0
 public WaveServer() : base()
 {
   m_Prefixes = new EventedList<string,WaveServer>(this, true);
   m_Prefixes.GetReadOnlyEvent = (l) => Status != ControlStatus.Inactive; 
 }
示例#46
0
 private void Pages_AddItem(object sender, EventedList <WizardPage> .ListChangedEventArgs <WizardPage> e)
 {
     Pages_AddItemHandler(e.Item, !initializing);
 }
示例#47
0
		private void Pages_RemoveItem(object sender, EventedList<WizardPage>.ListChangedEventArgs<WizardPage> e)
		{
			contentArea.Controls.Remove(e.Item);
			if (e.Item == selectedPage && Pages.Count > 0)
				SelectedPage = Pages[e.ItemIndex == Pages.Count ? e.ItemIndex - 1 : e.ItemIndex];
			else
				UpdateButtons();
		}
示例#48
0
 public FeatureCoverage(string name)
 {
     base.Name = name;
     Features  = new EventedList <IFeature>();
     UpdateGeometry();
 }
示例#49
0
        public void ZoomHistory()
        {
            const double cToleranceZoom = 0.001;

            // Setup test environment
            EventedList<IMapTool> tools = new EventedList<IMapTool>();

            MapControl mapControl = new MapControl();
            ZoomHistoryTool zoomHistoryToolMapTool = new ZoomHistoryTool(mapControl);
            zoomHistoryToolMapTool = new ZoomHistoryTool(mapControl);
            tools.Add(zoomHistoryToolMapTool);

            // First rendering is ignored
            mapControl.Map.Zoom = 1.0;
            mapControl.Map.Center = new Coordinate(0.1, 0.2);
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(0, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(0, zoomHistoryToolMapTool.RedoCount);

            // First recorded rendering
            mapControl.Map.Zoom = 1.1;
            mapControl.Map.Center = new Coordinate(1.2, 1.3);
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(1, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(0, zoomHistoryToolMapTool.RedoCount);

            // Undo and redo the zoom
            zoomHistoryToolMapTool.PreviousZoomState();
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(0, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(1, zoomHistoryToolMapTool.RedoCount);
            Assert.AreEqual(1.0, mapControl.Map.Zoom, cToleranceZoom);
            Assert.AreEqual(0.1, mapControl.Map.Center.X, cToleranceZoom);
            Assert.AreEqual(0.2, mapControl.Map.Center.Y, cToleranceZoom);
          
            zoomHistoryToolMapTool.NextZoomState();
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(1, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(0, zoomHistoryToolMapTool.RedoCount);
            Assert.AreEqual(1.1, mapControl.Map.Zoom, cToleranceZoom);
            Assert.AreEqual(1.2, mapControl.Map.Center.X, cToleranceZoom);
            Assert.AreEqual(1.3, mapControl.Map.Center.Y, cToleranceZoom);

            // Second recorded rendering
            mapControl.Map.Zoom = 2.1;
            mapControl.Map.Center = new Coordinate(2.2, 2.3);
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(2, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(0, zoomHistoryToolMapTool.RedoCount);

            // Third recorded rendering
            mapControl.Map.Zoom = 3.1;
            mapControl.Map.Center = new Coordinate(3.2, 3.3);
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(3, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(0, zoomHistoryToolMapTool.RedoCount);

            // Fourth recorded rendering
            mapControl.Map.Zoom = 4.1;
            mapControl.Map.Center = new Coordinate(4.2, 4.3);
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(4, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(0, zoomHistoryToolMapTool.RedoCount);

            // Undo 2 times and redo 2 times
            Assert.AreEqual(4, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(0, zoomHistoryToolMapTool.RedoCount);

            zoomHistoryToolMapTool.PreviousZoomState();
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(3.1, mapControl.Map.Zoom, cToleranceZoom);
            Assert.AreEqual(3.2, mapControl.Map.Center.X, cToleranceZoom);
            Assert.AreEqual(3.3, mapControl.Map.Center.Y, cToleranceZoom);
            Assert.AreEqual(3, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(1, zoomHistoryToolMapTool.RedoCount);

            zoomHistoryToolMapTool.PreviousZoomState();
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(2.1, mapControl.Map.Zoom, cToleranceZoom);
            Assert.AreEqual(2.2, mapControl.Map.Center.X, cToleranceZoom);
            Assert.AreEqual(2.3, mapControl.Map.Center.Y, cToleranceZoom);
            Assert.AreEqual(2, zoomHistoryToolMapTool.UndoCount);
            Assert.AreEqual(2, zoomHistoryToolMapTool.RedoCount);
            
            zoomHistoryToolMapTool.NextZoomState();
            zoomHistoryToolMapTool.MapRendered(mapControl.Map);
            Assert.AreEqual(3.1, mapControl.Map.Zoom, cToleranceZoom);
            Assert.AreEqual(3.2, mapControl.Map.Center.X, cToleranceZoom);
            Assert.AreEqual(3.3, mapControl.Map.Center.Y, cToleranceZoom);
        }
示例#50
0
 public override void Clear()
 {
     base.Clear();
     Features = new EventedList <IFeature>();
 }