public static LatLngVek operator *(float fak, LatLngVek lv1) { var lat = fak * lv1.lat; var lng = fak * lv1.lng; LatLngVek rv = new LatLngVek(lat, lng, "scaled LatLngVek"); return(rv); }
public static LatLngVek operator -(LatLngVek lv1, LatLngVek lv2) { var lat = lv1.lat - lv2.lat; var lng = lv1.lng - lv2.lng; LatLngVek rv = new LatLngVek(lat, lng, "difference of LatLngVek and LatLngVek"); return(rv); }
public static LatLngVek operator +(LatLngVek lv1, LatLngVek lv2) { var lat = lv1.lat + lv2.lat; var lng = lv1.lng + lv2.lng; LatLngVek rv = new LatLngVek(lat, lng, "sum of LatLngVek and LatLngVek"); return(rv); }
public static LatLng operator +(LatLngVek lv1, LatLng ll2) { var lat = lv1.lat + ll2.lat; var lng = lv1.lng + ll2.lng; var rv = new LatLngVek(lat, lng, "difference of two LatLngs"); return(rv); }
public static LatLngVek operator -(LatLng ll1, LatLng ll2) { var lat = ll1.lat - ll2.lat; var lng = ll1.lng - ll2.lng; var rv = new LatLngVek(lat, lng, "difference of two LatLngs"); return(rv); }
public static Vector2d GetLatLngDeltInMeters(LatLng ll, LatLngVek delt) { //var earthcircum = 40075016.63;// 40kkm //var latrad = Math.Cos(Math.PI * ll.lat / 180.0) * earthcircum; //var latoffsetmeters = earthcircum * delt.lng / 360; //var lngoffsetmeters = latrad * delt.lat / 360; var(dlat, dlng) = GetLatLngDeltInMeters(ll, delt.lat, delt.lng); var rv = new Vector2d(dlng, dlat); return(rv); }
void TranslateViewer(float xmove, float zmove) { if (usellmeth) { TranslateViewerLatLng(xmove, zmove); } else { TranslateViewerLambda(xmove, zmove); } curLatLng = qmm.GetLngLat(transform.position); offsetToMapMidpoint = curLatLng - qmm.stats.llbox.midll; offsetToOrigin = curLatLng - qmm.stats.llbox.orgll; offsetToMapMidpointMeter = LatLng.GetLatLngDeltInMeters(curLatLng, offsetToMapMidpoint); offsetToOriginMeter = LatLng.GetLatLngDeltInMeters(curLatLng, offsetToOrigin); }
public void Initialize(LatLng ll1, LatLng ll2, string name = "llbox", int lod = 16, LatLng org = null) { this.name = name; this.lod = lod; var latmin = System.Math.Min(ll1.lat, ll2.lat); var lngmin = System.Math.Min(ll1.lng, ll2.lng); minll = new LatLng(latmin, lngmin); var latmax = System.Math.Max(ll1.lat, ll2.lat); var lngmax = System.Math.Max(ll1.lng, ll2.lng); maxll = new LatLng(latmax, lngmax); var latmid = (latmin + latmax) / 2; var lngmid = (lngmin + lngmax) / 2; midll = new LatLng(latmid, lngmid); orgll = (org == null ? midll : org); groundMetersPerPixel = (float)(TileSystem.GroundResolution(latmid, lod)); extent = maxll - minll; var p1 = ll1.GetMeterCoords(lod); var p2 = ll2.GetMeterCoords(lod); diagonalInMeters = (float)LatLng.DistanceV2d(p1, p2); pixbl = GetBottomLeft().GetPixelCoords(lod); pixbr = GetBottomRight().GetPixelCoords(lod); pixul = GetUpperLeft().GetPixelCoords(lod); pixur = GetUpperRight().GetPixelCoords(lod); var op = pixul; // Debug.Log($"pix bl:{pixbl-op} br:{pixbr-op} ul:{pixul-op} ur:{pixur-op}"); var dpx = (Vector2.Distance(pixbl, pixbr) + Vector2.Distance(pixul, pixur)) / 2; var dpy = (Vector2.Distance(pixul, pixbl) + Vector2.Distance(pixur, pixbr)) / 2;// long live symmetry extentPixels = new Vector2(dpx, dpy); metbl = GetBottomLeft().GetMeterCoords(lod); metbr = GetBottomRight().GetMeterCoords(lod); metul = GetUpperLeft().GetMeterCoords(lod); metur = GetUpperRight().GetMeterCoords(lod); var om = metbl; // Debug.Log($"met bl:{diff2d(metbl,om)} br:{diff2d(metbr,om)} ul:{diff2d(metul,om)} ur:{diff2d(metur,om)}"); var dmx = (LatLng.DistanceV2d(metbl, metbr) + LatLng.DistanceV2d(metul, metur)) / 2; var d1 = LatLng.DistanceV2d(metul, metbl); var d2 = LatLng.DistanceV2d(metur, metbr); var dmy = (LatLng.DistanceV2d(metul, metbl) + LatLng.DistanceV2d(metur, metbr)) / 2;// long live symmetry extentMeters = new Vector2((float)dmx, (float)dmy); extentMeters1 = groundMetersPerPixel * extentPixels; }