public GISLayer(GISLayer currentLayer) { this.Visible = currentLayer.Visible; this.Id = currentLayer.Id; this.Name = currentLayer.Name; this.LayerType = currentLayer.LayerType; this._envelope = currentLayer._envelope; this._Features = currentLayer._Features; }
public static void AsXml(XmlWriter xtw, GISEnvelope envelope) { xtw.WriteStartElement("ENVELOPE"); xtw.WriteAttributeString("", "maxx", "", envelope.maxX.ToString()); xtw.WriteAttributeString("", "minx", "", envelope.minX.ToString()); xtw.WriteAttributeString("", "maxy", "", envelope.maxY.ToString()); xtw.WriteAttributeString("", "miny", "", envelope.minY.ToString()); xtw.WriteEndElement(); // ENVELOPER }
public static GISEnvelope Calculate(double centerX, double centerY, double width, double height) { double widthfactor = 1.0; GISEnvelope env = new GISEnvelope(); do { env.minY = GetCoordinate(centerX, centerY, 180, height / widthfactor).lat; env.maxY = GetCoordinate(centerX, centerY, 0, height / widthfactor).lat; env.maxX = GetCoordinate(centerX, centerY, 270, width / widthfactor).lon; env.minX = GetCoordinate(centerX, centerY, 90, width / widthfactor).lon; widthfactor += 1.0; } while (((int)env.CenterX != (int)centerX || (int)env.CenterY != (int)centerY || env.minY > env.maxY) && widthfactor < 6); if (env.minX > env.maxX) { env.maxX = -env.maxX; env.minX = -env.minX; } return env; }
public virtual void ExecuteSearch(string searchTerm, SEARCH_TYPE searchType, GISEnvelope searchArea, GISLayerInfo featureLayer) { throw new NotSupportedException(string.Format("Server type {0} does not expose a search interface.", this._Server.Type)); }
public abstract bool GetMap(GISService activeService, GISEnvelope mapEnvelope);
public EsriEnvelope(GISEnvelope env) : base(env.minX, env.maxX, env.minY, env.MaxY) { CoordinateSystem = env.CoordinateSystem; }
public double GetZoomLevel(GISEnvelope currentExtent) { return Controller.SetZoomLevel(currentExtent, Controller.SelectEnvelope(ActiveService)); }
//internal GISEnvelope SelectEnvelope(GISEnvelope lastEnvelope) //{ // if (_Server.ActiveLayers.Count > 0) // { // foreach (GISLayerInfo serviceInfo in _Server.ActiveLayers) // { // if (serviceInfo.IsVisible && serviceInfo.BaseExtent != null) // { // return serviceInfo.BaseExtent; // } // } // } // if (_Server.ActiveService.BaseLayers.Count > 0) // { // foreach (GISLayerInfo serviceInfo in _Server.ActiveService.BaseLayers) // { // if (serviceInfo.IsVisible && serviceInfo.BaseExtent != null) // { // return serviceInfo.BaseExtent; // } // } // } // if (_Server.ActiveService.BaseExtent != null) // { // return _Server.ActiveService.BaseExtent; // } // return lastEnvelope; //} internal virtual double SetZoomLevel(GISEnvelope lastEnvelope, GISEnvelope maximumExtent) { if (lastEnvelope != null && maximumExtent != null) { //TransformEnvelope(ref lastEnvelope); //TransformEnvelope(ref maximumExtent); double zoompercent = 1 - Math.Min(lastEnvelope.Width / maximumExtent.Width, lastEnvelope.Height / maximumExtent.Height); // double zoompercent = lastEnvelope.Height / maximumExtent.Height; return 100.0 * zoompercent; } else return 0; }
internal virtual GISEnvelope ZoomAbsolute(double zoomPercent, GISEnvelope lastEnvelope) { double zoomAmount = 1 - zoomPercent / 100.0; GISEnvelope envelope = SelectEnvelope(_Server.ActiveService); if (lastEnvelope != null) { return envelope.Zoom(zoomAmount, lastEnvelope.CenterX, lastEnvelope.CenterY); } else return envelope.Zoom(zoomAmount, envelope.CenterX, envelope.CenterY); }
public bool Identify(int xpoint, int ypoint, double latitude, double longitude, GISEnvelope envelope, GISLayerInfo featureLayer) { if (Controller.RequestProcessing) return false; else Controller.RequestProcessing = true; if (featureLayer == null) { if (FeatureLayer == null) { List<GISLayerInfo> layers = GetQueryLayers(); if (layers.Count() > 0) { featureLayer = layers.First(); } } else featureLayer = FeatureLayer; } return Controller.Identify(xpoint, ypoint, latitude, longitude, envelope, featureLayer); }
public abstract string GetMapImage(GISService activeService, List<GISLayerInfo> mapLayers, GISEnvelope mapEnvelope, double zoomLevel, int width, int height);
public bool GetMap(GISService service, GISEnvelope mapEnvelope, List<GISLayerInfo> mapLayers) { if (Controller.RequestProcessing) return false; else Controller.RequestProcessing = true; return Controller.GetMap(service, mapEnvelope, mapLayers); }
public string GetMapImage(GISService activeService, List<GISLayerInfo> mapLayers, GISEnvelope mapEnvelope, double zoomLevel, int width, int height) { return Controller.GetMapImage(activeService, mapLayers, mapEnvelope, zoomLevel, width, height); }
public bool GetMap(GISEnvelope envelope, double zoomLevel) { if (Controller.RequestProcessing) return false; else Controller.RequestProcessing = true; if (ActiveService != null) { if (zoomLevel > MaxZoom) zoomLevel = Math.Floor(MaxZoom - MaxZoom * .1); return (ZoomType == ZOOM_TYPE.TILED) ? Controller.GetMap(ActiveService, envelope.CenterX, envelope.CenterY, zoomLevel) : Controller.GetMap(ActiveService, envelope); } return false; }
public bool GetMap(GISEnvelope envelope) { if (Controller.RequestProcessing) return false; else Controller.RequestProcessing = true; if (ActiveService != null) { return (ZoomType == ZOOM_TYPE.TILED) ? Controller.GetMap(ActiveService, envelope.CenterX, envelope.CenterY, Controller.SetZoomLevel(envelope, ActiveService._baseExtent)) : Controller.GetMap(ActiveService, envelope); } return false; }
public bool ZoomAbsolute(double zoomLevel, GISEnvelope lastEnvelope) { return Controller.GetMap(ActiveService, lastEnvelope.CenterX, lastEnvelope.CenterY, zoomLevel); }
public abstract bool GetMap(GISService activeService, GISEnvelope mapEnvelope, List<GISLayerInfo> mapLayers);
public void ExecuteSearch(string searchTerm, SEARCH_TYPE searchType, GISEnvelope searchArea) { if (Controller.RequestProcessing) return; else Controller.RequestProcessing = true; if (FeatureLayer == null) { List<GISLayerInfo> layers = GetQueryLayers(); if (layers.Count() > 0) { _featureLayer = layers.First(); } } Controller.ExecuteSearch(searchTerm, searchType, searchArea, FeatureLayer); }
public abstract bool GetMap(GISService activeService, List<GISLayerInfo> mapLayers, GISEnvelope mapEnvelope, double zoomLevel, string requestString);
// starts at IMAGE begin element public static OGCImageResponse ProcessImageReturn(string requestString, GISEnvelope responseEnvelope) { OGCImageResponse response = new OGCImageResponse(); response.LastRequest = requestString; return response; }
public virtual bool Identify(int xpoint, int ypoint, double latitude, double longitude, GISEnvelope envelope, GISLayerInfo featureLayer) { throw new NotImplementedException("base class"); }
internal static GISLayerInfo Create(GISService activeService, GISEnvelope gISEnvelopes) { return new OGCLayer() { _id = activeService._serviceName, _isVisible = activeService.IsEnabled, _name = activeService.Name, _baseExtent = gISEnvelopes }; }
internal void TransformEnvelope(ref GISEnvelope inputEnvelope) { if (inputEnvelope.CoordinateSystem != "EPSG:4326") return; double aspectImg = (double)_imageWidth / (double)_imageHeight; inputEnvelope.maxX = inputEnvelope.minX + (inputEnvelope.Height * aspectImg); double aspectEnv = inputEnvelope.Width / inputEnvelope.Height; }
public static GISEnvelope Create(double latitude, double longitude) { GISEnvelope envelope = new GISEnvelope(); envelope.minY = latitude - Math.Abs(latitude * .001); envelope.minX = longitude - Math.Abs(longitude * .001); envelope.maxY = latitude + Math.Abs(latitude * .001); envelope.maxX = longitude + Math.Abs(longitude * .001); return envelope; }
protected GISEnvelope BuildEnvelope(double centerX, double centerY, GISEnvelope baseEnvelope, double zoomLevel) { if (zoomLevel == 0) return baseEnvelope; double newHeight = (baseEnvelope.Height * (100.0 - zoomLevel) / 100.0) / 2.0; double newWidth = (baseEnvelope.Width * (100.0 - zoomLevel) / 100.0) / 2.0; GISEnvelope mapEnvelope = new GISEnvelope(centerX - newWidth, centerX + newWidth, centerY - newHeight, centerY + newHeight); mapEnvelope.CoordinateSystem = baseEnvelope.CoordinateSystem; if (mapEnvelope.minX < baseEnvelope.minX) mapEnvelope.minX = baseEnvelope.minX; if (mapEnvelope.minY < baseEnvelope.minY) mapEnvelope.minY = baseEnvelope.minY; if (mapEnvelope.maxX > baseEnvelope.maxX) mapEnvelope.maxX = baseEnvelope.maxX; if (mapEnvelope.maxY > baseEnvelope.maxY) mapEnvelope.maxY = baseEnvelope.maxY; //TransformEnvelope(ref mapEnvelope); return mapEnvelope; }
internal static OGCService Create(XElement layer) { GISEnvelope env = new GISEnvelope(); OGCService service = new OGCService(""); // <CRS>CRS:84</CRS> //<EX_GeographicBoundingBox> // <westBoundLongitude>-180.0</westBoundLongitude> // <eastBoundLongitude>180.0</eastBoundLongitude> // <southBoundLatitude>-90.0</southBoundLatitude> // <northBoundLatitude>90.0</northBoundLatitude> //</EX_GeographicBoundingBox> foreach (XElement el in layer.Elements()) { if (el.Name == "Name") { service._serviceName = layer.Element("Name").Value; } else if (el.Name == "Title") { service._description = el.Value; } else if (el.Name == "SRS") { env.CoordinateSystem = el.Value; } else if (el.Name == "CRS") { env.CoordinateSystem = el.Value; } else if (el.Name == "LatLonBoundingBox") { env.minX = double.Parse(el.Attribute("minx").Value); env.maxX = double.Parse(el.Attribute("maxx").Value); env.minY = double.Parse(el.Attribute("miny").Value); env.maxY = double.Parse(el.Attribute("maxy").Value); } else if (el.Name == "BoundingBox") { env.minX = double.Parse(el.Attribute("minx").Value); env.maxX = double.Parse(el.Attribute("maxx").Value); env.minY = double.Parse(el.Attribute("miny").Value); env.maxY = double.Parse(el.Attribute("maxy").Value); env.CoordinateSystem = el.Attribute("SRS") != null ? el.Attribute("SRS").Value : el.Attribute("CRS").Value; } else if (el.Name == "Layer") { service._baseLayers.Add(OGCLayer.Create(el)); } } service._baseExtent = env; return service; }
internal static GISLayerInfo Create(XElement layer) { GISEnvelope env = new GISEnvelope(); OGCLayer service = new OGCLayer(); foreach (XElement el in layer.Elements()) { if (el.Name == "Name") { service._id = el.Value; } else if (el.Name == "Title") { service._name = el.Value; } else if (el.Name == "SRS") { env.CoordinateSystem = el.Value; } else if (el.Name == "LatLonBoundingBox") { env.minX = double.Parse(el.Attribute("minx").Value); env.maxX = double.Parse(el.Attribute("maxx").Value); env.minY = double.Parse(el.Attribute("miny").Value); env.maxY = double.Parse(el.Attribute("maxy").Value); } else if (el.Name == "BoundingBox") { env.minX = double.Parse(el.Attribute("minx").Value); env.maxX = double.Parse(el.Attribute("maxx").Value); env.minY = double.Parse(el.Attribute("miny").Value); env.maxY = double.Parse(el.Attribute("maxy").Value); env.CoordinateSystem = el.Attribute("SRS").Value; } else if (el.Name == "Style") { OGCStyle style = new OGCStyle() { Name = el.Element("Name").Value }; style.Abstract = el.Elements(XName.Get("Abstract")).First().Value; style.Title = el.Elements(XName.Get("Title")).First().Value; if (el.Elements(XName.Get("LegendURL")).Count() > 0) { style.LegendURL = GetHrefFromResource(el.Elements(XName.Get("LegendURL")).First()); } service.Style.Add(style); } } service._baseExtent = env; return service; }
internal static GISEnvelope Parse(string coordstring, string coordsys) { GISEnvelope e = new GISEnvelope(); string[] coords = coordstring.Split(','); e.maxX = double.Parse(coords[3].Replace(',', '.')); e.minX = double.Parse(coords[1].Replace(',', '.')); e.maxY = double.Parse(coords[2].Replace(',', '.')); e.minY = double.Parse(coords[0].Replace(',', '.')); if (coordstring.Contains(":")) { e._coordinateSystem = coordsys; } else e._coordinateSystem = string.Format("epsg:{0}", coordsys); return e; }