示例#1
0
 public static void TestLanLonFuncs()
 {
     if (MercatorCoordinateSystem.beenHere)
     {
         return;
     }
     MercatorCoordinateSystem.beenHere = true;
     foreach (LatLon current in new List <LatLon>
     {
         new LatLon(-85.0, -175.0),
         new LatLon(85.0, -175.0),
         new LatLon(85.0, 175.0),
         new LatLon(-85.0, 175.0),
         new LatLon(1.0, 1.0)
     })
     {
         LatLon latLon  = MercatorCoordinateSystem.LatLonToMercator(current);
         LatLon latLon2 = MercatorCoordinateSystem.MercatorToLatLon(latLon);
         D.Sayf(0, "Orig {0} merc {1} back {2}", new object[]
         {
             current,
             latLon,
             latLon2
         });
     }
 }
        public override void doTransform(PointD p0, PointD p1)
        {
            PointD transformedPoint = this.mercatorToSource.getTransformedPoint(MercatorCoordinateSystem.LatLonToMercator(p0));

            p1.x = transformedPoint.x;
            p1.y = transformedPoint.y;
        }
示例#3
0
        public override void doTransform(PointD p0, PointD p1, out bool isApproximate)
        {
            PointD pointD = MercatorCoordinateSystem.MercatorToLatLon(this.sourceToMercator.getTransformedPoint(p0, out isApproximate));

            p1.x = pointD.x;
            p1.y = pointD.y;
        }
示例#4
0
 public SourceMapInfoPanel()
 {
     this.InitializeComponent();
     this.mapFileURLTextBox.LostFocus += new EventHandler(this.mapFileURLTextBox_LostFocus);
     this.mapHomePageTextBox.LostFocus += new EventHandler(this.mapHomePageTextBox_LostFocus);
     this.mapDescriptionTextBox.LostFocus += new EventHandler(this.descriptionTextBox_LostFocus);
     MercatorCoordinateSystem mercatorCoordinateSystem = new MercatorCoordinateSystem();
     this.closestZoomUpDown.Minimum = mercatorCoordinateSystem.GetZoomRange().min;
     this.closestZoomUpDown.Maximum = mercatorCoordinateSystem.GetZoomRange().max;
 }
		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);
		}
示例#6
0
 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);
 }
        internal override void doTransformImage(GDIBigLockedImage sourceImage, MapRectangle sourceBounds, GDIBigLockedImage destImage, MapRectangle destBounds)
        {
            MapRectangle inr     = new MapRectangle(-0.5, -0.5, (double)destImage.Height - 0.5, (double)destImage.Width - 0.5);
            MapRectangle outr    = MapRectangle.MapRectangleIgnoreOrder(MercatorCoordinateSystem.LatLonToMercator(destBounds.GetNW()), MercatorCoordinateSystem.LatLonToMercator(destBounds.GetSE()));
            JamaMatrix   matrix  = PolynomialImageTransformer.FindAffineMatrix(inr, outr);
            MapRectangle outr2   = new MapRectangle(-0.5, -0.5, (double)sourceImage.Height - 0.5, (double)sourceImage.Width - 0.5);
            JamaMatrix   matrix2 = PolynomialImageTransformer.FindAffineMatrix(sourceBounds, outr2);

            FastImageWarper.doWarp(destImage, sourceImage, new IPointTransformer[]
            {
                new Affine2DPointTransformer(matrix),
                this.destMercatorToSourceTransformer,
                new Affine2DPointTransformer(matrix2)
            }, this.interpolationMode);
        }
示例#8
0
		public HomographicImageTransformer(RegistrationDefinition registration, InterpolationMode interpolationMode) : base(registration, interpolationMode)
		{
			List<PositionAssociation> associationList = registration.GetAssociationList();
			TransformationStyle arg_15_0 = registration.warpStyle;
			int count = associationList.Count;
			JamaMatrix jamaMatrix = new JamaMatrix(count, 2);
			JamaMatrix jamaMatrix2 = new JamaMatrix(count, 2);
			for (int i = 0; i < count; i++)
			{
				LatLon latlon = associationList[i].sourcePosition.pinPosition.latlon;
				jamaMatrix.SetElement(i, 0, latlon.lon);
				jamaMatrix.SetElement(i, 1, latlon.lat);
				LatLon latLon = MercatorCoordinateSystem.LatLonToMercator(associationList[i].globalPosition.pinPosition.latlon);
				jamaMatrix2.SetElement(i, 0, latLon.lon);
				jamaMatrix2.SetElement(i, 1, latLon.lat);
			}
		}
