Exemplo n.º 1
0
        public IFuturePrototype GetImagePrototype(ImageParameterTypeIfc parameterType, FutureFeatures features)
        {
            List <IFuturePrototype> list = new List <IFuturePrototype>();

            list.Add(parameterType.GetSizeParameter());
            foreach (SourceMap current in layer)
            {
                if (current.ReadyToLock())
                {
                    IDisplayableSource displayableSource =
                        mapTileSourceFactory.CreateDisplayableWarpedSource(current);
                    list.Add(displayableSource.GetImagePrototype(parameterType, features));
                }
            }

            IFuturePrototype futurePrototype = new ApplyPrototype(new CompositeImageVerb(), list.ToArray());

            if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.DiskCached))
            {
                futurePrototype = new DiskCachePrototype(mapTileSourceFactory.GetCachePackage().diskCache,
                                                         futurePrototype);
            }

            if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached))
            {
                futurePrototype = new MemCachePrototype(mapTileSourceFactory.GetCachePackage().computeCache,
                                                        futurePrototype);
            }

            return(futurePrototype);
        }
Exemplo n.º 2
0
 internal IFuture AddAsynchrony(IFuture future, FutureFeatures features)
 {
     if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Async))
     {
         future = new MemCacheFuture(this.cachePackage.asyncCache, new OpenDocumentSensitivePrioritizedFuture(this.cachePackage.openDocumentPrioritizer, Asynchronizer.MakeFuture(this.cachePackage.computeAsyncScheduler, future), this.GetOpenDocumentFuture(FutureFeatures.MemoryCached)));
     }
     return(future);
 }
Exemplo n.º 3
0
 internal IFuturePrototype AddAsynchrony(IFuturePrototype prototype, FutureFeatures features)
 {
     if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Async))
     {
         D.Assert(UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached), "should always cache async stuff, I think.");
         prototype = new MemCachePrototype(this.cachePackage.asyncCache, new OpenDocumentSensitivePrioritizedPrototype(this.cachePackage.openDocumentPrioritizer, new Asynchronizer(this.cachePackage.computeAsyncScheduler, prototype), this.GetOpenDocumentFuture(FutureFeatures.MemoryCached)));
     }
     return(prototype);
 }
Exemplo n.º 4
0
        public IFuture GetUserBounds(LatentRegionHolder latentRegionHolder, FutureFeatures features)
        {
            D.Assert(UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Cached));
            IFuture future = new MemCacheFuture(this.cachePackage.boundsCache, new ApplyFuture(new ConstantVerb(new BoundsPresent(new RenderRegion(new MapRectangle(-85.0, -5000.0, 85.0, 5000.0), new DirtyEvent()))), new IFuture[0]));

            if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Async))
            {
                future = new MemCacheFuture(this.cachePackage.asyncCache, Asynchronizer.MakeFuture(this.cachePackage.networkAsyncScheduler, future));
            }
            return(future);
        }
Exemplo n.º 5
0
        public IFuture GetOpenDocumentFuture(FutureFeatures features)
        {
            IFuture future = new FetchDocumentFuture(this.localDocumentFuture);

            D.Assert(UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached));
            if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached))
            {
                future = new MemCacheFuture(this.cachePackage.openSourceDocumentCache, future);
            }
            D.Assert(!UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Async));
            return(future);
        }
Exemplo n.º 6
0
 internal IFuturePrototype AddCaching(IFuturePrototype prototype, FutureFeatures features)
 {
     if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.DiskCached))
     {
         prototype = new DiskCachePrototype(this.cachePackage.diskCache, prototype);
     }
     if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached))
     {
         prototype = new MemCachePrototype(this.cachePackage.computeCache, prototype);
     }
     return(prototype);
 }
Exemplo n.º 7
0
        public IFuture GetUserBounds(LatentRegionHolder latentRegionHolder, FutureFeatures features)
        {
            D.Assert(UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached));
            D.Assert(!UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Transparency));
            if (latentRegionHolder == null)
            {
                latentRegionHolder = this.sourceMap.latentRegionHolder;
            }
            latentRegionHolder.RequestRenderRegion(this.GetImageBounds((FutureFeatures)7));
            IFuture future = new MemCacheFuture(this.cachePackage.boundsCache, new ApplyFuture(new UserBoundsRefVerb(latentRegionHolder, this.GetImageBounds(FutureFeatures.Cached)), new IFuture[0]));

            return(this.AddAsynchrony(future, features));
        }
Exemplo n.º 8
0
        public IFuturePrototype GetImageDetailPrototype(FutureFeatures features)
        {
            IFuturePrototype prototype = this.GetAccessPrototype(AccessMethod.ImageDetail, FutureFeatures.Cached, new IFuturePrototype[]
            {
                new UnevaluatedTerm(TermName.ImageDetail)
            });

            if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached))
            {
                prototype = new MemCachePrototype(this.cachePackage.computeCache, prototype);
            }
            return(this.AddAsynchrony(prototype, features));
        }
