void DrawLayer(LayerAbstract oL, Graphics g, Rectangle Rect) { CoordSys layerCoordsys = oL.LayerCoordSys; CoordConverter oCC = new CoordConverter(); oCC.Init(layerCoordsys, DisplayCoordSys); // this atPan converts DisplayCoordSys into Screen CoordSys[px] // DisplayCoordSys has Y axis up (unless its AT does not change it) // Screen Y axis is down AffineTransform atPan = new AffineTransform(); atPan.OffsetInPlace((double)mapOffsetX, (double)mapOffsetY); atPan.MultiplyInPlace(mapScale, -mapScale); // add screen scale and offset transformation oCC.atMaster = oCC.atMaster.Compose(atPan); oL.Draw(g, Rect, oCC); }
public FeaturesContainer(LayerAbstract parentLayer) { this.parentLayer = parentLayer; }
private void InitMapAndPresenter() { // set Display coordsys mapControl1.Map.DisplayCoordSys = CoordSysFactory.CreateCoordSys("Mercator Datum(WGS84)"); // make Map Layer mapControl1.Map.Layers.Clear(); mapControl1.ResizeScaleMode = MapControl.ResizeScaleConst.NoChange; // One Tile Layer tileLayer = new LayerTilesAsynch(); // mercator (datum(wgs84)) mapControl1.Map.Layers.Add(tileLayer); // MVC ------------ // bind view to presentation surface (control) gpxMapView = new GPXViewMap(mapControl1); gpxViewTree = new GPXViewTree(treeView1); gpxViewScrollbar = new GPXViewScrollbar(gpxScrollBar); gpxViewTimeSlide = new GPXViewTimeSlide(timeSlide1); gpxPresenter = new GPXPresenter(); gpxPresenter.registerView(gpxMapView); gpxPresenter.registerView(gpxViewTree); gpxPresenter.registerView(gpxViewScrollbar); gpxPresenter.registerView(gpxViewTimeSlide); mapControl1.Map.InsertionLayer = gpxMapView.o_LayerGPXPolylines; // CoordSys oCSWGS84 = CoordSysFactory.CreateCoordSys(CoordSysType.LatLong, CoordSysFactory.CreateDatum(DatumID.WGS84), new AffineTransform()); oCCGPS = new CoordConverter(); oCCGPS.Init(gpxMapView.o_LayerGPXPolylines.LayerCoordSys, mapControl1.Map.DisplayCoordSys); // show zoom=0 (whole world) in scale 1px screen = 1px layer Datum datumWGS84 = CoordSysFactory.CreateDatum(DatumID.WGS84); double r = datumWGS84.SemiMajorAxis; double zoom = mapControl1.Bounds.Width / 256.0 * 2 * Math.PI * r; //mapControl1.SetCenterZoom(0.0, 0.0, zoom, mapControl1.Bounds); /* if (gpxFile.getWptCount() > 0) { GpxWpt wpt = gpxFile.getWpt(0); oCCGPS.Convert(wpt.lon, wpt.lat); mapControl1.SetCenterZoom(oCCGPS.X, -oCCGPS.Y, zoom / 256.0, mapControl1.Bounds); // center poland } else {*/ oCCGPS.Convert(21.0, 52.0); mapControl1.SetCenterZoom(oCCGPS.X, -oCCGPS.Y, zoom / 256.0, mapControl1.Bounds); // center poland //} }