示例#9
0
        public PolynomialImageTransformer(RegistrationDefinition registration, InterpolationMode interpolationMode,
                                          int polynomialDegree) : base(registration, interpolationMode)
        {
            List <PositionAssociation> associationList = registration.GetAssociationList();
            TransformationStyle        arg_15_0        = registration.warpStyle;
            int num = associationList.Count;

            if (num == 2)
            {
                num++;
            }

            JamaMatrix jamaMatrix  = new JamaMatrix(num, 2);
            JamaMatrix jamaMatrix2 = new JamaMatrix(num, 2);

            for (int i = 0; i < num; i++)
            {
                LatLon latLon = i == associationList.Count
                    ? getThirdPosition(associationList[0].sourcePosition.pinPosition.latlon,
                                       associationList[1].sourcePosition.pinPosition.latlon,
                                       true)
                    : associationList[i].sourcePosition.pinPosition.latlon;
                jamaMatrix.SetElement(i, 0, latLon.lon);
                jamaMatrix.SetElement(i, 1, latLon.lat);
                LatLon latLon2 = i == associationList.Count
                    ? getThirdPosition(
                    MercatorCoordinateSystem.LatLonToMercator(associationList[0].globalPosition.pinPosition.latlon),
                    MercatorCoordinateSystem.LatLonToMercator(associationList[1].globalPosition.pinPosition.latlon),
                    false)
                    : MercatorCoordinateSystem.LatLonToMercator(associationList[i].globalPosition.pinPosition.latlon);
                jamaMatrix2.SetElement(i, 0, latLon2.lon);
                jamaMatrix2.SetElement(i, 1, latLon2.lat);
            }

            destMercatorToSourceTransformer             = getPolyPointTransformer(jamaMatrix, jamaMatrix2, polynomialDegree);
            sourceToDestMercatorTransformer_approximate =
                getApproximateInverterPolyPointTransformer(jamaMatrix, jamaMatrix2, polynomialDegree);
            DownhillInverterPointTransformer flakyPointTransformer =
                new DownhillInverterPointTransformer(destMercatorToSourceTransformer,
                                                     sourceToDestMercatorTransformer_approximate);
            IPointTransformer sourceToMercator = new RobustPointTransformer(flakyPointTransformer,
                                                                            sourceToDestMercatorTransformer_approximate);

            destLatLonToSourceTransformer = new LatLonToSourceTransform(destMercatorToSourceTransformer);
            sourceToDestLatLonTransformer = new SourceToLatLonTransform(sourceToMercator);
        }
		public override bool DoWork(ITileWorkFeedback feedback)
		{
			this.feedback = feedback;
			bool result;
			try
			{
				D.Sayf(0, "{0} start compositing {1}", new object[]
				{
					Clocker.theClock.stamp(),
					this
				});
				if (!this.NeedThisTile())
				{
					D.Say(10, "Skipping extant file: " + this.outputFilename);
					result = false;
				}
				else
				{
					D.Sayf(10, "Compositing {0}", new object[]
					{
						this.address
					});
					Size tileSize = new MercatorCoordinateSystem().GetTileSize();
					GDIBigLockedImage gDIBigLockedImage = new GDIBigLockedImage(tileSize, "CompositeTileUnit");
					D.Say(10, string.Format("Start({0}) sm.count={1}", this.address, this.singleSourceUnits.Count));
					foreach (SingleSourceUnit current in this.singleSourceUnits)
					{
						current.CompositeImageInto(gDIBigLockedImage);
					}
					this.SaveTile(gDIBigLockedImage);
					result = true;
				}
			}
			catch (NonredundantRenderComplaint complaint)
			{
				feedback.PostComplaint(complaint);
				result = false;
			}
			catch (Exception arg)
			{
				feedback.PostMessage(string.Format("Exception compositing tile {0}: {1}", this.address, arg));
				result = false;
			}
			return result;
		}
示例#11
0
 public void AutoSelectMaxZoom(MapTileSourceFactory mapTileSourceFactory)
 {
     if (this.sourceMapRenderOptions.maxZoom == -1)
     {
         MapRectangle userBoundingBox = this.GetUserBoundingBox(mapTileSourceFactory);
         if (userBoundingBox == null)
         {
             return;
         }
         Size size = new Size(600, 600);
         LatLonZoom bestViewContaining = new MercatorCoordinateSystem().GetBestViewContaining(userBoundingBox, size);
         IntParameter intParameter = (IntParameter)mapTileSourceFactory.CreateUnwarpedSource(this).GetImageDetailPrototype(FutureFeatures.Cached).Curry(new ParamDict(new object[]
         {
             TermName.ImageDetail,
             new SizeParameter(size)
         })).Realize("SourceMap.AutoSelectMaxZoom");
         this.sourceMapRenderOptions.maxZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().Constrain(bestViewContaining.zoom + intParameter.value + BuildConfig.theConfig.autoMaxZoomOffset);
     }
 }