Exemplo n.º 9
0
 public static IFuturePrototype AddFeatures(IFuturePrototype prototype, FutureFeatures features, CachePackage cachePackage)
 {
     if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.DiskCached))
     {
         prototype = new DiskCachePrototype(cachePackage.diskCache, prototype);
     }
     if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Cached))
     {
         prototype = new MemCachePrototype(cachePackage.networkCache, prototype);
     }
     if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Async))
     {
         prototype = new MemCachePrototype(cachePackage.asyncCache, new Asynchronizer(cachePackage.networkAsyncScheduler, prototype));
     }
     return(prototype);
 }
Exemplo n.º 10
0
        public IFuture GetUserBounds(LatentRegionHolder latentRegionHolder, FutureFeatures features)
        {
            List <IFuture> list = new List <IFuture>();

            foreach (SourceMap current in this.layer)
            {
                if (current.ReadyToLock())
                {
                    LatentRegionHolder latentRegionHolder2 = new LatentRegionHolder(new DirtyEvent(), new DirtyEvent());
                    list.Add(this.mapTileSourceFactory.CreateRenderableWarpedSource(current).GetUserBounds(latentRegionHolder2, features));
                }
            }
            IFuture future = new ApplyFuture(new CompositeBoundsVerb(), list.ToArray());

            D.Assert(UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached));
            return(new MemCacheFuture(this.mapTileSourceFactory.GetCachePackage().boundsCache, future));
        }
Exemplo n.º 11
0
        public IFuturePrototype GetImagePrototype(ImageParameterTypeIfc parameterType, FutureFeatures features)
        {
            if (parameterType == null)
            {
                parameterType = new ImageParameterFromTileAddress(GetDefaultCoordinateSystem());
            }

            FutureFeatures futureFeatures = FutureFeatures.Raw;

            if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Transparency))
            {
                futureFeatures |= FutureFeatures.Transparency;
            }

            if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached))
            {
                futureFeatures |= FutureFeatures.MemoryCached;
            }

            IFuturePrototype futurePrototype = new ApplyPrototype(
                new WarpImageVerb(imageTransformer,
                                  GetImageBounds(FutureFeatures.Cached),
                                  unwarpedMapTileSource.GetImagePrototype(
                                      new ImageParameterFromRawBounds(sourceImageOversampleSize),
                                      futureFeatures)),
                new[] { parameterType.GetBoundsParameter(), parameterType.GetSizeParameter() });

            if (parameterType is ImageParameterFromTileAddress)
            {
                futurePrototype =
                    new ApplyPrototype(
                        new FadeVerb(unwarpedMapTileSource.GetTransparencyOptions().GetFadeOptions()),
                        new[] { futurePrototype, new UnevaluatedTerm(TermName.TileAddress) });
            }
            else
            {
                D.Say(2, "Warning: Ignoring fade options because I don't have a tile address.");
            }

            futurePrototype = unwarpedMapTileSource.AddCaching(futurePrototype, features);
            return(unwarpedMapTileSource.AddAsynchrony(futurePrototype, features));
        }
Exemplo n.º 12
0
        public IFuturePrototype GetImagePrototype(ImageParameterTypeIfc parameterType, FutureFeatures features)
        {
            if (parameterType == null)
            {
                parameterType = new ImageParameterFromTileAddress(this.GetDefaultCoordinateSystem());
            }
            FutureFeatures   openDocFeatures = FutureFeatures.Cached;
            IFuturePrototype accessPrototype = this.GetAccessPrototype(AccessMethod.Render, openDocFeatures, new IFuturePrototype[]
            {
                new UnevaluatedTerm(TermName.ImageBounds),
                new UnevaluatedTerm(TermName.OutputSize),
                new UnevaluatedTerm(TermName.UseDocumentTransparency),
                new UnevaluatedTerm(TermName.ExactColors)
            });
            Verb             verb            = new SourceImageDownsamplerVerb(this.AddCaching(accessPrototype, FutureFeatures.Cached));
            IFuturePrototype futurePrototype = new ApplyPrototype(verb, new IFuturePrototype[]
            {
                parameterType.GetBoundsParameter(),
                parameterType.GetSizeParameter(),
                new ConstantFuture(new BoolParameter(this.sourceMap.transparencyOptions.useDocumentTransparency)),
                new ConstantFuture(new BoolParameter(UnwarpedMapTileSource.HasFeature(features, FutureFeatures.ExactColors)))
            });

            if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Transparency))
            {
                IFuturePrototype futurePrototype2 = new ApplyPrototype(verb, new IFuturePrototype[]
                {
                    parameterType.GetBoundsParameter(),
                    parameterType.GetSizeParameter(),
                    new ConstantFuture(new BoolParameter(this.sourceMap.transparencyOptions.useDocumentTransparency)),
                    new ConstantFuture(new BoolParameter(true))
                });
                if (UnwarpedMapTileSource.HasFeature(features, FutureFeatures.MemoryCached))
                {
                    futurePrototype  = this.AddCaching(futurePrototype, FutureFeatures.MemoryCached);
                    futurePrototype2 = this.AddCaching(futurePrototype2, FutureFeatures.MemoryCached);
                }
                futurePrototype = new TransparencyPrototype(this.sourceMap.transparencyOptions, futurePrototype, futurePrototype2);
            }
            futurePrototype = this.AddCaching(futurePrototype, features);
            return(this.AddAsynchrony(futurePrototype, features));
        }