From: <bma...@us...> - 2008-06-27 15:16:15
|
Revision: 3661 http://fudaa.svn.sourceforge.net/fudaa/?rev=3661&view=rev Author: bmarchan Date: 2008-06-27 08:16:05 -0700 (Fri, 27 Jun 2008) Log Message: ----------- Chgt nom par defaut. Modified Paths: -------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2008-06-27 14:41:22 UTC (rev 3660) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2008-06-27 15:16:05 UTC (rev 3661) @@ -1,130 +1,130 @@ -/* - * @creation 7 avr. 2005 - * @modification $Date: 2008-03-28 14:58:56 $ - * @license GNU General Public License 2 - * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne - * @mail de...@fu... - */ -package org.fudaa.ctulu.gis; - -import java.util.ArrayList; -import java.util.List; - -import com.memoire.fu.FuLib; - -import org.fudaa.ctulu.CtuluLib; -import org.fudaa.ctulu.CtuluLibString; - -/** - * Des constantes pour les attributs associables \xE0 des objets GIS. Les attributs constants sont en - * principe des attributs programme (non construits par l'utilisateur). Dans ce cas, leur ID est - * ind\xE9pendant de la langue pour \xEAtre correctement sauv\xE9 dans les fichiers GML. - * - * @author Fred Deniger - * @version $Id: GISAttributeConstants.java,v 1.14.8.3 2008-03-28 14:58:56 bmarchan Exp $ - */ -public final class GISAttributeConstants { - - private GISAttributeConstants() { - - } - - public static String toString(final GISAttributeInterface _att) { - if (_att == TITRE || _att == BATHY) { - return _att.getID(); - } - final String attributeSep = getAttributeSep(); - return _att.getDataClass().getName() + attributeSep + FuLib.replace(_att.getName(), attributeSep, "_") - + attributeSep + CtuluLibString.toString(_att.isAtomicValue()); - } - - private static String getAttributeSep() { - return "|"; - } - - public static GISAttributeInterface getConstantAttribute(final String _saveName) { - if (TITRE.getID().equals(_saveName)) { - return TITRE; - } - if (BATHY.getID().equals(_saveName)) { - return BATHY; - } - return null; - } - - public static GISAttributeInterface restoreFrom(final String _s) { - GISAttributeInterface res = getConstantAttribute(_s); - if (res != null) { - return res; - } - final String[] s = CtuluLibString.parseString(_s, getAttributeSep()); - if (s == null || s.length != 3) { - return null; - } - final String clazz = s[0]; - final String name = s[1]; - final boolean atomic = CtuluLibString.toBoolean(s[2]); - if (clazz.equals(Double.class.getName())) { - res = new GISAttributeDouble(name, atomic); - if (BATHY.isSameContent(res)) { - res = BATHY; - } - } else if (clazz.equals(Integer.class.getName())) { - res = new GISAttributeInteger(name, atomic); - } else { - res = new GISAttributeString(name, atomic); - if (TITRE.isSameContent(res)) { - res = TITRE; - } - } - - return res; - } - - public static List getDefaults() { - final ArrayList l = new ArrayList(2); - l.add(BATHY); - l.add(TITRE); - return l; - } - - public static boolean isConstant(final GISAttributeInterface _att) { - return _att == TITRE || _att == BATHY; - } - - /** - * Un attribut nom, non atomique. - */ - public final static GISAttributeString TITRE = new GISAttributeString(CtuluLib.getS("Nom")) { - - String def_ = CtuluLib.getS("Nouveau"); - - protected Object readResolve() { - return TITRE; - } - - public String getID() { - return "ATTRIBUTE_TITLE"; - } - - public Object getDefaultValue() { - return def_; - } - }; - - /** - * Un attribut bathy, atomique. - */ - public final static GISAttributeDouble BATHY = new GISAttributeDouble(CtuluLib.getS("z"), true) { - - protected Object readResolve() { - return BATHY; - } - - public String getID() { - return "ATTRIBUTE_Z"; - } - - }; - -} +/* + * @creation 7 avr. 2005 + * @modification $Date: 2008-03-28 14:58:56 $ + * @license GNU General Public License 2 + * @copyright (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne + * @mail de...@fu... + */ +package org.fudaa.ctulu.gis; + +import java.util.ArrayList; +import java.util.List; + +import com.memoire.fu.FuLib; + +import org.fudaa.ctulu.CtuluLib; +import org.fudaa.ctulu.CtuluLibString; + +/** + * Des constantes pour les attributs associables \xE0 des objets GIS. Les attributs constants sont en + * principe des attributs programme (non construits par l'utilisateur). Dans ce cas, leur ID est + * ind\xE9pendant de la langue pour \xEAtre correctement sauv\xE9 dans les fichiers GML. + * + * @author Fred Deniger + * @version $Id: GISAttributeConstants.java,v 1.14.8.3 2008-03-28 14:58:56 bmarchan Exp $ + */ +public final class GISAttributeConstants { + + private GISAttributeConstants() { + + } + + public static String toString(final GISAttributeInterface _att) { + if (_att == TITRE || _att == BATHY) { + return _att.getID(); + } + final String attributeSep = getAttributeSep(); + return _att.getDataClass().getName() + attributeSep + FuLib.replace(_att.getName(), attributeSep, "_") + + attributeSep + CtuluLibString.toString(_att.isAtomicValue()); + } + + private static String getAttributeSep() { + return "|"; + } + + public static GISAttributeInterface getConstantAttribute(final String _saveName) { + if (TITRE.getID().equals(_saveName)) { + return TITRE; + } + if (BATHY.getID().equals(_saveName)) { + return BATHY; + } + return null; + } + + public static GISAttributeInterface restoreFrom(final String _s) { + GISAttributeInterface res = getConstantAttribute(_s); + if (res != null) { + return res; + } + final String[] s = CtuluLibString.parseString(_s, getAttributeSep()); + if (s == null || s.length != 3) { + return null; + } + final String clazz = s[0]; + final String name = s[1]; + final boolean atomic = CtuluLibString.toBoolean(s[2]); + if (clazz.equals(Double.class.getName())) { + res = new GISAttributeDouble(name, atomic); + if (BATHY.isSameContent(res)) { + res = BATHY; + } + } else if (clazz.equals(Integer.class.getName())) { + res = new GISAttributeInteger(name, atomic); + } else { + res = new GISAttributeString(name, atomic); + if (TITRE.isSameContent(res)) { + res = TITRE; + } + } + + return res; + } + + public static List getDefaults() { + final ArrayList l = new ArrayList(2); + l.add(BATHY); + l.add(TITRE); + return l; + } + + public static boolean isConstant(final GISAttributeInterface _att) { + return _att == TITRE || _att == BATHY; + } + + /** + * Un attribut nom, non atomique. + */ + public final static GISAttributeString TITRE = new GISAttributeString(CtuluLib.getS("Nom")) { + + String def_ = CtuluLib.getS("_Nouveau"); + + protected Object readResolve() { + return TITRE; + } + + public String getID() { + return "ATTRIBUTE_TITLE"; + } + + public Object getDefaultValue() { + return def_; + } + }; + + /** + * Un attribut bathy, atomique. + */ + public final static GISAttributeDouble BATHY = new GISAttributeDouble(CtuluLib.getS("z"), true) { + + protected Object readResolve() { + return BATHY; + } + + public String getID() { + return "ATTRIBUTE_Z"; + } + + }; + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bma...@us...> - 2008-07-09 16:21:29
|
Revision: 3677 http://fudaa.svn.sourceforge.net/fudaa/?rev=3677&view=rev Author: bmarchan Date: 2008-07-09 09:21:37 -0700 (Wed, 09 Jul 2008) Log Message: ----------- Ajout de l'attribut Nature Modified Paths: -------------- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java Modified: branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java =================================================================== --- branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2008-07-09 16:20:58 UTC (rev 3676) +++ branches/Br_FudaaModeleur_TF/fudaa_devel/ctulu/src/org/fudaa/ctulu/gis/GISAttributeConstants.java 2008-07-09 16:21:37 UTC (rev 3677) @@ -30,7 +30,7 @@ } public static String toString(final GISAttributeInterface _att) { - if (_att == TITRE || _att == BATHY) { + if (_att == TITRE || _att == BATHY || _att == NATURE) { return _att.getID(); } final String attributeSep = getAttributeSep(); @@ -49,6 +49,9 @@ if (BATHY.getID().equals(_saveName)) { return BATHY; } + if (NATURE.getID().equals(_saveName)) { + return NATURE; + } return null; } @@ -76,6 +79,9 @@ if (TITRE.isSameContent(res)) { res = TITRE; } + else if (NATURE.isSameContent(res)) { + res = NATURE; + } } return res; @@ -85,11 +91,12 @@ final ArrayList l = new ArrayList(2); l.add(BATHY); l.add(TITRE); + l.add(NATURE); return l; } public static boolean isConstant(final GISAttributeInterface _att) { - return _att == TITRE || _att == BATHY; + return _att == TITRE || _att == BATHY || _att == NATURE; } /** @@ -100,10 +107,6 @@ private int numid_=0; String def_ = CtuluLib.getS("<Defaut>"); - protected Object readResolve() { - return TITRE; - } - public String getID() { return "ATTRIBUTE_TITLE"; } @@ -125,14 +128,23 @@ }; /** + * Un attribut nature, global. + */ + public final static GISAttributeString NATURE = new GISAttributeString(CtuluLib.getS("Nature"), false) { + public String getID() { + return "ATTRIBUTE_NATURE"; + } + + public boolean isEditable() { + return false; + } + }; + + /** * Un attribut bathy, atomique. */ public final static GISAttributeDouble BATHY = new GISAttributeDouble(CtuluLib.getS("z"), true) { - protected Object readResolve() { - return BATHY; - } - public String getID() { return "ATTRIBUTE_Z"; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |