public QLeaf[] Paint(double latitud, double longitud, int pincel, int valor, bool lockLeaf) { var leafs = new List <QLeaf>(pincel * pincel); var idx = GetIndex(latitud - ((pincel - 1) * HalfVerticalResolution), longitud - ((pincel - 1) * HalfHorizontalResolution)); for (var i = idx.Y; i < idx.Y + pincel; i++) { for (var j = idx.X; j < idx.X + pincel; j++) { var pos = GetCenterLatLon(new QIndex { X = j, Y = i }); SetValue(pos.Latitud, pos.Longitud, valor); var leaf = GetQLeaf(pos.Latitud, pos.Longitud); leaf.Locked |= lockLeaf; leafs.Add(leaf); } } if (lockLeaf && AlphaChannel != null) { AlphaChannel.Paint(latitud, longitud, pincel, 1); } return(leafs.ToArray()); }
public override void Open(string directory) { var repo = new Repository(); var so = new GridStructure(); repo.Open <GeoGrillas>(directory, ref so); Repository = repo; if (AlphaChannel == null) { return; } var lockDirectory = Path.Combine(directory, "locks"); if (!Directory.Exists(directory)) { AlphaChannel = new GteQtree(); AlphaChannel.Create(lockDirectory, so); } else { AlphaChannel.Open(lockDirectory); } }
public void Open(string dir) { var repo = new Repository(); var so = new GridStructure(); switch (Format) { case QtreeFormat.Gte: repo.Open <GeoGrillas>(dir, ref so); break; case QtreeFormat.Torino: repo.Open <GR2>(dir, ref so); break; } Repository = repo; if (AlphaChannel == null) { return; } var lockDir = Path.Combine(dir, "locks"); if (!Directory.Exists(lockDir)) { Directory.CreateDirectory(lockDir); switch (Format) { case QtreeFormat.Gte: CreateGte(lockDir); break; case QtreeFormat.Torino: CreateTorino(lockDir); break; } } AlphaChannel.Open(lockDir); }
public bool GetLock(double lat, double lon) { if (AlphaChannel == null) { return(false); } return(AlphaChannel.GetQLeaf(lat, lon).Valor > 0); }
public QLeaf SetLock(double latitud, double longitud, bool valor) { if (AlphaChannel == null) { return(null); } AlphaChannel.SetValue(latitud, longitud, valor ? 1 : 0); return(GetQLeaf(latitud, longitud)); }
public void Close() { if (Repository != null) { Repository.Close(); } Repository = null; if (AlphaChannel != null) { AlphaChannel.Close(); } }
public QLeaf SetValue(double lat, double lon, int valor, bool lockLeaf) { var inside = IsInsideQtree(lat, lon); if (inside) { Repository.SetPositionClass((float)lat, (float)lon, valor); } var index = GetIndex(lat, lon); var pos = GetLatLon(index); if (lockLeaf && AlphaChannel != null) { AlphaChannel.SetValue(lat, lon, 1); } return(new QLeaf { Index = index, Posicion = pos, Valor = inside ? valor : 0 }); }
public QLeaf[] PaintPolygon(List <PointF> points, int color, bool lockLeaf) { var leafs = FillPolygon(points.Select(p => new QLatLon { Latitud = p.Y, Longitud = p.X }).ToList()); foreach (var leaf in leafs) { var pos = leaf.Posicion;//GetCenterLatLon(leaf.Posicion); SetValue(pos.Latitud, pos.Longitud, color); leaf.Valor = color; leaf.Locked |= lockLeaf; } if (lockLeaf && AlphaChannel != null) { AlphaChannel.PaintPolygon(points, 1); } return(leafs.ToArray()); }
public void Dispose() { MagickImage?.Dispose(); AlphaChannel?.Dispose(); }
internal void Cleanup() { AlphaChannel.Dispose(); ColorModeData.Dispose(); }