Package slash.navigation.kml.binding20

Examples of slash.navigation.kml.binding20.NetworkLink


           
            return folder;
        }
       
        private void encodeSequentialNetworkLink(Folder folder, String linkbase, int start, int maxFeatures, String id, String readableName) {
            NetworkLink nl = folder.createAndAddNetworkLink();
            Link link = nl.createAndSetLink();
            link.setHref(linkbase + "?startindex=" + start + "&maxfeatures=" + maxFeatures);
            nl.setDescription(readableName);
            nl.setId(id);
        }
View Full Code Here


            }
        }
    }

    public void encodeGWCLink(Document container, GetMapRequest request, MapLayerInfo layer) {
        NetworkLink nl = container.createAndAddNetworkLink();
        String prefixedName = layer.getResource().prefixedName();
        nl.setName("GWC-" + prefixedName);
        Link link = nl.createAndSetLink();
        String type = layer.getType() == MapLayerInfo.TYPE_RASTER ? "png" : "kml";
        String url = ResponseUtils.buildURL(request.getBaseUrl(), "gwc/service/kml/" + prefixedName
                + "." + type + ".kml", null, URLType.SERVICE);
        link.setHref(url);
        link.setViewRefreshMode(ViewRefreshMode.NEVER);
View Full Code Here

        String overlayMode = context.getSuperOverlayMode();
        if (!"raster".equals(overlayMode) && layer instanceof FeatureLayer && !shouldDrawVectorLayer(layer, box)) {
            return;
        }

        NetworkLink nl = container.createAndAddNetworkLink();
        nl.setName(name);
        addRegion(nl, box, 128, -1);
        Link link = nl.createAndSetLink();
        String getMap = WMSRequests.getGetMapUrl(request, layer, 0, box, new String[] { "format",
                KMLMapOutputFormat.MIME_TYPE, "width", "256", "height", "256", "format", NetworkLinkMapOutputFormat.KML_MIME_TYPE  });
        link.setHref(getMap);
        LOGGER.fine("Network link " + name + ":" + getMap);
        link.setViewRefreshMode(ViewRefreshMode.ON_REGION);
View Full Code Here

        }
        String foEncoded = WMSRequests.encodeFormatOptions(fo);

        // encode the link
        NetworkLink nl = container.createAndAddNetworkLink();
        nl.setName(name);
        addRegion(nl, box, 128, -1);
        nl.setVisibility(true);
        Link link = nl.createAndSetLink();
        String url = WMSRequests.getGetMapUrl(request, layer, 0, box, new String[] { "width",
                "256", "height", "256", "format_options", foEncoded, "superoverlay", "true"});
        link.setHref(url);
    }
View Full Code Here

        final List<MapLayerInfo> layers = request.getLayers();
        final List<Style> styles = request.getStyles();
        for (int i = 0; i < layers.size(); i++) {
            MapLayerInfo layerInfo = layers.get(i);
            NetworkLink nl = container.createAndAddNetworkLink();
            nl.setName(layerInfo.getName());
            nl.setVisibility(true);
            nl.setOpen(true);

            // look at for this layer
            Envelope requestBox = context.getRequestBoxWGS84();
           
            if (requestBox != null) {
                LookAt la = lookAtFactory.buildLookAt(requestBox, lookAtOptions, false);
                nl.setAbstractView(la);
            }

            // set bbox to null so its not included in the request, google
            // earth will append it for us
            GetMapRequest requestCopy = (GetMapRequest) request.clone();
            requestCopy.setBbox(null);

            String style = i < styles.size() ? styles.get(i).getName() : null;
            String href = WMSRequests.getGetMapUrl(requestCopy, layers.get(i).getName(), i, style,
                    null, null);
            try {
                // WMSRequests.getGetMapUrl returns a URL encoded query string, but GoogleEarth
                // 6 doesn't like URL encoded parameters. See GEOS-4483
                href = URLDecoder.decode(href, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            }

            Link url = nl.createAndSetUrl();
            url.setHref(href);
            url.setViewRefreshMode(ViewRefreshMode.ON_STOP);
            url.setViewRefreshTime(1);
            url.setViewBoundScale(1);
        }
View Full Code Here

public class KmlFormatIT {
    @Test
    public void testReader() throws FileNotFoundException, JAXBException {
        Reader reader = new FileReader(TEST_PATH + "from20.kml");
        Kml kml = (Kml) newUnmarshaller20().unmarshal(reader);
        assertNotNull(kml);
        assertNotNull(kml.getFolder());
        assertEquals(3, kml.getFolder().getDocumentOrFolderOrGroundOverlay().size());
    }
View Full Code Here

    }

    @Test
    public void testInputStream() throws FileNotFoundException, JAXBException {
        InputStream in = new FileInputStream(TEST_PATH + "from20.kml");
        Kml kml = (Kml) newUnmarshaller20().unmarshal(in);
        assertNotNull(kml);
        assertNotNull(kml.getFolder());
        assertEquals(3, kml.getFolder().getDocumentOrFolderOrGroundOverlay().size());
    }
View Full Code Here

    }

    @Test
    public void testUnmarshal20() throws IOException, JAXBException {
        Reader reader = new FileReader(TEST_PATH + "from20.kml");
        Kml kml = unmarshal20(reader);
        assertNotNull(kml);
        assertNotNull(kml.getFolder());
        assertEquals(3, kml.getFolder().getDocumentOrFolderOrGroundOverlay().size());
    }
View Full Code Here

TOP

Related Classes of slash.navigation.kml.binding20.NetworkLink

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.