protected void RevealObject(SimulationEvent ev) { lock (GroundTruthLock) { String id = ((StringValue)ev["ObjectID"]).value; AttributeCollectionValue atts = ev["Attributes"] as AttributeCollectionValue; SeamateObject seamateObject = null; if (_unrevealedObjects.ContainsKey(id)) { seamateObject = _unrevealedObjects[id]; _unrevealedObjects.Remove(id); Console.WriteLine("Removed from UnrevealedObjects: " + id); } else { seamateObject = new SeamateObject(id); } seamateObject.SetAttributes(atts); if (_revealedObjects.ContainsKey(id)) { _revealedObjects.Remove(id); } _revealedObjects.Add(id, seamateObject); Console.WriteLine("Added to RevealedObjects: " + id); if (atts.attributes.ContainsKey("OwnerID")) { EstablishOwnership(id, ((StringValue)atts.attributes["OwnerID"]).value); } } }
public static SeamateObject FromDDDObject(SimObject baseObject) { SeamateObject obj = new SeamateObject(baseObject.ID); obj.Capabilities = baseObject.Capabilities; obj.CapabilityList = baseObject.CapabilityList; obj.CapabilityRangeRings = baseObject.CapabilityRangeRings; obj.ChildObjects = baseObject.ChildObjects; obj.ClassName = baseObject.ClassName; obj.CustomAttributes = baseObject.CustomAttributes; obj.DestinationLocation = baseObject.DestinationLocation; obj.DockedObjects = baseObject.DockedObjects; obj.DockedToParent = baseObject.DockedToParent; obj.DockedWeapons = baseObject.DockedWeapons; obj.FuelAmount = baseObject.FuelAmount; obj.FuelCapacity = baseObject.FuelCapacity; obj.FuelConsumptionRate = baseObject.FuelConsumptionRate; obj.IconName = baseObject.IconName; obj.InActiveRegions = baseObject.InActiveRegions; obj.IsWeapon = baseObject.IsWeapon; obj.Location = baseObject.Location; obj.MaximumSpeed = baseObject.MaximumSpeed; obj.Owner = baseObject.Owner; obj.ParentObjectID = baseObject.ParentObjectID; obj.Sensors = baseObject.Sensors; obj.ShouldProject = baseObject.ShouldProject; obj.State = baseObject.State; obj.TeamName = baseObject.TeamName; obj.Throttle = baseObject.Throttle; obj.Velocity = baseObject.Velocity; obj.Vulnerabilities = baseObject.Vulnerabilities; obj.VulnerabilityList = baseObject.VulnerabilityList; obj.VulnerabilityRangeRings = baseObject.VulnerabilityRangeRings; //obj.GroundTruthIFF; //obj.Heading; //obj.SensorRange; return(obj); }
private void ProcessObject(SimulationEvent ev) { String id = ((StringValue)ev["ID"]).value; String objectType = ((StringValue)((AttributeCollectionValue)ev["Attributes"])["ClassName"]).value; AttributeCollectionValue atts = ev["Attributes"] as AttributeCollectionValue; SeamateObject seamateObject = null; if (_unrevealedObjects.ContainsKey(id)) { } else { _unrevealedObjects.Add(id, new SeamateObject(id)); Console.WriteLine("Added to UnrevealedObjects: " + id); } _unrevealedObjects[id].SetAttributes(atts); if (atts.attributes.ContainsKey("OwnerID")) { EstablishOwnership(id, ((StringValue)atts.attributes["OwnerID"]).value); } if (ev.parameters.ContainsKey("StateTable") && !_speciesPossibleStates.ContainsKey(objectType)) { _speciesPossibleStates.Add(objectType, new Dictionary <string, AttributeCollectionValue>()); StateTableValue stv = (StateTableValue)ev["StateTable"]; AttributeCollectionValue stateAttributes = null; foreach (String stateName in stv.states.Keys) { stateAttributes = (AttributeCollectionValue)stv[stateName]; _speciesPossibleStates[objectType].Add(stateName, new AttributeCollectionValue()); foreach (String att in stateAttributes.attributes.Keys) { _speciesPossibleStates[objectType][stateName].attributes.Add(att, DataValueFactory.BuildFromDataValue(stateAttributes[att])); } } } }
public static SeamateObject FromDDDObject(SimObject baseObject) { SeamateObject obj = new SeamateObject(baseObject.ID); obj.Capabilities = baseObject.Capabilities; obj.CapabilityList = baseObject.CapabilityList; obj.CapabilityRangeRings = baseObject.CapabilityRangeRings; obj.ChildObjects = baseObject.ChildObjects; obj.ClassName = baseObject.ClassName; obj.CustomAttributes = baseObject.CustomAttributes; obj.DestinationLocation = baseObject.DestinationLocation; obj.DockedObjects = baseObject.DockedObjects; obj.DockedToParent = baseObject.DockedToParent; obj.DockedWeapons = baseObject.DockedWeapons; obj.FuelAmount = baseObject.FuelAmount; obj.FuelCapacity = baseObject.FuelCapacity; obj.FuelConsumptionRate = baseObject.FuelConsumptionRate; obj.IconName = baseObject.IconName; obj.InActiveRegions = baseObject.InActiveRegions; obj.IsWeapon = baseObject.IsWeapon; obj.Location = baseObject.Location; obj.MaximumSpeed = baseObject.MaximumSpeed; obj.Owner = baseObject.Owner; obj.ParentObjectID = baseObject.ParentObjectID; obj.Sensors = baseObject.Sensors; obj.ShouldProject = baseObject.ShouldProject; obj.State = baseObject.State; obj.TeamName = baseObject.TeamName; obj.Throttle = baseObject.Throttle; obj.Velocity = baseObject.Velocity; obj.Vulnerabilities = baseObject.Vulnerabilities; obj.VulnerabilityList = baseObject.VulnerabilityList; obj.VulnerabilityRangeRings = baseObject.VulnerabilityRangeRings; //obj.GroundTruthIFF; //obj.Heading; //obj.SensorRange; return obj; }
Boolean isInEntryRegion(SeamateObject ob) { foreach (PolygonValue region in GetAllEntryRegions()) { if (Polygon2D.IsPointInside(new Polygon2D(region), new Vec2D(ob.Location))) { return true; } } return false; }