private void InitializeLayer() { var mxdoc = (IMxDocument)_application.Document; _map = mxdoc.FocusMap; _cacheDir = CacheSettings.GetCacheFolder(); _tileTimeOut = ConfigurationHelper.GetTileTimeOut(); var spatialReferences = new SpatialReferences(); _tileSource = _config.CreateTileSource(); _schema = _tileSource.Schema; _dataSpatialReference = spatialReferences.GetSpatialReference(_schema.Srs); _envelope = GetDefaultEnvelope(); if (_map.SpatialReference == null) { // zet dan de spatial ref... _map.SpatialReference = _dataSpatialReference; } // If there is only one layer in the TOC zoom to this layer... if (_map.LayerCount == 0) { //envelope.Expand(-0.1, -0.1, true); _envelope.Project(_map.SpatialReference); ((IActiveView)_map).Extent = _envelope; } _displayFilter = new TransparencyDisplayFilterClass(); }
public BruTileCustomLayer(IApplication application, TileSource tileSource, FileCache fileCache) { _tileSource = tileSource; _fileCache = fileCache; _simplefilefetcher = new SimpleFileFetcher(tileSource, fileCache); var spatialReferences = new SpatialReferences(); _dataSpatialReference = spatialReferences.GetSpatialReference(_tileSource.Schema.Srs); if (SpatialReference.FactoryCode == 0) { // zet dan de spatial ref... m_spatialRef = _dataSpatialReference; } var mxdoc = (IMxDocument)application.Document; _map = mxdoc.FocusMap; var envelope = GetDefaultEnvelope(); // If there is only one layer in the TOC zoom to this layer... if (_map.LayerCount == 0) { ((IActiveView)_map).Extent = envelope; } }
private GeoLine CreateGreatCircle() { GeoPoint point1 = new GeoPoint(-73.935242, 40.730610); GeoPoint point2 = new GeoPoint(2.294694, 48.858093); GeoMultiLine greatCircleInWgs84 = point1.GetGreatCircle(point2, 30); Projection projection = new Proj4Projection(SpatialReferences.GetWgs84(), SpatialReferences.GetSphericalMercator()); GeoMultiLine greatCircleIn900913 = (GeoMultiLine)projection.ConvertToTarget(greatCircleInWgs84); return(greatCircleIn900913.Lines[0]); }
private void LoadData() { lblLoginStatus.Text = _login.Credentials ? LoginSuccessfully : LoginFailed; bool apply = btnApply.Enabled; ckDefaultBaseUrl.Checked = _config.BaseUrlDefault; ckDefaultRecordingService.Checked = _config.RecordingsServiceDefault; ckDefaultSwfUrl.Checked = _config.SwfUrlDefault; ckDefaultCycloramaVectorLayerLocation.Checked = _config.CycloramaVectorLayerLocationDefault; ckUseProxyServer.Checked = _config.UseProxyServer; ckUseDefaultProxyCredentials.Checked = (!_config.UseProxyServer) || _config.ProxyUseDefaultCredentials; txtBaseUrlLocation.Text = _config.BaseUrlDefault ? string.Empty : _config.BaseUrl; txtRecordingServiceLocation.Text = _config.RecordingsServiceDefault ? string.Empty : _config.RecordingsService; txtSwfUrlLocation.Text = _config.SwfUrlDefault ? string.Empty : _config.SwfUrl; txtCycloramaVectorLayerLocation.Text = _config.CycloramaVectorLayerLocationDefault ? string.Empty : _config.CycloramaVectorLayerLocation; FillInProxyParameters(); txtBaseUrlLocation.Enabled = !_config.BaseUrlDefault; txtRecordingServiceLocation.Enabled = !_config.RecordingsServiceDefault; txtSwfUrlLocation.Enabled = !_config.SwfUrlDefault; txtCycloramaVectorLayerLocation.Enabled = !_config.CycloramaVectorLayerLocationDefault; btnApply.Enabled = apply; nudMaxViewers.Value = _config.MaxViewers; nudDistVectLayerViewer.Value = _config.DistanceCycloramaVectorLayer; txtPassword.Text = _login.Password; txtUsername.Text = _login.Username; ckEnableSmartClick.Checked = (GlobeSpotterConfiguration.MeasureSmartClick && _config.SmartClickEnabled); ckEnableSmartClick.Enabled = GlobeSpotterConfiguration.MeasureSmartClick; ckDetailImages.Checked = _config.DetailImagesEnabled; cbSpatialReferences.Items.Clear(); SpatialReferences spatialReferences = SpatialReferences.Instance; foreach (var spatialReference in spatialReferences) { if (spatialReference.KnownInArcMap) { cbSpatialReferences.Items.Add(spatialReference); } } SpatialReference configSpat = _config.SpatialReference; SpatialReference spatialRef = spatialReferences.GetItem((configSpat == null) ? ArcUtils.EpsgCode : configSpat.SRSName); cbSpatialReferences.SelectedItem = spatialRef; _config.SpatialReference = spatialRef; if (!_login.Credentials) { txtUsername.Select(); } }
private void Button_Click(object sender, RoutedEventArgs e) { if (Map1.MapUnit == GeoUnit.Meter) { return; } Map1.MapUnit = GeoUnit.Meter; FeatureLayer featureLayer = Map1.FindLayer <ShapefileLayer>("countries-wgs84"); SpatialReference srsSource = SpatialReferences.GetWgs84(); SpatialReference srsTarget = SpatialReferences.GetSphericalMercator(); featureLayer.Source.Projection = new Proj4Projection(srsSource, srsTarget); Map1.Overlays["countries-wgs84"].Invalidate(); Map1.ZoomToFullBound(); }
private async void wpfMap_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; LayerOverlay baseOverlay = new LayerOverlay(); baseOverlay.Name = "Base Maps"; Map1.Overlays.Add(baseOverlay); OpenStreetMapLayer baseLayer = new OpenStreetMapLayer(); baseOverlay.Layers.Add(baseLayer); routeLine = new GeoLine("LINESTRING(2121735.25 6023143.5,2121641.25 6023344,2121161.25 6023667,2121192.75 6025693,2121255.5 6025818.5,2122127.25 6024946.5,2121986.25 6024802.5,2122262.25 6024536,2122014.5 6024363.5,2122691.75 6023497.5,2121754 6023137)"); routeLength = routeLine.GetLength(GeoUnit.Meter, LengthUnit.Kilometer); MemoryLayer routeLayer = new MemoryLayer(); routeLayer.Styles.Add(new LineStyle(GeoColor.FromRgba(GeoColors.SkyBlue, 180), 10)); routeLayer.Features.Add(new Feature(routeLine)); Map1.AddStaticLayers("Route Line", routeLayer); Marker vehicle = new Marker(); vehicle.DropShadow = false; vehicle.OffsetY = 4; vehicle.RenderTransform = new RotateTransform { CenterX = 17, CenterY = 7, Angle = -90 }; vehicle.ImageSource = new BitmapImage(new Uri("pack://application:,,,/Images/vehicle-red.png", UriKind.RelativeOrAbsolute)); vehicle.Location = routeLine.Coordinates.First(); Map1.Placements.Add(vehicle); GeoBound bound = routeLayer.GetBound(); bound.ScaleUp(40); Map1.ZoomTo(bound); projection = new Proj4Projection(SpatialReferences.GetSphericalMercator(), SpatialReferences.GetWgs84()); UpdateLonLat(new GeoPoint(vehicle.Location)); }