public void AutoMapWithExistingMapTest() { var context = new CsvContext(new CsvConfiguration(CultureInfo.InvariantCulture)); var existingMap = new SimpleMap(); context.Maps.Add(existingMap); var data = new { Simple = new Simple { Id = 1, Name = "one" } }; var map = context.AutoMap(data.GetType()); Assert.NotNull(map); Assert.Empty(map.MemberMaps); Assert.Single(map.ReferenceMaps); // Since Simple is a reference on the anonymous object, the type won't // be re-used. Types which are created from automapping aren't added // to the list of registered maps either. Assert.IsNotType <SimpleMap>(map.ReferenceMaps[0].Data.Mapping); }
private void Exploding() { // Keep setting my velocity back to zero base.Ball.Velocity.StoreNewValues(new MyVector()); // See if enough time has gone by bool isExpired = false; if (_explosion == null) { isExpired = true; } else { // Bump up my elapsed time _explosion.ElapsedTime += _curTickElapsedTime; if (_explosion.ElapsedTime > _explosion.Duration) { isExpired = true; } } if (isExpired) { // Let myself know that I am in the process of dying _state = ProjectileState.Dying; // Tell the map to drop me, and drop reference to the map. _map.Remove(this.Token); _map.Collisions -= new CollisionsDelegate(Map_Collisions); _map = null; } }
public void SetPointers(SimpleMap map, ObjectRenderer renderer, List <long> ignoreTokens) { // Store Stuff _map = map; _ignoreTokens = ignoreTokens; // Make my picturebox look like what the renderer is painting on pictureBox1.BackColor = renderer.Viewer.BackColor; pictureBox1.SetBorder(renderer.Viewer.BoundryLower, renderer.Viewer.BoundryUpper); if (renderer.Viewer.ShouldDrawCheckerBackground) { pictureBox1.ShowCheckerBackground(renderer.Viewer.CheckerOtherColor, renderer.Viewer.NumCheckersPerSide); } else { pictureBox1.HideBackground(); } if (renderer.Viewer.ShouldDrawBorder) { pictureBox1.ShowBorder(renderer.Viewer.BorderColor, renderer.Viewer.BorderWidth); } else { pictureBox1.HideBorder(); } // I want my viewer to show the whole scene pictureBox1.ZoomFit(); // Now clone the renderer _personalRenderer = new ObjectRenderer(pictureBox1); }
public void CanAddAndRemove() { var sourceNode = new Node(Utils.Id("foo")); var simpleMap = new SimpleMap <NodeID, NodeID>(); simpleMap.Init(sourceNode, db); for (int i = 0; i < 100; i++) { simpleMap.Add(Utils.Id($"foo/{i}"), Utils.Id("bar")); } for (int i = 0; i < 100; i += 2) { simpleMap.Remove(Utils.Id($"foo/{i}")); } for (int i = 0; i < 100; i++) { if (i % 2 == 1) { Assert.Contains(Utils.Id($"foo/{i}"), simpleMap); } else { Assert.DoesNotContain(Utils.Id($"foo/{i}"), simpleMap); } } }
public void CantInitEmpty() { var sourceNode = new Node(Utils.Id("foo")); var simpleList = new SimpleMap <NodeID, NodeID>(); simpleList.Init(sourceNode, db); }
public void AutoMapWithExistingMapTest() { var config = new CsvHelper.Configuration.CsvConfiguration(CultureInfo.InvariantCulture); var existingMap = new SimpleMap(); config.Maps.Add(existingMap); var data = new { Simple = new Simple { Id = 1, Name = "one" } }; var map = config.AutoMap(data.GetType()); Assert.IsNotNull(map); Assert.AreEqual(0, map.MemberMaps.Count); Assert.AreEqual(1, map.ReferenceMaps.Count); // Since Simple is a reference on the anonymous object, the type won't // be re-used. Types which are created from automapping aren't added // to the list of registered maps either. Assert.IsNotInstanceOfType(map.ReferenceMaps[0].Data.Mapping, typeof(SimpleMap)); }
protected internal GameObjectManager(SimpleMap map) { this.map = map; this.cachedViewPort = map.Surface.ViewPort; this.ItemAdded += GameObjectManager_ItemAdded; this.ItemRemoved += GameObjectManager_ItemRemoved; this.ItemMoved += GameObjectManager_ItemMoved; }
public void CreateForMap_WithEmptyMap_CreatesMapper() { var map = new SimpleMap <TestDataClass>(); var result = _sut.CreateForMap(map); Assert.That(result, Is.Not.Null); }
public Projectile(Ball ball, long shipToken, bool ignoreOtherProjectiles, double pain, SimpleMap map, RadarBlipQual blipQual, long token, Guid objectID) : base(ball, CollisionStyle.Standard, blipQual, token, objectID) { _shipToken = shipToken; _ignoreOtherProjectiles = ignoreOtherProjectiles; _pain = pain; _map = map; _map.Collisions += new CollisionsDelegate(Map_Collisions); }
public void Map_WithClassWithoutDefaultCtor_ThrowsException() { var map = new SimpleMap <ClassWithoutDefaultCtor>(); var sut = CreateTokenStreamMapper(map); TestDelegate act = () => sut.Map(CreateTokenStreamWithDelimiter()).ToArray(); var exception = Assert.Throws <MappingException>(act); Assert.That(exception.Message, Is.EqualTo("No default constructor found for ClassWithoutDefaultCtor.")); }
public ShipController(LargeMapViewer2D picturebox, SimpleMap map, MyVector boundryLower, MyVector boundryUpper) { _picturebox = picturebox; _map = map; _boundryLower = boundryLower; _boundryUpper = boundryUpper; _blipToken = TokenGenerator.NextToken(); _picturebox.KeyDown += new System.Windows.Forms.KeyEventHandler(Picturebox_KeyDown); _picturebox.KeyUp += new System.Windows.Forms.KeyEventHandler(Picturebox_KeyUp); }
public void RunPipeline <T>(SimpleMap <T> Map, string Name, int Number, ref FitsImage Pipeline, T Argument, AlgorithmRunParameters Parameters) { bool Value = EnsureImage(Name, Number, out FitsImage Result); if (!Value) { Map.Run(Argument, Pipeline, Result, Parameters); } Result.GetProperty <ImageSource>().AddToSet(Pipeline, Name); Pipeline = Result; LogHookImage(!Value, Name, Number); }
public void CanAddAndClear() { var sourceNode = new Node(Utils.Id("foo")); var simpleMap = new SimpleMap <NodeID, NodeID>(); simpleMap.Init(sourceNode, db); for (int i = 0; i < 100; i++) { simpleMap.Add(Utils.Id($"foo/{i}"), Utils.Id("bar")); } simpleMap.Clear(); Assert.Empty(simpleMap); }
public static RadarBlip CloneBlip(RadarBlip blip, SimpleMap map) { BallBlip retVal = new BallBlip((Ball)blip.Sphere.Clone(), blip.CollisionStyle, blip.Qual, TokenGenerator.NextToken()); retVal.Ball.Velocity.StoreNewValues(((Ball)blip.Sphere).Velocity); if (blip.Sphere is TorqueBall) { ((TorqueBall)retVal.Sphere).AngularMomentum.StoreNewValues(((TorqueBall)blip.Sphere).AngularMomentum); } return(retVal); }
static void Main(string[] args) { SimpleMap map = new SimpleMap(new MapSize(100, 100)); map.AddLayer("default"); SimpleMapObjectF factory = new SimpleMapObjectF(); SimpleEngine eng = new SimpleEngine(map, factory); for (int i = 0; i < 10; ++i) { eng.AddObject("1", "default", new Coordinates(i, i)); } Console.ReadLine(); }
public void SetPointers(LargeMapViewer2D picturebox, ShipController shipController, SimpleMap map) { _picturebox = picturebox; _shipController = shipController; _map = map; shipPropsMain1.SetPointers(picturebox, shipController); shipPropsTractor1.SetPointers(shipController, map); shipPropsGun1.SetPointers(shipController); _shipController.FinishedSetup(); ShowPropertyTab(shipPropsMain1); }
public void CantInit() { var sourceNode = new Node { Id = Utils.Id("simpleMap1"), Attributes = new Map { Items = new List <KeyValue>() } }; var simpleList = new SimpleMap <NodeID, NodeID>(); simpleList.Init(sourceNode, db); }
/// <summary> /// Runs the given algorithm on the input data. /// </summary> /// <typeparam name="T">First extra parameter type.</typeparam> /// <typeparam name="U">Second extra parameter type.</typeparam> /// <typeparam name="V">Third extra parameter type.</typeparam> /// <param name="Algorithm">Parallel algorithm.</param> /// <param name="Argument1">First argument to be passed to all invocations.</param> /// <param name="Argument2">Second argument to be passed to all invocations.</param> /// <param name="Argument3">Third argument to be passed to all invocations.</param> /// <param name="Input">Input image.</param> /// <param name="Output">Output image.</param> /// <param name="Parameters">Parameters of the algorithm run.</param> public static void RunAlgorithm <T, U, V>(SimpleMap <T, U, V> Algorithm, T Argument1, U Argument2, V Argument3, Image Input, Image Output, AlgorithmRunParameters Parameters) { RunDetails details = new RunDetails() { Algorithm = Algorithm, InputImages = new Image[] { Input }, OutputImage = Output, Parameters = new object[] { Argument1, Argument2, Argument3 }, Type = AlgorithmType.SimpleMap_TUV, }; PrepareGeometry(ref details, Parameters); DefaultScheduler(details); }
void pick_OnPickedLeftButton(SegmentInterceptInfo SegmentInterceptInfo) { SimpleMap sm = new SimpleMap(wh.CurrentWaypointsCollection); AStar astar = new AStar(sm); path = astar.GetPath(start.WorldPos, SegmentInterceptInfo.ImpactPosition); ///the first will always be the start and the last should be the clicked position, not the last waypoint =P path.AddLast(new Waypoint() { WorldPos = SegmentInterceptInfo.ImpactPosition }); pathchanged = true; destiny = SegmentInterceptInfo.ImpactPosition; }
private Ball _drawingBall = null; // ball is the lowest base class. it could also be solidball or rigidbody //private double _diminishPercent = 1d; #endregion #region Constructor public BallAdder(LargeMapViewer2D picturebox, ObjectRenderer renderer, BallProps newBallProps, SimpleMap map, MyVector boundryLower, MyVector boundryUpper, List <long> tempObjects) { _picturebox = picturebox; _renderer = renderer; _newBallProps = newBallProps; _map = map; _boundryLower = boundryLower; _boundryUpper = boundryUpper; _tempObjects = tempObjects; _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown); _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp); _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove); }
public Selector(LargeMapViewer2D picturebox, SimpleMap map, ObjectRenderer renderer, List <long> cantDeleteTokens) { _picturebox = picturebox; _map = map; _renderer = renderer; _cantDeleteTokens = cantDeleteTokens; _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown); _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp); _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove); _picturebox.KeyDown += new KeyEventHandler(picturebox_KeyDown); _picturebox.KeyUp += new KeyEventHandler(picturebox_KeyUp); }
public void CreateForMap_WithNonEmptyMap_CreatesMapperWhichMapsFieldsCorrectly() { var map = new SimpleMap <TestDataClass>(); map.AddMapping(0, TestDataClass.PropertyNameFieldA); map.AddMapping(1, TestDataClass.PropertyNameFieldB); var result = _sut.CreateForMap(map); var mapped = result.Map(CreateTokenStreamWithDelimiter("A", "B")).ToArray(); Assert.That(mapped, Has.Length.EqualTo(1)); AssertTestDataClass(mapped[0], "A", "B"); }
public void SetPointers(ShipController shipController, SimpleMap map) { _shipController = shipController; _map = map; _shipController.CreateNewTractorBeams += new EventHandler(ShipController_CreateNewTractorBeams); _shipController.RecalcTractorBeamOffsets += new EventHandler(ShipController_RecalcTractorBeamOffsets); _shipController.ChangeTractorBeamPower += new EventHandler(ShipController_ChangeTractorBeamPower); // Apply Settings cboType_SelectedIndexChanged(this, new EventArgs()); txtStrengthMax_TextChanged(this, new EventArgs()); // this method calls the trackbar methods txtMaxSize_TextChanged(this, new EventArgs()); // this method calls the trackbar's method trkSweepAngle_Scroll(this, new EventArgs()); }
public void SetMap(MapType T, int x, int y) { if (Map == null) { IMap map = new SimpleMap(); map.SetSize(x, y); map.SetType(T); this.Map = map; } else { Map.SetSize(x, y); Map.SetType(T); } return; }
public GravMouse(LargeMapViewer2D picturebox, SimpleMap map, MyVector boundryLower, MyVector boundryUpper) { const double RADIUS = 400; _picturebox = picturebox; _map = map; _boundryLower = boundryLower; _boundryUpper = boundryUpper; _cursorBlip = new BallBlip(new Ball(new MyVector(), new DoubleVector(1, 0, 0, 0, 1, 0), RADIUS, UtilityCore.GetMassForRadius(RADIUS, 1d), 1, 0, 0, _boundryLower, _boundryUpper), CollisionStyle.Stationary, RadarBlipQual.BallUserDefined05, TokenGenerator.NextToken()); _picturebox.MouseDown += new MouseEventHandler(picturebox_MouseDown); _picturebox.MouseUp += new MouseEventHandler(picturebox_MouseUp); _picturebox.MouseMove += new MouseEventHandler(picturebox_MouseMove); _picturebox.MouseLeave += new EventHandler(picturebox_MouseLeave); }
public ProjectileWeapon(double projectilePain, double projectileRadius, double projectileMass, double projectileSpeed, bool produceKick, bool ignoreOtherProjectiles, RadarBlipQual projectileQual, bool enforceFiringModeOuterTime, SimpleMap map, MyVector boundryLower, MyVector boundryUpper) { _projectileSettings = new ProjectileSettings(projectileSpeed, projectileRadius, projectileMass, projectilePain, ignoreOtherProjectiles, projectileQual); _enforceFiringModeOuterTime = enforceFiringModeOuterTime; _map = map; _produceKick = produceKick; if (boundryLower != null && boundryUpper != null) { _useBoundry = true; _boundryLower = boundryLower; _boundryUpper = boundryUpper; } _elapsedTime = new FiringMode(0, 0, 0); }
public void CanAddAndIterate() { var sourceNode = new Node(Utils.Id("foo")); var simpleMap = new SimpleMap <NodeID, NodeID>(); simpleMap.Init(sourceNode, db); for (int i = 0; i < 100; i++) { simpleMap.Add(Utils.Id($"foo/{i}"), Utils.Id("bar")); } for (int i = 0; i < 100; i++) { simpleMap.Contains(new KeyValuePair <NodeID, NodeID>(Utils.Id($"foo/{i}"), Utils.Id("bar"))); Assert.Contains(Utils.Id($"foo/{i}"), simpleMap.Keys); } }
public TractorBeamCone(SimpleMap map, BallBlip ship, MyVector offset, DoubleVector dirFacing, BeamMode mode, bool isSoft, double sweepAngle, double maxDistance, double forceAtZero, double forceAtMax, double maxForcePerTick) { _map = map; _ship = ship; _offset = offset; _dirFacing = dirFacing; _mode = mode; _isSoft = isSoft; _sweepAngle = sweepAngle; _maxDistance = maxDistance; _forceAtZero = forceAtZero; _forceAtMax = forceAtMax; _maxForcePerTick = maxForcePerTick; }
public void AutoMapWithExistingMapTest() { var config = new CsvConfiguration(); var existingMap = new SimpleMap(); existingMap.CreateMap(); config.Maps.Add(existingMap); var data = new { Simple = new Simple { Id = 1, Name = "one" } }; var map = config.AutoMap(data.GetType()); Assert.IsNotNull(map); Assert.AreEqual(0, map.PropertyMaps.Count); Assert.AreEqual(1, map.ReferenceMaps.Count); Assert.IsInstanceOfType(map.ReferenceMaps[0].Mapping, typeof(SimpleMap)); }
public void Start() { map = this; spots = new Spot[Environment.env.xSize, Environment.env.zSize]; for (int i = 0; i < spots.GetLength(0); i++) { for (int j = 0; j < spots.GetLength(1); j++) { spots [i, j] = Instantiate(SpotPrefab, new Vector3(i - (spots.GetLength(0) / 2) + 0.5f, 0f, j - (spots.GetLength(1) / 2) + 0.5f), Quaternion.identity, this.transform).GetComponent <Spot> (); //in order not to be seen in the preview camera spots[i, j].gameObject.layer = 10; spots [i, j].x = i; spots [i, j].y = j; spots [i, j].cost = TerrainType.grass.cost; } } SetNeighbours(); SetSpotsColor(); }