public void ShouldBeAbleToCreateNonDefaultType() { var tile = new SurfaceTile(); tile.Type.Should() .Be(TileType.Surface); }
public WorldSurfaceRenderer( uint samplesPerTile, double distanceAboveSeaLevel, WorldWind.World parentWorld ) { m_SamplesPerTile = samplesPerTile; m_ParentWorld = parentWorld; m_DistanceAboveSeaLevel = distanceAboveSeaLevel; double tileSize = 180.0f / m_NumberRootTilesHigh; m_RootSurfaceTiles = new SurfaceTile[m_NumberRootTilesHigh * (m_NumberRootTilesHigh * 2)]; for (int i = 0; i < m_NumberRootTilesHigh; i++) { for (int j = 0; j < m_NumberRootTilesHigh * 2; j++) { m_RootSurfaceTiles[i * m_NumberRootTilesHigh * 2 + j] = new SurfaceTile( (i + 1) * tileSize - 90.0f, i * tileSize - 90.0f, j * tileSize - 180.0f, (j + 1) * tileSize - 180.0f, 0, this); } } }
/// <summary> /// Creates the surface for the Acceleration based on speed and distance (A(V,d)) /// </summary> /// <returns></returns> public AccelerationSpeedDistanceSurface createAccelerationSpeedDistanceSurface(double expectedEndX, double expectedEndY) { AccelerationSpeedDistanceSurface retVal = new AccelerationSpeedDistanceSurface(); foreach (Segment segment in Segments) { Graph graph = segment.Graph; FlatAccelerationSpeedCurve acc = graph.FlatAccelerationSpeedCurve(expectedEndY); for (int i = 0; i < acc.SegmentCount; i++) { double start = segment.Start; double end = segment.End; if (end == double.MaxValue) { end = expectedEndX; } ConstantCurveSegment <SiSpeed, SiAcceleration> seg = acc[i]; SurfaceTile tile = new SurfaceTile( new SiDistance(start, SiDistance_SubUnits.Meter), new SiDistance(end, SiDistance_SubUnits.Meter), seg.X.X0, seg.X.X1, seg.Y ); retVal.Tiles.Add(tile); } } return(retVal); }
protected void computeTextureTransform(DrawContext dc, SurfaceTile tile, Transform t) { Sector st = tile.getSector(); double tileWidth = st.getDeltaLonRadians(); double tileHeight = st.getDeltaLatRadians(); double minLon = st.getMinLongitude().radians; double minLat = st.getMinLatitude().radians; t.VScale = tileHeight > 0 ? this.sgHeight / tileHeight : 1; t.HScale = tileWidth > 0 ? this.sgWidth / tileWidth : 1; t.VShift = -(minLat - this.sgMinSN) / this.sgHeight; t.HShift = -(minLon - this.sgMinWE) / this.sgWidth; }
public void DestructableSettings() { var tile = new SurfaceTile(); tile.AllowEntrance(digger) .Should() .BeTrue(); var block = new BlockTile(); block.AllowEntrance(digger) .Should() .BeFalse(); }
public void renderTile(DrawContext dc, SurfaceTile tile) { if (tile == null) { String message = Logging.getMessage("nullValue.TileIsNull"); Logging.logger().severe(message); throw new IllegalStateException(message); } ArrayList <SurfaceTile> al = new ArrayList <SurfaceTile>(1); al.add(tile); this.renderTiles(dc, al); al.clear(); }
abstract protected void computeTextureTransform(DrawContext dc, SurfaceTile tile, Transform t);
//public SpaceGame.Game Socket; private Core(bool loadData = true, DataConnector connector = null) { if (connector == null) { dataConnection = new SpacegameServer.DataConnectors.SqlConnector(); } else { dataConnection = connector; } writeToLog("Starting"); InfluenceManager.InitInfluenceRings(); identities.shipLock = new IdentityNumbers(); identities.templateLock = new IdentityNumbers(); identities.colonyId = new IdentityNumbers(); identities.colonyBuildingId = new IdentityNumbers(); identities.planetSurfaceId = new IdentityNumbers(); identities.allianceId = new IdentityNumbers(); identities.commNode = new IdentityNumbers(); identities.commNodeMessage = new IdentityNumbers(); identities.message = new IdentityNumbers(); identities.combat = new IdentityNumbers(); identities.galacticEvents = new IdentityNumbers(); identities.trades = new IdentityNumbers(); identities.routes = new IdentityNumbers(); identities.chat = new IdentityNumbers(); //fill the regions array with (yet empty) regions //ToDo: this leads to a maximum siz of the world. Units should not leave the area... GeometryIndex.createIndex(); //RULES //int ObjectDescriptionsSize = 20000; int GoodsSize = 10000; int BuildingsSize = 10000; int ModuleSize = 5000; int SurfaceImagesSize = 50; //TODO int ShipHullsSize = 230; //int ShipHullsImagesSize = 100; int QuestSize = 1000; int ResearchsSize = 10000; //int SpecializationGroupSize = 10; int ResearchQuestPrerequisitesSize = 500; int SurfaceTilesSize = 30; int languageSize = 8; //MAP //int StarMapSize = 100000; //int SolarSystemInstanceSize = 1000000; //int PlanetSurfaceSize = 1000000; //USERS //int UserSize = 1000; //int ShipTemplateSize = UserSize * 1000; //int ShipSize = UserSize * 100; //int ColonySize = UserSize * 10; //int ColonyBuildingSize = ColonySize * 100; NodeQuadTree.BoundarySouthWest boundarySouthWest = new NodeQuadTree.BoundarySouthWest(4096, 4096); NodeQuadTree.Bounding NodeQuadTreeBounding = new NodeQuadTree.Bounding(boundarySouthWest, 2048); nodeQuadTree = new NodeQuadTree.NodeQuadTree(NodeQuadTreeBounding); //RULES ObjectDescriptions = new Dictionary <int, ObjectDescription>(); //[ObjectDescriptionsSize]; ObjectsOnMap = new Dictionary <short, ObjectOnMap>(); ObjectWeaponModificators = new Dictionary <short, Dictionary <short, ObjectWeaponModificator> >(); Goods = new Good[GoodsSize]; Buildings = new Building[BuildingsSize]; PlanetTypes = new List <PlanetType>(10); Modules = new Module[ModuleSize]; ShipHulls = new ShipHull[ShipHullsSize]; ShipHullsImages = new List <ShipHullsImage>(); Quests = new Quest[QuestSize]; Researchs = new Research[ResearchsSize]; ResearchGains = new List <ResearchGain>(); SpecializationGroups = new List <SpecializationGroup>(); ResearchQuestPrerequisites = new List <ResearchQuestPrerequisite>(ResearchQuestPrerequisitesSize); SurfaceImages = new SurfaceImage[SurfaceImagesSize]; SurfaceTiles = new SurfaceTile[SurfaceTilesSize]; BuildOptions = new List <BuildOption>(); objectRelations = new List <ResearchQuestPrerequisite>(1000); surfaceDefaultMaps = new List <SurfaceDefaultMap>(3000); TurnEvaluations = new List <TurnEvaluation>(1000); languages = new Language[languageSize]; //SurfaceImages = new SurfaceImages //MAP stars = new Dictionary <int, SystemMap>(); // StarMap[StarMapSize]; planets = new Dictionary <int, SolarSystemInstance>(); //[SolarSystemInstanceSize]; planetSurface = new Dictionary <long, PlanetSurface>(); // [PlanetSurfaceSize]; //USERS users = new ConcurrentDictionary <int, User>(); // [UserSize]; shipTemplate = new ConcurrentDictionary <int, ShipTemplate>(); // ShipTemplate[ShipTemplateSize]; ships = new ConcurrentDictionary <int, Ship>(); //Ship[ShipSize]; colonies = new ConcurrentDictionary <int, Colony>(); //Colony[ColonySize]; colonyBuildings = new ConcurrentDictionary <int, ColonyBuilding>(); //ColonyBuilding[ColonyBuildingSize]; alliances = new ConcurrentDictionary <int, Alliance>(); invitesPerAlliance = new ConcurrentDictionary <int, List <int> >(); invitesPerUser = new ConcurrentDictionary <int, List <int> >(); tradeOffer = new ConcurrentDictionary <int, TradeOffer>(); routes = new ConcurrentDictionary <int, Route>(); chatLog = new ConcurrentDictionary <int, ChatLog>(); userRelations = new UserRelations(); labels = new List <Label>(); shipRefits = new List <shipRefit>(); commNodes = new ConcurrentDictionary <int, CommunicationNode>(); messages = new ConcurrentDictionary <int, MessageHead>(); combats = new ConcurrentDictionary <int, Combat>(); galactivEvents = new ConcurrentDictionary <int, GalacticEvents>(); //read all data if (loadData) { dataConnection.loadData(this); } /* * (new TurnSummary(this)).researchSpread(this); //Todo - remove, save to db after turn summary, restore from db when getAll(_core); is called * (new TurnSummary(this)).CalcGalaxyOwnership(); * * * //update data in all ships * foreach (var ship in this.ships.Values) * { * var clone = ship.clone(); * SpacegameServer.Core.StatisticsCalculator.calc(clone, this); * ship.CombatMaxHitpoint = clone.hitpoints; * ship.CombatStartHitpoint = ship.hitpoints; * } * * * //TODO * if (identities.shipLock.id == -1) identities.shipLock.id = 1000; //ToDo: F***ing ugly stupid and not even really functioning workaround, :ToDo : 1000 is a really bad workaround, because ships and colonies will sometimes (for example during trading) be stored in the same array as spaceobjects... * * * createTurnTimer(); */ }