本文整理汇总了C#中GMap.NET.GPoint类的典型用法代码示例。如果您正苦于以下问题:C# GPoint类的具体用法?C# GPoint怎么用?C# GPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GPoint类属于GMap.NET命名空间,在下文中一共展示了GPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CacheTiles
bool CacheTiles(ref MapType[] types, int zoom, GPoint p)
{
foreach(MapType type in types)
{
Exception ex;
PureImage img;
// tile number inversion(BottomLeft -> TopLeft) for pergo maps
if(type == MapType.PergoTurkeyMap)
{
img = GMaps.Instance.GetImageFrom(type, new GPoint(p.X, maxOfTiles.Height - p.Y), zoom, out ex);
}
else // ok
{
img = GMaps.Instance.GetImageFrom(type, p, zoom, out ex);
}
if(img != null)
{
img.Dispose();
img = null;
}
else
{
return false;
}
}
return true;
}
示例2: GRect
public GRect(GPoint location, GSize size)
{
this.x = location.X;
this.y = location.Y;
this.width = size.Width;
this.height = size.Height;
}
示例3: OnRender
public override void OnRender(Graphics g)
{
base.OnRender(g);
if (wprad == 0 || Overlay.Control == null)
return;
// if we have drawn it, then keep that color
if (!initcolor.HasValue)
Color = Color.White;
//wprad = 300;
// undo autochange in mouse over
//if (Pen.Color == Color.Blue)
// Pen.Color = Color.White;
double width = (Overlay.Control.MapProvider.Projection.GetDistance(Overlay.Control.FromLocalToLatLng(0, 0), Overlay.Control.FromLocalToLatLng(Overlay.Control.Width, 0)) * 1000.0);
double height = (Overlay.Control.MapProvider.Projection.GetDistance(Overlay.Control.FromLocalToLatLng(0, 0), Overlay.Control.FromLocalToLatLng(Overlay.Control.Height, 0)) * 1000.0);
double m2pixelwidth = Overlay.Control.Width / width;
double m2pixelheight = Overlay.Control.Height / height;
GPoint loc = new GPoint((int)(LocalPosition.X - (m2pixelwidth * wprad * 2)), LocalPosition.Y);// MainMap.FromLatLngToLocal(wpradposition);
//if (m2pixelheight > 0.5)
g.DrawArc(Pen, new System.Drawing.Rectangle(LocalPosition.X - Offset.X - (int)(Math.Abs(loc.X - LocalPosition.X) / 2), LocalPosition.Y - Offset.Y - (int)Math.Abs(loc.X - LocalPosition.X) / 2, (int)Math.Abs(loc.X - LocalPosition.X), (int)Math.Abs(loc.X - LocalPosition.X)), 0, 360);
g.FillPie(new SolidBrush(Color.FromArgb(25,Color.Red)), LocalPosition.X - Offset.X - (int)(Math.Abs(loc.X - LocalPosition.X) / 2), LocalPosition.Y - Offset.Y - (int)Math.Abs(loc.X - LocalPosition.X) / 2, Math.Abs(loc.X - LocalPosition.X), Math.Abs(loc.X - LocalPosition.X), 0, 360);
}
示例4: using
bool PureImageCache.PutImageToCache(byte[] tile, int type, GPoint pos, int zoom)
{
bool ret = true;
if (Created)
{
try
{
string file = CacheLocation + Path.DirectorySeparatorChar + GMapProviders.TryGetProvider(type).Name + Path.DirectorySeparatorChar + zoom + Path.DirectorySeparatorChar + pos.Y + Path.DirectorySeparatorChar + pos.X + ".jpg";
string dir = Path.GetDirectoryName(file);
Directory.CreateDirectory(dir);
using (BinaryWriter sw = new BinaryWriter(File.OpenWrite(file)))
{
sw.Write(tile.ToArray());
}
}
catch (Exception ex)
{
#if MONO
Console.WriteLine("PutImageToCache: " + ex.ToString());
#endif
Debug.WriteLine("PutImageToCache: " + ex.ToString());
ret = false;
}
}
return ret;
}
示例5: MakeTileImageUrl
string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
string ret;
ret = string.Format(CultureInfo.InvariantCulture, CustomURL + "&x={0}&y={1}&z={2}&s=", pos.X, pos.Y, zoom);
return ret;
}
示例6: MakeTileImageUrl
string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
string ret;
ret = string.Format(CultureInfo.InvariantCulture, CustomURL, pos.X, pos.Y, zoom, mapsource, mapkey);
return ret;
}
示例7: GetTileImage
public override PureImage GetTileImage(GPoint pos, int zoom)
{
//string url = MakeTileImageUrl(pos, zoom, LanguageStr);
//return GetTileImageUsingHttp(url);
return null;
}
示例8: MakeTileImageUrl
string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
string ret;
this.RefererUrl = "http://www.norgeskart.no/";
ret = string.Format(CultureInfo.InvariantCulture, CustomURL, zoom, pos.X, pos.Y);
return ret;
}
示例9: GetTileImage
public override PureImage GetTileImage(GPoint pos, int zoom)
{
Console.Out.WriteLine("zoom = {0}, pos = {1}", zoom, pos);
var imgStream = GetImgStreamForZoomPos(pos, zoom);
if (imgStream == null) return null;
var newStream = CopyStream(imgStream, true);
var ret = TileImageProxy.FromStream(imgStream);
ret.Data = newStream;
ret.Data.Position = 0;
newStream.Dispose();
return ret;
}
示例10: WellDetailPopup
public WellDetailPopup(Form parent, BSE.Windows.Forms.Panel leftPanel, Well well, GPoint markerLocationOnParent, string dataConnString, Action<Well> updateMarkerPosition, Action<Well> deleteMarker)
{
this.FormClosing += Close_clicked;
this.leftPanel = leftPanel;
deleteMarkerAction = deleteMarker;
updateMarkerPositionAction = updateMarkerPosition;
connectionString = dataConnString;
Owner = parent;
StartPosition = FormStartPosition.Manual;
Location = markerLocationOnParent;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
InitializeComponent();
this.well = well;
editLngBox.Text = well.Latitude;
editLatBox.Text = well.Longitude;
imageEditBackup = well.WellImage;
wellImage.Image = well.WellImage;
wellImage.SizeMode = PictureBoxSizeMode.Zoom;
}
示例11: TakePartFromOriginal
public static Stream TakePartFromOriginal(Bitmap img, GPoint pos)
{
const int size = 512;
var brush = new SolidBrush(Color.White);
var resizedImg = new Bitmap(ResizeTo(img, size, size));
var bmp = new Bitmap(256, 256);
var graph = Graphics.FromImage(bmp);
graph.FillRectangle(brush, new RectangleF(0, 0, size, size));
var offsetX = (int) pos.X*256;
var offsetY = (int) pos.Y*256;
for (int x = 0; x < 256; x++)
{
for (int y = 0; y < 256; y++)
{
var curX = x + offsetX;
var curY = y + offsetY;
bmp.SetPixel(x, y, resizedImg.GetPixel(curX, curY));
}
}
var resultStream = new MemoryStream();
bmp.Save(resultStream, img.RawFormat);
return resultStream;
}
示例12: GetTileImage
public override PureImage GetTileImage(GPoint pos, int zoom)
{
var px1 = GDALProvider.Instance.Projection.FromTileXYToPixel(pos);
var px2 = px1;
px1.Offset(0, 0);
PointLatLng p1 = GDALProvider.Instance.Projection.FromPixelToLatLng(px1, zoom);
px2.Offset(GDALProvider.Instance.Projection.TileSize.Width, -GDALProvider.Instance.Projection.TileSize.Height);
PointLatLng p2 = GDALProvider.Instance.Projection.FromPixelToLatLng(px2, zoom);
var bmp = GDAL.GetBitmap(p1.Lng, p1.Lat, p2.Lng, p2.Lat, GDALProvider.Instance.Projection.TileSize.Width, GDALProvider.Instance.Projection.TileSize.Height);
if (bmp == null)
{
return null;
}
var ms = new MemoryStream();
bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
return new GMapImage() { Img = bmp, Data = ms };
}
示例13: decode
public String decode(Bitmap bitmap)
{
if (bitmap == null)
{
return null;
}
LuminanceSource source = new RGBLuminanceSource(bitmap, bitmap.Width, bitmap.Height);
BinaryBitmap binaryBitmap = new BinaryBitmap(new HybridBinarizer(source));
try
{
Result result = this.reader.decode(binaryBitmap);
if (result != null)
{
String[] resultToken = result.Text.Split(';');
double lat = Convert.ToDouble(resultToken[0]);
double lng = Convert.ToDouble(resultToken[1]);
double distance = Convert.ToDouble(resultToken[2]);
GPoint pointA = new GPoint(Convert.ToInt32(result.ResultPoints[1].X), Convert.ToInt32(result.ResultPoints[1].Y));
GPoint pointB = new GPoint(Convert.ToInt32(result.ResultPoints[2].X), Convert.ToInt32(result.ResultPoints[2].Y));
MapOverlayForm.Instance.SetMapScale(pointA, pointB, distance);
MapOverlayForm.Instance.RotationAngle = Convert.ToSingle(this.computeRotation(result.ResultPoints));
MapOverlayForm.Instance.MoveMapToLocalPosition(this.computeCenter(result.ResultPoints), new GMap.NET.PointLatLng(lat, lng));
}
return result.Text;
}
catch (ReaderException)
{
return null;
}
}
示例14: OnRender
public override void OnRender(Graphics g)
{
base.OnRender(g);
if (wprad == 0 || MainMap == null)
return;
// undo autochange in mouse over
if (Pen.Color == Color.Blue)
Pen.Color = Color.White;
double width = (MainMap.MapProvider.Projection.GetDistance(MainMap.FromLocalToLatLng(0, 0), MainMap.FromLocalToLatLng(MainMap.Width, 0)) * 1000.0);
double height = (MainMap.MapProvider.Projection.GetDistance(MainMap.FromLocalToLatLng(0, 0), MainMap.FromLocalToLatLng(MainMap.Height, 0)) * 1000.0);
double m2pixelwidth = MainMap.Width / width;
double m2pixelheight = MainMap.Height / height;
GPoint loc = new GPoint((int)(LocalPosition.X - (m2pixelwidth * wprad * 2)), LocalPosition.Y);// MainMap.FromLatLngToLocal(wpradposition);
try
{
g.DrawArc(Pen, new System.Drawing.Rectangle((int)(LocalPosition.X - Offset.X - (Math.Abs(loc.X - LocalPosition.X) / 2)), (int)(LocalPosition.Y - Offset.Y - Math.Abs(loc.X - LocalPosition.X) / 2), (int)(Math.Abs(loc.X - LocalPosition.X)), (int)(Math.Abs(loc.X - LocalPosition.X))), 0, 360);
}
catch { }
}
示例15: MakeTileImageUrl
string MakeTileImageUrl(GPoint pos, int zoom, string language)
{
var px1 = Projection.FromTileXYToPixel(pos);
var px2 = px1;
px1.Offset(0, Projection.TileSize.Height);
PointLatLng p1 = Projection.FromPixelToLatLng(px1, zoom);
px2.Offset(Projection.TileSize.Width, 0);
PointLatLng p2 = Projection.FromPixelToLatLng(px2, zoom);
string ret;
string extra = "?";
if (CustomWMSURL.Contains("?"))
extra = "&";
//if there is a layer, use it
if (szWmsLayer != "")
{
ret = string.Format(CultureInfo.InvariantCulture,
CustomWMSURL + extra + "VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&layers=" + szWmsLayer +
"&styles=&bbox={0},{1},{2},{3}&width={4}&height={5}&srs=EPSG:4326&format=image/png", p1.Lng, p1.Lat,
p2.Lng, p2.Lat, Projection.TileSize.Width, Projection.TileSize.Height);
}
else
{
ret = string.Format(CultureInfo.InvariantCulture,
CustomWMSURL + extra +
"VERSION=1.1.1&REQUEST=GetMap&SERVICE=WMS&styles=&bbox={0},{1},{2},{3}&width={4}&height={5}&srs=EPSG:4326&format=image/png",
p1.Lng, p1.Lat, p2.Lng, p2.Lat, Projection.TileSize.Width, Projection.TileSize.Height);
}
return ret;
}