001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2002-2006, GeoTools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation;
009: * version 2.1 of the License.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.styling;
017:
018: import org.geotools.factory.CommonFactoryFinder;
019: import org.geotools.factory.GeoTools;
020: import org.opengis.filter.FilterFactory;
021: import org.opengis.filter.expression.Expression;
022:
023: /**
024: * DOCUMENT ME!
025: *
026: * @author iant
027: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/library/main/src/main/java/org/geotools/styling/TextMarkImpl.java $
028: */
029: public class TextMarkImpl extends MarkImpl implements TextMark {
030: /** The logger for the default core module. */
031:
032: //private static final Logger LOGGER = org.geotools.util.logging.Logging.getLogger("org.geotools.core");
033: private FilterFactory filterFactory;
034: private Expression wellKnownName = null;
035: private java.util.List fonts = new java.util.ArrayList();
036: private Expression symbol;
037:
038: public TextMarkImpl() {
039: this (CommonFactoryFinder.getFilterFactory(GeoTools
040: .getDefaultHints()));
041: }
042:
043: public TextMarkImpl(FilterFactory factory) {
044: filterFactory = factory;
045: }
046:
047: /**
048: * Creates a new instance of TextMark
049: *
050: * @param font DOCUMENT ME!
051: * @param symbol DOCUMENT ME!
052: */
053: public TextMarkImpl(Font font, String symbol) {
054: this (CommonFactoryFinder.getFilterFactory(GeoTools
055: .getDefaultHints()));
056: addFont(font);
057: setSymbol(symbol);
058: wellKnownName = filterFactory.literal("Symbol");
059: }
060:
061: public TextMarkImpl(Font font, Expression symbol) {
062: this (CommonFactoryFinder.getFilterFactory(GeoTools
063: .getDefaultHints()));
064: addFont(font);
065: setSymbol(symbol);
066: wellKnownName = filterFactory.literal("Symbol");
067: }
068:
069: /**
070: * This parameter gives the well-known name of the symbol of the mark.<br>
071: *
072: * @return The well-known name of this symbol
073: */
074: public Expression getWellKnownName() {
075: return wellKnownName;
076: }
077:
078: /**
079: * Getter for property font.
080: *
081: * @return Value of property font.
082: */
083: public org.geotools.styling.Font[] getFonts() {
084: return (Font[]) fonts.toArray(new Font[0]);
085: }
086:
087: /**
088: * Setter for property font.
089: *
090: * @param font New value of property font.
091: */
092: public void addFont(org.geotools.styling.Font font) {
093: this .fonts.add(font);
094: }
095:
096: /**
097: * Getter for property symbol.
098: *
099: * @return Value of property symbol.
100: */
101: public Expression getSymbol() {
102: return symbol;
103: }
104:
105: /**
106: * Setter for property symbol.
107: *
108: * @param symbol New value of property symbol.
109: */
110: public void setSymbol(java.lang.String symbol) {
111: setSymbol(filterFactory.literal(symbol));
112: }
113:
114: public void setSymbol(Expression symbol) {
115: Expression old = this .symbol;
116: this .symbol = symbol;
117: fireChildChanged("symbol", symbol, old);
118: }
119:
120: /**
121: * Setter for property wellKnownName.
122: *
123: * @param wellKnownName New value of property wellKnownName.
124: */
125: public void setWellKnownName(Expression wellKnownName) {
126: // this is really blank the name is always symbol
127: }
128:
129: public void accept(StyleVisitor visitor) {
130: visitor.visit(this);
131: }
132: }
|