protected override void Start() { Visible = SCANcontroller.controller.kscMapVisible; if (b == null) { b = Planetarium.fetch.Home; } if (bigmap == null) { bigmap = new SCANmap(b, true); bigmap.setProjection((MapProjection)SCANcontroller.controller.projection); bigmap.setWidth(720); } currentColor = SCANcontroller.controller.colours == 0; lastColor = currentColor; lastResource = SCANcontroller.controller.map_ResourceOverlay; WindowCaption = string.Format("Map of {0}", b.theName); data = SCANUtil.getData(b); if (data == null) { data = new SCANdata(b); SCANcontroller.controller.addToBodyData(b, data); } bigmap.setBody(b); if (SCANconfigLoader.GlobalResource) { loadedResources = SCANcontroller.setLoadedResourceList(); } TooltipsEnabled = SCANcontroller.controller.toolTips; }
private void RedrawMap() { map = new SCANmap(); map.setProjection(SCANmap.MapProjection.Rectangular); orbitingBody = vessel.mainBody; map.setBody(vessel.mainBody); map.setSize(screenWidth, screenHeight); map.mapscale *= (zoomLevel * zoomLevel + zoomModifier); mapCenterLong = vessel.longitude; mapCenterLat = vessel.latitude; // That's really just sweeping the problem under the carpet instead of fixing it, but meh. if (zoomLevel == 0) { mapCenterLat = 0; } map.centerAround(mapCenterLong, mapCenterLat); map.resetMap(mapMode); // Compute and store the map scale factors in mapSizeScale. We // use these values for every segment when drawing trails, so it // makes sense to compute it only when it changes. mapSizeScale = new Vector2d(360.0 * map.mapscale / map.mapwidth, 180.0 * map.mapscale / map.mapheight); redrawDeviation = redrawEdge * 180 / (zoomLevel * zoomLevel + zoomModifier); try { localAnomalies = SCANcontroller.controller.getData(vessel.mainBody).getAnomalies(); } catch { Debug.Log("JSISCANsatRPM: Could not get a list of anomalies, what happened?"); } // MATH! double kmPerDegreeLon = (2 * Math.PI * (orbitingBody.Radius / 1000d)) / 360d; double pixelsPerDegree = Math.Abs(longitudeToPixels(mapCenterLong + (((mapCenterLong + 1) > 360) ? -1 : 1), mapCenterLat) - longitudeToPixels(mapCenterLong, mapCenterLat)); pixelsPerKm = pixelsPerDegree / kmPerDegreeLon; }
private void Startup() { //Initialize the map object Visible = false; if (HighLogic.LoadedSceneIsFlight) { v = SCANcontroller.controller.BigMap.V; b = SCANcontroller.controller.BigMap.Body; data = SCANcontroller.controller.BigMap.Data; } else if (HighLogic.LoadedSceneHasPlanetarium) { v = null; b = SCANcontroller.controller.kscMap.Body; data = SCANcontroller.controller.kscMap.Data; } if (spotmap == null) { spotmap = new SCANmap(); spotmap.setSize(320, 240); } showOrbit = SCANcontroller.controller.map_orbit; showAnomaly = SCANcontroller.controller.map_markers; if (HighLogic.LoadedScene == GameScenes.SPACECENTER) { showWaypoints = false; } else { showWaypoints = SCANcontroller.controller.map_waypoints; } TooltipsEnabled = SCANcontroller.controller.toolTips; spotmap.setBody(b); }
protected override void Start() { //Initialize the map object Visible = SCANcontroller.controller.bigMapVisible; if (v == null) { v = FlightGlobals.ActiveVessel; } if (b == null) { b = v.mainBody; } if (bigmap == null) { bigmap = new SCANmap(b, true); bigmap.setProjection((MapProjection)SCANcontroller.controller.projection); bigmap.setWidth(SCANcontroller.controller.map_width); } WindowRect.x = SCANcontroller.controller.map_x; WindowRect.y = SCANcontroller.controller.map_y; currentColor = SCANcontroller.controller.colours == 0; lastColor = currentColor; lastResource = SCANcontroller.controller.map_ResourceOverlay; WindowCaption = string.Format("Map of {0}", b.theName); data = SCANUtil.getData(b); if (data == null) { data = new SCANdata(b); SCANcontroller.controller.addToBodyData(b, data); } bigmap.setBody(b); if (SCANconfigLoader.GlobalResource) { loadedResources = SCANcontroller.setLoadedResourceList(); } TooltipsEnabled = SCANcontroller.controller.toolTips; }