コード例 #1
0
ファイル: GeoportailPlugin.cs プロジェクト: gvellut/geopochi
 public bool Intersect(Extent extent)
 {
     return ( TopLeftUV.U < extent.BottomRightUV.U
             && BottomRightUV.U > extent.TopLeftUV.U
             && TopLeftUV.V > extent.BottomRightUV.V
             && BottomRightUV.V < extent.TopLeftUV.V
             );
 }
コード例 #2
0
ファイル: GeoportailPlugin.cs プロジェクト: gvellut/geopochi
        private void AddGeoTile(DrawArgs drawArgs, GeoportailLayer layer, int row, int col, GeoportailLayerLevel zoomLevel)
        {
            ArrayList geoTiles = layer.GeoTiles;
            bool tileFound = false;
            lock(geoTiles.SyncRoot) {
                foreach(GeoTile geoTile in geoTiles) {
                    if(geoTile.IsNeeded == true) {
                        continue; //we don't want to do the next test
                    }
                    if(geoTile.IsEqual(layer,row, col, zoomLevel) == true) {
                        geoTile.IsNeeded = true;
                        tileFound = true;
                        break;
                    }
                }
            }
            if(tileFound == false) {
                //exit if zoom level has changed
                double arcDistance = drawArgs.WorldCamera.TrueViewRange.Radians * EarthRadius;
                double scale = Scale(arcDistance);

                GeoportailLayerLevel curZoomLevel = layer.GetLevelByArcDistance(arcDistance);

                if(curZoomLevel != zoomLevel) {
                    return;
                }

                //Calculate the extent of the current tile so we can know if it intersects any components of the layer
                double xTL = col * zoomLevel.WorldPerTile.U + layer.LayerExtent.TopLeftUV.U;
                double yTL = layer.LayerExtent.TopLeftUV.V - (row * zoomLevel.WorldPerTile.V);
                double xBR = xTL + zoomLevel.WorldPerTile.U;
                double yBR = yTL - zoomLevel.WorldPerTile.V;
                Extent extent = new Extent(xTL,yTL,xBR,yBR);

                ArrayList components = layer.FindComponentsForScaleAndExtent(scale,extent);

                if(components.Count == 0)
                    return;

                GeoTile newGeoTile = new GeoTile(layer, components, row, col, zoomLevel);

                //thread to download new tile(s) or just load from cache
                newGeoTile.GetTexture(drawArgs);

                newGeoTile.UL = new UV(xTL,yTL);
                newGeoTile.UR = new UV(xBR,yTL);
                newGeoTile.LL = new UV(xTL,yBR);
                newGeoTile.LR = new UV(xBR,yBR);

                //create mesh
                byte opacity = this.Opacity; //from RenderableObject
                float verticalExaggeration = World.Settings.VerticalExaggeration;
                newGeoTile.CreateMesh(opacity, verticalExaggeration);
                newGeoTile.CreateDownloadRectangle(drawArgs, World.Settings.DownloadProgressColor.ToArgb());

                newGeoTile.IsNeeded = true;
                lock(geoTiles.SyncRoot) {
                    geoTiles.Add(newGeoTile);
                }
            }
        }
コード例 #3
0
ファイル: GeoportailPlugin.cs プロジェクト: gvellut/geopochi
 public bool Intersect(Extent extent)
 {
     return extent.Intersect(extent);
 }
コード例 #4
0
ファイル: GeoportailPlugin.cs プロジェクト: gvellut/geopochi
 public GeoportailLayerComponent(GeoportailLayer layer,String url,Extent extent,int scaleMin, int scaleMax)
 {
     this.Layer = layer;
     this.url = url;
     this.extent = extent;
     this.scaleMin = scaleMin;
     this.scaleMax = scaleMax;
 }
コード例 #5
0
ファイル: GeoportailPlugin.cs プロジェクト: gvellut/geopochi
 public ArrayList FindComponentsForScaleAndExtent(double scale,Extent extent)
 {
     ArrayList results = new ArrayList(20);
     scale /= 8;
     while(results.Count == 0){
         foreach(Object objComponent in Components){
             GeoportailLayerComponent component = objComponent as GeoportailLayerComponent;
             if(component.IsValidForScale(scale) && component.Intersect(extent)){
                 results.Add(component);
             }
         }
         scale *= 2;
     }
     return results;
 }
コード例 #6
0
ファイル: GeoportailPlugin.cs プロジェクト: gvellut/geopochi
        public GeoportailLayer(String name,Proj projection, Extent extent,UV cellSize, int width, int height, String copyrightNoticeUrl)
        {
            this.Name = name;
            this.Projection = projection;
            this.LayerExtent = extent;
            this.CellSize = cellSize;
            this.Width = width;
            this.Height = height;
            this.CopyrightNoticeUrl = copyrightNoticeUrl;

            this.Components = new ArrayList();
            this.Levels = new ArrayList();

            //Determinate the number of levels and create an Level object for each one
            int size = Math.Min(width,height);
            while(size > GeoportailTilesLayer.PixelsPerTile) {
                Levels.Add(new GeoportailLayerLevel(this, Levels.Count));
                size /= 2;
            }

            this.GeoTiles = new ArrayList();
        }