/** * Creates a network link to the first tile in the pyramid * * @param superString * @param bbox * @param url * @return */ private static String superOverlayNetworLink(String superString, BoundingBox bbox, String url) { String xml = "\n<NetworkLink><name>Super-overlay: " + superString + "</name>" + "\n<Region>\n" + bbox.toKMLLatLonAltBox() + "\n<Lod><minLodPixels>128</minLodPixels>" + "\n<maxLodPixels>-1</maxLodPixels></Lod>" + "\n</Region>" + "\n<Link><href>" + url + "</href>" + "\n<viewRefreshMode>onRegion</viewRefreshMode>" + "\n</Link>" + "\n</NetworkLink>"; return xml; }
/** * Creates a network link to the first tile in the pyramid * * @param superString * @param bbox * @param url * @return */ private static String superOverlayNetworLink(String superString, BoundingBox bbox, String url) { String xml = "\n<NetworkLink><name>Super-overlay: " + superString + "</name>" + "\n<Region>\n" + bbox.toKMLLatLonAltBox() + "\n<Lod><minLodPixels>128</minLodPixels>" + "\n<maxLodPixels>-1</maxLodPixels></Lod>" + "\n</Region>" + "\n<Link><href>" + url + "</href>" + "\n<viewRefreshMode>onRegion</viewRefreshMode>" + "\n</Link>" + "\n</NetworkLink>"; return xml; }
/** * This creates the header for the overlay * * @param bbox * @return */ private static String createOverlayHeader(BoundingBox bbox, boolean setMaxLod) { int maxLodPixels = -1; if (setMaxLod) { maxLodPixels = 385; } return KMLHeader() + "<Document>\n" + "<Region>\n" + bbox.toKMLLatLonAltBox() + "<Lod><minLodPixels>128</minLodPixels>" + "<maxLodPixels>" + Integer.toString(maxLodPixels) + "</maxLodPixels></Lod>\n" + "</Region>\n"; }
/** * For KML features / vector data OR for the next level * * @param layer * @param urlStr * @param gridLoc * @param bbox * @param extension * @return */ private static String createNetworkLinkElement(TileLayer layer, BoundingBox bbox, String gridLocUrl, String tileIdx, int maxLodPixels, String refreshTags) { String xml = "\n<NetworkLink>" + "\n<name>" + layer.getName() + "</name>" + "\n<Region>" + bbox.toKMLLatLonAltBox() + "\n<Lod><minLodPixels>128</minLodPixels>" + "<maxLodPixels>" + Integer.toString(maxLodPixels) + "</maxLodPixels></Lod>\n" + "</Region>" + "\n<Link>" + "\n<href>" + gridLocUrl + "</href>" + refreshTags + "\n<viewRefreshMode>onRegion</viewRefreshMode>" + "\n</Link>" + "\n</NetworkLink>\n"; return xml; }
/** * This creates the header for the overlay * * @param bbox * @return */ private static String createOverlayHeader(BoundingBox bbox, boolean setMaxLod) { int maxLodPixels = -1; if (setMaxLod) { maxLodPixels = 385; } return KMLHeader() + "<Document>\n" + "<Region>\n" + bbox.toKMLLatLonAltBox() + "<Lod><minLodPixels>128</minLodPixels>" + "<maxLodPixels>" + Integer.toString(maxLodPixels) + "</maxLodPixels></Lod>\n" + "</Region>\n"; }
+ "</name>" + "\n<Region>" + bbox.toKMLLatLonAltBox() + "\n<Lod><minLodPixels>128</minLodPixels>" + "<maxLodPixels>"
public void test6gridLoctoBounds4326() throws Exception { BoundingBox bbox = new BoundingBox(-124.73, 24.96, -66.97, 49.37); GridSubset grid = GridSubsetFactory.createGridSubSet(gridSetBroker.getWorldEpsg4326(), bbox, 0, 10); long[] gridLoc1 = {1, 1, 1}; BoundingBox box1 = grid.boundsFromIndex(gridLoc1); boolean box1_comparison = box1.equals(new BoundingBox(-90.0, 0.0, 0.0, 90.0)); assertTrue(box1_comparison); boolean box1_kml = box1.toKMLLatLonBox() .equals( "<LatLonBox><north>90.0</north><south>0.0</south>" + "<east>0.0</east><west>-90.0</west></LatLonBox>"); assertTrue(box1_kml); long[] gridLoc2 = {5, 1, 2}; BoundingBox box2 = grid.boundsFromIndex(gridLoc2); boolean box2_comparison = box2.equals(new BoundingBox(45.0, -45.0, 90.0, 0.0)); assertTrue(box2_comparison); boolean box2_kml = box2.toKMLLatLonAltBox() .equals( "<LatLonAltBox><north>0.0</north><south>-45.0</south>" + "<east>90.0</east><west>45.0</west></LatLonAltBox>"); assertTrue(box2_kml); }