/* * GeoTools - The Open Source Java GIS Toolkit * http://geotools.org * * (C) 2002-2008, Open Source Geospatial Foundation (OSGeo) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. */ package org.geotools.gui.swing.style.sld; import org.geotools.map.MapLayer; import org.geotools.styling.StyleBuilder; import org.opengis.filter.expression.Expression; /** * Degree panel * * @author Johann Sorel * * @source $URL$ */ public class JDegreePane extends javax.swing.JPanel { /** * Creates new form JDegreePanel */ public JDegreePane() { initComponents(); init(); } private void init(){ // clock.setPan(this); exptxt.setType(JExpressionPane.EXP_TYPE.NUMBER); } /** * * @param exp the default expression */ public void setExpression(Expression exp) { exptxt.setExpression(exp); try { // clock.setDegree(Double.valueOf(exp.toString())); } catch (Exception e) { } } /** * * @return Expression : new Expression */ public Expression getExpression() { return exptxt.getExpression(); } void update() { StyleBuilder sb = new StyleBuilder(); // int val = (int) Math.round(clock.getDegree()); // // exptxt.setExpression(sb.literalExpression(val)); } /** * * @param layer the layer to edit */ public void setLayer(MapLayer layer){ exptxt.setLayer(layer); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { exptxt = new org.geotools.gui.swing.style.sld.JExpressionPane(); setMaximumSize(new java.awt.Dimension(100, 40)); setMinimumSize(new java.awt.Dimension(100, 40)); setPreferredSize(new java.awt.Dimension(100, 40)); add(exptxt); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables private org.geotools.gui.swing.style.sld.JExpressionPane exptxt; // End of variables declaration//GEN-END:variables }