Package org.geotools.data.ows

Examples of org.geotools.data.ows.StyleImpl


            getmap.setProperty(GetMapRequest.FORMAT, "image/jpeg"); //$NON-NLS-1$
        } else if (formats.contains("image/bmp")) { //$NON-NLS-1$
            getmap.setProperty(GetMapRequest.FORMAT, "image/bmp"); //$NON-NLS-1$
        }
       
        StyleImpl wmsStyle = (StyleImpl) layer.getStyleBlackboard().get(WMSStyleContent.WMSSTYLE);
        if (wmsStyle != null) {
            getmap.setProperty(GetMapRequest.STYLES, wmsStyle.getName());
        }
        else {
            // supply an empty String as per UDIG-1507
            getmap.setProperty(GetMapRequest.STYLES, "");
        }
View Full Code Here


        Map<String,StyleImpl> nameMap = new HashMap<String, StyleImpl>();

        // calculate display names for all styles
        // If there are duplicate titles then a combo title(name) is displayed
        for (Object s : allStyles) {
            StyleImpl wmsStyle =
                (StyleImpl) s;
            String name = getDisplayName(wmsStyle);
            if( nameMap.containsKey(name) ){
                // rename the old one and mark it as deleted
                StyleImpl oldStyle = nameMap.get(name);
                if( oldStyle!=null){
                    nameMap.put(name, null);
                    String oldStyleName = name + " ("+oldStyle.getName()+")"; //$NON-NLS-1$ //$NON-NLS-2$
                    nameMap.put(oldStyleName, oldStyle);
                }
                name = name + " ("+wmsStyle.getName()+")"; //$NON-NLS-1$ //$NON-NLS-2$
            }
            // if the key is still used then we will use the first instance only.  If
            // there are two definitions of the same name and title then there isn't any
            // more we can be expected to do
            if( !nameMap.containsKey(name) ){
                nameMap.put(name, wmsStyle);
            }
        }
       
        for( Entry<String, StyleImpl> entry : nameMap.entrySet() ) {
            if( entry.getValue()!=null) {
                styleCombo.add(entry.getKey());
                styles.add(entry.getValue());
            }
        }
    //look for a value to set the combo to on the blackboard
    StyleImpl style =
      (StyleImpl) layer.getStyleBlackboard().get(WMSStyleContent.WMSSTYLE);
    boolean set=false;
        if (style != null) {
            for( int i=0; i<styles.size(); i++) {
                StyleImpl wmsStyle = (StyleImpl) styles.get(i);
                if( style.equals(wmsStyle) ){
                    set=true;
                    styleCombo.select(i);
                    setDetails(wmsStyle);
                    break;
View Full Code Here

      new SelectionListener() {

        public void widgetSelected(SelectionEvent e) {
          int i = styleCombo.getSelectionIndex();
          if (i > -1) {
                        StyleImpl wmsStyle =
                            (StyleImpl) styles.get(i);
            StyleBlackboard bb = getLayer().getStyleBlackboard();
            bb.put(WMSStyleContent.WMSSTYLE, wmsStyle);
                        bb.setSelected(new String[]{WMSStyleContent.WMSSTYLE});
                        setDetails(wmsStyle);
View Full Code Here

    return StyleImpl.class;
  }

  @Override
  public void save(IMemento memento, Object value) {
        StyleImpl style = (StyleImpl)value;
    memento.putString("value", style.getName()); //$NON-NLS-1$
  }
View Full Code Here

    memento.putString("value", style.getName()); //$NON-NLS-1$
  }

  @Override
  public Object load(IMemento memento) {
    return new StyleImpl(memento.getString("value")); //$NON-NLS-1$
  }
View Full Code Here

            Object next=iter.next();
            if( next instanceof String ){
                String style=(String)next;
                first=writeStyle(style, style, first, out);
            }else if( next instanceof StyleImpl ){
                StyleImpl style=(StyleImpl)next;
                writeStyle(style.getName(), style.getTitle().toString(), first, out);
            }
        }
        append(6, out, "</StyleList>"); //$NON-NLS-1$
        append( 4, out, "</Layer>" );                 //$NON-NLS-1$
    }
View Full Code Here

        if (currentLayer.isType(WebMapServer.class)) { // checking for wms

            List<String> l = new LinkedList<String>();
            try {
              for (Iterator<StyleImpl> iterator = currentLayer.getResource(org.geotools.data.ows.Layer.class, null).getStyles().iterator(); iterator.hasNext();) {
                StyleImpl style = (StyleImpl) iterator.next();
                l.add(style.getName());
        }
            } catch (IOException e) {
                ProjectPlugin.log(null, e);
            }
            l.add(Messages.Styling_default);
View Full Code Here

                    maxScale = rule.getMaxScaleDenominator();
                }

                if (currScale >= minScale && currScale <= maxScale) {
                    // check for a wms style
                    StyleImpl wmsStyle = (StyleImpl) ilayer.getStyleBlackboard().get(
                            WMSStyleContent.WMSSTYLE);
                    if (wmsStyle != null) {
                        request.addLayer(layer, wmsStyle);
                    } else {
                        request.addLayer(layer);
View Full Code Here

     *      java.util.Map)
     */
    public Object getValue(Element element, ElementValue[] value,
        Attributes attrs, Map hints) throws SAXException,
        OperationNotSupportedException {
      StyleImpl style = new StyleImpl();
      List legendURLS = new ArrayList();
     
      for (int i = 0; i < value.length; i++) {
       
        if (sameName(elems[0], value[i])) {
          String name = (String) value[i].getValue();
          style.setName(name);
        }
       
        if (sameName(elems[1], value[i])) {
          String title = (String) value[i].getValue();
          style.setTitle(new SimpleInternationalString(title));
        }
       
        if (sameName(elems[2], value[i])) {
          String _abstract = (String) value[i].getValue();
          style.setAbstract(new SimpleInternationalString(_abstract));
        }
       
        if (sameName(elems[3], value[i])) {
          legendURLS.add((String)value[i].getValue());
        }
       
        if (sameName(elems[4], value[i])) {
          //TODO Implement StyleSheet URL
        }
       
        if (sameName(elems[5], value[i])) {
          //TODO implement StyleURL
        }
      }
      style.setLegendURLs(legendURLS);
      return style;
    }
View Full Code Here

            assertEquals(bbox.getMaxX(), 269400.0, 0.0);
            assertEquals(bbox.getMaxY(), 2048600.0, 0.0);
           
            // Changed expected value, no duplicates allowed by spec
            assertEquals(layer.getStyles().size(), 18);
            assertTrue(layer.getStyles().contains(new StyleImpl("UTMGrid")));
            assertTrue(layer.getStyles().contains(new StyleImpl("GeoGrid_Cyan")));
            assertTrue(layer.getStyles().contains(new StyleImpl("GeoGrid_Black")));
            assertTrue(layer.getStyles().contains(new StyleImpl("GeoGrid_Gray")));
            assertTrue(layer.getStyles().contains(new StyleImpl("GeoGrid_White")));
           
            StyleImpl utmGrid = (StyleImpl) layer.getStyles().get(0);
            assertEquals(utmGrid.getName(), "UTMGrid");
            assertEquals(utmGrid.getAbstract().toString(), "Display grid lines in Goldenrod on the DOQ image");
            assertEquals(utmGrid.getTitle().toString(), "Goldedrod Grid Lines on UTM coordinates");
           
            assertFalse(layer.isQueryable());
           
            // Added test to verify inheritance, should be same as previous llbbox
            validateBoundingBox(layer.getLatLonBoundingBox(),
View Full Code Here

TOP

Related Classes of org.geotools.data.ows.StyleImpl

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.