예제 #1
0
파일: SCANkscMap.cs 프로젝트: DBT85/SCANsat
		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;
		}
예제 #2
0
파일: SCANbigMap.cs 프로젝트: DBT85/SCANsat
		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;
		}
예제 #3
0
 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;
 }
예제 #4
0
        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;
        }
예제 #5
0
        public void setMapCenter(double lat, double lon, SCANmap big)
        {
            Visible = true;
            bigmap  = big;

            SCANcontroller.controller.TargetSelecting       = false;
            SCANcontroller.controller.TargetSelectingActive = false;

            if (bigmap.Projection == MapProjection.Polar)
            {
                spotmap.setProjection(MapProjection.Polar);
            }
            else
            {
                spotmap.setProjection(MapProjection.Rectangular);
            }

            if (bigmap.Body != b)
            {
                SCANdata dat = SCANUtil.getData(bigmap.Body);
                if (dat == null)
                {
                    dat = new SCANdata(bigmap.Body);
                }

                data = dat;
                b    = data.Body;

                spotmap.setBody(b);
            }

            if (SCANconfigLoader.GlobalResource && narrowBand)
            {
                spotmap.Resource = bigmap.Resource;
                spotmap.Resource.CurrentBodyConfig(b.name);
            }

            spotmap.MapScale = 10;

            spotmap.centerAround(lon, lat);
            if (SCANcontroller.controller.needsNarrowBand && SCANcontroller.controller.map_ResourceOverlay)
            {
                checkForScanners();
            }
            spotmap.resetMap(bigmap.MType, false, narrowBand);
        }
예제 #6
0
 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;
 }
예제 #7
0
        //Draw the drop down menus if any have been opened
        private void dropDown(int id)
        {
            if (projection_drop_down)
            {
                ddRect = new Rect(110, 45, 100, 70);
                GUI.Box(ddRect, "");
                for (int i = 0; i < SCANmapProjection.projectionNames.Length; ++i)
                {
                    Rect r = new Rect(ddRect.x + 2, ddRect.y + (24 * i), ddRect.width - 4, 20);
                    if (GUI.Button(r, SCANmapProjection.projectionNames[i], SCANskins.SCAN_dropDownButton))
                    {
                        bigmap.setProjection((MapProjection)i);
                        bigmap.resetMap();
                        SCANcontroller.controller.projection = i;
                        drawGrid       = true;
                        drop_down_open = false;
                    }
                }
            }

            else if (mapType_drop_down)
            {
                ddRect = new Rect(270, 45, 70, 70);
                GUI.Box(ddRect, "");
                for (int i = 0; i < SCANmapType.mapTypeNames.Length; i++)
                {
                    Rect r = new Rect(ddRect.x + 2, ddRect.y + (24 * i), ddRect.width - 4, 20);
                    if (GUI.Button(r, SCANmapType.mapTypeNames[i], SCANskins.SCAN_dropDownButton))
                    {
                        bigmap.resetMap((mapType)i, true);
                        drop_down_open = false;
                    }
                }
            }

            else if (resources_drop_down)
            {
                ddRect = new Rect(WindowRect.width - 290, 45, 120, 160);
                GUI.Box(ddRect, "");
                for (int i = 0; i < loadedResources.Count; i++)
                {
                    scrollR = GUI.BeginScrollView(ddRect, scrollR, new Rect(0, 0, 100, 20 * loadedResources.Count));
                    Rect r = new Rect(2, 20 * i, 96, 20);
                    if (GUI.Button(r, loadedResources[i].Name, SCANskins.SCAN_dropDownButton))
                    {
                        bigmap.Resource = loadedResources[i];
                        bigmap.Resource.CurrentBodyConfig(bigmap.Body.name);

                        SCANcontroller.controller.resourceSelection = bigmap.Resource.Name;

                        if (SCANcontroller.controller.map_ResourceOverlay)
                        {
                            bigmap.resetMap();
                        }

                        drop_down_open = false;
                    }
                    GUI.EndScrollView();
                }
            }

            else if (planetoid_drop_down)
            {
                int j = 0;
                ddRect = new Rect(WindowRect.width - 130, 45, 100, 160);
                GUI.Box(ddRect, "");
                for (int i = 0; i < SCANcontroller.controller.GetDataCount; i++)
                {
                    scrollP = GUI.BeginScrollView(ddRect, scrollP, new Rect(0, 0, 80, (20 * SCANcontroller.controller.GetDataCount) + 1));

                    SCANdata dropDownData = SCANcontroller.controller.getData(i);
                    if (dropDownData != null)
                    {
                        Rect r = new Rect(2, 20 * j, 76, 20);
                        if (GUI.Button(r, dropDownData.Body.name, SCANskins.SCAN_dropDownButton))
                        {
                            data = dropDownData;
                            b    = data.Body;
                            bigmap.setBody(data.Body);
                            bigmap.resetMap();
                            drop_down_open = false;
                        }
                        j++;
                    }
                    GUI.EndScrollView();
                }
            }

            else
            {
                drop_down_open = false;
            }
        }