public WarpedMapTileSource(UnwarpedMapTileSource unwarpedTileSource, CachePackage cachePackage, SourceMap sourceMap)
		{
			this.unwarpedMapTileSource = unwarpedTileSource;
			this.cachePackage = cachePackage;
			this.coordinateSystem = new MercatorCoordinateSystem();
			if (sourceMap.registration.GetAssociationList().Count < sourceMap.registration.warpStyle.getCorrespondencesRequired())
			{
				throw new InsufficientCorrespondencesException();
			}
			this.imageTransformer = sourceMap.registration.warpStyle.getImageTransformer(sourceMap.registration, RenderQualityStyle.theStyle.warpInterpolationMode);
		}
Exemplo n.º 2
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.º 3
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.º 4
0
        public WarpedMapTileSource(UnwarpedMapTileSource unwarpedTileSource, CachePackage cachePackage,
                                   SourceMap sourceMap)
        {
            unwarpedMapTileSource = unwarpedTileSource;
            this.cachePackage     = cachePackage;
            coordinateSystem      = new MercatorCoordinateSystem();
            if (sourceMap.registration.GetAssociationList().Count <
                sourceMap.registration.warpStyle.getCorrespondencesRequired())
            {
                throw new InsufficientCorrespondencesException();
            }

            imageTransformer = sourceMap.registration.warpStyle.getImageTransformer(sourceMap.registration,
                                                                                    RenderQualityStyle.theStyle.warpInterpolationMode);
        }
Exemplo n.º 5
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.º 6
0
        public IFuture GetUserBounds(LatentRegionHolder latentRegionHolder, FutureFeatures features)
        {
            D.Assert(UnwarpedMapTileSource.HasFeature(features, FutureFeatures.Cached));
            IFuture future = new MemCacheFuture(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(cachePackage.asyncCache,
                                            Asynchronizer.MakeFuture(cachePackage.networkAsyncScheduler, future));
            }

            return(future);
        }
Exemplo n.º 7
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.º 8
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.º 9
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));
        }