public void Awake()
        {
            rect = this.GetComponent <RectTransform>();

            EnablePlanner  = GameObject.Find("EnablePlanner").GetComponent <Toggle>();
            DetectAntennas = GameObject.Find("DetectAntennas").GetComponent <Toggle>();
            DetectAntennas.onValueChanged.AddListener(delegate { onDetectAntennasValueChanged(DetectAntennas); });
            DetectRelays = GameObject.Find("DetectRelays").GetComponent <Toggle>();
            DetectRelays.onValueChanged.AddListener(delegate { onDetectRelaysValueChanged(DetectRelays); });

            CelestialBodies = GameObject.Find("PlannerPlanetDropdown").GetComponent <Dropdown>();
            CelestialBodies.onValueChanged.AddListener(delegate { onDropdownMenuValueChanged(CelestialBodies.value); });

            DistanceSlider = GameObject.Find("PlannerDistanceSlider").GetComponent <Slider>();
            DistanceSlider.onValueChanged.AddListener(delegate { onSliderValueChanged(DistanceSlider.value); });
            DistanceSliderLabel = GameObject.Find("CurrentDistance").GetComponent <Text>();

            DataRate                = GameObject.Find("PlannerDataRate");
            CurrentDataRateLabel    = DataRate.GetChild("CurrentDataRate").GetComponent <Text>();
            MaxDataRateLabel        = DataRate.GetChild("MaxDataRate").GetComponent <Text>();
            SignalStrengthLabel     = GameObject.Find("PlannerStrength").GetChild("signalstrength").GetComponent <Text>();
            ActiveTransmittersLabel = GameObject.Find("PlannerActiveTransmitters").GetChild("activeantennas").GetComponent <Text>();

            DSNLevel = ScenarioUpgradeableFacilities.GetFacilityLevel(SpaceCenterFacility.TrackingStation);
            DSNPower = GameVariables.Instance.GetDSNRange(DSNLevel);

            Bodies.ResearchBodiesAPI = Bodies.VerifyResearchBodiesAPI();
            celestialBodies          = Bodies.GetCelestialBodies();

            FillDropdownMenu(celestialBodies);

            ChangeSliderValues(Convert.ToSingle(Bodies.getMinDistance(FlightGlobals.GetHomeBody(), celestialBodies[0])),
                               Convert.ToSingle(Bodies.getMaxDistance(FlightGlobals.GetHomeBody(), celestialBodies[0])));
        }
        public ListViewPageMan()
        {
            InitializeComponent();
            Bodies pModel = new Bodies();

            BindingContext = pModel;
        }
 public unsafe void ExtractLines(ref PointOnLineServoPrestepData prestepBundle, int innerIndex, int setIndex, int *bodyIndices,
                                 Bodies bodies, ref Vector3 tint, ref QuickList <LineInstance> lines)
 {
     //Could do bundles of constraints at a time, but eh.
     var     poseA        = bodies.Sets[setIndex].Poses[bodyIndices[0]];
     var     poseB        = bodies.Sets[setIndex].Poses[bodyIndices[1]];
     ref var offsetBundle = ref GatherScatter.GetOffsetInstance(ref prestepBundle, innerIndex);
Example #4
0
        public RouteSpecBuilder WithBody(JSchema schema, bool required = false)
        {
            var body = new RouteSpecRequestBody("application/json", required, schema, new List <string>());

            Bodies.Add(body);
            return(this);
        }
Example #5
0
        public async Task DeleteBody(string symbol)
        {
            var bodyToDelete = Bodies.FirstOrDefault(x => x.Symbol == symbol);

            bodyToDelete.QuantityInStock = 0;
            await UpdateBody(bodyToDelete);
        }
Example #6
0
        public void Save(String forcedDirectory = null)
        {
            String directory = (forcedDirectory == null ? StorageDirectory : forcedDirectory);

            //  Save each body as individual file with name indicating type, current name, and some random number
            //throw new NotImplementedException();

            var duplicates = Bodies.Where(b => Bodies.Count(o => o.Id == b.Id) > 1);

            if (duplicates.Count() > 0)
            {
                throw new Exception("Cannot save! Invalid db state!");
            }

            foreach (var body in Bodies)
            {
                var map = _WorkingSerializations.Where(p => p.Key.Id == body.Id).Select(p => p.Value);
                if (map.Count() > 0)
                {
                    var m   = map.Single();
                    var xml = SaveBody(m.Filename, body);
                    m.Xml = xml;
                }
                else
                {
                    var fname = Path.Combine(directory, String.Format("{0}_{1}.fb", body.Type, body.Id));
                    var xml   = SaveBody(fname, body);
                    _WorkingSerializations.Add(body, new FileXmlMap {
                        Filename = fname, Xml = xml
                    });
                }
            }
        }
Example #7
0
        public unsafe void ExtractLines(ref CenterDistancePrestepData prestepBundle, int setIndex, int *bodyIndices,
                                        Bodies bodies, ref Vector3 tint, ref QuickList <LineInstance> lines)
        {
            //Could do bundles of constraints at a time, but eh.
            var poseA           = bodies.Sets[setIndex].Poses[bodyIndices[0]];
            var poseB           = bodies.Sets[setIndex].Poses[bodyIndices[1]];
            var targetDistance  = GatherScatter.GetFirst(ref prestepBundle.TargetDistance);
            var color           = new Vector3(0.2f, 0.2f, 1f) * tint;
            var packedColor     = Helpers.PackColor(color);
            var backgroundColor = new Vector3(0f, 0f, 1f) * tint;
            //Draw a line from A to B. If the true distance is longer than the target distance, draw a red line to complete the gap.
            //If the true distance is shorter than the target distance, draw an overshooting red line.
            var offset              = poseB.Position - poseA.Position;
            var length              = offset.Length();
            var direction           = length < 1e-9f ? new Vector3(1, 0, 0) : offset / length;
            var errorColor          = new Vector3(1, 0, 0) * tint;
            var packedErrorColor    = Helpers.PackColor(errorColor);
            var packedDistanceColor = Helpers.PackColor(color * 0.5f);
            var targetEnd           = poseA.Position + direction * targetDistance;

            if (length < targetDistance)
            {
                lines.AllocateUnsafely() = new LineInstance(poseA.Position, poseB.Position, packedDistanceColor, 0);
                lines.AllocateUnsafely() = new LineInstance(poseB.Position, targetEnd, packedErrorColor, 0);
            }
            else
            {
                lines.AllocateUnsafely() = new LineInstance(poseA.Position, targetEnd, packedDistanceColor, 0);
                lines.AllocateUnsafely() = new LineInstance(targetEnd, poseB.Position, packedErrorColor, 0);
            }
        }
Example #8
0
        protected override void AnalyzeNewBodyData()
        {
            foreach (var body in Bodies.Where(b => b.IsTracked))
            {
                var state = GetCurrentState(body.TrackingId);
                switch (state.Item1)
                {
                case State.HandClosed:
                    if (IsHandNotClosed(body))
                    {
                        SetCurrentState(body.TrackingId, State.Unknown);
                    }
                    break;

                default:
                    if (IsHandClosed(body))
                    {
                        IncreaseTicker(body.TrackingId);
                    }
                    else if (state.Item2 != 0)
                    {
                        SetCurrentState(body.TrackingId, State.Unknown);
                    }

                    if (state.Item2 > 2)
                    {
                        SetCurrentState(body.TrackingId, State.HandClosed);
                        InvokeDetected(body.TrackingId);
                    }
                    break;
                }
            }
        }
        public void Prestep(Bodies bodies, ref TwoBodyReferences bodyReferences, int count,
                            float dt, float inverseDt, ref Contact4PrestepData prestep, out Contact4Projection projection)
        {
            //Some speculative compression options not (yet) pursued:
            //1) Store the surface basis in a compressed fashion. It could be stored within 32 bits by using standard compression schemes, but we lack the necessary
            //instructions to properly SIMDify the decode operation (e.g. shift). Even with the potential savings of 3 floats (relative to uncompressed storage), it would be questionable.
            //We could drop one of the four components of the quaternion and reconstruct it relatively easily- that would just require that the encoder ensures the W component is positive.
            //It would require a square root, but it might still be a net win. On an IVB, sqrt has a 7 cycle throughput. 4 bytes saved * 4 lanes = 16 bytes, which takes
            //about 16 / 5.5GBps = 2.9ns, where 5.5 is roughly the per-core bandwidth on a 3770K. 7 cycles is only 2ns at 3.5ghz.
            //There are a couple of other instructions necessary to decode, but sqrt is by far the heaviest; it's likely a net win.
            //Be careful about the execution order here. It should be aligned with the prestep data layout to ensure prefetching works well.

            bodies.GatherInertia(ref bodyReferences, count, out projection.InertiaA, out projection.InertiaB);
            Vector3Wide.Add(ref prestep.OffsetA0, ref prestep.OffsetA1, out var a01);
            Vector3Wide.Add(ref prestep.OffsetA2, ref prestep.OffsetA3, out var a23);
            Vector3Wide.Add(ref a01, ref a23, out var offsetToManifoldCenterA);
            var scale = new Vector <float>(0.25f);

            Vector3Wide.Scale(ref offsetToManifoldCenterA, ref scale, out offsetToManifoldCenterA);
            Vector3Wide.Subtract(ref offsetToManifoldCenterA, ref prestep.OffsetB, out var offsetToManifoldCenterB);
            projection.PremultipliedFrictionCoefficient = scale * prestep.FrictionCoefficient;
            projection.Normal = prestep.Normal;
            Helpers.BuildOrthnormalBasis(ref prestep.Normal, out var x, out var z);
            TangentFriction.Prestep(ref x, ref z, ref offsetToManifoldCenterA, ref offsetToManifoldCenterB, ref projection.InertiaA, ref projection.InertiaB, out projection.Tangent);
            PenetrationLimit4.Prestep(ref projection.InertiaA, ref projection.InertiaB, ref prestep.Normal, ref prestep, dt, inverseDt, out projection.Penetration);
            //Just assume the lever arms for B are the same. It's a good guess. (The only reason we computed the offset B is because we didn't want to go into world space.)
            Vector3Wide.Distance(ref prestep.OffsetA0, ref offsetToManifoldCenterA, out projection.LeverArm0);
            Vector3Wide.Distance(ref prestep.OffsetA1, ref offsetToManifoldCenterA, out projection.LeverArm1);
            Vector3Wide.Distance(ref prestep.OffsetA2, ref offsetToManifoldCenterA, out projection.LeverArm2);
            Vector3Wide.Distance(ref prestep.OffsetA3, ref offsetToManifoldCenterA, out projection.LeverArm3);
            TwistFriction.Prestep(ref projection.InertiaA, ref projection.InertiaB, ref prestep.Normal, out projection.Twist);
        }
Example #10
0
        public ParkingSpaceObstacle(World world, Vector2 position, float rotation)
        {
            Vector2[] vertices = new Vector2[8];
            vertices[0] = new Vector2(-3.5f, 1.5f);
            vertices[1] = new Vector2(3.5f, 1.5f);
            vertices[2] = new Vector2(3.5f, -1.5f);
            vertices[3] = new Vector2(-3.5f, -1.5f);
            vertices[4] = new Vector2(-3.5f, -1.45f);
            vertices[5] = new Vector2(3.45f, -1.45f);
            vertices[6] = new Vector2(3.45f, 1.45f);
            vertices[7] = new Vector2(-3.45f, 1.45f);

            for (int i = 0; i < 8; i++)
            {
                vertices[i] *= 10;
            }

            LinkedList <Vertices> vertexSet = new LinkedList <Vertices>();

            vertexSet.AddAll(EarclipDecomposer.ConvexPartition(new Vertices(vertices)));

            foreach (Vertices v in vertexSet)
            {
                Body b = BodyFactory.CreatePolygon(world, v, 1f, position);
                b.BodyType = BodyType.Static;
                b.Rotation = rotation;

                Bodies.Add(b);
            }
        }
Example #11
0
 public void AddBody(IAstronomicalObject obj)
 {
     if (obj != null)
     {
         Bodies.Add(obj);
     }
 }
        public unsafe void ExtractLines(ref BallSocketPrestepData prestepBundle, int innerIndex, int setIndex, int *bodyIndices,
                                        Bodies bodies, ref Vector3 tint, ref QuickList <LineInstance, Array <LineInstance> > lines)
        {
            //Could do bundles of constraints at a time, but eh.
            var poseA = bodies.Sets[setIndex].Poses[bodyIndices[0]];
            var poseB = bodies.Sets[setIndex].Poses[bodyIndices[1]];

            Vector3Wide.GetLane(ref prestepBundle.LocalOffsetA, innerIndex, out var localOffsetA);
            Vector3Wide.GetLane(ref prestepBundle.LocalOffsetB, innerIndex, out var localOffsetB);
            Quaternion.Transform(ref localOffsetA, ref poseA.Orientation, out var worldOffsetA);
            Quaternion.Transform(ref localOffsetB, ref poseB.Orientation, out var worldOffsetB);
            var endA            = poseA.Position + worldOffsetA;
            var endB            = poseB.Position + worldOffsetB;
            var color           = new Vector3(0.2f, 0.2f, 1f) * tint;
            var packedColor     = Helpers.PackColor(ref color);
            var backgroundColor = new Vector3(0f, 0f, 1f) * tint;
            var lineA           = new LineInstance(ref poseA.Position, ref endA, packedColor, 0);
            var lineB           = new LineInstance(ref poseB.Position, ref endB, packedColor, 0);

            lines.AddUnsafely(ref lineA);
            lines.AddUnsafely(ref lineB);
            var errorColor       = new Vector3(1, 0, 0) * tint;
            var packedErrorColor = Helpers.PackColor(ref errorColor);
            var errorLine        = new LineInstance(ref endA, ref endB, packedErrorColor, 0);

            lines.AddUnsafely(ref errorLine);
        }
Example #13
0
        public async Task <IActionResult> Edit(int id, [Bind("BodyId,Body")] Bodies bodies)
        {
            if (id != bodies.BodyId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(bodies);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BodiesExists(bodies.BodyId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(bodies));
        }
Example #14
0
        /** Remove a body from physics world. */
        public virtual void RemoveBody(CCPhysicsBody body)
        {
            if (body.GetWorld() != this)
            {
                cp.AssertWarn("Physics Warnning: this body doesn't belong to this world");
                return;
            }

            // destory the body's joints
            foreach (var joint in body._joints)
            {
                // set destroy param to false to keep the iterator available
                RemoveJoint(joint, false);

                CCPhysicsBody other = (joint.BodyA == body ? joint.BodyB : joint.BodyA);
                other.RemoveJoint(joint);


                if (DelayRemoveJoints.Exists(j => j == joint))
                {
                    joint._destoryMark = true;
                }
            }

            body._joints.Clear();

            RemoveBodyOrDelay(body);
            Bodies.Remove(body);
            body._world = null;
        }
Example #15
0
        public override void FlipY(bool relativeToSub)
        {
            base.FlipY(relativeToSub);

            if (Prefab.CanSpriteFlipY)
            {
                SpriteEffects ^= SpriteEffects.FlipVertically;
            }

            if (StairDirection != Direction.None)
            {
                StairDirection = StairDirection == Direction.Left ? Direction.Right : Direction.Left;
                Bodies.ForEach(b => GameMain.World.RemoveBody(b));
                Bodies.Clear();
                bodyDebugDimensions.Clear();

                CreateStairBodies();
            }

            if (HasBody)
            {
                CreateSections();
                UpdateSections();
            }
        }
        /// <summary>
        /// Store MetaDataObjects for each method part of this member
        /// </summary>
        private void BuildBodies()
        {
            switch (Member.MemberType)
            {
            case MemberTypes.Constructor:
                Bodies.Add(new MetadataObject(Member, null));
                break;

            case MemberTypes.Event:
                EventInfo         E = (EventInfo)Member;
                List <MethodInfo> methods = new MethodInfo[3] {
                    E.GetAddMethod(), E.GetRemoveMethod(), E.GetRaiseMethod()
                }.ToList();
                methods.AddRange(E.GetOtherMethods());
                methods.FindAll(m => m.GetMethodBody() != null).ForEach(m => Bodies.Add(new MetadataObject(Member, m)));
                break;

            case MemberTypes.Method:
                Bodies.Add(new MetadataObject(Member, (MethodInfo)Member));
                break;

            case MemberTypes.Property:
                PropertyInfo P = (PropertyInfo)Member;
                new MethodInfo[2] {
                    P.GetGetMethod(), P.GetSetMethod()
                }.ToList().FindAll(
                    m => m != null).ForEach(m => Bodies.Add(new MetadataObject(Member, m)));
                break;

            default:
                break;
            }
        }
        public unsafe void ExtractLines(ref PointOnLineServoPrestepData prestepBundle, int setIndex, int *bodyIndices,
                                        Bodies bodies, ref Vector3 tint, ref QuickList <LineInstance> lines)
        {
            //Could do bundles of constraints at a time, but eh.
            var poseA = bodies.Sets[setIndex].Poses[bodyIndices[0]];
            var poseB = bodies.Sets[setIndex].Poses[bodyIndices[1]];

            Vector3Wide.ReadFirst(prestepBundle.LocalOffsetA, out var localOffsetA);
            Vector3Wide.ReadFirst(prestepBundle.LocalOffsetB, out var localOffsetB);
            Vector3Wide.ReadFirst(prestepBundle.LocalDirection, out var localDirection);
            QuaternionEx.Transform(localOffsetA, poseA.Orientation, out var worldOffsetA);
            QuaternionEx.Transform(localDirection, poseA.Orientation, out var worldDirection);
            QuaternionEx.Transform(localOffsetB, poseB.Orientation, out var worldOffsetB);

            var anchorA            = poseA.Position + worldOffsetA;
            var anchorB            = poseB.Position + worldOffsetB;
            var closestPointOnLine = Vector3.Dot(anchorB - anchorA, worldDirection) * worldDirection + anchorA;

            var color           = new Vector3(0.2f, 0.2f, 1f) * tint;
            var packedColor     = Helpers.PackColor(color);
            var backgroundColor = new Vector3(0f, 0f, 1f) * tint;

            lines.AllocateUnsafely() = new LineInstance(poseA.Position, anchorA, packedColor, 0);
            lines.AllocateUnsafely() = new LineInstance(anchorA, closestPointOnLine, packedColor, 0);
            lines.AllocateUnsafely() = new LineInstance(closestPointOnLine, anchorB, Helpers.PackColor(new Vector3(1, 0, 0) * tint), 0);
            lines.AllocateUnsafely() = new LineInstance(anchorB, poseB.Position, packedColor, 0);
        }
        /// <summary>
        /// A view of the full instruction stream
        /// </summary>
        /// <returns></returns>
        public string GetInstructions()
        {
            string info = FullName;

            Bodies.ForEach(B => info += $"\n{B.ToString()}\n");
            return(info);
        }
Example #19
0
        public unsafe void ExtractLines(ref Contact1PrestepData prestepBundle, int setIndex, int *bodyIndices,
                                        Bodies bodies, ref Vector3 tint, ref QuickList <LineInstance> lines)
        {
            var poseA = bodies.Sets[setIndex].Poses[bodyIndices[0]];

            ContactLines.Add(poseA, ref prestepBundle.OffsetA0, ref prestepBundle.Normal, ref prestepBundle.PenetrationDepth0, tint, ref lines);
        }
Example #20
0
        private void CreatePlayerPhysicsObjects(Vector2 gameWorldPosition)
        {
            MainFixture = FixtureFactory.CreateRectangle(Engine.Physics.World, 0.5f, 0.5f, 1);
            MainFixture.CollisionFilter.CollisionCategories = (Category)(Global.CollisionCategories.Player);
            Bodies.Add(MainFixture.Body);
            MainFixture.Body.Position        = Engine.Physics.PositionToPhysicsWorld(gameWorldPosition);
            MainFixture.Body.BodyType        = BodyType.Dynamic;
            MainFixture.Body.SleepingAllowed = false;

            WheelFixture = FixtureFactory.CreateCircle(Engine.Physics.World, 0.3f, 1.0f);
            WheelFixture.CollisionFilter.CollisionCategories = (Category)(Global.CollisionCategories.Player);
            Bodies.Add(WheelFixture.Body);
            WheelFixture.Body.Position = MainFixture.Body.Position + new Vector2(0.0f, 0.6f);
            WheelFixture.Body.BodyType = BodyType.Dynamic;

            WheelFixture.Body.SleepingAllowed = false;
            WheelFixture.Friction             = 0.5f;

            playerFAJ       = JointFactory.CreateFixedAngleJoint(Engine.Physics.World, MainFixture.Body);
            playerFAJ.BodyB = WheelFixture.Body;

            wheelMotorRevJoint = JointFactory.CreateRevoluteJoint(MainFixture.Body, WheelFixture.Body, Vector2.Zero);
            wheelMotorRevJoint.MaxMotorTorque = 10.0f;
            wheelMotorRevJoint.MotorEnabled   = true;
            Engine.Physics.World.AddJoint(wheelMotorRevJoint);
        }
Example #21
0
        private void GeneratePlanets()
        {
            int numPlanets = 3;

            switch (size)
            {
            case "small":
                numPlanets = UnityEngine.Random.Range(3, 5);
                break;

            case "medium":
                numPlanets = UnityEngine.Random.Range(4, 6);
                break;

            case "large":
                numPlanets = UnityEngine.Random.Range(5, 7);
                break;

            case "huge":
                numPlanets = UnityEngine.Random.Range(7, 11);
                break;
            }

            for (int i = 0; i < numPlanets; i++)
            {
                if (i == 2) // third rock from the sun! Randomise this eventually
                {
                    Bodies.Add(new Planet(true, Planet.GetPlanetType(), i.ToString()));
                }
                else
                {
                    Bodies.Add(new Planet(false, Planet.GetPlanetType(), i.ToString()));
                }
            }
        }
        public unsafe void ExtractLines(ref BallSocketPrestepData prestepBundle, int setIndex, int *bodyIndices,
                                        Bodies bodies, ref Vector3 tint, ref QuickList <LineInstance> lines)
        {
            //Could do bundles of constraints at a time, but eh.
            var poseA = bodies.Sets[setIndex].Poses[bodyIndices[0]];
            var poseB = bodies.Sets[setIndex].Poses[bodyIndices[1]];

            Vector3Wide.ReadFirst(prestepBundle.LocalOffsetA, out var localOffsetA);
            Vector3Wide.ReadFirst(prestepBundle.LocalOffsetB, out var localOffsetB);
            QuaternionEx.Transform(localOffsetA, poseA.Orientation, out var worldOffsetA);
            QuaternionEx.Transform(localOffsetB, poseB.Orientation, out var worldOffsetB);
            var endA            = poseA.Position + worldOffsetA;
            var endB            = poseB.Position + worldOffsetB;
            var color           = new Vector3(0.2f, 0.2f, 1f) * tint;
            var packedColor     = Helpers.PackColor(color);
            var backgroundColor = new Vector3(0f, 0f, 1f) * tint;

            lines.AllocateUnsafely() = new LineInstance(poseA.Position, endA, packedColor, 0);
            lines.AllocateUnsafely() = new LineInstance(poseB.Position, endB, packedColor, 0);

            var errorColor       = new Vector3(1, 0, 0) * tint;
            var packedErrorColor = Helpers.PackColor(errorColor);

            lines.AllocateUnsafely() = new LineInstance(endA, endB, packedErrorColor, 0);
        }
        public System.Drawing.Image GetPlanetClassImage()
        {
            if (PlanetClass == null)
            {
                return(GetPlanetImageNotScanned());
            }

            EDPlanet planetclass = PlanetTypeID;

            if (planetclass == EDPlanet.High_metal_content_body || planetclass == EDPlanet.Metal_rich_body)
            {
                if (AtmosphereProperty == (EDAtmosphereProperty.Hot | EDAtmosphereProperty.Thick))
                {
                    planetclass = EDPlanet.High_metal_content_body_hot_thick;
                }
                else if (planetclass == EDPlanet.High_metal_content_body && nSurfaceTemperature > 700)
                {
                    planetclass = EDPlanet.High_metal_content_body_700;
                }
                else if (planetclass == EDPlanet.High_metal_content_body && nSurfaceTemperature > 250)
                {
                    planetclass = EDPlanet.High_metal_content_body_250;
                }
            }

            return(Bodies.GetPlanetClassImage(planetclass));
        }
Example #24
0
        private void extButtonFilter_Click(object sender, EventArgs e)
        {
            ExtendedControls.CheckedIconListBoxFormGroup bodyfilter = new CheckedIconListBoxFormGroup();
            bodyfilter.AddAllNone();
            foreach (var x in Enum.GetNames(typeof(EDPlanet)))
            {
                bodyfilter.AddStandardOption(x.ToString(), x.ToString().Replace("_", " "));
            }
            foreach (var x in Enum.GetNames(typeof(EDStar)))
            {
                bodyfilter.AddStandardOption(x.ToString(), Bodies.StarName(x.ParseEnum <EDStar>()));
            }

            // these are filter types for items which are either do not have scandata or are not stars/bodies.  Only Belts/Barycentre are displayed.. scans of rings/beltculsters are not displayed
            bodyfilter.AddStandardOption("star", "Star");
            bodyfilter.AddStandardOption("body", "Body");
            bodyfilter.AddStandardOption("barycentre", "Barycentre");
            bodyfilter.AddStandardOption("belt", "Belt");

            bodyfilter.SaveSettings = (s, o) =>
            {
                bodyfilters = s.Split(';');
                SQLiteDBClass.PutSettingString(DbSave + "BodyFilters", string.Join(";", bodyfilters));
                DrawSystem();
            };

            bodyfilter.Show(string.Join(";", bodyfilters), extButtonFilter, this.FindForm());
        }
Example #25
0
 public JournalStartJump(JObject evt) : base(evt, JournalTypeEnum.StartJump)
 {
     JumpType          = evt["JumpType"].Str();
     StarSystem        = evt["StarSystem"].Str();
     StarClass         = evt["StarClass"].Str();
     FriendlyStarClass = (StarClass.Length > 0) ? Bodies.StarName(Bodies.StarStr2Enum(StarClass)) : "";
 }
Example #26
0
        /// <summary>
        ///     This method provides the skeletonID of the skeleton perfoming the defined gesture or which should be reactivated.
        ///     <param name="igsSkelId">SkeletonID stored in the IGS</param>
        ///     <returns>ID of the skeleton which was marked as tracked</returns>
        /// </summary>
        public int GetSkeletonId(int igsSkelId)
        {
            if (Bodies.Any(s => s.Id == igsSkelId))
            {
                return(igsSkelId);
            }

            if (!_bodiesLastFrame.Any(s => s.TrackingId != 0))
            {
                return(NO_BODIES_IN_FRAME);
            }

            Bodies = Strategy.Replace(Bodies);

            HashSet <int> idsSeen = new HashSet <int>();

            foreach (TrackedSkeleton s in Bodies)
            {
                idsSeen.Add(s.Id);
            }

            Bodies = Filter.Filter(_bodiesLastFrame, Bodies, igsSkelId, reader);

            //see which user was added
            foreach (TrackedSkeleton s in Bodies.Where(s => !idsSeen.Contains(s.Id)))
            {
                return(s.Id);
            }

            return(NO_GESTURE_FOUND);
        }
Example #27
0
        private void PopulateVertexBuffer()
        {
            var vertArr = Bodies.SelectMany(gb => gb.Vertices()).ToArray();

            totalNumVerts = vertArr.Length;
            OpenGLUtil.PopulateBuffer(vertexBufferID, vertArr);
        }
Example #28
0
        /// <summary>
        /// Runs a simulation on the bodies in the simulator for the simulation
        /// length making time steps and recording the properties of the bodies
        /// to a log file.
        /// </summary>
        public void Simulate()
        {
            if (!this.ValidateSimulation())
            {
                return; // Maybe throw an exception or something instead
            }
            int maxSteps = (int)(this.SimulationLength / this.TimeStep);

            using (StreamWriter file = new StreamWriter(@"D:\My documents\Documents\Dropbox\Programming\C#\Gravity Simulator\Outputs\output.txt"))
            {
                for (int stepsTaken = 0; stepsTaken < maxSteps; stepsTaken++)
                {
                    this.Bodies = CelestialBody.Update(this.Bodies, TimeStep);

                    if (stepsTaken % 10 == 0)
                    {
                        this.Bodies = CelestialBody.CentreOfMass(this.Bodies);
                    }

                    if (stepsTaken % this.PrintResolution == 0)
                    {
                        file.WriteLine(Bodies.ToLog());
                    }
                }

                file.WriteLine(Bodies.ToLog());
            }
        }
Example #29
0
 public void AddBody(Body3d body)
 {
     if (Bodies.Contains(body))
     {
         return;
     }
     Bodies.Add(body);
 }
Example #30
0
 public LatticeBodyGetter(int width, int height, int length, int[] bodyHandles, Bodies bodies)
 {
     this.width       = width;
     this.height      = height;
     this.length      = length;
     this.bodyHandles = bodyHandles;
     this.bodies      = bodies;
 }
Example #31
0
 public AICreature(int x, int y, int z, String name, String desc, char displaychar, Bodies.Body body, CharStats stats)
     : base(x,y,z,name,desc, displaychar, body, stats)
 {
 }