Package org.geoserver.wms

Examples of org.geoserver.wms.WMS


    protected void setUpInternal() throws Exception {
        super.setUpInternal();

        dispatcher = (Dispatcher) applicationContext.getBean("dispatcher");
        WMS wms = new WMS(getGeoServer());
        reader = new GetMapKvpRequestReader(wms);
    }
View Full Code Here


        Color oldColor = g2d.getColor();
        AffineTransform oldTransform = (AffineTransform)g2d.getTransform().clone();
        Font oldFont = g2d.getFont();
        Stroke oldStroke = g2d.getStroke();
        g2d.translate(paintArea.getX(), paintArea.getY());
        final WMS wms = mapContext.getRequest().getWMS();

        AffineTransform tx = new AffineTransform();

        FontMetrics metrics = g2d.getFontMetrics(g2d.getFont().deriveFont(Font.BOLD));
View Full Code Here

  private Map<String, String> params;

  protected void setUp() throws Exception {
    geoServerImpl = new GeoServerImpl();
    geoServerImpl.add(new WMSInfoImpl());
    wms = new WMS(geoServerImpl);
    request = new MockHttpServletRequest();
    params = new HashMap<String, String>();
  }
View Full Code Here

     * @return
     */
    GetMapRequest getRequest() {
        if (request == null) {
            GeoServerApplication app = GeoServerApplication.get();
            request = new GetMapRequest(new WMS(app.getGeoServer()));
            Catalog catalog = app.getCatalog();
            List<MapLayerInfo> layers = expandLayers(catalog);
            request.setLayers(layers.toArray(new MapLayerInfo[layers.size()]));
            request.setFormat("application/openlayers");
           
View Full Code Here

            throw new IllegalArgumentException("Not a GetCapabilities Request");
        }
       
        //UpdateSequence handling for WMS:  see WMS 1.1.1 page 23
        final WMSCapabilitiesRequest capreq = (WMSCapabilitiesRequest)request;
        final WMS wmsConfig = capreq.getWMS();
       
        long reqUS = -1;
        if (capreq.getUpdateSequence() != null && !"".equals(capreq.getUpdateSequence().trim())) {
          try {
            reqUS = Long.parseLong(capreq.getUpdateSequence());
          } catch (NumberFormatException nfe) {
            throw new ServiceException("GeoServer only accepts numbers in the updateSequence parameter");
          }
        }
        long geoUS = wmsConfig.getUpdateSequence();
      if (reqUS > geoUS) {
        throw new org.geoserver.platform.ServiceException("Client supplied an updateSequence that is greater than the current sever updateSequence","InvalidUpdateSequence");
      }
      if (reqUS == geoUS) {
        throw new org.geoserver.platform.ServiceException("WMS capabilities document is current (updateSequence = " + geoUS + ")","CurrentUpdateSequence");
      }
      //otherwise it's a normal response...
       

        Set<String> legendFormats = GetLegendGraphicResponse.getFormats();
        WMSCapsTransformer transformer = new WMSCapsTransformer(request.getBaseUrl(), mapFormats, legendFormats);

        // if (request.getWFS().getGeoServer().isVerbose()) {
        transformer.setIndentation(2);
        final WMS wms = (WMS)applicationContext.getBean("wms");
        final Charset encoding = wms.getCharSet();
        transformer.setEncoding(encoding);

        // }
        ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

     */
  public void produceMap() throws WmsException {
    transformer = new KMLTransformer();
    transformer.setKmz(true);
     GetMapRequest request = mapContext.getRequest();
     WMS wms = request.getWMS();
     Charset encoding = wms.getCharSet();
     transformer.setEncoding(encoding);
    // TODO: use GeoServer.isVerbose() to determine if we should indent?
    transformer.setIndentation(3);
  }
View Full Code Here

            if (null == layerName) {
                throw new WmsException("A UserLayer without layer name was passed");
            }

            final WMS wms = request.getWMS();
           
            if (sl instanceof UserLayer && ((((UserLayer) sl)).getRemoteOWS() != null)) {
                // this beast can define multiple feature sources and multiple styles, we'll
                // have to mix and match them (ugh)
                ul = ((UserLayer) sl);
                try {
                    addRemoteLayersFromUserLayer(request, ul, layers, styles);
                } catch (IOException e) {
                    throw new WmsException("Error accessing remote layers", "RemoteAccessFailed", e);
                }
            } else {
                // simpler case, one layer, eventually multiple styles
                currLayer = null;
                // handle the InLineFeature stuff
                if ((sl instanceof UserLayer)
                        && ((((UserLayer) sl)).getInlineFeatureDatastore() != null)) {
                    // SPECIAL CASE - we make the temporary version
                    ul = ((UserLayer) sl);

                    try {
                       currLayer =  initializeInlineFeatureLayer(request, ul);
                    } catch (Exception e) {
                        throw new WmsException(e);
                    }
                } else {
                    if(wms.getLayerGroupByName(layerName) != null) {
                        LayerGroupInfo group = wms.getLayerGroupByName(layerName);
                        for(int i = 0; i < group.getLayers().size(); i++) {
                            LayerInfo layer = group.getLayers().get(i);
                            layers.add(new MapLayerInfo(layer));
                            StyleInfo style = group.getStyles().get(i);
                            if(style != null) {
                                styles.add(style.getStyle());
                            } else {
                                styles.add(layer.getDefaultStyle().getStyle());
                            }
                        }
                        // move to the next named layer
                        continue;
                    } else {
                        LayerInfo layerInfo = wms.getLayerByName(layerName);
                       
                        if(layerInfo == null)
                            throw new WmsException("Unknown layer: " + layerName);
                       
                        currLayer = new MapLayerInfo(layerInfo);
View Full Code Here

            layout = tiled
            ? new MetatiledMapDecorationLayout()
            : new MapDecorationLayout();
        }

        WMS wms = mapContext.getRequest().getWMS();

        if (wms != null){
            MapDecorationLayout.Block watermark =
                getWatermark(mapContext.getRequest().getWMS().getServiceInfo());
            if (watermark != null) layout.addBlock(watermark);
View Full Code Here

        assertEquals("acme:bar", data.getLayers().get(1));
    }
   
    @Test
    public void testWMSGetLegendGraphic() throws Exception {
        WMS wms = new WMS(createMock(GeoServer.class));
        GetLegendGraphicRequest glg = new GetLegendGraphicRequest();
       
        FeatureType type = createMock(FeatureType.class);
        expect(type.getName()).andReturn(new NameImpl("http://acme.org", "foo")).anyTimes();
        replay(type);
View Full Code Here

     * @see KMLNetworkLinkTransformer#setEncodeAsRegion(boolean)
     */
    public void testEncodeAsRegion() throws Exception {
        XpathEngine xpath = XMLUnit.newXpathEngine();

        WMS wms = mockData.getWMS();
        KMLNetworkLinkTransformer transformer = new KMLNetworkLinkTransformer(wms);
        transformer.setEncodeAsRegion(true);
        transformer.setIndentation(2);

        request.setBbox(new Envelope(-1, 1, -10, 10));
View Full Code Here

TOP

Related Classes of org.geoserver.wms.WMS

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.