public Texture2D generateTexture(MapProvider provider, BBox bbox, int i, int j, string OSMFileName)
        {
            string[] proj = OSMFileName.Split(new char[] {'/', '\\'});
            string projectName = proj[proj.Length - 1];

            if (File.Exists(tileFolder + "/final/" + provider.ToString("G") + "_" + projectName + "_" + i + "_" + j + ".png"))
            {
                byte[] fileData;
                fileData = File.ReadAllBytes(tileFolder + "/final/" + provider.ToString("G") + "_" + projectName + "_" + i + "_" + j + ".png");
                Texture2D texture = new Texture2D(2, 2);
                texture.LoadImage(fileData);
                return texture;
            }

            Texture2D uncroppedTexture = generateUncroppedTexture(bbox, provider, i, j);
            Rect cropWindow = generateCroppingRect(bbox);
            Texture2D finalTexture = CropTexture(uncroppedTexture, cropWindow);

            if (!Directory.Exists(tileFolder + "/final/"))
                Directory.CreateDirectory(tileFolder + "/final/");

            var tex = new Texture2D(finalTexture.width, finalTexture.height);
            tex.SetPixels32(finalTexture.GetPixels32());
            tex.Apply(false);
            File.WriteAllBytes(tileFolder + "/final/" + provider.ToString("G") + "_" + projectName + "_" + i + "_" + j + ".png", tex.EncodeToPNG());

            return finalTexture;
        }
