///
        /// <summary>
        /// Constructor of compressed file
        /// </summary>
        /// <param name="dataFilePath">path to the data file</param>
        /// <param name="cipherKey">cipher key (if null, then no encryption is performed)</param>
        /// <param name="indexFilePath">path to the index file</param>
        /// <param name="parameters">file parameters</param>
        ///
        public CompressedFile(string dataFilePath,
                              string cipherKey,
                              string indexFilePath,
                              FileParameters parameters)
            : base(dataFilePath, parameters)
        {
            indexFile = new OSFile(indexFilePath, parameters);

            if (cipherKey != null)
            {
                setKey(Encoding.Unicode.GetBytes(cipherKey));
            }
            if (!parameters.readOnly)
            {
                bitmapExtensionQuantum = (int)(parameters.fileExtensionQuantum >> (ALLOCATION_QUANTUM_LOG + 3));
                bitmap    = new byte[(int)(base.Length >> (ALLOCATION_QUANTUM_LOG + 3)) + bitmapExtensionQuantum];
                bitmapPos = bitmapStart = Page.pageSize >> (ALLOCATION_QUANTUM_LOG + 3);

                pageMap = new PageMap();

                byte[] buf = new byte[8];
                for (long indexPos = 0, indexSize = indexFile.Length; indexPos < indexSize; indexPos += 8)
                {
                    indexFile.Read(indexPos, buf);
                    long pagePos     = Bytes.unpack8(buf, 0);
                    long pageBitOffs = pagePos >> (Page.pageSizeLog + ALLOCATION_QUANTUM_LOG);
                    long pageBitSize = ((pagePos & (Page.pageSize - 1)) + ALLOCATION_QUANTUM) >> ALLOCATION_QUANTUM_LOG;
                    Bitmap.reserve(bitmap, pageBitOffs, pageBitSize);
                }
            }
        }
Esempio n. 2
0
 public PageInfo GetPageInfo()
 {
     if (!PageMap.ContainsKey(Source))
     {
         return(null);
     }
     return(PageMap[Source]);
 }
Esempio n. 3
0
        private void SearchLineSelectionChanged(MessageTypes.SearchLineSelectionChanged _)
        {
            GeoboundingBox lineBox   = PageMap.GetAllMapElementsBoundingBox();
            var            mapMargin = AdaptiveVisualStateGroup.CurrentState == _narrowVisualState
                ? new Thickness(0, 0, 0, (this.NarrowSearchPanel.ExpandedHeight) + 0)
                : new Thickness(410, 10, 10, 10);

            PageMap.TrySetViewBoundsAsync(lineBox, mapMargin, MapAnimationKind.Linear).DoNotAwait();
        }
Esempio n. 4
0
        private async Task TrySetMapViewWithMargin(BasicGeoposition pos, double boundingBoxZoomAdjustment, MapAnimationKind mapAnimation = MapAnimationKind.None)
        {
            double narrowZoomAdjustment = boundingBoxZoomAdjustment / 2;

            // Creators update changed maps a bit, so we need to zoom in closer on any device running it.
            // MapStyle is a decent proxy for "are we on Creators or not"
            if (DeviceTypeHelper.GetDeviceFormFactorType() == DeviceFormFactorType.Phone &&
                !ApiInformation.IsTypePresent("Windows.UI.Xaml.Controls.Maps.MapStyle"))
            {
                narrowZoomAdjustment = boundingBoxZoomAdjustment / 1.35;
            }

            // Create a box surrounding the specified point to emulate a zoom level on the map.
            // We're using a simulated bounding box, because we need to be able to specify a margin,
            // to accommodate either of the the floating content panels.
            BasicGeoposition northwest = BasicGeopositionExtensions.Create
                                         (
                0.0,
                pos.Longitude - boundingBoxZoomAdjustment,
                pos.Latitude + boundingBoxZoomAdjustment
                                         );
            BasicGeoposition southeast = BasicGeopositionExtensions.Create
                                         (
                0.0,
                pos.Longitude + boundingBoxZoomAdjustment,
                pos.Latitude - boundingBoxZoomAdjustment
                                         );

            if (AdaptiveVisualStateGroup.CurrentState == _narrowVisualState)
            {
                // Zoom in a little further when in the narrow view, otherwise we're a little
                // too far out for the narrow field of view
                northwest.Longitude += narrowZoomAdjustment;
                northwest.Latitude  -= narrowZoomAdjustment;

                southeast.Longitude -= narrowZoomAdjustment;
                southeast.Latitude  += narrowZoomAdjustment;

                GeoboundingBox box = new GeoboundingBox(northwest, southeast);
                if (NarrowSearchPanel.IsOpen)
                {
                    double bottomMargin = NarrowSearchPanel.ExpandedHeight;
                    await PageMap.TrySetViewBoundsAsync(box, new Thickness(0, 0, 0, bottomMargin), mapAnimation);
                }
                else
                {
                    await PageMap.TrySetViewBoundsAsync(box, new Thickness(0, 0, 0, 0), mapAnimation);
                }
            }
            else
            {
                GeoboundingBox box = new GeoboundingBox(northwest, southeast);
                await PageMap.TrySetViewBoundsAsync(box, new Thickness(410, 0, 0, 0), mapAnimation);
            }
        }
        protected override void Awake()
        {
            base.Awake();

            SetFactory(null as IItemFactory <TData>);
            SetFactory(null as ICarrierFactory <TData>);

            _widgets      = new List <IScrollItem <TData> >();
            VisibleWindow = new PageMap <IScrollItem <TData> >(null, new Range <int>());

            Bind(GetComponent <IPageProvider <TData> >());
        }