Ejemplo n.º 2
0
 public void InitializeGrid(string scenename, LatLngBox llbox, string mapcoordname = "", MapProvider mapprov = MapProvider.Bing, ElevProvider elevprov = ElevProvider.Bing)
 {
     this.scenename     = scenename;
     this.mapcoordname  = mapcoordname;
     this.mapprov       = mapprov;
     this.elevprov      = elevprov;
     this.levelOfDetail = llbox.lod;
     this.llmap         = this.gameObject.AddComponent <LatLongMap>();
     this.qmapElev      = gameObject.AddComponent <QmapElevation>();
     this.qkm           = new QkMan(this, this.mapcoordname, mapprov, llbox);
     this.qtt           = this.gameObject.AddComponent <Qtrilines>();
     qtt.Init(this);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Creates new instance of <see cref="ObjectMap"/> class.
 /// </summary>
 public ObjectMap()
 {
     m_mapProvider = new SortedMapProvider(MINSIZE);
 }
Ejemplo n.º 4
0
        private void EditorLoad(object sender, EventArgs e)
        {
            FileTypeRegistration.RegisterFileTypes();

            SettingsManager.Read();

            if (TaskbarManager.IsPlatformSupported)
            {
                TaskbarManager.Instance.ApplicationId = FileTypeRegistration.ProgramId;

                _jumpList = JumpList.CreateJumpList();
                _jumpList.KnownCategoryToDisplay = JumpListKnownCategoryType.Recent;
                _jumpList.Refresh();
            }

            UpdateDocumentTabs();
            UpdateRecentFiles();

            DockBottom.Hidden = DockLeft.Hidden = DockRight.Hidden = true;

            MenuManager.Init(mnuMain, tscToolStrip);
            MenuManager.Rebuild();

            BrushManager.Init();
            SidebarManager.Init(RightSidebar);

            ViewportManager.Init(TableSplitView);
            ToolManager.Init();

            foreach (var tool in ToolManager.Tools)
            {
                var tl     = tool;
                var hotkey = CBRE.Settings.Hotkeys.GetHotkeyForMessage(HotkeysMediator.SwitchTool, tool.GetHotkeyToolType());
                tspTools.Items.Add(new ToolStripButton(
                                       "",
                                       tl.GetIcon(),
                                       (s, ea) => Mediator.Publish(HotkeysMediator.SwitchTool, tl.GetHotkeyToolType()),
                                       tl.GetName())
                {
                    Checked      = (tl == ToolManager.ActiveTool),
                    ToolTipText  = tl.GetName() + (hotkey != null ? " (" + hotkey.Hotkey + ")" : ""),
                    DisplayStyle = ToolStripItemDisplayStyle.Image,
                    ImageScaling = ToolStripItemImageScaling.None,
                    AutoSize     = false,
                    Width        = 36,
                    Height       = 36
                }
                                   );
            }

            TextureProvider.SetCachePath(SettingsManager.GetTextureCachePath());
            MapProvider.Register(new CBRProvider());
            MapProvider.Register(new VmfProvider());
            MapProvider.Register(new L3DWProvider());
            MapProvider.Register(new MSL2Provider());
            GameDataProvider.Register(new FgdProvider());
            TextureProvider.Register(new SprProvider());
            TextureProvider.Register(new MiscTexProvider());
            ModelProvider.Register(new AssimpProvider());

            TextureHelper.EnableTransparency       = !CBRE.Settings.View.GloballyDisableTransparency;
            TextureHelper.DisableTextureFiltering  = CBRE.Settings.View.DisableTextureFiltering;
            TextureHelper.ForceNonPowerOfTwoResize = CBRE.Settings.View.ForcePowerOfTwoTextureResizing;

            Subscribe();

            Mediator.MediatorException += (mthd, ex) => Logging.Logger.ShowException(ex.Exception, "Mediator Error: " + ex.Message);

            if (!Directories.TextureDirs.Any())
            {
                OpenSettings(4);
            }

            if (CBRE.Settings.View.LoadSession)
            {
                foreach (var session in SettingsManager.LoadSession())
                {
                    LoadFileGame(session, SettingsManager.Game);
                }
            }

            ProcessArguments(System.Environment.GetCommandLineArgs());

            ViewportManager.RefreshClearColour(DocumentTabs.TabPages.Count == 0);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Creates new instance of <see cref="ObjectMap"/> class.
 /// </summary>
 public ObjectMap()
 {
     m_mapProvider = new SortedMapProvider(MINSIZE);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// See interface docs.
 /// </summary>
 /// <param name="mapProvider"></param>
 /// <returns></returns>
 public TileServerSettings[] GetAllTileLayerSettings(MapProvider mapProvider)
 {
     return(GetAllTileServerSettings(mapProvider, isLayer: true));
 }
    /// <summary>
    /// Ensures the given node within the tree.
    /// </summary>
    /// <param name="node">Node to ensure</param>
    /// <param name="nodeId">Ensure by NodeID</param>
    protected void EnsureNode(TreeNode node, int nodeId)
    {
        if (node == null)
        {
            // If not already exists, do not add
            if (allNodes[nodeId] != null)
            {
                return;
            }
            else
            {
                // Get the node
                node = TreeProvider.SelectSingleNode(nodeId, TreeProvider.ALL_CULTURES, true);

                if (!SelectPublishedData)
                {
                    node = DocumentHelper.GetDocument(node, TreeProvider);
                }
            }
        }
        else
        {
            nodeId = node.NodeID;
        }

        if (node != null)
        {
            // Get the correct parent node
            System.Web.UI.WebControls.TreeNode parentNode = (System.Web.UI.WebControls.TreeNode)allNodes[node.NodeParentID];
            if (parentNode != null)
            {
                // Expand the parent
                parentNode.Expanded = true;

                // If still not present, add the node
                if (allNodes[nodeId] == null)
                {
                    TreeSiteMapNode sourceNode = new TreeSiteMapNode(MapProvider, nodeId.ToString());
                    sourceNode.TreeNode = node;

                    System.Web.UI.WebControls.TreeNode newNode = CreateNode(sourceNode, 0, true);

                    // If MaxTreeNodes threshold reached, sourceNode must be placed before "Click here..." node
                    if (parentNode.ChildNodes.Count >= MaxTreeNodes)
                    {
                        parentNode.ChildNodes.AddAt(parentNode.ChildNodes.Count - 1, newNode);
                    }
                    else
                    {
                        parentNode.ChildNodes.Add(newNode);
                    }
                }
            }
            else
            {
                // Get the correct node and add it to list of processed nodes
                TreeSiteMapNode targetNode = MapProvider.GetNodeByAliasPath(node.NodeAliasPath);

                if (targetNode != null)
                {
                    List <int> procNodes = new List <int>();
                    procNodes.Add((int)targetNode.NodeData["NodeID"]);

                    if (targetNode.ParentNode != null)
                    {
                        // Repeat until existing parent node in allNodes is found
                        do
                        {
                            int targetParentNodeId = (int)((TreeSiteMapNode)targetNode.ParentNode).NodeData["NodeID"];
                            procNodes.Add(targetParentNodeId);
                            targetNode = (TreeSiteMapNode)targetNode.ParentNode;
                        } while ((targetNode.ParentNode != null) && (allNodes[(int)(((TreeSiteMapNode)(targetNode.ParentNode)).NodeData["NodeID"])] == null));
                    }

                    // Process nodes in reverse order
                    procNodes.Reverse();
                    if (!procNodes.Any(p => (p <= 0)))
                    {
                        foreach (int nodeID in procNodes)
                        {
                            EnsureNode(null, nodeID);
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 8
0
 /// <summary>
 /// Returns a collection of tile server settings that are clones of the ones passed in but with the real
 /// URLs swapped out for fake ones.
 /// </summary>
 /// <param name="mapProvider"></param>
 /// <param name="settings"></param>
 /// <returns></returns>
 private TileServerSettings[] CloneAndReplaceManyRealTileServerSettingsWithFake(MapProvider mapProvider, IEnumerable <TileServerSettings> settings)
 {
     return(settings
            .Select(r => CloneAndReplaceRealTileServerSettingsWithFake(mapProvider, r))
            .ToArray());
 }
Ejemplo n.º 9
0
 public ManageMapController()
 {
     this.mapProvider = (MapProvider)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(MapProvider));
 }
        private Texture2D generateUncroppedTexture(BBox bbox, MapProvider provider, int ii, int jj)
        {
            Vector2 mintileCoord = new Vector2();
            Vector2 maxtileCoord = new Vector2();

            FindTiles(bbox, ref mintileCoord, ref maxtileCoord);

            Debug.Log("<color=green>TEXTURE:</color> mintile X:" + mintileCoord.x + " Y:" + mintileCoord.y +
                " maxtile X:" + maxtileCoord.x + " Y:" + maxtileCoord.y);

            int ColumnCount = (int)(1 + maxtileCoord.x - mintileCoord.x);
            int RowCount = (int)(1 + mintileCoord.y - maxtileCoord.y);

            Texture2D[,] textures = new Texture2D[RowCount, ColumnCount];

            for (int i = (int)maxtileCoord.y, m=0; i <= (int)mintileCoord.y ; i++,m++)
            {
                for(int j= (int) mintileCoord.x, n=0 ; j <= (int) maxtileCoord.x ; j++, n++)
                {
                    textures[m,n] = DownloadTile(j, i, provider);
                }
            }

            Texture2D finalTexture = ConcatTexture(textures, ColumnCount, RowCount);
            return finalTexture;
        }
        private Texture2D DownloadTile(int tilex,int tiley, MapProvider provider)
        {
            string _URL = "";
            if(!Directory.Exists(tileFolder + provider.ToString("G")))
                Directory.CreateDirectory(tileFolder+ provider.ToString("G"));

            string savedfileName =  + zoomLevel + "_" + tilex + "_" + tiley;

            switch (provider)
            {
                case MapProvider.MapQuest:
                    _URL = "http://otile1.mqcdn.com/tiles/1.0.0/osm/" + zoomLevel.ToString() + "/" + tilex.ToString() + "/" + tiley.ToString() + ".png";

                    savedfileName = savedfileName + ".png";
                    break;
                case MapProvider.OpenStreetMap:
                    _URL = "http://" + "a" + ".tile.openstreetmap.org/" + zoomLevel.ToString() + "/" + tilex.ToString() + "/" + tiley.ToString() + ".png";
                    savedfileName = savedfileName + ".png";
                    break;

                case MapProvider.OpenStreetMapNoLabel:
                    _URL = "http://a.tiles.wmflabs.org/osm-no-labels/" + zoomLevel.ToString() + "/" + tilex.ToString() + "/" + tiley.ToString() + ".png";
                    savedfileName = savedfileName + ".png";
                    break;

                case MapProvider.BingMapStreet:
                    _URL = "http://ecn.t" + ((tilex + tiley) % 7).ToString() + ".tiles.virtualearth.net/tiles/" + "r";
                    for (int i = zoomLevel - 1; i >= 0; i--)
                    {
                        _URL = _URL + (((((tiley >> i) & 1) << 1) + ((tilex >> i) & 1)));
                    }
                    _URL = _URL + ".png" + "?g=409&mkt=en-us";
                    savedfileName = savedfileName + ".png";
                    break;

                case MapProvider.BingMapAerial:
                    _URL = "http://ecn.t" + ((tilex + tiley) % 7).ToString() + ".tiles.virtualearth.net/tiles/" + "a";
                    for (int i = zoomLevel - 1; i >= 0; i--)
                    {
                        _URL = _URL + (((((tiley >> i) & 1) << 1) + ((tilex >> i) & 1)));
                    }
                    _URL = _URL + ".jpeg" + "?g=409&mkt=en-us";
                    savedfileName = savedfileName + ".jpg";
                    break;

                default:
                    return null;
            }

            try
            {
                FileDownloader.downloadfromURL(_URL, tileFolder + provider.ToString("G") + "/" + savedfileName);
            }
            catch
            {
                if(provider == MapProvider.OpenStreetMapNoLabel)
                {
                    _URL = "http://" + "a" + ".tile.openstreetmap.org/" + zoomLevel.ToString() + "/" + tilex.ToString() + "/" + tiley.ToString() + ".png";
                    FileDownloader.downloadfromURL(_URL, tileFolder + provider.ToString("G") + "/" + savedfileName);
                }

            }

            byte[] fileData;
            fileData = File.ReadAllBytes(tileFolder + provider.ToString("G") + "/" + savedfileName);
            Texture2D texture = new Texture2D(2, 2);
            texture.LoadImage(fileData);
            return texture;
        }
Ejemplo n.º 12
0
    public async Task <(QmapMesh, int, int)> MakeMeshFromLlbox(string scenename, LatLngBox llbox, int tpqk = 4, float hmult = 1, string mapcoordname = "", MapExtentTypeE mapextent = MapExtentTypeE.SnapToTiles, MapProvider mapprov = MapProvider.Bing, ElevProvider elevprov = ElevProvider.Bing, bool execute = true, bool forceload = false,
                                                               bool limitQuadkeys = true, QmapMesh.sythTexMethod synthTex   = QmapMesh.sythTexMethod.Quadkeys, HeightTypeE heitType = HeightTypeE.FetchedAndZeroed)
    {
        var wpstays = false;

        Debug.Log($"QmapMan.MakeMeshFromLlbox scenename:{scenename} wpstays:{wpstays}");
        this.mapprov      = mapprov;
        this.elevprov     = elevprov;
        this.scenename    = scenename;
        this.mapcoordname = mapcoordname;
        if (rgo != null)
        {
            Destroy(rgo);
            rgo = null;
        }
        rgo = new GameObject("rgo");
        rgo.transform.SetParent(this.transform, worldPositionStays: wpstays);
        qkgo = new GameObject("QmapMesh");
        qkgo.transform.SetParent(rgo.transform, worldPositionStays: wpstays);
        qkgo.transform.position = Vector3.zero;

        var qmmcomp = qkgo.AddComponent <QmapMesh>();

        qmmcomp.descriptor = $"{scenename} {llbox.lod} {mapprov} {mapextent}";
        qmmcomp.InitializeGrid(scenename, llbox, mapcoordname: mapcoordname);
        qmmcomp.secsPerQkTile    = tpqk;
        qmmcomp.useElevationData = useElevationDataStart;
        qmmcomp.mapExtent        = mapextent;
        qmmcomp.hmult            = hmult;
        qmmcomp.synthTex         = synthTex;
        qmmcomp.limitQuadkeys    = limitQuadkeys;
        qmmcomp.heightType       = heitType;

        (var nbm, var nel) = await qmmcomp.GenerateGrid(execute, forceload, limitQuadkeys : limitQuadkeys);

        return(qmmcomp, nbm, nel);
    }
Ejemplo n.º 13
0
    public async Task <(QmapMesh, int, int)> MakeMesh(string scenename, int lod, LatLng ll1, LatLng ll2, string mapcoordname = "", int tpqk = 4, float hmult = 1, MapProvider mapprov = MapProvider.Bing, ElevProvider elevprov = ElevProvider.Bing)
    {
        var llbox = new LatLngBox(ll1, ll2, scenename, lod: lod);

        return(await MakeMeshFromLlbox(scenename, llbox, mapcoordname : mapcoordname, tpqk : tpqk, hmult : hmult, mapprov : mapprov, elevprov : elevprov));
    }
Ejemplo n.º 14
0
 /// <summary>
 /// See interface.
 /// </summary>
 /// <param name="mapProvider"></param>
 /// <returns></returns>
 public bool MapProviderUsesTileServers(MapProvider mapProvider)
 {
     return(_DefaultImplementation.MapProviderUsesTileServers(mapProvider));
 }
Ejemplo n.º 15
0
        public myTerrain(HeightmapLoader _heightmap, BBox _bbox, string _OSMfileName, MapProvider _provider)
        {
            OSMfileName = _OSMfileName;
            heightmap   = _heightmap;
            scenebbox   = _bbox;
            textureType = _provider;

            terrainObject = new GameObject("Terrain");
            gridList      = new List <GameObject>();

            int leftIndex  = (int)Math.Floor((scenebbox.left - (float)Math.Floor(scenebbox.left)) * 1200.0f);
            int rightIndex = (int)Math.Ceiling((scenebbox.right - (float)Math.Floor(scenebbox.right)) * 1200.0f);

            if ((rightIndex - leftIndex) % 2 != 0)
            {
                rightIndex++;
            }

            int topIndex, bottomIndex;


            topIndex    = (int)Math.Floor(((float)Math.Ceiling(scenebbox.top) - scenebbox.top) * 1200.0f);
            bottomIndex = (int)Math.Ceiling(((float)Math.Ceiling(scenebbox.bottom) - scenebbox.bottom) * 1200.0f);

            if ((bottomIndex - topIndex) % 2 != 0)
            {
                topIndex -= 1;
            }



            Debug.Log("<color=yellow>TERRAIN:</color>" + "left:" + leftIndex + " right:" + rightIndex
                      + " bottom:" + bottomIndex + " top:" + topIndex);


            float[,] myTerrainHeights = new float[1 + bottomIndex - topIndex, 1 + rightIndex - leftIndex];
            Vector2[,] meterPositions = new Vector2[1 + bottomIndex - topIndex, 1 + rightIndex - leftIndex];
            Geography geo = new Geography();

            float left   = (float)Math.Floor(scenebbox.left) + (leftIndex / 1200.0f);
            float right  = (float)Math.Floor(scenebbox.left) + (rightIndex / 1200.0f);
            float top    = (float)Math.Ceiling(scenebbox.top) - (topIndex / 1200.0f);
            float bottom = (float)Math.Ceiling(scenebbox.top) - (bottomIndex / 1200.0f);

            for (int i = 0; i <= bottomIndex - topIndex; i++)
            {
                for (int j = 0; j <= rightIndex - leftIndex; j++)
                {
                    myTerrainHeights[i, j] = heightmap.heightmap[topIndex + i, leftIndex + j];
                    meterPositions[i, j]   = geo.LatLontoMeters(top - (i / 1200.0f), left + (j / 1200.0f));
                }
            }


            terrainInfo.leftIndex      = leftIndex;
            terrainInfo.rightIndex     = rightIndex;
            terrainInfo.bottomIndex    = bottomIndex;
            terrainInfo.topIndex       = topIndex;
            terrainInfo.terrainHeights = myTerrainHeights;
            terrainInfo.meterPositions = meterPositions;
            terrainInfo.ColumnCount    = 1 + rightIndex - leftIndex;
            terrainInfo.RowCount       = 1 + bottomIndex - topIndex;

            terrainInfo.terrainBBox        = new BBox();
            terrainInfo.terrainBBox.left   = left;
            terrainInfo.terrainBBox.top    = top;
            terrainInfo.terrainBBox.bottom = bottom;
            terrainInfo.terrainBBox.right  = right;
            Vector2 bottmleft = geo.LatLontoMeters(bottom, left);
            Vector2 topright  = geo.LatLontoMeters(top, right);

            terrainInfo.terrainBBox.meterBottom = bottmleft.x;
            terrainInfo.terrainBBox.meterLeft   = bottmleft.y;
            terrainInfo.terrainBBox.meterTop    = topright.x;
            terrainInfo.terrainBBox.meterRight  = topright.y;

            terrainInfo.shiftX = scenebbox.meterLeft;
            terrainInfo.shiftZ = scenebbox.meterBottom;

            Debug.Log("<color=yellow>TERRAIN:</color> ColumnCount:" + terrainInfo.ColumnCount + " RowCount:" + terrainInfo.RowCount);

            // drawBoundsforDebug();

            for (int i = 0; i < terrainInfo.RowCount - 1; i += 2)
            {
                for (int j = 0; j < terrainInfo.ColumnCount - 1; j += 2)
                {
                    createGrid(i, j);
                }
            }

            drawUnderPlates();
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Returns true if real URLs should be offered up.
        /// </summary>
        /// <param name="mapProvider"></param>
        /// <returns></returns>
        private bool ServeRealUrls(MapProvider mapProvider)
        {
            var options = Plugin.Singleton?.Options;

            return(mapProvider != MapProvider.Leaflet || !(options?.IsPluginEnabled ?? false));
        }
Ejemplo n.º 17
0
 public SoapRestController()
 {
     // TODO - This should really use constructor injection but couldn't get that working.
     this.mapProvider = (MapProvider)System.Web.Mvc.DependencyResolver.Current.GetService(typeof(MapProvider));
 }
Ejemplo n.º 18
0
        private Texture2D DownloadTile(int tilex, int tiley, MapProvider provider)
        {
            string _URL = "";

            if (!Directory.Exists(tileFolder + provider.ToString("G")))
            {
                Directory.CreateDirectory(tileFolder + provider.ToString("G"));
            }



            string savedfileName = +zoomLevel + "_" + tilex + "_" + tiley;

            switch (provider)
            {
            case MapProvider.MapQuest:
                _URL = "http://otile1.mqcdn.com/tiles/1.0.0/osm/" + zoomLevel.ToString() + "/" + tilex.ToString() + "/" + tiley.ToString() + ".png";

                savedfileName = savedfileName + ".png";
                break;

            case MapProvider.OpenStreetMap:
                _URL          = "http://" + "a" + ".tile.openstreetmap.org/" + zoomLevel.ToString() + "/" + tilex.ToString() + "/" + tiley.ToString() + ".png";
                savedfileName = savedfileName + ".png";
                break;

            case MapProvider.OpenStreetMapNoLabel:
                _URL          = "http://a.tiles.wmflabs.org/osm-no-labels/" + zoomLevel.ToString() + "/" + tilex.ToString() + "/" + tiley.ToString() + ".png";
                savedfileName = savedfileName + ".png";
                break;

            case MapProvider.BingMapStreet:
                _URL = "http://ecn.t" + ((tilex + tiley) % 7).ToString() + ".tiles.virtualearth.net/tiles/" + "r";
                for (int i = zoomLevel - 1; i >= 0; i--)
                {
                    _URL = _URL + (((((tiley >> i) & 1) << 1) + ((tilex >> i) & 1)));
                }
                _URL          = _URL + ".png" + "?g=409&mkt=en-us";
                savedfileName = savedfileName + ".png";
                break;

            case MapProvider.BingMapAerial:
                _URL = "http://ecn.t" + ((tilex + tiley) % 7).ToString() + ".tiles.virtualearth.net/tiles/" + "a";
                for (int i = zoomLevel - 1; i >= 0; i--)
                {
                    _URL = _URL + (((((tiley >> i) & 1) << 1) + ((tilex >> i) & 1)));
                }
                _URL          = _URL + ".jpeg" + "?g=409&mkt=en-us";
                savedfileName = savedfileName + ".jpg";
                break;

            default:
                return(null);
            }

            try
            {
                FileDownloader.downloadfromURL(_URL, tileFolder + provider.ToString("G") + "/" + savedfileName);
            }
            catch
            {
                if (provider == MapProvider.OpenStreetMapNoLabel)
                {
                    _URL = "http://" + "a" + ".tile.openstreetmap.org/" + zoomLevel.ToString() + "/" + tilex.ToString() + "/" + tiley.ToString() + ".png";
                    FileDownloader.downloadfromURL(_URL, tileFolder + provider.ToString("G") + "/" + savedfileName);
                }
            }

            byte[] fileData;
            fileData = File.ReadAllBytes(tileFolder + provider.ToString("G") + "/" + savedfileName);
            Texture2D texture = new Texture2D(2, 2);

            texture.LoadImage(fileData);
            return(texture);
        }
Ejemplo n.º 19
0
        public bool SaveFile(string path = null, bool forceOverride = false, bool switchPath = true)
        {
            path = forceOverride ? path : path ?? MapFile;

            if (path != null)
            {
                IEnumerable <string> noSaveExtensions = FileTypeRegistration.GetSupportedExtensions().Where(x => !x.CanSave).Select(x => x.Extension);
                foreach (string ext in noSaveExtensions)
                {
                    if (path.EndsWith(ext, StringComparison.OrdinalIgnoreCase))
                    {
                        path = null;
                        break;
                    }
                }
            }

            if (path == null)
            {
                using (var sfd = new SaveFileDialog()) {
                    var filter = String.Join("|", FileTypeRegistration.GetSupportedExtensions()
                                             .Where(x => x.CanSave).Select(x => x.Description + " (*" + x.Extension + ")|*" + x.Extension));
                    var all = FileTypeRegistration.GetSupportedExtensions().Where(x => x.CanSave).Select(x => "*" + x.Extension).ToArray();
                    sfd.Filter = "All supported formats (" + String.Join(", ", all) + ")|" + String.Join(";", all) + "|" + filter;
                    if (sfd.ShowDialog() == DialogResult.OK)
                    {
                        path = sfd.FileName;
                    }
                }
            }
            if (path == null)
            {
                return(false);
            }

            // Save the 3D camera position
            var cam = ViewportManager.Viewports.OfType <Viewport3D>().Select(x => x.Camera).FirstOrDefault();

            if (cam != null)
            {
                if (Map.ActiveCamera == null)
                {
                    Map.ActiveCamera = !Map.Cameras.Any() ? new Camera {
                        LookPosition = Coordinate.UnitX * Map.GridSpacing * 1.5m
                    } : Map.Cameras.First();
                    if (!Map.Cameras.Contains(Map.ActiveCamera))
                    {
                        Map.Cameras.Add(Map.ActiveCamera);
                    }
                }
                var dist = (Map.ActiveCamera.LookPosition - Map.ActiveCamera.EyePosition).VectorMagnitude();
                var loc  = cam.Location;
                var look = cam.LookAt - cam.Location;
                look.Normalize();
                look = loc + look * (float)dist;
                Map.ActiveCamera.EyePosition  = new Coordinate((decimal)loc.X, (decimal)loc.Y, (decimal)loc.Z);
                Map.ActiveCamera.LookPosition = new Coordinate((decimal)look.X, (decimal)look.Y, (decimal)look.Z);
            }
            Map.WorldSpawn.EntityData.SetPropertyValue("wad", string.Join(";", GetUsedTexturePackages().Select(x => x.PackageRoot).Where(x => x.EndsWith(".wad"))));
            MapProvider.SaveMapToFile(path, Map, GameData, TextureCollection);
            if (switchPath)
            {
                MapFile     = path;
                MapFileName = Path.GetFileName(MapFile);
                History.TotalActionsSinceLastSave = 0;
                Mediator.Publish(EditorMediator.DocumentSaved, this);
            }
            return(true);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// See interface docs.
        /// </summary>
        /// <param name="mapProvider"></param>
        /// <returns></returns>
        public TileServerSettings GetDefaultTileServerSettings(MapProvider mapProvider)
        {
            var settings = _TileServerSettings;

            return(settings.FirstOrDefault(r => r.IsDefault && !r.IsCustom && !r.IsLayer));
        }
Ejemplo n.º 21
0
 public MainForm()
 {
     InitializeComponent();
     MapProvider.Register(new ThreeDtProvider());
 }
Ejemplo n.º 22
0
 public void LoadVmfTest()
 {
     MapProvider.Register(new VmfProvider());
     var file = @"D:\Github\sledge\_Resources\VMF\sdk_d2_coast_12.vmf";
     var map  = MapProvider.GetMapFromFile(file);
 }
Ejemplo n.º 23
0
        public myTerrain(HeightmapLoader _heightmap, BBox _bbox, string _OSMfileName, MapProvider _provider)
        {
            OSMfileName = _OSMfileName;
            heightmap = _heightmap;
            scenebbox = _bbox;
            textureType = _provider;

            terrainObject = new GameObject("Terrain");
            gridList = new List<GameObject>();

            int leftIndex = (int)Math.Floor((scenebbox.left - (float)Math.Floor(scenebbox.left)) * 1200.0f);
            int rightIndex = (int)Math.Ceiling((scenebbox.right - (float)Math.Floor(scenebbox.right)) * 1200.0f);

            if ((rightIndex - leftIndex) % 2 != 0)
                rightIndex++;

            int topIndex, bottomIndex;

            topIndex = (int)Math.Floor(((float)Math.Ceiling(scenebbox.top) - scenebbox.top) * 1200.0f);
            bottomIndex = (int)Math.Ceiling(((float)Math.Ceiling(scenebbox.bottom) - scenebbox.bottom) * 1200.0f);

            if ((bottomIndex - topIndex) % 2 != 0)
                topIndex -= 1;

            Debug.Log("<color=yellow>TERRAIN:</color>" + "left:" + leftIndex + " right:" + rightIndex
                       + " bottom:" + bottomIndex + " top:" + topIndex);

            float[,] myTerrainHeights = new float[1 + bottomIndex - topIndex, 1 + rightIndex - leftIndex ];
            Vector2[,] meterPositions = new Vector2[1 + bottomIndex - topIndex, 1 + rightIndex - leftIndex ];
            Geography geo = new Geography();

            float left = (float)Math.Floor(scenebbox.left) + (leftIndex / 1200.0f);
            float right = (float)Math.Floor(scenebbox.left) + (rightIndex / 1200.0f);
            float top = (float)Math.Ceiling(scenebbox.top) - (topIndex / 1200.0f);
            float bottom = (float)Math.Ceiling(scenebbox.top) - (bottomIndex / 1200.0f);

            for (int i = 0; i <= bottomIndex - topIndex; i++)
            {
                for (int j = 0; j <= rightIndex - leftIndex; j++)
                {
                    myTerrainHeights[i, j] = heightmap.heightmap[topIndex + i, leftIndex + j];
                    meterPositions[i , j] =  geo.LatLontoMeters(top - (i / 1200.0f), left + (j / 1200.0f));
                }
            }

            terrainInfo.leftIndex = leftIndex;
            terrainInfo.rightIndex = rightIndex;
            terrainInfo.bottomIndex = bottomIndex;
            terrainInfo.topIndex = topIndex;
            terrainInfo.terrainHeights = myTerrainHeights;
            terrainInfo.meterPositions = meterPositions;
            terrainInfo.ColumnCount = 1 + rightIndex - leftIndex;
            terrainInfo.RowCount = 1 + bottomIndex - topIndex;

            terrainInfo.terrainBBox = new BBox();
            terrainInfo.terrainBBox.left = left;
            terrainInfo.terrainBBox.top = top;
            terrainInfo.terrainBBox.bottom = bottom;
            terrainInfo.terrainBBox.right = right;
            Vector2 bottmleft = geo.LatLontoMeters(bottom, left);
            Vector2 topright = geo.LatLontoMeters(top, right);
            terrainInfo.terrainBBox.meterBottom = bottmleft.x;
            terrainInfo.terrainBBox.meterLeft = bottmleft.y;
            terrainInfo.terrainBBox.meterTop = topright.x;
            terrainInfo.terrainBBox.meterRight = topright.y;

            terrainInfo.shiftX = scenebbox.meterLeft;
            terrainInfo.shiftZ = scenebbox.meterBottom;

            Debug.Log("<color=yellow>TERRAIN:</color> ColumnCount:" + terrainInfo.ColumnCount + " RowCount:" + terrainInfo.RowCount);

               // drawBoundsforDebug();

            for (int i = 0; i < terrainInfo.RowCount-1; i += 2)
            {
                for (int j = 0; j < terrainInfo.ColumnCount-1; j += 2)
                    createGrid(i,j);
            }

            drawUnderPlates();
        }
 /// <summary>
 /// Método para carregar mapa.
 /// </summary>
 /// <param name="key"></param>
 public virtual void CreateMap(string key = null)
 {
     //MapProvider.BypassCache = true;
     MapProvider.OnInitialized();
 }
Ejemplo n.º 25
0
        public ActionResult ListCurrency()
        {
            Tmp_QuotesCollection quotesCollection = new Tmp_QuotesCollection();

            Log.Info("---------调用查询开始-----------");
            quotesCollection.ListByCurrents();
            Log.Info("---------调用查询结束-----------");
            if (quotesCollection.Count == 0)
            {
                SuccessResult(quotesCollection);
            }

            List <QuoteModel> ListQuote = MapProvider.Map <QuoteModel>(quotesCollection.DataTable);
            var k = ListQuote.GroupBy(t => t.PlatformName).Select(p => p.First()).ToList();

            //包装Title
            List <TitleVModel> titleList = new List <TitleVModel>();
            TitleVModel        titleOn   = new TitleVModel();

            titleOn.TitleName = "币种";
            titleList.Add(titleOn);
            foreach (var item in k)
            {
                TitleVModel title = new TitleVModel();
                title.TitleName = item.PlatformName;
                titleList.Add(title);
            }
            TitleVModel titleDiff = new TitleVModel();

            titleDiff.TitleName = "差值";
            titleList.Add(titleDiff);

            //包装统计值
            var q = from d in ListQuote
                    group d by d.CoinName into g
                    select new
            {
                MaxPrice = g.Max(x => x.SellPrice),
                MinPrice = g.Min(t => t.BuyPrice),
                coinName = g.Key
            };

            //包装当前价格
            List <CoinInfoVModel> ListCoinInfo = new List <CoinInfoVModel>();

            foreach (var item in q)
            {
                CoinInfoVModel coinInfoVModel = new CoinInfoVModel();
                coinInfoVModel.CoinName   = item.coinName;
                coinInfoVModel.Difference = item.MaxPrice - item.MinPrice;
                List <PriceVModel> ListPrice = new List <PriceVModel>();
                foreach (QuoteModel model in ListQuote)
                {
                    if (model.CoinName == item.coinName)
                    {
                        PriceVModel price = new PriceVModel();
                        price.BuyPrice     = model.BuyPrice;
                        price.CoinName     = model.CoinName;
                        price.SellPrice    = model.SellPrice;
                        price.PlatformName = model.PlatformName;
                        price.Price        = model.Price;
                        int isMaxAndMin = 0;
                        if (item.MaxPrice == model.SellPrice)
                        {
                            isMaxAndMin = 1;
                        }
                        if (item.MinPrice == model.BuyPrice)
                        {
                            isMaxAndMin = 2;
                        }
                        price.IsMaxAndMin = isMaxAndMin;
                        ListPrice.Add(price);
                    }
                }
                coinInfoVModel.PriceVModels = ListPrice;
                ListCoinInfo.Add(coinInfoVModel);
            }

            CoinPriceVModel tableModel = new CoinPriceVModel();

            tableModel.CoinInfoVModels = ListCoinInfo;
            tableModel.TitleVModels    = titleList;
            return(SuccessResult(tableModel));
        }
Ejemplo n.º 26
0
 private void SetMapProvider(bool readOnly)
 {
     int count = m_mapProvider.m_count;
     MapProvider provider = m_mapProvider;
     if (readOnly)
     {
         SortedMapProvider pr = m_mapProvider as SortedMapProvider;
         if (pr.m_lastKey <= MAXINDEX)
         {
             provider = new IndexMapProvider();
         }
         else if (count <= MAXARRAYCOUNT)
         {
             provider = new ArrayMapProvider(m_mapProvider.m_count);
         }
     }
     else
     {
         if (! (provider is SortedMapProvider))
         {
             provider = new SortedMapProvider(m_mapProvider.m_count);
         }
     }
     if (provider != m_mapProvider)
     {
         for (int i = 0; i < count; i++)
         {
             Entry entry = m_mapProvider.GetEntry(i);
             provider.Add(entry.Key, entry.Value);
         }
         m_mapProvider = provider;
     }
 }
 private IEnumerator loadScene(string osmFileName,HeightmapContinent continent, MapProvider provider)
 {
     scene = new Scene();
     Alert alert = new Alert();
     alert.openAlertDialog("Loading project might take a couple of minute. Please wait...");
     yield return new WaitForSeconds(0.2f);
     scene.initializeScene(osmFileName, continent, provider);
     alert.closeAlertDialog();
     this.gameObject.SetActive(false);
     yield return true;
 }
Ejemplo n.º 28
0
        private void Save_Click(object sender, EventArgs e)
        {
            if (MyCommon.IsNetworkAvailable() &&
                (ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Bitly || ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Jmp))
            {
                // bit.ly 短縮機能実装のプライバシー問題の暫定対応
                // bit.ly 使用時はログインIDとAPIキーの指定を必須とする
                // 参照: http://sourceforge.jp/projects/opentween/lists/archive/dev/2012-January/000020.html
                if (string.IsNullOrEmpty(TextBitlyId.Text) || string.IsNullOrEmpty(TextBitlyPw.Text))
                {
                    MessageBox.Show("bit.ly のログイン名とAPIキーの指定は必須項目です。", Application.ProductName);
                    _ValidationError = true;
                    TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
                    TreeViewSetting.Select();
                    TextBitlyId.Focus();
                    return;
                }

                if (!BitlyValidation(TextBitlyId.Text, TextBitlyPw.Text))
                {
                    MessageBox.Show(Properties.Resources.SettingSave_ClickText1);
                    _ValidationError = true;
                    TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
                    TreeViewSetting.Select();
                    TextBitlyId.Focus();
                    return;
                }
                else
                {
                    _ValidationError = false;
                }
            }
            else
            {
                _ValidationError = false;
            }

            this.UserAccounts.Clear();
            foreach (object u in this.AuthUserCombo.Items)
            {
                this.UserAccounts.Add((UserAccount)u);
            }
            if (this.AuthUserCombo.SelectedIndex > -1)
            {
                foreach (UserAccount u in this.UserAccounts)
                {
                    if (u.Username.ToLower() == ((UserAccount)this.AuthUserCombo.SelectedItem).Username.ToLower())
                    {
                        tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
                        if (u.UserId == 0)
                        {
                            tw.VerifyCredentials();
                            u.UserId = tw.UserId;
                        }
                        break;
                    }
                }
            }
            else
            {
                tw.ClearAuthInfo();
                tw.Initialize("", "", "", 0);
            }

            #if UA
            //フォロー
            if (this.FollowCheckBox.Checked)
            {
                //現在の設定内容で通信
                HttpConnection.ProxyType ptype;
                if (RadioProxyNone.Checked)
                {
                    ptype = HttpConnection.ProxyType.None;
                }
                else if (RadioProxyIE.Checked)
                {
                    ptype = HttpConnection.ProxyType.IE;
                }
                else
                {
                    ptype = HttpConnection.ProxyType.Specified;
                }
                string padr = TextProxyAddress.Text.Trim();
                int pport = int.Parse(TextProxyPort.Text.Trim());
                string pusr = TextProxyUser.Text.Trim();
                string ppw = TextProxyPassword.Text.Trim();
                HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);

                string ret = tw.PostFollowCommand(ApplicationSettings.FeedbackTwitterName);
            }
            #endif
            IntervalChangedEventArgs arg = new IntervalChangedEventArgs();
            bool isIntervalChanged = false;

            try
            {
                UserstreamStartup = this.StartupUserstreamCheck.Checked;

                if (UserstreamPeriodInt != int.Parse(UserstreamPeriod.Text))
                {
                    UserstreamPeriodInt = int.Parse(UserstreamPeriod.Text);
                    arg.UserStream = true;
                    isIntervalChanged = true;
                }
                if (TimelinePeriodInt != int.Parse(TimelinePeriod.Text))
                {
                    TimelinePeriodInt = int.Parse(TimelinePeriod.Text);
                    arg.Timeline = true;
                    isIntervalChanged = true;
                }
                if (DMPeriodInt != int.Parse(DMPeriod.Text))
                {
                    DMPeriodInt = int.Parse(DMPeriod.Text);
                    arg.DirectMessage = true;
                    isIntervalChanged = true;
                }
                if (PubSearchPeriodInt != int.Parse(PubSearchPeriod.Text))
                {
                    PubSearchPeriodInt = int.Parse(PubSearchPeriod.Text);
                    arg.PublicSearch = true;
                    isIntervalChanged = true;
                }

                if (ListsPeriodInt != int.Parse(ListsPeriod.Text))
                {
                    ListsPeriodInt = int.Parse(ListsPeriod.Text);
                    arg.Lists = true;
                    isIntervalChanged = true;
                }
                if (ReplyPeriodInt != int.Parse(ReplyPeriod.Text))
                {
                    ReplyPeriodInt = int.Parse(ReplyPeriod.Text);
                    arg.Reply = true;
                    isIntervalChanged = true;
                }
                if (UserTimelinePeriodInt != int.Parse(UserTimelinePeriod.Text))
                {
                    UserTimelinePeriodInt = int.Parse(UserTimelinePeriod.Text);
                    arg.UserTimeline = true;
                    isIntervalChanged = true;
                }

                if (isIntervalChanged && IntervalChanged != null)
                {
                    IntervalChanged(this, arg);
                }

                Readed = StartupReaded.Checked;
                switch (IconSize.SelectedIndex)
                {
                    case 0:
                        IconSz = MyCommon.IconSizes.IconNone;
                        break;
                    case 1:
                        IconSz = MyCommon.IconSizes.Icon16;
                        break;
                    case 2:
                        IconSz = MyCommon.IconSizes.Icon24;
                        break;
                    case 3:
                        IconSz = MyCommon.IconSizes.Icon48;
                        break;
                    case 4:
                        IconSz = MyCommon.IconSizes.Icon48_2;
                        break;
                }
                Status = StatusText.Text;
                PlaySound = PlaySnd.Checked;
                UnreadManage = UReadMng.Checked;
                OneWayLove = OneWayLv.Checked;

                FontUnread = lblUnread.Font;     //未使用
                ColorUnread = lblUnread.ForeColor;
                FontReaded = lblListFont.Font;     //リストフォントとして使用
                ColorReaded = lblListFont.ForeColor;
                ColorFav = lblFav.ForeColor;
                ColorOWL = lblOWL.ForeColor;
                ColorRetweet = lblRetweet.ForeColor;
                FontDetail = lblDetail.Font;
                ColorSelf = lblSelf.BackColor;
                ColorAtSelf = lblAtSelf.BackColor;
                ColorTarget = lblTarget.BackColor;
                ColorAtTarget = lblAtTarget.BackColor;
                ColorAtFromTarget = lblAtFromTarget.BackColor;
                ColorAtTo = lblAtTo.BackColor;
                ColorInputBackcolor = lblInputBackcolor.BackColor;
                ColorInputFont = lblInputFont.ForeColor;
                ColorListBackcolor = lblListBackcolor.BackColor;
                ColorDetailBackcolor = lblDetailBackcolor.BackColor;
                ColorDetail = lblDetail.ForeColor;
                ColorDetailLink = lblDetailLink.ForeColor;
                FontInputFont = lblInputFont.Font;
                switch (cmbNameBalloon.SelectedIndex)
                {
                    case 0:
                        NameBalloon = MyCommon.NameBalloonEnum.None;
                        break;
                    case 1:
                        NameBalloon = MyCommon.NameBalloonEnum.UserID;
                        break;
                    case 2:
                        NameBalloon = MyCommon.NameBalloonEnum.NickName;
                        break;
                }

                switch (ComboBoxPostKeySelect.SelectedIndex)
                {
                    case 2:
                        PostShiftEnter = true;
                        PostCtrlEnter = false;
                        break;
                    case 1:
                        PostCtrlEnter = true;
                        PostShiftEnter = false;
                        break;
                    case 0:
                        PostCtrlEnter = false;
                        PostShiftEnter = false;
                        break;
                }
                CountApi = int.Parse(TextCountApi.Text);
                CountApiReply = int.Parse(TextCountApiReply.Text);
                BrowserPath = BrowserPathText.Text.Trim();
                PostAndGet = CheckPostAndGet.Checked;
                UseRecommendStatus = CheckUseRecommendStatus.Checked;
                DispUsername = CheckDispUsername.Checked;
                CloseToExit = CheckCloseToExit.Checked;
                MinimizeToTray = CheckMinimizeToTray.Checked;
                switch (ComboDispTitle.SelectedIndex)
                {
                    case 0:  //None
                        DispLatestPost = MyCommon.DispTitleEnum.None;
                        break;
                    case 1:  //Ver
                        DispLatestPost = MyCommon.DispTitleEnum.Ver;
                        break;
                    case 2:  //Post
                        DispLatestPost = MyCommon.DispTitleEnum.Post;
                        break;
                    case 3:  //RepCount
                        DispLatestPost = MyCommon.DispTitleEnum.UnreadRepCount;
                        break;
                    case 4:  //AllCount
                        DispLatestPost = MyCommon.DispTitleEnum.UnreadAllCount;
                        break;
                    case 5:  //Rep+All
                        DispLatestPost = MyCommon.DispTitleEnum.UnreadAllRepCount;
                        break;
                    case 6:  //Unread/All
                        DispLatestPost = MyCommon.DispTitleEnum.UnreadCountAllCount;
                        break;
                    case 7: //Count of Status/Follow/Follower
                        DispLatestPost = MyCommon.DispTitleEnum.OwnStatus;
                        break;
                }
                SortOrderLock = CheckSortOrderLock.Checked;
                ViewTabBottom = CheckViewTabBottom.Checked;
                TinyUrlResolve = CheckTinyURL.Checked;
                ShortUrlForceResolve = CheckForceResolve.Checked;
                ShortUrl.IsResolve = TinyUrlResolve;
                ShortUrl.IsForceResolve = ShortUrlForceResolve;
                if (RadioProxyNone.Checked)
                {
                    _MyProxyType = HttpConnection.ProxyType.None;
                }
                else if (RadioProxyIE.Checked)
                {
                    _MyProxyType = HttpConnection.ProxyType.IE;
                }
                else
                {
                    _MyProxyType = HttpConnection.ProxyType.Specified;
                }
                ProxyAddress = TextProxyAddress.Text.Trim();
                ProxyPort = int.Parse(TextProxyPort.Text.Trim());
                ProxyUser = TextProxyUser.Text.Trim();
                ProxyPassword = TextProxyPassword.Text.Trim();
                PeriodAdjust = CheckPeriodAdjust.Checked;
                StartupVersion = CheckStartupVersion.Checked;
                StartupFollowers = CheckStartupFollowers.Checked;
                RestrictFavCheck = CheckFavRestrict.Checked;
                AlwaysTop = CheckAlwaysTop.Checked;
                UrlConvertAuto = CheckAutoConvertUrl.Checked;
                ShortenTco = ShortenTcoCheck.Checked;
                OutputzEnabled = CheckOutputz.Checked;
                OutputzKey = TextBoxOutputzKey.Text.Trim();

                switch (ComboBoxOutputzUrlmode.SelectedIndex)
                {
                    case 0:
                        OutputzUrlmode = MyCommon.OutputzUrlmode.twittercom;
                        break;
                    case 1:
                        OutputzUrlmode = MyCommon.OutputzUrlmode.twittercomWithUsername;
                        break;
                }

                Nicoms = CheckNicoms.Checked;
                UseUnreadStyle = chkUnreadStyle.Checked;
                DateTimeFormat = CmbDateTimeFormat.Text;
                DefaultTimeOut = int.Parse(ConnectionTimeOut.Text);
                RetweetNoConfirm = CheckRetweetNoConfirm.Checked;
                LimitBalloon = CheckBalloonLimit.Checked;
                EventNotifyEnabled = CheckEventNotify.Checked;
                GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
                ForceEventNotify = CheckForceEventNotify.Checked;
                FavEventUnread = CheckFavEventUnread.Checked;
                TranslateLanguage = (new Bing()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex);
                EventSoundFile = (string)ComboBoxEventNotifySound.SelectedItem;
                AutoShortUrlFirst = (MyCommon.UrlConverter)ComboBoxAutoShortUrlFirst.SelectedIndex;
                TabIconDisp = chkTabIconDisp.Checked;
                ReadOwnPost = chkReadOwnPost.Checked;
                GetFav = chkGetFav.Checked;
                IsMonospace = CheckMonospace.Checked;
                ReadOldPosts = CheckReadOldPosts.Checked;
                UseSsl = CheckUseSsl.Checked;
                BitlyUser = TextBitlyId.Text;
                BitlyPwd = TextBitlyPw.Text;
                ShowGrid = CheckShowGrid.Checked;
                UseAtIdSupplement = CheckAtIdSupple.Checked;
                UseHashSupplement = CheckHashSupple.Checked;
                PreviewEnable = CheckPreviewEnable.Checked;
                TwitterApiUrl = TwitterAPIText.Text.Trim();
                TwitterSearchApiUrl = TwitterSearchAPIText.Text.Trim();
                switch (ReplyIconStateCombo.SelectedIndex)
                {
                    case 0:
                        ReplyIconState = MyCommon.REPLY_ICONSTATE.None;
                        break;
                    case 1:
                        ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
                        break;
                    case 2:
                        ReplyIconState = MyCommon.REPLY_ICONSTATE.BlinkIcon;
                        break;
                }
                switch (LanguageCombo.SelectedIndex)
                {
                    case 0:
                        Language = "OS";
                        break;
                    case 1:
                        Language = "ja";
                        break;
                    case 2:
                        Language = "en";
                        break;
                    case 3:
                        Language = "zh-CN";
                        break;
                    default:
                        Language = "en";
                        break;
                }
                HotkeyEnabled = this.HotkeyCheck.Checked;
                HotkeyMod = Keys.None;
                if (this.HotkeyAlt.Checked) HotkeyMod = HotkeyMod | Keys.Alt;
                if (this.HotkeyShift.Checked) HotkeyMod = HotkeyMod | Keys.Shift;
                if (this.HotkeyCtrl.Checked) HotkeyMod = HotkeyMod | Keys.Control;
                if (this.HotkeyWin.Checked) HotkeyMod = HotkeyMod | Keys.LWin;
                int.TryParse(HotkeyCode.Text, out HotkeyValue);
                HotkeyKey = (Keys)HotkeyText.Tag;
                BlinkNewMentions = ChkNewMentionsBlink.Checked;
                UseAdditionalCount = UseChangeGetCount.Checked;
                MoreCountApi = int.Parse(GetMoreTextCountApi.Text);
                FirstCountApi = int.Parse(FirstTextCountApi.Text);
                SearchCountApi = int.Parse(SearchTextCountApi.Text);
                FavoritesCountApi = int.Parse(FavoritesTextCountApi.Text);
                UserTimelineCountApi = int.Parse(UserTimelineTextCountApi.Text);
                ListCountApi = int.Parse(ListTextCountApi.Text);
                OpenUserTimeline = CheckOpenUserTimeline.Checked;
                ListDoubleClickAction = ListDoubleClickActionComboBox.SelectedIndex;
                UserAppointUrl = UserAppointUrlText.Text;
                this.HideDuplicatedRetweets = this.HideDuplicatedRetweetsCheck.Checked;
                this.IsPreviewFoursquare = this.IsPreviewFoursquareCheckBox.Checked;
                this.MapThumbnailProvider = (MapProvider)this.MapThumbnailProviderComboBox.SelectedIndex;
                this.MapThumbnailHeight = int.Parse(this.MapThumbnailHeightTextBox.Text);
                this.MapThumbnailWidth = int.Parse(this.MapThumbnailWidthTextBox.Text);
                this.MapThumbnailZoom = int.Parse(this.MapThumbnailZoomTextBox.Text);
                this.IsListStatusesIncludeRts = this.IsListsIncludeRtsCheckBox.Checked;
                this.TabMouseLock = this.TabMouseLockCheck.Checked;
                this.IsRemoveSameEvent = this.IsRemoveSameFavEventCheckBox.Checked;
                this.IsNotifyUseGrowl = this.IsNotifyUseGrowlCheckBox.Checked;
            }
            catch(Exception)
            {
                MessageBox.Show(Properties.Resources.Save_ClickText3);
                this.DialogResult = DialogResult.Cancel;
                return;
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        ///  Constructs the scene from given parameters
        /// </summary>
        /// <param name="OSMfilename">Full path of OSM file</param>
        /// <param name="continent">Specify Continent to download correct Heightmap from Nasa Srtm Data</param>
        /// <param name="provider">Choose mapProvider to select Texture of Terrain</param>
        public void initializeScene(string OSMfilename, HeightmapContinent _continent, MapProvider _provider)
        {
            string[] subStr = OSMfilename.Split(new char[] { '/', '\\' });
            sceneName = subStr[subStr.Length - 1];
            OSMPath   = OSMfilename;

            continent = _continent;
            provider  = _provider;

            List <Way> WayListforHighway  = new List <Way>();
            List <Way> WayListforBuilding = new List <Way>();

            InitialConfigLoader configloader = new InitialConfigLoader();

            var stopwatch = new System.Diagnostics.Stopwatch();

            stopwatch.Start();

            OSMparser parser = new OSMparser();

            scenebbox = parser.readBBox(OSMfilename);
            scenebbox = editbbox(scenebbox);
            config    = configloader.loadInitialConfig();


            HeightmapLoader heightMap = new HeightmapLoader(scenebbox, continent);

            terrain = new myTerrain(heightMap, scenebbox, OSMfilename, provider);

            stopwatch.Stop();
            Debug.Log("<color=blue>TERRAIN RENDER TIME:</color>" + stopwatch.ElapsedMilliseconds);
            stopwatch.Reset();
            stopwatch.Start();

            osmxml = parser.parseOSM(OSMfilename);
            assignNodePositions();

            stopwatch.Stop();
            Debug.Log("<color=blue>OSM PARSING TIME:</color>" + stopwatch.ElapsedMilliseconds);
            stopwatch.Reset();
            stopwatch.Start();


            defaultObject3DList = DefaultObject3DHandler.drawDefaultObjects(osmxml.defaultobject3DList);

            stopwatch.Stop();
            Debug.Log("<color=blue>3D OBJECT RENDER TIME:</color>" + stopwatch.ElapsedMilliseconds);
            stopwatch.Reset();
            stopwatch.Start();


            for (int k = 0; k < osmxml.wayList.Count; k++)
            {
                Way w = osmxml.wayList[k];

                switch (w.type)
                {
                case ItemEnumerator.wayType.building:
                    WayListforBuilding.Add(w);
                    break;

                case ItemEnumerator.wayType.highway:
                    WayListforHighway.Add(w);
                    break;

                case ItemEnumerator.wayType.area:
                    break;

                case ItemEnumerator.wayType.barrier:
                    barrierList.Add(new Barrier(w, config.barrierConfig));
                    break;

                case ItemEnumerator.wayType.river:
                    highwayList.Add(new Highway(w, config.highwayConfig, terrain));
                    break;

                case ItemEnumerator.wayType.none:
                    break;
                }
            }

            stopwatch.Stop();
            Debug.Log("<color=blue>ITEM ENUMERATING TIME:</color>" + stopwatch.ElapsedMilliseconds);
            stopwatch.Reset();
            stopwatch.Start();

            highwayModeller = new HighwayModeller(WayListforHighway, terrain, config.highwayConfig);
            highwayModeller.renderHighwayList();
            highwayModeller.renderPavementList();
            highwayList  = highwayModeller.highwayList;
            pavementList = highwayModeller.pavementList;

            stopwatch.Stop();
            Debug.Log("<color=blue>HIGHWAY RENDERING TIME:</color>" + stopwatch.ElapsedMilliseconds);
            stopwatch.Reset();
            stopwatch.Start();

            BuildingListModeller buildingListModeller = new BuildingListModeller(WayListforBuilding, osmxml.buildingRelations, config.buildingConfig);

            buildingListModeller.renderBuildingList();
            buildingList = buildingListModeller.buildingList;

            stopwatch.Stop();
            Debug.Log("<color=blue>BUILDING RENDERING TIME:</color>" + stopwatch.ElapsedMilliseconds);

            Debug.Log("<color=red>Scene Info:</color> BuildingCount:" + buildingList.Count.ToString() + " HighwayCount:" + highwayList.Count);
        }