Esempio n. 6
0
 public virtual void Start()
 {
     parentPage = NGUITools.FindInParents <PageMap>(trans.parent.gameObject);
     if (parentPage == null)
     {
         Debug.Log(gameObject.name + " has NO parent page");
     }
     else
     {
         Debug.Log(gameObject.name + " has parent page " + parentPage.name);
     }
     if (background == null)
     {
         background = GetAnchor(UIAnchor.Side.Center, backPanel.gameObject).GetComponent <UISprite>();
     }
     CorrectAllOffsets(backPanel.gameObject);
     CorrectAllOffsets(forePanel.gameObject);
     AdjustDepths();
 }
 public PageMapIterator(PageMap map)
 {
     this.map = map;
 }
 public PageMapIterator(PageMap map)
 {
     this.map = map;
 }
     ///
     /// <summary>
     /// Constructor of compressed file
     /// </summary>
     /// <param name="dataFilePath">path to the data file</param> 
     /// <param name="cipherKey">cipher key (if null, then no encryption is performed)</param> 
     /// <param name="indexFilePath">path to the index file</param> 
     /// <param name="parameters">file parameters</param> 
     ///
     public CompressedFile(string dataFilePath,        
                           string cipherKey,
                           string indexFilePath, 
                           FileParameters parameters)
     : base(dataFilePath, parameters)
     {
         indexFile = new OSFile(indexFilePath, parameters);
             
         if (cipherKey != null) 
         {
             setKey(Encoding.Unicode.GetBytes(cipherKey)); 
         }
         if (!parameters.readOnly)
         {
             bitmapExtensionQuantum = (int)(parameters.fileExtensionQuantum >> (ALLOCATION_QUANTUM_LOG + 3));
             bitmap = new byte[(int)(base.Length >> (ALLOCATION_QUANTUM_LOG + 3)) + bitmapExtensionQuantum];
             bitmapPos = bitmapStart = Page.pageSize >> (ALLOCATION_QUANTUM_LOG + 3);
 
             pageMap = new PageMap();            
 
             byte[] buf = new byte[8];  
             for (long indexPos = 0, indexSize = indexFile.Length; indexPos < indexSize; indexPos += 8) 
             {
                 indexFile.Read(indexPos, buf);
                 long pagePos = Bytes.unpack8(buf, 0);
                 long pageBitOffs = pagePos >> (Page.pageSizeLog + ALLOCATION_QUANTUM_LOG);
                 long pageBitSize = ((pagePos & (Page.pageSize - 1)) + ALLOCATION_QUANTUM) >> ALLOCATION_QUANTUM_LOG;
                 Bitmap.reserve(bitmap, pageBitOffs, pageBitSize);
             }
         }
     }
Esempio n. 10
0
            public virtual void OnPageLoad(IRange <int> range)
            {
                Parent._pages[Index] = PageMap <TData> .Create <TPage>(Parent._source, range);

                Parent._binder = null;
            }
Esempio n. 11
0
 protected void SetMenuPanel(GameObject menuPanel)
 {
     this.menuPanel = menuPanel;
     menuPanel.SetActive(true);
     pageMap = menuPanel.GetComponent <PageMap>();
 }